Skip to content

Commit

Permalink
fix: renamed Payment Management to Payment Methods Management
Browse files Browse the repository at this point in the history
  • Loading branch information
ArushKapoorJuspay committed Jul 2, 2024
1 parent 8143552 commit 7d025aa
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/CardUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ let getCardBrandIcon = (cardType, paymentType) => {
| ApplePayElement
| KlarnaElement
| ExpressCheckoutElement
| PaymentManagement
| PaymentMethodsManagement
| NONE =>
<Icon size=brandIconSize name="default-card" />
}
Expand Down
2 changes: 1 addition & 1 deletion src/Payments/PreMountLoader.res
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ let make = (
}

let savedPaymentMethodsResponse = switch hyperComponentName {
| PaymentManagementElements =>
| PaymentMethodsManagementElements =>
PaymentHelpers.fetchSavedPaymentMethodList(
~ephemeralKey,
~optLogger=Some(logger),
Expand Down
2 changes: 1 addition & 1 deletion src/RenderPaymentMethods.res
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ let make = (
id="card-cvc"
isFocus
/>
| PaymentManagement =>
| PaymentMethodsManagement =>
<React.Suspense
fallback={<RenderIf condition={showLoader}>
<PaymentElementShimmer />
Expand Down
6 changes: 3 additions & 3 deletions src/Types/CardThemeType.res
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type mode =
| ApplePayElement
| KlarnaElement
| ExpressCheckoutElement
| PaymentManagement
| PaymentMethodsManagement
| NONE
type label = Above | Floating | Never
type themeClass = {
Expand Down Expand Up @@ -106,7 +106,7 @@ let getPaymentMode = val => {
| "paymentMethodCollect" => PaymentMethodCollectElement
| "klarna" => KlarnaElement
| "expressCheckout" => ExpressCheckoutElement
| "paymentManagement" => PaymentManagement
| "paymentMethodsManagement" => PaymentMethodsManagement
| _ => NONE
}
}
Expand All @@ -124,7 +124,7 @@ let getPaymentModeToStrMapper = val => {
| PaymentMethodCollectElement => "PaymentMethodCollectElement"
| KlarnaElement => "KlarnaElement"
| ExpressCheckoutElement => "ExpressCheckoutElement"
| PaymentManagement => "PaymentManagement"
| PaymentMethodsManagement => "PaymentMethodsManagement"
| NONE => "None"
}
}
4 changes: 3 additions & 1 deletion src/Utilities/Utils.res
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/orca-loader/Elements.res
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ let make = (
| "applePay"
| "klarna"
| "expressCheckout"
| "paymentManagement"
| "paymentMethodsManagement"
| "payment" => ()
| str => manageErrorWarning(UNKNOWN_KEY, ~dynamicStr=`${str} type in create`, ~logger, ())
}
Expand Down
22 changes: 11 additions & 11 deletions src/orca-loader/Hyper.res
Original file line number Diff line number Diff line change
Expand Up @@ -430,23 +430,23 @@ let make = (publishableKey, options: option<JSON.t>, analyticsInfo: option<JSON.
)
}

let paymentManagementElements = paymentManagementElementsOptions => {
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
Expand All @@ -464,8 +464,8 @@ let make = (publishableKey, options: option<JSON.t>, analyticsInfo: option<JSON.
})
->ignore

PaymentManagementElements.make(
paymentManagementElementsOptions,
PaymentMethodsManagementElements.make(
paymentMethodsManagementElementsOptions,
setIframeRef,
~sdkSessionId=sessionID,
~publishableKey,
Expand Down Expand Up @@ -627,7 +627,7 @@ let make = (publishableKey, options: option<JSON.t>, analyticsInfo: option<JSON.
retrievePaymentIntent: retrievePaymentIntentFn,
paymentRequest,
initPaymentSession,
paymentManagementElements,
paymentMethodsManagementElements,
}
Window.setHyper(Window.window, returnObject)
returnObject
Expand Down
2 changes: 1 addition & 1 deletion src/orca-loader/LoaderPaymentElement.res
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ let make = (
}

let (elementIframeWrapperDivId, elementIframeId) = if isPaymentManagementElement {
("management-element", "payment-management-element")
("management-element", "payment-methods-management-element")
} else {
("element", "payment-element")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let make = (
~analyticsMetadata,
~customBackendUrl,
) => {
let hyperComponentName = PaymentManagementElements
let hyperComponentName = PaymentMethodsManagementElements
try {
let iframeRef = []
let logger = logger->Option.getOr(OrcaLogger.defaultLoggerConfig)
Expand Down Expand Up @@ -166,7 +166,7 @@ let make = (
: ()
let otherElements = componentType->isOtherElements
switch componentType {
| "paymentManagement" => ()
| "paymentMethodsManagement" => ()
| str => manageErrorWarning(UNKNOWN_KEY, ~dynamicStr=`${str} type in create`, ~logger, ())
}

Expand Down
10 changes: 5 additions & 5 deletions src/orca-loader/Types.res
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (_, _) => {
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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
}
}

0 comments on commit 7d025aa

Please sign in to comment.