@classapp-tech/iugu-node-integration
v1.0.1
Published
Unofficial Iugu library for NodeJS
Downloads
1,255
Readme
@classapp-tech/iugu-node-integration
Installation
Use the package manager node to install.
npm install @classapp-tech/iugu-node-integration
Usage
Initialize the sdk using you API key, previously generated:
import Iugu, { IuguCustomer } from 'iugu-node-sdk'
Iugu.setApiKey('<YOUR API KEY>')
All methods follow the pattern Iugu.{resource}.{method}(model,urlParams)
const client: IuguCustomer = {
name: 'John Doe',
email: '[email protected]'
}
const urlParams: Map<string, string> = new Map()
urlParams.set('id', '558958DB714B389EA6B1FF0A33D75505')
// You can use await
const resultClient : IuguCustomer = await Iugu.customers.update(client, urlParams)
// Or you can use .then
Iugu.customers.create(client, urlParams).then((cli: IuguCustomer) => {
// On success
}).catch((error: Error) => {
// On error
})
Tests
To run the tests you need to create the file iugu_services.json inside tests folder with the data below:
{
"accountId": "<SUA ACCOUNT ID>",
"apiKey": "<API KEY PREFERENCIALMENTE DE TESTES>",
"clientId": "<UM CLIENT ID VÁLIDO>",
"paymentMethodToken": "<<UM TOKEN DE FORMA DE PAGAMENTO VÁLIDO>>"
}
To run the tests execute:
npm run test
More info
To find more information about requests and his parameters, access the documentation dev.iugu.com/reference for reference.
Credits
- This library was created based on the Vinícius Picanço repository.
Keywords
iugu