From dc458de9e82d37d0c7bd513c9b247521677d2997 Mon Sep 17 00:00:00 2001 From: Gabriel Lupu Date: Wed, 31 Aug 2016 19:56:17 +0300 Subject: [PATCH 1/5] Initial mandates commit --- lib/apiMethods.js | 9 ++- lib/models/Mandate.js | 65 +++++++++++++++++ lib/models/MandateStatus.js | 6 ++ lib/services/Mandates.js | 134 ++++++++++++++++++++++++++++++++++++ test/services/Mandates.js | 28 ++++++++ 5 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 lib/models/Mandate.js create mode 100644 lib/models/MandateStatus.js create mode 100644 lib/services/Mandates.js create mode 100644 test/services/Mandates.js diff --git a/lib/apiMethods.js b/lib/apiMethods.js index d12518a..ebbd55b 100644 --- a/lib/apiMethods.js +++ b/lib/apiMethods.js @@ -95,5 +95,12 @@ module.exports = { "disputes_repudiation_get" : [ "/${apiVersion}/${clientId}/repudiations/${id}", "GET"], "disputes_repudiation_create_settlement" : [ "/${apiVersion}/${clientId}/repudiations/${id}/settlementtransfer", "POST"], - "disputes_repudiation_get_settlement" : [ "/${apiVersion}/${clientId}/settlements/${id}", "GET"] + "disputes_repudiation_get_settlement" : [ "/${apiVersion}/${clientId}/settlements/${id}", "GET"], + + "mandates_directdebit-web_create" : ["/${apiVersion}/${clientId}/mandates/directdebit/web/", "POST"], + "mandates_get" : ["/${apiVersion}/${clientId}/mandates/${id}", "GET"], + "mandates_cancel" : ["/${apiVersion}/${clientId}/mandates/${id}/cancel", "PUT"], + "mandates_all" : ["/${apiVersion}/${clientId}/mandates", "GET"], + "mandates_get_for_user" : ["/${apiVersion}/${clientId}/users/{$id}/mandates", "GET"], + "mandates_get_for_bank_account" : ["/${apiVersion}/${clientId}/users/{$id}/bankaccounts/${bankAccountId}/mandates", "GET"] }; \ No newline at end of file diff --git a/lib/models/Mandate.js b/lib/models/Mandate.js new file mode 100644 index 0000000..ddefec5 --- /dev/null +++ b/lib/models/Mandate.js @@ -0,0 +1,65 @@ +var _ = require('underscore'); +var Model = require('../Model'); + +var Mandate = Model.extend({ + defaults: { + /** + * When the item was created + */ + CreationDate: null, + /** + * Custom data that you can add to this item + */ + Tag: null, + /** + * An ID of a Bank Account + */ + BankAccountId: null, + /** + * The object owner's UserId + */ + UserId: null, + /** + * The URL to redirect to after payment (whether successful or not) + */ + ReturnURL: null, + /** + * The URL to redirect to user to for them to proceed with the payment + */ + RedirectURL: null, + /** + * The URL to download the mandate + */ + DocumentURL: null, + /** + * The language to use for the mandate confirmation page - needs to be the ISO code of the language + */ + Culture: null, + /** + * The type of mandate, but will only be completed once the mandate has been submitted + */ + Scheme: null, + /** + * The status of the mandate + */ + Status: null, + /** + * The result code + */ + ResultCode: null, + /** + * A verbal explanation of the ResultCode + */ + ResultMessage: null, + /** + * The execution type for creating the mandate + */ + ExecutionType: 'WEB', + /** + * The type of Mandate, defaults to DIRECT_DEBIT + */ + MandateType: 'DIRECT_DEBIT' + } +}); + +module.exports = Mandate; \ No newline at end of file diff --git a/lib/models/MandateStatus.js b/lib/models/MandateStatus.js new file mode 100644 index 0000000..d2293b2 --- /dev/null +++ b/lib/models/MandateStatus.js @@ -0,0 +1,6 @@ +module.exports = { + Created: 'CREATED', + Submitted: 'SUBMITTED', + Active: 'ACTIVE', + Failed: 'FAILED' +}; diff --git a/lib/services/Mandates.js b/lib/services/Mandates.js new file mode 100644 index 0000000..2b92dfe --- /dev/null +++ b/lib/services/Mandates.js @@ -0,0 +1,134 @@ +/** + * @module Mandates + * @desc [MangoPay Mandates API Reference](https://docs.mangopay.com/endpoints/v2.01/mandates) + */ +var _ = require('underscore'); +var Service = require('../service'); + +var Mandate = require('../models/Mandate'); + +var Mandates = Service.extend({ + /** + * Create a new Mandate + * @param {Object} mandate Mandate object + * @param {Function} callback Callback function + * @param {Object} options Request options + * @return {Object} Promise of the request + */ + create: function(mandate, callback, options) { + options = this._api._getOptions(callback, options, { + data: mandate, + dataClass: Mandate + }); + + var mandateKey = this.getMandateKey(mandate); + var executionKey = this.getExecutionKey(mandate); + + return this._api.method('mandates_' + mandateKey + '-' + executionKey + '_create', callback, options); + }, + + /** + * Get all mandates + * @param {Function} callback Callback function + * @param {Object} options Request options + * @return {Object} Request promise + */ + getAll: function(callback, options) { + options = this._api._getOptions(callback, options, { + dataClass: Mandate + }); + + return this._api.method('mandates_all', callback, options); + }, + + /** + * Get mandate by ID + * @param {number} mandateId Mandate identifier + * @param {Function} callback Callback function + * @param {Object} options Request options + * @return {Object} Request promise + */ + get: function(mandateId, callback, options) { + options = this._api._getOptions(callback, options, { + path: { + id: mandateId + }, + dataClass: Mandate + }); + + return this._api.method('mandates_get', callback, options); + }, + + /** + * Cancel a mandate + * @param {number} mandateId Mandate identifier + * @param {Function} callback Callback function + * @param {Object} options Request options + * @return {Object} Request promise + */ + cancel: function(mandateId, callback, options) { + options = this._api._getOptions(callback, options, { + path: { + id: mandateId + } + }); + + return this._api.method('mandates_cancel', callback, options); + }, + + /** + * Gets user's mandates + * @param {number} userId User identifier + * @param {Function} callback Callback function + * @param {Object} options Request options + * @return {Object} Request promise + */ + getMandatesForUser: function(userId, callback, options) { + options = this._api._getOptions(callback, options, { + path: { + id: userId + }, + dataClass: Mandate + }); + + return this._api.method('mandates_get_for_user', callback, options); + }, + + /** + * Gets bank account mandates + * @param {number} userId User identifier + * @param {number} bankAccountId Bank Account identifier + * @param {Function} callback Callback function + * @param {Object} options Request options + * @return {Object} Request promise + */ + getMandatesForBankAccount: function(userId, bankAccountId, callback, options) { + options = this._api._getOptions(callback, options, { + path: { + id: userId, + bankAccountId: bankAccountId + }, + dataClass: Mandate + }); + + return this._api.method('mandates_get_for_bank_account', callback, options); + }, + + getMandateKey: function(mandate) { + if (mandate.MandateType) { + return mandate.MandateType.toLowerCase().replace('_', ''); + } + + throw new Error('Mandate needs a MandateType'); + }, + + getExecutionKey: function(mandate) { + if (mandate.ExecutionType) { + return mandate.ExecutionType.toLowerCase(); + } + + throw new Error('Mandate needs a ExecutionType'); + } +}); + +module.exports = Mandates; \ No newline at end of file diff --git a/test/services/Mandates.js b/test/services/Mandates.js new file mode 100644 index 0000000..1efce9c --- /dev/null +++ b/test/services/Mandates.js @@ -0,0 +1,28 @@ +var _ = require('underscore'); +var path = require('path'); +var Promise = require('promise'); +var expect = require('chai').expect; +var assert = require('chai').assert; +var sinon = require('sinon'); + +var helpers = require('../helpers'); + +var Mandate = require('../../lib/models/Mandate'); +var UserNatural = require('../../lib/models/UserNatural'); +var BankAccount = require('../../lib/models/BankAccount'); + + +describe('Mandates', function() { + var john = new UserNatural(helpers.data.UserNatural); + + before(function(done){ + api.Users.create(john).then(function(data, response){ + done() + }); + }); + + it('Create Natural', function(){ + expect(john.Id).not.to.be.undefined; + expect(john.PersonType).to.equal(PersonType.Natural); + }); +}); \ No newline at end of file From 7586f69d5d476a030d23a1c5ff61d31472048341 Mon Sep 17 00:00:00 2001 From: Gabriel Lupu Date: Wed, 31 Aug 2016 20:13:32 +0300 Subject: [PATCH 2/5] Mandates test update --- test/services/Mandates.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/services/Mandates.js b/test/services/Mandates.js index 1efce9c..c1ceb43 100644 --- a/test/services/Mandates.js +++ b/test/services/Mandates.js @@ -13,11 +13,23 @@ var BankAccount = require('../../lib/models/BankAccount'); describe('Mandates', function() { + var ibanAccount; var john = new UserNatural(helpers.data.UserNatural); before(function(done){ api.Users.create(john).then(function(data, response){ - done() + account = new BankAccount({ + OwnerName: john.FirstName + ' ' + john.LastName, + OwnerAddress: john.Address, + Details: new BankAccountDetailsIBAN({ + IBAN: 'FR7618829754160173622224154', + BIC: 'CMBRFR2BCME' + }) + }); + api.Users.createBankAccount(john.Id, account).then(function(data){ + ibanAccount = data; + done(); + }); }); }); From 84ad2c0354ff4540455900a804ecb0f7d2c9e12b Mon Sep 17 00:00:00 2001 From: Gabriel Lupu Date: Thu, 1 Sep 2016 10:52:49 +0300 Subject: [PATCH 3/5] Add payins mandates method, update default values logic and mandates test --- lib/Model.js | 3 +- lib/apiMethods.js | 1 + test/services/Mandates.js | 80 ++++++++++++++++++++++++++++++++++++--- 3 files changed, 77 insertions(+), 7 deletions(-) diff --git a/lib/Model.js b/lib/Model.js index 33b635a..5feed61 100644 --- a/lib/Model.js +++ b/lib/Model.js @@ -1,7 +1,8 @@ var _ = require('underscore'); function Model(data) { - _.extend(this, data); + var nonNullDefaults = _.omit(this.defaults, _.isEmpty); + _.extend(this, nonNullDefaults, data); this.initialize(data); } diff --git a/lib/apiMethods.js b/lib/apiMethods.js index ebbd55b..aa8fb03 100644 --- a/lib/apiMethods.js +++ b/lib/apiMethods.js @@ -28,6 +28,7 @@ module.exports = { "payins_preauthorized-direct_create" : [ "/${apiVersion}/${clientId}/payins/preauthorized/direct/", "POST" ], "payins_bankwire-direct_create" : [ "/${apiVersion}/${clientId}/payins/bankwire/direct/", "POST" ], "payins_directdebit-web_create" : [ "/${apiVersion}/${clientId}/payins/directdebit/web", "POST" ], + "payins_directdebit-direct_create" : [ "/${apiVersion}/${clientId}/payins/directdebit/direct", "POST" ], "payins_get" : [ "/${apiVersion}/${clientId}/payins/${id}", "GET" ], "payins_createrefunds" : [ "/${apiVersion}/${clientId}/payins/${id}/refunds", "POST" ], diff --git a/test/services/Mandates.js b/test/services/Mandates.js index c1ceb43..d1c876f 100644 --- a/test/services/Mandates.js +++ b/test/services/Mandates.js @@ -3,22 +3,24 @@ var path = require('path'); var Promise = require('promise'); var expect = require('chai').expect; var assert = require('chai').assert; -var sinon = require('sinon'); var helpers = require('../helpers'); var Mandate = require('../../lib/models/Mandate'); var UserNatural = require('../../lib/models/UserNatural'); var BankAccount = require('../../lib/models/BankAccount'); +var BankAccountDetailsIBAN = require('../../lib/models/BankAccountDetailsIBAN'); describe('Mandates', function() { - var ibanAccount; + var ibanAccount, mandate; var john = new UserNatural(helpers.data.UserNatural); before(function(done){ api.Users.create(john).then(function(data, response){ - account = new BankAccount({ + john = data; + + var account = new BankAccount({ OwnerName: john.FirstName + ' ' + john.LastName, OwnerAddress: john.Address, Details: new BankAccountDetailsIBAN({ @@ -26,15 +28,81 @@ describe('Mandates', function() { BIC: 'CMBRFR2BCME' }) }); + api.Users.createBankAccount(john.Id, account).then(function(data){ ibanAccount = data; + + mandate = new Mandate({ + Tag: 'custom meta', + BankAccountId: ibanAccount.Id, + Culture: 'EN', + ReturnURL: 'http://www.my-site.com/returnURL/' + }); + + api.Mandates.create(mandate, function(data){ + mandate = data; + done(); + }); + + }); + }); + }); + + it('should be created with the right properties', function(){ + expect(mandate.Id).not.to.be.undefined; + expect(mandate.BankAccountId).to.equal(ibanAccount.Id); + expect(mandate.MandateType).to.equal('DIRECT_DEBIT'); + expect(mandate.ExecutionType).to.equal('WEB'); + expect(mandate.ReturnURL).to.equal('http://www.my-site.com/returnURL/?MandateId=' + mandate.Id); + expect(mandate.Tag).to.equal('custom meta'); + expect(mandate.Status).to.equal('CREATED'); + }); + + describe('Get created mandate', function() { + before(function(done){ + api.Mandates.get(mandate.Id, function(data){ + mandate = data; + done(); + }); + }); + + it('should be received with the right properties', function(){ + expect(mandate.Id).not.to.be.undefined; + expect(mandate.BankAccountId).to.equal(ibanAccount.Id); + expect(mandate.MandateType).to.equal('DIRECT_DEBIT'); + expect(mandate.ExecutionType).to.equal('WEB'); + expect(mandate.ReturnURL).to.equal('http://www.my-site.com/returnURL/?MandateId=' + mandate.Id); + expect(mandate.Tag).to.equal('custom meta'); + expect(mandate.Status).to.equal('CREATED'); + }); + }); + + describe('Get all mandates', function() { + var mandates; + + before(function(done){ + api.Mandates.getAll(function(data){ + mandates = data; done(); }); }); + + it('should be retrieve at least one mandate', function(){ + expect(mandates.length).to.be.above(1); + }); }); - it('Create Natural', function(){ - expect(john.Id).not.to.be.undefined; - expect(john.PersonType).to.equal(PersonType.Natural); + describe('Cancel a mandate with CREATED status', function() { + var response; + before(function(done){ + api.Mandates.cancel(mandate.Id, function(data){ + response = data; + done(); + }); + }); + + it('shouldn\'t be able to cancel a mandate with the status "CREATED"', function(){ + expect(response.Type).to.equal('mandate_cannot_be_cancelled'); + }); }); }); \ No newline at end of file From f175226d00f7f8387f846de377373c287eeea997 Mon Sep 17 00:00:00 2001 From: Gabriel Lupu Date: Thu, 1 Sep 2016 20:33:33 +0300 Subject: [PATCH 4/5] Mandates feature --- test/services/Mandates.js | 144 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 138 insertions(+), 6 deletions(-) diff --git a/test/services/Mandates.js b/test/services/Mandates.js index d1c876f..47436ae 100644 --- a/test/services/Mandates.js +++ b/test/services/Mandates.js @@ -3,6 +3,7 @@ var path = require('path'); var Promise = require('promise'); var expect = require('chai').expect; var assert = require('chai').assert; +var os = require('os'); var helpers = require('../helpers'); @@ -10,11 +11,12 @@ var Mandate = require('../../lib/models/Mandate'); var UserNatural = require('../../lib/models/UserNatural'); var BankAccount = require('../../lib/models/BankAccount'); var BankAccountDetailsIBAN = require('../../lib/models/BankAccountDetailsIBAN'); - +var Wallet = require('../../lib/models/Wallet'); +var PayIn = require('../../lib/models/PayIn'); describe('Mandates', function() { var ibanAccount, mandate; - var john = new UserNatural(helpers.data.UserNatural); + var john = new UserNatural(_.extend(helpers.data.UserNatural)); before(function(done){ api.Users.create(john).then(function(data, response){ @@ -92,17 +94,147 @@ describe('Mandates', function() { }); }); - describe('Cancel a mandate with CREATED status', function() { - var response; + describe('Cancel a mandate before being approved it - CREATED status', function() { + var cancelResponse; before(function(done){ api.Mandates.cancel(mandate.Id, function(data){ - response = data; + cancelResponse = data; done(); }); }); it('shouldn\'t be able to cancel a mandate with the status "CREATED"', function(){ - expect(response.Type).to.equal('mandate_cannot_be_cancelled'); + expect(cancelResponse.Type).to.equal('mandate_cannot_be_cancelled'); + }); + }); + + describe('Create DirectDebit Direct Payin before being approved - "CREATED" status', function() { + var payIn, wallet; + + before(function(done){ + wallet = new Wallet({ + Owners: [john.Id], + Currency: 'EUR', + Description: 'WALLET IN EUR' + }); + + api.Wallets.create(wallet).then(function(data){ + wallet = data; + + payIn = new PayIn({ + CreditedWalletId: wallet.Id, + AuthorId: john.Id, + DebitedFunds: { + Amount: 10000, + Currency: 'EUR' + }, + Fees: { + Amount: 0, + Currency: 'EUR' + }, + PaymentType: 'DIRECT_DEBIT', + ExecutionType: 'DIRECT', + MandateId: mandate.Id + }); + + api.PayIns.create(payIn, function(data) { + payIn = data; + done(); + }); + }); + }); + + it('should be created successfully but with "FAILED" status', function(){ + expect(payIn.AuthorId).to.equal(john.Id); + expect(payIn.CreditedUserId).to.equal(john.Id); + expect(payIn.CreditedWalletId).to.equal(wallet.Id); + expect(payIn.Status).to.equal('FAILED'); }); }); + + /** + * Check if the OS platform has a GUI ( MacOS / Windows ) and if the tests are running + * in debugging mode. Otherwise this test cannot run, since a user action is required + * inside the browser, for approving the Mandate (clicking the "CONFIRM" button) + */ + if ((os.platform() === 'darwin' || os.platform() === 'win32') && process.execArgv && process.execArgv[0] && process.execArgv[0].match(/--debug-brk/)) { + describe('After approving the mandate', function() { + before(function(done){ + /** + * ! IMPORTANT NOTE ! + * + * In order to make this test pass debugging mode is required to stop at the breakpoint below + * and navigate to URL the mandate.RedirectURL property points to and click "CONFIRM" button. + * + * The command above is supposed to open your default browser window with that link for you: + */ + var spawn = require('child_process').spawn; + spawn('open', [mandate.RedirectURL]); + + debugger; + done(); + }); + + describe('Create DirectDebit Direct Payin after being approved', function() { + var payIn, wallet; + + before(function(done){ + wallet = new Wallet({ + Owners: [john.Id], + Currency: 'EUR', + Description: 'WALLET IN EUR' + }); + + api.Wallets.create(wallet).then(function(data){ + wallet = data; + + payIn = new PayIn({ + CreditedWalletId: wallet.Id, + AuthorId: john.Id, + DebitedFunds: { + Amount: 10000, + Currency: 'EUR' + }, + Fees: { + Amount: 0, + Currency: 'EUR' + }, + PaymentType: 'DIRECT_DEBIT', + ExecutionType: 'DIRECT', + MandateId: mandate.Id + }); + + api.PayIns.create(payIn, function(data) { + payIn = data; + done(); + }); + }); + }); + + it('should be created successfully but with the right status', function(){ + expect(payIn.AuthorId).to.equal(john.Id); + expect(payIn.CreditedUserId).to.equal(john.Id); + expect(payIn.CreditedWalletId).to.equal(wallet.Id); + expect(payIn.MandateId).to.equal(mandate.Id); + expect(payIn.Status).to.equal('CREATED'); + }); + }); + + describe('Cancel a mandate after being confirmed', function() { + var cancelResponse; + + before(function(done){ + api.Mandates.cancel(mandate.Id, function(data){ + cancelResponse = data; + done(); + }); + }); + + it('should set the mandate status to "FAILED"', function(){ + expect(cancelResponse.Status).to.equal('FAILED'); + }); + }); + }); + } + }); \ No newline at end of file From f73c58e2434cecfc4fbd8606910d1d94b2442dcd Mon Sep 17 00:00:00 2001 From: Gabriel Lupu Date: Thu, 1 Sep 2016 20:35:01 +0300 Subject: [PATCH 5/5] Version bump and mandates feature docs --- docs/Mandates.md | 110 +++++++++++++++++++++++++++++++++++++++++++++++ docs/README.md | 38 +++++++++------- package.json | 2 +- 3 files changed, 133 insertions(+), 17 deletions(-) create mode 100644 docs/Mandates.md diff --git a/docs/Mandates.md b/docs/Mandates.md new file mode 100644 index 0000000..d1a4b43 --- /dev/null +++ b/docs/Mandates.md @@ -0,0 +1,110 @@ +# Mandates + +[MangoPay Mandates API Reference](https://docs.mangopay.com/endpoints/v2.01/mandates) + + + +* * * + +### Mandates.create(mandate, callback, options) + +Create a new Mandate + +**Parameters** + +**mandate**: `Object`, Mandate object + +**callback**: `function`, Callback function + +**options**: `Object`, Request options + +**Returns**: `Object`, Promise of the request + + +### Mandates.getAll(callback, options) + +Get all mandates + +**Parameters** + +**callback**: `function`, Callback function + +**options**: `Object`, Request options + +**Returns**: `Object`, Request promise + + +### Mandates.get(mandateId, callback, options) + +Get mandate by ID + +**Parameters** + +**mandateId**: `number`, Mandate identifier + +**callback**: `function`, Callback function + +**options**: `Object`, Request options + +**Returns**: `Object`, Request promise + + +### Mandates.cancel(mandateId, callback, options) + +Cancel a mandate + +**Parameters** + +**mandateId**: `number`, Mandate identifier + +**callback**: `function`, Callback function + +**options**: `Object`, Request options + +**Returns**: `Object`, Request promise + + +### Mandates.getMandatesForUser(userId, callback, options) + +Gets user's mandates + +**Parameters** + +**userId**: `number`, User identifier + +**callback**: `function`, Callback function + +**options**: `Object`, Request options + +**Returns**: `Object`, Request promise + + +### Mandates.getMandatesForBankAccount(userId, bankAccountId, callback, options) + +Gets bank account mandates + +**Parameters** + +**userId**: `number`, User identifier + +**bankAccountId**: `number`, Bank Account identifier + +**callback**: `function`, Callback function + +**options**: `Object`, Request options + +**Returns**: `Object`, Request promise + + + +* * * + + + + + + + + + + diff --git a/docs/README.md b/docs/README.md index cd4052a..996ad77 100644 --- a/docs/README.md +++ b/docs/README.md @@ -20,15 +20,17 @@ ## All available functions | Function | Description | Source Code | | -------- | ----------- | ----------- | +|[Mandates.cancel](Mandates.md) | Cancel a mandate | [../lib/services/Mandates.js](../lib/services/Mandates.js) | |[Disputes.closeDispute](Disputes.md) | Close dispute | [../lib/services/Disputes.js](../lib/services/Disputes.js) | |[Disputes.contestDispute](Disputes.md) | Contest dispute | [../lib/services/Disputes.js](../lib/services/Disputes.js) | +|[Hooks.create](Hooks.md) | Create new hook | [../lib/services/Hooks.js](../lib/services/Hooks.js) | |[PayIns.create](PayIns.md) | Create new pay-in | [../lib/services/PayIns.js](../lib/services/PayIns.js) | |[CardPreAuthorizations.create](CardPreAuthorizations.md) | Create new pre-authorization | [../lib/services/CardPreAuthorizations.js](../lib/services/CardPreAuthorizations.js) | -|[PayOuts.create](PayOuts.md) | Create new pay-out | [../lib/services/PayOuts.js](../lib/services/PayOuts.js) | +|[Wallets.create](Wallets.md) | Create new wallet | [../lib/services/Wallets.js](../lib/services/Wallets.js) | |[CardRegistrations.create](CardRegistrations.md) | Create new card registration | [../lib/services/CardRegistrations.js](../lib/services/CardRegistrations.js) | -|[Hooks.create](Hooks.md) | Create new hook | [../lib/services/Hooks.js](../lib/services/Hooks.js) | |[Transfers.create](Transfers.md) | Create new transfer | [../lib/services/Transfers.js](../lib/services/Transfers.js) | -|[Wallets.create](Wallets.md) | Create new wallet | [../lib/services/Wallets.js](../lib/services/Wallets.js) | +|[Mandates.create](Mandates.md) | Create a new Mandate | [../lib/services/Mandates.js](../lib/services/Mandates.js) | +|[PayOuts.create](PayOuts.md) | Create new pay-out | [../lib/services/PayOuts.js](../lib/services/PayOuts.js) | |[Users.create](Users.md) | Create a new user | [../lib/services/Users.js](../lib/services/Users.js) | |[Users.createBankAccount](Users.md) | Create bank account for user | [../lib/services/Users.js](../lib/services/Users.js) | |[Disputes.createDisputeDocument](Disputes.md) | Creates document for dispute | [../lib/services/Disputes.js](../lib/services/Disputes.js) | @@ -40,26 +42,28 @@ |[PayIns.createRefund](PayIns.md) | Create refund for pay-in object | [../lib/services/PayIns.js](../lib/services/PayIns.js) | |[Transfers.createRefund](Transfers.md) | Create refund for transfer object | [../lib/services/Transfers.js](../lib/services/Transfers.js) | |[Disputes.createSettlementTransfer](Disputes.md) | Creates settlement transfer | [../lib/services/Disputes.js](../lib/services/Disputes.js) | -|[Responses.get](Responses.md) | Get response from previous call | [../lib/services/Responses.js](../lib/services/Responses.js) | -|[Cards.get](Cards.md) | Get card | [../lib/services/Cards.js](../lib/services/Cards.js) | |[PayIns.get](PayIns.md) | Get pay-in | [../lib/services/PayIns.js](../lib/services/PayIns.js) | +|[CardPreAuthorizations.get](CardPreAuthorizations.md) | Get pre-authorization object | [../lib/services/CardPreAuthorizations.js](../lib/services/CardPreAuthorizations.js) | +|[Hooks.get](Hooks.md) | Get hook | [../lib/services/Hooks.js](../lib/services/Hooks.js) | |[Disputes.get](Disputes.md) | Get dispute | [../lib/services/Disputes.js](../lib/services/Disputes.js) | +|[Responses.get](Responses.md) | Get response from previous call | [../lib/services/Responses.js](../lib/services/Responses.js) | +|[Mandates.get](Mandates.md) | Get mandate by ID | [../lib/services/Mandates.js](../lib/services/Mandates.js) | |[DisputeDocuments.get](DisputeDocuments.md) | Gets dispute's document | [../lib/services/DisputeDocuments.js](../lib/services/DisputeDocuments.js) | -|[Users.get](Users.md) | Get natural or legal user by ID | [../lib/services/Users.js](../lib/services/Users.js) | |[Wallets.get](Wallets.md) | Get pay-in | [../lib/services/Wallets.js](../lib/services/Wallets.js) | -|[CardPreAuthorizations.get](CardPreAuthorizations.md) | Get pre-authorization object | [../lib/services/CardPreAuthorizations.js](../lib/services/CardPreAuthorizations.js) | -|[Refunds.get](Refunds.md) | Get events | [../lib/services/Refunds.js](../lib/services/Refunds.js) | -|[Hooks.get](Hooks.md) | Get hook | [../lib/services/Hooks.js](../lib/services/Hooks.js) | |[PayOuts.get](PayOuts.md) | Get payout | [../lib/services/PayOuts.js](../lib/services/PayOuts.js) | -|[KycDocuments.get](KycDocuments.md) | Get KycDocument | [../lib/services/KycDocuments.js](../lib/services/KycDocuments.js) | +|[Users.get](Users.md) | Get natural or legal user by ID | [../lib/services/Users.js](../lib/services/Users.js) | +|[Refunds.get](Refunds.md) | Get events | [../lib/services/Refunds.js](../lib/services/Refunds.js) | |[CardRegistrations.get](CardRegistrations.md) | Get registration | [../lib/services/CardRegistrations.js](../lib/services/CardRegistrations.js) | |[Transfers.get](Transfers.md) | Get transfer | [../lib/services/Transfers.js](../lib/services/Transfers.js) | -|[KycDocuments.getAll](KycDocuments.md) | Get all KycDocuments | [../lib/services/KycDocuments.js](../lib/services/KycDocuments.js) | -|[Events.getAll](Events.md) | Get events | [../lib/services/Events.js](../lib/services/Events.js) | -|[Hooks.getAll](Hooks.md) | Get all hooks | [../lib/services/Hooks.js](../lib/services/Hooks.js) | +|[Cards.get](Cards.md) | Get card | [../lib/services/Cards.js](../lib/services/Cards.js) | +|[KycDocuments.get](KycDocuments.md) | Get KycDocument | [../lib/services/KycDocuments.js](../lib/services/KycDocuments.js) | |[DisputeDocuments.getAll](DisputeDocuments.md) | Gets dispute's documents for client | [../lib/services/DisputeDocuments.js](../lib/services/DisputeDocuments.js) | -|[Users.getAll](Users.md) | Get all users | [../lib/services/Users.js](../lib/services/Users.js) | |[Disputes.getAll](Disputes.md) | Get all disputes | [../lib/services/Disputes.js](../lib/services/Disputes.js) | +|[KycDocuments.getAll](KycDocuments.md) | Get all KycDocuments | [../lib/services/KycDocuments.js](../lib/services/KycDocuments.js) | +|[Users.getAll](Users.md) | Get all users | [../lib/services/Users.js](../lib/services/Users.js) | +|[Hooks.getAll](Hooks.md) | Get all hooks | [../lib/services/Hooks.js](../lib/services/Hooks.js) | +|[Mandates.getAll](Mandates.md) | Get all mandates | [../lib/services/Mandates.js](../lib/services/Mandates.js) | +|[Events.getAll](Events.md) | Get events | [../lib/services/Events.js](../lib/services/Events.js) | |[Users.getBankAccount](Users.md) | Get all bank accounts for user | [../lib/services/Users.js](../lib/services/Users.js) | |[Users.getBankAccounts](Users.md) | Get all bank accounts for user | [../lib/services/Users.js](../lib/services/Users.js) | |[Users.getCards](Users.md) | Get all cards for user | [../lib/services/Users.js](../lib/services/Users.js) | @@ -69,6 +73,8 @@ |[Users.getKycDocument](Users.md) | Get KYC document | [../lib/services/Users.js](../lib/services/Users.js) | |[Users.getKycDocuments](Users.md) | Get all KYC documents for user | [../lib/services/Users.js](../lib/services/Users.js) | |[Users.getLegal](Users.md) | Get legal user by ID | [../lib/services/Users.js](../lib/services/Users.js) | +|[Mandates.getMandatesForBankAccount](Mandates.md) | Gets bank account mandates | [../lib/services/Mandates.js](../lib/services/Mandates.js) | +|[Mandates.getMandatesForUser](Mandates.md) | Gets user's mandates | [../lib/services/Mandates.js](../lib/services/Mandates.js) | |[Users.getNatural](Users.md) | Get natural user by ID | [../lib/services/Users.js](../lib/services/Users.js) | |[Disputes.getRepudiation](Disputes.md) | Gets repudiation | [../lib/services/Disputes.js](../lib/services/Disputes.js) | |[Disputes.getSettlementTransfer](Disputes.md) | Gets settlement transfer | [../lib/services/Disputes.js](../lib/services/Disputes.js) | @@ -77,12 +83,12 @@ |[Disputes.getTransactions](Disputes.md) | Gets dispute's transactions | [../lib/services/Disputes.js](../lib/services/Disputes.js) | |[Users.getWallets](Users.md) | Get all wallets accounts for user | [../lib/services/Users.js](../lib/services/Users.js) | |[Disputes.resubmitDispute](Disputes.md) | This method is used to resubmit a Dispute if it is reopened requiring more docs | [../lib/services/Disputes.js](../lib/services/Disputes.js) | -|[Disputes.update](Disputes.md) | Update dispute's tag | [../lib/services/Disputes.js](../lib/services/Disputes.js) | |[CardRegistrations.update](CardRegistrations.md) | Update card registration | [../lib/services/CardRegistrations.js](../lib/services/CardRegistrations.js) | +|[Disputes.update](Disputes.md) | Update dispute's tag | [../lib/services/Disputes.js](../lib/services/Disputes.js) | |[CardPreAuthorizations.update](CardPreAuthorizations.md) | Update pre-authorization object | [../lib/services/CardPreAuthorizations.js](../lib/services/CardPreAuthorizations.js) | +|[Cards.update](Cards.md) | Update card | [../lib/services/Cards.js](../lib/services/Cards.js) | |[Hooks.update](Hooks.md) | Save hook | [../lib/services/Hooks.js](../lib/services/Hooks.js) | |[Users.update](Users.md) | Save user | [../lib/services/Users.js](../lib/services/Users.js) | |[Wallets.update](Wallets.md) | Update wallet | [../lib/services/Wallets.js](../lib/services/Wallets.js) | -|[Cards.update](Cards.md) | Update card | [../lib/services/Cards.js](../lib/services/Cards.js) | |[Disputes.updateDisputeDocument](Disputes.md) | Update dispute document | [../lib/services/Disputes.js](../lib/services/Disputes.js) | |[Users.updateKycDocument](Users.md) | Save KYC document | [../lib/services/Users.js](../lib/services/Users.js) | diff --git a/package.json b/package.json index 4cd257e..247241c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mangopay2-nodejs-sdk", - "version": "1.0.3", + "version": "1.0.4", "description": "Mangopay Node.js SDK", "keywords": [ "mangopay",