From 08d6db82cceca3f536fc5131589dc5e63480d5de Mon Sep 17 00:00:00 2001 From: Arun Mishra <68141066+arun-mi@users.noreply.github.com> Date: Wed, 13 Dec 2023 12:56:47 +0530 Subject: [PATCH] fix: HS:132: card holder name passed as non-empty value (#70) Co-authored-by: arun.mishra --- src/Components/DynamicFields.res | 2 +- src/Utilities/PaymentBody.res | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Components/DynamicFields.res b/src/Components/DynamicFields.res index b034bbb1b..ee584ae28 100644 --- a/src/Components/DynamicFields.res +++ b/src/Components/DynamicFields.res @@ -402,7 +402,7 @@ let make = ( if !isAllStoredCardsHaveName { acc->Js.Dict.set( "payment_method_data.card_token.card_holder_name", - value->Js.Json.string, + value === "" ? Js.Json.null : value->Js.Json.string, ) } } else { diff --git a/src/Utilities/PaymentBody.res b/src/Utilities/PaymentBody.res index a4bec0423..2a873f0ac 100644 --- a/src/Utilities/PaymentBody.res +++ b/src/Utilities/PaymentBody.res @@ -11,7 +11,10 @@ let cardPaymentBody = (~cardNumber, ~month, ~year, ~cardHolderName, ~cvcNumber, ("card_number", cardNumber->CardUtils.clearSpaces->Js.Json.string), ("card_exp_month", month->Js.Json.string), ("card_exp_year", year->Js.Json.string), - ("card_holder_name", cardHolderName->Js.Json.string), + ( + "card_holder_name", + cardHolderName === "" ? Js.Json.null : cardHolderName->Js.Json.string, + ), ("card_cvc", cvcNumber->Js.Json.string), ("card_issuer", ""->Js.Json.string), ] @@ -40,7 +43,10 @@ let bancontactBody = (~cardNumber, ~month, ~year, ~cardHolderName) => [ ("card_number", cardNumber->CardUtils.clearSpaces->Js.Json.string), ("card_exp_month", month->Js.Json.string), ("card_exp_year", year->Js.Json.string), - ("card_holder_name", cardHolderName->Js.Json.string), + ( + "card_holder_name", + cardHolderName === "" ? Js.Json.null : cardHolderName->Js.Json.string, + ), ] ->Js.Dict.fromArray ->Js.Json.object_,