From 7d025aa201474f2e239db7361772321183454020 Mon Sep 17 00:00:00 2001 From: Arush Date: Tue, 2 Jul 2024 14:35:11 +0530 Subject: [PATCH] fix: renamed Payment Management to Payment Methods Management --- src/CardUtils.res | 2 +- src/Payments/PreMountLoader.res | 2 +- src/RenderPaymentMethods.res | 2 +- src/Types/CardThemeType.res | 6 ++--- src/Utilities/Utils.res | 4 +++- src/orca-loader/Elements.res | 2 +- src/orca-loader/Hyper.res | 22 +++++++++---------- src/orca-loader/LoaderPaymentElement.res | 2 +- ...s => PaymentMethodsManagementElements.res} | 4 ++-- src/orca-loader/Types.res | 10 ++++----- 10 files changed, 29 insertions(+), 27 deletions(-) rename src/orca-loader/{PaymentManagementElements.res => PaymentMethodsManagementElements.res} (98%) diff --git a/src/CardUtils.res b/src/CardUtils.res index 7c2db4524..017b1cfdd 100644 --- a/src/CardUtils.res +++ b/src/CardUtils.res @@ -363,7 +363,7 @@ let getCardBrandIcon = (cardType, paymentType) => { | ApplePayElement | KlarnaElement | ExpressCheckoutElement - | PaymentManagement + | PaymentMethodsManagement | NONE => } diff --git a/src/Payments/PreMountLoader.res b/src/Payments/PreMountLoader.res index 432fe2962..305ebb686 100644 --- a/src/Payments/PreMountLoader.res +++ b/src/Payments/PreMountLoader.res @@ -69,7 +69,7 @@ let make = ( } let savedPaymentMethodsResponse = switch hyperComponentName { - | PaymentManagementElements => + | PaymentMethodsManagementElements => PaymentHelpers.fetchSavedPaymentMethodList( ~ephemeralKey, ~optLogger=Some(logger), diff --git a/src/RenderPaymentMethods.res b/src/RenderPaymentMethods.res index f73f0cd8f..d02c2bbfe 100644 --- a/src/RenderPaymentMethods.res +++ b/src/RenderPaymentMethods.res @@ -142,7 +142,7 @@ let make = ( id="card-cvc" isFocus /> - | PaymentManagement => + | PaymentMethodsManagement => diff --git a/src/Types/CardThemeType.res b/src/Types/CardThemeType.res index 2892bc298..ed526c19f 100644 --- a/src/Types/CardThemeType.res +++ b/src/Types/CardThemeType.res @@ -17,7 +17,7 @@ type mode = | ApplePayElement | KlarnaElement | ExpressCheckoutElement - | PaymentManagement + | PaymentMethodsManagement | NONE type label = Above | Floating | Never type themeClass = { @@ -106,7 +106,7 @@ let getPaymentMode = val => { | "paymentMethodCollect" => PaymentMethodCollectElement | "klarna" => KlarnaElement | "expressCheckout" => ExpressCheckoutElement - | "paymentManagement" => PaymentManagement + | "paymentMethodsManagement" => PaymentMethodsManagement | _ => NONE } } @@ -124,7 +124,7 @@ let getPaymentModeToStrMapper = val => { | PaymentMethodCollectElement => "PaymentMethodCollectElement" | KlarnaElement => "KlarnaElement" | ExpressCheckoutElement => "ExpressCheckoutElement" - | PaymentManagement => "PaymentManagement" + | PaymentMethodsManagement => "PaymentMethodsManagement" | NONE => "None" } } diff --git a/src/Utilities/Utils.res b/src/Utilities/Utils.res index b6f2d265c..4faddc3d9 100644 --- a/src/Utilities/Utils.res +++ b/src/Utilities/Utils.res @@ -1241,7 +1241,9 @@ let expressCheckoutComponents = ["googlePay", "payPal", "applePay", "klarna", "e let spmComponents = ["paymentMethodCollect"]->Array.concat(expressCheckoutComponents) let componentsForPaymentElementCreate = - ["payment", "paymentMethodCollect", "paymentManagement"]->Array.concat(expressCheckoutComponents) + ["payment", "paymentMethodCollect", "paymentMethodsManagement"]->Array.concat( + expressCheckoutComponents, + ) let getIsExpressCheckoutComponent = componentType => { expressCheckoutComponents->Array.includes(componentType) diff --git a/src/orca-loader/Elements.res b/src/orca-loader/Elements.res index c00d22ed4..b3ea3151c 100644 --- a/src/orca-loader/Elements.res +++ b/src/orca-loader/Elements.res @@ -264,7 +264,7 @@ let make = ( | "applePay" | "klarna" | "expressCheckout" - | "paymentManagement" + | "paymentMethodsManagement" | "payment" => () | str => manageErrorWarning(UNKNOWN_KEY, ~dynamicStr=`${str} type in create`, ~logger, ()) } diff --git a/src/orca-loader/Hyper.res b/src/orca-loader/Hyper.res index b31137742..1eca77a83 100644 --- a/src/orca-loader/Hyper.res +++ b/src/orca-loader/Hyper.res @@ -430,23 +430,23 @@ let make = (publishableKey, options: option, analyticsInfo: option { + let paymentMethodsManagementElements = paymentMethodsManagementElementsOptions => { open Promise - let paymentManagementElementsOptionsDict = - paymentManagementElementsOptions->JSON.Decode.object - paymentManagementElementsOptionsDict + let paymentMethodsManagementElementsOptionsDict = + paymentMethodsManagementElementsOptions->JSON.Decode.object + paymentMethodsManagementElementsOptionsDict ->Option.forEach(x => x->Dict.set("launchTime", Date.now()->JSON.Encode.float)) ->ignore let ephemeralKeyId = - paymentManagementElementsOptionsDict + paymentMethodsManagementElementsOptionsDict ->Option.flatMap(x => x->Dict.get("ephemeralKey")) ->Option.flatMap(JSON.Decode.string) ->Option.getOr("") - let paymentManagementElementsOptions = - paymentManagementElementsOptionsDict->Option.mapOr( - paymentManagementElementsOptions, + let paymentMethodsManagementElementsOptions = + paymentMethodsManagementElementsOptionsDict->Option.mapOr( + paymentMethodsManagementElementsOptions, JSON.Encode.object, ) ephemeralKey := ephemeralKeyId @@ -464,8 +464,8 @@ let make = (publishableKey, options: option, analyticsInfo: optionignore - PaymentManagementElements.make( - paymentManagementElementsOptions, + PaymentMethodsManagementElements.make( + paymentMethodsManagementElementsOptions, setIframeRef, ~sdkSessionId=sessionID, ~publishableKey, @@ -627,7 +627,7 @@ let make = (publishableKey, options: option, analyticsInfo: option { - let hyperComponentName = PaymentManagementElements + let hyperComponentName = PaymentMethodsManagementElements try { let iframeRef = [] let logger = logger->Option.getOr(OrcaLogger.defaultLoggerConfig) @@ -166,7 +166,7 @@ let make = ( : () let otherElements = componentType->isOtherElements switch componentType { - | "paymentManagement" => () + | "paymentMethodsManagement" => () | str => manageErrorWarning(UNKNOWN_KEY, ~dynamicStr=`${str} type in create`, ~logger, ()) } diff --git a/src/orca-loader/Types.res b/src/orca-loader/Types.res index 2b22ed3e9..6c5577d31 100644 --- a/src/orca-loader/Types.res +++ b/src/orca-loader/Types.res @@ -72,7 +72,7 @@ type hyperInstance = { widgets: JSON.t => element, paymentRequest: JSON.t => JSON.t, initPaymentSession: JSON.t => initPaymentSession, - paymentManagementElements: JSON.t => element, + paymentMethodsManagementElements: JSON.t => element, } let oneClickConfirmPaymentFn = (_, _) => { @@ -180,7 +180,7 @@ let defaultHyperInstance = { widgets: _ev => defaultElement, paymentRequest: _ev => JSON.Encode.null, initPaymentSession: _ev => defaultInitPaymentSession, - paymentManagementElements: _ev => defaultElement, + paymentMethodsManagementElements: _ev => defaultElement, } type eventType = @@ -217,19 +217,19 @@ type rec ele = { @send external appendChild: (Dom.element, ele) => unit = "appendChild" -type hyperComponentName = Elements | PaymentManagementElements +type hyperComponentName = Elements | PaymentMethodsManagementElements let getStrFromHyperComponentName = hyperComponentName => { switch hyperComponentName { | Elements => "Elements" - | PaymentManagementElements => "PaymentManagementElements" + | PaymentMethodsManagementElements => "PaymentMethodsManagementElements" } } let getHyperComponentNameFromStr = hyperComponentName => { switch hyperComponentName { | "Elements" => Elements - | "PaymentManagementElements" => PaymentManagementElements + | "PaymentMethodsManagementElements" => PaymentMethodsManagementElements | _ => Elements } }