diff --git a/src/Components/SavedMethodItem.res b/src/Components/SavedMethodItem.res index 1de1c3ede..287e712b1 100644 --- a/src/Components/SavedMethodItem.res +++ b/src/Components/SavedMethodItem.res @@ -9,10 +9,7 @@ let make = (~brandIcon, ~paymentItem: PaymentType.customerMethods, ~handleDelete let currentDate = Date.make() let pickerItemClass = "PickerItem--selected" let isCardExpired = isCard && expiryDate < currentDate - let paymentMethodType = switch paymentItem.paymentMethodType { - | Some(paymentMethodType) => paymentMethodType - | None => "debit" - } + let paymentMethodType = paymentItem.paymentMethodType->Option.getOr("debit")
brandIcon
- {isCard - ?
-
{React.string(paymentItem.card.nickname)}
-
-
{React.string(`****`)}
-
{React.string(paymentItem.card.last4Digits)}
-
+ {if isCard { +
+
{React.string(paymentItem.card.nickname)}
+
+
{React.string(`****`)}
+
{React.string(paymentItem.card.last4Digits)}
- :
{React.string(paymentMethodType->Utils.snakeToTitleCase)}
} +
+ } else { +
{React.string(paymentMethodType->Utils.snakeToTitleCase)}
+ }}
diff --git a/src/LoaderController.res b/src/LoaderController.res index eb9d8988b..4cb86c473 100644 --- a/src/LoaderController.res +++ b/src/LoaderController.res @@ -480,7 +480,6 @@ let make = (~children, ~paymentMode, ~setIntegrateErrorError, ~logger, ~initTime ~latency=finalLoadLatency, (), ) - | _ => () } diff --git a/src/PaymentManagement.res b/src/PaymentManagement.res index bebac1129..33ce12bfa 100644 --- a/src/PaymentManagement.res +++ b/src/PaymentManagement.res @@ -5,6 +5,7 @@ open RecoilAtoms let make = () => { let {savedPaymentMethods, displaySavedPaymentMethods} = Recoil.useRecoilValueFromAtom(optionAtom) let (savedMethods, setSavedMethods) = React.useState(_ => []) + let (isLoading, setIsLoading) = React.useState(_ => false) React.useEffect(() => { switch savedPaymentMethods { @@ -23,21 +24,20 @@ let make = () => { } setSavedMethods(_ => finalSavedPaymentMethods) + setIsLoading(_ => false) } - | LoadingSavedCards - | NoResult(_) => () + | LoadingSavedCards => setIsLoading(_ => true) + | NoResult(_) => setIsLoading(_ => false) } None }, (savedPaymentMethods, displaySavedPaymentMethods)) - let loading = false - <> - + - +
{"Loading..."->React.string}
diff --git a/src/orca-loader/PaymentSessionMethods.res b/src/orca-loader/PaymentSessionMethods.res index 097df06f3..e067c65e5 100644 --- a/src/orca-loader/PaymentSessionMethods.res +++ b/src/orca-loader/PaymentSessionMethods.res @@ -9,7 +9,6 @@ let getCustomerSavedPaymentMethods = ( ~logger, ~switchToCustomPod, ) => { - // open Promise open ApplePayTypes open GooglePayType let applePaySessionRef = ref(Nullable.null) @@ -479,17 +478,7 @@ let getPaymentManagementMethods = (~ephemeralKey, ~logger, ~switchToCustomPod, ~ }) ->catch(err => { let exceptionMessage = err->formatException->JSON.stringify - let updatedCustomerDetails = - [ - ( - "error", - [ - ("type", "server_error"->JSON.Encode.string), - ("message", exceptionMessage->JSON.Encode.string), - ]->getJsonFromArrayOfJson, - ), - ]->getJsonFromArrayOfJson - updatedCustomerDetails->resolve + handleFailureResponse(~message=exceptionMessage, ~errorType="server_error")->resolve }) } @@ -505,18 +494,7 @@ let getPaymentManagementMethods = (~ephemeralKey, ~logger, ~switchToCustomPod, ~ }) ->catch(err => { let exceptionMessage = err->formatException->JSON.stringify - let updatedCustomerDetails = - [ - ( - "error", - [ - ("type", "server_error"->JSON.Encode.string), - ("message", exceptionMessage->JSON.Encode.string), - ]->getJsonFromArrayOfJson, - ), - ]->getJsonFromArrayOfJson - - updatedCustomerDetails->resolve + handleFailureResponse(~message=exceptionMessage, ~errorType="server_error")->resolve }) }