currency-cloud
Advanced tools
Comparing version 3.0.4 to 3.1.2
@@ -149,3 +149,30 @@ /** | ||
return promise; | ||
}, | ||
/** | ||
* Gets details of the bank for a given identifier. | ||
* @param {Object} params Parameters object | ||
* @param {String} params.identifierType Type of the identifier, required | ||
* @param {String} params.identifierValue Value of the identifier, required | ||
* @return {Promise} Promise; if fulfilled returns object, which contains details of the bank; if rejected returns APIerror. | ||
*/ | ||
getBankDetails: function (params) { | ||
params = params || {}; | ||
if (!params.hasOwnProperty('identifierType')) { | ||
throw new Error('identifierType is required'); | ||
} | ||
if (!params.hasOwnProperty('identifierValue')) { | ||
throw new Error('identifierValue is required'); | ||
} | ||
var url = '/v2/reference/bank_details'; | ||
var promise = client.request({ | ||
url: url, | ||
method: 'GET', | ||
qs: params | ||
}); | ||
return promise; | ||
} | ||
}; |
{ | ||
"name": "currency-cloud", | ||
"description": "Currencycloud API v2 JavaScript client", | ||
"version": "3.0.4", | ||
"version": "3.1.2", | ||
"author": "Currencycloud", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -162,2 +162,22 @@ var nock = require('nock'); | ||
nock('https://devapi.currencycloud.com:443', {"encodedQueryParams":true}) | ||
.get('/v2/reference/bank_details') | ||
.query({"identifier_type":"iban","identifier_value":"GB19TCCL00997901654515"}) | ||
.reply(200, {"identifier_value":"GB19TCCL00997901654515","identifier_type":"iban","account_number":"GB19TCCL00997901654515","bic_swift":"TCCLGB22XXX","bank_name":"THE CURRENCY CLOUD LIMITED","bank_branch":"","bank_address":"12 STEWARD STREET THE STEWARD BUILDING FLOOR 0","bank_city":"LONDON","bank_state":"LONDON","bank_post_code":"E1 6FQ","bank_country":"UNITED KINGDOM","bank_country_ISO":"GB","currency":null}, [ 'Date', | ||
'Mon, 16 Jul 2018 16:24:27 GMT', | ||
'Content-Type', | ||
'application/json;charset=utf-8', | ||
'Content-Length', | ||
'640', | ||
'Connection', | ||
'close', | ||
'Server', | ||
'nginx', | ||
'X-Request-Id', | ||
'669f74a9-f731-4d32-b7d6-3013d9365d7a', | ||
'X-Content-Type-Options', | ||
'nosniff', | ||
'Vary', | ||
'Origin' ]); | ||
nock('https://devapi.currencycloud.com:443', {"encodedQueryParams":true}) | ||
.post('/v2/authenticate/close_session') | ||
@@ -164,0 +184,0 @@ .reply(200, {}, [ 'Date', |
@@ -130,2 +130,29 @@ 'use strict'; | ||
}); | ||
describe('getBankDetails', function () { | ||
it('successfully getsbank details', function (done) { | ||
currencyCloud.reference.getBankDetails({ | ||
identifierType: 'iban', | ||
identifierValue: 'GB19TCCL00997901654515' | ||
}) | ||
.then(function (res) { | ||
expect(res).is.not.empty; | ||
expect(res).to.have.property('accountNumber').that.eql("GB19TCCL00997901654515"); | ||
expect(res).to.have.property('bankAddress').that.eql("12 STEWARD STREET THE STEWARD BUILDING FLOOR 0"); | ||
expect(res).to.have.property('bankBranch').that.eql(""); | ||
expect(res).to.have.property('bankCity').that.eql("LONDON"); | ||
expect(res).to.have.property('bankCountry').that.eql("UNITED KINGDOM"); | ||
expect(res).to.have.property('bankCountry_ISO').that.eql("GB"); | ||
expect(res).to.have.property('bankName').that.eql("THE CURRENCY CLOUD LIMITED"); | ||
expect(res).to.have.property('bankPostCode').that.eql("E1 6FQ"); | ||
expect(res).to.have.property('bankState').that.eql("LONDON"); | ||
expect(res).to.have.property('bicSwift').that.eql("TCCLGB22XXX"); | ||
expect(res).to.have.property('currency').that.is.null; | ||
expect(res).to.have.property('identifierType').that.eql("iban"); | ||
expect(res).to.have.property('identifierValue').that.eql("GB19TCCL00997901654515"); | ||
done(); | ||
}) | ||
.catch(done); | ||
}); | ||
}); | ||
}); |
456359
10586