@spot-flow/checkout-inline-js 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -31498,7 +31498,9 @@ class jd {
|
|
|
31498
31498
|
return;
|
|
31499
31499
|
}
|
|
31500
31500
|
if (((w = l == null ? void 0 : l.authorization) == null ? void 0 : w.mode) === "otp") {
|
|
31501
|
-
this.cardResponse = l, this.
|
|
31501
|
+
this.cardResponse = l, R() !== "en" ? (this.showLoader(), this.renderTranslatedText(l == null ? void 0 : l.providerMessage).then(() => {
|
|
31502
|
+
this.pageLoader.unmountLoader(), this.currentStep = 3;
|
|
31503
|
+
})) : (this.otpMessage = (l == null ? void 0 : l.providerMessage) || "", this.currentStep = 3);
|
|
31502
31504
|
return;
|
|
31503
31505
|
}
|
|
31504
31506
|
if (((A = l == null ? void 0 : l.authorization) == null ? void 0 : A.mode) === "avs") {
|
|
@@ -31698,7 +31700,9 @@ class jd {
|
|
|
31698
31700
|
return;
|
|
31699
31701
|
}
|
|
31700
31702
|
if (((f = c == null ? void 0 : c.authorization) == null ? void 0 : f.mode) === "otp") {
|
|
31701
|
-
this.cardResponse = c, this.
|
|
31703
|
+
this.cardResponse = c, R() !== "en" ? (this.showLoader(), this.renderTranslatedText(c == null ? void 0 : c.providerMessage).then(() => {
|
|
31704
|
+
this.pageLoader.unmountLoader(), this.currentStep = 3;
|
|
31705
|
+
})) : (this.otpMessage = (c == null ? void 0 : c.providerMessage) || "", this.currentStep = 3);
|
|
31702
31706
|
return;
|
|
31703
31707
|
}
|
|
31704
31708
|
this.currentStep = 10;
|
package/dist/checkout-inline.js
CHANGED
|
@@ -1565,11 +1565,11 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
1565
1565
|
<path
|
|
1566
1566
|
d="M4.66667 3.99992V1.99992C4.66667 1.82311 4.7369 1.65354 4.86193 1.52851C4.98695 1.40349 5.15652 1.33325 5.33333 1.33325H13.3333C13.5101 1.33325 13.6797 1.40349 13.8047 1.52851C13.9298 1.65354 14 1.82311 14 1.99992V11.3333C14 11.5101 13.9298 11.6796 13.8047 11.8047C13.6797 11.9297 13.5101 11.9999 13.3333 11.9999H11.3333V13.9999C11.3333 14.3679 11.0333 14.6666 10.662 14.6666H2.67133C2.58342 14.6671 2.49626 14.6503 2.41488 14.617C2.3335 14.5837 2.25949 14.5347 2.19711 14.4728C2.13472 14.4108 2.0852 14.3372 2.05137 14.256C2.01754 14.1749 2.00009 14.0878 2 13.9999L2.002 4.66659C2.002 4.29859 2.302 3.99992 2.67333 3.99992H4.66667ZM3.33533 5.33325L3.33333 13.3333H10V5.33325H3.33533ZM6 3.99992H11.3333V10.6666H12.6667V2.66659H6V3.99992Z"
|
|
1567
1567
|
fill="#0D0716" />
|
|
1568
|
-
</svg>`},1e3))})})}renderComponent(e){R()!=="en"&&e===1?(this.mainLoader=new ke(this.container),this.mainLoader.mountLoader("15dvh"),this.renderTranslatedText().then(()=>{this.mainLoader.unmountLoader(),this.container.innerHTML=this.render(),this.attachListener()})):(this.container.innerHTML=this.render(),this.attachListener())}async renderTranslatedText(){await Ks(R())}}function pc(n){n.classList.remove("hidden"),requestAnimationFrame(()=>{n.classList.remove("opacity-0","scale-95")})}function di(n){n.classList.add("opacity-0","scale-95"),n.addEventListener("transitionend",()=>n.classList.add("hidden"),{once:!0})}class ra{constructor({container:e,testCardContainer:t,keyEnvironment:i}){d(this,"container");d(this,"testCardContainer");d(this,"testCardInstance",null);d(this,"keyEnvironment",null);d(this,"isVisible",!1);d(this,"mainLoader");d(this,"testCardClicks");this.container=e,this.testCardContainer=t,this.keyEnvironment=i,this.isVisible=!1,this.testCardClicks=0}attachListener(){const e=this.container.querySelector("#test-cards-link"),t=this.container.querySelector("#terms-text"),i=this.container.querySelector("#privacy-text"),s=this.container.querySelector("#contact-text"),o=this.container.querySelector("#powered-by-text");if(t&&(t.innerHTML=q.terms),i&&(i.innerHTML=q.privacy),s&&(s.innerHTML=q.contact),o&&(o.innerHTML=q.powered),!!e){if(e.innerHTML=q["test-card"],this.keyEnvironment!=="test"){e.classList.add("hidden");return}e.addEventListener("click",async()=>{this.testCardClicks=this.testCardClicks+1,this.testCardInstance||(this.testCardInstance=new aa({container:this.testCardContainer,closeCallback:()=>{this.testCardContainer.innerHTML="",di(this.testCardContainer),e.classList.remove("text-tone-100","font-bold"),this.isVisible=!1}})),this.testCardInstance.renderComponent(this.testCardClicks),pc(this.testCardContainer),e.classList.add("text-tone-100","font-bold"),this.isVisible=!0})}}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return hc}}function ft(){return{httpBrowserLanguage:navigator.language||"en-US",httpBrowserJavaEnabled:!1,httpBrowserJavaScriptEnabled:!0,httpBrowserColorDepth:window.screen.colorDepth.toString(),httpBrowserScreenHeight:window.screen.height.toString(),httpBrowserScreenWidth:window.screen.width.toString(),httpBrowserTimeDifference:(-new Date().getTimezoneOffset()).toString(),userAgentBrowserValue:navigator.userAgent,deviceChannel:"Browser"}}function Hn(n,e){return e&&e!==n?e:n}class vc{constructor({amount:e,totalAmount:t,container:i,customer:s,encryption:o,planId:a,token:c,currency:l,rdtCode:p,url:m,reference:g,onSuccess:b,callBackUrl:y,metadata:w,localCurrency:f,hidePaymentMethods:k,showPaymentMethods:x,onClose:A,restartTransactionProcess:M,retryingPayment:E,keys:D,testcardIsVisible:F}){d(this,"contents");d(this,"cardDetailForm");d(this,"cardOtpValidationForm");d(this,"merchantPlanDetail",{});d(this,"cardPinForm");d(this,"avsForm");d(this,"isw3dsForm");d(this,"successScreen");d(this,"pageLoader");d(this,"warningScreen");d(this,"transactionIssuesScreen");d(this,"container");d(this,"onSuccess");d(this,"planId","");d(this,"customer");d(this,"token");d(this,"amount");d(this,"totalAmount");d(this,"encryption");d(this,"currency");d(this,"_currentStep");d(this,"activeRef");d(this,"rdtCode");d(this,"url");d(this,"reference");d(this,"callBackUrl");d(this,"metadata");d(this,"localCurrency");d(this,"hidePaymentMethods");d(this,"showPaymentMethods");d(this,"onClose");d(this,"cardResponse");d(this,"cardResponseHeader");d(this,"confirmationEnd");d(this,"confirmationProgress");d(this,"restartTransactionProcess");d(this,"retryingPayment");d(this,"merchantDetails");d(this,"isMaxRetriesReached");d(this,"isCancelledPlan");d(this,"isMobile",!1);d(this,"keys");d(this,"testcardIsVisible",!1);d(this,"errorText");d(this,"otpMessage");d(this,"rawAvsData");d(this,"translatedAvsData");this.currency=l,this.onSuccess=b||(()=>null),this.keys=D,this.testcardIsVisible=F,this.metadata=w,this.container=i,this.encryption=o,this.token=c,this.customer=s,this.planId=a,this.merchantDetails={},this.amount=e,this.totalAmount=t,this.rdtCode=p,this.url=m,this.reference=g,this.callBackUrl=y,this.metadata=w,this.localCurrency=f,this._currentStep=1,this.activeRef="",this.contents=this.container.querySelector("#payment-content-view"),this.cardResponse={},this.cardResponseHeader={},this.hidePaymentMethods=k,this.showPaymentMethods=x,this.onClose=A,this.restartTransactionProcess=M,this.retryingPayment=E,this.isMaxRetriesReached=!1,this.isCancelledPlan=!1,this.errorText="",this.otpMessage="",this.renderCardContent(),this.rawAvsData={"billing-address":"Billing address",address:"Address",city:"City",state:"State",country:"Country","zip-code":"Zip code",submit:"Submit"},this.translatedAvsData=this.rawAvsData,_.track("card_opens",{payment_method:"Card"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderCardContent()}fetchCurrentRegionDetails(){const e=this.localCurrency?this.localCurrency!==this.currency?this.localCurrency:this.currency:this.currency;return Ni(e)}cancellledPlanAction(){if(this.rdtCode)window.history.back();else{const e=document.getElementById("checkout-modal");e&&e.remove()}}async renderTranslatedText(e){if(Array.isArray(e))this.translatedAvsData=await Ae.translateRecord(this.rawAvsData,R());else if(e){const t=await z(e,R());this.otpMessage=t}else this.otpMessage=""}showLoader(){this.pageLoader=new ke(this.contents),this.pageLoader.mountLoader()}async submitCardDetails(e,t){e.preventDefault(),_.track("input_cardDetails",{payment_method:"Card",authentication_type:"None"});const i=this.container.querySelector(".spinner"),s=this.container.querySelector("#details-form-button-text"),o=await ar(JSON.stringify(t),this.encryption);i&&s&&(i.classList.remove("hidden"),s.classList.add("hidden"));const a=ft();(()=>{var l,p,m,g,b,y,w;if(this.retryingPayment){const f={channel:"card",reference:this.reference,encryptedCard:o};return et(this.token,f,this.rdtCode,this.url)}else{const f={amount:((g=(m=(p=(l=this.merchantPlanDetail)==null?void 0:l.plan)==null?void 0:p.trial)==null?void 0:m.pricingList[0])==null?void 0:g.amount)??this.amount,channel:"card",applyDiscount:!0,currency:this.currency,planId:this.planId,customer:this.customer,reference:this.reference,encryptedCard:o,callBackUrl:this.callBackUrl,metadata:{...this.metadata,...((b=this.merchantDetails)==null?void 0:b.subscription_id)&&{subscription_id:(y=this.merchantDetails)==null?void 0:y.subscription_id}},...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((w=this.merchantPlanDetail)==null?void 0:w.taxQuoteId)&&{taxQuoteId:this.merchantPlanDetail.taxQuoteId},deviceInformation:a};return Ha(this.token,f,this.rdtCode,this.url)}})().then(async({data:l,headers:p})=>{var m,g,b,y,w,f,k,x;if(l.providerMessage){const A=await z(l.providerMessage,R());this.errorText=A}if(l.status==="failed")this.currentStep=4,this.reference=l.reference,_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"None"}),this.cardResponse=l,this.cardResponseHeader=p,l.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue();else if(["success","successful"].includes(l.status))this.currentStep=5,this.cardResponse=l,this.cardResponseHeader=p,_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"}),this.redirectTo(l,p,"success");else if(!["success","successful"].includes(l.status)&&l.status!=="failed")if(this.cardResponse=l,this.cardResponseHeader=p,l!=null&&l.authorization){if(this.activeRef=l.reference,((m=l==null?void 0:l.authorization)==null?void 0:m.mode)==="pin"){this.currentStep=2;return}if(((g=l==null?void 0:l.authorization)==null?void 0:g.mode)==="3DS"){(b=l==null?void 0:l.authorization)!=null&&b.redirectUrl&&this.redirectTo3DS((y=l==null?void 0:l.authorization)==null?void 0:y.redirectUrl),(w=l==null?void 0:l.authorization)!=null&&w.embeddedHtml&&this.redirectToPreciumDoc((f=l==null?void 0:l.authorization)==null?void 0:f.embeddedHtml);return}if(((k=l==null?void 0:l.authorization)==null?void 0:k.mode)==="otp"){this.cardResponse=l,this.currentStep=3;return}if(((x=l==null?void 0:l.authorization)==null?void 0:x.mode)==="avs"){if(R()!=="en"){this.showLoader();const A=Object.values(this.rawAvsData);this.renderTranslatedText(A).then(()=>{this.pageLoader.unmountLoader(),this.currentStep=7})}else this.currentStep=7;return}}else this.currentStep=4,l.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["error-with-payment"]),this.warningScreen.hideReportIssue()}).catch(async l=>{if(_.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"None"}),l.code==="payment_max_retry_attempts")this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=4,_.track("max_retries_reached",{payment_method:"Card"}),this.warningScreen.setPaymentError(P["maximum-retries"],P["maximum-retries-desc"],q["merchant-back"]);else{if(l.message){const p=await z(l.message,R());this.errorText=p,l.code==="7137"?(this.isCancelledPlan=!0,this.currentStep=4,_.track("cancelled_plan",{payment_method:"Card"}),this.warningScreen.setPaymentError(this.errorText,"",q["merchant-back"])):(this.currentStep=4,this.warningScreen.setPaymentError(this.errorText))}else this.currentStep=4,this.warningScreen.setPaymentError(P["payment-failed"]);this.warningScreen.hideReportIssue()}}).finally(()=>{i&&s&&(i.classList.add("hidden"),s.classList.remove("hidden"))})}handlePinRequest(e){if(e.length===4){const t={authorization:{pin:e},reference:this.activeRef};_.track("input_cardPin",{payment_method:"Card",authentication_type:"PIN"}),setTimeout(()=>{const i=this.container.querySelector("#pin-loader"),s=this.container.querySelector("#cancel-payment");i&&(i.innerHTML=`<svg class="animate-spin" width="40" height="40" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1568
|
+
</svg>`},1e3))})})}renderComponent(e){R()!=="en"&&e===1?(this.mainLoader=new ke(this.container),this.mainLoader.mountLoader("15dvh"),this.renderTranslatedText().then(()=>{this.mainLoader.unmountLoader(),this.container.innerHTML=this.render(),this.attachListener()})):(this.container.innerHTML=this.render(),this.attachListener())}async renderTranslatedText(){await Ks(R())}}function pc(n){n.classList.remove("hidden"),requestAnimationFrame(()=>{n.classList.remove("opacity-0","scale-95")})}function di(n){n.classList.add("opacity-0","scale-95"),n.addEventListener("transitionend",()=>n.classList.add("hidden"),{once:!0})}class ra{constructor({container:e,testCardContainer:t,keyEnvironment:i}){d(this,"container");d(this,"testCardContainer");d(this,"testCardInstance",null);d(this,"keyEnvironment",null);d(this,"isVisible",!1);d(this,"mainLoader");d(this,"testCardClicks");this.container=e,this.testCardContainer=t,this.keyEnvironment=i,this.isVisible=!1,this.testCardClicks=0}attachListener(){const e=this.container.querySelector("#test-cards-link"),t=this.container.querySelector("#terms-text"),i=this.container.querySelector("#privacy-text"),s=this.container.querySelector("#contact-text"),o=this.container.querySelector("#powered-by-text");if(t&&(t.innerHTML=q.terms),i&&(i.innerHTML=q.privacy),s&&(s.innerHTML=q.contact),o&&(o.innerHTML=q.powered),!!e){if(e.innerHTML=q["test-card"],this.keyEnvironment!=="test"){e.classList.add("hidden");return}e.addEventListener("click",async()=>{this.testCardClicks=this.testCardClicks+1,this.testCardInstance||(this.testCardInstance=new aa({container:this.testCardContainer,closeCallback:()=>{this.testCardContainer.innerHTML="",di(this.testCardContainer),e.classList.remove("text-tone-100","font-bold"),this.isVisible=!1}})),this.testCardInstance.renderComponent(this.testCardClicks),pc(this.testCardContainer),e.classList.add("text-tone-100","font-bold"),this.isVisible=!0})}}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return hc}}function ft(){return{httpBrowserLanguage:navigator.language||"en-US",httpBrowserJavaEnabled:!1,httpBrowserJavaScriptEnabled:!0,httpBrowserColorDepth:window.screen.colorDepth.toString(),httpBrowserScreenHeight:window.screen.height.toString(),httpBrowserScreenWidth:window.screen.width.toString(),httpBrowserTimeDifference:(-new Date().getTimezoneOffset()).toString(),userAgentBrowserValue:navigator.userAgent,deviceChannel:"Browser"}}function Hn(n,e){return e&&e!==n?e:n}class vc{constructor({amount:e,totalAmount:t,container:i,customer:s,encryption:o,planId:a,token:c,currency:l,rdtCode:p,url:m,reference:g,onSuccess:b,callBackUrl:y,metadata:w,localCurrency:f,hidePaymentMethods:k,showPaymentMethods:x,onClose:A,restartTransactionProcess:M,retryingPayment:E,keys:D,testcardIsVisible:F}){d(this,"contents");d(this,"cardDetailForm");d(this,"cardOtpValidationForm");d(this,"merchantPlanDetail",{});d(this,"cardPinForm");d(this,"avsForm");d(this,"isw3dsForm");d(this,"successScreen");d(this,"pageLoader");d(this,"warningScreen");d(this,"transactionIssuesScreen");d(this,"container");d(this,"onSuccess");d(this,"planId","");d(this,"customer");d(this,"token");d(this,"amount");d(this,"totalAmount");d(this,"encryption");d(this,"currency");d(this,"_currentStep");d(this,"activeRef");d(this,"rdtCode");d(this,"url");d(this,"reference");d(this,"callBackUrl");d(this,"metadata");d(this,"localCurrency");d(this,"hidePaymentMethods");d(this,"showPaymentMethods");d(this,"onClose");d(this,"cardResponse");d(this,"cardResponseHeader");d(this,"confirmationEnd");d(this,"confirmationProgress");d(this,"restartTransactionProcess");d(this,"retryingPayment");d(this,"merchantDetails");d(this,"isMaxRetriesReached");d(this,"isCancelledPlan");d(this,"isMobile",!1);d(this,"keys");d(this,"testcardIsVisible",!1);d(this,"errorText");d(this,"otpMessage");d(this,"rawAvsData");d(this,"translatedAvsData");this.currency=l,this.onSuccess=b||(()=>null),this.keys=D,this.testcardIsVisible=F,this.metadata=w,this.container=i,this.encryption=o,this.token=c,this.customer=s,this.planId=a,this.merchantDetails={},this.amount=e,this.totalAmount=t,this.rdtCode=p,this.url=m,this.reference=g,this.callBackUrl=y,this.metadata=w,this.localCurrency=f,this._currentStep=1,this.activeRef="",this.contents=this.container.querySelector("#payment-content-view"),this.cardResponse={},this.cardResponseHeader={},this.hidePaymentMethods=k,this.showPaymentMethods=x,this.onClose=A,this.restartTransactionProcess=M,this.retryingPayment=E,this.isMaxRetriesReached=!1,this.isCancelledPlan=!1,this.errorText="",this.otpMessage="",this.renderCardContent(),this.rawAvsData={"billing-address":"Billing address",address:"Address",city:"City",state:"State",country:"Country","zip-code":"Zip code",submit:"Submit"},this.translatedAvsData=this.rawAvsData,_.track("card_opens",{payment_method:"Card"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderCardContent()}fetchCurrentRegionDetails(){const e=this.localCurrency?this.localCurrency!==this.currency?this.localCurrency:this.currency:this.currency;return Ni(e)}cancellledPlanAction(){if(this.rdtCode)window.history.back();else{const e=document.getElementById("checkout-modal");e&&e.remove()}}async renderTranslatedText(e){if(Array.isArray(e))this.translatedAvsData=await Ae.translateRecord(this.rawAvsData,R());else if(e){const t=await z(e,R());this.otpMessage=t}else this.otpMessage=""}showLoader(){this.pageLoader=new ke(this.contents),this.pageLoader.mountLoader()}async submitCardDetails(e,t){e.preventDefault(),_.track("input_cardDetails",{payment_method:"Card",authentication_type:"None"});const i=this.container.querySelector(".spinner"),s=this.container.querySelector("#details-form-button-text"),o=await ar(JSON.stringify(t),this.encryption);i&&s&&(i.classList.remove("hidden"),s.classList.add("hidden"));const a=ft();(()=>{var l,p,m,g,b,y,w;if(this.retryingPayment){const f={channel:"card",reference:this.reference,encryptedCard:o};return et(this.token,f,this.rdtCode,this.url)}else{const f={amount:((g=(m=(p=(l=this.merchantPlanDetail)==null?void 0:l.plan)==null?void 0:p.trial)==null?void 0:m.pricingList[0])==null?void 0:g.amount)??this.amount,channel:"card",applyDiscount:!0,currency:this.currency,planId:this.planId,customer:this.customer,reference:this.reference,encryptedCard:o,callBackUrl:this.callBackUrl,metadata:{...this.metadata,...((b=this.merchantDetails)==null?void 0:b.subscription_id)&&{subscription_id:(y=this.merchantDetails)==null?void 0:y.subscription_id}},...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((w=this.merchantPlanDetail)==null?void 0:w.taxQuoteId)&&{taxQuoteId:this.merchantPlanDetail.taxQuoteId},deviceInformation:a};return Ha(this.token,f,this.rdtCode,this.url)}})().then(async({data:l,headers:p})=>{var m,g,b,y,w,f,k,x;if(l.providerMessage){const A=await z(l.providerMessage,R());this.errorText=A}if(l.status==="failed")this.currentStep=4,this.reference=l.reference,_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"None"}),this.cardResponse=l,this.cardResponseHeader=p,l.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue();else if(["success","successful"].includes(l.status))this.currentStep=5,this.cardResponse=l,this.cardResponseHeader=p,_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"}),this.redirectTo(l,p,"success");else if(!["success","successful"].includes(l.status)&&l.status!=="failed")if(this.cardResponse=l,this.cardResponseHeader=p,l!=null&&l.authorization){if(this.activeRef=l.reference,((m=l==null?void 0:l.authorization)==null?void 0:m.mode)==="pin"){this.currentStep=2;return}if(((g=l==null?void 0:l.authorization)==null?void 0:g.mode)==="3DS"){(b=l==null?void 0:l.authorization)!=null&&b.redirectUrl&&this.redirectTo3DS((y=l==null?void 0:l.authorization)==null?void 0:y.redirectUrl),(w=l==null?void 0:l.authorization)!=null&&w.embeddedHtml&&this.redirectToPreciumDoc((f=l==null?void 0:l.authorization)==null?void 0:f.embeddedHtml);return}if(((k=l==null?void 0:l.authorization)==null?void 0:k.mode)==="otp"){this.cardResponse=l,R()!=="en"?(this.showLoader(),this.renderTranslatedText(l==null?void 0:l.providerMessage).then(()=>{this.pageLoader.unmountLoader(),this.currentStep=3})):(this.otpMessage=(l==null?void 0:l.providerMessage)||"",this.currentStep=3);return}if(((x=l==null?void 0:l.authorization)==null?void 0:x.mode)==="avs"){if(R()!=="en"){this.showLoader();const A=Object.values(this.rawAvsData);this.renderTranslatedText(A).then(()=>{this.pageLoader.unmountLoader(),this.currentStep=7})}else this.currentStep=7;return}}else this.currentStep=4,l.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["error-with-payment"]),this.warningScreen.hideReportIssue()}).catch(async l=>{if(_.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"None"}),l.code==="payment_max_retry_attempts")this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=4,_.track("max_retries_reached",{payment_method:"Card"}),this.warningScreen.setPaymentError(P["maximum-retries"],P["maximum-retries-desc"],q["merchant-back"]);else{if(l.message){const p=await z(l.message,R());this.errorText=p,l.code==="7137"?(this.isCancelledPlan=!0,this.currentStep=4,_.track("cancelled_plan",{payment_method:"Card"}),this.warningScreen.setPaymentError(this.errorText,"",q["merchant-back"])):(this.currentStep=4,this.warningScreen.setPaymentError(this.errorText))}else this.currentStep=4,this.warningScreen.setPaymentError(P["payment-failed"]);this.warningScreen.hideReportIssue()}}).finally(()=>{i&&s&&(i.classList.add("hidden"),s.classList.remove("hidden"))})}handlePinRequest(e){if(e.length===4){const t={authorization:{pin:e},reference:this.activeRef};_.track("input_cardPin",{payment_method:"Card",authentication_type:"PIN"}),setTimeout(()=>{const i=this.container.querySelector("#pin-loader"),s=this.container.querySelector("#cancel-payment");i&&(i.innerHTML=`<svg class="animate-spin" width="40" height="40" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1569
1569
|
<path
|
|
1570
1570
|
d="M62 32C62 38.6156 59.8132 45.0457 55.78 50.2897C51.7468 55.5336 46.0932 59.2974 39.6992 60.9952C33.3052 62.693 26.5293 62.2297 20.4258 59.6774C14.3224 57.1251 9.2338 52.6268 5.95186 46.8827C2.66993 41.1385 1.37873 34.4707 2.2792 27.9166C3.17967 21.3626 6.22129 15.29 10.9308 10.6438C15.6402 5.9976 21.7534 3.0384 28.3191 2.22668C34.8847 1.41496 41.5345 2.79623 47.2337 6.15557"
|
|
1571
1571
|
stroke="black" stroke-width="4" stroke-linejoin="round" />
|
|
1572
|
-
</svg>`),s&&s.classList.add("hidden"),Ot(this.token,t,this.rdtCode,this.url).then(async({data:a,headers:c})=>{var l,p,m,g,b,y,w,f,k,x;if(a.providerMessage){const A=await z(a.providerMessage,R());this.errorText=A}if(a.status==="failed")_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.currentStep=4,a.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(a.status))this.currentStep=5,this.redirectTo(a,c,"success"),_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"});else{if(((l=a==null?void 0:a.authorization)==null?void 0:l.mode)==="3DS"){(p=a==null?void 0:a.authorization)!=null&&p.redirectUrl&&this.redirectTo3DS((m=a==null?void 0:a.authorization)==null?void 0:m.redirectUrl),(g=a==null?void 0:a.authorization)!=null&&g.embeddedHtml&&this.redirectToPreciumDoc((b=a==null?void 0:a.authorization)==null?void 0:b.embeddedHtml),(y=a==null?void 0:a.authorization)!=null&&y.jwt&&((w=a==null?void 0:a.authorization)!=null&&w.acsUrl)&&((f=a==null?void 0:a.authorization)!=null&&f.md)&&(this.cardResponse=a,this.currentStep=11);return}if(((k=a==null?void 0:a.authorization)==null?void 0:k.mode)==="otp"){this.cardResponse=a,R()!=="en"?(this.showLoader(),this.renderTranslatedText(a==null?void 0:a.providerMessage).then(()=>{this.pageLoader.unmountLoader(),this.currentStep=3})):(this.otpMessage=(a==null?void 0:a.providerMessage)||"",this.currentStep=3);return}if(((x=a==null?void 0:a.authorization)==null?void 0:x.mode)==="avs"){if(R()!=="en"){this.showLoader();const A=Object.values(this.rawAvsData);this.renderTranslatedText(A).then(()=>{this.pageLoader.unmountLoader(),this.currentStep=7})}else this.currentStep=7;return}this.currentStep=10}}).catch(async a=>{if(_.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"PIN"}),a.message){const c=await z(a.message,R());this.errorText=c,this.currentStep=4,this.warningScreen.setPaymentError(this.errorText)}else this.currentStep=4,this.warningScreen.setPaymentError(P["payment-failed"]);this.warningScreen.hideReportIssue()})},300)}}validatedAVS(e,t){e.stopPropagation(),e.preventDefault();const i=this.container.querySelector(".spinner"),s=this.container.querySelector("#avs-form-button-text"),o={authorization:{avs:{state:t==null?void 0:t.state,city:t==null?void 0:t.city,country:t==null?void 0:t.country,address:t==null?void 0:t.address,zipCode:(t==null?void 0:t.code)||"-"}},reference:this.activeRef};_.track("input_address",{payment_method:"Card",authentication_type:"AVS"}),i&&s&&(i.classList.remove("hidden"),s.classList.add("hidden")),Ot(this.token,o,this.rdtCode,this.url).then(async({data:c,headers:l})=>{var p,m,g,b,y,w,f;if(c.providerMessage){const k=await z(c.providerMessage,R());this.errorText=k}if(c.status==="failed")this.currentStep=4,_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"AVS"}),c.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(c.status))["success","successful"].includes(c.status)&&(this.currentStep=5,this.redirectTo(c,l,"success"),_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"AVS"}));else{if(((p=c==null?void 0:c.authorization)==null?void 0:p.mode)==="pin"){this.currentStep=2;return}if(((m=c==null?void 0:c.authorization)==null?void 0:m.mode)==="3DS"){(g=c==null?void 0:c.authorization)!=null&&g.redirectUrl&&this.redirectTo3DS((b=c==null?void 0:c.authorization)==null?void 0:b.redirectUrl),(y=c==null?void 0:c.authorization)!=null&&y.embeddedHtml&&this.redirectToPreciumDoc((w=c==null?void 0:c.authorization)==null?void 0:w.embeddedHtml);return}if(((f=c==null?void 0:c.authorization)==null?void 0:f.mode)==="otp"){this.cardResponse=c,this.currentStep=3;return}this.currentStep=10}}).catch(async c=>{if(_.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"AVS"}),c.message){const l=await z(c.message,R());this.errorText=l,this.currentStep=4,this.warningScreen.setPaymentError(this.errorText)}else this.currentStep=4,this.warningScreen.setPaymentError(P["payment-failed"]);this.warningScreen.hideReportIssue()}).finally(()=>{i&&s&&(i.classList.add("hidden"),s.classList.remove("hidden"))})}submitOtp(e,t){e.preventDefault();const i={authorization:{otp:t},reference:this.activeRef};this.currentStep=6,this.showLoader(),_.track("input_cardOTP",{payment_method:"Card",authentication_type:"PIN+0TP"}),Ot(this.token,i,this.rdtCode,this.url).then(async({data:o,headers:a})=>{var c,l,p,m,g,b,y;if(o.providerMessage){const w=await z(o.providerMessage,R());this.errorText=w}if(o.status==="failed")this.currentStep=4,_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),o.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(o.status))["success","successful"].includes(o.status)&&(this.currentStep=5,this.redirectTo(o,a,"success"),_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN+0TP"}));else{if(this.activeRef=o.reference,((c=o==null?void 0:o.authorization)==null?void 0:c.mode)==="pin"){this.currentStep=2;return}if(((l=o==null?void 0:o.authorization)==null?void 0:l.mode)==="3DS"){(p=o==null?void 0:o.authorization)!=null&&p.redirectUrl&&this.redirectTo3DS((m=o==null?void 0:o.authorization)==null?void 0:m.redirectUrl),(g=o==null?void 0:o.authorization)!=null&&g.embeddedHtml&&this.redirectToPreciumDoc((b=o==null?void 0:o.authorization)==null?void 0:b.embeddedHtml);return}if(((y=o==null?void 0:o.authorization)==null?void 0:y.mode)==="avs"){if(R()!=="en"){this.showLoader();const w=Object.values(this.rawAvsData);this.renderTranslatedText(w).then(()=>{this.pageLoader.unmountLoader(),this.currentStep=7})}else this.currentStep=7;return}this.currentStep=10}}).catch(async o=>{if(_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),o!=null&&o.message){const a=await z(o.message,R());this.errorText=a,this.currentStep=4,this.warningScreen.setPaymentError(this.errorText)}else this.currentStep=4,this.warningScreen.setPaymentError(P["payment-failed"]);this.warningScreen.hideReportIssue()})}redirectTo3DS(e){const t=window.open("","_blank");if(!t){alert(pe["enable-popup"]);return}t.location.href=e,_.track("auth_redirect",{payment_method:"Card",authentication_type:"3DS"}),this.currentStep=6,this.showLoader();const i=setInterval(()=>{t.closed&&(clearInterval(i),this.verifyPayment(({data:s,headers:o})=>{this.currentStep=5,_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"3DS"}),this.redirectTo(s,o,"success")},async({data:s})=>{if(s.providerMessage){const o=await z(s.providerMessage,R());this.errorText=o}this.currentStep=4,s.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue(),_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"3DS"})}))},2e3)}redirectToPreciumDoc(e){const t=atob(e),i=new Blob([t],{type:"text/html"}),s=URL.createObjectURL(i),o=window.open(s,"_blank");if(o){o.document.close(),_.track("auth_redirect",{payment_method:"Card",authentication_type:"3DS"}),this.currentStep=6,this.showLoader();const a=setInterval(()=>{o.closed&&(clearInterval(a),this.verifyPayment(({data:c,headers:l})=>{this.currentStep=5,_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"3DS"}),this.redirectTo(c,l,"success")},async({data:c})=>{if(c.providerMessage){const l=await z(c.providerMessage,R());this.errorText=l}this.currentStep=4,c.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue(),_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"3DS"})}))},2e3)}else alert(pe["enable-popup"])}async verifyPayment(e,t){try{const i=await Xe(this.token,this.activeRef,void 0,this.rdtCode,this.url);i.data.status==="failed"?t(i):(["success","successful"].includes(i.data.status)&&e(i),i.data.status==="inProgress"&&(this.currentStep=10))}catch{this.currentStep=4,_.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"3DS"}),this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue()}}async verifyPaymentProcess(){try{const e=await Xe(this.token,this.reference,void 0,this.rdtCode,this.url);this.cardResponse=e.data,this.cardResponseHeader=e.headers}catch{this.currentStep=4}}charge3DSPayment(){const e=ja(this.token,this.reference,this.rdtCode,this.url);_.track("charge_3ds_payment",{payment_method:"Card",authentication_type:"3DS"}),e.then(async({data:t,headers:i})=>{if(this.cardResponse=t,this.cardResponseHeader=i,t.providerMessage){const s=await z(t.providerMessage,R());this.errorText=s}t.status==="failed"?(this.currentStep=4,_.track("charge_3ds_payment",{payment_method:"Card",authentication_type:"3DS",verification_status:"Failed"}),t.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue()):["success","successful"].includes(t.status)?(this.currentStep=5,_.track("charge_3ds_payment",{payment_method:"Card",authentication_type:"3DS",verification_status:"Success"}),this.redirectTo(t,i,"success")):t.status==="inProgress"?this.currentStep=10:(this.currentStep=4,_.track("charge_3ds_payment",{payment_method:"Card",authentication_type:"3DS",verification_status:"Null"}),t.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue())}).catch(async t=>{if(_.track("charge_3ds_payment",{payment_method:"Card",authentication_type:"3DS",verification_status:"Null"}),t.message){const i=await z(t.message,R());this.errorText=i,this.currentStep=4,this.warningScreen.setPaymentError(this.errorText)}else this.currentStep=4,this.warningScreen.setPaymentError(P["payment-failed"]);this.warningScreen.hideReportIssue()})}goBackToMerchant(){if(this.isCancelledPlan){this.cancellledPlanAction();return}this.redirectTo(this.cardResponse,this.cardResponseHeader,this.callBackUrl)}renderCardContent(e){var o,a,c,l,p,m,g,b,y,w,f;e&&(this.merchantPlanDetail=e);const t=document.getElementById("test-container"),i=this.container.querySelector("#test-cards-link"),s=document.getElementById("go-back");if(this.currentStep!==1?(this.hidePaymentMethods(),s==null||s.classList.add("hidden")):this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.contents){switch(this.currentStep){case 1:this.cardDetailForm=new Qs({container:this.contents,onAction:x=>A=>this.submitCardDetails.bind(this)(x,A),merchantName:this.merchantPlanDetail.merchantName,currency:Hn(this.currency,this.localCurrency)}),this.cardDetailForm.renderContent();break;case 2:this.cardPinForm=new ur({container:this.contents,onClose:this.onClose,onAction:x=>this.handlePinRequest.bind(this)(x)}),this.cardPinForm.renderComponent();break;case 3:this.cardOtpValidationForm=new cr({container:this.contents,onClose:this.onClose,onAction:x=>A=>this.submitOtp.bind(this)(x,A),otpMessage:this.otpMessage||P["Payment failed"]}),this.cardOtpValidationForm.renderComponent();break;case 4:this.warningScreen=new en({container:this.contents,onAction:this.isMaxRetriesReached||this.isCancelledPlan?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this),onReportIssue:()=>this.currentStep=8}),this.testcardIsVisible&&(di(t),i.classList.remove("text-tone-100","font-bold")),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 5:this.successScreen=new Fn({container:this.contents,amount:((l=(c=(a=(o=this.merchantPlanDetail)==null?void 0:o.plan)==null?void 0:a.trial)==null?void 0:c.pricingList[0])==null?void 0:l.amount)??this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:(p=this.merchantPlanDetail)==null?void 0:p.rate.rate}),this.testcardIsVisible&&(di(t),i.classList.remove("text-tone-100","font-bold")),this.successScreen.renderComponent();break;case 6:this.pageLoader=new ke(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 7:this.avsForm=new pr({container:this.contents,onAction:x=>A=>this.validatedAVS.bind(this)(x,A),translatedTexts:this.translatedAvsData}),this.avsForm.renderComponent();break;case 8:this.transactionIssuesScreen=new st({container:this.contents,onAction:async()=>{var x,A;if((x=this.cardResponse)!=null&&x.providerMessage){const M=await z((A=this.cardResponse)==null?void 0:A.providerMessage,R());this.errorText=M}this.currentStep=4,this.warningScreen.setPaymentError(this.errorText||P["payment-failed"])},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"card",callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break;case 9:this.confirmationEnd=new oa({container:this.contents,onAction:x=>{this.currentStep=x},ref:this.reference,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader,paymentMethod:"Card"}),this.confirmationEnd.renderComponent();break;case 10:this.confirmationProgress=new uc({container:this.contents,onAction:x=>{this.currentStep=x},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(x,A)=>{this.cardResponse=x,this.cardResponseHeader=A},step:{failed:4,success:5,end:9},paymentMethod:"Card"}),this.testcardIsVisible&&(di(t),i.classList.remove("text-tone-100","font-bold")),this.confirmationProgress.renderComponent();break;case 11:this.isw3dsForm=new vr({container:this.contents,threeDSecureDetails:{jwt:((g=(m=this.cardResponse)==null?void 0:m.authorization)==null?void 0:g.jwt)||"",md:((y=(b=this.cardResponse)==null?void 0:b.authorization)==null?void 0:y.md)||"",acsUrl:((f=(w=this.cardResponse)==null?void 0:w.authorization)==null?void 0:f.acsUrl)||""},onAction:x=>{this.currentStep=x,x===6&&this.showLoader()},onSuccess:this.charge3DSPayment.bind(this)}),this.isw3dsForm.renderComponent();break;default:this.cardDetailForm=new Qs({container:this.contents,onAction:x=>A=>this.submitCardDetails.bind(this)(x,A),merchantName:this.merchantPlanDetail.merchantName,currency:Hn(this.currency,this.localCurrency)}),this.cardDetailForm.renderContent();break}this.displayButtonText();const k=this.container.querySelector("#card-currency");k&&(k.textContent=`${Hn(this.currency,this.localCurrency)} ${pe.card}`)}}redirectTo(e,t,i){const s=t.get("spf-redirect-url");this.callBackUrl=s||this.callBackUrl,this.callBackUrl?setTimeout(()=>{const o=new URL(this.callBackUrl);o.searchParams.append("status",e.status),o.searchParams.append("reference",e.reference),window.location.href=o.toString()},1800):i==="success"&&this.onSuccess(e)}displayButtonText(e){var i,s,o,a,c,l,p,m,g,b;const t=this.container.querySelector("#details-form-button-text");if(t){const y=(s=(i=this==null?void 0:this.merchantPlanDetail)==null?void 0:i.plan)==null?void 0:s.trial,w=(l=(c=(a=(o=this==null?void 0:this.merchantPlanDetail)==null?void 0:o.plan)==null?void 0:a.trial)==null?void 0:c.pricingList[0])==null?void 0:l.amount,f=Hn(this.currency,this.localCurrency),k=f==="USD"?(m=(p=this.merchantPlanDetail)==null?void 0:p.rate)==null?void 0:m.from:f;e?t.textContent=e:t.textContent=`${pe["continue-to"]} ${k} ${Te(y&&w!=null?w:this.totalAmount!==this.amount?this.totalAmount:(this.amount||0)*(this.currency==="USD"?(b=(g=this.merchantPlanDetail)==null?void 0:g.rate)==null?void 0:b.rate:1),2)}`}}}const bc=`<div data-section="transfer" data-section="transfer">
|
|
1572
|
+
</svg>`),s&&s.classList.add("hidden"),Ot(this.token,t,this.rdtCode,this.url).then(async({data:a,headers:c})=>{var l,p,m,g,b,y,w,f,k,x;if(a.providerMessage){const A=await z(a.providerMessage,R());this.errorText=A}if(a.status==="failed")_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.currentStep=4,a.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(a.status))this.currentStep=5,this.redirectTo(a,c,"success"),_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"});else{if(((l=a==null?void 0:a.authorization)==null?void 0:l.mode)==="3DS"){(p=a==null?void 0:a.authorization)!=null&&p.redirectUrl&&this.redirectTo3DS((m=a==null?void 0:a.authorization)==null?void 0:m.redirectUrl),(g=a==null?void 0:a.authorization)!=null&&g.embeddedHtml&&this.redirectToPreciumDoc((b=a==null?void 0:a.authorization)==null?void 0:b.embeddedHtml),(y=a==null?void 0:a.authorization)!=null&&y.jwt&&((w=a==null?void 0:a.authorization)!=null&&w.acsUrl)&&((f=a==null?void 0:a.authorization)!=null&&f.md)&&(this.cardResponse=a,this.currentStep=11);return}if(((k=a==null?void 0:a.authorization)==null?void 0:k.mode)==="otp"){this.cardResponse=a,R()!=="en"?(this.showLoader(),this.renderTranslatedText(a==null?void 0:a.providerMessage).then(()=>{this.pageLoader.unmountLoader(),this.currentStep=3})):(this.otpMessage=(a==null?void 0:a.providerMessage)||"",this.currentStep=3);return}if(((x=a==null?void 0:a.authorization)==null?void 0:x.mode)==="avs"){if(R()!=="en"){this.showLoader();const A=Object.values(this.rawAvsData);this.renderTranslatedText(A).then(()=>{this.pageLoader.unmountLoader(),this.currentStep=7})}else this.currentStep=7;return}this.currentStep=10}}).catch(async a=>{if(_.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"PIN"}),a.message){const c=await z(a.message,R());this.errorText=c,this.currentStep=4,this.warningScreen.setPaymentError(this.errorText)}else this.currentStep=4,this.warningScreen.setPaymentError(P["payment-failed"]);this.warningScreen.hideReportIssue()})},300)}}validatedAVS(e,t){e.stopPropagation(),e.preventDefault();const i=this.container.querySelector(".spinner"),s=this.container.querySelector("#avs-form-button-text"),o={authorization:{avs:{state:t==null?void 0:t.state,city:t==null?void 0:t.city,country:t==null?void 0:t.country,address:t==null?void 0:t.address,zipCode:(t==null?void 0:t.code)||"-"}},reference:this.activeRef};_.track("input_address",{payment_method:"Card",authentication_type:"AVS"}),i&&s&&(i.classList.remove("hidden"),s.classList.add("hidden")),Ot(this.token,o,this.rdtCode,this.url).then(async({data:c,headers:l})=>{var p,m,g,b,y,w,f;if(c.providerMessage){const k=await z(c.providerMessage,R());this.errorText=k}if(c.status==="failed")this.currentStep=4,_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"AVS"}),c.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(c.status))["success","successful"].includes(c.status)&&(this.currentStep=5,this.redirectTo(c,l,"success"),_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"AVS"}));else{if(((p=c==null?void 0:c.authorization)==null?void 0:p.mode)==="pin"){this.currentStep=2;return}if(((m=c==null?void 0:c.authorization)==null?void 0:m.mode)==="3DS"){(g=c==null?void 0:c.authorization)!=null&&g.redirectUrl&&this.redirectTo3DS((b=c==null?void 0:c.authorization)==null?void 0:b.redirectUrl),(y=c==null?void 0:c.authorization)!=null&&y.embeddedHtml&&this.redirectToPreciumDoc((w=c==null?void 0:c.authorization)==null?void 0:w.embeddedHtml);return}if(((f=c==null?void 0:c.authorization)==null?void 0:f.mode)==="otp"){this.cardResponse=c,R()!=="en"?(this.showLoader(),this.renderTranslatedText(c==null?void 0:c.providerMessage).then(()=>{this.pageLoader.unmountLoader(),this.currentStep=3})):(this.otpMessage=(c==null?void 0:c.providerMessage)||"",this.currentStep=3);return}this.currentStep=10}}).catch(async c=>{if(_.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"AVS"}),c.message){const l=await z(c.message,R());this.errorText=l,this.currentStep=4,this.warningScreen.setPaymentError(this.errorText)}else this.currentStep=4,this.warningScreen.setPaymentError(P["payment-failed"]);this.warningScreen.hideReportIssue()}).finally(()=>{i&&s&&(i.classList.add("hidden"),s.classList.remove("hidden"))})}submitOtp(e,t){e.preventDefault();const i={authorization:{otp:t},reference:this.activeRef};this.currentStep=6,this.showLoader(),_.track("input_cardOTP",{payment_method:"Card",authentication_type:"PIN+0TP"}),Ot(this.token,i,this.rdtCode,this.url).then(async({data:o,headers:a})=>{var c,l,p,m,g,b,y;if(o.providerMessage){const w=await z(o.providerMessage,R());this.errorText=w}if(o.status==="failed")this.currentStep=4,_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),o.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(o.status))["success","successful"].includes(o.status)&&(this.currentStep=5,this.redirectTo(o,a,"success"),_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN+0TP"}));else{if(this.activeRef=o.reference,((c=o==null?void 0:o.authorization)==null?void 0:c.mode)==="pin"){this.currentStep=2;return}if(((l=o==null?void 0:o.authorization)==null?void 0:l.mode)==="3DS"){(p=o==null?void 0:o.authorization)!=null&&p.redirectUrl&&this.redirectTo3DS((m=o==null?void 0:o.authorization)==null?void 0:m.redirectUrl),(g=o==null?void 0:o.authorization)!=null&&g.embeddedHtml&&this.redirectToPreciumDoc((b=o==null?void 0:o.authorization)==null?void 0:b.embeddedHtml);return}if(((y=o==null?void 0:o.authorization)==null?void 0:y.mode)==="avs"){if(R()!=="en"){this.showLoader();const w=Object.values(this.rawAvsData);this.renderTranslatedText(w).then(()=>{this.pageLoader.unmountLoader(),this.currentStep=7})}else this.currentStep=7;return}this.currentStep=10}}).catch(async o=>{if(_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),o!=null&&o.message){const a=await z(o.message,R());this.errorText=a,this.currentStep=4,this.warningScreen.setPaymentError(this.errorText)}else this.currentStep=4,this.warningScreen.setPaymentError(P["payment-failed"]);this.warningScreen.hideReportIssue()})}redirectTo3DS(e){const t=window.open("","_blank");if(!t){alert(pe["enable-popup"]);return}t.location.href=e,_.track("auth_redirect",{payment_method:"Card",authentication_type:"3DS"}),this.currentStep=6,this.showLoader();const i=setInterval(()=>{t.closed&&(clearInterval(i),this.verifyPayment(({data:s,headers:o})=>{this.currentStep=5,_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"3DS"}),this.redirectTo(s,o,"success")},async({data:s})=>{if(s.providerMessage){const o=await z(s.providerMessage,R());this.errorText=o}this.currentStep=4,s.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue(),_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"3DS"})}))},2e3)}redirectToPreciumDoc(e){const t=atob(e),i=new Blob([t],{type:"text/html"}),s=URL.createObjectURL(i),o=window.open(s,"_blank");if(o){o.document.close(),_.track("auth_redirect",{payment_method:"Card",authentication_type:"3DS"}),this.currentStep=6,this.showLoader();const a=setInterval(()=>{o.closed&&(clearInterval(a),this.verifyPayment(({data:c,headers:l})=>{this.currentStep=5,_.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"3DS"}),this.redirectTo(c,l,"success")},async({data:c})=>{if(c.providerMessage){const l=await z(c.providerMessage,R());this.errorText=l}this.currentStep=4,c.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue(),_.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"3DS"})}))},2e3)}else alert(pe["enable-popup"])}async verifyPayment(e,t){try{const i=await Xe(this.token,this.activeRef,void 0,this.rdtCode,this.url);i.data.status==="failed"?t(i):(["success","successful"].includes(i.data.status)&&e(i),i.data.status==="inProgress"&&(this.currentStep=10))}catch{this.currentStep=4,_.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"3DS"}),this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue()}}async verifyPaymentProcess(){try{const e=await Xe(this.token,this.reference,void 0,this.rdtCode,this.url);this.cardResponse=e.data,this.cardResponseHeader=e.headers}catch{this.currentStep=4}}charge3DSPayment(){const e=ja(this.token,this.reference,this.rdtCode,this.url);_.track("charge_3ds_payment",{payment_method:"Card",authentication_type:"3DS"}),e.then(async({data:t,headers:i})=>{if(this.cardResponse=t,this.cardResponseHeader=i,t.providerMessage){const s=await z(t.providerMessage,R());this.errorText=s}t.status==="failed"?(this.currentStep=4,_.track("charge_3ds_payment",{payment_method:"Card",authentication_type:"3DS",verification_status:"Failed"}),t.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue()):["success","successful"].includes(t.status)?(this.currentStep=5,_.track("charge_3ds_payment",{payment_method:"Card",authentication_type:"3DS",verification_status:"Success"}),this.redirectTo(t,i,"success")):t.status==="inProgress"?this.currentStep=10:(this.currentStep=4,_.track("charge_3ds_payment",{payment_method:"Card",authentication_type:"3DS",verification_status:"Null"}),t.providerMessage?this.warningScreen.setPaymentError(this.errorText):this.warningScreen.setPaymentError(P["payment-failed"]),this.warningScreen.hideReportIssue())}).catch(async t=>{if(_.track("charge_3ds_payment",{payment_method:"Card",authentication_type:"3DS",verification_status:"Null"}),t.message){const i=await z(t.message,R());this.errorText=i,this.currentStep=4,this.warningScreen.setPaymentError(this.errorText)}else this.currentStep=4,this.warningScreen.setPaymentError(P["payment-failed"]);this.warningScreen.hideReportIssue()})}goBackToMerchant(){if(this.isCancelledPlan){this.cancellledPlanAction();return}this.redirectTo(this.cardResponse,this.cardResponseHeader,this.callBackUrl)}renderCardContent(e){var o,a,c,l,p,m,g,b,y,w,f;e&&(this.merchantPlanDetail=e);const t=document.getElementById("test-container"),i=this.container.querySelector("#test-cards-link"),s=document.getElementById("go-back");if(this.currentStep!==1?(this.hidePaymentMethods(),s==null||s.classList.add("hidden")):this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.contents){switch(this.currentStep){case 1:this.cardDetailForm=new Qs({container:this.contents,onAction:x=>A=>this.submitCardDetails.bind(this)(x,A),merchantName:this.merchantPlanDetail.merchantName,currency:Hn(this.currency,this.localCurrency)}),this.cardDetailForm.renderContent();break;case 2:this.cardPinForm=new ur({container:this.contents,onClose:this.onClose,onAction:x=>this.handlePinRequest.bind(this)(x)}),this.cardPinForm.renderComponent();break;case 3:this.cardOtpValidationForm=new cr({container:this.contents,onClose:this.onClose,onAction:x=>A=>this.submitOtp.bind(this)(x,A),otpMessage:this.otpMessage||P["Payment failed"]}),this.cardOtpValidationForm.renderComponent();break;case 4:this.warningScreen=new en({container:this.contents,onAction:this.isMaxRetriesReached||this.isCancelledPlan?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this),onReportIssue:()=>this.currentStep=8}),this.testcardIsVisible&&(di(t),i.classList.remove("text-tone-100","font-bold")),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 5:this.successScreen=new Fn({container:this.contents,amount:((l=(c=(a=(o=this.merchantPlanDetail)==null?void 0:o.plan)==null?void 0:a.trial)==null?void 0:c.pricingList[0])==null?void 0:l.amount)??this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:(p=this.merchantPlanDetail)==null?void 0:p.rate.rate}),this.testcardIsVisible&&(di(t),i.classList.remove("text-tone-100","font-bold")),this.successScreen.renderComponent();break;case 6:this.pageLoader=new ke(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 7:this.avsForm=new pr({container:this.contents,onAction:x=>A=>this.validatedAVS.bind(this)(x,A),translatedTexts:this.translatedAvsData}),this.avsForm.renderComponent();break;case 8:this.transactionIssuesScreen=new st({container:this.contents,onAction:async()=>{var x,A;if((x=this.cardResponse)!=null&&x.providerMessage){const M=await z((A=this.cardResponse)==null?void 0:A.providerMessage,R());this.errorText=M}this.currentStep=4,this.warningScreen.setPaymentError(this.errorText||P["payment-failed"])},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"card",callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break;case 9:this.confirmationEnd=new oa({container:this.contents,onAction:x=>{this.currentStep=x},ref:this.reference,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader,paymentMethod:"Card"}),this.confirmationEnd.renderComponent();break;case 10:this.confirmationProgress=new uc({container:this.contents,onAction:x=>{this.currentStep=x},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(x,A)=>{this.cardResponse=x,this.cardResponseHeader=A},step:{failed:4,success:5,end:9},paymentMethod:"Card"}),this.testcardIsVisible&&(di(t),i.classList.remove("text-tone-100","font-bold")),this.confirmationProgress.renderComponent();break;case 11:this.isw3dsForm=new vr({container:this.contents,threeDSecureDetails:{jwt:((g=(m=this.cardResponse)==null?void 0:m.authorization)==null?void 0:g.jwt)||"",md:((y=(b=this.cardResponse)==null?void 0:b.authorization)==null?void 0:y.md)||"",acsUrl:((f=(w=this.cardResponse)==null?void 0:w.authorization)==null?void 0:f.acsUrl)||""},onAction:x=>{this.currentStep=x,x===6&&this.showLoader()},onSuccess:this.charge3DSPayment.bind(this)}),this.isw3dsForm.renderComponent();break;default:this.cardDetailForm=new Qs({container:this.contents,onAction:x=>A=>this.submitCardDetails.bind(this)(x,A),merchantName:this.merchantPlanDetail.merchantName,currency:Hn(this.currency,this.localCurrency)}),this.cardDetailForm.renderContent();break}this.displayButtonText();const k=this.container.querySelector("#card-currency");k&&(k.textContent=`${Hn(this.currency,this.localCurrency)} ${pe.card}`)}}redirectTo(e,t,i){const s=t.get("spf-redirect-url");this.callBackUrl=s||this.callBackUrl,this.callBackUrl?setTimeout(()=>{const o=new URL(this.callBackUrl);o.searchParams.append("status",e.status),o.searchParams.append("reference",e.reference),window.location.href=o.toString()},1800):i==="success"&&this.onSuccess(e)}displayButtonText(e){var i,s,o,a,c,l,p,m,g,b;const t=this.container.querySelector("#details-form-button-text");if(t){const y=(s=(i=this==null?void 0:this.merchantPlanDetail)==null?void 0:i.plan)==null?void 0:s.trial,w=(l=(c=(a=(o=this==null?void 0:this.merchantPlanDetail)==null?void 0:o.plan)==null?void 0:a.trial)==null?void 0:c.pricingList[0])==null?void 0:l.amount,f=Hn(this.currency,this.localCurrency),k=f==="USD"?(m=(p=this.merchantPlanDetail)==null?void 0:p.rate)==null?void 0:m.from:f;e?t.textContent=e:t.textContent=`${pe["continue-to"]} ${k} ${Te(y&&w!=null?w:this.totalAmount!==this.amount?this.totalAmount:(this.amount||0)*(this.currency==="USD"?(b=(g=this.merchantPlanDetail)==null?void 0:g.rate)==null?void 0:b.rate:1),2)}`}}}const bc=`<div data-section="transfer" data-section="transfer">
|
|
1573
1573
|
<div class="container-center h-[40vh] hidden" id="loader">
|
|
1574
1574
|
<img src="" alt="loader gif" />
|
|
1575
1575
|
</div>
|