Skip to content

Commit 8777aa8

Browse files
iulian03Iulian Masar
and
Iulian Masar
authored
[feature] Extended Web Card PayIn endpoint integration (#437)
* added missing stuff * added typings for extended card web payin details * small adjustments * commented test * removed integration for deprected endpoint * updated test * updated docs --------- Co-authored-by: Iulian Masar <[email protected]>
1 parent 6bf3f6a commit 8777aa8

File tree

7 files changed

+89
-1
lines changed

7 files changed

+89
-1
lines changed

lib/apiMethods.js

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ module.exports = {
3030

3131
// pay ins URLs
3232
"payins_card-web_create": ["/${apiVersion}/${clientId}/payins/card/web/", "POST"],
33+
"payins_card-web_get_details": ["/${apiVersion}/${clientId}/payins/card/web/${id}/extended", "GET"],
3334
"payins_card-direct_create": ["/${apiVersion}/${clientId}/payins/card/direct/", "POST"],
3435
"payins_preauthorized-direct_create": ["/${apiVersion}/${clientId}/payins/preauthorized/direct/", "POST"],
3536
"payins_bankwire-direct_create": ["/${apiVersion}/${clientId}/payins/bankwire/direct/", "POST"],

lib/models/User.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,16 @@ var User = EntityBase.extend({
2323
*/
2424
TermsAndConditionsAccepted: null,
2525

26+
TermsAndConditionsAcceptedDate: null,
27+
2628
/**
2729
* Category of the user. May take one of the following values:
2830
* PAYER - Users who only use MANGOPAY to give money to other users
2931
* OWNER - Users who use MANGOPAY to receive funds. Please note that a user needs to be KYC validated to perform payouts
3032
*/
31-
UserCategory: null
33+
UserCategory: null,
34+
35+
UserStatus: null
3236
},
3337

3438
/**

lib/services/PayIns.js

+10
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,16 @@ var PayIns = Service.extend({
281281
return this._api.method('add_tracking_info', callback, options);
282282
},
283283

284+
getCardWebPayInExtendedDetails: function(payInId, callback, options) {
285+
options = this._api._getOptions(callback, options, {
286+
path: {
287+
id: payInId
288+
}
289+
});
290+
291+
return this._api.method('payins_card-web_get_details', callback, options);
292+
},
293+
284294
getPaymentKey: function(payIn) {
285295
if (payIn.PaymentType) {
286296
return payIn.PaymentType.toLowerCase().replaceAll('_', '');

test/services/PayIns.js

+17
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,23 @@ describe('PayIns', function () {
5454
expect(getPayIn.ReturnURL).not.to.be.undefined;
5555
});
5656
});
57+
58+
describe.skip('Get extended details', function () {
59+
console.warn('Cannot be tested because a Succeeded Card Web PayIn cannot be generated from the tests');
60+
var extendedDetails;
61+
before(function (done) {
62+
api.PayIns.getCardWebPayInExtendedDetails(payIn.Id, function (data, response) {
63+
extendedDetails = data;
64+
done();
65+
});
66+
});
67+
68+
it('should get the PayIn', function () {
69+
expect(extendedDetails.Id).not.to.be.undefined;
70+
expect(extendedDetails.PaymentType).to.equal('CARD');
71+
expect(extendedDetails.ExecutionType).to.equal('WEB');
72+
});
73+
});
5774
});
5875

5976
describe('Card Direct', function () {

typings/models/payIn.d.ts

+42
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,48 @@ export namespace payIn {
190190
BankName: string;
191191
}
192192

193+
interface CardWebExtendedPayInData {
194+
/**
195+
* The unique identifier of the object.
196+
*/
197+
Id: string;
198+
199+
/**
200+
* The type of payin
201+
*/
202+
PaymentType: PayInPaymentType;
203+
204+
/**
205+
* The type of execution for the payin
206+
*/
207+
ExecutionType: PayInExecutionType;
208+
209+
/**
210+
* Time in millis when the page consult will expire.
211+
*/
212+
ExpirationDate: Timestamp;
213+
214+
/**
215+
* A partially obfuscated version of the credit card number
216+
*/
217+
Alias: string;
218+
219+
/**
220+
* The type of card
221+
*/
222+
CardType: card.CardType;
223+
224+
/**
225+
* The Country of the Card
226+
*/
227+
Country: CountryISO;
228+
229+
/**
230+
* A unique representation of a 16-digits card number
231+
*/
232+
Fingerprint: string;
233+
}
234+
193235
interface CreateCardWebPayIn {
194236
ExecutionType: "WEB";
195237

typings/models/user.d.ts

+7
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,19 @@ export namespace user {
107107
*/
108108
TermsAndConditionsAccepted?: boolean;
109109

110+
/**
111+
* The date when the user has accepted the MANGOPAY Terms and Conditions.
112+
*/
113+
TermsAndConditionsAcceptedDate?: number;
114+
110115
/**
111116
* Category of the user. May take one of the following values:
112117
* PAYER - Users who only use MANGOPAY to give money to other users
113118
* OWNER - Users who use MANGOPAY to receive funds. Please note that a user needs to be KYC validated to perform payouts
114119
*/
115120
UserCategory?: UserCategory;
121+
122+
UserStatus?: string;
116123
}
117124

118125
interface UserLegalData extends UserData {

typings/services/PayIns.d.ts

+7
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,11 @@ export class PayIns {
130130
addPayPalTrackingInformation: TwoArgsMethodOverload<string,
131131
payIn.PayPalWebTrackingData,
132132
payIn.PayPalWebPayInData>;
133+
134+
/**
135+
* View card details for a Web Card PayIn
136+
* @param payInId
137+
* @param options
138+
*/
139+
getCardWebPayInExtendedDetails: MethodOverload<string, payIn.CardWebExtendedPayInData>;
133140
}

0 commit comments

Comments
 (0)