Skip to content

Commit

Permalink
fix(sdkHandleOneClickConfirmPayment): properly handling redirection f…
Browse files Browse the repository at this point in the history
…or one click payment methods (#192)

Co-authored-by: Praful Koppalkar <[email protected]>
  • Loading branch information
vsrivatsa-edinburgh and prafulkoppalkar authored Feb 28, 2024
1 parent d9bbab2 commit 0e70b4f
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/Utilities/PaymentHelpers.res
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ let intentCall = (
~fetchMethod,
~setIsManualRetryEnabled,
~switchToCustomPod,
~sdkHandleOneClickConfirmPayment,
) => {
open Promise
let isConfirm = uri->Js.String2.includes("/confirm")
Expand Down Expand Up @@ -335,11 +336,11 @@ let intentCall = (

handlePostMessage(message)
} else {
switch paymentType {
| Card
| Gpay
| Applepay
| Paypal =>
switch (paymentType, sdkHandleOneClickConfirmPayment) {
| (Card, _)
| (Gpay, false)
| (Applepay, false)
| (Paypal, false) =>
postSubmitResponse(~jsonData=data, ~url=url.href)
| _ => openUrl(url.href)
}
Expand All @@ -365,11 +366,11 @@ let intentCall = (
if intent.status === "failed" {
setIsManualRetryEnabled(. _ => intent.manualRetryAllowed)
}
switch paymentType {
| Card
| Gpay
| Applepay
| Paypal =>
switch (paymentType, sdkHandleOneClickConfirmPayment) {
| (Card, _)
| (Gpay, false)
| (Applepay, false)
| (Paypal, false) =>
postSubmitResponse(~jsonData=data, ~url=url.href)
| _ => openUrl(url.href)
}
Expand Down Expand Up @@ -438,6 +439,7 @@ let usePaymentSync = (optLogger: option<OrcaLogger.loggerMake>, paymentType: pay
~fetchMethod=Fetch.Get,
~setIsManualRetryEnabled,
~switchToCustomPod,
~sdkHandleOneClickConfirmPayment=keys.sdkHandleOneClickConfirmPayment,
)
}
switch list {
Expand Down Expand Up @@ -587,6 +589,7 @@ let usePaymentIntent = (optLogger: option<OrcaLogger.loggerMake>, paymentType: p
~fetchMethod,
~setIsManualRetryEnabled,
~switchToCustomPod,
~sdkHandleOneClickConfirmPayment=keys.sdkHandleOneClickConfirmPayment,
)
}
}
Expand Down

0 comments on commit 0e70b4f

Please sign in to comment.