mangopay4-nodejs-sdk 1.66.1 → 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 +15 -0
- package/README.md +78 -1
- package/lib/api.js +31 -2
- package/lib/apiMethods.js +10 -3
- package/lib/config.js +14 -1
- 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/Idempotency.js +1 -6
- package/test/services/PayIns.js +2 -123
- package/test/services/RateLimit.js +1 -6
- package/test/services/UboDeclarations.js +1 -6
- package/typings/base.d.ts +41 -0
- package/typings/enums.d.ts +0 -1
- package/typings/index.d.ts +5 -5
- package/typings/index.test-d.ts +19 -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,18 @@
|
|
|
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
|
+
|
|
12
|
+
## [1.67.0] - 2026-03-19
|
|
13
|
+
### Added - mTLS certificates support
|
|
14
|
+
- mTLS certificates are now configurable in the SDK via file paths or encoded strings
|
|
15
|
+
|
|
1
16
|
## [1.66.1] - 2026-02-23
|
|
2
17
|
### Added - ChargeBearer body parameter on payouts
|
|
3
18
|
|
package/README.md
CHANGED
|
@@ -34,7 +34,84 @@ Supported options
|
|
|
34
34
|
|connectionTimeout|30000|Set the connection timeout limit (in milliseconds)|
|
|
35
35
|
|responseTimeout|80000|Set the response timeout limit (in milliseconds)|
|
|
36
36
|
|apiVersion|'v2.01'|API Version|
|
|
37
|
-
|errorHandler|```function(options, err) {console.error(options, err)}```|Set a custom error handler
|
|
37
|
+
|errorHandler|```function(options, err) {console.error(options, err)}```|Set a custom error handler|
|
|
38
|
+
|cert|null|Base64-encoded string of the mTLS certificate `.pem` file content|
|
|
39
|
+
|key|null|Base64-encoded string of the mTLS private `.key` file content|
|
|
40
|
+
|ca|null|Base64-encoded string of the private or custom certificate authority (optional)|
|
|
41
|
+
|passphrase|null|Passphrase for an encrypted mTLS private key (optional)|
|
|
42
|
+
|certFilePath|null|Path to the mTLS certificate `.pem` file (takes precedence over `cert` if set)|
|
|
43
|
+
|keyFilePath|null|Path to the mTLS private `.key` file (takes precedence over `key` if set)|
|
|
44
|
+
|caFilePath|null|Path to the private or custom certificate authority file (takes precedence over `ca` if set)|
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
mTLS
|
|
48
|
+
-------------------------------------------------
|
|
49
|
+
### Set the base URL for mTLS
|
|
50
|
+
|
|
51
|
+
Using mTLS authentication requires your integration to call a base URL with a different hostname from the standard API:
|
|
52
|
+
|
|
53
|
+
* Sandbox: `https://api-mtls.sandbox.mangopay.com`
|
|
54
|
+
* Production: `https://api-mtls.mangopay.com`
|
|
55
|
+
|
|
56
|
+
If using mTLS, your integration should use the `api-mtls` URLs for all API calls, including OAuth token generation.
|
|
57
|
+
|
|
58
|
+
**Caution:** Ensure you set the mTLS base URL, as shown in the configuration examples below. If you don’t, the mTLS certificate will not be transferred to Mangopay. When mTLS is enforced, your integration will result in an error.
|
|
59
|
+
|
|
60
|
+
### Configure the SDK’s mTLS properties
|
|
61
|
+
|
|
62
|
+
The Node.js SDK allows you to load Base64-encoded strings from your environment variables. You can also load locally stored file paths, which may be useful during testing.
|
|
63
|
+
|
|
64
|
+
**Caution:** The file path properties take precedence if both are set.
|
|
65
|
+
|
|
66
|
+
#### Base64-encoded strings
|
|
67
|
+
|
|
68
|
+
When your `.pem` certificate and private `.key` are stored as encoded strings in a secrets manager, you can load them using the following configuration properties.
|
|
69
|
+
|
|
70
|
+
**Best practice:** Use this option in Production.
|
|
71
|
+
|
|
72
|
+
| Property | Type | Description |
|
|
73
|
+
| ------------ | ----------------- |-------------------------------------------------------------------------------|
|
|
74
|
+
| `cert` | string | Base64-encoded string of the certificate `.pem` file content. |
|
|
75
|
+
| `key` | string | Base64-encoded string of the private `.key` file content. |
|
|
76
|
+
| `ca` | string (optional) | Base64-encoded string of the private or custom certificate authority, if used. |
|
|
77
|
+
| `passphrase` | string (optional) | String of the passphrase for an encrypted private key. |
|
|
78
|
+
|
|
79
|
+
```jsx theme={null}
|
|
80
|
+
const mangopay = new Mangopay({
|
|
81
|
+
clientId: 'your-mangopay-client-id',
|
|
82
|
+
clientApiKey: 'your-api-key',
|
|
83
|
+
baseUrl: 'https://api-mtls.sandbox.mangopay.com', // mTLS base URL
|
|
84
|
+
cert: process.env.CERTIFICATE_PEM_B64, // Base64-encoded
|
|
85
|
+
key: process.env.PRIVATE_KEY_B64, // Base64-encoded
|
|
86
|
+
ca: process.env.YOUR_CUSTOM_CA, // Base64-encoded (optional)
|
|
87
|
+
passphrase: process.env.YOUR_CERT_PASSPHRASE, // (optional)
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
#### File paths
|
|
92
|
+
|
|
93
|
+
If your `.pem` certificate and private `.key` are stored locally, for example during testing, you can load them using the following properties.
|
|
94
|
+
|
|
95
|
+
**Caution:** If the file path properties are set, they take precedence and the Base64-encoded equivalents are ignored.
|
|
96
|
+
|
|
97
|
+
| Property | Type | Description |
|
|
98
|
+
| -------------- | ----------------- | ------------------------------------------------------------- |
|
|
99
|
+
| `certFilePath` | string | Path to the certificate `.pem` file. |
|
|
100
|
+
| `keyFilePath` | string | Path to the private `.key` file. |
|
|
101
|
+
| `caFilePath` | string (optional) | Path to the private or custom certificate authority, if used. |
|
|
102
|
+
| `passphrase` | string (optional) | String of the passphrase for an encrypted private key. |
|
|
103
|
+
|
|
104
|
+
```jsx theme={null}
|
|
105
|
+
const mangopay = new Mangopay({
|
|
106
|
+
clientId: 'your-mangopay-client-id',
|
|
107
|
+
clientApiKey: 'your-api-key',
|
|
108
|
+
baseUrl: 'https://api-mtls.sandbox.mangopay.com', // mTLS base URL
|
|
109
|
+
certFilePath: '/path/to/certificate.pem',
|
|
110
|
+
keyFilePath: '/path/to/private.key',
|
|
111
|
+
caFilePath: '/path/to/custom-ca.crt', // optional
|
|
112
|
+
passphrase: 'your-cert-passphrase', // optional
|
|
113
|
+
});
|
|
114
|
+
```
|
|
38
115
|
|
|
39
116
|
Documentation
|
|
40
117
|
-------------------------------------------------
|
package/lib/api.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
var _ = require('underscore');
|
|
2
2
|
var Promise = require('promise');
|
|
3
3
|
var querystring = require('querystring');
|
|
4
|
+
var https = require('https');
|
|
5
|
+
var fs = require('fs');
|
|
4
6
|
|
|
5
7
|
var apiMethods = require('./apiMethods');
|
|
6
8
|
var apiModels = require('./models');
|
|
@@ -20,6 +22,29 @@ function _getBasicAuthHash(username, apiKey) {
|
|
|
20
22
|
return 'Basic ' + Buffer.from(username + ':' + apiKey).toString('base64');
|
|
21
23
|
}
|
|
22
24
|
|
|
25
|
+
function _buildHttpsAgent(config) {
|
|
26
|
+
var agentOptions = {
|
|
27
|
+
minVersion: 'TLSv1.2'
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var cert = (config.cert && Buffer.from(config.cert, 'base64').toString('utf8')) || (config.certFilePath && fs.readFileSync(config.certFilePath));
|
|
31
|
+
var key = (config.key && Buffer.from(config.key, 'base64').toString('utf8')) || (config.keyFilePath && fs.readFileSync(config.keyFilePath));
|
|
32
|
+
var ca = (config.ca && Buffer.from(config.ca, 'base64').toString('utf8')) || (config.caFilePath && fs.readFileSync(config.caFilePath));
|
|
33
|
+
|
|
34
|
+
if (cert && key) {
|
|
35
|
+
agentOptions.cert = cert;
|
|
36
|
+
agentOptions.key = key;
|
|
37
|
+
if (ca) {
|
|
38
|
+
agentOptions.ca = ca;
|
|
39
|
+
}
|
|
40
|
+
if (config.passphrase) {
|
|
41
|
+
agentOptions.passphrase = config.passphrase;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return new https.Agent(agentOptions);
|
|
46
|
+
}
|
|
47
|
+
|
|
23
48
|
var Api = function (config) {
|
|
24
49
|
var defaultConfig = require('./config');
|
|
25
50
|
config = this.config = _.extend({}, defaultConfig, config);
|
|
@@ -30,6 +55,8 @@ var Api = function (config) {
|
|
|
30
55
|
|
|
31
56
|
this.errorHandler = config.errorHandler;
|
|
32
57
|
|
|
58
|
+
this.httpsAgent = _buildHttpsAgent(config);
|
|
59
|
+
|
|
33
60
|
this.rateLimits = [];
|
|
34
61
|
|
|
35
62
|
// Add default request configuration options
|
|
@@ -244,7 +271,8 @@ Api.prototype = {
|
|
|
244
271
|
data: requestOptions.data,
|
|
245
272
|
headers: requestOptions.headers,
|
|
246
273
|
params: requestOptions.parameters,
|
|
247
|
-
signal: abortSignal
|
|
274
|
+
signal: abortSignal,
|
|
275
|
+
httpsAgent: self.httpsAgent
|
|
248
276
|
})
|
|
249
277
|
.then(function (response) {
|
|
250
278
|
var resolveArgument = (resolveWithFullResponse) ?
|
|
@@ -357,7 +385,8 @@ Api.prototype = {
|
|
|
357
385
|
headers: _.extend({}, self.requestOptions.headers, {
|
|
358
386
|
'Authorization': _getBasicAuthHash(self.config.clientId, self.config.clientApiKey),
|
|
359
387
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
360
|
-
})
|
|
388
|
+
}),
|
|
389
|
+
httpsAgent: self.httpsAgent
|
|
361
390
|
})
|
|
362
391
|
.then(function (response) {
|
|
363
392
|
// Authorization succeeded
|
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
|
};
|
package/lib/config.js
CHANGED
|
@@ -53,5 +53,18 @@ module.exports = {
|
|
|
53
53
|
*/
|
|
54
54
|
errorHandler: function(options, err) {
|
|
55
55
|
console.error(options, err);
|
|
56
|
-
}
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
// mTLS – base64-encoded PEM content
|
|
59
|
+
cert: null,
|
|
60
|
+
key: null,
|
|
61
|
+
ca: null,
|
|
62
|
+
|
|
63
|
+
// mTLS – file paths (SDK reads them at init)
|
|
64
|
+
certFilePath: null,
|
|
65
|
+
keyFilePath: null,
|
|
66
|
+
caFilePath: null,
|
|
67
|
+
|
|
68
|
+
// optional passphrase for encrypted private key
|
|
69
|
+
passphrase: null
|
|
57
70
|
};
|
|
@@ -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",
|