diff --git a/src/orca-loader/Hyper.res b/src/orca-loader/Hyper.res index 59de6eb2f..7adabb05c 100644 --- a/src/orca-loader/Hyper.res +++ b/src/orca-loader/Hyper.res @@ -269,7 +269,7 @@ let make = (publishableKey, options: option, analyticsInfo: option { + let confirmPaymentWrapper = (payload, isOneClick, result, ~isSdkButton=false) => { let confirmTimestamp = Date.now() let confirmParams = payload @@ -328,7 +328,11 @@ let make = (publishableKey, options: option, analyticsInfo: optionJSON.Decode.bool->Option.getOr(false) && redirect === "always" { + + if ( + isSdkButton || + (val->JSON.Decode.bool->Option.getOr(false) && redirect === "always") + ) { Window.replace(returnUrl) } else if !(val->JSON.Decode.bool->Option.getOr(false)) { resolve1(json) @@ -370,11 +374,15 @@ let make = (publishableKey, options: option, analyticsInfo: option { + confirmPaymentWrapper(payload, false, true, ~isSdkButton=true) + } + let handleSdkConfirm = (event: Types.event) => { let json = event.data->anyTypeToJson let dict = json->getDictFromJson switch dict->Dict.get("handleSdkConfirm") { - | Some(payload) => confirmPayment(payload)->ignore + | Some(payload) => confirmPaymentViaSDKButton(payload)->ignore | None => () } }