npm package: @minkainc/sdk
Description: Minka-sdk for client integration to API
Author: Andres Rengifo
Latest version: 0.1.13

# README #

## Minka SDK ##

Minka Banking as a service SDK

Version v0.1.8

### What is this repository for? ###

The purpose of Minka SDK is to connect with Minka REST-API.

### How do I get set up? ###

* Installation

```
$ npm install @minkainc/sdk --save
```

* Usage

```javascript
const minka = require("@minkainc/sdk")
const initData = {
  API_KEY: "API_KEY",
  url: "https://api.minka.io"
};
minka.init(initData);
```

### endpoints ###

* /person
* /org
* /gateway
* /transfer
* /contract
* /item
* /lukatag

### person ###

* Create a person
```javascript
let personData = {
  lukatag: "@person",
  name: "test",
  first: "legaltest",
  last: "description",
  gender: "testlogo",
  avatar: "unodostres",
  locations: [
    {
      city: "gohtam",
      country: "dc comics",
      countryCode: "DC",
      region: "test",
      state: "test",
      street: "street test"
    }
  ],
  contacts: [
    {
      type: "testa",
      value: "testa",
      isVerified: "testa"
    }
  ],
  identification: [
    {
      numberId: "12323234",
      typeId: "CC",
      dateIssue: "123123",
      verified: true,
      locationIssue: "123232"
    }
  ],
  terms: [
    {
      version: "cxvccx",
      dateConfirmed: "12233",
      channel: "12312",
      verified: "123232"
    }
  ]
};
minka.person.create(data)
 .then((body) => console.log(body))
```
* Retrieve a person
```javascript
minka.person.read(lukatag)
 .then((body) => console.log(body))
```
* Retrieve all persons
```javascript
minka.person.list(sandToken)
 .then((body) => console.log(body))
```
* Retrieve balance of a person
```javascript
minka.person.balance(lukatag)
 .then((body) => console.log(body))
```
* Retrieve balance of a person
```javascript
minka.person.delet3(lukatag)
 .then((body) => console.log(body))
```

### org ###
* Create an org
```javascript
let data = {
  lukatag: "@orpes",
  name: "test",
  legalName: "legaltest",
  description: "description",
  logo: "testlogo",
  website: "http://www.test.com",
  isVerified: true,
  city: "gohtam",
  country: "dc comics",
  countryCode: "DC",
  street: "st 1",
  isVerified: true,
  type: "phone",
  value: "12432534546",
  isVerified: true,
  categories: [
    {
      sector: "testa",
      industryGroup: "testa",
      industry: "testa",
      subIndustry: "testa"
    }
  ],
  terms: [
    {
      version: "cxvccx",
      dateConfirmed: "",
      channel: "12312",
      verified: "123232"
    }
  ]
};
minka.org.create(data)
 .then((body) => console.log(body))
```
* Retrieve an org
```javascript
minka.org.read(lukatag)
 .then((body) => console.log(body))
```
* Retrieve all orgs
```javascript
minka.org.list(sandToken)
 .then((body) => console.log(body))
```
* Retrieve balance of an org
```javascript
minka.org.balance(lukatag)
 .then((body) => console.log(body))
```
* d\elete an org
```javascript
minka.org.delet3(lukatag)
 .then((body) => console.log(body))
```

### transfer ###
* create a transfer
```javascript
let dataTransfer = {
  destination: "@batman1",
  source: "@lco",
  currency: "LCO",
  value: "100",
  charges: {
    txt: "test"
  },
  metadata: {
    description: "test",
    des: "test"
  }
};
minka.transfer.create(dataTransfer, token)
  .then((body) => console.log(body))
```
* retrieve transfers by lukatag
```javascript
minka.transfer.read(lukatag)
  .then((body) => console.log(body))
```
* authorize a transfer
```javascript
minka.transfer.auth(id, token)
  .then((body) => console.log(body))
```

### item ###
* create an item
```javascript
let dataItem = {
  org: "59f8dc679d457a7e5f2d863f",
  amount: {
    value: "100",
    currency: "LCO"
  },
  charges: [
    {
      org: "59f8dc679d457a7e5f2d863f",
      amount: {
        value: "100",
        currency: "LCO"
      },
      metadata: {
        type: "testing",
        country: "test"
      }
    }
  ],
  categories: [
    {
      sector: "test",
      industryGroup: "test",
      industry: "test",
      subIndustry: "test"
    }
  ],
  references: [],
  metadata: {
    type: "TOPUP0",
  }
};
minka.item.create(dataItem)
  .then(body => console.log(body));
```
* retrieve an item
```javascript
minka.item.read(itemId)
  .then((body) => console.log(body))
```
* retrieve all items
```javascript
minka.item.list(sandToken)
 .then((body) => console.log(body))
```
* delete an item
```javascript
minka.item.delet3(itemId)
 .then((body) => console.log(body))
```

### contract ###
* create a contract
```javascript
let dataCon = {
  item: "59fbee3689767e1ae138bc3b",
  person: "59fbb331a81566198dfa215f",
  metadata: {
    data: "test"
  }
};
minka.contract.create(dataCon)
  .then(body => console.log(body));
```
* retrieve a contract
```javascript
minka.contract.read(contractId)
  .then(body => console.log(body));
```
* retrieve all contracts
```javascript
minka.contract.list(sandToken)
  .then((body) => console.log(body))
```
* delete a contract
```javascript
minka.contract.delet3(contractId)
  .then(body => console.log(body));
```
### gateway ###
* create a gateway
```javascript
let dataGate = {
  name: "testing",
  lukatag: "@gatema",
  admin: "59fbb331a81566198dfa215f",
  parameters: {
    something: "test",
    test: "test"
  }
};
minka.gateway.create(dataGate)
  .then(body => console.log(body));
```
* retrieve a gateway
```javascript
minka.gateway.read(gateId)
  .then(body => console.log(body));
```
* delete a gateway
```javascript
minka.gateway.delet3(gateId)
  .then(body => console.log(body));
```