Skip to content

Commit

Permalink
[UBO Declarations] Get by declaration id
Browse files Browse the repository at this point in the history
Add a method to get a declaration only by its id (not requiring userId).

By the way, I also updated document that wasn't up to date anymore. For example, the doc for `UboDeclarations.get` was not mentionning `userId` as a parameter and it was confusing.
  • Loading branch information
JordhanMadec committed Sep 25, 2020
1 parent 91ba981 commit 30b0b42
Show file tree
Hide file tree
Showing 16 changed files with 332 additions and 35 deletions.
35 changes: 35 additions & 0 deletions docs/BankAccounts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# BankAccounts





* * *

### BankAccounts.getTransactions(bankAccountId, callback, options)

Retrieve list of transactions for a bank account

**Parameters**

**bankAccountId**: `number`, Bank Account Id

**callback**: `function`, Callback function

**options**: `Object`, Request options

**Returns**: `Object`, Request promise



* * *










30 changes: 30 additions & 0 deletions docs/Cards.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,36 @@ Update card
**Returns**: `Object`, Request promise


### Cards.getTransactions(cardId, callback, options)

Get list of Transactions of a Card

**Parameters**

**cardId**: `number`, Card identifier

**callback**: `function`, Callback function

**options**: `object`, Request options

**Returns**: `object`, Request promise


### Cards.getPreAuthorizations(cardId, callback, options)

Gets list of PreAuthorizations of a Card.

**Parameters**

**cardId**: `number`, Card identifier

**callback**: `function`, Callback function

**options**: `Object`, Request options

**Returns**: `Object`, Request promise



* * *

Expand Down
13 changes: 13 additions & 0 deletions docs/Disputes.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,19 @@ Creates document's page for dispute from file
**Returns**: `Object`, Promise of the request


### Disputes.getPendingSettlement(callback, options)

Retrieve a list of Disputes pending settlement

**Parameters**

**callback**: `function`, Callback function

**options**: `object`, Request options

**Returns**: `object`, Request promise



* * *

Expand Down
11 changes: 11 additions & 0 deletions docs/Idempotency.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* * *










15 changes: 15 additions & 0 deletions docs/Mandates.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,21 @@ Gets bank account mandates
**Returns**: `Object`, Request promise


### Mandates.getTransactions(mandateId, callback, options)

Gets Transactions for a Mandate

**Parameters**

**mandateId**: `number`, Mandate identifier

**callback**: `function`, Callback function

**options**: `Object`, Request options

**Returns**: `Object`, Request promise



* * *

Expand Down
32 changes: 32 additions & 0 deletions docs/OptionsHelper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Global





* * *

### withIdempotency(options, idempotencyKey)

Adds Idempotency-Key headers to the provided 'options' parameter

**Parameters**

**options**: , Adds Idempotency-Key headers to the provided 'options' parameter

**idempotencyKey**: , Adds Idempotency-Key headers to the provided 'options' parameter




* * *










15 changes: 15 additions & 0 deletions docs/PayIns.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,21 @@ Create refund for pay-in object
**Returns**: `Object`, Request promise


### PayIns.getRefunds(payInId, callback, options)

Gets list of Refunds for a PayIn

**Parameters**

**payInId**: `number`, PayIn identifier

**callback**: `function`, Callback function

**options**: `Object`, Request options

**Returns**: `Object`, Request promise



* * *

Expand Down
15 changes: 15 additions & 0 deletions docs/PayOuts.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@ Get payout
**Returns**: `Object`, Request promise


### PayOuts.getRefunds(payOutId, callback, options)

Gets list of Refunds of a PayOut

**Parameters**

**payOutId**: `number`, PayOut identifier

**callback**: `function`, Callback function

**options**: `Object`, Request options

**Returns**: `Object`, Request promise



* * *

Expand Down
76 changes: 44 additions & 32 deletions docs/README.md

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions docs/Repudiations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Repudiations

