diff --git a/lib/models/PayInPaymentDetailsCardWeb.js b/lib/models/PayInPaymentDetailsCardWeb.js index be083d0..c3a3540 100644 --- a/lib/models/PayInPaymentDetailsCardWeb.js +++ b/lib/models/PayInPaymentDetailsCardWeb.js @@ -11,7 +11,17 @@ var PayInPaymentDetailsCardWeb = PayInPaymentDetailsCard.extend({ /* * Shipping */ - Shipping: null + Shipping: null, + + /** + * The BIC identifier of the end-user’s bank + */ + Bic: null, + + /** + * Name of the end-user’s bank + */ + BankName: null, }) }); diff --git a/test/helpers.js b/test/helpers.js index 3b1b5a0..159fe7e 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -954,5 +954,41 @@ module.exports = { }; api.PayIns.create(payIn, callback); }); - } + }, + + getLegacyPayInIdealCardWeb: function(api, user, callback) { + var wallet = { + Owners: [user.Id], + Currency: 'EUR', + Description: 'WALLET IN EUR' + }; + + api.Wallets.create(wallet).then(function(){ + var payIn = new api.models.PayIn({ + CreditedWalletId: wallet.Id, + AuthorId: user.Id, + DebitedFunds: new api.models.Money({ + Amount: 1000, + Currency: 'EUR' + }), + Fees: new api.models.Money({ + Amount: 0, + Currency: 'EUR' + }), + PaymentType: 'CARD', + PaymentDetails: new api.models.PayInPaymentDetailsCard({ + CardType: 'IDEAL', + Bic: 'REVOLT21' + }), + ExecutionType: 'WEB', + ExecutionDetails: new api.models.PayInPaymentDetailsCard({ + ReturnURL: 'https://test.com', + TemplateURL: 'https://TemplateURL.com', + SecureMode: 'DEFAULT', + Culture: 'fr' + }) + }); + api.PayIns.create(payIn, callback); + }); + }, }; diff --git a/test/services/PayIns.js b/test/services/PayIns.js index 4341edb..0b043e4 100644 --- a/test/services/PayIns.js +++ b/test/services/PayIns.js @@ -1259,6 +1259,30 @@ describe('PayIns', function () { }); }); + describe('Ideal Legacy Web', function () { + var payIn; + + before(function (done) { + helpers.getLegacyPayInIdealCardWeb(api, john, function (data) { + payIn = data; + done(); + }); + }); + + describe('Create', function () { + it('should create the legacy PayIn', function () { + expect(payIn.Id).not.to.be.undefined; + expect(payIn.BankName).not.to.be.null; + expect(payIn.CardType).to.equal('IDEAL'); + expect(payIn.PaymentType).to.equal('CARD'); + expect(payIn.ExecutionType).to.equal('WEB'); + expect(payIn.AuthorId).to.equal(john.Id); + expect(payIn.Type).to.equal('PAYIN'); + expect(payIn.Phone).not.to.be.null; + }); + }); + }); + // skip because we cannot generate new paymentData in the tests describe.skip('GooglePay V2', function () { var googlePayIn, wallet; diff --git a/typings/mangopay2-nodejs-sdk-tests.ts b/typings/mangopay2-nodejs-sdk-tests.ts index a8d6b1f..3644800 100644 --- a/typings/mangopay2-nodejs-sdk-tests.ts +++ b/typings/mangopay2-nodejs-sdk-tests.ts @@ -703,6 +703,21 @@ api.PayIns.create({ const d = data; // $ExpectType GiropayWebPayInData }); +api.PayIns.create({ + PaymentType: "CARD", + ExecutionType: "WEB", + AuthorId: "user-id", + CreditedWalletId: "wallet-id", + Fees: {Amount: 100, Currency: "GBP"}, + DebitedFunds: {Amount: 2000, Currency: "GBP"}, + ReturnURL: "https://secure-return.co", + Culture: "FR", + Bic: "RBRBNL21", + CardType: "IDEAL" +}).then(data => { + const d = data; // $ExpectType CardWebPayInData +}); + api.PayIns.create({ PaymentType: "CARD", ExecutionType: "WEB", diff --git a/typings/models/payIn.d.ts b/typings/models/payIn.d.ts index 22dafdb..197f6b6 100644 --- a/typings/models/payIn.d.ts +++ b/typings/models/payIn.d.ts @@ -177,6 +177,11 @@ export namespace payIn { * The URL to redirect to user to for them to proceed with the payment */ RedirectURL: string; + + /** + * Name of the end-user’s bank + */ + BankName: string; } interface CreateCardWebPayIn { @@ -252,6 +257,11 @@ export namespace payIn { * Contains every useful information's related to the user shipping */ Shipping?: ShippingData; + + /** + * The BIC identifier of the end-user’s bank + */ + Bic?: string; } interface CardDirectPayInData extends BasePayInData {