npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@plasma-platform/tm-service-balances

v1.3.1

Published

SDK for service balances

Downloads

13

Readme

Documentation

Table of Contents

BalancesService

Balances Micro Service API

Parameters

  • url string service url
  • token (string | null) user access tocken if available (optional, default null)

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

  • args object object with arguments
    • args.type number taxpayer info type (required)
    • args.countryId string Char code of "Country or Country Residence" (required)
    • args.countryId2 string? Char code of "Country citizenship or Country incorporation"
    • args.stateId string? Char code of "State / Province ID"
    • args.city string? City
    • args.zip string? ZIP-code
    • args.address string? Street & apt. or suite no.
    • args.address2 string? Permanent residence address
    • args.personNumberType string? Tax Number for individual (e.g. "Foreign Tax ID Number")
    • args.companyNumberType string? Tax Number for Corporation (e.g. "Employer Identification Number(EIN)")
    • args.taxIdNumber string? Tax ID number (XXX-XX-XXXX)
    • args.taxClassification string? Tax classification
    • args.name string? Name (shown on your income tax return)
    • args.businessName string? Business name
    • args.organizationName string? Name of organization
    • args.disregardedEntity string? Name of disregarded entity
    • args.chapter3Status string? Chapter 3 status
    • args.signature string? Signature
    • args.residenceNumbers string? 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

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

  • id string 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

  • args Object? object of params
    • args.balanceType string? Balance type
    • args.types string? filter by transactions types divided by comma (e.g. types: 'sale,refund')
    • args.type string? Balance type filter by transactions type (e.g. type: 'sale')

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

  • balanceType string? 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

  • args object object with arguments
    • args.paymentMethod number Payment method (paypal, wire, skrill, payoneer) (required)
    • args.email string? E-mail (required for paypal & skrill)
    • args.fullName string? First & last name (required for wire)
    • args.address string? Address (required for wire)
    • args.country string? Country char code (required for wire)
    • args.swiftCode string? SWIFT-code (required for wire)
    • args.bankAccountId string? Bank account number (required for wire)
    • args.bankName string? Bank name (required for wire)
    • args.bankAddress string? Bank address (required for wire)
    • args.payonnerId string? (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

  • args object object with arguments
    • args.paymentMethod number Payment method (paypal, wire, skrill, payoneer) (required)
    • args.email string? E-mail (required for paypal & skrill)
    • args.fullName string? First & last name (required for wire)
    • args.address string? Address (required for wire)
    • args.country string? Country char code (required for wire)
    • args.swiftCode string? SWIFT-code (required for wire)
    • args.bankAccountId string? Bank account number (required for wire)
    • args.bankName string? Bank name (required for wire)
    • args.bankAddress string? Bank address (required for wire)
    • args.payonnerId string? (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

  • args object object with arguments
    • args.amount string amount to withdraw (must be greater than balance) (required)
    • args.paymentMethod string Payment method (paypal, wire, skrill, payoneer) (required)

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

getBalanceByOrderId

Transaction - Request balance of order for balance_type

Parameters

  • params object
    • params.orderId string Order id (required).
    • params.balanceType string? Balance type.

Examples

(async () => {
  const balancesService = new BalancesService('http://service-balances.dev/api/v2/');
  const request = await balancesService.getBalanceByOrderId(params);
})();

Returns Promise<any>