-
- {if showApplePay {
- if showApplePayLoader {
-
- } else {
-
+ React.useEffect1(() => {
+ if (
+ (isInvokeSDKFlow || paymentExperience == PaymentMethodsRecord.RedirectToURL) &&
+ isApplePayReady
+ ) {
+ setShowApplePay(_ => true)
+ }
+ None
+ }, [isApplePayReady])
+
+ let submitCallback = React.useCallback((ev: Window.event) => {
+ if !isWallet {
+ let json = ev.data->Js.Json.parseExn
+ let confirm = json->getDictFromJson->ConfirmType.itemToObjMapper
+ if confirm.doSubmit && areRequiredFieldsValid && !areRequiredFieldsEmpty {
+ options.readOnly
+ ? ()
+ : handlePostMessage([("applePayButtonClicked", true->Js.Json.boolean)])
+ } else if areRequiredFieldsEmpty {
+ postFailedSubmitResponse(
+ ~errortype="validation_error",
+ ~message=localeString.enterFieldsText,
+ )
+ } else if !areRequiredFieldsValid {
+ postFailedSubmitResponse(
+ ~errortype="validation_error",
+ ~message=localeString.enterValidDetailsText,
+ )
}
- } else {
- React.null
- }}
-
+ }
+ })
+ submitPaymentData(submitCallback)
+
+ {
+ isWallet
+ ?