mangopay4-nodejs-sdk 1.67.0 → 1.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/lib/apiMethods.js +10 -3
- package/lib/models/PayInPaymentType.js +0 -1
- package/lib/models/ReportFilterV2.js +2 -1
- package/lib/services/Acquiring.js +152 -0
- package/lib/services/PayIns.js +0 -18
- package/lib/services/index.js +2 -1
- package/package.json +1 -1
- package/test/helpers.js +3 -2
- package/test/services/Acquiring.js +338 -0
- package/test/services/Conversions.js +1 -1
- package/test/services/PayIns.js +1 -117
- package/typings/enums.d.ts +0 -1
- package/typings/index.d.ts +5 -5
- package/typings/index.test-d.ts +0 -15
- package/typings/models/acquiring.d.ts +763 -0
- package/typings/models/payIn.d.ts +20 -80
- package/typings/models/refund.d.ts +1 -0
- package/typings/models/reportV2.d.ts +2 -0
- package/typings/services/Acquiring.d.ts +44 -0
- package/typings/services/PayIns.d.ts +0 -8
- package/typings/types.d.ts +0 -2
- package/lib/models/PayInPaymentDetailsPayconiq.js +0 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## [1.68.0] - 2026-03-25
|
|
2
|
+
### Added - Acquiring pay-in service
|
|
3
|
+
- New `Acquiring` service with `createPayIn` (Card, iDEAL, Apple Pay, Google Pay, PayPal), `createPayInRefund`, `createPayPalDataCollection`, and `createCardValidation` methods
|
|
4
|
+
- TypeScript typings under the `acquiring` namespace (`typings/models/acquiring.d.ts`, `typings/services/Acquiring.d.ts`)
|
|
5
|
+
|
|
6
|
+
### Breaking change - Payconiq removed
|
|
7
|
+
- Payconiq was discontinued on 4 December 2025; all related code has been removed: `PayInPaymentDetailsPayconiq` model, `PAYCONIQ` enum value, `createPayconiqWeb`/`getPayconiqWeb` methods, and associated TypeScript typings
|
|
8
|
+
|
|
9
|
+
### Added - Klarna `Discount` field
|
|
10
|
+
- Optional `Discount` field added to `LineItemData` and `CreateLineItem` interfaces in `payIn.d.ts`
|
|
11
|
+
|
|
1
12
|
## [1.67.0] - 2026-03-19
|
|
2
13
|
### Added - mTLS certificates support
|
|
3
14
|
- mTLS certificates are now configurable in the SDK via file paths or encoded strings
|
package/lib/apiMethods.js
CHANGED
|
@@ -50,8 +50,6 @@ module.exports = {
|
|
|
50
50
|
"payins_recurring_registration_put": ["/${apiVersion}/${clientId}/recurringpayinregistrations/${id}", "PUT"],
|
|
51
51
|
"payins_create_recurring_card_direct": ["/${apiVersion}/${clientId}/payins/recurring/card/direct", "POST"],
|
|
52
52
|
"payins_create_recurring_paypal": ["/${apiVersion}/${clientId}/payins/payment-methods/paypal/recurring", "POST"],
|
|
53
|
-
"payins_payconiq-web_create": ["/${apiVersion}/${clientId}/payins/payconiq/web", "POST"],
|
|
54
|
-
"payins_payconiqv2-web_create": ["/${apiVersion}/${clientId}/payins/payment-methods/payconiq", "POST"],
|
|
55
53
|
"payins_create_card_pre_authorized_deposit": ["/${apiVersion}/${clientId}/payins/deposit-preauthorized/direct/full-capture", "POST"],
|
|
56
54
|
"payins_deposit_preauthorized_prior_to_complement": ["/${apiVersion}/${clientId}/payins/deposit-preauthorized/direct/capture-with-complement", "POST"],
|
|
57
55
|
"payins_deposit_preauthorized_complement": ["/${apiVersion}/${clientId}/payins/deposit-preauthorized/direct/complement", "POST"],
|
|
@@ -272,5 +270,14 @@ module.exports = {
|
|
|
272
270
|
"recipients_validate": ["/${apiVersion}/${clientId}/users/${userId}/recipients/validate", "POST"],
|
|
273
271
|
"recipients_deactivate": ["/${apiVersion}/${clientId}/recipients/${recipientId}", "PUT"],
|
|
274
272
|
|
|
275
|
-
"pay_by_bank_get_supported_banks": ["/${apiVersion}/${clientId}/payment-methods/openbanking/metadata/supported-banks", "GET"]
|
|
273
|
+
"pay_by_bank_get_supported_banks": ["/${apiVersion}/${clientId}/payment-methods/openbanking/metadata/supported-banks", "GET"],
|
|
274
|
+
|
|
275
|
+
"acquiring_payins_card-direct_create": ["/${apiVersion}/${clientId}/acquiring/payins/card/direct/", "POST"],
|
|
276
|
+
"acquiring_payins_ideal-web_create": ["/${apiVersion}/${clientId}/acquiring/payins/payment-methods/ideal", "POST"],
|
|
277
|
+
"acquiring_payins_applepay-direct_create": ["/${apiVersion}/${clientId}/acquiring/payins/payment-methods/applepay", "POST"],
|
|
278
|
+
"acquiring_payins_googlepay-direct_create": ["/${apiVersion}/${clientId}/acquiring/payins/payment-methods/googlepay", "POST"],
|
|
279
|
+
"acquiring_payins_paypal-web_create": ["/${apiVersion}/${clientId}/acquiring/payins/payment-methods/paypal", "POST"],
|
|
280
|
+
"acquiring_payins_paypal_data_collection_create": ["/${apiVersion}/${clientId}/acquiring/payins/payment-methods/paypal/data-collection", "POST"],
|
|
281
|
+
"acquiring_payins_createrefunds": ["/${apiVersion}/${clientId}/acquiring/payins/${id}/refunds", "POST"],
|
|
282
|
+
"acquiring_card_validation_create": ["/${apiVersion}/${clientId}/acquiring/cards/${id}/validation", "POST"],
|
|
276
283
|
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
const _ = require('underscore');
|
|
2
|
+
|
|
3
|
+
const Service = require('../service');
|
|
4
|
+
|
|
5
|
+
const PayIn = require('../models/PayIn');
|
|
6
|
+
const PayInPaymentDetailsBankWire = require('../models/PayInPaymentDetailsBankWire');
|
|
7
|
+
const PayInPaymentDetailsCard = require('../models/PayInPaymentDetailsCard');
|
|
8
|
+
const PayInPaymentDetailsDirectDebitDirect = require('../models/PayInPaymentDetailsDirectDebitDirect');
|
|
9
|
+
const PayInPaymentDetailsDirectDebitWeb = require('../models/PayInPaymentDetailsDirectDebitWeb');
|
|
10
|
+
const PayInPaymentDetailsPreAuthorized = require('../models/PayInPaymentDetailsPreAuthorized');
|
|
11
|
+
const PayInPaymentDetailsPayPal = require('../models/PayInPaymentDetailsPayPal');
|
|
12
|
+
const PayInExecutionDetailsWeb = require('../models/PayInExecutionDetailsWeb');
|
|
13
|
+
const PayInExecutionDetailsDirect = require('../models/PayInExecutionDetailsDirect');
|
|
14
|
+
const PayInExecutionDetailsBankingAlias = require('../models/PayInExecutionDetailsBankingAlias');
|
|
15
|
+
const PayInPaymentDetailsApplePay = require('../models/PayInPaymentDetailsApplePay');
|
|
16
|
+
const PayInPaymentDetailsGooglePay = require('../models/PayInPaymentDetailsGooglePay');
|
|
17
|
+
const PayInPaymentDetailsMbway = require('../models/PayInPaymentDetailsMbway');
|
|
18
|
+
const PayInPaymentDetailsBancontact = require('../models/PayInPaymentDetailsBancontact');
|
|
19
|
+
const PayInPaymentDetailsBizum = require('../models/PayInPaymentDetailsBizum');
|
|
20
|
+
const Refund = require('../models/Refund');
|
|
21
|
+
const PayInPaymentDetailsMultibanco = require("../models/PayInPaymentDetailsMultibanco");
|
|
22
|
+
const PayInPaymentDetailsSatispay = require("../models/PayInPaymentDetailsSatispay");
|
|
23
|
+
const PayInPaymentDetailsBlik = require("../models/PayInPaymentDetailsBlik");
|
|
24
|
+
const PayInPaymentDetailsKlarna = require("../models/PayInPaymentDetailsKlarna");
|
|
25
|
+
const PayInPaymentDetailsIdeal = require("../models/PayInPaymentDetailsIdeal");
|
|
26
|
+
const PayInPaymentDetailsGiropay = require("../models/PayInPaymentDetailsGiropay");
|
|
27
|
+
const PayInPaymentDetailsSwish = require("../models/PayInPaymentDetailsSwish");
|
|
28
|
+
const PayInPaymentDetailsTwint = require("../models/PayInPaymentDetailsTwint");
|
|
29
|
+
const PayInPaymentDetailsPayByBank = require("../models/PayInPaymentDetailsPayByBank");
|
|
30
|
+
const CardValidation = require('../models/CardValidation');
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
const Acquiring = Service.extend({
|
|
34
|
+
/**
|
|
35
|
+
* Create new pay-in
|
|
36
|
+
* @param {Object} payIn PayIn object
|
|
37
|
+
* @param {Function} callback Callback function
|
|
38
|
+
* @param {Object} options Request options
|
|
39
|
+
* @return {Object} Request promise
|
|
40
|
+
*/
|
|
41
|
+
createPayIn: function (payIn, callback, options) {
|
|
42
|
+
options = this._api._getOptions(callback, options, {
|
|
43
|
+
data: payIn,
|
|
44
|
+
dataClass: PayIn
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const paymentKey = this.getPaymentKey(payIn);
|
|
48
|
+
const executionKey = this.getExecutionKey(payIn);
|
|
49
|
+
|
|
50
|
+
return this._api.method('acquiring_payins_' + paymentKey + '-' + executionKey + '_create', callback, options);
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Create refund for pay-in object
|
|
55
|
+
* @param {number} payInId PayIn identifier
|
|
56
|
+
* @param {Object} refund Refund data
|
|
57
|
+
* @param {Function} callback Callback function
|
|
58
|
+
* @param {Object} options Request options
|
|
59
|
+
* @return {Object} Request promise
|
|
60
|
+
*/
|
|
61
|
+
createPayInRefund: function (payInId, refund, callback, options) {
|
|
62
|
+
options = this._api._getOptions(callback, options, {
|
|
63
|
+
path: {
|
|
64
|
+
id: payInId
|
|
65
|
+
},
|
|
66
|
+
dataClass: Refund,
|
|
67
|
+
data: refund
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
return this._api.method('acquiring_payins_createrefunds', callback, options);
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Send key pre-transaction data such as order details, buyer information,
|
|
75
|
+
* and merchant context before initiating a PayPal payment
|
|
76
|
+
*
|
|
77
|
+
* @param dataCollection The data collection to be created
|
|
78
|
+
* @param callback Callback function
|
|
79
|
+
* @param options Request options
|
|
80
|
+
* @returns {Object} Request promise
|
|
81
|
+
*/
|
|
82
|
+
createPayPalDataCollection: function (dataCollection, callback, options) {
|
|
83
|
+
options = this._api._getOptions(callback, options, {
|
|
84
|
+
data: dataCollection
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
return this._api.method('acquiring_payins_paypal_data_collection_create', callback, options);
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Create card validation
|
|
92
|
+
* @param cardId The ID of the card
|
|
93
|
+
* @param cardValidation The create card validation dto
|
|
94
|
+
* @param callback Callback function
|
|
95
|
+
* @param options Request promise
|
|
96
|
+
* @returns {Object}
|
|
97
|
+
*/
|
|
98
|
+
createCardValidation: function (cardId, cardValidation, callback, options) {
|
|
99
|
+
options = this._api._getOptions(callback, options, {
|
|
100
|
+
path: {
|
|
101
|
+
id: cardId
|
|
102
|
+
},
|
|
103
|
+
data: cardValidation,
|
|
104
|
+
dataClass: CardValidation
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
return this._api.method('acquiring_card_validation_create', callback, options);
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
getPaymentKey: function (payIn) {
|
|
111
|
+
if (payIn.PaymentType) {
|
|
112
|
+
return payIn.PaymentType.toLowerCase().replaceAll('_', '');
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (payIn.PaymentDetails instanceof PayInPaymentDetailsBankWire) return 'bankwire';
|
|
116
|
+
if (payIn.PaymentDetails instanceof PayInPaymentDetailsCard) return 'card';
|
|
117
|
+
if (payIn.PaymentDetails instanceof PayInPaymentDetailsDirectDebitDirect) return 'directdebit';
|
|
118
|
+
if (payIn.PaymentDetails instanceof PayInPaymentDetailsDirectDebitWeb) return 'directdebit';
|
|
119
|
+
if (payIn.PaymentDetails instanceof PayInPaymentDetailsPreAuthorized) return 'preauthorized';
|
|
120
|
+
if (payIn.PaymentDetails instanceof PayInPaymentDetailsPayPal) return 'paypal';
|
|
121
|
+
if (payIn.PaymentDetails instanceof PayInPaymentDetailsApplePay) return 'applepay';
|
|
122
|
+
if (payIn.PaymentDetails instanceof PayInPaymentDetailsGooglePay) return 'googlepay';
|
|
123
|
+
if (payIn.PaymentDetails instanceof PayInPaymentDetailsMbway) return 'mbway';
|
|
124
|
+
if (payIn.PaymentDetails instanceof PayInPaymentDetailsBancontact) return 'bcmc';
|
|
125
|
+
if (payIn.PaymentDetails instanceof PayInPaymentDetailsBizum) return 'bizum';
|
|
126
|
+
if (payIn.PaymentDetails instanceof PayInPaymentDetailsMultibanco) return 'multibanco';
|
|
127
|
+
if (payIn.PaymentDetails instanceof PayInPaymentDetailsSatispay) return 'satispay';
|
|
128
|
+
if (payIn.PaymentDetails instanceof PayInPaymentDetailsBlik) return 'blik';
|
|
129
|
+
if (payIn.PaymentDetails instanceof PayInPaymentDetailsKlarna) return 'klarna';
|
|
130
|
+
if (payIn.PaymentDetails instanceof PayInPaymentDetailsIdeal) return 'ideal';
|
|
131
|
+
if (payIn.PaymentDetails instanceof PayInPaymentDetailsGiropay) return 'giropay';
|
|
132
|
+
if (payIn.PaymentDetails instanceof PayInPaymentDetailsSwish) return 'swish';
|
|
133
|
+
if (payIn.PaymentDetails instanceof PayInPaymentDetailsTwint) return 'twint';
|
|
134
|
+
if (payIn.PaymentDetails instanceof PayInPaymentDetailsPayByBank) return 'paybybank';
|
|
135
|
+
|
|
136
|
+
throw new Error(`PaymentType ${payIn.PaymentType} not handled`);
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
getExecutionKey: function (payIn) {
|
|
140
|
+
if (payIn.ExecutionType) {
|
|
141
|
+
return payIn.ExecutionType.toLowerCase();
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (payIn.ExecutionDetails instanceof PayInExecutionDetailsWeb) return 'web';
|
|
145
|
+
if (payIn.ExecutionDetails instanceof PayInExecutionDetailsDirect) return 'direct';
|
|
146
|
+
if (payIn.ExecutionDetails instanceof PayInExecutionDetailsBankingAlias) return 'bankingalias';
|
|
147
|
+
|
|
148
|
+
throw new Error(`ExecutionType ${payIn.ExecutionType} not handled`);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
module.exports = Acquiring;
|
package/lib/services/PayIns.js
CHANGED
|
@@ -24,7 +24,6 @@ var PayInPaymentDetailsBancontact = require('../models/PayInPaymentDetailsBancon
|
|
|
24
24
|
var PayInPaymentDetailsBizum = require('../models/PayInPaymentDetailsBizum');
|
|
25
25
|
var Refund = require('../models/Refund');
|
|
26
26
|
var PayInRecurringRegistration = require('../models/PayInRecurringRegistration');
|
|
27
|
-
var PayInPaymentDetailsPayconiq = require('../models/PayInPaymentDetailsPayconiq');
|
|
28
27
|
const RecurringPayIn = require('../models/RecurringPayIn');
|
|
29
28
|
const PayInPaymentDetailsMultibanco = require("../models/PayInPaymentDetailsMultibanco");
|
|
30
29
|
const PayInPaymentDetailsSatispay = require("../models/PayInPaymentDetailsSatispay");
|
|
@@ -359,22 +358,6 @@ var PayIns = Service.extend({
|
|
|
359
358
|
return this._api.method('payins_card-web_get_details', callback, options);
|
|
360
359
|
},
|
|
361
360
|
|
|
362
|
-
/**
|
|
363
|
-
* Create new pay-in Payconiq Web, using the latest API url (/payment-methods/payconiq)
|
|
364
|
-
* @param {Object} payIn PayIn object
|
|
365
|
-
* @param {Function} callback Callback function
|
|
366
|
-
* @param {Object} options Request options
|
|
367
|
-
* @return {Object} Request promise
|
|
368
|
-
*/
|
|
369
|
-
createPayconiq: function(payIn, callback, options) {
|
|
370
|
-
options = this._api._getOptions(callback, options, {
|
|
371
|
-
data: payIn,
|
|
372
|
-
dataClass: PayIn
|
|
373
|
-
});
|
|
374
|
-
|
|
375
|
-
return this._api.method('payins_payconiqv2-web_create', callback, options);
|
|
376
|
-
},
|
|
377
|
-
|
|
378
361
|
/**
|
|
379
362
|
* Create a pay in intent authorization
|
|
380
363
|
* @param {Object} payInIntentAuthorization PayInIntentAuthorization object
|
|
@@ -745,7 +728,6 @@ var PayIns = Service.extend({
|
|
|
745
728
|
if (payIn.PaymentDetails instanceof PayInPaymentDetailsPayPal) return 'paypal';
|
|
746
729
|
if (payIn.PaymentDetails instanceof PayInPaymentDetailsApplePay) return 'applepay';
|
|
747
730
|
if (payIn.PaymentDetails instanceof PayInPaymentDetailsGooglePay) return 'googlepay';
|
|
748
|
-
if (payIn.PaymentDetails instanceof PayInPaymentDetailsPayconiq) return 'payconiq';
|
|
749
731
|
if (payIn.PaymentDetails instanceof PayInPaymentDetailsMbway) return 'mbway';
|
|
750
732
|
if (payIn.PaymentDetails instanceof PayInPaymentDetailsBancontact) return 'bcmc';
|
|
751
733
|
if (payIn.PaymentDetails instanceof PayInPaymentDetailsBizum) return 'bizum';
|
package/lib/services/index.js
CHANGED
|
@@ -30,5 +30,6 @@ module.exports = {
|
|
|
30
30
|
IdentityVerifications: require('./IdentityVerifications'),
|
|
31
31
|
Recipients: require('./Recipients'),
|
|
32
32
|
ReportsV2: require('./ReportsV2'),
|
|
33
|
-
Settlements: require('./Settlements')
|
|
33
|
+
Settlements: require('./Settlements'),
|
|
34
|
+
Acquiring: require('./Acquiring'),
|
|
34
35
|
};
|
package/package.json
CHANGED
package/test/helpers.js
CHANGED
|
@@ -1104,7 +1104,7 @@ module.exports = {
|
|
|
1104
1104
|
AuthorId: user.Id,
|
|
1105
1105
|
CreditedWalletId: wallet.Id,
|
|
1106
1106
|
DebitedFunds: {
|
|
1107
|
-
Amount:
|
|
1107
|
+
Amount: 990,
|
|
1108
1108
|
Currency: 'EUR'
|
|
1109
1109
|
},
|
|
1110
1110
|
Fees: {
|
|
@@ -1125,7 +1125,8 @@ module.exports = {
|
|
|
1125
1125
|
Quantity: 1,
|
|
1126
1126
|
UnitAmount: 500,
|
|
1127
1127
|
TaxAmount: 0,
|
|
1128
|
-
Description: "seller2 ID"
|
|
1128
|
+
Description: "seller2 ID",
|
|
1129
|
+
Discount: 10
|
|
1129
1130
|
}
|
|
1130
1131
|
],
|
|
1131
1132
|
Country: "FR",
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
const expect = require('chai').expect;
|
|
2
|
+
|
|
3
|
+
const mangopay = require('../../index');
|
|
4
|
+
|
|
5
|
+
// const api = global.api = new mangopay({
|
|
6
|
+
// clientId: 'placeholder',
|
|
7
|
+
// clientApiKey: 'placeholder'
|
|
8
|
+
// });
|
|
9
|
+
|
|
10
|
+
const cardId = 'placeholder';
|
|
11
|
+
|
|
12
|
+
describe.skip('Acquiring', function () {
|
|
13
|
+
describe('PayIn Card Direct', function () {
|
|
14
|
+
let payIn;
|
|
15
|
+
|
|
16
|
+
before(function (done) {
|
|
17
|
+
const dto = {
|
|
18
|
+
DebitedFunds: {
|
|
19
|
+
Amount: 100,
|
|
20
|
+
Currency: 'EUR'
|
|
21
|
+
},
|
|
22
|
+
IpAddress: '2001:0620:0000:0000:0211:24FF:FE80:C12C',
|
|
23
|
+
BrowserInfo: {
|
|
24
|
+
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
25
|
+
JavaEnabled: true,
|
|
26
|
+
Language: "FR-FR",
|
|
27
|
+
ColorDepth: 4,
|
|
28
|
+
ScreenHeight: 1800,
|
|
29
|
+
ScreenWidth: 400,
|
|
30
|
+
JavascriptEnabled: true,
|
|
31
|
+
TimeZoneOffset: "+60",
|
|
32
|
+
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
33
|
+
},
|
|
34
|
+
CardId: cardId,
|
|
35
|
+
SecureMode: 'DEFAULT',
|
|
36
|
+
SecureModeReturnURL: 'http://test.com',
|
|
37
|
+
PaymentType: 'CARD',
|
|
38
|
+
ExecutionType: 'DIRECT'
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
api.Acquiring.createPayIn(dto, function (response) {
|
|
42
|
+
payIn = response;
|
|
43
|
+
done();
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should create the PayIn', function () {
|
|
48
|
+
expect(payIn).not.to.be.undefined;
|
|
49
|
+
expect(payIn.PaymentType).to.equal('CARD');
|
|
50
|
+
expect(payIn.ExecutionType).to.equal('DIRECT');
|
|
51
|
+
expect(payIn.Status).to.equal('SUCCEEDED');
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe('PayIn Ideal Web', function () {
|
|
56
|
+
let payIn;
|
|
57
|
+
|
|
58
|
+
before(function (done) {
|
|
59
|
+
const dto = {
|
|
60
|
+
DebitedFunds: {
|
|
61
|
+
Amount: 100,
|
|
62
|
+
Currency: 'EUR'
|
|
63
|
+
},
|
|
64
|
+
ReturnURL: 'http://test.com',
|
|
65
|
+
PaymentType: 'IDEAL',
|
|
66
|
+
ExecutionType: 'WEB'
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
api.Acquiring.createPayIn(dto, function (response) {
|
|
70
|
+
payIn = response;
|
|
71
|
+
done();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('should create the PayIn', function () {
|
|
76
|
+
expect(payIn).not.to.be.undefined;
|
|
77
|
+
expect(payIn.PaymentType).to.equal('IDEAL');
|
|
78
|
+
expect(payIn.ExecutionType).to.equal('WEB');
|
|
79
|
+
expect(payIn.Status).to.equal('CREATED');
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe('PayIn ApplePay Direct', function () {
|
|
84
|
+
let payIn;
|
|
85
|
+
|
|
86
|
+
before(function (done) {
|
|
87
|
+
const dto = {
|
|
88
|
+
DebitedFunds: {
|
|
89
|
+
Amount: 100,
|
|
90
|
+
Currency: 'EUR'
|
|
91
|
+
},
|
|
92
|
+
PaymentData: {},
|
|
93
|
+
PaymentType: 'APPLEPAY',
|
|
94
|
+
ExecutionType: 'DIRECT'
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
api.Acquiring.createPayIn(dto, function (response) {
|
|
98
|
+
payIn = response;
|
|
99
|
+
done();
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('should create the PayIn', function () {
|
|
104
|
+
expect(payIn).not.to.be.undefined;
|
|
105
|
+
expect(payIn.PaymentType).to.equal('APPLEPAY');
|
|
106
|
+
expect(payIn.ExecutionType).to.equal('DIRECT');
|
|
107
|
+
expect(payIn.Status).to.equal('CREATED');
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
describe('PayIn GooglePay Direct', function () {
|
|
112
|
+
let payIn;
|
|
113
|
+
|
|
114
|
+
before(function (done) {
|
|
115
|
+
const dto = {
|
|
116
|
+
DebitedFunds: {
|
|
117
|
+
Amount: 100,
|
|
118
|
+
Currency: 'EUR'
|
|
119
|
+
},
|
|
120
|
+
IpAddress: '2001:0620:0000:0000:0211:24FF:FE80:C12C',
|
|
121
|
+
BrowserInfo: {
|
|
122
|
+
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
123
|
+
JavaEnabled: true,
|
|
124
|
+
Language: "FR-FR",
|
|
125
|
+
ColorDepth: 4,
|
|
126
|
+
ScreenHeight: 1800,
|
|
127
|
+
ScreenWidth: 400,
|
|
128
|
+
JavascriptEnabled: true,
|
|
129
|
+
TimeZoneOffset: "+60",
|
|
130
|
+
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
131
|
+
},
|
|
132
|
+
SecureModeReturnURL: 'http://test.com',
|
|
133
|
+
PaymentData: "",
|
|
134
|
+
PaymentType: 'GOOGLE_PAY',
|
|
135
|
+
ExecutionType: 'DIRECT'
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
api.Acquiring.createPayIn(dto, function (response) {
|
|
139
|
+
payIn = response;
|
|
140
|
+
done();
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('should create the PayIn', function () {
|
|
145
|
+
expect(payIn).not.to.be.undefined;
|
|
146
|
+
expect(payIn.PaymentType).to.equal('GOOGLE_PAY');
|
|
147
|
+
expect(payIn.ExecutionType).to.equal('DIRECT');
|
|
148
|
+
expect(payIn.Status).to.equal('CREATED');
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
describe('PayIn PayPal Web', function () {
|
|
153
|
+
let payIn;
|
|
154
|
+
|
|
155
|
+
before(function (done) {
|
|
156
|
+
const dto = {
|
|
157
|
+
DebitedFunds: {
|
|
158
|
+
Amount: 100,
|
|
159
|
+
Currency: 'EUR'
|
|
160
|
+
},
|
|
161
|
+
LineItems: [
|
|
162
|
+
{
|
|
163
|
+
Name: "running shoes",
|
|
164
|
+
Quantity: 1,
|
|
165
|
+
UnitAmount: 100,
|
|
166
|
+
TaxAmount: 0,
|
|
167
|
+
Description: "seller1 ID"
|
|
168
|
+
}
|
|
169
|
+
],
|
|
170
|
+
ReturnURL: 'https://mangopay.com',
|
|
171
|
+
PaymentType: 'PAYPAL',
|
|
172
|
+
ExecutionType: 'WEB'
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
api.Acquiring.createPayIn(dto, function (response) {
|
|
176
|
+
payIn = response;
|
|
177
|
+
done();
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it('should create the PayIn', function () {
|
|
182
|
+
expect(payIn).not.to.be.undefined;
|
|
183
|
+
expect(payIn.PaymentType).to.equal('PAYPAL');
|
|
184
|
+
expect(payIn.ExecutionType).to.equal('WEB');
|
|
185
|
+
expect(payIn.Status).to.equal('CREATED');
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
describe('PayPal DataCollection', function () {
|
|
190
|
+
let dataCollection;
|
|
191
|
+
|
|
192
|
+
before(function (done) {
|
|
193
|
+
const dto = {
|
|
194
|
+
"sender_account_id" : "A12345N343",
|
|
195
|
+
"sender_first_name" : "Jane",
|
|
196
|
+
"sender_last_name" : "Doe",
|
|
197
|
+
"sender_email" : "jane.doe@sample.com",
|
|
198
|
+
"sender_phone" : "(042) 1123 4567",
|
|
199
|
+
"sender_address_zip" : "75009",
|
|
200
|
+
"sender_country_code" : "FR",
|
|
201
|
+
"sender_create_date" : "2012-12-09T19:14:55.277-0:00",
|
|
202
|
+
"sender_signup_ip" : "10.220.90.20",
|
|
203
|
+
"sender_popularity_score" : "high",
|
|
204
|
+
"receiver_account_id" : "A12345N344",
|
|
205
|
+
"receiver_create_date" : "2012-12-09T19:14:55.277-0:00",
|
|
206
|
+
"receiver_email" : "jane@sample.com",
|
|
207
|
+
"receiver_address_country_code" : "FR",
|
|
208
|
+
"business_name" : "Jane Ltd",
|
|
209
|
+
"recipient_popularity_score" : "high",
|
|
210
|
+
"first_interaction_date" : "2012-12-09T19:14:55.277-0:00",
|
|
211
|
+
"txn_count_total" : "34",
|
|
212
|
+
"vertical" : "Household goods",
|
|
213
|
+
"transaction_is_tangible" : "0"
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
api.Acquiring.createPayPalDataCollection(dto, function (response) {
|
|
217
|
+
dataCollection = response;
|
|
218
|
+
done();
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
it('should create the PayIn', function () {
|
|
223
|
+
expect(dataCollection).not.to.be.undefined;
|
|
224
|
+
expect(dataCollection.dataCollectionId).not.to.be.undefined;
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
describe('PayIn Refund', function () {
|
|
229
|
+
let refund;
|
|
230
|
+
|
|
231
|
+
before(function (done) {
|
|
232
|
+
const payInDto = {
|
|
233
|
+
DebitedFunds: {
|
|
234
|
+
Amount: 100,
|
|
235
|
+
Currency: 'EUR'
|
|
236
|
+
},
|
|
237
|
+
IpAddress: '2001:0620:0000:0000:0211:24FF:FE80:C12C',
|
|
238
|
+
BrowserInfo: {
|
|
239
|
+
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
240
|
+
JavaEnabled: true,
|
|
241
|
+
Language: "FR-FR",
|
|
242
|
+
ColorDepth: 4,
|
|
243
|
+
ScreenHeight: 1800,
|
|
244
|
+
ScreenWidth: 400,
|
|
245
|
+
JavascriptEnabled: true,
|
|
246
|
+
TimeZoneOffset: "+60",
|
|
247
|
+
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
248
|
+
},
|
|
249
|
+
CardId: cardId,
|
|
250
|
+
SecureMode: 'DEFAULT',
|
|
251
|
+
SecureModeReturnURL: 'http://test.com',
|
|
252
|
+
PaymentType: 'CARD',
|
|
253
|
+
ExecutionType: 'DIRECT'
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
api.Acquiring.createPayIn(payInDto, function (createdPayIn) {
|
|
257
|
+
const refundDto = {
|
|
258
|
+
DebitedFunds: {
|
|
259
|
+
Amount: 100,
|
|
260
|
+
Currency: 'EUR'
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
api.Acquiring.createPayInRefund(createdPayIn.Id, refundDto, function (response) {
|
|
264
|
+
refund = response;
|
|
265
|
+
done();
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
it('should create the PayIn', function () {
|
|
271
|
+
expect(refund).not.to.be.undefined;
|
|
272
|
+
expect(refund.Type).to.equal('PAYOUT');
|
|
273
|
+
expect(refund.Nature).to.equal('REFUND');
|
|
274
|
+
expect(refund.Status).to.equal('SUCCEEDED');
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
describe('Card Validation', function () {
|
|
279
|
+
let cardValidation;
|
|
280
|
+
|
|
281
|
+
before(function (done) {
|
|
282
|
+
const dto = {
|
|
283
|
+
SecureModeReturnURL: "http://example.com",
|
|
284
|
+
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
|
|
285
|
+
BrowserInfo: {
|
|
286
|
+
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
287
|
+
ColorDepth: 4,
|
|
288
|
+
JavaEnabled: true,
|
|
289
|
+
JavascriptEnabled: true,
|
|
290
|
+
Language: 'FR-FR',
|
|
291
|
+
ScreenHeight: 1800,
|
|
292
|
+
ScreenWidth: 400,
|
|
293
|
+
TimeZoneOffset: "+60",
|
|
294
|
+
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
api.Acquiring.createCardValidation(cardId, dto, function (response) {
|
|
299
|
+
cardValidation = response;
|
|
300
|
+
done();
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
it('should create the PayIn', function () {
|
|
305
|
+
expect(cardValidation).to.not.be.undefined;
|
|
306
|
+
expect(cardValidation.Id).to.not.be.undefined;
|
|
307
|
+
expect(cardValidation.Type).to.equal("CARD_VALIDATION");
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
describe('Settlement Report', function () {
|
|
312
|
+
let report;
|
|
313
|
+
|
|
314
|
+
before(function (done) {
|
|
315
|
+
const dto = {
|
|
316
|
+
DownloadFormat: "CSV",
|
|
317
|
+
ReportType: "ACQUIRING_SETTLEMENT",
|
|
318
|
+
AfterDate: 1740787200,
|
|
319
|
+
BeforeDate: 1743544740,
|
|
320
|
+
Filters: {
|
|
321
|
+
SettlementId: "placeholder"
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
api.ReportsV2.create(dto, function (response) {
|
|
326
|
+
report = response;
|
|
327
|
+
done();
|
|
328
|
+
});
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
it('should create the PayIn', function () {
|
|
332
|
+
expect(report.Id).to.exist;
|
|
333
|
+
expect(report.ReportType).to.equal("ACQUIRING_SETTLEMENT");
|
|
334
|
+
expect(report.DownloadFormat).to.equal("CSV");
|
|
335
|
+
expect(report.Status).to.equal("PENDING");
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
});
|