├── src ├── get-balances.js ├── validate-accounts.js ├── request-args.js ├── authentication-token.js ├── validate-account.js ├── create-bitcoin-invoice.js ├── check-currency-exchange.js ├── soap-client.js ├── history.js ├── find-transaction.js └── index.js ├── .travis.yml ├── .babelrc ├── test ├── get-balances.js ├── untested │ ├── validation-send-money-to-btc-e.js │ ├── validation-send-money-to-exmo.js │ ├── send-money-to-btc-e.js │ ├── send-money-to-exmo.js │ ├── send-money-to-ecurrency.js │ └── validation-send-money-to-bank-card.js ├── side-effects │ ├── currency-exchange.js │ ├── send-money.js │ ├── send-money-to-email.js │ └── send-money-to-advcash.js ├── validation-currency-exchange.js ├── validation-send-money-to-email.js ├── validation-send-money.js ├── validation-send-money-to-advcash-card.js ├── validation-send-money-to-ecurrency.js ├── validate-accounts.js ├── validate-account.js ├── check-currency-exchange.js ├── create-bitcoin-invoice.js ├── find-transaction.js └── history.js ├── .gitignore ├── LICENSE ├── package.json └── README.md /src/get-balances.js: -------------------------------------------------------------------------------- 1 | export default (balances) => balances.map(balance => { 2 | return { amount: parseFloat(balance.amount), id: balance.id } 3 | }) -------------------------------------------------------------------------------- /src/validate-accounts.js: -------------------------------------------------------------------------------- 1 | export default (accounts) => accounts.map(account => { 2 | return { present: account.present, accountEmail: account.systemAccountName } 3 | }) -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "6.0.0" 4 | before_script: 5 | - export NODE_ENV=test 6 | after_success: 7 | - npm install -g codeclimate-test-reporter 8 | - codeclimate-test-reporter < ./coverage/lcov.info -------------------------------------------------------------------------------- /src/request-args.js: -------------------------------------------------------------------------------- 1 | import token from './authentication-token' 2 | 3 | export default (apiName, password, accountEmail) => { 4 | return { 5 | apiName, 6 | accountEmail, 7 | authenticationToken: token(password) 8 | } 9 | } -------------------------------------------------------------------------------- /src/authentication-token.js: -------------------------------------------------------------------------------- 1 | import moment from 'moment-timezone' 2 | import sha from 'sha.js' 3 | 4 | export default password => sha('sha256') 5 | .update(`${password}:${moment.tz("Europe/London").format('YYYYMMDD:HH')}`, 'utf8') 6 | .digest('hex') -------------------------------------------------------------------------------- /src/validate-account.js: -------------------------------------------------------------------------------- 1 | export default (validateAccountResponse) => { 2 | return { 3 | firstNameMatchingPercentage: parseFloat(validateAccountResponse.firstNameMatchingPercentage), 4 | lastNameMatchingPercentage: parseFloat(validateAccountResponse.lastNameMatchingPercentage) 5 | } 6 | } -------------------------------------------------------------------------------- /src/create-bitcoin-invoice.js: -------------------------------------------------------------------------------- 1 | export default invoice => { 2 | return { 3 | bitcoinAddress: invoice.bitcoinAddress, 4 | bitcoinAmount: parseFloat(invoice.bitcoinAmount), 5 | amount: parseFloat(invoice.amount), 6 | currency: invoice.currency, 7 | sciName: invoice.sciName || '', 8 | orderId: invoice.orderId || '', 9 | note: invoice.note || '' 10 | } 11 | } -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | [ 4 | "env", 5 | { 6 | "targets": { 7 | "node": 6.0 8 | } 9 | } 10 | ] 11 | ], 12 | "env": { 13 | "test": { 14 | "plugins": [ 15 | "istanbul" 16 | ] 17 | } 18 | }, 19 | "plugins": [ 20 | "add-module-exports" 21 | ] 22 | } -------------------------------------------------------------------------------- /src/check-currency-exchange.js: -------------------------------------------------------------------------------- 1 | export default (checkCurrencyExchangeResultHolder) => { 2 | return { 3 | amountExchanged: parseFloat(checkCurrencyExchangeResultHolder.amountExchanged), 4 | rate: parseFloat(checkCurrencyExchangeResultHolder.rate), 5 | from: checkCurrencyExchangeResultHolder.from, 6 | to: checkCurrencyExchangeResultHolder.to, 7 | action: checkCurrencyExchangeResultHolder.action, 8 | amount: parseFloat(checkCurrencyExchangeResultHolder.amount) 9 | } 10 | } -------------------------------------------------------------------------------- /src/soap-client.js: -------------------------------------------------------------------------------- 1 | import soap from 'soap-as-promised' 2 | 3 | export default async advcashSoapUrl => { 4 | const soapClient = await soap.createClient(advcashSoapUrl, { 5 | endpoint: advcashSoapUrl, 6 | ignoredNamespaces: { 7 | namespaces: [], 8 | override: true 9 | } 10 | }) 11 | 12 | return async (operation, args, map) => { 13 | const response = await soapClient[operation].call(this, args) 14 | return map ? map(response.return) : response.return 15 | } 16 | } -------------------------------------------------------------------------------- /src/history.js: -------------------------------------------------------------------------------- 1 | export default transactions => transactions.map(transaction => { 2 | return { 3 | id: transaction.id, 4 | comment: transaction.comment || '', 5 | startTime: transaction.startTime, 6 | status: transaction.status, 7 | transactionName: transaction.transactionName, 8 | sci: transaction.sci, 9 | walletSrcId: transaction.walletSrcId || '', 10 | walletDestId: transaction.walletDestId || '', 11 | senderEmail: transaction.senderEmail || '', 12 | receiverEmail: transaction.receiverEmail || '', 13 | amount: parseFloat(transaction.amount), 14 | currency: transaction.currency, 15 | fullCommission: parseFloat(transaction.fullCommission), 16 | direction: transaction.direction, 17 | orderId: transaction.orderId || '' 18 | } 19 | }) 20 | -------------------------------------------------------------------------------- /test/get-balances.js: -------------------------------------------------------------------------------- 1 | import advcash from '../src/index' 2 | import chai from 'chai' 3 | import chaiAsPromised from 'chai-as-promised' 4 | 5 | const expect = chai.expect 6 | const password = process.env.ADVCASH_PASSWORD 7 | const accountEmail = process.env.ADVCASH_ACCOUNT_EMAIL 8 | const apiName = process.env.ADVCASH_API_NAME 9 | const advcashSoapUrl = process.env.ADVCASH_SOAP_URL 10 | 11 | chai.use(chaiAsPromised) 12 | 13 | describe('Get balances', () => { 14 | describe('Get Balance per User’s Wallets', () => { 15 | it('Should return an array of object { amount, id }', async () => { 16 | 17 | const client = await advcash({ password, accountEmail, apiName }) 18 | 19 | const promise = client.getbalances() 20 | 21 | return Promise.all([ 22 | expect(promise).to.eventually.be.instanceof(Array) 23 | ]); 24 | }) 25 | }) 26 | 27 | }) -------------------------------------------------------------------------------- /src/find-transaction.js: -------------------------------------------------------------------------------- 1 | export default transaction => { 2 | return { 3 | id: transaction.id, 4 | comment: transaction.comment || '', 5 | startTime: transaction.startTime, 6 | status: transaction.status, 7 | transactionName: transaction.transactionName, 8 | sci: transaction.sci, 9 | walletSrcId: transaction.walletSrcId || '', 10 | walletDestId: transaction.walletDestId || '', 11 | senderEmail: transaction.senderEmail || '', 12 | receiverEmail: transaction.receiverEmail || '', 13 | amount: parseFloat(transaction.amount), 14 | currency: transaction.currency, 15 | fullCommission: parseFloat(transaction.fullCommission), 16 | direction: transaction.direction, 17 | orderId: transaction.orderId || '' 18 | } 19 | } -------------------------------------------------------------------------------- /test/untested/validation-send-money-to-btc-e.js: -------------------------------------------------------------------------------- 1 | import advcash from '../src/index' 2 | import chai from 'chai' 3 | import chaiAsPromised from 'chai-as-promised' 4 | 5 | const expect = chai.expect 6 | const password = process.env.ADVCASH_PASSWORD 7 | const accountEmail = process.env.ADVCASH_ACCOUNT_EMAIL 8 | const apiName = process.env.ADVCASH_API_NAME 9 | 10 | chai.use(chaiAsPromised) 11 | 12 | describe('Validation Send Money To Btc-E', () => { 13 | 14 | describe('Validation of Withdrawal to BTC-E', () => { 15 | 16 | it('Should return a null object', async () => { 17 | const client = await advcash({ password, apiName, accountEmail }) 18 | 19 | const promise = client.validationSendMoneyToBtcE({ 20 | amount: 1.10, 21 | currency: "USD", 22 | note: "testing" 23 | }) 24 | 25 | return expect(promise).to.eventually.equal(null) 26 | }) 27 | }) 28 | }) -------------------------------------------------------------------------------- /test/untested/validation-send-money-to-exmo.js: -------------------------------------------------------------------------------- 1 | import advcash from '../src/index' 2 | import chai from 'chai' 3 | import chaiAsPromised from 'chai-as-promised' 4 | 5 | const expect = chai.expect 6 | const password = process.env.ADVCASH_PASSWORD 7 | const accountEmail = process.env.ADVCASH_ACCOUNT_EMAIL 8 | const apiName = process.env.ADVCASH_API_NAME 9 | const advcashSoapUrl = process.env.ADVCASH_SOAP_URL 10 | 11 | chai.use(chaiAsPromised) 12 | 13 | describe('Validation Send Money To Exmo', () => { 14 | 15 | describe('Validation of Withdrawal to EXMO', () => { 16 | 17 | it('Should return a null object', async () => { 18 | const client = await advcash({ password, apiName, accountEmail }) 19 | 20 | const promise = client.validationSendMoneyToExmo({ 21 | amount: 1.10, 22 | currency: "USD", 23 | note: "testing" 24 | }) 25 | 26 | return expect(promise).to.eventually.equal(null) 27 | }) 28 | }) 29 | }) -------------------------------------------------------------------------------- /test/side-effects/currency-exchange.js: -------------------------------------------------------------------------------- 1 | import advcash from '../src/index' 2 | import chai from 'chai' 3 | import chaiAsPromised from 'chai-as-promised' 4 | 5 | const expect = chai.expect 6 | const password = process.env.ADVCASH_PASSWORD 7 | const accountEmail = process.env.ADVCASH_ACCOUNT_EMAIL 8 | const apiName = process.env.ADVCASH_API_NAME 9 | const advcashSoapUrl = process.env.ADVCASH_SOAP_URL 10 | 11 | chai.use(chaiAsPromised) 12 | 13 | describe('Currency exchange', () => { 14 | describe('Intrasystem Currency Exchange', () => { 15 | it('Should return a string', async () => { 16 | 17 | const client = await advcash({ password, apiName, accountEmail }) 18 | 19 | const promise = client.currencyExchange({ 20 | from: 'USD', 21 | to: 'EUR', 22 | action: 'SELL', 23 | amount: 0.10, 24 | note: "testing currency exchange" 25 | }) 26 | 27 | return expect(promise).to.eventually.be.a("string") 28 | }) 29 | }) 30 | }) -------------------------------------------------------------------------------- /test/side-effects/send-money.js: -------------------------------------------------------------------------------- 1 | import advcash from '../src/index' 2 | import chai from 'chai' 3 | import chaiAsPromised from 'chai-as-promised' 4 | 5 | const expect = chai.expect 6 | const password = process.env.ADVCASH_PASSWORD 7 | const accountEmail = process.env.ADVCASH_ACCOUNT_EMAIL 8 | const apiName = process.env.ADVCASH_API_NAME 9 | const advcashSoapUrl = process.env.ADVCASH_SOAP_URL 10 | 11 | chai.use(chaiAsPromised) 12 | 13 | describe('Send Money', () => { 14 | 15 | describe('Intrasystem Payment', () => { 16 | it('Should return transaction id', async () => { 17 | const client = await advcash({ password, apiName, accountEmail }) 18 | 19 | const promise = client.sendMoney({ 20 | amount: 0.10, 21 | currency: "USD", 22 | email: "leonardocadastro69@gmail.com", 23 | note: "testing", 24 | savePaymentTemplate: true 25 | }) 26 | 27 | return expect(promise).to.eventually.be.a("string") 28 | }) 29 | }) 30 | }) -------------------------------------------------------------------------------- /test/validation-currency-exchange.js: -------------------------------------------------------------------------------- 1 | import advcash from '../src/index' 2 | import chai from 'chai' 3 | import chaiAsPromised from 'chai-as-promised' 4 | 5 | const expect = chai.expect 6 | const password = process.env.ADVCASH_PASSWORD 7 | const accountEmail = process.env.ADVCASH_ACCOUNT_EMAIL 8 | const apiName = process.env.ADVCASH_API_NAME 9 | const advcashSoapUrl = process.env.ADVCASH_SOAP_URL 10 | 11 | chai.use(chaiAsPromised) 12 | 13 | describe('Validation Currency Exchange', () => { 14 | 15 | describe('Validation of Currency Exchange', () => { 16 | 17 | it('Should return a null object', async () => { 18 | const client = await advcash({ password, apiName, accountEmail }) 19 | 20 | const promise = client.validationCurrencyExchange({ 21 | amount: 1.10, 22 | from: "USD", 23 | to: "EUR", 24 | action: "SELL", 25 | note: "testing" 26 | }) 27 | 28 | return expect(promise).to.eventually.equal(null) 29 | }) 30 | }) 31 | }) -------------------------------------------------------------------------------- /test/side-effects/send-money-to-email.js: -------------------------------------------------------------------------------- 1 | import advcash from '../src/index' 2 | import chai from 'chai' 3 | import chaiAsPromised from 'chai-as-promised' 4 | 5 | const expect = chai.expect 6 | const password = process.env.ADVCASH_PASSWORD 7 | const accountEmail = process.env.ADVCASH_ACCOUNT_EMAIL 8 | const apiName = process.env.ADVCASH_API_NAME 9 | const advcashSoapUrl = process.env.ADVCASH_SOAP_URL 10 | 11 | chai.use(chaiAsPromised) 12 | 13 | describe('Send Money To Email', () => { 14 | describe('Transfer of Funds to Unregistered User via E-mail', () => { 15 | it('Should return a string', async () => { 16 | 17 | const client = await advcash({ password, apiName, accountEmail }) 18 | 19 | const promise = client.sendMoneyToEmail({ 20 | amount: 0.10, 21 | currency: 'USD', 22 | email: 'adv.wrapper@gmail.com', 23 | note: "testing currency exchange" 24 | }) 25 | 26 | return expect(promise).to.eventually.be.a("string") 27 | }) 28 | }) 29 | 30 | }) -------------------------------------------------------------------------------- /test/untested/send-money-to-btc-e.js: -------------------------------------------------------------------------------- 1 | import advcash from '../src/index' 2 | import chai from 'chai' 3 | import chaiAsPromised from 'chai-as-promised' 4 | 5 | const expect = chai.expect 6 | const password = process.env.ADVCASH_PASSWORD 7 | const accountEmail = process.env.ADVCASH_ACCOUNT_EMAIL 8 | const apiName = process.env.ADVCASH_API_NAME 9 | 10 | chai.use(chaiAsPromised) 11 | 12 | describe('Send Money To BtcE', () => { 13 | 14 | describe('Withdrawal to BTC-E', () => { 15 | 16 | it('Should return a null object', async () => { 17 | const client = await advcash({ password, apiName, accountEmail }) 18 | 19 | const promise = client.sendMoneyToBtcE({ 20 | amount: 1.10, 21 | currency: "USD", 22 | note: "testing" 23 | }) 24 | 25 | return Promise.all([ 26 | expect(promise).to.eventually.have.property('id').with.a("string"), 27 | expect(promise).to.eventually.have.property('coupon').with.a("string"), 28 | ]); 29 | }) 30 | }) 31 | }) -------------------------------------------------------------------------------- /test/validation-send-money-to-email.js: -------------------------------------------------------------------------------- 1 | import advcash from '../src/index' 2 | import chai from 'chai' 3 | import chaiAsPromised from 'chai-as-promised' 4 | 5 | const expect = chai.expect 6 | const password = process.env.ADVCASH_PASSWORD 7 | const accountEmail = process.env.ADVCASH_ACCOUNT_EMAIL 8 | const apiName = process.env.ADVCASH_API_NAME 9 | const advcashSoapUrl = process.env.ADVCASH_SOAP_URL 10 | 11 | chai.use(chaiAsPromised) 12 | 13 | describe('Validation Send Money To Email', () => { 14 | 15 | describe('Validation of Funds Transfer to Unregistered User via E-mail', () => { 16 | 17 | it('Should return a null object', async () => { 18 | const client = await advcash({ password, apiName, accountEmail }) 19 | 20 | const promise = client.validationSendMoneyToEmail({ 21 | amount: 1.10, 22 | currency: "USD", 23 | email: "testing@testing.com", 24 | note: "testing" 25 | }) 26 | 27 | return expect(promise).to.eventually.equal(null) 28 | }) 29 | }) 30 | }) -------------------------------------------------------------------------------- /test/untested/send-money-to-exmo.js: -------------------------------------------------------------------------------- 1 | import advcash from '../src/index' 2 | import chai from 'chai' 3 | import chaiAsPromised from 'chai-as-promised' 4 | 5 | const expect = chai.expect 6 | const password = process.env.ADVCASH_PASSWORD 7 | const accountEmail = process.env.ADVCASH_ACCOUNT_EMAIL 8 | const apiName = process.env.ADVCASH_API_NAME 9 | const advcashSoapUrl = process.env.ADVCASH_SOAP_URL 10 | 11 | chai.use(chaiAsPromised) 12 | 13 | describe('Send Money To Exmo', () => { 14 | 15 | describe('Withdrawal to EXMO', () => { 16 | 17 | it('Should return a null object', async () => { 18 | const client = await advcash({ password, apiName, accountEmail }) 19 | 20 | const promise = client.sendMoneyToExmo({ 21 | amount: 1.10, 22 | currency: "USD", 23 | note: "testing" 24 | }) 25 | 26 | return Promise.all([ 27 | expect(promise).to.eventually.have.property('id').with.a("string"), 28 | expect(promise).to.eventually.have.property('coupon').with.a("string"), 29 | ]); 30 | }) 31 | }) 32 | }) -------------------------------------------------------------------------------- /test/validation-send-money.js: -------------------------------------------------------------------------------- 1 | import advcash from '../src/index' 2 | import chai from 'chai' 3 | import chaiAsPromised from 'chai-as-promised' 4 | 5 | const expect = chai.expect 6 | const password = process.env.ADVCASH_PASSWORD 7 | const accountEmail = process.env.ADVCASH_ACCOUNT_EMAIL 8 | const apiName = process.env.ADVCASH_API_NAME 9 | const advcashSoapUrl = process.env.ADVCASH_SOAP_URL 10 | 11 | chai.use(chaiAsPromised) 12 | 13 | describe('Validation Send Money', () => { 14 | 15 | describe('Validation of Intrasystem Transfer', () => { 16 | it('Should return a null object', async () => { 17 | const client = await advcash({ password, apiName, accountEmail }) 18 | 19 | const promise = client.validationSendMoney({ 20 | amount: 0.10, 21 | currency: "USD", 22 | email: "leonardocadastro69@gmail.com", 23 | note: "teste", 24 | savePaymentTemplate: true 25 | }) 26 | 27 | return Promise.all([ 28 | expect(promise).to.eventually.equal(null) 29 | ]) 30 | }) 31 | }) 32 | }) -------------------------------------------------------------------------------- /test/side-effects/send-money-to-advcash.js: -------------------------------------------------------------------------------- 1 | import advcash from '../src/index' 2 | import chai from 'chai' 3 | import chaiAsPromised from 'chai-as-promised' 4 | 5 | const expect = chai.expect 6 | const password = process.env.ADVCASH_PASSWORD 7 | const accountEmail = process.env.ADVCASH_ACCOUNT_EMAIL 8 | const apiName = process.env.ADVCASH_API_NAME 9 | const advcashSoapUrl = process.env.ADVCASH_SOAP_URL 10 | 11 | chai.use(chaiAsPromised) 12 | 13 | describe('Send Money To Advcash Card', () => { 14 | 15 | describe('Transfer of Funds to Advanced Cash Card', () => { 16 | 17 | it('Should return transaction id', async () => { 18 | const client = await advcash({ password, apiName, accountEmail }) 19 | 20 | const promise = client.sendMoneyToAdvcashCard({ 21 | amount: 0.10, 22 | currency: "USD", 23 | email: "erik.nakata5@gmail.com", 24 | cardType: "PLASTIC", 25 | note: "testing", 26 | savePaymentTemplate: true 27 | }) 28 | 29 | return expect(promise).to.eventually.be.a("string") 30 | }) 31 | }) 32 | 33 | }) -------------------------------------------------------------------------------- /test/untested/send-money-to-ecurrency.js: -------------------------------------------------------------------------------- 1 | import advcash from '../src/index' 2 | import chai from 'chai' 3 | import chaiAsPromised from 'chai-as-promised' 4 | 5 | const expect = chai.expect 6 | const password = process.env.ADVCASH_PASSWORD 7 | const accountEmail = process.env.ADVCASH_ACCOUNT_EMAIL 8 | const apiName = process.env.ADVCASH_API_NAME 9 | const address = process.env.ECOIN_ADDRESS 10 | 11 | chai.use(chaiAsPromised) 12 | 13 | describe('Send Money To Ecurrency', () => { 14 | 15 | describe('Withdrawal to a third-party payment system.', () => { 16 | 17 | it('Should return a null object', async () => { 18 | const client = await advcash({ password, apiName, accountEmail }) 19 | 20 | const promise = client.sendMoneyToEcurrency({ 21 | amount: 1.00, 22 | currency: "USD", 23 | ecurrency: "ECOIN", 24 | receiver: address, 25 | note: "testing", 26 | savePaymentTemplate: false 27 | }) 28 | 29 | return Promise.all([ 30 | expect(promise).to.eventually.equal(null) 31 | ]) 32 | }) 33 | }) 34 | }) -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (http://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # Typescript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | lib/ 61 | 62 | .vscode/ 63 | .DS_Store -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Erik Nakata 4 | Copyright (c) 2017 Leonardo Cadastro 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the "Software"), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | the Software, and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /test/untested/validation-send-money-to-bank-card.js: -------------------------------------------------------------------------------- 1 | import advcash from '../src/index' 2 | import chai from 'chai' 3 | import chaiAsPromised from 'chai-as-promised' 4 | 5 | const expect = chai.expect 6 | const password = process.env.ADVCASH_PASSWORD 7 | const accountEmail = process.env.ADVCASH_ACCOUNT_EMAIL 8 | const apiName = process.env.ADVCASH_API_NAME 9 | 10 | chai.use(chaiAsPromised) 11 | 12 | describe('Validation Send Money To Bank Card', () => { 13 | 14 | describe('Validation of Funds Transfer to External Card Not Tied to System', () => { 15 | 16 | it('Should return a null object', async () => { 17 | const client = await advcash({ password, apiName, accountEmail }) 18 | 19 | const promise = client.validationSendMoneyToBankCard({ 20 | amount: 4.00, 21 | currency: "USD", 22 | cardNumber: "4532881212776308", 23 | expiryMonth: "12", 24 | expiryYear: "18", 25 | note: "testing", 26 | savePaymentTemplate: false 27 | }) 28 | 29 | return Promise.all([ 30 | expect(promise).to.eventually.equal(null) 31 | ]) 32 | }) 33 | }) 34 | 35 | }) -------------------------------------------------------------------------------- /test/validation-send-money-to-advcash-card.js: -------------------------------------------------------------------------------- 1 | import advcash from '../src/index' 2 | import chai from 'chai' 3 | import chaiAsPromised from 'chai-as-promised' 4 | 5 | const expect = chai.expect 6 | const password = process.env.ADVCASH_PASSWORD 7 | const accountEmail = process.env.ADVCASH_ACCOUNT_EMAIL 8 | const apiName = process.env.ADVCASH_API_NAME 9 | const advcashSoapUrl = process.env.ADVCASH_SOAP_URL 10 | 11 | chai.use(chaiAsPromised) 12 | 13 | describe('Validation Send Money To Advcash Card', () => { 14 | 15 | describe('Validation of Funds Transfer to Advanced Cash Card', () => { 16 | 17 | it('Should return a null object', async () => { 18 | const client = await advcash({ password, apiName, accountEmail }) 19 | 20 | const promise = client.validationSendMoneyToAdvcashCard({ 21 | amount: 0.10, 22 | currency: "USD", 23 | email: "erik.nakata5@gmail.com", 24 | cardType: "PLASTIC", 25 | note: "teste", 26 | savePaymentTemplate: true 27 | }) 28 | 29 | return Promise.all([ 30 | expect(promise).to.eventually.equal(null) 31 | ]) 32 | }) 33 | }) 34 | 35 | }) -------------------------------------------------------------------------------- /test/validation-send-money-to-ecurrency.js: -------------------------------------------------------------------------------- 1 | import advcash from '../src/index' 2 | import chai from 'chai' 3 | import chaiAsPromised from 'chai-as-promised' 4 | 5 | const expect = chai.expect 6 | const password = process.env.ADVCASH_PASSWORD 7 | const accountEmail = process.env.ADVCASH_ACCOUNT_EMAIL 8 | const apiName = process.env.ADVCASH_API_NAME 9 | const advcashSoapUrl = process.env.ADVCASH_SOAP_URL 10 | const address = process.env.ECOIN_ADDRESS 11 | 12 | chai.use(chaiAsPromised) 13 | 14 | describe('validation Send Money To Ecurrency', () => { 15 | 16 | describe('Validation of Withdrawal to a third-party payment system', () => { 17 | 18 | it('Should return a null object', async () => { 19 | const client = await advcash({ password, apiName, accountEmail }) 20 | 21 | const promise = client.validationSendMoneyToEcurrency({ 22 | amount: 1.00, 23 | currency: "USD", 24 | ecurrency: "ECOIN", 25 | receiver: address, 26 | note: "testing", 27 | savePaymentTemplate: false 28 | }) 29 | 30 | return Promise.all([ 31 | expect(promise).to.eventually.equal(null) 32 | ]) 33 | }) 34 | }) 35 | }) -------------------------------------------------------------------------------- /test/validate-accounts.js: -------------------------------------------------------------------------------- 1 | import advcash from '../src/index' 2 | import chai from 'chai' 3 | import chaiAsPromised from 'chai-as-promised' 4 | 5 | const expect = chai.expect 6 | const password = process.env.ADVCASH_PASSWORD 7 | const accountEmail = process.env.ADVCASH_ACCOUNT_EMAIL 8 | const apiName = process.env.ADVCASH_API_NAME 9 | const advcashSoapUrl = process.env.ADVCASH_SOAP_URL 10 | 11 | chai.use(chaiAsPromised) 12 | 13 | describe('Validate accounts', () => { 14 | describe('Validation of Account’s Existence', () => { 15 | it('Should return an array of object { present, accountEmail }', async () => { 16 | const client = await advcash({ 17 | password: password, 18 | apiName: apiName, 19 | accountEmail: accountEmail, 20 | }) 21 | 22 | const email = 'teste12345@teste.com' 23 | 24 | const promise = client.validateAccounts([email]) 25 | 26 | return Promise.all([ 27 | expect(promise).to.eventually.be.instanceof(Array), 28 | expect(promise).to.eventually.have.deep.property('[0].present', false), 29 | expect(promise).to.eventually.have.deep.property('[0].accountEmail', email) 30 | ]); 31 | }) 32 | }) 33 | }) -------------------------------------------------------------------------------- /test/validate-account.js: -------------------------------------------------------------------------------- 1 | import advcash from '../src/index' 2 | import chai from 'chai' 3 | import chaiAsPromised from 'chai-as-promised' 4 | 5 | const expect = chai.expect 6 | const password = process.env.ADVCASH_PASSWORD 7 | const accountEmail = process.env.ADVCASH_ACCOUNT_EMAIL 8 | const apiName = process.env.ADVCASH_API_NAME 9 | const advcashSoapUrl = process.env.ADVCASH_SOAP_URL 10 | 11 | chai.use(chaiAsPromised) 12 | 13 | describe('Validate account', () => { 14 | describe(`Checking matching the first and last name of the user in the Advanced Cash system with the name 15 | and last name in a third-party system`, () => { 16 | it('Should return an object { firstNameMatchingPercentage, lastNameMatchingPercentage }', async () => { 17 | const client = await advcash({ password, apiName, accountEmail }) 18 | 19 | const promise = client.validateAccount({ 20 | email: accountEmail, 21 | firstName: "Test first name", 22 | lastName: "Test last name" 23 | }) 24 | 25 | return Promise.all([ 26 | expect(promise).to.eventually.have.property("firstNameMatchingPercentage").with.a("number"), 27 | expect(promise).to.eventually.have.property("lastNameMatchingPercentage").with.a("number"), 28 | ]) 29 | }) 30 | }) 31 | }) -------------------------------------------------------------------------------- /test/check-currency-exchange.js: -------------------------------------------------------------------------------- 1 | import advcash from '../src/index' 2 | import chai from 'chai' 3 | import chaiAsPromised from 'chai-as-promised' 4 | 5 | const expect = chai.expect 6 | const password = process.env.ADVCASH_PASSWORD 7 | const accountEmail = process.env.ADVCASH_ACCOUNT_EMAIL 8 | const apiName = process.env.ADVCASH_API_NAME 9 | const advcashSoapUrl = process.env.ADVCASH_SOAP_URL 10 | 11 | chai.use(chaiAsPromised) 12 | 13 | describe('Check currency exchange', () => { 14 | describe('Getting the currency exchange rate', () => { 15 | it('Should return a object { amountExchanged, rate, from, to, action, amount }', async () => { 16 | 17 | const client = await advcash({ password, apiName, accountEmail }) 18 | 19 | const promise = client.checkCurrencyExchange({ 20 | from: 'BTC', 21 | to: 'USD', 22 | action: 'SELL', 23 | amount: 1 24 | }) 25 | 26 | return Promise.all([ 27 | expect(promise).to.eventually.have.property("amountExchanged").with.a("number"), 28 | expect(promise).to.eventually.have.property("rate").with.a("number"), 29 | expect(promise).to.eventually.have.property("from").with.a("string"), 30 | expect(promise).to.eventually.have.property("to").with.a("string"), 31 | expect(promise).to.eventually.have.property("action").with.a("string"), 32 | expect(promise).to.eventually.have.property("amount").with.a("number"), 33 | ]); 34 | }) 35 | }) 36 | }) -------------------------------------------------------------------------------- /test/create-bitcoin-invoice.js: -------------------------------------------------------------------------------- 1 | import advcash from '../src/index' 2 | import chai from 'chai' 3 | import chaiAsPromised from 'chai-as-promised' 4 | 5 | const expect = chai.expect 6 | const password = process.env.ADVCASH_PASSWORD 7 | const accountEmail = process.env.ADVCASH_ACCOUNT_EMAIL 8 | const apiName = process.env.ADVCASH_API_NAME 9 | 10 | chai.use(chaiAsPromised) 11 | 12 | describe('Create Bitcoin Invoice', () => { 13 | describe('Creating bitcoin invoice', () => { 14 | it(`Should return an object { bitcoinAddress, bitcoinAmount, amount, 15 | currency, sciName, orderId, note }`, async () => { 16 | 17 | const client = await advcash({ 18 | password: password, 19 | apiName: apiName, 20 | accountEmail: accountEmail, 21 | }) 22 | 23 | const promise = client.createBitcoinInvoice({ 24 | amount: 1.0, 25 | currency: "USD" 26 | }) 27 | 28 | return Promise.all([ 29 | expect(promise).to.eventually.have.property('bitcoinAddress').with.a("string"), 30 | expect(promise).to.eventually.have.property('bitcoinAmount').with.a("number"), 31 | expect(promise).to.eventually.have.property('amount').with.a("number"), 32 | expect(promise).to.eventually.have.property('currency').with.a("string"), 33 | expect(promise).to.eventually.have.property('sciName').with.a("string"), 34 | expect(promise).to.eventually.have.property('orderId').with.a("string"), 35 | expect(promise).to.eventually.have.property('note').with.a("string") 36 | ]); 37 | }) 38 | }) 39 | }) -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "advcash", 3 | "version": "1.0.7", 4 | "description": "node.js wrapper for advcash cryptocurrency exchange", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "test": "nyc --reporter=lcov mocha --timeout 10000", 8 | "compile": "babel -d lib/ src/", 9 | "prepublish": "npm run compile", 10 | "dev": "mocha --timeout 10000 --require babel-core/register --require dotenv/config" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/eriknakata/advcash" 15 | }, 16 | "keywords": [ 17 | "advcash", 18 | "bitcoin", 19 | "cryptocurrency", 20 | "btc", 21 | "wrapper" 22 | ], 23 | "author": "Erik Nakata ", 24 | "license": "MIT", 25 | "homepage": "https://github.com/eriknakata/advcash#readme", 26 | "dependencies": { 27 | "moment-timezone": "^0.5.13", 28 | "sha.js": "^2.4.8", 29 | "soap-as-promised": "^1.19.0" 30 | }, 31 | "devDependencies": { 32 | "babel-cli": "^6.24.1", 33 | "babel-plugin-add-module-exports": "^0.2.1", 34 | "babel-plugin-istanbul": "^4.1.1", 35 | "babel-preset-env": "^1.4.0", 36 | "chai": "^3.5.0", 37 | "chai-as-promised": "^6.0.0", 38 | "dotenv": "^4.0.0", 39 | "istanbul": "^0.4.5", 40 | "mocha": "^3.2.0", 41 | "nodemon": "^1.11.0", 42 | "nyc": "^10.2.0" 43 | }, 44 | "engines": { 45 | "node": ">=6.0.0" 46 | }, 47 | "nyc": { 48 | "sourceMap": false, 49 | "instrument": false, 50 | "require": [ 51 | "babel-register", 52 | "babel-polyfill" 53 | ] 54 | }, 55 | "contributors": [ 56 | { 57 | "email": "leonardocadastro69@gmail.com", 58 | "name": "Leonardo Cadastro" 59 | }, 60 | { 61 | "name": "Erik Nakata", 62 | "email": "erik.nakata5@gmail.com" 63 | } 64 | ], 65 | "bugs": { 66 | "url": "https://github.com/eriknakata/advcash/issues" 67 | }, 68 | "files": [ 69 | "lib" 70 | ] 71 | } 72 | -------------------------------------------------------------------------------- /test/find-transaction.js: -------------------------------------------------------------------------------- 1 | import advcash from '../src/index' 2 | import chai from 'chai' 3 | import chaiAsPromised from 'chai-as-promised' 4 | 5 | const expect = chai.expect 6 | const password = process.env.ADVCASH_PASSWORD 7 | const accountEmail = process.env.ADVCASH_ACCOUNT_EMAIL 8 | const apiName = process.env.ADVCASH_API_NAME 9 | const advcashSoapUrl = process.env.ADVCASH_SOAP_URL 10 | 11 | chai.use(chaiAsPromised) 12 | 13 | describe('Find Transaction', () => { 14 | describe('Transaction Search by ID', () => { 15 | it(`Should return an array of object { id, comment, startTime, status, transactionName, sci, walletSrcId, 16 | walletDestId, senderEmail, receiverEmail, amount, currency, fullCommission, direction, orderId }`, async () => { 17 | 18 | const client = await advcash({ 19 | password: password, 20 | apiName: apiName, 21 | accountEmail: accountEmail, 22 | }) 23 | 24 | const promise = client.findTransaction("4744c507-45bd-410e-9027-d8a25fc8c510") 25 | 26 | return Promise.all([ 27 | expect(promise).to.eventually.have.property('id').with.a("string"), 28 | expect(promise).to.eventually.have.property('comment').with.a("string"), 29 | expect(promise).to.eventually.have.property('startTime').with.a("date"), 30 | expect(promise).to.eventually.have.property('status').with.a("string"), 31 | expect(promise).to.eventually.have.property('transactionName').with.a("string"), 32 | expect(promise).to.eventually.have.property('sci').with.a("boolean"), 33 | expect(promise).to.eventually.have.property('walletSrcId').with.a("string"), 34 | expect(promise).to.eventually.have.property('walletDestId').with.a("string"), 35 | expect(promise).to.eventually.have.property('senderEmail').with.a("string"), 36 | expect(promise).to.eventually.have.property('receiverEmail').with.a("string"), 37 | expect(promise).to.eventually.have.property('amount').with.a("number"), 38 | expect(promise).to.eventually.have.property('currency').with.a("string"), 39 | expect(promise).to.eventually.have.property('fullCommission').with.a("number"), 40 | expect(promise).to.eventually.have.property('direction').with.a("string"), 41 | expect(promise).to.eventually.have.property('orderId').with.a("string"), 42 | ]); 43 | }) 44 | }) 45 | }) -------------------------------------------------------------------------------- /test/history.js: -------------------------------------------------------------------------------- 1 | import advcash from '../src/index' 2 | import chai from 'chai' 3 | import chaiAsPromised from 'chai-as-promised' 4 | 5 | const expect = chai.expect 6 | const password = process.env.ADVCASH_PASSWORD 7 | const accountEmail = process.env.ADVCASH_ACCOUNT_EMAIL 8 | const apiName = process.env.ADVCASH_API_NAME 9 | const advcashSoapUrl = process.env.ADVCASH_SOAP_URL 10 | 11 | chai.use(chaiAsPromised) 12 | 13 | describe('History', () => { 14 | describe('Transaction History', () => { 15 | it(`Should return an array of object { id, comment, startTime, status, transactionName, sci, walletSrcId, 16 | walletDestId, senderEmail, receiverEmail, amount, currency, fullCommission, direction, orderId }`, async () => { 17 | const client = await advcash({ 18 | password: password, 19 | apiName: apiName, 20 | accountEmail: accountEmail, 21 | }) 22 | 23 | const promise = client.history({ 24 | count: 5 25 | }) 26 | 27 | return Promise.all([ 28 | expect(promise).to.eventually.be.instanceof(Array).lengthOf(5), 29 | expect(promise).to.eventually.have.deep.property('[0].id').with.a("string"), 30 | expect(promise).to.eventually.have.deep.property('[0].comment').with.a("string"), 31 | expect(promise).to.eventually.have.deep.property('[0].startTime').with.a("date"), 32 | expect(promise).to.eventually.have.deep.property('[0].status').with.a("string"), 33 | expect(promise).to.eventually.have.deep.property('[0].transactionName').with.a("string"), 34 | expect(promise).to.eventually.have.deep.property('[0].sci').with.a("boolean"), 35 | expect(promise).to.eventually.have.deep.property('[0].walletSrcId').with.a("string"), 36 | expect(promise).to.eventually.have.deep.property('[0].walletDestId').with.a("string"), 37 | expect(promise).to.eventually.have.deep.property('[0].senderEmail').with.a("string"), 38 | expect(promise).to.eventually.have.deep.property('[0].receiverEmail').with.a("string"), 39 | expect(promise).to.eventually.have.deep.property('[0].amount').with.a("number"), 40 | expect(promise).to.eventually.have.deep.property('[0].currency').with.a("string"), 41 | expect(promise).to.eventually.have.deep.property('[0].fullCommission').with.a("number"), 42 | expect(promise).to.eventually.have.deep.property('[0].direction').with.a("string"), 43 | expect(promise).to.eventually.have.deep.property('[0].orderId').with.a("string"), 44 | ]); 45 | }) 46 | }) 47 | }) -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import getbalances from './get-balances' 2 | import checkCurrencyMap from './check-currency-exchange' 3 | import validateAccountMap from './validate-account' 4 | import validateAccountsMap from './validate-accounts' 5 | import requestArgs from './request-args' 6 | import soap from './soap-client' 7 | import historyMap from './history' 8 | import findTransactionMap from './find-transaction' 9 | import createBitcoinInvoice from './create-bitcoin-invoice' 10 | 11 | export default async ({ password, apiName, accountEmail, advcashSoapUrl = 'https://wallet.advcash.com/wsm/merchantWebService?wsdl' }) => { 12 | const arg0 = requestArgs(apiName, password, accountEmail) 13 | const advcashClient = await soap(advcashSoapUrl) 14 | 15 | return { 16 | getbalances: () => advcashClient("getBalances", { arg0 }, getbalances), 17 | 18 | checkCurrencyExchange: (arg1) => advcashClient("checkCurrencyExchange", { 19 | arg0, 20 | arg1 21 | }, checkCurrencyMap), 22 | 23 | validateAccount: (arg1) => advcashClient("validateAccount", { 24 | arg0, 25 | arg1 26 | }, validateAccountMap), 27 | 28 | validateAccounts: (arg1) => advcashClient("validateAccounts", { 29 | arg0, 30 | arg1 31 | }, validateAccountsMap), 32 | 33 | validationSendMoney: (arg1) => advcashClient("validationSendMoney", { 34 | arg0, 35 | arg1 36 | }), 37 | 38 | history: (arg1) => advcashClient("history", { 39 | arg0, 40 | arg1 41 | }, historyMap), 42 | 43 | validationSendMoneyToAdvcashCard: (arg1) => advcashClient("validationSendMoneyToAdvcashCard", { 44 | arg0, 45 | arg1 46 | }), 47 | 48 | validationSendMoneyToEcurrency: (arg1) => advcashClient("validationSendMoneyToEcurrency", { 49 | arg0, 50 | arg1 51 | }), 52 | 53 | currencyExchange: (arg1) => advcashClient("currencyExchange", { 54 | arg0, 55 | arg1 56 | }), 57 | 58 | sendMoneyToEmail: (arg1) => advcashClient("sendMoneyToEmail", { 59 | arg0, 60 | arg1 61 | }), 62 | 63 | findTransaction: transactionId => advcashClient("findTransaction", { 64 | arg0, 65 | arg1: transactionId 66 | }, findTransactionMap), 67 | 68 | validationCurrencyExchange: (arg1) => advcashClient("validationCurrencyExchange", { 69 | arg0, 70 | arg1 71 | }), 72 | 73 | validationSendMoneyToEmail: (arg1) => advcashClient("validationSendMoneyToEmail", { 74 | arg0, 75 | arg1 76 | }), 77 | 78 | sendMoney: (arg1) => advcashClient("sendMoney", { 79 | arg0, 80 | arg1 81 | }), 82 | 83 | sendMoneyToAdvcashCard: (arg1) => advcashClient("sendMoneyToAdvcashCard", { 84 | arg0, 85 | arg1 86 | }), 87 | 88 | validationSendMoneyToBankCard: (arg1) => advcashClient("validationSendMoneyToBankCard", { 89 | arg0, 90 | arg1 91 | }), 92 | 93 | sendMoneyToEcurrency: (arg1) => advcashClient("sendMoneyToEcurrency", { 94 | arg0, 95 | arg1 96 | }), 97 | 98 | validationSendMoneyToBtcE: (arg1) => advcashClient("validationSendMoneyToBtcE", { 99 | arg0, 100 | arg1 101 | }), 102 | 103 | sendMoneyToBtcE: (arg1) => advcashClient("sendMoneyToBtcE", { 104 | arg0, 105 | arg1 106 | }), 107 | 108 | validationSendMoneyToExmo: (arg1) => advcashClient("validationSendMoneyToExmo", { 109 | arg0, 110 | arg1 111 | }), 112 | 113 | sendMoneyToExmo: (arg1) => advcashClient("sendMoneyToExmo", { 114 | arg0, 115 | arg1 116 | }), 117 | 118 | createBitcoinInvoice: (arg1) => advcashClient("createBitcoinInvoice", { 119 | arg0, 120 | arg1 121 | }, createBitcoinInvoice), 122 | } 123 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/eriknakata/advcash.svg?branch=master)](https://travis-ci.org/eriknakata/advcash) 2 | [![Code Climate](https://codeclimate.com/github/eriknakata/advcash/badges/gpa.svg)](https://codeclimate.com/github/eriknakata/advcash) 3 | [![Test Coverage](https://codeclimate.com/github/eriknakata/advcash/badges/coverage.svg)](https://codeclimate.com/github/eriknakata/advcash/coverage) 4 | [![dependencies Status](https://david-dm.org/eriknakata/advcash/status.svg)](https://david-dm.org/eriknakata/advcash) 5 | 6 | # Advcash 7 | 8 | node.js wrapper for [advcash](http://wallet.advcash.com/referral/d3bd61a9-5950-4d1b-8607-ec4c0f7a3576) cryptocurrency exchange 9 | 10 | ### Documentation 11 | 12 | The official documentation can be found [here](https://advcash.com/files/documents/advcash.merchantapi-1.9_en.pdf) 13 | 14 | ### Prerequisites 15 | 16 | 17 | - Node 6.0 18 | - Advcash account ([click here](http://wallet.advcash.com/referral/d3bd61a9-5950-4d1b-8607-ec4c0f7a3576) to register) 19 | - Advcash api key 20 | 21 | 22 | ### Installing 23 | 24 | ``` 25 | npm install --save advcash 26 | ``` 27 | 28 | ## Examples 29 | 30 | All methods returns a promise as result 31 | 32 | ### client 33 | 34 | ```js 35 | var advcash = require('advcash'); 36 | 37 | var options = { 38 | password: 'password created previously', 39 | apiName: 'api created previously', 40 | accountEmail: 'email used to create the advcash account' 41 | }; 42 | 43 | advcash(options).then(function(client) { 44 | // client is ready 45 | }) 46 | 47 | ``` 48 | 49 | ### checkCurrencyExchange 50 | 51 | Getting the currency exchange rate 52 | 53 | #### Arguments 54 | 55 | | Name | Type | Description | 56 | |----------|---------|---------------------------------------------------------------------| 57 | | from | String | [Transfer currencies](#transfer-currencies) | 58 | | to | String | [Transfer currencies](#transfer-currencies) | 59 | | action | String | BUY, SELL | 60 | | amount | Float | Transaction amount (accuracy – up to two digits after decimal point)| 61 | 62 | ```js 63 | 64 | var arguments = { 65 | from: "BTC", 66 | to: "USD", 67 | action: "SELL", 68 | amount: 0.5 69 | }; 70 | 71 | client.checkCurrencyExchange(arguments).then(function(response) { 72 | console.log(response) 73 | }) 74 | 75 | ``` 76 | 77 | > Response 78 | 79 | ```json 80 | 81 | { 82 | "amountExchanged": 636.32, 83 | "rate": 1272.63, 84 | "from": "BTC", 85 | "to": "USD", 86 | "action": "SELL", 87 | "amount": 0.5 88 | } 89 | 90 | ``` 91 | 92 | ### getBalances 93 | 94 | Get Balance per User’s Wallets 95 | 96 | ```js 97 | 98 | client.getBalances().then(function(balances) { 99 | console.log(balances) 100 | }) 101 | 102 | ``` 103 | 104 | > Response 105 | 106 | ```json 107 | 108 | [ 109 | { 110 | "amount": 0.55, 111 | "id": "U768564323906" 112 | }, 113 | { 114 | "amount": 0.80, 115 | "id": "E527005319826" 116 | } 117 | ] 118 | 119 | ``` 120 | 121 | ### validateAccount 122 | 123 | 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 124 | 125 | ```js 126 | 127 | var arguments = { 128 | email: "email@example.com", 129 | firstName: "First name example", 130 | lastName: "Last name example" 131 | }; 132 | 133 | client.validateAccount(arguments).then(function(response) { 134 | console.log(response) 135 | }) 136 | 137 | ``` 138 | 139 | > Response 140 | 141 | ```json 142 | 143 | { 144 | "firstNameMatchingPercentage": 90.55, 145 | "rate": 55.56 146 | } 147 | 148 | ``` 149 | 150 | 151 | ### validateAccounts 152 | 153 | Validation of Account’s Existence 154 | 155 | ```js 156 | 157 | var emails = ['email1@example.com', 'email2@example.com'] 158 | 159 | client.validateAccounts(emails).then(function(response) { 160 | console.log(response) 161 | }) 162 | 163 | ``` 164 | 165 | > Response 166 | 167 | ```json 168 | 169 | [ 170 | { 171 | "present": false, 172 | "accountEmail": "email1@example.com" 173 | }, 174 | { 175 | "present": true, 176 | "accountEmail": "email2@example.com" 177 | } 178 | ] 179 | 180 | ``` 181 | 182 | ### history 183 | 184 | Transaction History 185 | 186 | #### Arguments 187 | 188 | | Name | Type | Description | 189 | |---------------------|---------|---------------------------------------------------------------------| 190 | | from | Int | Ordinal number of transaction to start displaying with | 191 | | count | Int | The number of transactions for disiplaying | 192 | | sortOrder | String | ASC, DESC | 193 | | startTimeFrom       | Date   | Start date for transactions to be selected | 194 | | startTimeTo       | Date   | End date for transactions to be selected                         | 195 | | transactionName     | String | [Transaction Names](#transaction-names)                       | 196 | | transactionStatus   | String  | [Transaction Statuses](#transaction-statuses) | 197 | | walletId | String | Wallet | 198 | 199 | ```js 200 | 201 | var arguments = { 202 | from: 1, 203 | count: 5, 204 | sortOrder: "ASC", 205 | startTimeFrom: new Date('2017-01-02'), 206 | startTimeTo: new Date(), 207 | transactionName: 'CURRENCY_EXCHANGE', 208 | transactionStatus: 'COMPLETED' 209 | }; 210 | 211 | client.history(arguments).then(function(response) { 212 | console.log(response) 213 | }) 214 | 215 | ``` 216 | 217 | > Response 218 | 219 | ```json 220 | 221 | { 222 | "id": "8d088e53-462c-4eb5-b596-70060db6b66d", 223 | "activityLevel": 0, 224 | "amount": 10.24, 225 | "comment": "", 226 | "currency": "EUR", 227 | "direction": "OUTGOING", 228 | "fullCommission": 0.00, 229 | "receiverEmail": "receiver@example.com", 230 | "sci": false, 231 | "senderEmail": "sender@example.com", 232 | "startTime": "2017-03-25T19:46:56.843Z", 233 | "status": "COMPLETED", 234 | "transactionName": "CURRENCY_EXCHANGE", 235 | "walletDestId": "U768564448973", 236 | "walletSrcId": "E5270053223408" 237 | } 238 | 239 | ``` 240 | 241 | ### validationSendMoney 242 | 243 | Validation of Intrasystem Transfer 244 | 245 | #### Arguments 246 | 247 | | Name | Type | Description | 248 | |----------------------|---------|-----------------------------------------------------------------------| 249 | | amount | Float | Transaction amount (accuracy – up to two digits after decimal point) | 250 | | currency | String | [Transfer currencies](#transfer-currencies) | 251 | | email | String | Recipient’s email (Required if “walletId” is empty) | 252 | | walletId       | String  | Recipient’s wallet (Required if “email” is empty) | 253 | | note       | String  | Note to transaction                         | 254 | | savePaymentTemplate | Boolean | Indicator of saving the current payment template                      | 255 | 256 | 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. 257 | 258 | ```js 259 | 260 | var arguments = { 261 | amount: 0.10, 262 | currency: "USD", 263 | email: "example@example.com", 264 | note: "testing", 265 | savePaymentTemplate: true 266 | } 267 | 268 | client.validationSendMoney(arguments).then(function(response) { 269 | console.log(response) // null 270 | }) 271 | .catch(function(error) { 272 | console.log(error) 273 | }) 274 | 275 | ``` 276 | 277 | > Response 278 | 279 | ```json 280 | 281 | null 282 | 283 | ``` 284 | 285 | ### validationSendMoneyToAdvcashCard 286 | 287 | Validation of Funds Transfer to Advanced Cash Card 288 | 289 | #### Arguments 290 | 291 | | Name | Type | Description | 292 | |----------------------|---------|--------------------------------------------------------------------------------| 293 | | amount | Float | Transaction amount (accuracy – up to two digits after decimal point) | 294 | | currency | String | [Transfer currencies](#transfer-currencies) | 295 | | email | String | Email of the user that owns the card | 296 | | cardType             | String | [Card type which will be used for the transfer of funds](#advcash-cards-types) | 297 | | note       | String  | Note to transaction                         | 298 | | savePaymentTemplate | Boolean | Indicator of saving the current payment template                       | 299 | 300 | 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. 301 | 302 | ```js 303 | 304 | var arguments = { 305 | amount: 0.10, 306 | currency: "USD", 307 | email: "example@example.com", 308 | cardType: "PLASTIC", 309 | note: "testing", 310 | savePaymentTemplate: true 311 | } 312 | 313 | client.validationSendMoneyToAdvcashCard(arguments).then(function(response) { 314 | console.log(response) // null 315 | }) 316 | .catch(function(error) { 317 | console.log(error) 318 | }) 319 | 320 | ``` 321 | 322 | > Response 323 | 324 | ```json 325 | 326 | null 327 | 328 | ``` 329 | 330 | ### validationSendMoneyToEcurrency 331 | 332 | Validation of Withdrawal to a third-party payment system 333 | 334 | #### Arguments 335 | 336 | | Name | Type | Description | 337 | |----------------------|---------|--------------------------------------------------------------------------------| 338 | | amount               | Float   | Transaction amount (accuracy – up to two digits after decimal point). Required if ecurrency is not BITCOIN | 339 | | btcAmount | Float | Transaction 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 | 340 | | currency | String | [Transfer currencies](#transfer-currencies) | 341 | | ecurrency | String | [Ecurrencies](#ecurrencies) | 342 | | receiver             | String | ID or wallet of the recipient in the third-party payment system | 343 | | note       | String  | Note to transaction                         | 344 | | savePaymentTemplate | Boolean | Indicator of saving the current payment template                       | 345 | 346 | 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. 347 | 348 | ```js 349 | 350 | var arguments = { 351 | amount: 1.00, 352 | currency: "USD", 353 | ecurrency: "ECOIN", 354 | receiver: "1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp", 355 | note: "testing", 356 | savePaymentTemplate: false 357 | } 358 | 359 | client.validationSendMoneyToEcurrency(arguments).then(function(response) { 360 | console.log(response) // null 361 | }) 362 | .catch(function(error) { 363 | console.log(error) 364 | }) 365 | 366 | ``` 367 | 368 | > Response 369 | 370 | ```json 371 | 372 | null 373 | 374 | ``` 375 | 376 | ### findTransaction 377 | 378 | Transaction Search by ID 379 | 380 | #### Arguments 381 | 382 | | Name | Type | Description | 383 | |----------------|---------|-------------------| 384 | | transactionId | String | Transaction ID | 385 | 386 | ```js 387 | 388 | client.findTransaction("e5383553-f66c-4073-b81d-86e7c3756cdb").then(function(response) { 389 | console.log(response) 390 | }) 391 | 392 | ``` 393 | 394 | > Response 395 | 396 | ```json 397 | 398 | { 399 | "id": "e5383553-f66c-4073-b81d-86e7c3756cdb", 400 | "activityLevel": 0, 401 | "amount": 10.24, 402 | "comment": "", 403 | "currency": "EUR", 404 | "direction": "OUTGOING", 405 | "fullCommission": 0.00, 406 | "receiverEmail": "receiver@example.com", 407 | "sci": false, 408 | "senderEmail": "sender@example.com", 409 | "startTime": "2017-03-25T19:46:56.843Z", 410 | "status": "COMPLETED", 411 | "transactionName": "INNER_SYSTEM", 412 | "walletDestId": "U768564448973", 413 | "walletSrcId": "E5270053223408" 414 | } 415 | 416 | ``` 417 | 418 | ### currencyExchange 419 | 420 | Intrasystem Currency Exchange 421 | 422 | #### Arguments 423 | 424 | | Name | Type | Description | 425 | |--------|---------|-----------------------------------------------------------------------| 426 | | from | String | [Transfer currencies](#transfer-currencies) | 427 | | to | String | [Transfer currencies](#transfer-currencies) | 428 | | action | String | BUY, SELL | 429 | | amount | Float   | Transaction amount (accuracy – up to two digits after decimal point) | 430 | | note | String | Note to transaction | 431 | 432 | ```js 433 | 434 | var arguments = { 435 | from: "USD", 436 | to: "EUR", 437 | action: "SELL", 438 | amount: 1.00, 439 | note: "testing" 440 | } 441 | 442 | client.currencyExchange(arguments).then(function(transactionId) { 443 | console.log(transactionId) 444 | }) 445 | 446 | ``` 447 | 448 | > Response 449 | 450 | ```json 451 | 452 | "1575948b-6ead-426f-8ecf-ee7 aa3969c" 453 | 454 | ``` 455 | 456 | ### sendMoneyToEmail 457 | 458 | Transfer of Funds to Unregistered User via E-mail 459 | 460 | #### Arguments 461 | 462 | | Name | Type | Description | 463 | |-----------|---------|-----------------------------------------------------------------------| 464 | | currency | String | [Transfer currencies](#transfer-currencies) | 465 | | email | String | E-mail address of the payment recipient unregistered in Advanced Cash system (Immediate after registration in Advanced Cash system, user will receive funds transfer) | 466 | | amount | Float   | Transaction amount (accuracy – up to two digits after decimal point) | 467 | | note | String | Note to transaction | 468 | 469 | ```js 470 | 471 | var arguments = { 472 | amount: 0.10, 473 | currency: 'USD', 474 | email: 'example@example.com', 475 | note: "testing" 476 | } 477 | 478 | client.sendMoneyToEmail(arguments).then(function(transactionId) { 479 | console.log(transactionId) 480 | }) 481 | 482 | ``` 483 | 484 | > Response 485 | 486 | ```json 487 | 488 | "1575948b-6ead-426f-8ecf-ee7 aa3969c" 489 | 490 | ``` 491 | 492 | ### validationCurrencyExchange 493 | 494 | Validation of Currency Exchange 495 | 496 | #### Arguments 497 | 498 | | Name | Type | Description | 499 | |---------|---------|------------------------------------------------------------------------| 500 | | amount | Float   | Transaction amount (accuracy – up to two digits after decimal point). | 501 | | from | String | [Outgoing currency](#transfer-currencies) | 502 | | to     | String | [Incoming currency](#transfer-currencies)                             | 503 | | action | String | SELL, BUY | 504 | | note  | String  | Note to transaction                         | 505 | 506 | 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. 507 | 508 | ```js 509 | 510 | var arguments = { 511 | amount: 1.10, 512 | from: "USD", 513 | to: "EUR", 514 | action: "SELL", 515 | note: "testing" 516 | } 517 | 518 | client.validationCurrencyExchange(arguments).then(function(response) { 519 | console.log(response) // null 520 | }) 521 | .catch(function(error) { 522 | console.log(error) 523 | }) 524 | 525 | ``` 526 | 527 | > Response 528 | 529 | ```json 530 | 531 | null 532 | 533 | ``` 534 | ### validationSendMoneyToEmail 535 | 536 | Validation of Funds Transfer to Unregistered User via E-mail 537 | 538 | #### Arguments 539 | 540 | | Name | Type | Description | 541 | |--------- |---------|------------------------------------------------------------------------| 542 | | amount | Float   | Transaction amount (accuracy – up to two digits after decimal point). | 543 | | currency | String | [Transaction currency](#transfer-currencies)                          | 544 | | email | String | E-mail address of the payment recipient unregistered in Advanced Cash system (Immediately after registration in Advanced Cash system, user will receive funds transfer) | 545 | | note   | String  | Note to transaction                         | 546 | 547 | 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. 548 | 549 | ```js 550 | 551 | var arguments = { 552 | amount: 1.10, 553 | currency: "USD", 554 | email: "testing@testing.com", 555 | note: "testing" 556 | } 557 | 558 | client.validationSendMoneyToEmail(arguments).then(function(response) { 559 | console.log(response) // null 560 | }) 561 | .catch(function(error) { 562 | console.log(error) 563 | }) 564 | 565 | ``` 566 | 567 | > Response 568 | 569 | ```json 570 | null 571 | ``` 572 | 573 | ### sendMoney 574 | 575 | Intrasystem Payment 576 | 577 | #### Arguments 578 | 579 | | Name | Type | Description | 580 | |----------------------|---------|-----------------------------------------------------------------------| 581 | | amount | Float | Transaction amount (accuracy – up to two digits after decimal point) | 582 | | currency | String | [Transfer currencies](#transfer-currencies) | 583 | | email | String | Recipient’s email (Required if “walletId” is empty) | 584 | | walletId       | String  | Recipient’s wallet (Required if “email” is empty) | 585 | | note       | String  | Note to transaction                         | 586 | | savePaymentTemplate | Boolean | Indicator of saving the current payment template                      | 587 | 588 | ```js 589 | var arguments = client.sendMoney({ 590 | amount: 10.50, 591 | currency: "USD", 592 | email: "sample@sample.com", 593 | note: "testing", 594 | savePaymentTemplate: true 595 | }) 596 | 597 | client.sendMoney(arguments).then(function(response) { 598 | console.log(response) // null 599 | }) 600 | ``` 601 | 602 | > Response 603 | 604 | ```json 605 | "1575948b-6ead-426f-8ecf-ee7 aa3969c" 606 | ``` 607 | 608 | ### sendMoneyToAdvcashCard 609 | 610 | Transfer of Funds to Advanced Cash Card 611 | 612 | #### Arguments 613 | 614 | | Name | Type | Description | 615 | |----------------------|---------|--------------------------------------------------------------------------------| 616 | | amount | Float | Transaction amount (accuracy – up to two digits after decimal point) | 617 | | currency | String | [Transfer currencies](#transfer-currencies) | 618 | | email | String | Email of the user that owns the card | 619 | | cardType             | String | [Card type which will be used for the transfer of funds](#advcash-cards-types) | 620 | | note       | String  | Note to transaction                         | 621 | | savePaymentTemplate | Boolean | Indicator of saving the current payment template                       | 622 | 623 | ```js 624 | 625 | var arguments = { 626 | amount: 5.00, 627 | currency: "USD", 628 | email: "sample@sample.com", 629 | cardType: "PLASTIC", 630 | note: "testing", 631 | savePaymentTemplate: true 632 | } 633 | 634 | client.sendMoneyToAdvcashCard(arguments).then(function(response) { 635 | console.log(response) 636 | }) 637 | 638 | ``` 639 | 640 | > Response 641 | 642 | ```json 643 | 644 | "1575948b-6ead-426f-8ecf-ee7 aa3969c" 645 | 646 | ``` 647 | 648 | ### validationSendMoneyToBankCard 649 | 650 | Validation of Funds Transfer to External Card Not Tied to System 651 | 652 | #### Arguments 653 | 654 | | Name | Type | Description | 655 | |----------------------|---------|-----------------------------------------------------------------------------------------| 656 | | amount | Float | Transaction amount (accuracy – up to two digits after decimal point) | 657 | | currency | String | [Transfer currencies](#transfer-currencies) | 658 | | cardNumber | String | External card number for finds withdrawal | 659 | | expiryMonth         | String | Two digits that signify the month of the card’s expiration date (e.g. 09 for September) | 660 | | expiryYear           | String | Two last digits of the year of the card’s expiration date (e.g. 17 for year 2017) | 661 | | note       | String  | Note to transaction                         | 662 | | savePaymentTemplate | Boolean | Indicator of saving the current payment template                       | 663 | 664 | 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. 665 | 666 | ```js 667 | 668 | var arguments = { 669 | amount: 4.00, 670 | currency: "USD", 671 | cardNumber: "4532881212776308", 672 | expiryMonth: "12", 673 | expiryYear: "18", 674 | note: "testing", 675 | savePaymentTemplate: false 676 | } 677 | 678 | client.validationSendMoneyToBankCard(arguments).then(function(response) { 679 | console.log(response) 680 | }) 681 | 682 | ``` 683 | 684 | > Response 685 | 686 | ```json 687 | 688 | null 689 | 690 | ``` 691 | 692 | ### sendMoneyToBankCard 693 | 694 | Transfer of Funds to External Bank Card 695 | 696 | #### Arguments 697 | 698 | | Name | Type | Description | 699 | |----------------------|---------|-----------------------------------------------------------------------------------------| 700 | | amount | Float | Transaction amount (accuracy – up to two digits after decimal point) | 701 | | currency | String | [Transfer currencies](#transfer-currencies) | 702 | | cardNumber | String | External card number for finds withdrawal | 703 | | expiryMonth         | String | Two digits that signify the month of the card’s expiration date (e.g. 09 for September) | 704 | | expiryYear           | String | Two last digits of the year of the card’s expiration date (e.g. 17 for year 2017) | 705 | | note       | String  | Note to transaction                         | 706 | | savePaymentTemplate | Boolean | Indicator of saving the current payment template                       | 707 | 708 | ```js 709 | 710 | var arguments = { 711 | amount: 4.00, 712 | currency: "USD", 713 | cardNumber: "4532881212776308", 714 | expiryMonth: "12", 715 | expiryYear: "18", 716 | note: "testing", 717 | savePaymentTemplate: false 718 | } 719 | 720 | client.sendMoneyToBankCard(arguments).then(function(response) { 721 | console.log(response) 722 | }) 723 | 724 | ``` 725 | 726 | > Response 727 | 728 | ```json 729 | 730 | "20931ce4-f4c9-4cc5-84f7-f7efb38c939c" 731 | 732 | ``` 733 | 734 | ### sendMoneyToEcurrency 735 | 736 | Withdrawal to a third-party payment system 737 | 738 | #### Arguments 739 | 740 | | Name | Type | Description | 741 | |----------------------|---------|-----------------------------------------------------------------------------------------| 742 | | amount | Float | Transaction amount (accuracy – up to two digits after decimal point) | 743 | | btcAmount | Float | Transaction amount in BTC currency when you need to withdraw exact BTC amount (accuracy – up to six digits after decimal point) | 744 | | currency | String | [Transfer currencies](#transfer-currencies) | 745 | | ecurrency           | String | [Ecurrencies](#ecurrencies)                                             | 746 | | cardNumber | String | External card number for finds withdrawal | 747 | | receiver           | String | ID or wallet of the recipient in the third-party payment system     | 748 | | note       | String  | Note to transaction                         | 749 | | savePaymentTemplate | Boolean | Indicator of saving the current payment template                       | 750 | 751 | ```js 752 | 753 | var arguments = { 754 | amount: 1.00, 755 | currency: "USD", 756 | ecurrency: "ECOIN", 757 | receiver: address, 758 | note: "testing", 759 | savePaymentTemplate: false 760 | } 761 | 762 | client.sendMoneyToEcurrency(arguments).then(function(response) { 763 | console.log(response) 764 | }) 765 | 766 | ``` 767 | 768 | > Response 769 | 770 | ```json 771 | 772 | "d28a6da7-451d-41c4-93f8-cd0084c72f96" 773 | 774 | ``` 775 | 776 | ### createBitcoinInvoice 777 | 778 | Creating bitcoin invoice 779 | 780 | #### Arguments 781 | 782 | | Name | Type | Description | 783 | |----------------------|---------|-----------------------------------------------------------------------------------------| 784 | | amount | Float | Transaction amount (accuracy – up to two digits after decimal point) | 785 | | currency | String | [Transfer currencies](#transfer-currencies) | 786 | | sciName | String | Shopping Cart Interface name (optional parameter) | 787 | | orderId           | String | Id of the order (optional parameter) | 788 | | note       | String  | Note to transaction (optional parameter)             | 789 | 790 | ```js 791 | 792 | var arguments = { 793 | amount: 1.0, 794 | currency: "USD" 795 | } 796 | 797 | client.createBitcoinInvoice(arguments).then(function(response) { 798 | console.log(response) 799 | }) 800 | 801 | ``` 802 | 803 | > Response 804 | 805 | ```json 806 | 807 | { 808 | "bitcoinAddress": "1C8jQAkHwE87bTmyDXSKdNyf8B8MnGYhpp", 809 | "bitcoinAmount": 0.001388, 810 | "amount": 1.00, 811 | "currency": "USD", 812 | "sciName": "sci_name", 813 | "orderId": "12345", 814 | "note": "Some note" 815 | } 816 | 817 | ``` 818 | 819 | ### register 820 | 821 | Register a new user 822 | 823 | #### Arguments 824 | 825 | | Name | Type | Description | 826 | |----------------------|---------|--------------------| 827 | | email | String | User's email | 828 | | firstName | String | User's first name | 829 | | lastName | String | User's last name | 830 | | language          | String | en, ru | 831 | 832 | 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. 833 | 834 | ```js 835 | 836 | var arguments = { 837 | email: "test@test.com", 838 | firstName: "First name", 839 | lastName: "Last name", 840 | language: "en" 841 | } 842 | 843 | client.register(arguments).then(function(response) { 844 | console.log(response) 845 | }) 846 | 847 | ``` 848 | 849 | > Response 850 | 851 | ```json 852 | 853 | null 854 | 855 | ``` 856 | 857 | ### sendMoneyToExmo 858 | 859 | Withdrawal to EXMO 860 | 861 | #### Arguments 862 | 863 | | Name | Type | Description | 864 | |----------------------|---------|-----------------------------------------------------------------------------------------| 865 | | amount | Float | Transaction amount (accuracy – up to two digits after decimal point) | 866 | | currency | String | [Transfer currencies](#transfer-currencies) | 867 | | note       | String  | Note to transaction (optional parameter)             | 868 | 869 | ```js 870 | 871 | var arguments = { 872 | amount: 1.10, 873 | currency: "USD", 874 | note: "testing" 875 | } 876 | 877 | client.sendMoneyToExmo(arguments).then(function(response) { 878 | console.log(response) 879 | }) 880 | .catch(function(error) { 881 | console.log(error) 882 | }) 883 | 884 | ``` 885 | 886 | > Response 887 | 888 | ```json 889 | 890 | { 891 | "id": "d28a6da7-451d-41c4-93f8-cd0084c72f96", 892 | "coupon": "EX-CODE_22562_USD1d7f906bd79cb8e13200aa55c227a2fe9328bf17" 893 | } 894 | 895 | ``` 896 | 897 | ### validationSendMoneyToBtcE 898 | 899 | Validation of Withdrawal to BTC-E 900 | 901 | #### Arguments 902 | 903 | | Name | Type | Description | 904 | |----------------------|---------|-----------------------------------------------------------------------------------------| 905 | | amount | Float | Transaction amount (accuracy – up to two digits after decimal point) | 906 | | currency | String | [Transfer currencies](#transfer-currencies) | 907 | | note       | String  | Note to transaction (optional parameter)             | 908 | 909 | 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. 910 | 911 | ```js 912 | 913 | var arguments = { 914 | amount: 1.10, 915 | currency: "USD", 916 | note: "testing" 917 | } 918 | 919 | client.validationSendMoneyToBtcE(arguments).then(function(response) { 920 | console.log(response) // null 921 | }) 922 | .catch(function(error) { 923 | console.log(error) 924 | }) 925 | ``` 926 | 927 | > Response 928 | 929 | ```json 930 | 931 | null 932 | 933 | ``` 934 | 935 | ### validationSendMoneyToExmo 936 | 937 | Validation of Withdrawal to EXMO 938 | 939 | #### Arguments 940 | 941 | | Name | Type | Description | 942 | |----------------------|---------|-----------------------------------------------------------------------------------------| 943 | | amount | Float | Transaction amount (accuracy – up to two digits after decimal point) | 944 | | currency | String | [Transfer currencies](#transfer-currencies) | 945 | | note       | String  | Note to transaction (optional parameter)             | 946 | 947 | 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. 948 | 949 | ```js 950 | 951 | var arguments = { 952 | amount: 1.10, 953 | currency: "USD", 954 | note: "testing" 955 | } 956 | 957 | client.validationSendMoneyToExmo(arguments).then(function(response) { 958 | console.log(response) // null 959 | }) 960 | .catch(function(error) { 961 | console.log(error) 962 | }) 963 | 964 | ``` 965 | 966 | > Response 967 | 968 | ```json 969 | 970 | null 971 | 972 | ``` 973 | 974 | ### sendMoneyToBtcE 975 | 976 | Withdrawal to BTC-E 977 | 978 | #### Arguments 979 | 980 | | Name | Type | Description | 981 | |----------------------|---------|-----------------------------------------------------------------------------------------| 982 | | amount | Float | Transaction amount (accuracy – up to two digits after decimal point) | 983 | | currency | String | [Transfer currencies](#transfer-currencies) | 984 | | note       | String  | Note to transaction (optional parameter)             | 985 | 986 | ```js 987 | 988 | var arguments = { 989 | amount: 1.10, 990 | currency: "USD", 991 | note: "testing" 992 | } 993 | 994 | client.sendMoneyToBtcE(arguments).then(function(response) { 995 | console.log(response) 996 | }) 997 | .catch(function(error) { 998 | console.log(error) 999 | }) 1000 | ``` 1001 | 1002 | > Response 1003 | 1004 | ```json 1005 | 1006 | { 1007 | "id": "d28a6da7-451d-41c4-93f8-cd0084c72f96", 1008 | "coupon": "EX-CODE_22562_USD1d7f906bd79cb8e13200aa55c227a2fe9328bf17" 1009 | } 1010 | 1011 | ``` 1012 | 1013 | 1014 | ### Transaction Statuses 1015 | 1016 | | Value | Description | 1017 | |------------|------------------------------------| 1018 | | PENDING | Transaction processing is pending | 1019 | | PROCESS | Transaction is being processed | 1020 | | COMPLETED | Transaction is completed | 1021 | | CANCELED   | Transaction is cancelled | 1022 | | CONFIRMED | Transaction is confirmed | 1023 | 1024 | ### Transaction Names 1025 | 1026 | | Value | Description | 1027 | |-----------------------------|--------------------------------------------| 1028 | | ALL | All transactions regardless of their type | 1029 | | CHECK_DEPOSIT | Funds deposit by bank check | 1030 | | WIRE_TRANSFER_DEPOSIT | Funds deposit from bank account | 1031 | | WIRE_TRANSFER_WITHDRAW   | Funds withdrawal to bank account | 1032 | | INNER_SYSTEM | Intrasystem funds transfer | 1033 | | CURRENCY_EXCHANGE | Currency exchange within account | 1034 | | BANK_CARD_TRANSFER | Funds withdrawal to external bank card | 1035 | | ADVCASH_CARD_TRANSFER | Funds transfer to Advanced Cash card | 1036 | | EXTERNAL_SYSTEM_DEPOSIT | Deposit funds through third-party system | 1037 | | EXTERNAL_SYSTEM_WITHDRAWAL | Withdrawal through third-party system | 1038 | | REPAYMENT | Funds repayment | 1039 | 1040 | ### Transfer Currencies 1041 | 1042 | | Value | Description | 1043 | |-------|--------------------| 1044 | | USD | US Dollar | 1045 | | EUR | Euro | 1046 | | RUR | Russian Rouble | 1047 | | GBP   | Pound Sterling | 1048 | | UAH | Ukrainian Hryvnia | 1049 | | BTC | Bitcoin | 1050 | 1051 | ### ADVCash cards Types 1052 | 1053 | | Value | Description | 1054 | |----------|--------------------| 1055 | | VIRTUAL | Virtual card   | 1056 | | PLASTIC | Plastic card | 1057 | 1058 | ### Ecurrencies 1059 | 1060 | | Value | Description | 1061 | |----------------|-------------------------------| 1062 | | BITCOIN | Withdrawal to BTC   | 1063 | | CAPITALIST | Capitalist payment system | 1064 | | ECOIN | Ecoin payment system | 1065 | | OKPAY | OkPay payment system | 1066 | | PAXUM | Paxum payment system | 1067 | | PAYEER | Payeer payment system | 1068 | | PERFECT_MONEY | Perfect Money payment system | 1069 | | WEB_MONEY | WebMoney payment system | 1070 | | QIWI | QIWI payment system | 1071 | | YANDEX_MONEY | Yandex.Money payment system | 1072 | 1073 | 1074 | ## Contributing 1075 | 1076 | - Erik Nakata 1077 | - Leonardo Cadastro 1078 | 1079 | ## License 1080 | 1081 | This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details 1082 | --------------------------------------------------------------------------------