-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into react-hooks-errors
- Loading branch information
Showing
25 changed files
with
2,055 additions
and
1,734 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,7 +57,6 @@ let make = ( | |
cvcProps | ||
paymentType | ||
list | ||
savedMethods | ||
setRequiredFieldsBody | ||
/> | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
open Utils | ||
|
||
@react.component | ||
let make = () => { | ||
let (openModal, setOpenModal) = React.useState(_ => false) | ||
let (loader, setloader) = React.useState(_ => true) | ||
|
||
let logger = Recoil.useRecoilValueFromAtom(RecoilAtoms.loggerAtom) | ||
|
||
React.useEffect0(() => { | ||
handlePostMessage([("iframeMountedCallback", true->JSON.Encode.bool)]) | ||
let handle = (ev: Window.event) => { | ||
let json = ev.data->JSON.parseExn | ||
let dict = json->Utils.getDictFromJson | ||
if dict->Dict.get("fullScreenIframeMounted")->Option.isSome { | ||
let metadata = dict->getJsonObjectFromDict("metadata") | ||
let metaDataDict = metadata->JSON.Decode.object->Option.getOr(Dict.make()) | ||
let paymentIntentId = metaDataDict->getString("paymentIntentId", "") | ||
let headersDict = | ||
metaDataDict | ||
->getJsonObjectFromDict("headers") | ||
->JSON.Decode.object | ||
->Option.getOr(Dict.make()) | ||
let threeDsAuthoriseUrl = | ||
metaDataDict | ||
->getJsonObjectFromDict("threeDSData") | ||
->JSON.Decode.object | ||
->Option.getOr(Dict.make()) | ||
->getString("three_ds_authorize_url", "") | ||
let headers = | ||
headersDict | ||
->Dict.toArray | ||
->Array.map(entries => { | ||
let (x, val) = entries | ||
(x, val->JSON.Decode.string->Option.getOr("")) | ||
}) | ||
|
||
let threeDsMethodComp = metaDataDict->getString("3dsMethodComp", "U") | ||
open Promise | ||
PaymentHelpers.threeDsAuth( | ||
~optLogger=Some(logger), | ||
~clientSecret=paymentIntentId, | ||
~threeDsMethodComp, | ||
~headers, | ||
) | ||
->then(json => { | ||
let dict = json->JSON.Decode.object->Option.getOr(Dict.make()) | ||
let creq = dict->getString("challenge_request", "") | ||
let transStatus = dict->getString("trans_status", "Y") | ||
let acsUrl = dict->getString("acs_url", "") | ||
|
||
let ele = Window.querySelector("#threeDsAuthDiv") | ||
|
||
switch ele->Nullable.toOption { | ||
| Some(elem) => | ||
if transStatus === "C" { | ||
setloader(_ => false) | ||
let form = elem->OrcaUtils.makeForm(acsUrl, "3dsChallenge") | ||
let input = Types.createElement("input") | ||
input.name = "creq" | ||
input.value = creq | ||
form.target = "threeDsAuthFrame" | ||
form.appendChild(input) | ||
form.submit() | ||
} else { | ||
let form1 = elem->OrcaUtils.makeForm(threeDsAuthoriseUrl, "3dsFrintionLess") | ||
form1.submit() | ||
} | ||
| None => () | ||
} | ||
resolve(json) | ||
}) | ||
->ignore | ||
} | ||
} | ||
Window.addEventListener("message", handle) | ||
Some(() => {Window.removeEventListener("message", handle)}) | ||
}) | ||
|
||
<Modal loader={loader} showClose=false openModal setOpenModal> | ||
<div className="backdrop-blur-xl"> | ||
<div id="threeDsAuthDiv" className="hidden" /> | ||
<iframe | ||
id="threeDsAuthFrame" | ||
name="threeDsAuthFrame" | ||
style={ReactDOMStyle.make(~minHeight="500px", ())} | ||
width="100%" | ||
/> | ||
</div> | ||
</Modal> | ||
} |
Oops, something went wrong.