From 937248f8ff3507cd9b6ccef3fe56769456f6ccbe Mon Sep 17 00:00:00 2001 From: Praful Koppalkar <126236898+prafulkoppalkar@users.noreply.github.com> Date: Wed, 24 Apr 2024 18:25:07 +0530 Subject: [PATCH 1/4] fix: priority array to include apple pay logs (#332) --- src/orca-log-catcher/OrcaLogger.res | 1 + 1 file changed, 1 insertion(+) diff --git a/src/orca-log-catcher/OrcaLogger.res b/src/orca-log-catcher/OrcaLogger.res index 8ec06c2f4..a9234adbe 100644 --- a/src/orca-log-catcher/OrcaLogger.res +++ b/src/orca-log-catcher/OrcaLogger.res @@ -509,6 +509,7 @@ let make = ( SESSIONS_CALL, RETRIEVE_CALL, DISPLAY_THREE_DS_SDK, + APPLE_PAY_FLOW, ] arrayOfLogs ->Array.find(log => { From 9d7e8eaf42f62930c6000686e9da55a80e6767df Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 24 Apr 2024 12:56:58 +0000 Subject: [PATCH 2/4] chore(release): 0.45.1 [skip ci] ## [0.45.1](https://github.com/juspay/hyperswitch-web/compare/v0.45.0...v0.45.1) (2024-04-24) ### Bug Fixes * priority array to include apple pay logs ([#332](https://github.com/juspay/hyperswitch-web/issues/332)) ([937248f](https://github.com/juspay/hyperswitch-web/commit/937248f8ff3507cd9b6ccef3fe56769456f6ccbe)) --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42c79f5b9..78c01f3b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.45.1](https://github.com/juspay/hyperswitch-web/compare/v0.45.0...v0.45.1) (2024-04-24) + + +### Bug Fixes + +* priority array to include apple pay logs ([#332](https://github.com/juspay/hyperswitch-web/issues/332)) ([937248f](https://github.com/juspay/hyperswitch-web/commit/937248f8ff3507cd9b6ccef3fe56769456f6ccbe)) + # [0.45.0](https://github.com/juspay/hyperswitch-web/compare/v0.44.1...v0.45.0) (2024-04-24) diff --git a/package-lock.json b/package-lock.json index 08ca1b2e3..198b7af94 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.45.0", + "version": "0.45.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.45.0", + "version": "0.45.1", "hasInstallScript": true, "dependencies": { "@aws-sdk/client-cloudfront": "^3.414.0", diff --git a/package.json b/package.json index 41a7e92e0..88b168e81 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.45.0", + "version": "0.45.1", "main": "index.js", "private": true, "dependencies": { From 1f754b6f4023709752ef892c0e2861d34aa4f2fe Mon Sep 17 00:00:00 2001 From: Vrishab Srivatsa Date: Wed, 24 Apr 2024 19:36:01 +0530 Subject: [PATCH 3/4] fix: added breakpoints to debug --- src/Payments/ApplePay.res | 3 ++- src/orca-loader/Elements.res | 49 ++++++++++++++++++++++++++++++++---- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/src/Payments/ApplePay.res b/src/Payments/ApplePay.res index a3a985a23..c10026aa5 100644 --- a/src/Payments/ApplePay.res +++ b/src/Payments/ApplePay.res @@ -309,7 +309,8 @@ let make = ( postFailedSubmitResponse(~errortype="server_error", ~message="Something went wrong") } } else if dict->Dict.get("applePaySyncPayment")->Option.isSome { - syncPayment() + () + // syncPayment(breakpoint) } } catch { | _ => Utils.logInfo(Console.log("Error in parsing Apple Pay Data")) diff --git a/src/orca-loader/Elements.res b/src/orca-loader/Elements.res index 37716fc43..6c206410c 100644 --- a/src/orca-loader/Elements.res +++ b/src/orca-loader/Elements.res @@ -4,6 +4,7 @@ open Identity open Utils open EventListenerManager open ApplePayTypes +@send external alert: ('t, string) => unit = "alert" type trustPayFunctions = { finishApplePaymentV2: (string, paymentRequestData) => Promise.t, @@ -462,7 +463,6 @@ let make = ( addSmartEventListener("message", handleApplePayMounted, "onApplePayMount") addSmartEventListener("message", handlePollStatusMessage, "onPollStatusMsg") addSmartEventListener("message", handleGooglePayThirdPartyFlow, "onGooglePayThirdParty") - Window.removeEventListener("message", handleApplePayMessages.contents) let fetchSessionTokens = mountedIframeRef => { let handleSessionTokensLoaded = (event: Types.event) => { @@ -536,6 +536,11 @@ let make = ( ->JSON.Decode.bool ->Belt.Option.getWithDefault(false) + Window.window->alert( + "isDelayedSessionToken: " ++ + isDelayedSessionToken->anyTypeToJson->JSON.stringify, + ) + if isDelayedSessionToken { logger.setLogInfo( ~value="Delayed Session Token Flow", @@ -544,19 +549,28 @@ let make = ( (), ) - let applePayPresent = + let applePaySessionTokenData = dict ->Dict.get("applePayPresent") ->Belt.Option.flatMap(JSON.Decode.object) ->Belt.Option.getWithDefault(Dict.make()) + Window.window->alert( + "applePaySessionTokenData: " ++ + applePaySessionTokenData->anyTypeToJson->JSON.stringify, + ) + let connector = - applePayPresent + applePaySessionTokenData ->Dict.get("connector") ->Belt.Option.getWithDefault(JSON.Encode.null) ->JSON.Decode.string ->Belt.Option.getWithDefault("") + Window.window->alert( + "connector: " ++ connector->anyTypeToJson->JSON.stringify, + ) + switch connector { | "trustpay" => logger.setLogInfo( @@ -566,7 +580,7 @@ let make = ( (), ) let secrets = - applePayPresent + applePaySessionTokenData ->Dict.get("session_token_data") ->Belt.Option.getWithDefault(JSON.Encode.null) ->JSON.Decode.object @@ -574,13 +588,22 @@ let make = ( ->Dict.get("secrets") ->Belt.Option.getWithDefault(JSON.Encode.null) + Window.window->alert( + "secrets: " ++ secrets->anyTypeToJson->JSON.stringify, + ) + let paymentRequest = - applePayPresent + applePaySessionTokenData ->Dict.get("payment_request_data") ->Belt.Option.flatMap(JSON.Decode.object) ->Belt.Option.getWithDefault(Dict.make()) ->ApplePayTypes.jsonToPaymentRequestDataType + Window.window->alert( + "paymentRequest: " ++ + paymentRequest->anyTypeToJson->JSON.stringify, + ) + let payment = secrets ->JSON.Decode.object @@ -590,10 +613,17 @@ let make = ( ->JSON.Decode.string ->Belt.Option.getWithDefault("") + Window.window->alert( + "payment: " ++ payment->anyTypeToJson->JSON.stringify, + ) + try { let trustpay = trustPayApi(secrets) 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, @@ -604,6 +634,7 @@ let make = ( let msg = [ ("applePaySyncPayment", true->JSON.Encode.bool), + ("breakpoint", "1"->JSON.Encode.string), ]->Dict.fromArray mountedIframeRef->Window.iframePostMessage(msg) logger.setLogInfo( @@ -617,6 +648,9 @@ let make = ( ->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", @@ -626,6 +660,7 @@ let make = ( let msg = [ ("applePaySyncPayment", true->JSON.Encode.bool), + ("breakpoint", "2"->JSON.Encode.string), ]->Dict.fromArray mountedIframeRef->Window.iframePostMessage(msg) resolve() @@ -639,9 +674,13 @@ let make = ( ~paymentMethod="APPLE_PAY", (), ) + Window.window->alert( + "exn: " ++ exn->Utils.formatException->JSON.stringify, + ) let msg = [ ("applePaySyncPayment", true->JSON.Encode.bool), + ("breakpoint", "3"->JSON.Encode.string), ]->Dict.fromArray mountedIframeRef->Window.iframePostMessage(msg) } From 4c3df2989c7fa93ef245301ac661a3e469c998b7 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 24 Apr 2024 14:10:42 +0000 Subject: [PATCH 4/4] chore(release): 0.45.2 [skip ci] ## [0.45.2](https://github.com/juspay/hyperswitch-web/compare/v0.45.1...v0.45.2) (2024-04-24) ### Bug Fixes * added breakpoints to debug ([1f754b6](https://github.com/juspay/hyperswitch-web/commit/1f754b6f4023709752ef892c0e2861d34aa4f2fe)) --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78c01f3b2..bd73e3637 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.45.2](https://github.com/juspay/hyperswitch-web/compare/v0.45.1...v0.45.2) (2024-04-24) + + +### Bug Fixes + +* added breakpoints to debug ([1f754b6](https://github.com/juspay/hyperswitch-web/commit/1f754b6f4023709752ef892c0e2861d34aa4f2fe)) + ## [0.45.1](https://github.com/juspay/hyperswitch-web/compare/v0.45.0...v0.45.1) (2024-04-24) diff --git a/package-lock.json b/package-lock.json index 198b7af94..bbb44dd3d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.45.1", + "version": "0.45.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.45.1", + "version": "0.45.2", "hasInstallScript": true, "dependencies": { "@aws-sdk/client-cloudfront": "^3.414.0", diff --git a/package.json b/package.json index 88b168e81..da65d966d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.45.1", + "version": "0.45.2", "main": "index.js", "private": true, "dependencies": {