New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

currency-cloud

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

currency-cloud - npm Package Compare versions

Comparing version 2.0.1 to 3.0.4

51

lib/api/accounts.js

@@ -135,3 +135,54 @@ /**

return promise;
},
/**
* Gets payment charges settings for given account.
* @param {String} params.accountId Account Id or house account available in current visibility scope, required
* @return {Promise} Promise; if fulfilled returns object contains payment charges settings; if rejected returns APIerror.
*/
getPaymentChargesSettings: function (params) {
params = params || {};
if (!params.hasOwnProperty('accountId')) {
throw new Error('accountId is required');
}
var url = '/v2/accounts/' + params.accountId + '/payment_charges_settings';
var promise = client.request({
url: url,
method: 'GET'
});
return promise;
},
/**
* Updates an existing account.
* @param {Object} params Object, which contains parameters of the updated account
* @param {String} params.accountId Account Id or house account available in current visibility scope, required
* @param {String} params.chargeSettingsId Account Payment Charges Setting Id, required
* @return {Promise} Promise; if fulfilled returns object, which contains updated account; if rejected returns APIerror.
*/
updatePaymentChargesSettings: function (params) {
params = params || {};
if (!params.hasOwnProperty('accountId')) {
throw new Error('accountId is required');
}
if (!params.hasOwnProperty('chargeSettingsId')) {
throw new Error('chargeSettingsId is required');
}
var url = '/v2/accounts/' + params.accountId + '/payment_charges_settings/' + params.chargeSettingsId;
var qs = Object.assign({}, params);
delete qs.accountId;
delete qs.chargeSettingsId;
var promise = client.request({
url: url,
method: 'POST',
qs: qs
});
return promise;
}
};

1

lib/api/conversions.js

@@ -263,3 +263,2 @@ /**

/**

@@ -266,0 +265,0 @@ * Execute conversion split history and returns a json structure containing conversion split history

@@ -173,3 +173,3 @@ /**

* @param {Object} params Object, which contains parameters of the new payment
* @param {String} params.payment_ids Payment ids, required and array of payment_id(s)
* @param {String} params.paymentIds Payment Ids, required and array of payment_id(s)
* @return {Promise} Promise; if fulfilled returns object, which contains newly authorised payment(s); if rejected returns APIerror.

@@ -179,4 +179,4 @@ */

params = params || {};
if (!params.hasOwnProperty('payment_ids')) {
throw new Error('payment_ids is required');
if (!params.hasOwnProperty('paymentIds')) {
throw new Error('paymentIds is required');
}

@@ -195,2 +195,8 @@

/**
* Gets confirmation Id for a payment.
* @param {Object} params Parameters object
* @param {String} params.id Id of the requested payment, required
* @return {Promise} Promise; if fulfilled returns object, which contains requested payment; if rejected returns APIerror.
*/
getConfirmation: function (params) {

@@ -211,3 +217,38 @@ params = params || {};

return promise;
},
/**
* Gets payment delivery date.
* @param {Object} params Parameters object
* @param {String} params.paymentDate Payment release date in ISO 8601 format, eg. "2017-12-31", required
* @param {String} params.paymentType One of two typess: "priority", made using the SWIFT network; or "regular", made using the local bank network
* @param {String} params.currency 3-letter ISO code of the payment's currency, required
* @param {String} params.bankCountry 2-letter ISO code of the country where the payment is sent, required
* @return {Promise} Promise; if fulfilled returns object, which contains requested payment; if rejected returns APIerror.
*/
getPaymentDeliveryDate: function (params) {
params = params || {};
if (!params.hasOwnProperty('paymentDate')) {
throw new Error('paymentDate is required');
}
if (!params.hasOwnProperty('paymentType')) {
throw new Error('paymentType is required');
}
if (!params.hasOwnProperty('currency')) {
throw new Error('currency is required');
}
if (!params.hasOwnProperty('bankCountry')) {
throw new Error('bankCountry is required');
}
var url = '/v2/payments/payment_delivery_date' ;
var promise = client.request({
url: url,
method: 'GET',
qs: params
});
return promise;
}
};

@@ -27,2 +27,3 @@ /**

},
create_payment_report: function (params){

@@ -29,0 +30,0 @@ params = params || {};

@@ -53,3 +53,3 @@ /**

getSender: function (params) {
getSender: function (params) {
params = params || {};

@@ -56,0 +56,0 @@ if (!params.hasOwnProperty('id')) {

@@ -10,14 +10,7 @@ /**

module.exports = {
get: function (params) {
var url = '/v2/virtual_accounts';
var promise = client.request({
url: url,
method: 'GET',
qs: params
});
return promise;
},
/**
* Returns details of the VANs for the specified accounts
* @param {Object} params Object, which contains the VAN's parameters
* @return {Promise} Promise; if fulfilled returns object, which contains an array of transfers, as well as pagination information; if rejected returns APIerror.
*/
find: function (params) {

@@ -24,0 +17,0 @@ var url = '/v2/virtual_accounts/find';

{
"name": "currency-cloud",
"description": "Currencycloud API v2 JavaScript client",
"version": "2.0.1",
"version": "3.0.4",
"author": "Currencycloud",

@@ -24,5 +24,6 @@ "contributors": [

},
"homepage": "https://connect.currencycloud.com",
"homepage": "https://www.currencycloud.com",
"keywords": [
"currency cloud",
"currencycloud",
"api",

@@ -39,3 +40,3 @@ "client",

"request": "^2.88.0",
"request-promise": "^4.2.2",
"request-promise": "^4.2.4",
"retry": "^0.12.0",

@@ -46,4 +47,4 @@ "uuid": "^3.3.2"

"chai": "^4.2.0",
"jshint": "^2.9.7",
"mocha": "^5.2.0",
"jshint": "^2.10.2",
"mocha": "^6.1.4",
"nock": "^10.0.6"

@@ -50,0 +51,0 @@ },

@@ -133,2 +133,40 @@ 'use strict';

});
describe('getPaymentChargesSettings', function() {
it('fails if required parameters are missing', function() {
expect(function() {
currencyCloud.accounts.getPaymentChargesSettings(/*no params*/);
}).to.throw();
});
it('successfully gets payment charges settings for the account', function(done) {
currencyCloud.accounts.getPaymentChargesSettings({
accountId: mock.accounts.settings1().accountId
})
.then(function(gotten) {
expect(gotten.paymentChargesSettings).to.deep.include(mock.accounts.settings1());
done();
})
.catch(done);
});
});
describe('updatePaymentChargesSettings', function() {
it('fails if required parameters are missing', function() {
expect(function() {
currencyCloud.accounts.updatePaymentChargesSettings(/*no params*/);
}).to.throw();
});
it('successfully updates payment charges settings for the account', function(done) {
currencyCloud.accounts.updatePaymentChargesSettings(new mock.accounts.settings2())
.then(function(updated) {
expect(updated).to.eql(mock.accounts.settings2());
done();
})
.catch(done);
});
});
});

