From e797149d2737232c1fd20c39a95413208a685a91 Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja Date: Wed, 24 Jul 2024 14:41:15 +0530 Subject: [PATCH 1/2] fix: customer acceptance issue for bank debits (#516) --- src/Payments/ACHBankDebit.res | 1 - src/Utilities/PaymentBody.res | 204 +++++++++++++++++----------------- 2 files changed, 103 insertions(+), 102 deletions(-) diff --git a/src/Payments/ACHBankDebit.res b/src/Payments/ACHBankDebit.res index a2bccc7f6..596936bfe 100644 --- a/src/Payments/ACHBankDebit.res +++ b/src/Payments/ACHBankDebit.res @@ -85,7 +85,6 @@ let make = (~paymentType: CardThemeType.mode) => { ~city=city.value, ~postalCode=postalCode.value, ~state=state.value, - ~paymentType=paymentMethodListValue.payment_type, ) intent( ~bodyArr=body, diff --git a/src/Utilities/PaymentBody.res b/src/Utilities/PaymentBody.res index bf5ce5217..46d53d3a9 100644 --- a/src/Utilities/PaymentBody.res +++ b/src/Utilities/PaymentBody.res @@ -168,6 +168,15 @@ let confirmPayloadForSDKButton = (sdkHandleConfirmPayment: PaymentType.sdkHandle ), ]->Utils.getJsonFromArrayOfJson +let bankDebitsCommonBody = paymentMethodType => { + [ + ("payment_method", "bank_debit"->JSON.Encode.string), + ("setup_future_usage", "off_session"->JSON.Encode.string), + ("payment_method_type", paymentMethodType->JSON.Encode.string), + ("customer_acceptance", customerAcceptanceBody), + ] +} + let achBankDebitBody = ( ~email, ~bank: ACHTypes.data, @@ -178,12 +187,8 @@ let achBankDebitBody = ( ~city, ~postalCode, ~state, - ~paymentType, ) => - [ - ("payment_method", "bank_debit"->JSON.Encode.string), - ("setup_future_usage", "off_session"->JSON.Encode.string), - ("payment_method_type", "ach"->JSON.Encode.string), + bankDebitsCommonBody("ach")->Array.concat([ ( "payment_method_data", [ @@ -213,7 +218,7 @@ let achBankDebitBody = ( ), ]->Utils.getJsonFromArrayOfJson, ), - ]->Array.concat(mandateBody(paymentType->PaymentMethodsRecord.paymentTypeToStringMapper)) + ]) let sepaBankDebitBody = ( ~fullName, @@ -225,37 +230,36 @@ let sepaBankDebitBody = ( ~city, ~postalCode, ~state, -) => [ - ("payment_method", "bank_debit"->JSON.Encode.string), - ("payment_method_type", "sepa"->JSON.Encode.string), - ( - "payment_method_data", - [ - ( - "bank_debit", - [ - ( - "sepa_bank_debit", - [ - billingDetailsTuple( - ~fullName, - ~email, - ~line1, - ~line2, - ~city, - ~state, - ~postalCode, - ~country, - ), - ("iban", data.iban->JSON.Encode.string), - ("bank_account_holder_name", data.accountHolderName->JSON.Encode.string), - ]->Utils.getJsonFromArrayOfJson, - ), - ]->Utils.getJsonFromArrayOfJson, - ), - ]->Utils.getJsonFromArrayOfJson, - ), -] +) => + bankDebitsCommonBody("sepa")->Array.concat([ + ( + "payment_method_data", + [ + ( + "bank_debit", + [ + ( + "sepa_bank_debit", + [ + billingDetailsTuple( + ~fullName, + ~email, + ~line1, + ~line2, + ~city, + ~state, + ~postalCode, + ~country, + ), + ("iban", data.iban->JSON.Encode.string), + ("bank_account_holder_name", data.accountHolderName->JSON.Encode.string), + ]->Utils.getJsonFromArrayOfJson, + ), + ]->Utils.getJsonFromArrayOfJson, + ), + ]->Utils.getJsonFromArrayOfJson, + ), + ]) let bacsBankDebitBody = ( ~email, @@ -268,38 +272,37 @@ let bacsBankDebitBody = ( ~state, ~country, ~bankAccountHolderName, -) => [ - ("payment_method", "bank_debit"->JSON.Encode.string), - ("payment_method_type", "bacs"->JSON.Encode.string), - ( - "payment_method_data", - [ - ( - "bank_debit", - [ - ( - "bacs_bank_debit", - [ - billingDetailsTuple( - ~fullName=bankAccountHolderName, - ~email, - ~line1, - ~line2, - ~city, - ~state, - ~postalCode=zip, - ~country, - ), - ("bank_account_holder_name", bankAccountHolderName->JSON.Encode.string), - ("sort_code", sortCode->JSON.Encode.string), - ("account_number", accNum->JSON.Encode.string), - ]->Utils.getJsonFromArrayOfJson, - ), - ]->Utils.getJsonFromArrayOfJson, - ), - ]->Utils.getJsonFromArrayOfJson, - ), -] +) => + bankDebitsCommonBody("bacs")->Array.concat([ + ( + "payment_method_data", + [ + ( + "bank_debit", + [ + ( + "bacs_bank_debit", + [ + billingDetailsTuple( + ~fullName=bankAccountHolderName, + ~email, + ~line1, + ~line2, + ~city, + ~state, + ~postalCode=zip, + ~country, + ), + ("bank_account_holder_name", bankAccountHolderName->JSON.Encode.string), + ("sort_code", sortCode->JSON.Encode.string), + ("account_number", accNum->JSON.Encode.string), + ]->Utils.getJsonFromArrayOfJson, + ), + ]->Utils.getJsonFromArrayOfJson, + ), + ]->Utils.getJsonFromArrayOfJson, + ), + ]) let becsBankDebitBody = ( ~fullName, @@ -311,38 +314,37 @@ let becsBankDebitBody = ( ~city, ~postalCode, ~state, -) => [ - ("payment_method", "bank_debit"->JSON.Encode.string), - ("payment_method_type", "becs"->JSON.Encode.string), - ( - "payment_method_data", - [ - ( - "bank_debit", - [ - ( - "becs_bank_debit", - [ - billingDetailsTuple( - ~fullName, - ~email, - ~line1, - ~line2, - ~city, - ~state, - ~postalCode, - ~country, - ), - ("bsb_number", data.sortCode->JSON.Encode.string), - ("account_number", data.accountNumber->JSON.Encode.string), - ("bank_account_holder_name", data.accountHolderName->JSON.Encode.string), - ]->Utils.getJsonFromArrayOfJson, - ), - ]->Utils.getJsonFromArrayOfJson, - ), - ]->Utils.getJsonFromArrayOfJson, - ), -] +) => + bankDebitsCommonBody("becs")->Array.concat([ + ( + "payment_method_data", + [ + ( + "bank_debit", + [ + ( + "becs_bank_debit", + [ + billingDetailsTuple( + ~fullName, + ~email, + ~line1, + ~line2, + ~city, + ~state, + ~postalCode, + ~country, + ), + ("bsb_number", data.sortCode->JSON.Encode.string), + ("account_number", data.accountNumber->JSON.Encode.string), + ("bank_account_holder_name", data.accountHolderName->JSON.Encode.string), + ]->Utils.getJsonFromArrayOfJson, + ), + ]->Utils.getJsonFromArrayOfJson, + ), + ]->Utils.getJsonFromArrayOfJson, + ), + ]) let klarnaRedirectionBody = (~fullName, ~email, ~country, ~connectors) => [ ("payment_method", "pay_later"->JSON.Encode.string), From 20f3de39dceb281127efba73ad1bfe45ea57a538 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 24 Jul 2024 09:12:35 +0000 Subject: [PATCH 2/2] chore(release): 0.77.2 [skip ci] ## [0.77.2](https://github.com/juspay/hyperswitch-web/compare/v0.77.1...v0.77.2) (2024-07-24) ### Bug Fixes * customer acceptance issue for bank debits ([#516](https://github.com/juspay/hyperswitch-web/issues/516)) ([e797149](https://github.com/juspay/hyperswitch-web/commit/e797149d2737232c1fd20c39a95413208a685a91)) --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9fbcf88d..8bdb4b007 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.77.2](https://github.com/juspay/hyperswitch-web/compare/v0.77.1...v0.77.2) (2024-07-24) + + +### Bug Fixes + +* customer acceptance issue for bank debits ([#516](https://github.com/juspay/hyperswitch-web/issues/516)) ([e797149](https://github.com/juspay/hyperswitch-web/commit/e797149d2737232c1fd20c39a95413208a685a91)) + ## [0.77.1](https://github.com/juspay/hyperswitch-web/compare/v0.77.0...v0.77.1) (2024-07-23) # [0.77.0](https://github.com/juspay/hyperswitch-web/compare/v0.76.2...v0.77.0) (2024-07-18) diff --git a/package-lock.json b/package-lock.json index aa8f03d81..bcf26ba32 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.77.1", + "version": "0.77.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.77.1", + "version": "0.77.2", "hasInstallScript": true, "dependencies": { "@aws-sdk/client-cloudfront": "^3.414.0", diff --git a/package.json b/package.json index 0cf3ae8f3..bb5fd335b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.77.1", + "version": "0.77.2", "main": "index.js", "private": true, "dependencies": {