[MangoPay Repudiations API Reference](https://docs.mangopay.com/api-references/repudiations/)



* * *

### Repudiations.getRefunds(repudiationId, callback, options)

Gets list of Refunds of a Repudiation

**Parameters**

**repudiationId**: `number`, Repudiation identifier

**callback**: `function`, Callback function

**options**: `Object`, Request options

**Returns**: `Object`, Request promise



* * *










15 changes: 15 additions & 0 deletions docs/Transfers.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,21 @@ Create refund for transfer object
**Returns**: `Object`, Request promise


### Transfers.getRefunds(transferId, callback, options)

Gets list of Refunds of a Transfer

**Parameters**

**transferId**: `number`, Transfer identifier

**callback**: `function`, Callback function

**options**: `Object`, Request options

**Returns**: `Object`, Request promise



* * *

Expand Down
36 changes: 34 additions & 2 deletions docs/UboDeclarations.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,37 @@

* * *

### get(id, callback, options)
### create(userId, callback, options)

Create a UBO declaration object from the API

**Parameters**

**userId**: `String`, user Unique identifier

**callback**: `function`, Create a UBO declaration object from the API

**options**: `Object`, Create a UBO declaration object from the API



### get(userId, id, callback, options)

Retrieves a UBO declaration object from the API.

**Parameters**

**userId**: `String`, User Unique identifier

**id**: `String`, Unique identifier

**callback**: `function`, Retrieves a UBO declaration object from the API.

**options**: `Object`, Retrieves a UBO declaration object from the API.



### getById(id, callback, options)

Retrieves a UBO declaration object from the API.

Expand All @@ -20,12 +50,14 @@ Retrieves a UBO declaration object from the API.



### update(uboDeclaration, callback, options)
### update(userId, uboDeclaration, callback, options)

Updates a UBO declaration entity.

**Parameters**

**userId**: `String`, User Unique Identifier

**uboDeclaration**: `Object`, Updated UBO declaration entity - must have ID!

**callback**: `function`, Updates a UBO declaration entity.
Expand Down
6 changes: 5 additions & 1 deletion docs/Users.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,14 +299,18 @@ Create page for KYC document
**Returns**: `Object`, Request promise


### Users.getEMoney(userId, callback, options)
### Users.getEMoney(userId, year, month, callback, options)

Get users's EMoney

**Parameters**

**userId**: `number`, User identifier

**year**: `year`, The year for which we want to get the emoney

**month**: `month`, The month for which we want to get the emoney. Can be null

**callback**: `function`, Get users's EMoney

**options**: `Object`, Get users's EMoney
Expand Down
1 change: 1 addition & 0 deletions lib/apiMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ module.exports = {
"ubo_declaration_create": ["/${apiVersion}/${clientId}/users/${userId}/kyc/ubodeclarations", "POST"],
"ubo_declaration_update": ["/${apiVersion}/${clientId}/users/${userId}/kyc/ubodeclarations/${declarationId}", "PUT"],
"ubo_declaration_get": ["/${apiVersion}/${clientId}/users/${userId}/kyc/ubodeclarations/${declarationId}", "GET"],
"ubo_declaration_get_by_id": ["/${apiVersion}/${clientId}/kyc/ubodeclarations/${declarationId}", "GET"],
"ubo_declarations_get": ["/${apiVersion}/${clientId}/users/${userId}/kyc/ubodeclarations", "GET"],

"ubo_create": ["/${apiVersion}/${clientId}/users/${userId}/kyc/ubodeclarations/${declarationId}/ubos", "POST"],
Expand Down
16 changes: 16 additions & 0 deletions lib/services/UboDeclarations.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,22 @@ var UboDeclarations = Service.extend({
return this._api.method('ubo_declaration_get', callback, options);
},

/**
* Retrieves a UBO declaration object from the API.
* @param {String} id Unique identifier
* @param {Function} callback
* @param {Object} options
*/
getById: function (id, callback, options) {
options = this._api._getOptions(callback, options, {
path: {
declarationId: id
}
});

return this._api.method('ubo_declaration_get_by_id', callback, options);
},

getAll: function (userId, callback, options) {
if (options && !options.hasOwnProperty('parameters'))
Object.assign(options, {parameters: {...options}});
Expand Down
16 changes: 16 additions & 0 deletions test/services/UboDeclarations.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,22 @@ describe('UBO Declarations', function () {
});
});

describe('GetById', function () {
var getDeclaration;

before(function (done) {
api.UboDeclarations.getById(uboDeclaration.Id, function (data, response) {
getDeclaration = data;
done();
});
});

it('should be retrieved', function () {
expect(getDeclaration).not.to.be.null;
expect(getDeclaration.Id).to.equal(uboDeclaration.Id);
});
});

describe('GetAll', function () {
var getDeclarations;

Expand Down

0 comments on commit 30b0b42

Please sign in to comment.