@@ -270,3 +270,38 @@ var nock = require('nock');

nock('https://devapi.currencycloud.com:443')
.get('/v2/accounts/cf28b2d8-5afa-4d7f-9a26-7b45bf616a11/payment_charges_settings')
.reply(200, {
"payment_charges_settings": [
{
"charge_settings_id": "37b48141-1b0b-4c76-bcbc-8ffb4c5a98e4",
"account_id": "cf28b2d8-5afa-4d7f-9a26-7b45bf616a11",
"charge_type": "ours",
"enabled": false,
"default": false
},
{
"charge_settings_id": "e43db1d1-2d48-4ed1-90ca-542ec45bcbe8",
"account_id": "cf28b2d8-5afa-4d7f-9a26-7b45bf616a11",
"charge_type": "shared",
"enabled": true,
"default": true
}
]
});
nock('https://devapi.currencycloud.com:443')
.post('/v2/accounts/cf28b2d8-5afa-4d7f-9a26-7b45bf616a11/payment_charges_settings/e43db1d1-2d48-4ed1-90ca-542ec45bcbe8', {
"charge_type": "shared",
"enabled": true,
"default": true
})
.reply(200, {
"charge_settings_id": "e43db1d1-2d48-4ed1-90ca-542ec45bcbe8",
"account_id": "cf28b2d8-5afa-4d7f-9a26-7b45bf616a11",
"charge_type": "shared",
"enabled": true,
"default": true
});
nock('https://devapi.currencycloud.com:443')
.post('/v2/authenticate/close_session')
.reply(200, {});

@@ -292,3 +292,3 @@ 'use strict';

return currencyCloud.payments.authorise({
payment_ids: [created.id]
paymentIds: [created.id]
})

@@ -335,3 +335,3 @@ .then(function (gotten) {

return currencyCloud.payments.authorise({
payment_ids: [data.created[0].id, data.created[1].id]
paymentIds: [data.created[0].id, data.created[1].id]
})

@@ -381,2 +381,24 @@ .then(function (gotten) {

});
describe('getPaymentDeliveryDate', function () {
it('fails if required parameters are missing', function () {
expect(function () {
currencyCloud.payments.getPaymentDeliveryDate(/*no params*/);
}).to.throw();
});
it('successfully gets a payment delivery date', function (done) {
currencyCloud.payments.getPaymentDeliveryDate({
paymentDate: mock.payments.delivery1().paymentDate,
paymentType: mock.payments.delivery1().paymentType,
currency: mock.payments.delivery1().currency,
bankCountry: mock.payments.delivery1().bankCountry
})
.then(function (gotten) {
expect(gotten).to.eql(mock.payments.delivery1());
done();
})
.catch(done);
});
});
});

@@ -27,14 +27,2 @@ 'use strict';

describe('get', function () {
it('successfully gets virtual accounts', function (done) {
currencyCloud.vans.get()
.then(function (gotten) {
expect(gotten).to.have.property('pagination').that.satisfy(mock.pagination.schema.validate);
expect(gotten.virtualAccounts[0]).that.satisfy(mock.vans.schema.validate);
done();
})
.catch(done);
});
});
describe('find', function () {

@@ -41,0 +29,0 @@ it('successfully finds virtual accounts', function (done) {

@@ -61,2 +61,20 @@ 'use strict';

},
settings1: function() {
return {
chargeSettingsId: '37b48141-1b0b-4c76-bcbc-8ffb4c5a98e4',
accountId: 'cf28b2d8-5afa-4d7f-9a26-7b45bf616a11',
chargeType: 'ours',
enabled: false,
default: false
};
},
settings2: function() {
return {
chargeSettingsId: 'e43db1d1-2d48-4ed1-90ca-542ec45bcbe8',
accountId: 'cf28b2d8-5afa-4d7f-9a26-7b45bf616a11',
chargeType: 'shared',
enabled: true,
default: true
};
},
schema: new JSONschema({

@@ -368,2 +386,12 @@ id: 'UUID',

},
delivery1: function() {
return {
paymentDate: '2018-01-01',
paymentDeliveryDate: '2018-01-01T00:00:00+00:00',
paymentCutoffTime: '2018-01-02T14:30:00+00:00',
paymentType: 'regular',
currency: 'EUR',
bankCountry: 'IT'
};
},
schema: new JSONschema({

@@ -370,0 +398,0 @@ id: 'UUID',

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc