Skip to content

Commit

Permalink
fix: apple pay debug
Browse files Browse the repository at this point in the history
  • Loading branch information
prafulkoppalkar committed Apr 25, 2024
1 parent f99edde commit 34d4828
Showing 1 changed file with 53 additions and 47 deletions.
100 changes: 53 additions & 47 deletions src/orca-loader/Elements.res
Original file line number Diff line number Diff line change
Expand Up @@ -636,57 +636,63 @@ let make = (
)

try {
let trustpay = trustPayApi(secrets)
Window.window->alert(
"trustpay: " ++ trustpay->anyTypeToJson->JSON.stringify,
)
trustpay.finishApplePaymentV2(payment, paymentRequest)
->then(res => {
setTimeout(() => {
let trustpay = trustPayApi(secrets)
Window.window->alert(
"res: " ++ res->anyTypeToJson->JSON.stringify,
"trustpay: " ++ trustpay->anyTypeToJson->JSON.stringify,
)
logger.setLogInfo(
~value="TrustPay ApplePay Success Response",
~internalMetadata=res->JSON.stringify,
~eventName=APPLE_PAY_FLOW,
~paymentMethod="APPLE_PAY",
(),
)
let msg =
[
("applePaySyncPayment", true->JSON.Encode.bool),
("breakpoint", "1"->JSON.Encode.string),
]->Dict.fromArray
mountedIframeRef->Window.iframePostMessage(msg)
logger.setLogInfo(
~value="",
~eventName=PAYMENT_DATA_FILLED,
~paymentMethod="APPLE_PAY",
(),
)
resolve()
})
->catch(err => {
let exceptionMessage =
err->Utils.formatException->JSON.stringify
Window.window->alert(
"err: " ++ err->anyTypeToJson->JSON.stringify,
trustpay.finishApplePaymentV2(payment, paymentRequest)
->then(
res => {
Window.window->alert(
"res: " ++ res->anyTypeToJson->JSON.stringify,
)
logger.setLogInfo(
~value="TrustPay ApplePay Success Response",
~internalMetadata=res->JSON.stringify,
~eventName=APPLE_PAY_FLOW,
~paymentMethod="APPLE_PAY",
(),
)
let msg =
[
("applePaySyncPayment", true->JSON.Encode.bool),
("breakpoint", "1"->JSON.Encode.string),
]->Dict.fromArray
mountedIframeRef->Window.iframePostMessage(msg)
logger.setLogInfo(
~value="",
~eventName=PAYMENT_DATA_FILLED,
~paymentMethod="APPLE_PAY",
(),
)
resolve()
},
)
logger.setLogInfo(
~eventName=APPLE_PAY_FLOW,
~paymentMethod="APPLE_PAY",
~value=exceptionMessage,
(),
->catch(
err => {
let exceptionMessage =
err->Utils.formatException->JSON.stringify
Window.window->alert(
"err: " ++ err->anyTypeToJson->JSON.stringify,
)
logger.setLogInfo(
~eventName=APPLE_PAY_FLOW,
~paymentMethod="APPLE_PAY",
~value=exceptionMessage,
(),
)
let msg =
[
("applePaySyncPayment", true->JSON.Encode.bool),
("breakpoint", "2"->JSON.Encode.string),
]->Dict.fromArray
mountedIframeRef->Window.iframePostMessage(msg)
resolve()
},
)
let msg =
[
("applePaySyncPayment", true->JSON.Encode.bool),
("breakpoint", "2"->JSON.Encode.string),
]->Dict.fromArray
mountedIframeRef->Window.iframePostMessage(msg)
resolve()
})
->ignore
->ignore
}, 0)->ignore
} catch {
| exn => {
logger.setLogInfo(
Expand Down

0 comments on commit 34d4828

Please sign in to comment.