mangopay4-nodejs-sdk 1.64.0 → 1.66.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 CHANGED
@@ -1,3 +1,86 @@
1
+ ## [1.66.0] - 2026-02-12
2
+ ### FX
3
+
4
+ #### Breaking change – Custom fees
5
+ #530
6
+ To support percentage-based FX fees ([API release note](/release-notes/api/2026-02-11)):
7
+ - **Breaking change** – The `CreateInstantConversion.Fees` type is now `CustomMoneyData` instead of `MoneyData`, to support the new FX fees structure of `Type` (`PERCENTAGE` | `FIXED`) and `Value`
8
+ - **Breaking change** - The `CreateInstantConversion.CreditedFunds` type is now `MoneyDataOptionalAmount` instead of `MoneyData`
9
+ - Added `Fees` to `CreateQuote`
10
+ - Added `Fees` and `RequestedFees` to `QuoteData`
11
+ - Added `RequestedFees` to `ConversionData`
12
+
13
+ #### Added – User margin
14
+ #530
15
+ To support the FX user margin ([API release note](/release-notes/api/2026-02-11)):
16
+ - Added `UserMargin` to `CreateInstantConversion` and `CreateQuote`
17
+ - Added `MarginsResponse` to `ConversionData` and `QuoteData`
18
+
19
+ ### Echo
20
+
21
+ #### Breaking change - Settlement upload endpoints
22
+ #527
23
+ To support the new behavior of the [POST Create a Settlement](/api-reference/settlements/create-settlement) endpoint to obtain an `UploadUrl`:
24
+ - Updated `settlement_sample.csv` and tests
25
+ - Added `FileName` and `UploadUrl` to `SettlementData`
26
+ - Added `GenerateSettlementUploadUrl ` interface
27
+ - **Breaking change** – Replaced `upload` method in `Settlements` with `generateUploadUrl`:
28
+ - **Breaking change** – Replaced `update` method in `Settlements` with `generateNewUploadUrl`:
29
+
30
+ #### Added - GET validations for a Settlement endpoint
31
+ #527
32
+ To support the [GET View validations for a Settlement](/api-reference/settlements/view-settlement-validations) endpoint:
33
+ - Added `SettlementValidation`, `SettlementValidationFooter`, `SettlementValidationLine` interfaces
34
+ - Added `getValidations` method to `Settlements`
35
+
36
+ #### Added - PUT Cancel a Settlement endpoint
37
+ #527
38
+ To support the [PUT Cancel a Settlement](/api-reference/settlements/cancel-settlement) endpoint:
39
+ - Added `cancel` method to `Settlements`
40
+
41
+ #### Added – Intent unfunded amounts and source wallet
42
+ #528
43
+ - Added `SplitOriginWalletId` to `PayInIntentLineItem`, `PayInIntentSplitData`, `CreatePayInIntentSplit`
44
+ #523
45
+ - Added `UnfundedSellerAmount` to `PayInIntentLineItem`
46
+ - Added `UnfundedAmount` to `PayInIntentData`, `CreatePayInIntentAuthorization`
47
+
48
+ #### Added – POST Create a Refund of an Intent
49
+ #524
50
+ To support [POST Create a Refund of an Intent](/api-reference/intents/create-intent-refund):
51
+ - Added `Refund` and `Capture` to `PayInIntentData`
52
+ - Added `createPayInIntentRefund` method to `Payins`:
53
+
54
+ #### Added – POST Reverse the Refund of an Intent
55
+ #524
56
+ To support [POST Reverse the Refund of an Intent](/api-reference/intents/create-intent-refund):
57
+ - Added `reversePayInIntentRefund` method to `PayIns`:
58
+
59
+ #### Added – POST Create a Dispute of an Intent
60
+ #524
61
+ To support [POST Create a Dispute of an Intent](/api-reference/intents/create-intent-refund):
62
+ - Added `Dispute` to `PayInIntentData`
63
+ - Added `createPayInIntentDispute` method to `PayIns`:
64
+
65
+ #### Added - PUT Update an Intent Dispute
66
+ #524
67
+ To support [PUT Update an Intent Dispute](/api-reference/intents/create-intent-dispute):
68
+ - Added `Decision` to `PayInIntentData`
69
+ - Added `UpdatePayInIntentDisputeOutcome` interface
70
+ - Added `updatePayInIntentDisputeOutcome` method to `PayIns`:
71
+
72
+ ## [1.65.0] - 2026-01-27
73
+ ### Added
74
+ - Support for new [GET View the SCA status of a User](https://docs.mangopay.com/api-reference/users/view-user-sca-status) endpoint ([API release note](https://docs.mangopay.com/release-notes/api/2026-01-15)) (#526)
75
+ - Support for new [event types](https://docs.mangopay.com/webhooks/event-types#mangopay-sca-email-and-phone-number-verification) `SCA_CONTACT_INFORMATION_UPDATE_CONSENT_GIVEN`, `SCA_CONTACT_INFORMATION_UPDATE_CONSENT_REVOKED`, `SCA_TRANSFER_CONSENT_GIVEN`, `SCA_TRANSFER_CONSENT_REVOKED`, `SCA_RECIPIENT_REGISTRATION_CONSENT_GIVEN`, `SCA_RECIPIENT_REGISTRATION_CONSENT_REVOKED`, `SCA_VIEW_ACCOUNT_INFORMATION_CONSENT_GIVEN`, `SCA_VIEW_ACCOUNT_INFORMATION_CONSENT_REVOKED`, `SCA_EMAIL_VERIFIED`, `SCA_PHONE_NUMBER_VERIFIED` (#525)
76
+ - Support for new `RecipientId` property on [payouts](https://docs.mangopay.com/api-reference/payouts/create-payout) ([API release note](https://docs.mangopay.com/release-notes/api/2026-01-27)) (#522)
77
+
78
+ Release PR: #529
79
+
80
+ ## [1.64.0] - 2025-11-26
81
+ ### Changed
82
+ - changed naming convention to mangopay4
83
+
1
84
  ## [1.62.2] - 2025-11-25
2
85
  ### Added
3
86
  - Support for `ScaContext` on [POST Create a Recipient](https://docs.mangopay.com/api-reference/recipients/create-recipient) for platforms taking action by [proxy with consent](https://docs.mangopay.com/guides/sca/proxy-management) from the user ([API release note](https://docs.mangopay.com/release-notes/api/2025-11-17), #519)
package/lib/apiMethods.js CHANGED
@@ -77,9 +77,15 @@ module.exports = {
77
77
  "payins_intent_reverse_split": ["/V3.0/${clientId}/payins/intents/${intentId}/splits/${splitId}/reverse", "POST"],
78
78
  "payins_intent_get_split": ["/V3.0/${clientId}/payins/intents/${intentId}/splits/${splitId}", "GET"],
79
79
  "payins_intent_update_split": ["/V3.0/${clientId}/payins/intents/${intentId}/splits/${splitId}", "PUT"],
80
- "settlement_create": ["/V3.0/${clientId}/payins/intents/settlements", "POST"],
80
+ "payins_intent_create_refund": ["/V3.0/${clientId}/payins/intents/${intentId}/refunds", "POST"],
81
+ "payins_intent_reverse_refund": ["/V3.0/${clientId}/payins/intents/${intentId}/refunds/${refundId}/reverse", "POST"],
82
+ "payins_intent_create_dispute": ["/V3.0/${clientId}/payins/intents/${intentId}/captures/${captureId}/disputes", "POST"],
83
+ "payins_intent_update_dispute_outcome": ["/V3.0/${clientId}/payins/intents/${intentId}/captures/${captureId}/disputes/${disputeId}/decision", "PUT"],
84
+ "settlement_generate_upload_url": ["/V3.0/${clientId}/payins/intents/settlements", "POST"],
81
85
  "settlement_get": ["/V3.0/${clientId}/payins/intents/settlements/${id}", "GET"],
82
- "settlement_update": ["/V3.0/${clientId}/payins/intents/settlements/${id}", "PUT"],
86
+ "settlement_generate_new_upload_url": ["/V3.0/${clientId}/payins/intents/settlements/${id}", "PUT"],
87
+ "settlement_get_validations": ["/V3.0/${clientId}/payins/intents/settlements/${id}/validations", "GET"],
88
+ "settlement_cancel": ["/V3.0/${clientId}/payins/intents/settlements/${id}/cancel", "POST"],
83
89
 
84
90
  "add_tracking_info": ["/${apiVersion}/${clientId}/payins/${payInId}/trackings", "PUT"],
85
91
 
@@ -135,12 +141,12 @@ module.exports = {
135
141
  "users_manage_consent": ["/${apiVersion}/${clientId}/sca/users/${id}/consent", "POST"],
136
142
  "users_close_natural": ["/${apiVersion}/${clientId}/users/natural/${id}", "DELETE"],
137
143
  "users_close_legal": ["/${apiVersion}/${clientId}/users/legal/${id}", "DELETE"],
138
-
139
144
  "users_getemoney_year": ["/${apiVersion}/${clientId}/users/${id}/emoney/${year}/", "GET"],
140
145
  "users_getemoney_month": ["/${apiVersion}/${clientId}/users/${id}/emoney/${year}/${month}/", "GET"],
141
146
  "users_block_status": ["/${apiVersion}/${clientId}/users/${id}/blockStatus", "GET"],
142
147
  "users_regulatory": ["/${apiVersion}/${clientId}/users/${id}/Regulatory", "GET"],
143
148
  "users_validate_data_format": ["/${apiVersion}/${clientId}/users/data-formats/validation", "POST"],
149
+ "users_get_sca_status": ["/${apiVersion}/${clientId}/sca/users/${id}/sca-status", "GET"],
144
150
 
145
151
  "wallets_create": ["/${apiVersion}/${clientId}/wallets", "POST"],
146
152
  "wallets_alltransactions": ["/${apiVersion}/${clientId}/wallets/${id}/transactions", "GET"],
@@ -12,9 +12,13 @@ module.exports = EntityBase.extend({
12
12
  Buyer: null,
13
13
  LineItems: null,
14
14
  Captures: null,
15
+ Capture: null,
15
16
  Refunds: null,
17
+ Refund: null,
16
18
  Disputes: null,
19
+ Dispute: null,
17
20
  Splits: null,
18
- SettlementId: null
21
+ SettlementId: null,
22
+ UnfundedAmount: null
19
23
  }
20
24
  });
@@ -9,6 +9,8 @@ module.exports = EntityBase.extend({
9
9
  FeesAmount: null,
10
10
  TransferDate: null,
11
11
  Description: null,
12
- Status: null
12
+ Status: null,
13
+ SplitOriginWalletId: null,
14
+ UnfundedSellerAmount: null
13
15
  }
14
16
  });
@@ -8,7 +8,8 @@ var PayInPaymentDetailsBankWire = PayInPaymentDetails.extend({
8
8
  DeclaredDebitedFunds: null,
9
9
  DeclaredFees: null,
10
10
  BankAccount: null,
11
- WireReference: null
11
+ WireReference: null,
12
+ RecipientId: null,
12
13
  },
13
14
 
14
15
  getSubObjects: function() {
@@ -0,0 +1,11 @@
1
+ var EntityBase = require('./EntityBase');
2
+
3
+ module.exports = EntityBase.extend({
4
+ defaults: {
5
+ UserStatus: null,
6
+ IsEnrolled: null,
7
+ LastEnrollmentDate: null,
8
+ LastConsentCollectionDate: null,
9
+ ConsentScope: null
10
+ }
11
+ });
@@ -9,7 +9,9 @@ var Settlement = EntityBase.extend({
9
9
  DeclaredIntentAmount: null,
10
10
  ExternalProcessorFeesAmount: null,
11
11
  ActualSettlementAmount: null,
12
- FundsMissingAmount: null
12
+ FundsMissingAmount: null,
13
+ FileName: null,
14
+ UploadUrl: null
13
15
  }
14
16
  });
15
17
 
@@ -0,0 +1,10 @@
1
+ var EntityBase = require('./EntityBase');
2
+
3
+ var SettlementValidation = EntityBase.extend({
4
+ defaults: {
5
+ FooterErrors: null,
6
+ LinesErrors: null,
7
+ }
8
+ });
9
+
10
+ module.exports = SettlementValidation;
@@ -0,0 +1,11 @@
1
+ var EntityBase = require('./EntityBase');
2
+
3
+ var SettlementValidationFooter = EntityBase.extend({
4
+ defaults: {
5
+ FooterName: null,
6
+ Code: null,
7
+ Description: null,
8
+ }
9
+ });
10
+
11
+ module.exports = SettlementValidationFooter;
@@ -0,0 +1,12 @@
1
+ var EntityBase = require('./EntityBase');
2
+
3
+ var SettlementValidationLine = EntityBase.extend({
4
+ defaults: {
5
+ ExternalProviderReference: null,
6
+ ExternalTransactionType: null,
7
+ Code: null,
8
+ Description: null,
9
+ }
10
+ });
11
+
12
+ module.exports = SettlementValidationLine;
@@ -645,6 +645,94 @@ var PayIns = Service.extend({
645
645
  return this._api.method('payins_paypal_data_collection_get', callback, options);
646
646
  },
647
647
 
648
+ /**
649
+ * Create a pay in intent refund
650
+ * @param intentId Intent identifier
651
+ * @param {Object} payInIntentRefund Refund to be created
652
+ * @param {Function} callback Callback function
653
+ * @param {Object} options Request options
654
+ * @return {Object} Request promise
655
+ */
656
+ createPayInIntentRefund: function (intentId, payInIntentRefund, callback, options) {
657
+ options = this._api._getOptions(callback, options, {
658
+ data: payInIntentRefund,
659
+ dataClass: PayInIntent,
660
+ path: {
661
+ intentId: intentId
662
+ }
663
+ });
664
+
665
+ return this._api.method('payins_intent_create_refund', callback, options);
666
+ },
667
+
668
+ /**
669
+ * Reverse a pay in intent refund
670
+ * @param intentId Intent identifier
671
+ * @param refundId Refund identifier
672
+ * @param {Object} payInIntentRefund Refund to be reversed
673
+ * @param {Function} callback Callback function
674
+ * @param {Object} options Request options
675
+ * @return {Object} Request promise
676
+ */
677
+ reversePayInIntentRefund: function (intentId, refundId, payInIntentRefund, callback, options) {
678
+ options = this._api._getOptions(callback, options, {
679
+ data: payInIntentRefund,
680
+ dataClass: PayInIntent,
681
+ path: {
682
+ intentId: intentId,
683
+ refundId: refundId
684
+ }
685
+ });
686
+
687
+ return this._api.method('payins_intent_reverse_refund', callback, options);
688
+ },
689
+
690
+ /**
691
+ * Create a PayInIntent Dispute
692
+ * @param intentId Intent identifier
693
+ * @param captureId Capture identifier
694
+ * @param {Object} payInIntentDispute Dispute to be created
695
+ * @param {Function} callback Callback function
696
+ * @param {Object} options Request options
697
+ * @return {Object} Request promise
698
+ */
699
+ createPayInIntentDispute: function (intentId, captureId, payInIntentDispute, callback, options) {
700
+ options = this._api._getOptions(callback, options, {
701
+ data: payInIntentDispute,
702
+ dataClass: PayInIntent,
703
+ path: {
704
+ intentId: intentId,
705
+ captureId: captureId
706
+ }
707
+ });
708
+
709
+ return this._api.method('payins_intent_create_dispute', callback, options);
710
+ },
711
+
712
+ /**
713
+ * Update PayInIntent Dispute outcome
714
+ * @param intentId Intent identifier
715
+ * @param captureId Capture identifier
716
+ * @param disputeId Dispute identifier
717
+ * @param {Object} payInIntentDisputeOutcome Object containing the 'Decision'
718
+ * @param {Function} callback Callback function
719
+ * @param {Object} options Request options
720
+ * @return {Object} Request promise
721
+ */
722
+ updatePayInIntentDisputeOutcome: function (intentId, captureId, disputeId, payInIntentDisputeOutcome, callback, options) {
723
+ options = this._api._getOptions(callback, options, {
724
+ data: payInIntentDisputeOutcome,
725
+ dataClass: PayInIntent,
726
+ path: {
727
+ intentId: intentId,
728
+ captureId: captureId,
729
+ disputeId: disputeId,
730
+ }
731
+ });
732
+
733
+ return this._api.method('payins_intent_update_dispute_outcome', callback, options);
734
+ },
735
+
648
736
  getPaymentKey: function(payIn) {
649
737
  if (payIn.PaymentType) {
650
738
  return payIn.PaymentType.toLowerCase().replaceAll('_', '');
@@ -4,33 +4,30 @@
4
4
 
5
5
  var Service = require('../service');
6
6
  var Settlement = require('../models/Settlement');
7
+ const SettlementValidation = require("../models/SettlementValidation");
7
8
 
8
9
  var Settlements = Service.extend({
9
10
  /**
10
- * Upload a settlement file
11
- * @param {Buffer} file The settlement file to be uploaded
12
- * @param {Function} callback Callback function
13
- * @param {Object} options Request options
14
- * @return {Object} Request promise
11
+ * Generate a pre-signed URL to which you can upload your Mangopay-format settlement file
12
+ *
13
+ * @param {Settlement} settlement The settlement file to be uploaded containing the 'FileName'
14
+ * (the name of your file, which can be anything you wish. The file extension must be .csv)
15
+ * @param {Function} callback Callback function
16
+ * @param {Object} options Request options
17
+ * @return {Object} Request promise
15
18
  */
16
- upload: function (file, callback, options) {
17
- if (file === undefined || !Buffer.isBuffer(file)) {
18
- throw new Error('The file needs to be a Buffer');
19
- }
20
-
19
+ generateUploadUrl: function (settlement, callback, options) {
21
20
  options = this._api._getOptions(callback, options, {
22
21
  dataClass: Settlement,
23
- data: {
24
- file: file,
25
- fileName: 'settlement_file.csv'
26
- }
22
+ data: settlement
27
23
  });
28
24
 
29
- return this._api.multipartFormMethod('settlement_create', callback, options);
25
+ return this._api.method('settlement_generate_upload_url', callback, options);
30
26
  },
31
27
 
32
28
  /**
33
- * Get a settlement
29
+ * Retrieve the settlement data generated from file upload
30
+ *
34
31
  * @param {string} settlementId Settlement Id
35
32
  * @param {Function} callback Callback function
36
33
  * @param {Object} options Request options
@@ -46,28 +43,61 @@ var Settlements = Service.extend({
46
43
  },
47
44
 
48
45
  /**
49
- * Update a settlement file
50
- * @param {string} settlementId Settlement identifier
51
- * @param {Buffer} file The settlement file to be updated
46
+ * Generate a new pre-signed URL to replace the file of an existing Settlement
47
+ *
48
+ * @param {string} settlementId Settlement identifier
49
+ * @param {Settlement} settlement The settlement file to be uploaded containing the 'FileName'
50
+ * (the name of your file, which can be anything you wish. The file extension must be .csv)
51
+ * @param {Function} callback Callback function
52
+ * @param {Object} options Request options
53
+ * @return {Object} Request promise
54
+ */
55
+ generateNewUploadUrl: function (settlementId, settlement, callback, options) {
56
+ options = this._api._getOptions(callback, options, {
57
+ dataClass: Settlement,
58
+ data: settlement,
59
+ path: {id: settlementId}
60
+ });
61
+
62
+ return this._api.method('settlement_generate_new_upload_url', callback, options);
63
+ },
64
+
65
+ /**
66
+ * Returns all the possible errors that might have occurred with a Settlement File
67
+ *
68
+ * @param {string} settlementId The settlement identifier
52
69
  * @param {Function} callback Callback function
53
70
  * @param {Object} options Request options
54
71
  * @return {Object} Request promise
55
72
  */
56
- update: function (settlementId, file, callback, options) {
57
- if (file === undefined || !Buffer.isBuffer(file)) {
58
- throw new Error('The file needs to be a Buffer');
73
+ getValidations: function(settlementId, callback, options) {
74
+ if (options && !options.hasOwnProperty('parameters')) {
75
+ Object.assign(options, {parameters: {...options}});
59
76
  }
60
77
 
78
+ options = this._api._getOptions(callback, options, {
79
+ dataClass: SettlementValidation,
80
+ path: {id: settlementId},
81
+ });
82
+
83
+ return this._api.method('settlement_get_validations', callback, options);
84
+ },
85
+
86
+ /**
87
+ * Cancel settlement
88
+ *
89
+ * @param {string} settlementId The settlement identifier
90
+ * @param {Function} callback Callback function
91
+ * @param {Object} options Request options
92
+ * @return {Object} Request promise
93
+ */
94
+ cancel: function (settlementId, callback, options) {
61
95
  options = this._api._getOptions(callback, options, {
62
96
  dataClass: Settlement,
63
- data: {
64
- file: file,
65
- fileName: 'settlement_file.csv'
66
- },
67
- path: {id: settlementId}
97
+ path: {id: settlementId},
68
98
  });
69
99
 
70
- return this._api.multipartFormMethod('settlement_update', callback, options);
100
+ return this._api.method('settlement_cancel', callback, options);
71
101
  },
72
102
  });
73
103
 
@@ -826,6 +826,25 @@ var Users = Service.extend({
826
826
 
827
827
  return this._api.method('users_validate_data_format', callback, options);
828
828
  },
829
+
830
+ /**
831
+ * Get SCA status
832
+ * @param {number} userId User identifier
833
+ * @param {Function} callback Callback function
834
+ * @param {Object} options Request options
835
+ * @return {Object} Request promise
836
+ */
837
+ getScaStatus: function(userId, callback, options) {
838
+ options = this._api._getOptions(callback,
839
+ options,
840
+ {
841
+ path: {
842
+ id: userId
843
+ }
844
+ });
845
+
846
+ return this._api.method('users_get_sca_status', callback, options);
847
+ }
829
848
  });
830
849
 
831
850
  module.exports = Users;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mangopay4-nodejs-sdk",
3
- "version": "1.64.0",
3
+ "version": "1.66.0",
4
4
  "types": "./typings/index.d.ts",
5
5
  "description": "Mangopay Node.js SDK",
6
6
  "repository": "https://github.com/Mangopay/mangopay2-nodejs-sdk.git",
package/test/helpers.js CHANGED
@@ -640,6 +640,62 @@ module.exports = {
640
640
  });
641
641
  },
642
642
 
643
+ getNewPayoutBankWireWithRecipientId: function(api, user, callback) {
644
+ var wallet = {
645
+ Owners: [user.Id],
646
+ Currency: 'EUR',
647
+ Description: 'WALLET IN EUR'
648
+ };
649
+
650
+ const createRecipient = {
651
+ DisplayName: "My EUR account",
652
+ PayoutMethodType: "LocalBankTransfer",
653
+ RecipientType: "Individual",
654
+ Currency: "EUR",
655
+ Country: "DE",
656
+ IndividualRecipient: {
657
+ FirstName: "John",
658
+ LastName: "Doe",
659
+ Address: {
660
+ AddressLine1: "10 Kingsway",
661
+ City: "London",
662
+ PostalCode: "WC2B 6LH",
663
+ Country: "DE"
664
+ }
665
+ },
666
+ LocalBankTransfer: {
667
+ EUR: {
668
+ IBAN: "DE75512108001245126199"
669
+ }
670
+ },
671
+ ScaContext: "USER_PRESENT"
672
+ };
673
+
674
+ api.Wallets.create(wallet).then(function(data){
675
+ api.Recipients.create(createRecipient, user.Id).then(function(data){
676
+ var payOut = {
677
+ DebitedWalletId: wallet.Id,
678
+ AuthorId: user.Id,
679
+ CreditedUserId: user.Id,
680
+ Tag: 'DefaultTag',
681
+ DebitedFunds: {
682
+ Amount: 10,
683
+ Currency: 'EUR'
684
+ },
685
+ Fees: {
686
+ Amount: 5,
687
+ Currency: 'EUR'
688
+ },
689
+ RecipientId: data.Id,
690
+ BankWireRef: 'User payment',
691
+ PaymentType: 'BANK_WIRE',
692
+ PayoutModeRequested: 'STANDARD'
693
+ };
694
+ api.PayOuts.create(payOut, callback);
695
+ });
696
+ });
697
+ },
698
+
643
699
  getNewPayInCardWeb: function(api, user, callback) {
644
700
  var wallet = {
645
701
  Owners: [user.Id],
@@ -1286,6 +1342,25 @@ module.exports = {
1286
1342
  },
1287
1343
 
1288
1344
  getNewQuote: function (api, callback) {
1345
+ var quoteBody = {
1346
+ DebitedFunds: {
1347
+ Amount: 100,
1348
+ Currency: 'EUR'
1349
+ },
1350
+ CreditedFunds: {
1351
+ Currency: 'GBP'
1352
+ },
1353
+ Duration: 300,
1354
+ Fees: {
1355
+ Currency: 'EUR',
1356
+ Type: 'FIXED',
1357
+ Value: 1
1358
+ }
1359
+ };
1360
+ api.Conversions.createQuote(quoteBody, callback);
1361
+ },
1362
+
1363
+ getNewQuoteWithoutFees: function (api, callback) {
1289
1364
  var quoteBody = {
1290
1365
  DebitedFunds: {
1291
1366
  Amount: 100,
@@ -1406,6 +1481,36 @@ module.exports = {
1406
1481
  });
1407
1482
  },
1408
1483
 
1484
+ getNewPayInIntentFullCapture: function (api, user, callback) {
1485
+ this.getNewPayInIntentAuthorization(api, user, function (data) {
1486
+ const toCreate = {
1487
+ "ExternalData" : {
1488
+ "ExternalProcessingDate" : 1727788165,
1489
+ "ExternalProviderReference" : Math.random().toString(),
1490
+ "ExternalMerchantReference" : "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
1491
+ "ExternalProviderName" : "Stripe",
1492
+ "ExternalProviderPaymentMethod" : "PAYPAL"
1493
+ }
1494
+ };
1495
+ api.PayIns.createPayInIntentFullCapture(data.Id, toCreate, callback);
1496
+ });
1497
+ },
1498
+
1499
+ getNewPayInIntentFullRefund: function(api ,user, callback) {
1500
+ this.getNewPayInIntentFullCapture(api, user, function(data) {
1501
+ const fullRefundDto = {
1502
+ "ExternalData" : {
1503
+ "ExternalProcessingDate" : 1727788165,
1504
+ "ExternalProviderReference" : Math.random().toString(),
1505
+ "ExternalMerchantReference" : "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
1506
+ "ExternalProviderName" : "Stripe",
1507
+ "ExternalProviderPaymentMethod" : "PAYPAL"
1508
+ }
1509
+ };
1510
+ api.PayIns.createPayInIntentRefund(data.Id, fullRefundDto, callback);
1511
+ });
1512
+ },
1513
+
1409
1514
  getNewPayInIntentSplit: function (api, intent, callback) {
1410
1515
  const fullCapture = {
1411
1516
  "ExternalData" : {
@@ -19,8 +19,10 @@ describe('Cards', function () {
19
19
  var getPreAuthorizations;
20
20
 
21
21
  before(function (done) {
22
- helpers.getNewPayInCardDirect(api, john, function (data) {
22
+ helpers.getNewPayInCardDirect(api, john, async function (data) {
23
23
  cardId = data.CardId;
24
+ const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
25
+ await delay(5000);
24
26
  api.Cards.getPreAuthorizations(cardId, function (data, response) {
25
27
  getPreAuthorizations = data;
26
28
  done();
@@ -28,6 +28,9 @@ describe('Conversions', function () {
28
28
  expect(quote.Id).not.to.be.null;
29
29
  expect(quote.ExpirationDate).not.to.be.null;
30
30
  expect(quote.Status).to.equal("ACTIVE");
31
+ expect(quote.MarginsResponse).not.to.be.null;
32
+ expect(quote.RequestedFees).not.to.be.null;
33
+ expect(quote.Fees.Amount).not.to.be.null;
31
34
  });
32
35
  });
33
36
 
@@ -129,6 +132,11 @@ describe('Conversions', function () {
129
132
  Currency: 'EUR',
130
133
  Amount: 79
131
134
  },
135
+ Fees: {
136
+ Currency: 'EUR',
137
+ Type: 'PERCENTAGE',
138
+ Value: 0.01
139
+ },
132
140
  Tag: 'Instant conversion test'
133
141
  };
134
142
  api.Conversions.createInstantConversion(instantConversion, function (data, response) {
@@ -145,6 +153,9 @@ describe('Conversions', function () {
145
153
  expect(instantConversion.DebitedFunds.Amount).not.to.be.null;
146
154
  expect(instantConversion.CreditedFunds.Amount).not.to.be.null;
147
155
  expect(instantConversion.Status).to.equal('SUCCEEDED');
156
+ expect(instantConversion.MarginsResponse).not.to.be.null;
157
+ expect(instantConversion.RequestedFees).not.to.be.null;
158
+ expect(instantConversion.Fees.Amount).not.to.be.null;
148
159
  });
149
160
  });
150
161
 
@@ -237,7 +248,7 @@ describe('Conversions', function () {
237
248
  describe('Create Client Wallets Quoted Conversion', function () {
238
249
  var created;
239
250
  before(function (done) {
240
- helpers.getNewQuote(api, function (data, response) {
251
+ helpers.getNewQuoteWithoutFees(api, function (data, response) {
241
252
  quote = data;
242
253
 
243
254
  var body = {