Skip to content

Commit

Permalink
Merge branch 'main' into fix/spTestPayment
Browse files Browse the repository at this point in the history
  • Loading branch information
JeevaRamu0104 authored Nov 30, 2023
2 parents 920948b + 10bc54c commit 7ae63ef
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/screens/HyperSwitch/SDKPayment/SDKPaymentTypes.res
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ type paymentType = {
amount: int,
currency: string,
profile_id: string,
customer_id: string,
}
2 changes: 2 additions & 0 deletions src/screens/HyperSwitch/SDKPayment/SDKPaymentUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ let initialValueForForm: string => SDKPaymentTypes.paymentType = profileId => {
amount: 100,
currency: "United States-USD",
profile_id: profileId,
customer_id: "hyperswitch_sdk_demo_id",
}

let getTypedValueForPayment: Js.Json.t => SDKPaymentTypes.paymentType = values => {
Expand All @@ -11,6 +12,7 @@ let getTypedValueForPayment: Js.Json.t => SDKPaymentTypes.paymentType = values =
amount: dictOfValues->getInt("amount", 100),
currency: dictOfValues->getString("currency", "United States-USD"),
profile_id: dictOfValues->getString("profile_id", ""),
customer_id: dictOfValues->getString("customer_id", ""),
}
}

Expand Down
1 change: 1 addition & 0 deletions src/screens/HyperSwitch/SDKPayment/TestPayment.res
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ let make = (
->Js.Json.number,
),
("profile_id", initialValues.profile_id->Js.Json.string),
("customer_id", "hyperswitch_sdk_demo_id"->Js.Json.string),
])->Js.Json.object_
let response = await updateDetails(url, body, Post)
let clientSecret = response->getDictFromJsonObject->getOptionString("client_secret")
Expand Down
15 changes: 5 additions & 10 deletions src/screens/HyperSwitch/SDKPayment/WebSDK.res
Original file line number Diff line number Diff line change
Expand Up @@ -215,16 +215,11 @@ module CheckoutForm = {
->ignore
}
React.useEffect1(() => {
let id = Js.String2.split(clientSecret, "_secret_")[0]->Belt.Option.getWithDefault("")
switch Some(id) {
| None | Some("") => ()
| Some(id) =>
hyper.retrievePaymentIntent(id)
->then(_ => {
resolve()
})
->ignore
}
hyper.retrievePaymentIntent(clientSecret)
->then(_ => {
resolve()
})
->ignore

None
}, [hyper])
Expand Down

0 comments on commit 7ae63ef

Please sign in to comment.