Skip to content

Commit

Permalink
fix: fixed netcetra 3ds not opening and added fallback log
Browse files Browse the repository at this point in the history
  • Loading branch information
ArushKapoorJuspay committed Jul 3, 2024
1 parent 1bbc48c commit 52c14ff
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions src/ThreeDSMethod.res
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,21 @@ let make = () => {
stateMetadata->Utils.getDictFromJson->Dict.set("3dsMethodComp", "Y"->JSON.Encode.string)
let metadataDict = stateMetadata->JSON.Decode.object->Option.getOr(Dict.make())
let iframeId = metadataDict->getString("iframeId", "")
LoggerUtils.handleLogging(
~optLogger=Some(logger),
~eventName=THREE_DS_METHOD_RESULT,
~value="Y",
~paymentMethod="CARD",
(),
)
handlePostMessage([
("fullscreen", true->JSON.Encode.bool),
("param", `3dsAuth`->JSON.Encode.string),
("iframeId", iframeId->JSON.Encode.string),
("metadata", stateMetadata),
])
if iframeId->String.length > 0 {
LoggerUtils.handleLogging(
~optLogger=Some(logger),
~eventName=THREE_DS_METHOD_RESULT,
~value="Y",
~paymentMethod="CARD",
(),
)
handlePostMessage([
("fullscreen", true->JSON.Encode.bool),
("param", `3dsAuth`->JSON.Encode.string),
("iframeId", iframeId->JSON.Encode.string),
("metadata", stateMetadata),
])
}
}

observer.current = Some(
Expand All @@ -42,6 +44,17 @@ let make = () => {
| _ => ()
}

let handleOnLoad = _ => {
setTimeout(() => {
logger.setLogError(
~value="ThreeDS Method Opened for more than 20 seconds",
~eventName=THREE_DS_METHOD_RESULT,
~logType=DEBUG,
(),
)
}, 20000)->ignore
}

React.useEffect0(() => {
handlePostMessage([("iframeMountedCallback", true->JSON.Encode.bool)])
let handle = (ev: Window.event) => {
Expand Down Expand Up @@ -130,6 +143,7 @@ let make = () => {
name="threeDsInvisibleIframe"
className="h-96 invisible"
ref={divRef->ReactDOM.Ref.domRef}
onLoad={handleOnLoad}
/>
</>
}

0 comments on commit 52c14ff

Please sign in to comment.