From a2622b2ce5a7e2a5148cb73f43bdc7ff845e0649 Mon Sep 17 00:00:00 2001 From: Sanskar Atrey Date: Fri, 25 Oct 2024 12:32:56 +0530 Subject: [PATCH] refactor: applied suggestions --- src/CardUtils.res | 8 ++------ src/Payment.res | 7 +------ 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/CardUtils.res b/src/CardUtils.res index bcb9c8ea..9341d889 100644 --- a/src/CardUtils.res +++ b/src/CardUtils.res @@ -672,10 +672,6 @@ let getEligibleCoBadgedCardSchemes = (~matchedCardSchemes, ~enabledCardSchemes) }) } -let getCardBrandFromStates = (cardBrand, cardScheme, showFields, isNotBancontact) => { - switch (showFields, isNotBancontact) { - | (false, _) => cardScheme - | (_, true) => cardBrand - | _ => cardBrand - } +let getCardBrandFromStates = (cardBrand, cardScheme, showFields) => { + !showFields ? cardScheme : cardBrand } diff --git a/src/Payment.res b/src/Payment.res index 6b159e8b..f549921d 100644 --- a/src/Payment.res +++ b/src/Payment.res @@ -56,12 +56,7 @@ let make = (~paymentMode, ~integrateError, ~logger) => { !showFields && isNotBancontact ? cardScheme : cardBrand ) - let cardBrand = CardUtils.getCardBrandFromStates( - cardBrand, - cardScheme, - showFields, - isNotBancontact, - ) + let cardBrand = CardUtils.getCardBrandFromStates(cardBrand, cardScheme, showFields) let supportedCardBrands = React.useMemo(() => { paymentMethodListValue->PaymentUtils.getSupportedCardBrands }, [paymentMethodListValue])