1.0.7 • Published 7 years ago

advcash v1.0.7

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

Build Status Code Climate Test Coverage dependencies Status

Advcash

node.js wrapper for advcash cryptocurrency exchange

Documentation

The official documentation can be found here

Prerequisites

  • Node 6.0
  • Advcash account (click here to register)
  • Advcash api key

Installing

npm install --save advcash

Examples

All methods returns a promise as result

client

var advcash = require('advcash');

var options = {
  password: 'password created previously',
  apiName: 'api created previously',
  accountEmail: 'email used to create the advcash account'
};

advcash(options).then(function(client) {
  // client is ready
})

checkCurrencyExchange

Getting the currency exchange rate

Arguments

NameTypeDescription
fromStringTransfer currencies
toStringTransfer currencies
actionStringBUY, SELL
amountFloatTransaction amount (accuracy – up to two digits after decimal point)
var arguments = {
  from: "BTC",
  to: "USD",
  action: "SELL",
  amount: 0.5
};

client.checkCurrencyExchange(arguments).then(function(response) {
  console.log(response)
})

Response

{
  "amountExchanged": 636.32,
  "rate": 1272.63,
  "from": "BTC",
  "to": "USD",
  "action": "SELL",
  "amount": 0.5
}

getBalances

Get Balance per User’s Wallets

client.getBalances().then(function(balances) {
  console.log(balances)
})

Response

[
  {
    "amount": 0.55,
    "id": "U768564323906"
  },
  {
    "amount": 0.80,
    "id": "E527005319826"
  }
]

validateAccount

Checking matching the first and last name of the user in the Advanced Cash system with the name and last name in a third-party system

var arguments = {
  email: "email@example.com",
  firstName: "First name example",
  lastName: "Last name example"
};

client.validateAccount(arguments).then(function(response) {
  console.log(response)
})

Response

{
  "firstNameMatchingPercentage": 90.55,
  "rate": 55.56
}

validateAccounts

Validation of Account’s Existence

var emails = ['email1@example.com', 'email2@example.com']

client.validateAccounts(emails).then(function(response) {
  console.log(response)
})

Response

[
  {
    "present": false,
    "accountEmail": "email1@example.com"
  },
  {
    "present": true,
    "accountEmail": "email2@example.com"
  }
]

history

Transaction History

Arguments

NameTypeDescription
fromIntOrdinal number of transaction to start displaying with
countIntThe number of transactions for disiplaying
sortOrderStringASC, DESC
startTimeFrom      Date  Start date for transactions to be selected
startTimeTo      Date  End date for transactions to be selected                        
transactionName    StringTransaction Names                      
transactionStatus  String  Transaction Statuses
walletIdStringWallet
var arguments = {
  from: 1,
  count: 5,
  sortOrder: "ASC",
  startTimeFrom: new Date('2017-01-02'),
  startTimeTo: new Date(),
  transactionName: 'CURRENCY_EXCHANGE',
  transactionStatus: 'COMPLETED'
};

client.history(arguments).then(function(response) {
  console.log(response)
})

Response

{ 
  "id": "8d088e53-462c-4eb5-b596-70060db6b66d",
  "activityLevel": 0,
  "amount": 10.24,
  "comment": "",
  "currency": "EUR",
  "direction": "OUTGOING",
  "fullCommission": 0.00,
  "receiverEmail": "receiver@example.com",
  "sci": false,
  "senderEmail": "sender@example.com",
  "startTime": "2017-03-25T19:46:56.843Z",
  "status": "COMPLETED",
  "transactionName": "CURRENCY_EXCHANGE",
  "walletDestId": "U768564448973",
  "walletSrcId": "E5270053223408"
}

validationSendMoney

Validation of Intrasystem Transfer

Arguments

NameTypeDescription
amountFloatTransaction amount (accuracy – up to two digits after decimal point)
currencyStringTransfer currencies
emailStringRecipient’s email (Required if “walletId” is empty)
walletId      String  Recipient’s wallet (Required if “email” is empty)
note      String  Note to transaction                        
savePaymentTemplateBooleanIndicator of saving the current payment template                      

