@plasma-platform/service-balances v1.9.0
Full documentation
install:npm i @plasma-platform/service-balances -S
Short documentation
Table of Contents
- BalancesService
- Parameters
- createNewDocument
- getLinkAmazonS3Uploader
- requestTaxpayerDocument
- createTaxpayerDocument
- checkBalanceByUserId
- requestTaxpayerInfo
- requestTransactionInfo
- requestTransactionList
- requestBalances
- createPaymentMethod
- createPaymentMethod
- createWithdrawRequest
- requestUserPaymentMethods
- requestUserWithdrawInformation
- requestWithdraws
- getBalanceByOrderId
- updateAutoWithdrawal
- getWithdrawalInfo
- getWithdrawalInvoice
BalancesService
Balances Micro Service API
Parameters
urlstring service urltoken(string | null) user access tocken if available (optional, defaultnull)
createNewDocument
Creates new document based on your user_id ("transactions" scope is needed)
Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.createNewDocument();
})();Returns object response
getLinkAmazonS3Uploader
Return link to upload your file ("transactions" scope is needed)
Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.getLinkAmazonS3Uploader();
})();Returns object response
requestTaxpayerDocument
Returns taxpayer own document by his access_token ("transactions" scope is required)
Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.requestTaxpayerDocument();
})();Returns object response
createTaxpayerDocument
Create taxpayer info or update existent one
Parameters
argsobject object with argumentsargs.typenumber taxpayer info type (required)args.countryIdstring Char code of "Country or Country Residence" (required)args.countryId2string? Char code of "Country citizenship or Country incorporation"args.stateIdstring? Char code of "State / Province ID"args.citystring? Cityargs.zipstring? ZIP-codeargs.addressstring? Street & apt. or suite no.args.address2string? Permanent residence addressargs.personNumberTypestring? Tax Number for individual (e.g. "Foreign Tax ID Number")args.companyNumberTypestring? Tax Number for Corporation (e.g. "Employer Identification Number(EIN)")args.taxIdNumberstring? Tax ID number (XXX-XX-XXXX)args.taxClassificationstring? Tax classificationargs.namestring? Name (shown on your income tax return)args.businessNamestring? Business nameargs.organizationNamestring? Name of organizationargs.disregardedEntitystring? Name of disregarded entityargs.chapter3Statusstring? Chapter 3 statusargs.signaturestring? Signatureargs.residenceNumbersstring? Residence numbers (optional) (not implemented yet)
Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.createTaxpayerDocument({});
})();Returns object response
checkBalanceByUserId
Check balance of the specified user
Parameters
idstring user id
Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.checkBalanceByUserId();
})();Returns array array with balances info
requestTaxpayerInfo
Returns taxpayer own information by his access_token
Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.requestTaxpayerInfo();
})();Returns array array with balances info
requestTransactionInfo
Returns taxpayer own information by his access_token
Parameters
idstring Transaction unique ID
Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.requestTransactionInfo('1');
})();Returns array array with balances info
requestTransactionList
Request Transactions list of authenticated user by balance type
Parameters
argsObject? object of params
Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.requestTransactionInfo('1');
})();Returns array array with balances info
requestBalances
Request balance of authenticated user by type or default
Parameters
balanceTypestring? type of balance needed (vendor|bonus)
Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.requestBalances();
})();Returns array array with balances info
createPaymentMethod
Creates new payment method ("transactions" scope is needed)
Parameters
argsobject object with argumentsargs.paymentMethodnumber Payment method (paypal, wire, skrill, payoneer) (required)args.emailstring? E-mail (required for paypal & skrill)args.fullNamestring? First & last name (required for wire)args.addressstring? Address (required for wire)args.countrystring? Country char code (required for wire)args.swiftCodestring? SWIFT-code (required for wire)args.bankAccountIdstring? Bank account number (required for wire)args.bankNamestring? Bank name (required for wire)args.bankAddressstring? Bank address (required for wire)args.payonnerIdstring? (required for payoneer)
Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.createPaymentMethod({});
})();Returns object response
createPaymentMethod
Updates existed payment method ("transactions" scope is needed)
Parameters
argsobject object with argumentsargs.paymentMethodnumber Payment method (paypal, wire, skrill, payoneer) (required)args.emailstring? E-mail (required for paypal & skrill)args.fullNamestring? First & last name (required for wire)args.addressstring? Address (required for wire)args.countrystring? Country char code (required for wire)args.swiftCodestring? SWIFT-code (required for wire)args.bankAccountIdstring? Bank account number (required for wire)args.bankNamestring? Bank name (required for wire)args.bankAddressstring? Bank address (required for wire)args.payonnerIdstring? (required for payoneer)
Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.createPaymentMethod({});
})();Returns object response
createWithdrawRequest
Creates new withdraw request ("transactions" scope is needed)
Parameters
argsobject object with arguments
Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.createWithdrawRequest({});
})();Returns object response
requestUserPaymentMethods
Get all user payment methods ("transactions" scope is needed)
Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.requestUserPaymentMethods();
})();Returns array array with balances info
requestUserWithdrawInformation
Return user own last withdraw request ("transactions" scope is needed)
Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.requestUserPaymentMethods();
})();Returns array array with balances info
requestWithdraws
Return all withdraws
Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.requestWithdraws();
})();Returns array array with balances info
getBalanceByOrderId
Transaction - Request balance of order for balance_type
Parameters
Examples
(async () => {
const balancesService = new BalancesService('http://service-balances.dev/api/v2/');
const request = await balancesService.getBalanceByOrderId(params);
})();Returns Promise<any>
updateAutoWithdrawal
Update auto withdrawal
Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.updateAutoWithdrawal();
})();Returns object response
getWithdrawalInfo
Withdraw - Get withdrawal information for user
Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.getWithdrawalInfo();
})();Returns object object with withdrawal info
getWithdrawalInvoice
Withdraw - Get withdrawal invoice information
Examples
(async () => {
const balancesService = new BalancesService('https://jsonplaceholder.typicode.com/', 'dsugsahfdkljhafljkdfhajkldshfad');
const balances = await balancesService.getWithdrawalInvoice();
})();Returns object object with invoice info
4 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago