abs-client
Advanced tools
Comparing version 0.0.3-beta to 0.0.4-alpha
111
lib/index.js
@@ -91,12 +91,98 @@ const rp = require('request-promise-native') | ||
async function balances(customerId) { | ||
return ( | ||
await doGet('/account', {}, { 'X-USERID': customerId }) | ||
).items | ||
async function balances(customerID) { | ||
return await doGet('/account', {}, { 'X-USERID': customerID }) | ||
} | ||
async function balance(customerId, accountId) { | ||
return await doGet('/account/' + accountId, {}, { 'X-USERID': customerId }) | ||
async function balance(customerID, accountID) { | ||
return await doGet(`/account/${accountID}`, {}, { 'X-USERID': customerID }) | ||
} | ||
async function setBankInfo(name, branch, BIC, address, countryCode, defaultCurrency, description) { | ||
return await doPost(`/bankInfo`, { name, branch, BIC, address, countryCode, defaultCurrency, description }) | ||
} | ||
async function getBankInfo() { | ||
return await doGet(`/bankInfo`) | ||
} | ||
async function createCustomer({ | ||
firstName, | ||
lastName, | ||
companyName, | ||
customerId, | ||
customerType, | ||
description, | ||
countryCode, | ||
natLegalIdentifier, | ||
intlLegalIdentifier, | ||
}) { | ||
return await doPost(`/customer`, { | ||
firstName, | ||
lastName, | ||
companyName, | ||
customerId, | ||
customerType, | ||
description, | ||
countryCode, | ||
natLegalIdentifier, | ||
intlLegalIdentifier, | ||
}, { 'X-USERID': customerId }) | ||
} | ||
async function createCustomer({ | ||
firstName, | ||
lastName, | ||
companyName, | ||
customerId, | ||
customerType, | ||
description, | ||
countryCode, | ||
natLegalIdentifier, | ||
intlLegalIdentifier, | ||
}) { | ||
return await doPost(`/customer`, { | ||
firstName, | ||
lastName, | ||
companyName, | ||
customerId, | ||
customerType, | ||
description, | ||
countryCode, | ||
natLegalIdentifier, | ||
intlLegalIdentifier, | ||
}, { 'X-USERID': customerId }) | ||
} | ||
async function getCustomer(queryObj, customerID) { | ||
return await doGet(`/customer`, queryObj, { 'X-USERID': customerID }) | ||
} | ||
async function createAccount({ | ||
customerID, | ||
accountID, | ||
accountNumber, | ||
balance, | ||
currency, | ||
description, | ||
// type, | ||
}) { | ||
return await doPost(`/account`, { | ||
customerID, | ||
accountID, | ||
accountNumber, | ||
balance, | ||
currency, | ||
description, | ||
// type, | ||
}) | ||
} | ||
async function linkAccount({ | ||
customerID, | ||
accountID, | ||
}) { | ||
return await doPost(`/account:link`, { | ||
customerID, | ||
accountID, | ||
}) | ||
} | ||
return { | ||
@@ -107,9 +193,12 @@ transferToOmnibus, | ||
balances, | ||
balance | ||
balance, | ||
setBankInfo, | ||
getBankInfo, | ||
createCustomer, | ||
getCustomer, | ||
createAccount, | ||
linkAccount, | ||
} | ||
} | ||
module.exports = { | ||
balances, | ||
balance, | ||
} | ||
module.exports = init |
{ | ||
"name": "abs-client", | ||
"version": "0.0.3-beta", | ||
"version": "0.0.4-alpha", | ||
"description": "Client that interacts functions for the abs.", | ||
@@ -10,4 +10,5 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"request": "^2.88.0", | ||
"request-promise-native": "^1.0.7" | ||
} | ||
} |
6297
186
2
+ Addedrequest@^2.88.0