Date: Wed, 17 Apr 2024 17:58:56 +0530
Subject: [PATCH 03/12] fix: customer_acceptance fix
---
src/Utilities/PaymentBody.res | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/Utilities/PaymentBody.res b/src/Utilities/PaymentBody.res
index 67cacc823..e98bdacf3 100644
--- a/src/Utilities/PaymentBody.res
+++ b/src/Utilities/PaymentBody.res
@@ -89,7 +89,6 @@ let savedCardBody = (
("payment_method", "card"->JSON.Encode.string),
("payment_token", paymentToken->JSON.Encode.string),
("customer_id", customerId->JSON.Encode.string),
- ("customer_acceptance", customerAcceptanceBody),
]
if requiresCvv {
From 3340cd9264f4660411e3e328e39783a0484bcdd0 Mon Sep 17 00:00:00 2001
From: Pritish Budhiraja <1805317@kiit.ac.in>
Date: Wed, 17 Apr 2024 19:26:30 +0530
Subject: [PATCH 04/12] fix: adding checks for business name and replacing with
merchant_name if business_name is ""
---
src/LoaderController.res | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/LoaderController.res b/src/LoaderController.res
index 60e1430a5..eb0fa9c4e 100644
--- a/src/LoaderController.res
+++ b/src/LoaderController.res
@@ -362,6 +362,15 @@ let make = (~children, ~paymentMode, ~setIntegrateErrorError, ~logger, ~initTime
}
if dict->getDictIsSome("paymentMethodList") {
let list = dict->getJsonObjectFromDict("paymentMethodList")
+ let listDict = list->getDictFromJson
+ if optionsPayment.business.name === "" {
+ setOptionsPayment(prev => {
+ ...prev,
+ business: {
+ name: listDict->getString("merchant_name", ""),
+ },
+ })
+ }
let finalLoadLatency = if launchTime <= 0.0 {
-1.0
} else {
@@ -370,11 +379,11 @@ let make = (~children, ~paymentMode, ~setIntegrateErrorError, ~logger, ~initTime
let updatedState: PaymentType.loadType =
list == Dict.make()->JSON.Encode.object
? LoadError(list)
- : switch list->getDictFromJson->Dict.get("error") {
+ : switch listDict->Dict.get("error") {
| Some(_) => LoadError(list)
| None =>
let isNonEmptyPaymentMethodList =
- list->getDictFromJson->getArray("payment_methods")->Array.length > 0
+ listDict->getArray("payment_methods")->Array.length > 0
isNonEmptyPaymentMethodList ? Loaded(list) : LoadError(list)
}
@@ -474,7 +483,7 @@ let make = (~children, ~paymentMode, ~setIntegrateErrorError, ~logger, ~initTime
}
}
handleMessage(handleFun, "Error in parsing sent Data")
- }, (showCardFormByDefault, paymentMethodOrder))
+ }, (showCardFormByDefault, paymentMethodOrder, optionsPayment.business.name))
let observer = ResizeObserver.newResizerObserver(entries => {
entries
From 88e8b6ed8b5ff5e28e2a2e33aacacdaf8e7eba70 Mon Sep 17 00:00:00 2001
From: Pritish Budhiraja <1805317@kiit.ac.in>
Date: Wed, 17 Apr 2024 19:31:09 +0530
Subject: [PATCH 05/12] fix: comments addressed
---
src/Components/SaveDetailsCheckbox.res | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/Components/SaveDetailsCheckbox.res b/src/Components/SaveDetailsCheckbox.res
index 703c58858..196337eff 100644
--- a/src/Components/SaveDetailsCheckbox.res
+++ b/src/Components/SaveDetailsCheckbox.res
@@ -50,10 +50,8 @@ let make = (~isChecked, ~setIsChecked, ~list: PaymentMethodsRecord.list) => {
let valueToBeRendered = if showFields {
localeString.saveCardDetails
- } else if business.name !== "" {
- localeString.cardTerms(business.name)
} else {
- localeString.cardTerms(list.merchant_name)
+ localeString.cardTerms(business.name)
}
From 134c99a4e14d8ccf860d4d9f9eeaddb3ab65bb02 Mon Sep 17 00:00:00 2001
From: Pritish Budhiraja <1805317@kiit.ac.in>
Date: Wed, 17 Apr 2024 19:32:03 +0530
Subject: [PATCH 06/12] fix: comments adddressed
---
src/Hooks/UtilityHooks.res | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Hooks/UtilityHooks.res b/src/Hooks/UtilityHooks.res
index 02380e144..feb416e0b 100644
--- a/src/Hooks/UtilityHooks.res
+++ b/src/Hooks/UtilityHooks.res
@@ -33,4 +33,4 @@ let useIsCustomerAcceptanceRequired = (
} else {
!(isGuestCustomer || list.payment_type === NORMAL)
}
- }, (isSaveCardsChecked, list.payment_type))
+ }, (isSaveCardsChecked, list.payment_type, isGuestCustomer, displaySavedPaymentMethodsCheckbox))
From ffcb073534b5234c0be4a59e6db2e18ac04e62f7 Mon Sep 17 00:00:00 2001
From: Pritish Budhiraja <1805317@kiit.ac.in>
Date: Wed, 17 Apr 2024 19:34:12 +0530
Subject: [PATCH 07/12] fix: addressed comments
---
src/LoaderController.res | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/LoaderController.res b/src/LoaderController.res
index eb0fa9c4e..e0b5a9aba 100644
--- a/src/LoaderController.res
+++ b/src/LoaderController.res
@@ -483,7 +483,7 @@ let make = (~children, ~paymentMode, ~setIntegrateErrorError, ~logger, ~initTime
}
}
handleMessage(handleFun, "Error in parsing sent Data")
- }, (showCardFormByDefault, paymentMethodOrder, optionsPayment.business.name))
+ }, (showCardFormByDefault, paymentMethodOrder, optionsPayment))
let observer = ResizeObserver.newResizerObserver(entries => {
entries
From bd6448b0030e887678c56cdc9cca47d9f935e112 Mon Sep 17 00:00:00 2001
From: Pritish Budhiraja <1805317@kiit.ac.in>
Date: Wed, 17 Apr 2024 19:36:16 +0530
Subject: [PATCH 08/12] fix: warnings removed
---
src/Components/SaveDetailsCheckbox.res | 2 +-
src/Components/SavedMethods.res | 2 +-
src/Payments/CardPayment.res | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/Components/SaveDetailsCheckbox.res b/src/Components/SaveDetailsCheckbox.res
index 196337eff..296e6f1d3 100644
--- a/src/Components/SaveDetailsCheckbox.res
+++ b/src/Components/SaveDetailsCheckbox.res
@@ -1,5 +1,5 @@
@react.component
-let make = (~isChecked, ~setIsChecked, ~list: PaymentMethodsRecord.list) => {
+let make = (~isChecked, ~setIsChecked) => {
let {themeObj} = Recoil.useRecoilValueFromAtom(RecoilAtoms.configAtom)
let showFields = Recoil.useRecoilValueFromAtom(RecoilAtoms.showCardFieldsAtom)
let {business} = Recoil.useRecoilValueFromAtom(RecoilAtoms.optionAtom)
diff --git a/src/Components/SavedMethods.res b/src/Components/SavedMethods.res
index e9742eea1..12c0729b4 100644
--- a/src/Components/SavedMethods.res
+++ b/src/Components/SavedMethods.res
@@ -205,7 +205,7 @@ let make = (
}}
-
+
diff --git a/src/Payments/CardPayment.res b/src/Payments/CardPayment.res
index ca1bdc39d..14aee6d5b 100644
--- a/src/Payments/CardPayment.res
+++ b/src/Payments/CardPayment.res
@@ -275,7 +275,7 @@ let make = (
From bf35640092cbfbc5cb9f38ebd7dda5c6facc2b34 Mon Sep 17 00:00:00 2001
From: Vrishab Srivatsa <136090360+vsrivatsa-juspay@users.noreply.github.com>
Date: Wed, 17 Apr 2024 19:39:06 +0530
Subject: [PATCH 09/12] fix: update saveCardCheckboxLabel
---
src/Components/SaveDetailsCheckbox.res | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Components/SaveDetailsCheckbox.res b/src/Components/SaveDetailsCheckbox.res
index 296e6f1d3..4901f2c52 100644
--- a/src/Components/SaveDetailsCheckbox.res
+++ b/src/Components/SaveDetailsCheckbox.res
@@ -48,7 +48,7 @@ let make = (~isChecked, ~setIsChecked) => {
? ("Checkbox--checked", "CheckboxInput--checked", "CheckboxLabel--checked")
: ("", "", "")
- let valueToBeRendered = if showFields {
+ let saveCardCheckboxLabel = if showFields {
localeString.saveCardDetails
} else {
localeString.cardTerms(business.name)
From 38053848194b09e1b93e1f856a40c01e27ac3f29 Mon Sep 17 00:00:00 2001
From: Vrishab Srivatsa <136090360+vsrivatsa-juspay@users.noreply.github.com>
Date: Wed, 17 Apr 2024 19:39:12 +0530
Subject: [PATCH 10/12] fix: update saveCardCheckboxLabel
---
src/Components/SaveDetailsCheckbox.res | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Components/SaveDetailsCheckbox.res b/src/Components/SaveDetailsCheckbox.res
index 4901f2c52..4ee425282 100644
--- a/src/Components/SaveDetailsCheckbox.res
+++ b/src/Components/SaveDetailsCheckbox.res
@@ -60,7 +60,7 @@ let make = (~isChecked, ~setIsChecked) => {
- {React.string(valueToBeRendered)}
+ {React.string(saveCardCheckboxLabel)}
From 715351549ecfa9f8b9b6b729829d1d606cf9e3ac Mon Sep 17 00:00:00 2001
From: Vrishab Srivatsa <136090360+vsrivatsa-juspay@users.noreply.github.com>
Date: Wed, 17 Apr 2024 19:40:23 +0530
Subject: [PATCH 11/12] fix: update checkboxLabelState class
---
src/Components/SaveDetailsCheckbox.res | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Components/SaveDetailsCheckbox.res b/src/Components/SaveDetailsCheckbox.res
index 4ee425282..4589eb14e 100644
--- a/src/Components/SaveDetailsCheckbox.res
+++ b/src/Components/SaveDetailsCheckbox.res
@@ -59,7 +59,7 @@ let make = (~isChecked, ~setIsChecked) => {