If the validation of the expected payment is successful, the response from the server will contain a blank message. If the validation is not successful, a message with an error contained in its body will be returned.

var arguments = {
  amount: 0.10,
  currency: "USD",
  email: "example@example.com",
  note: "testing",
  savePaymentTemplate: true
}

client.validationSendMoney(arguments).then(function(response) {
  console.log(response) // null
})
.catch(function(error) {
  console.log(error)
})

Response

null

validationSendMoneyToAdvcashCard

Validation of Funds Transfer to Advanced Cash Card

Arguments

NameTypeDescription
amountFloatTransaction amount (accuracy – up to two digits after decimal point)
currencyStringTransfer currencies
emailStringEmail of the user that owns the card
cardType            StringCard type which will be used for the transfer of funds
note      String  Note to transaction                        
savePaymentTemplateBooleanIndicator of saving the current payment template                      

If the validation of the expected payment is successful, the response from the server will contain a blank message. If the validation is not successful, a message with an error contained in its body will be returned.

var arguments = {
  amount: 0.10,
  currency: "USD",
  email: "example@example.com",
  cardType: "PLASTIC",
  note: "testing",
  savePaymentTemplate: true
}

client.validationSendMoneyToAdvcashCard(arguments).then(function(response) {
  console.log(response) // null
})
.catch(function(error) {
  console.log(error)
})

Response

null

validationSendMoneyToEcurrency

Validation of Withdrawal to a third-party payment system

Arguments

NameTypeDescription
amount              Float  Transaction amount (accuracy – up to two digits after decimal point). Required if ecurrency is not BITCOIN
btcAmountFloatTransaction amount in BTC currency when you need to withdraw exact BTC amount (accuracy – up to six digits after decimal point). Required if ecurrency is BITCOIN
currencyStringTransfer currencies
ecurrencyStringEcurrencies
receiver            StringID or wallet of the recipient in the third-party payment system
note      String  Note to transaction                        
savePaymentTemplateBooleanIndicator of saving the current payment template                      

If the validation of the expected payment is successful, the response from the server will contain a blank message. If the validation is not successful, a message with an error contained in its body will be returned.

var arguments = {
  amount: 1.00,
  currency: "USD",
  ecurrency: "ECOIN",
  receiver: "1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp",
  note: "testing",
  savePaymentTemplate: false  
}

client.validationSendMoneyToEcurrency(arguments).then(function(response) {
  console.log(response) // null
})
.catch(function(error) {
  console.log(error)
})

Response

null

findTransaction

Transaction Search by ID

Arguments

NameTypeDescription
transactionIdStringTransaction ID
client.findTransaction("e5383553-f66c-4073-b81d-86e7c3756cdb").then(function(response) {
  console.log(response)
})

Response

{ 
  "id": "e5383553-f66c-4073-b81d-86e7c3756cdb",
  "activityLevel": 0,
  "amount": 10.24,
  "comment": "",
  "currency": "EUR",
  "direction": "OUTGOING",
  "fullCommission": 0.00,
  "receiverEmail": "receiver@example.com",
  "sci": false,
  "senderEmail": "sender@example.com",
  "startTime": "2017-03-25T19:46:56.843Z",
  "status": "COMPLETED",
  "transactionName": "INNER_SYSTEM",
  "walletDestId": "U768564448973",
  "walletSrcId": "E5270053223408"
}

currencyExchange

Intrasystem Currency Exchange

Arguments

NameTypeDescription
fromStringTransfer currencies
toStringTransfer currencies
actionStringBUY, SELL
amountFloat  Transaction amount (accuracy – up to two digits after decimal point)
noteStringNote to transaction
var arguments = {
  from: "USD",
  to: "EUR",
  action: "SELL",
  amount: 1.00,
  note: "testing"
}

client.currencyExchange(arguments).then(function(transactionId) {
  console.log(transactionId)
})

Response

"1575948b-6ead-426f-8ecf-ee7 aa3969c"

sendMoneyToEmail

Transfer of Funds to Unregistered User via E-mail

Arguments

