From 1259e9322cb244db6eaea6f1a70ef2b2555d4aa2 Mon Sep 17 00:00:00 2001 From: Iulian Masar Date: Fri, 12 Jul 2024 16:15:11 +0300 Subject: [PATCH 1/2] added new params --- typings/models/card.d.ts | 1 + typings/models/cardPreauthorization.d.ts | 11 ++++++++++- typings/models/cardValidation.d.ts | 18 ++++++++++++++++++ typings/models/payIn.d.ts | 18 ++++++++++++++++++ typings/models/refund.d.ts | 10 ++++++++++ 5 files changed, 57 insertions(+), 1 deletion(-) diff --git a/typings/models/card.d.ts b/typings/models/card.d.ts index af6d2bb..b12da1d 100644 --- a/typings/models/card.d.ts +++ b/typings/models/card.d.ts @@ -82,6 +82,7 @@ export namespace card { interface UpdateCard { Id: string; Active?: false; + CardHolderName?: string; } interface CardInfoData { diff --git a/typings/models/cardPreauthorization.d.ts b/typings/models/cardPreauthorization.d.ts index 3f7181c..0162bb0 100644 --- a/typings/models/cardPreauthorization.d.ts +++ b/typings/models/cardPreauthorization.d.ts @@ -22,7 +22,7 @@ export namespace cardPreAuthorization { type PreAuthorizationStatus = "CREATED" | "SUCCEEDED" | "FAILED"; type CreateCardPreAuthorization = PickPartialRequired; + "Tag" | "Billing" | "SecureMode" | "Culture" | "StatementDescriptor" | "Shipping" | "PaymentCategory", "AuthorId" | "DebitedFunds" | "CardId" | "SecureModeReturnURL" | "IpAddress" | "BrowserInfo">; type UpdateCardPreAuthorization = PickPartialRequired Date: Fri, 12 Jul 2024 17:00:23 +0300 Subject: [PATCH 2/2] added new bancontact payin --- lib/apiMethods.js | 2 + lib/models/PayInPaymentDetailsBancontact.js | 13 +++ lib/models/PayInPaymentType.js | 1 + lib/models/index.js | 1 + lib/services/PayIns.js | 2 + test/helpers.js | 31 +++++++ test/services/PayIns.js | 40 +++++++++ typings/enums.d.ts | 1 + typings/models/payIn.d.ts | 90 +++++++++++++++++++++ typings/services/PayIns.d.ts | 4 +- typings/types.d.ts | 1 + 11 files changed, 185 insertions(+), 1 deletion(-) create mode 100644 lib/models/PayInPaymentDetailsBancontact.js diff --git a/lib/apiMethods.js b/lib/apiMethods.js index 8056bb8..d7aafcb 100644 --- a/lib/apiMethods.js +++ b/lib/apiMethods.js @@ -54,6 +54,8 @@ module.exports = { "payins_klarna-web_create": ["/${apiVersion}/${clientId}/payins/payment-methods/klarna", "POST"], "payins_ideal-web_create": ["/${apiVersion}/${clientId}/payins/payment-methods/ideal", "POST"], "payins_giropay-web_create": ["/${apiVersion}/${clientId}/payins/payment-methods/giropay", "POST"], + "payins_bcmc-web_create": ["/${apiVersion}/${clientId}/payins/payment-methods/bancontact", "POST"], + "add_tracking_info": ["/${apiVersion}/${clientId}/payins/${payInId}/trackings", "PUT"], "payment_method_metadata_get": ["/${apiVersion}/${clientId}/payment-methods/metadata", "POST"], diff --git a/lib/models/PayInPaymentDetailsBancontact.js b/lib/models/PayInPaymentDetailsBancontact.js new file mode 100644 index 0000000..23c3e66 --- /dev/null +++ b/lib/models/PayInPaymentDetailsBancontact.js @@ -0,0 +1,13 @@ +var PayInPaymentDetails = require('./PayInPaymentDetails'); + +var PayInPaymentDetailsBancontact = PayInPaymentDetails.extend({ + defaults: { + /** + * Custom description to show on the user's bank statement. + * It can be up to 10 char alpha-numeric and space. + */ + StatementDescriptor: null + } +}); + +module.exports = PayInPaymentDetailsBancontact; diff --git a/lib/models/PayInPaymentType.js b/lib/models/PayInPaymentType.js index 90dce22..5554fa0 100644 --- a/lib/models/PayInPaymentType.js +++ b/lib/models/PayInPaymentType.js @@ -8,6 +8,7 @@ module.exports = { GooglePay: 'GOOGLE_PAY', Payconiq: 'PAYCONIQ', Mbway: 'MBWAY', + Bancontact: 'BCMC', Multibanco: 'MULTIBANCO', Satispay: 'SATISPAY', Blik: 'BLIK', diff --git a/lib/models/index.js b/lib/models/index.js index 835a54d..5519c67 100644 --- a/lib/models/index.js +++ b/lib/models/index.js @@ -57,6 +57,7 @@ module.exports = { PayInPaymentDetailsGooglePay: require('./PayInPaymentDetailsGooglePay'), PayInPaymentDetailsPayPal: require('./PayInPaymentDetailsPayPal'), PayInPaymentDetailsPreAuthorized: require('./PayInPaymentDetailsPreAuthorized'), + PayInPaymentDetailsBancontact: require('./PayInPaymentDetailsBancontact'), PayInPaymentType: require('./PayInPaymentType'), PayInRecurringRegistration: require('./PayInRecurringRegistration'), PayInTemplateURLOptions: require('./PayInTemplateURLOptions'), diff --git a/lib/services/PayIns.js b/lib/services/PayIns.js index fbbfe66..5d54e9c 100644 --- a/lib/services/PayIns.js +++ b/lib/services/PayIns.js @@ -20,6 +20,7 @@ var PayInExecutionDetailsBankingAlias = require('../models/PayInExecutionDetails var PayInPaymentDetailsApplePay = require('../models/PayInPaymentDetailsApplePay'); var PayInPaymentDetailsGooglePay = require('../models/PayInPaymentDetailsGooglePay'); var PayInPaymentDetailsMbway = require('../models/PayInPaymentDetailsMbway'); +var PayInPaymentDetailsBancontact = require('../models/PayInPaymentDetailsBancontact'); var Refund = require('../models/Refund'); var PayInRecurringRegistration = require('../models/PayInRecurringRegistration'); var PayInPaymentDetailsPayconiq = require('../models/PayInPaymentDetailsPayconiq'); @@ -292,6 +293,7 @@ var PayIns = Service.extend({ if (payIn.PaymentDetails instanceof PayInPaymentDetailsGooglePay) return 'googlepay'; if (payIn.PaymentDetails instanceof PayInPaymentDetailsPayconiq) return 'payconiq'; if (payIn.PaymentDetails instanceof PayInPaymentDetailsMbway) return 'mbway'; + if (payIn.PaymentDetails instanceof PayInPaymentDetailsBancontact) return 'bcmc'; if (payIn.PaymentDetails instanceof PayInPaymentDetailsMultibanco) return 'multibanco'; if (payIn.PaymentDetails instanceof PayInPaymentDetailsSatispay) return 'satispay'; if (payIn.PaymentDetails instanceof PayInPaymentDetailsBlik) return 'blik'; diff --git a/test/helpers.js b/test/helpers.js index 2a0a3ac..5002a6c 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -338,6 +338,37 @@ module.exports = { }); }, + getNewPayInBancontactWeb: function(api, user, callback) { + var wallet = { + Owners: [user.Id], + Currency: 'EUR', + Description: 'WALLET IN EUR' + }; + + api.Wallets.create(wallet).then(function(){ + var payIn = { + AuthorId: user.Id, + CreditedWalletId: wallet.Id, + DebitedFunds: { + Amount: 500, + Currency: 'EUR' + }, + Fees: { + Amount: 0, + Currency: 'EUR' + }, + ReturnURL: "http://mangopay.com", + PaymentType: 'BCMC', + ExecutionType: 'WEB', + Culture: 'FR', + StatementDescriptor: "test", + Recurring: true, + Tag: "test tag" + }; + api.PayIns.create(payIn, callback); + }); + }, + getNewPayInPayPalWeb: function(api, user, callback) { var wallet = { Owners: [user.Id], diff --git a/test/services/PayIns.js b/test/services/PayIns.js index 76a9a05..59bd5af 100644 --- a/test/services/PayIns.js +++ b/test/services/PayIns.js @@ -1088,6 +1088,46 @@ describe('PayIns', function () { }); }); + describe('Bancontact Web', function () { + var payIn; + + before(function (done) { + helpers.getNewPayInBancontactWeb(api, john, function (data, response) { + payIn = data; + done(); + }); + }); + + describe('Create', function () { + it('should create the PayIn', function () { + expect(payIn.Id).not.to.be.undefined; + expect(payIn.PaymentType).to.equal('BCMC'); + expect(payIn.ExecutionType).to.equal('WEB'); + expect(payIn.AuthorId).to.equal(john.Id); + expect(payIn.Status).to.equal('CREATED'); + expect(payIn.Type).to.equal('PAYIN'); + expect(payIn.Recurring).not.to.be.null; + }); + }); + + describe('Get', function () { + var getPayIn; + before(function (done) { + api.PayIns.get(payIn.Id, function (data, response) { + getPayIn = data; + done() + }); + }); + + it('should get the PayIn', function () { + expect(getPayIn.Id).to.equal(payIn.Id); + expect(getPayIn.PaymentType).to.equal('BCMC'); + expect(getPayIn.ExecutionType).to.equal('WEB'); + expect(getPayIn.Phone).not.to.be.null; + }); + }); + }); + describe('PayPal Web V2', function () { var payIn; diff --git a/typings/enums.d.ts b/typings/enums.d.ts index 5c981f0..aafcfb4 100644 --- a/typings/enums.d.ts +++ b/typings/enums.d.ts @@ -19,6 +19,7 @@ export namespace enums { Klarna: "KLARNA"; Ideal: "IDEAL"; Giropay: "GIROPAY"; + Bancontact: "BCMC"; } interface IMandateStatus { diff --git a/typings/models/payIn.d.ts b/typings/models/payIn.d.ts index e18e1f2..b841236 100644 --- a/typings/models/payIn.d.ts +++ b/typings/models/payIn.d.ts @@ -30,6 +30,7 @@ export namespace payIn { | PayconiqWebPayInData | DirectDebitDirectPayInData | MbwayWebPayInData + | BancontactWebPayInData | MultibancoWebPayInData | SatispayWebPayInData | BlikWebPayInData @@ -345,6 +346,43 @@ export namespace payIn { Phone: string; } + interface BancontactWebPayInData extends BasePayInData { + ExecutionType: "WEB"; + + PaymentType: "BCMC"; + + /** + * The URL to which the user is redirected to complete the payment + */ + RedirectURL: string; + + /** + * The URL where users are automatically redirected after the payment is validated + */ + ReturnURL: string; + + /** + * The URL where you should redirect your client in a mobile app experience + */ + DeepLinkURL: string; + + /** + * A custom description to appear on the user's bank statement. It can be up to 10 characters long, and can only include alphanumeric + * characters or spaces. See here for important info. Note that each bank handles this information differently, some show less or no information. + */ + StatementDescriptor: string; + + /** + * The language to use for the payment page - needs to be the ISO code of the language + */ + Culture: CountryISO; + + /** + * Whether the Bancontact pay-ins are being made to be re-used in a recurring payment flow + */ + Recurring: boolean; + } + interface PayPalWebPayInData extends BasePayInData { ExecutionType: "WEB"; @@ -609,6 +647,58 @@ export namespace payIn { Tag?: string; } + interface CreateBancontactWebPayIn { + ExecutionType: "WEB"; + + PaymentType: "BCMC"; + + /** + * A user's ID + */ + AuthorId: string; + + /** + * The ID of the wallet where money will be credited + */ + CreditedWalletId: string; + + /** + * Information about the funds that are being debited + */ + DebitedFunds: MoneyData; + + /** + * Information about the fees that were taken by the client for this transaction (and were hence transferred to the Client's platform wallet) + */ + Fees: MoneyData; + + /** + * The URL where users are automatically redirected after the payment is validated + */ + ReturnURL: string; + + /** + * The language to use for the payment page - needs to be the ISO code of the language + */ + Culture?: CountryISO; + + /** + * Whether the Bancontact pay-ins are being made to be re-used in a recurring payment flow + */ + Recurring?: boolean; + + /** + * A custom description to appear on the user's bank statement. It can be up to 10 characters long, and can only include alphanumeric characters or spaces. + * See here for important info. Note that each bank handles this information differently, some show less or no information. + */ + StatementDescriptor?: string; + + /** + * Custom data that you can add to this item + */ + Tag?: string; + } + interface CreatePayPalWebPayIn { ExecutionType: "WEB"; diff --git a/typings/services/PayIns.d.ts b/typings/services/PayIns.d.ts index 03d476d..cf89a9a 100644 --- a/typings/services/PayIns.d.ts +++ b/typings/services/PayIns.d.ts @@ -25,7 +25,9 @@ export class PayIns { MethodOverload & MethodOverload & MethodOverload & - MethodOverload; + MethodOverload & + MethodOverload; + /** * Get pay-in diff --git a/typings/types.d.ts b/typings/types.d.ts index 9af96b0..8b199a6 100644 --- a/typings/types.d.ts +++ b/typings/types.d.ts @@ -160,6 +160,7 @@ export type ApiMethod = | "transactions_get_for_bank_account" | "idempotency_response_get" | "payins_mbway-web_create" + | "payins_bcmc-web_create" | "payins_paypal-web_create_v2" | "payins_multibanco-web_create" | "payins_satispay-web_create"