NameTypeDescription
currencyStringTransfer currencies
emailStringE-mail address of the payment recipient unregistered in Advanced Cash system (Immediate after registration in Advanced Cash system, user will receive funds transfer)
amountFloat  Transaction amount (accuracy – up to two digits after decimal point)
noteStringNote to transaction
var arguments = {
  amount: 0.10,
  currency: 'USD',
  email: 'example@example.com',
  note: "testing"
}

client.sendMoneyToEmail(arguments).then(function(transactionId) {
  console.log(transactionId)
})

Response

"1575948b-6ead-426f-8ecf-ee7 aa3969c"

validationCurrencyExchange

Validation of Currency Exchange

Arguments

NameTypeDescription
amountFloat  Transaction amount (accuracy – up to two digits after decimal point).
fromStringOutgoing currency
to    StringIncoming currency                            
actionStringSELL, BUY
note  String  Note to transaction                        

If the validation of the expected payment is successful, the response from the server will contain a blank message. If the validation is not successful, a message with an error contained in its body will be returned.

var arguments = {
  amount: 1.10,
  from: "USD",
  to: "EUR",
  action: "SELL",
  note: "testing"
}

client.validationCurrencyExchange(arguments).then(function(response) {
  console.log(response) // null
})
.catch(function(error) {
  console.log(error)
})

Response

null

validationSendMoneyToEmail

Validation of Funds Transfer to Unregistered User via E-mail

Arguments

NameTypeDescription
amountFloat  Transaction amount (accuracy – up to two digits after decimal point).
currencyStringTransaction currency                          
emailStringE-mail address of the payment recipient unregistered in Advanced Cash system (Immediately after registration in Advanced Cash system, user will receive funds transfer)
note  String  Note to transaction                        

If the validation of the expected payment is successful, the response from the server will contain a blank message. If the validation is not successful, a message with an error contained in its body will be returned.

var arguments = {
  amount: 1.10,
  currency: "USD",
  email: "testing@testing.com",
  note: "testing"
}

client.validationSendMoneyToEmail(arguments).then(function(response) {
  console.log(response) // null
})
.catch(function(error) {
  console.log(error)
})

Response

null

sendMoney

Intrasystem Payment

Arguments

NameTypeDescription
amountFloatTransaction amount (accuracy – up to two digits after decimal point)
currencyStringTransfer currencies
emailStringRecipient’s email (Required if “walletId” is empty)
walletId      String  Recipient’s wallet (Required if “email” is empty)
note      String  Note to transaction                        
savePaymentTemplateBooleanIndicator of saving the current payment template                      
var arguments = client.sendMoney({
  amount: 10.50,
  currency: "USD",
  email: "sample@sample.com",
  note: "testing",
  savePaymentTemplate: true
})

client.sendMoney(arguments).then(function(response) {
  console.log(response) // null
})

Response

"1575948b-6ead-426f-8ecf-ee7 aa3969c"

sendMoneyToAdvcashCard

Transfer of Funds to Advanced Cash Card

Arguments

NameTypeDescription
amountFloatTransaction amount (accuracy – up to two digits after decimal point)
currencyStringTransfer currencies
emailStringEmail of the user that owns the card
cardType            StringCard type which will be used for the transfer of funds
note      String  Note to transaction                        
savePaymentTemplateBooleanIndicator of saving the current payment template                      
var arguments = {
  amount: 5.00,
  currency: "USD",
  email: "sample@sample.com",
  cardType: "PLASTIC",
  note: "testing",
  savePaymentTemplate: true
}

client.sendMoneyToAdvcashCard(arguments).then(function(response) {
  console.log(response)
})

Response

"1575948b-6ead-426f-8ecf-ee7 aa3969c"

validationSendMoneyToBankCard

Validation of Funds Transfer to External Card Not Tied to System

Arguments

NameTypeDescription
amountFloatTransaction amount (accuracy – up to two digits after decimal point)
currencyStringTransfer currencies
cardNumberStringExternal card number for finds withdrawal
expiryMonth        StringTwo digits that signify the month of the card’s expiration date (e.g. 09 for September)
expiryYear          StringTwo last digits of the year of the card’s expiration date (e.g. 17 for year 2017)
note      String  Note to transaction                        
savePaymentTemplateBooleanIndicator of saving the current payment template                      

If the validation of the expected payment is successful, the response from the server will contain a blank message. If the validation is not successful, a message with an error contained in its body will be returned.

var arguments = {
  amount: 4.00,
  currency: "USD",
  cardNumber: "4532881212776308",
  expiryMonth: "12",
  expiryYear: "18",
  note: "testing",
  savePaymentTemplate: false
}

client.validationSendMoneyToBankCard(arguments).then(function(response) {
  console.log(response)
})

Response

null

sendMoneyToBankCard

Transfer of Funds to External Bank Card

Arguments

NameTypeDescription
amountFloatTransaction amount (accuracy – up to two digits after decimal point)
currencyStringTransfer currencies
cardNumberStringExternal card number for finds withdrawal
expiryMonth        StringTwo digits that signify the month of the card’s expiration date (e.g. 09 for September)
expiryYear          StringTwo last digits of the year of the card’s expiration date (e.g. 17 for year 2017)
note      String  Note to transaction                        
savePaymentTemplateBooleanIndicator of saving the current payment template                      
var arguments = {
  amount: 4.00,
  currency: "USD",
  cardNumber: "4532881212776308",
  expiryMonth: "12",
  expiryYear: "18",
  note: "testing",
  savePaymentTemplate: false
}

client.sendMoneyToBankCard(arguments).then(function(response) {
  console.log(response)
})

Response

"20931ce4-f4c9-4cc5-84f7-f7efb38c939c"

sendMoneyToEcurrency

Withdrawal to a third-party payment system

Arguments

NameTypeDescription
amountFloatTransaction amount (accuracy – up to two digits after decimal point)
btcAmountFloatTransaction amount in BTC currency when you need to withdraw exact BTC amount (accuracy – up to six digits after decimal point)
currencyStringTransfer currencies
ecurrency          StringEcurrencies                                            
cardNumberStringExternal card number for finds withdrawal
receiver          StringID or wallet of the recipient in the third-party payment system    
note      String  Note to transaction                        
savePaymentTemplateBooleanIndicator of saving the current payment template                      
var arguments = {
  amount: 1.00,
  currency: "USD",
  ecurrency: "ECOIN",
  receiver: address,
  note: "testing",
  savePaymentTemplate: false
}

client.sendMoneyToEcurrency(arguments).then(function(response) {
  console.log(response)
})

Response

"d28a6da7-451d-41c4-93f8-cd0084c72f96"

createBitcoinInvoice

Creating bitcoin invoice

Arguments

NameTypeDescription
amountFloatTransaction amount (accuracy – up to two digits after decimal point)
currencyStringTransfer currencies
sciNameStringShopping Cart Interface name (optional parameter)
orderId          StringId of the order (optional parameter)
note      String  Note to transaction (optional parameter)            
var arguments = {
  amount: 1.0,
  currency: "USD"
}

client.createBitcoinInvoice(arguments).then(function(response) {
  console.log(response)
})

Response

{ 
  "bitcoinAddress": "1C8jQAkHwE87bTmyDXSKdNyf8B8MnGYhpp",
  "bitcoinAmount": 0.001388,
  "amount": 1.00,
  "currency": "USD",
  "sciName": "sci_name",
  "orderId": "12345",
  "note": "Some note"
}

register

Register a new user

Arguments

NameTypeDescription
emailStringUser's email
firstNameStringUser's first name
lastNameStringUser's last name
language          Stringen, ru

If the registration of the user is successful, the response from the server will contain a blank message. If the registration is not successful, a message with an error contained in its body will be returned.

var arguments = {
  email: "test@test.com",
  firstName: "First name",
  lastName: "Last name",
  language: "en"
}

client.register(arguments).then(function(response) {
  console.log(response)
})

Response

null

sendMoneyToExmo

Withdrawal to EXMO

Arguments

NameTypeDescription
amountFloatTransaction amount (accuracy – up to two digits after decimal point)
currencyStringTransfer currencies
note      String  Note to transaction (optional parameter)            
var arguments = {
  amount: 1.10,
  currency: "USD",
  note: "testing"
}

client.sendMoneyToExmo(arguments).then(function(response) {
  console.log(response)
})
.catch(function(error) {
  console.log(error)
})

Response

{
  "id": "d28a6da7-451d-41c4-93f8-cd0084c72f96",
  "coupon": "EX-CODE_22562_USD1d7f906bd79cb8e13200aa55c227a2fe9328bf17"
}

validationSendMoneyToBtcE

Validation of Withdrawal to BTC-E

Arguments

NameTypeDescription
amountFloatTransaction amount (accuracy – up to two digits after decimal point)
currencyStringTransfer currencies
note      String  Note to transaction (optional parameter)            

If the validation of the expected payment is successful, the response from the server will contain a blank message. If the validation is not successful, a message with an error contained in its body will be returned.

var arguments = {
  amount: 1.10,
  currency: "USD",
  note: "testing"
}

client.validationSendMoneyToBtcE(arguments).then(function(response) {
  console.log(response) // null
})
.catch(function(error) {
  console.log(error)
})

Response

null

validationSendMoneyToExmo

Validation of Withdrawal to EXMO

Arguments

NameTypeDescription
amountFloatTransaction amount (accuracy – up to two digits after decimal point)
currencyStringTransfer currencies
note      String  Note to transaction (optional parameter)            

If the validation of the expected payment is successful, the response from the server will contain a blank message. If the validation is not successful, a message with an error contained in its body will be returned.

var arguments = {
  amount: 1.10,
  currency: "USD",
  note: "testing"
}

client.validationSendMoneyToExmo(arguments).then(function(response) {
  console.log(response) // null
})
.catch(function(error) {
  console.log(error)
})

Response

null

sendMoneyToBtcE

Withdrawal to BTC-E

Arguments

NameTypeDescription
amountFloatTransaction amount (accuracy – up to two digits after decimal point)
currencyStringTransfer currencies
note      String  Note to transaction (optional parameter)            
var arguments = {
  amount: 1.10,
  currency: "USD",
  note: "testing"
}

client.sendMoneyToBtcE(arguments).then(function(response) {
  console.log(response)
})
.catch(function(error) {
  console.log(error)
})

Response

{
  "id": "d28a6da7-451d-41c4-93f8-cd0084c72f96",
  "coupon": "EX-CODE_22562_USD1d7f906bd79cb8e13200aa55c227a2fe9328bf17"
}

Transaction Statuses

ValueDescription
PENDINGTransaction processing is pending
PROCESSTransaction is being processed
COMPLETEDTransaction is completed
CANCELED  Transaction is cancelled
CONFIRMEDTransaction is confirmed

Transaction Names

ValueDescription
ALLAll transactions regardless of their type
CHECK_DEPOSITFunds deposit by bank check
WIRE_TRANSFER_DEPOSITFunds deposit from bank account
WIRE_TRANSFER_WITHDRAW  Funds withdrawal to bank account
INNER_SYSTEMIntrasystem funds transfer
CURRENCY_EXCHANGECurrency exchange within account
BANK_CARD_TRANSFERFunds withdrawal to external bank card
ADVCASH_CARD_TRANSFERFunds transfer to Advanced Cash card
EXTERNAL_SYSTEM_DEPOSITDeposit funds through third-party system
EXTERNAL_SYSTEM_WITHDRAWALWithdrawal through third-party system
REPAYMENTFunds repayment

Transfer Currencies

ValueDescription
USDUS Dollar
EUREuro
RURRussian Rouble
GBP  Pound Sterling
UAHUkrainian Hryvnia
BTCBitcoin

ADVCash cards Types

ValueDescription
VIRTUALVirtual card  
PLASTICPlastic card

Ecurrencies

ValueDescription
BITCOINWithdrawal to BTC  
CAPITALISTCapitalist payment system
ECOINEcoin payment system
OKPAYOkPay payment system
PAXUMPaxum payment system
PAYEERPayeer payment system
PERFECT_MONEYPerfect Money payment system
WEB_MONEYWebMoney payment system
QIWIQIWI payment system
YANDEX_MONEYYandex.Money payment system

Contributing

  • Erik Nakata
  • Leonardo Cadastro

License

This project is licensed under the MIT License - see the LICENSE file for details

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago