@fractalpay/fractalpay-next-dev 0.0.25 → 0.0.27
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.
- package/dist/index.d.mts +25 -13
- package/dist/index.d.ts +25 -13
- package/dist/index.js +606 -12
- package/dist/index.mjs +610 -16
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Tn=Object.defineProperty,$n=Object.defineProperties;var Bn=Object.getOwnPropertyDescriptors;var sn=Object.getOwnPropertySymbols;var Cn=Object.prototype.hasOwnProperty,wn=Object.prototype.propertyIsEnumerable;var vn=(e,F,T)=>F in e?Tn(e,F,{enumerable:!0,configurable:!0,writable:!0,value:T}):e[F]=T,S=(e,F)=>{for(var T in F||(F={}))Cn.call(F,T)&&vn(e,T,F[T]);if(sn)for(var T of sn(F))wn.call(F,T)&&vn(e,T,F[T]);return e},L=(e,F)=>$n(e,Bn(F));var ln=(e,F)=>{var T={};for(var V in e)Cn.call(e,V)&&F.indexOf(V)<0&&(T[V]=e[V]);if(e!=null&&sn)for(var V of sn(e))F.indexOf(V)<0&&wn.call(e,V)&&(T[V]=e[V]);return T};import"bootstrap/dist/js/bootstrap.bundle.min.js";import k,{useState as jt,useEffect as Un}from"react";import Bt from"react";import Hn from"react";var jn=e=>Hn.createElement("style",null,`
|
|
2
2
|
|
|
3
3
|
.loader {
|
|
4
4
|
position: fixed; /* Fixed position to cover the viewport */
|
|
@@ -81,7 +81,7 @@ var zn=Object.defineProperty,In=Object.defineProperties;var qn=Object.getOwnProp
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
`),
|
|
84
|
+
`),Nn=jn;var Vn=e=>Bt.createElement(Bt.Fragment,null,Bt.createElement(Nn,null),(e==null?void 0:e.loading)&&Bt.createElement("div",{className:"loader"},Bt.createElement("div",{className:"lds-ellipsis"},Bt.createElement("div",null),Bt.createElement("div",null),Bt.createElement("div",null),Bt.createElement("div",null)))),xt=Vn;var Yt="https://api-dev.merchant-trends.com/",ue="https://fractal-userdata-upload.s3.us-east-1.amazonaws.com/",Be="https://dev-sky-node.fractalpay.com/",He="https://dev-widget.fractalpay.com/";var Qe={namerequired:"Full Name is required",amountrequired:"Amount is required",amountpositive:"Amount should be positive",amountzero:"Amount should not be zero",amountenter:"Please enter an amount",amountvalid:"Please enter a valid amount",phoneoremailrequired:"Phone or Email is required",invalidemail:"Please enter a valid email",invalidemailformat:"Invalid email format",onlylettersallowed:"Only letters are allowed",phonenumberlength:"Phone number should be 10 digits",phonenumberrequired:"Please enter a phone number",phonenumbervalid:"Please enter a valid phone number",phonenumbervalidnumberonly:"Please enter a valid phone number (numbers only)",orderidenter:"Please enter an order ID",orderidrequired:"Order ID is required",networkresponseerror:"Network response was not ok",anerroroccured:"An error occurred. Please try again.",montherror:"Please write month only 1 to 12",fieldrequired:"This field is required",fractalpayclientidrequired:"Fractalpay client key is missing or empty."};import Qt from"react";import Kn from"react";var En=e=>Kn.createElement("style",null,`
|
|
85
85
|
.fractal-input::placeholder {
|
|
86
86
|
color: #35254D;
|
|
87
87
|
opacity: 1;
|
|
@@ -334,7 +334,7 @@ var zn=Object.defineProperty,In=Object.defineProperties;var qn=Object.getOwnProp
|
|
|
334
334
|
padding: 0px !important;
|
|
335
335
|
border-radius: 12px !important;
|
|
336
336
|
}
|
|
337
|
-
`),
|
|
337
|
+
`),kn=En;var Zn=({open:e,onClose:F,children:T,maxWidth:V})=>e?Qt.createElement(Qt.Fragment,null,Qt.createElement(kn,null),Qt.createElement("div",{className:"fractal-popup"},Qt.createElement("div",{className:"fractal-popup-content request-payment-popup-container",style:{maxWidth:`${V!=null?V:"auto"}`}},T))):null,kt=Zn;import Gn from"axios";import{PatternFormat as Jn}from"react-number-format";import On from"react";var Wn=e=>On.createElement("style",null,`
|
|
338
338
|
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
|
|
339
339
|
body {
|
|
340
340
|
font-family: 'Inter', sans-serif !important;
|
|
@@ -575,7 +575,7 @@ var zn=Object.defineProperty,In=Object.defineProperties;var qn=Object.getOwnProp
|
|
|
575
575
|
|
|
576
576
|
font-size: 12px;
|
|
577
577
|
}
|
|
578
|
-
`),an=Vn;function On(e){let N=e.merchantPublicKey,Y=e==null?void 0:e.discount,j=e==null?void 0:e.tax,q=e==null?void 0:e.surcharge,[pe,F]=zt(!1),[Le,ee]=zt(!1),[r,d]=zt({}),[y,p]=zt(null),[u,he]=zt({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:N}),[te,E]=zt(""),[fe,le]=zt(!1),[Me,Ce]=zt(null),we=c=>/^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(c),ot=/[+-]?([0-9]*[.])?[0-9]+/,Ye=c=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(c),Ee=c=>/^[A-Za-z\s]*$/.test(c),f=()=>{F(!1),d({})},Fe=()=>F(!0),h=()=>{console.log(Me,"apiresponse"),m(Me),le(!1)};function i(){he({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:N}),E("")}function m(c){let o={type:"preview.compiledcheck",other:A(I({},c),{status:!0})};window.parent.postMessage(o,"*")}let B=async()=>{if(!(Object.keys(r).length>0)){if(d({}),!(u!=null&&u.email)&&y&&!we(y)){d(c=>A(I({},c),{phone:ve.phonenumbervalid}));return}if(_())try{ee(!0);let c={fractalpayPublicKey:N,amount:te,phone_number:y,order_id:u.order_id,action:"request",name:u.name,email:u.email,customer_id:e!=null&&e.customerId?e==null?void 0:e.customerId:"",discount:Y,surcharge:q,tax:j,require_3ds:e==null?void 0:e.require_3ds},o=await Zn.post(`${re}create-widget-order`,c);(o==null?void 0:o.status)===200&&(le(!0),F(!1),i(),Ce(o==null?void 0:o.data)),ee(!1)}catch(c){console.log(c),ee(!1)}}},P=re+"images/logo-img.png",s=c=>{let{value:o}=c.target,M=c.target.dataset.token;if(he(A(I({},u),{[M]:o})),M==="name"&&!Ee(o)){d(Ne=>A(I({},Ne),{[M]:ve.onlylettersallowed}));return}let z=r;M==="email"&&!y&&(delete z.phone,d(z)),o&&(delete z[M],d(z)),M==="email"&&!o&&(delete z[M],d(z))},S=c=>{let{value:o}=c;if(Number(o)>0){let M=r;delete M.amount,d(M)}E(o)},_=()=>{let c={};return te||(c.amount=ve.amountrequired),u.email&&!Ye(u==null?void 0:u.email)&&(c.email=ve.invalidemail),!y&&!(u!=null&&u.email)&&(c.phone=ve.phoneoremailrequired),!y&&!(u!=null&&u.email)&&(c.email=ve.phoneoremailrequired),!y&&u.email&&!Ye(u==null?void 0:u.email)&&(c.email=ve.invalidemail),e.from==="merchant"&&!u.order_id&&(c.order_id=ve.orderidrequired),d(c),Object.keys(c).length===0};Kn(()=>{e&&(he(c=>A(I({},c),{order_id:e.orderID?e.orderID:"",name:e!=null&&e.name?e==null?void 0:e.name:"",email:e!=null&&e.email?e==null?void 0:e.email:""})),E(e.amount?e.amount:""),p(e.phone?`${e.phone}`:null))},[e]);let V=c=>{let o=c==null?void 0:c.value;if(o&&(o==null?void 0:o.length)>0&&(o==null?void 0:o.length)!==10){d(z=>A(I({},z),{phone:ve.phonenumberlength})),p(o);return}else p(o);let M=r;delete M.phone,o&&!(u!=null&&u.email)&&delete M.email,d(M)};function k(c){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(c))}return b.createElement(b.Fragment,null,b.createElement(an,null),b.createElement(dt,{loading:Le}),b.createElement(b.Fragment,null,b.createElement("button",{className:"paymentBtn",onClick:Fe},"Request Payment"),b.createElement(wt,{open:pe,onClose:()=>F(!1),maxWidth:"500px"},b.createElement("div",{style:{maxWidth:"500px"}},b.createElement("div",{className:"request-payment-amount-detail frac-form"},b.createElement("p",{className:"request-payment-merchantname"},"Pay ",e==null?void 0:e.webname),b.createElement("p",{className:"request-payment-amount"},k(e==null?void 0:e.amount)),(e==null?void 0:e.from)==="merchant"&&b.createElement("p",{className:"request-payment-orderid"},u==null?void 0:u.order_id),b.createElement("span",{className:"request-payment-close-popup",onClick:f},b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},b.createElement("g",{clipPath:"url(#clip0_12425_52336)"},b.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),b.createElement("defs",null,b.createElement("clipPath",{id:"clip0_12425_52336"},b.createElement("rect",{width:"16",height:"16",fill:"white"})))))),b.createElement("form",{className:"request-payment-input-form"},b.createElement("div",{className:"request-payment-list-div"},b.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"FULL NAME"),b.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Full Name","data-token":"name",onChange:s,value:u==null?void 0:u.name}),r.name&&b.createElement("small",{className:"request-payment-error-msg"},r.name)),b.createElement("div",{className:"request-payment-list-div"},b.createElement("label",{htmlFor:"requestPhoneNumber",className:"request-payment-input-label"},"Phone Number"),b.createElement(En,{className:"request-payment-input-box",placeholder:"Mobile number",format:"+1 (###) ###-####",value:y,onValueChange:c=>{V(c)}}),r.phone&&b.createElement("small",{className:"request-payment-error-msg"},r.phone)),b.createElement("div",{className:"request-payment-list-div"},b.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"EMAIL"),b.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Email",onChange:s,"data-token":"email",value:u==null?void 0:u.email}),r.email&&b.createElement("small",{className:"request-payment-error-msg"},r.email)),b.createElement("button",{type:"button",className:"request-payment-submit-button",onClick:B,disabled:Le},Le?"Loading...":"Send Request"),b.createElement("div",{className:"request-payment-fractal-powerd-by"},b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},b.createElement("path",{d:"M15.2165 4.11839C15.1973 3.69746 15.1973 3.29567 15.1973 2.89387C15.1973 2.56861 14.9486 2.31988 14.6234 2.31988C12.2317 2.31988 10.4141 1.63109 8.90257 0.157848C8.67298 -0.0526158 8.32858 -0.0526158 8.09898 0.157848C6.58748 1.63109 4.76984 2.31988 2.37821 2.31988C2.05295 2.31988 1.80422 2.56861 1.80422 2.89387C1.80422 3.29567 1.80422 3.69746 1.78508 4.11839C1.70855 8.13632 1.59375 13.6466 8.30945 15.9617L8.50078 16L8.69211 15.9617C15.3887 13.6466 15.293 8.15546 15.2165 4.11839ZM8.04159 9.6861C7.92679 9.78176 7.79286 9.83916 7.63979 9.83916H7.62066C7.46759 9.83916 7.31453 9.76263 7.21887 9.64783L5.43949 7.67713L6.30048 6.91181L7.69719 8.46158L10.7967 5.5151L11.5812 6.35695L8.04159 9.6861Z",fill:"#727272"})),"Secure payments powered by ",b.createElement("span",null,"Fractal"),b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},b.createElement("path",{d:"M17.4999 5.49758V7.01156C17.4999 7.05924 17.4595 7.09898 17.411 7.09898H12.3516C12.9169 6.54266 13.4781 5.99032 14.0434 5.434C14.0596 5.4181 14.0838 5.41016 14.104 5.41016H17.411C17.4595 5.41016 17.4999 5.44989 17.4999 5.49758Z",fill:"#61C699"}),b.createElement("path",{d:"M12.3462 10.9037V9.29836C12.3462 9.25067 12.3866 9.21094 12.435 9.21094H13.8523C13.929 9.21094 13.9694 9.30631 13.9129 9.35796C13.392 9.87455 12.8711 10.3911 12.3462 10.9037Z",fill:"#61C699"}),b.createElement("path",{d:"M12.4404 9.00523H15.6949C15.7434 9.00523 15.7838 8.96549 15.7838 8.91781V7.40383C15.7838 7.35614 15.7434 7.31641 15.6949 7.31641H12.4404C12.3919 7.31641 12.3516 7.35614 12.3516 7.40383V8.91781C12.3516 8.96549 12.3919 9.00523 12.4404 9.00523Z",fill:"#61C699"}),b.createElement("path",{d:"M10.1581 0.0120725L11.4906 0.77105C11.531 0.794892 11.5471 0.84655 11.5229 0.890261L8.99114 5.20173C8.78521 4.44275 8.57927 3.68775 8.37334 2.92877C8.36527 2.90493 8.3693 2.88109 8.38142 2.86122L10.0329 0.0438621C10.0612 0.000151419 10.1177 -0.0117697 10.1581 0.0120725Z",fill:"#61C699"}),b.createElement("path",{d:"M12.3382 7.10006L10.9289 6.29737C10.8886 6.27353 10.8724 6.22187 10.8966 6.17816L11.6033 4.97015C11.6436 4.9026 11.7446 4.91452 11.7648 4.99002C11.9546 5.69734 12.1484 6.40068 12.3382 7.10006Z",fill:"#61C699"}),b.createElement("path",{d:"M10.7107 6.0771L12.338 3.30345C12.3622 3.26372 12.346 3.20808 12.3057 3.18424L10.9732 2.42526C10.9328 2.40142 10.8763 2.41732 10.852 2.45705L9.22476 5.2307C9.20053 5.27044 9.21669 5.32607 9.25706 5.34991L10.5896 6.10889C10.634 6.13273 10.6865 6.11683 10.7107 6.0771Z",fill:"#61C699"}),b.createElement("path",{d:"M1.66713 3.51237L2.99963 2.75339C3.04001 2.72955 3.09654 2.74544 3.12077 2.78518L5.65251 7.09665C4.88128 6.89399 4.11408 6.69133 3.34285 6.48867C3.31862 6.4847 3.30247 6.4688 3.29036 6.44893L1.63483 3.63158C1.6106 3.58787 1.62271 3.53621 1.66713 3.51237Z",fill:"#61C699"}),b.createElement("path",{d:"M8.99793 5.20018L7.58871 5.99889C7.54833 6.02274 7.4918 6.00684 7.46757 5.9671L6.76095 4.76307C6.72057 4.69552 6.78517 4.61605 6.86189 4.63591C7.57256 4.82268 8.28726 5.00944 8.99793 5.20018Z",fill:"#61C699"}),b.createElement("path",{d:"M7.27986 6.07054L5.6526 3.2969C5.62837 3.25716 5.57588 3.24127 5.53146 3.26511L4.19896 4.02409C4.15858 4.04793 4.14243 4.09959 4.16666 4.1433L5.79392 6.91694C5.81815 6.95668 5.87064 6.97257 5.91506 6.94873L7.24756 6.18975C7.28794 6.16591 7.30409 6.11425 7.27986 6.07054Z",fill:"#61C699"}),b.createElement("path",{d:"M0.5 12.4998V10.9859C0.5 10.9382 0.540379 10.8984 0.588833 10.8984H5.64829C5.08299 11.4548 4.52172 12.0071 3.95642 12.5634C3.94027 12.5793 3.91604 12.5873 3.89585 12.5873H0.588833C0.540379 12.5873 0.5 12.5475 0.5 12.4998Z",fill:"#61C699"}),b.createElement("path",{d:"M5.65129 7.09766V8.70303C5.65129 8.75072 5.61091 8.79045 5.56246 8.79045H4.14516C4.06844 8.79045 4.02806 8.69508 4.08459 8.64343C4.60548 8.12685 5.12637 7.61424 5.65129 7.09766Z",fill:"#61C699"}),b.createElement("path",{d:"M5.55967 8.99609H2.30514C2.25669 8.99609 2.21631 9.03583 2.21631 9.08352V10.5975C2.21631 10.6452 2.25669 10.6849 2.30514 10.6849H5.55967C5.60813 10.6849 5.6485 10.6452 5.6485 10.5975V9.08352C5.6485 9.03583 5.60813 8.99609 5.55967 8.99609Z",fill:"#61C699"}),b.createElement("path",{d:"M7.82638 17.9865L6.49388 17.2276C6.4535 17.2037 6.43735 17.1521 6.46158 17.1083L8.99333 12.7969C9.19926 13.5559 9.40519 14.3109 9.61112 15.0698C9.6192 15.0937 9.61516 15.1175 9.60305 15.1374L7.95155 17.9547C7.91925 17.9985 7.86676 18.0104 7.82638 17.9865Z",fill:"#61C699"}),b.createElement("path",{d:"M5.64795 10.8984L7.05717 11.7011C7.09755 11.725 7.1137 11.7766 7.08947 11.8203L6.38284 13.0283C6.34246 13.0959 6.24152 13.084 6.22133 13.0085C6.02751 12.3012 5.83773 11.5978 5.64795 10.8984Z",fill:"#61C699"}),b.createElement("path",{d:"M7.2739 11.9258L5.64664 14.6994C5.62241 14.7392 5.63856 14.7948 5.67894 14.8187L7.01144 15.5776C7.05182 15.6015 7.10835 15.5856 7.13258 15.5458L8.75984 12.7722C8.78407 12.7325 8.76792 12.6768 8.72754 12.653L7.39504 11.894C7.35062 11.8702 7.29813 11.8861 7.2739 11.9258Z",fill:"#61C699"}),b.createElement("path",{d:"M16.3199 14.4866L14.9874 15.2456C14.947 15.2694 14.8904 15.2535 14.8662 15.2138L12.3345 10.9023C13.1057 11.105 13.8729 11.3077 14.6441 11.5103C14.6684 11.5143 14.6845 11.5302 14.6966 11.5501L16.3481 14.3674C16.3764 14.4111 16.3643 14.4628 16.3199 14.4866Z",fill:"#61C699"}),b.createElement("path",{d:"M8.99121 12.7983L10.4004 11.9956C10.4408 11.9717 10.4973 11.9876 10.5216 12.0274L11.2282 13.2354C11.2686 13.3029 11.204 13.3824 11.1272 13.3625C10.4166 13.1758 9.70188 12.989 8.99121 12.7983Z",fill:"#61C699"}),b.createElement("path",{d:"M10.7077 11.9285L12.3349 14.7021C12.3592 14.7418 12.4117 14.7577 12.4561 14.7339L13.7886 13.9749C13.829 13.9511 13.8451 13.8994 13.8209 13.8557L12.1936 11.0821C12.1694 11.0423 12.1169 11.0264 12.0725 11.0503L10.74 11.8092C10.6996 11.8331 10.6834 11.8847 10.7077 11.9285Z",fill:"#61C699"})))))),b.createElement(wt,{open:fe,onClose:h,maxWidth:"500px"},b.createElement("div",{className:"fractal-popup-content",style:{padding:"0px",maxWidth:"500px"}},b.createElement("div",{className:"request-payment-success-container"},b.createElement("span",{className:"request-payment-close-popup",onClick:h},b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},b.createElement("g",{clipPath:"url(#clip0_12425_52336)"},b.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),b.createElement("defs",null,b.createElement("clipPath",{id:"clip0_12425_52336"},b.createElement("rect",{width:"16",height:"16",fill:"white"}))))),b.createElement("div",{className:"request-payment-success-tick-div"},b.createElement("div",{className:"request-payment-success-tick"},b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},b.createElement("path",{d:"M6.12669 13.9774C5.97396 14.131 5.76558 14.2167 5.54913 14.2167C5.33267 14.2167 5.1243 14.131 4.97157 13.9774L0.359012 9.36408C-0.119671 8.8854 -0.119671 8.10919 0.359012 7.6314L0.936573 7.05369C1.4154 6.57501 2.19072 6.57501 2.6694 7.05369L5.54913 9.93357L13.3306 2.15198C13.8094 1.6733 14.5855 1.6733 15.0634 2.15198L15.641 2.72969C16.1196 3.20837 16.1196 3.98444 15.641 4.46237L6.12669 13.9774Z",fill:"#61C699"})))),b.createElement("h6",{className:"request-payment-success-text"},"The request ",b.createElement("br",null),"was sent"),b.createElement("h6",{className:"request-payment-success-subtext"},"Please wait for the customer to pay"),b.createElement("div",{className:"request-payment-success-btn-div"},b.createElement("button",{onClick:h,className:"request-payment-success-btn2"},"Close")))))))}import"bootstrap/dist/js/bootstrap.bundle.min.js";import x,{useState as It,useEffect as Wn}from"react";import Gn from"axios";import{PatternFormat as Un}from"react-number-format";function Jn(e){let N=e.merchantPublicKey,Y=e==null?void 0:e.discount,j=e==null?void 0:e.tax,q=e==null?void 0:e.surcharge,[pe,F]=It(!1),[Le,ee]=It(!1),[r,d]=It({}),[y,p]=It(null),[u,he]=It({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:N}),[te,E]=It(""),[fe,le]=It(!1),[Me,Ce]=It(null),we=c=>/^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(c),ot=/[+-]?([0-9]*[.])?[0-9]+/,Ye=c=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(c),Ee=c=>/^[A-Za-z\s]*$/.test(c),f=()=>{F(!1),d({})},Fe=()=>F(!0),h=()=>{console.log(Me,"apiresponse"),m(Me),le(!1)};function i(){he({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:N}),E("")}function m(c){let o={type:"preview.compiledcheck",other:A(I({},c),{status:!0})};window.parent.postMessage(o,"*")}let B=async()=>{if(!(Object.keys(r).length>0)){if(d({}),!(u!=null&&u.email)&&y&&!we(y)){d(c=>A(I({},c),{phone:ve.phonenumbervalid}));return}if(_())try{ee(!0);let c={fractalpayPublicKey:N,amount:te,phone_number:y,order_id:u.order_id,action:"request",name:u.name,email:u.email,customer_id:e!=null&&e.customerId?e==null?void 0:e.customerId:"",discount:Y,surcharge:q,tax:j,require_3ds:e==null?void 0:e.require_3ds},o=await Gn.post(`${re}send-request-pre-auth-payment`,c);(o==null?void 0:o.status)===200&&(le(!0),F(!1),i(),Ce(o==null?void 0:o.data)),ee(!1)}catch(c){console.log(c),ee(!1)}}},P=re+"images/logo-img.png",s=c=>{let{value:o}=c.target,M=c.target.dataset.token;if(he(A(I({},u),{[M]:o})),M==="name"&&!Ee(o)){d(Ne=>A(I({},Ne),{[M]:ve.onlylettersallowed}));return}let z=r;M==="email"&&!y&&(delete z.phone,d(z)),o&&(delete z[M],d(z)),M==="email"&&!o&&(delete z[M],d(z))},S=c=>{let{value:o}=c;if(Number(o)>0){let M=r;delete M.amount,d(M)}E(o)},_=()=>{let c={};return te||(c.amount=ve.amountrequired),u.email&&!Ye(u==null?void 0:u.email)&&(c.email=ve.invalidemail),!y&&!(u!=null&&u.email)&&(c.phone=ve.phoneoremailrequired),!y&&!(u!=null&&u.email)&&(c.email=ve.phoneoremailrequired),!y&&u.email&&!Ye(u==null?void 0:u.email)&&(c.email=ve.invalidemail),e.from==="merchant"&&!u.order_id&&(c.order_id=ve.orderidrequired),d(c),Object.keys(c).length===0};Wn(()=>{e&&(he(c=>A(I({},c),{order_id:e.orderID?e.orderID:"",name:e!=null&&e.name?e==null?void 0:e.name:"",email:e!=null&&e.email?e==null?void 0:e.email:""})),E(e.amount?e.amount:""),p(e.phone?`${e.phone}`:null))},[e]);let V=c=>{let o=c==null?void 0:c.value;if(o&&(o==null?void 0:o.length)>0&&(o==null?void 0:o.length)!==10){d(z=>A(I({},z),{phone:ve.phonenumberlength})),p(o);return}else p(o);let M=r;delete M.phone,o&&!(u!=null&&u.email)&&delete M.email,d(M)};function k(c){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(c))}return x.createElement(x.Fragment,null,x.createElement(an,null),x.createElement(dt,{loading:Le}),x.createElement(x.Fragment,null,x.createElement("button",{className:"paymentBtn",onClick:Fe},"Send Request"),x.createElement("div",{className:"frac-form"},x.createElement(wt,{open:pe,onClose:()=>F(!1),maxWidth:"500px"},x.createElement("div",{className:"request-payment-amount-detail"},x.createElement("p",{className:"request-payment-merchantname"},"Authorization Request"),x.createElement("p",{className:"request-payment-pre-auth-merchantname"},"Pay ",e==null?void 0:e.webname),x.createElement("p",{className:"request-payment-amount"},k(e==null?void 0:e.amount)),(e==null?void 0:e.from)==="merchant"&&x.createElement("p",{className:"request-payment-orderid"},u==null?void 0:u.order_id),x.createElement("span",{className:"request-payment-close-popup",onClick:f},x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},x.createElement("g",{clipPath:"url(#clip0_12425_52336)"},x.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),x.createElement("defs",null,x.createElement("clipPath",{id:"clip0_12425_52336"},x.createElement("rect",{width:"16",height:"16",fill:"white"})))))),x.createElement("form",{className:"request-payment-input-form"},x.createElement("div",{className:"request-payment-list-div"},x.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"FULL NAME"),x.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Full Name","data-token":"name",onChange:s,value:u==null?void 0:u.name}),r.name&&x.createElement("small",{className:"request-payment-error-msg"},r.name)),x.createElement("div",{className:"request-payment-list-div"},x.createElement("label",{htmlFor:"requestPhoneNumber",className:"request-payment-input-label"},"Phone Number"),x.createElement(Un,{className:"request-payment-input-box",placeholder:"Mobile number",format:"+1 (###) ###-####",value:y,onValueChange:c=>{V(c)}}),r.phone&&x.createElement("small",{className:"request-payment-error-msg"},r.phone)),x.createElement("div",{className:"request-payment-list-div"},x.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"EMAIL"),x.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Email",onChange:s,"data-token":"email",value:u==null?void 0:u.email}),r.email&&x.createElement("small",{className:"request-payment-error-msg"},r.email)),x.createElement("button",{type:"button",className:"request-payment-submit-button",onClick:B,disabled:Le},Le?"Loading...":"Send Request"),x.createElement("div",{className:"request-payment-fractal-powerd-by"},x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},x.createElement("path",{d:"M15.2165 4.11839C15.1973 3.69746 15.1973 3.29567 15.1973 2.89387C15.1973 2.56861 14.9486 2.31988 14.6234 2.31988C12.2317 2.31988 10.4141 1.63109 8.90257 0.157848C8.67298 -0.0526158 8.32858 -0.0526158 8.09898 0.157848C6.58748 1.63109 4.76984 2.31988 2.37821 2.31988C2.05295 2.31988 1.80422 2.56861 1.80422 2.89387C1.80422 3.29567 1.80422 3.69746 1.78508 4.11839C1.70855 8.13632 1.59375 13.6466 8.30945 15.9617L8.50078 16L8.69211 15.9617C15.3887 13.6466 15.293 8.15546 15.2165 4.11839ZM8.04159 9.6861C7.92679 9.78176 7.79286 9.83916 7.63979 9.83916H7.62066C7.46759 9.83916 7.31453 9.76263 7.21887 9.64783L5.43949 7.67713L6.30048 6.91181L7.69719 8.46158L10.7967 5.5151L11.5812 6.35695L8.04159 9.6861Z",fill:"#727272"})),"Secure payments powered by ",x.createElement("span",null,"Fractal"),x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},x.createElement("path",{d:"M17.4999 5.49758V7.01156C17.4999 7.05924 17.4595 7.09898 17.411 7.09898H12.3516C12.9169 6.54266 13.4781 5.99032 14.0434 5.434C14.0596 5.4181 14.0838 5.41016 14.104 5.41016H17.411C17.4595 5.41016 17.4999 5.44989 17.4999 5.49758Z",fill:"#61C699"}),x.createElement("path",{d:"M12.3462 10.9037V9.29836C12.3462 9.25067 12.3866 9.21094 12.435 9.21094H13.8523C13.929 9.21094 13.9694 9.30631 13.9129 9.35796C13.392 9.87455 12.8711 10.3911 12.3462 10.9037Z",fill:"#61C699"}),x.createElement("path",{d:"M12.4404 9.00523H15.6949C15.7434 9.00523 15.7838 8.96549 15.7838 8.91781V7.40383C15.7838 7.35614 15.7434 7.31641 15.6949 7.31641H12.4404C12.3919 7.31641 12.3516 7.35614 12.3516 7.40383V8.91781C12.3516 8.96549 12.3919 9.00523 12.4404 9.00523Z",fill:"#61C699"}),x.createElement("path",{d:"M10.1581 0.0120725L11.4906 0.77105C11.531 0.794892 11.5471 0.84655 11.5229 0.890261L8.99114 5.20173C8.78521 4.44275 8.57927 3.68775 8.37334 2.92877C8.36527 2.90493 8.3693 2.88109 8.38142 2.86122L10.0329 0.0438621C10.0612 0.000151419 10.1177 -0.0117697 10.1581 0.0120725Z",fill:"#61C699"}),x.createElement("path",{d:"M12.3382 7.10006L10.9289 6.29737C10.8886 6.27353 10.8724 6.22187 10.8966 6.17816L11.6033 4.97015C11.6436 4.9026 11.7446 4.91452 11.7648 4.99002C11.9546 5.69734 12.1484 6.40068 12.3382 7.10006Z",fill:"#61C699"}),x.createElement("path",{d:"M10.7107 6.0771L12.338 3.30345C12.3622 3.26372 12.346 3.20808 12.3057 3.18424L10.9732 2.42526C10.9328 2.40142 10.8763 2.41732 10.852 2.45705L9.22476 5.2307C9.20053 5.27044 9.21669 5.32607 9.25706 5.34991L10.5896 6.10889C10.634 6.13273 10.6865 6.11683 10.7107 6.0771Z",fill:"#61C699"}),x.createElement("path",{d:"M1.66713 3.51237L2.99963 2.75339C3.04001 2.72955 3.09654 2.74544 3.12077 2.78518L5.65251 7.09665C4.88128 6.89399 4.11408 6.69133 3.34285 6.48867C3.31862 6.4847 3.30247 6.4688 3.29036 6.44893L1.63483 3.63158C1.6106 3.58787 1.62271 3.53621 1.66713 3.51237Z",fill:"#61C699"}),x.createElement("path",{d:"M8.99793 5.20018L7.58871 5.99889C7.54833 6.02274 7.4918 6.00684 7.46757 5.9671L6.76095 4.76307C6.72057 4.69552 6.78517 4.61605 6.86189 4.63591C7.57256 4.82268 8.28726 5.00944 8.99793 5.20018Z",fill:"#61C699"}),x.createElement("path",{d:"M7.27986 6.07054L5.6526 3.2969C5.62837 3.25716 5.57588 3.24127 5.53146 3.26511L4.19896 4.02409C4.15858 4.04793 4.14243 4.09959 4.16666 4.1433L5.79392 6.91694C5.81815 6.95668 5.87064 6.97257 5.91506 6.94873L7.24756 6.18975C7.28794 6.16591 7.30409 6.11425 7.27986 6.07054Z",fill:"#61C699"}),x.createElement("path",{d:"M0.5 12.4998V10.9859C0.5 10.9382 0.540379 10.8984 0.588833 10.8984H5.64829C5.08299 11.4548 4.52172 12.0071 3.95642 12.5634C3.94027 12.5793 3.91604 12.5873 3.89585 12.5873H0.588833C0.540379 12.5873 0.5 12.5475 0.5 12.4998Z",fill:"#61C699"}),x.createElement("path",{d:"M5.65129 7.09766V8.70303C5.65129 8.75072 5.61091 8.79045 5.56246 8.79045H4.14516C4.06844 8.79045 4.02806 8.69508 4.08459 8.64343C4.60548 8.12685 5.12637 7.61424 5.65129 7.09766Z",fill:"#61C699"}),x.createElement("path",{d:"M5.55967 8.99609H2.30514C2.25669 8.99609 2.21631 9.03583 2.21631 9.08352V10.5975C2.21631 10.6452 2.25669 10.6849 2.30514 10.6849H5.55967C5.60813 10.6849 5.6485 10.6452 5.6485 10.5975V9.08352C5.6485 9.03583 5.60813 8.99609 5.55967 8.99609Z",fill:"#61C699"}),x.createElement("path",{d:"M7.82638 17.9865L6.49388 17.2276C6.4535 17.2037 6.43735 17.1521 6.46158 17.1083L8.99333 12.7969C9.19926 13.5559 9.40519 14.3109 9.61112 15.0698C9.6192 15.0937 9.61516 15.1175 9.60305 15.1374L7.95155 17.9547C7.91925 17.9985 7.86676 18.0104 7.82638 17.9865Z",fill:"#61C699"}),x.createElement("path",{d:"M5.64795 10.8984L7.05717 11.7011C7.09755 11.725 7.1137 11.7766 7.08947 11.8203L6.38284 13.0283C6.34246 13.0959 6.24152 13.084 6.22133 13.0085C6.02751 12.3012 5.83773 11.5978 5.64795 10.8984Z",fill:"#61C699"}),x.createElement("path",{d:"M7.2739 11.9258L5.64664 14.6994C5.62241 14.7392 5.63856 14.7948 5.67894 14.8187L7.01144 15.5776C7.05182 15.6015 7.10835 15.5856 7.13258 15.5458L8.75984 12.7722C8.78407 12.7325 8.76792 12.6768 8.72754 12.653L7.39504 11.894C7.35062 11.8702 7.29813 11.8861 7.2739 11.9258Z",fill:"#61C699"}),x.createElement("path",{d:"M16.3199 14.4866L14.9874 15.2456C14.947 15.2694 14.8904 15.2535 14.8662 15.2138L12.3345 10.9023C13.1057 11.105 13.8729 11.3077 14.6441 11.5103C14.6684 11.5143 14.6845 11.5302 14.6966 11.5501L16.3481 14.3674C16.3764 14.4111 16.3643 14.4628 16.3199 14.4866Z",fill:"#61C699"}),x.createElement("path",{d:"M8.99121 12.7983L10.4004 11.9956C10.4408 11.9717 10.4973 11.9876 10.5216 12.0274L11.2282 13.2354C11.2686 13.3029 11.204 13.3824 11.1272 13.3625C10.4166 13.1758 9.70188 12.989 8.99121 12.7983Z",fill:"#61C699"}),x.createElement("path",{d:"M10.7077 11.9285L12.3349 14.7021C12.3592 14.7418 12.4117 14.7577 12.4561 14.7339L13.7886 13.9749C13.829 13.9511 13.8451 13.8994 13.8209 13.8557L12.1936 11.0821C12.1694 11.0423 12.1169 11.0264 12.0725 11.0503L10.74 11.8092C10.6996 11.8331 10.6834 11.8847 10.7077 11.9285Z",fill:"#61C699"}))))),x.createElement(wt,{open:fe,onClose:h,maxWidth:"500px"},x.createElement("div",{className:"fractal-popup-content",style:{padding:"0px",maxWidth:"500px"}},x.createElement("div",{className:"request-payment-success-container"},x.createElement("span",{className:"request-payment-close-popup",onClick:h},x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},x.createElement("g",{clipPath:"url(#clip0_12425_52336)"},x.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),x.createElement("defs",null,x.createElement("clipPath",{id:"clip0_12425_52336"},x.createElement("rect",{width:"16",height:"16",fill:"white"}))))),x.createElement("div",{className:"request-payment-success-tick-div"},x.createElement("div",{className:"request-payment-success-tick"},x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},x.createElement("path",{d:"M6.12669 13.9774C5.97396 14.131 5.76558 14.2167 5.54913 14.2167C5.33267 14.2167 5.1243 14.131 4.97157 13.9774L0.359012 9.36408C-0.119671 8.8854 -0.119671 8.10919 0.359012 7.6314L0.936573 7.05369C1.4154 6.57501 2.19072 6.57501 2.6694 7.05369L5.54913 9.93357L13.3306 2.15198C13.8094 1.6733 14.5855 1.6733 15.0634 2.15198L15.641 2.72969C16.1196 3.20837 16.1196 3.98444 15.641 4.46237L6.12669 13.9774Z",fill:"#61C699"})))),x.createElement("h6",{className:"request-payment-success-text"},"The request ",x.createElement("br",null),"was sent"),x.createElement("h6",{className:"request-payment-success-subtext"},"Please wait for the customer to pay"),x.createElement("div",{className:"request-payment-success-btn-div"},x.createElement("button",{onClick:h,className:"request-payment-success-btn2"},"Close"))))))))}import t,{useEffect as ni,useState as Pe}from"react";import Xn from"react";function Ut(){let e="#000",N="#fff",Y="#212529",j="#dee2e6";return Xn.createElement("style",null,`
|
|
578
|
+
`),dn=Wn;function Xn(e){let F=e.merchantPublicKey,T=e==null?void 0:e.discount,V=e==null?void 0:e.tax,$=e==null?void 0:e.surcharge,[je,q]=jt(!1),[De,de]=jt(!1),[R,n]=jt({}),[K,d]=jt(null),[f,i]=jt({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:F}),[pe,v]=jt(""),[fe,we]=jt(!1),[Oe,Ve]=jt(null),ve=c=>/^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(c),nt=/[+-]?([0-9]*[.])?[0-9]+/,Ke=c=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(c),at=c=>/^[A-Za-z\s]*$/.test(c),y=()=>{q(!1),n({})},We=()=>q(!0),E=()=>{console.log(Oe,"apiresponse"),x(Oe),we(!1)};function _(){i({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:F}),v("")}function x(c){let l={type:"preview.compiledcheck",other:L(S({},c),{status:!0})};window.parent.postMessage(l,"*")}let ie=async()=>{if(!(Object.keys(R).length>0)){if(n({}),!(f!=null&&f.email)&&K&&!ve(K)){n(c=>L(S({},c),{phone:Qe.phonenumbervalid}));return}if(b())try{de(!0);let c={fractalpayPublicKey:F,amount:pe,phone_number:K,order_id:f.order_id,action:"request",name:f.name,email:f.email,customer_id:e!=null&&e.customerId?e==null?void 0:e.customerId:"",discount:T,surcharge:$,tax:V,require_3ds:e==null?void 0:e.require_3ds},l=await Gn.post(`${He}create-widget-order`,c);(l==null?void 0:l.status)===200&&(we(!0),q(!1),_(),Ve(l==null?void 0:l.data)),de(!1)}catch(c){console.log(c),de(!1)}}},X=He+"images/logo-img.png",r=c=>{let{value:l}=c.target,P=c.target.dataset.token;if(i(L(S({},f),{[P]:l})),P==="name"&&!at(l)){n(Me=>L(S({},Me),{[P]:Qe.onlylettersallowed}));return}let I=R;P==="email"&&!K&&(delete I.phone,n(I)),l&&(delete I[P],n(I)),P==="email"&&!l&&(delete I[P],n(I))},s=c=>{let{value:l}=c;if(Number(l)>0){let P=R;delete P.amount,n(P)}v(l)},b=()=>{let c={};return pe||(c.amount=Qe.amountrequired),f.email&&!Ke(f==null?void 0:f.email)&&(c.email=Qe.invalidemail),!K&&!(f!=null&&f.email)&&(c.phone=Qe.phoneoremailrequired),!K&&!(f!=null&&f.email)&&(c.email=Qe.phoneoremailrequired),!K&&f.email&&!Ke(f==null?void 0:f.email)&&(c.email=Qe.invalidemail),e.from==="merchant"&&!f.order_id&&(c.order_id=Qe.orderidrequired),n(c),Object.keys(c).length===0};Un(()=>{e&&(i(c=>L(S({},c),{order_id:e.orderID?e.orderID:"",name:e!=null&&e.name?e==null?void 0:e.name:"",email:e!=null&&e.email?e==null?void 0:e.email:""})),v(e.amount?e.amount:""),d(e.phone?`${e.phone}`:null))},[e]);let U=c=>{let l=c==null?void 0:c.value;if(l&&(l==null?void 0:l.length)>0&&(l==null?void 0:l.length)!==10){n(I=>L(S({},I),{phone:Qe.phonenumberlength})),d(l);return}else d(l);let P=R;delete P.phone,l&&!(f!=null&&f.email)&&delete P.email,n(P)};function w(c){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(c))}return k.createElement(k.Fragment,null,k.createElement(dn,null),k.createElement(xt,{loading:De}),k.createElement(k.Fragment,null,k.createElement("button",{className:"paymentBtn",onClick:We},"Request Payment"),k.createElement(kt,{open:je,onClose:()=>q(!1),maxWidth:"500px"},k.createElement("div",{style:{maxWidth:"500px"}},k.createElement("div",{className:"request-payment-amount-detail frac-form"},k.createElement("p",{className:"request-payment-merchantname"},"Pay ",e==null?void 0:e.webname),k.createElement("p",{className:"request-payment-amount"},w(e==null?void 0:e.amount)),(e==null?void 0:e.from)==="merchant"&&k.createElement("p",{className:"request-payment-orderid"},f==null?void 0:f.order_id),k.createElement("span",{className:"request-payment-close-popup",onClick:y},k.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},k.createElement("g",{clipPath:"url(#clip0_12425_52336)"},k.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),k.createElement("defs",null,k.createElement("clipPath",{id:"clip0_12425_52336"},k.createElement("rect",{width:"16",height:"16",fill:"white"})))))),k.createElement("form",{className:"request-payment-input-form"},k.createElement("div",{className:"request-payment-list-div"},k.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"FULL NAME"),k.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Full Name","data-token":"name",onChange:r,value:f==null?void 0:f.name}),R.name&&k.createElement("small",{className:"request-payment-error-msg"},R.name)),k.createElement("div",{className:"request-payment-list-div"},k.createElement("label",{htmlFor:"requestPhoneNumber",className:"request-payment-input-label"},"Phone Number"),k.createElement(Jn,{className:"request-payment-input-box",placeholder:"Mobile number",format:"+1 (###) ###-####",value:K,onValueChange:c=>{U(c)}}),R.phone&&k.createElement("small",{className:"request-payment-error-msg"},R.phone)),k.createElement("div",{className:"request-payment-list-div"},k.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"EMAIL"),k.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Email",onChange:r,"data-token":"email",value:f==null?void 0:f.email}),R.email&&k.createElement("small",{className:"request-payment-error-msg"},R.email)),k.createElement("button",{type:"button",className:"request-payment-submit-button",onClick:ie,disabled:De},De?"Loading...":"Send Request"),k.createElement("div",{className:"request-payment-fractal-powerd-by"},k.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},k.createElement("path",{d:"M15.2165 4.11839C15.1973 3.69746 15.1973 3.29567 15.1973 2.89387C15.1973 2.56861 14.9486 2.31988 14.6234 2.31988C12.2317 2.31988 10.4141 1.63109 8.90257 0.157848C8.67298 -0.0526158 8.32858 -0.0526158 8.09898 0.157848C6.58748 1.63109 4.76984 2.31988 2.37821 2.31988C2.05295 2.31988 1.80422 2.56861 1.80422 2.89387C1.80422 3.29567 1.80422 3.69746 1.78508 4.11839C1.70855 8.13632 1.59375 13.6466 8.30945 15.9617L8.50078 16L8.69211 15.9617C15.3887 13.6466 15.293 8.15546 15.2165 4.11839ZM8.04159 9.6861C7.92679 9.78176 7.79286 9.83916 7.63979 9.83916H7.62066C7.46759 9.83916 7.31453 9.76263 7.21887 9.64783L5.43949 7.67713L6.30048 6.91181L7.69719 8.46158L10.7967 5.5151L11.5812 6.35695L8.04159 9.6861Z",fill:"#727272"})),"Secure payments powered by ",k.createElement("span",null,"Fractal"),k.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},k.createElement("path",{d:"M17.4999 5.49758V7.01156C17.4999 7.05924 17.4595 7.09898 17.411 7.09898H12.3516C12.9169 6.54266 13.4781 5.99032 14.0434 5.434C14.0596 5.4181 14.0838 5.41016 14.104 5.41016H17.411C17.4595 5.41016 17.4999 5.44989 17.4999 5.49758Z",fill:"#61C699"}),k.createElement("path",{d:"M12.3462 10.9037V9.29836C12.3462 9.25067 12.3866 9.21094 12.435 9.21094H13.8523C13.929 9.21094 13.9694 9.30631 13.9129 9.35796C13.392 9.87455 12.8711 10.3911 12.3462 10.9037Z",fill:"#61C699"}),k.createElement("path",{d:"M12.4404 9.00523H15.6949C15.7434 9.00523 15.7838 8.96549 15.7838 8.91781V7.40383C15.7838 7.35614 15.7434 7.31641 15.6949 7.31641H12.4404C12.3919 7.31641 12.3516 7.35614 12.3516 7.40383V8.91781C12.3516 8.96549 12.3919 9.00523 12.4404 9.00523Z",fill:"#61C699"}),k.createElement("path",{d:"M10.1581 0.0120725L11.4906 0.77105C11.531 0.794892 11.5471 0.84655 11.5229 0.890261L8.99114 5.20173C8.78521 4.44275 8.57927 3.68775 8.37334 2.92877C8.36527 2.90493 8.3693 2.88109 8.38142 2.86122L10.0329 0.0438621C10.0612 0.000151419 10.1177 -0.0117697 10.1581 0.0120725Z",fill:"#61C699"}),k.createElement("path",{d:"M12.3382 7.10006L10.9289 6.29737C10.8886 6.27353 10.8724 6.22187 10.8966 6.17816L11.6033 4.97015C11.6436 4.9026 11.7446 4.91452 11.7648 4.99002C11.9546 5.69734 12.1484 6.40068 12.3382 7.10006Z",fill:"#61C699"}),k.createElement("path",{d:"M10.7107 6.0771L12.338 3.30345C12.3622 3.26372 12.346 3.20808 12.3057 3.18424L10.9732 2.42526C10.9328 2.40142 10.8763 2.41732 10.852 2.45705L9.22476 5.2307C9.20053 5.27044 9.21669 5.32607 9.25706 5.34991L10.5896 6.10889C10.634 6.13273 10.6865 6.11683 10.7107 6.0771Z",fill:"#61C699"}),k.createElement("path",{d:"M1.66713 3.51237L2.99963 2.75339C3.04001 2.72955 3.09654 2.74544 3.12077 2.78518L5.65251 7.09665C4.88128 6.89399 4.11408 6.69133 3.34285 6.48867C3.31862 6.4847 3.30247 6.4688 3.29036 6.44893L1.63483 3.63158C1.6106 3.58787 1.62271 3.53621 1.66713 3.51237Z",fill:"#61C699"}),k.createElement("path",{d:"M8.99793 5.20018L7.58871 5.99889C7.54833 6.02274 7.4918 6.00684 7.46757 5.9671L6.76095 4.76307C6.72057 4.69552 6.78517 4.61605 6.86189 4.63591C7.57256 4.82268 8.28726 5.00944 8.99793 5.20018Z",fill:"#61C699"}),k.createElement("path",{d:"M7.27986 6.07054L5.6526 3.2969C5.62837 3.25716 5.57588 3.24127 5.53146 3.26511L4.19896 4.02409C4.15858 4.04793 4.14243 4.09959 4.16666 4.1433L5.79392 6.91694C5.81815 6.95668 5.87064 6.97257 5.91506 6.94873L7.24756 6.18975C7.28794 6.16591 7.30409 6.11425 7.27986 6.07054Z",fill:"#61C699"}),k.createElement("path",{d:"M0.5 12.4998V10.9859C0.5 10.9382 0.540379 10.8984 0.588833 10.8984H5.64829C5.08299 11.4548 4.52172 12.0071 3.95642 12.5634C3.94027 12.5793 3.91604 12.5873 3.89585 12.5873H0.588833C0.540379 12.5873 0.5 12.5475 0.5 12.4998Z",fill:"#61C699"}),k.createElement("path",{d:"M5.65129 7.09766V8.70303C5.65129 8.75072 5.61091 8.79045 5.56246 8.79045H4.14516C4.06844 8.79045 4.02806 8.69508 4.08459 8.64343C4.60548 8.12685 5.12637 7.61424 5.65129 7.09766Z",fill:"#61C699"}),k.createElement("path",{d:"M5.55967 8.99609H2.30514C2.25669 8.99609 2.21631 9.03583 2.21631 9.08352V10.5975C2.21631 10.6452 2.25669 10.6849 2.30514 10.6849H5.55967C5.60813 10.6849 5.6485 10.6452 5.6485 10.5975V9.08352C5.6485 9.03583 5.60813 8.99609 5.55967 8.99609Z",fill:"#61C699"}),k.createElement("path",{d:"M7.82638 17.9865L6.49388 17.2276C6.4535 17.2037 6.43735 17.1521 6.46158 17.1083L8.99333 12.7969C9.19926 13.5559 9.40519 14.3109 9.61112 15.0698C9.6192 15.0937 9.61516 15.1175 9.60305 15.1374L7.95155 17.9547C7.91925 17.9985 7.86676 18.0104 7.82638 17.9865Z",fill:"#61C699"}),k.createElement("path",{d:"M5.64795 10.8984L7.05717 11.7011C7.09755 11.725 7.1137 11.7766 7.08947 11.8203L6.38284 13.0283C6.34246 13.0959 6.24152 13.084 6.22133 13.0085C6.02751 12.3012 5.83773 11.5978 5.64795 10.8984Z",fill:"#61C699"}),k.createElement("path",{d:"M7.2739 11.9258L5.64664 14.6994C5.62241 14.7392 5.63856 14.7948 5.67894 14.8187L7.01144 15.5776C7.05182 15.6015 7.10835 15.5856 7.13258 15.5458L8.75984 12.7722C8.78407 12.7325 8.76792 12.6768 8.72754 12.653L7.39504 11.894C7.35062 11.8702 7.29813 11.8861 7.2739 11.9258Z",fill:"#61C699"}),k.createElement("path",{d:"M16.3199 14.4866L14.9874 15.2456C14.947 15.2694 14.8904 15.2535 14.8662 15.2138L12.3345 10.9023C13.1057 11.105 13.8729 11.3077 14.6441 11.5103C14.6684 11.5143 14.6845 11.5302 14.6966 11.5501L16.3481 14.3674C16.3764 14.4111 16.3643 14.4628 16.3199 14.4866Z",fill:"#61C699"}),k.createElement("path",{d:"M8.99121 12.7983L10.4004 11.9956C10.4408 11.9717 10.4973 11.9876 10.5216 12.0274L11.2282 13.2354C11.2686 13.3029 11.204 13.3824 11.1272 13.3625C10.4166 13.1758 9.70188 12.989 8.99121 12.7983Z",fill:"#61C699"}),k.createElement("path",{d:"M10.7077 11.9285L12.3349 14.7021C12.3592 14.7418 12.4117 14.7577 12.4561 14.7339L13.7886 13.9749C13.829 13.9511 13.8451 13.8994 13.8209 13.8557L12.1936 11.0821C12.1694 11.0423 12.1169 11.0264 12.0725 11.0503L10.74 11.8092C10.6996 11.8331 10.6834 11.8847 10.7077 11.9285Z",fill:"#61C699"})))))),k.createElement(kt,{open:fe,onClose:E,maxWidth:"500px"},k.createElement("div",{className:"fractal-popup-content",style:{padding:"0px",maxWidth:"500px"}},k.createElement("div",{className:"request-payment-success-container"},k.createElement("span",{className:"request-payment-close-popup",onClick:E},k.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},k.createElement("g",{clipPath:"url(#clip0_12425_52336)"},k.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),k.createElement("defs",null,k.createElement("clipPath",{id:"clip0_12425_52336"},k.createElement("rect",{width:"16",height:"16",fill:"white"}))))),k.createElement("div",{className:"request-payment-success-tick-div"},k.createElement("div",{className:"request-payment-success-tick"},k.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},k.createElement("path",{d:"M6.12669 13.9774C5.97396 14.131 5.76558 14.2167 5.54913 14.2167C5.33267 14.2167 5.1243 14.131 4.97157 13.9774L0.359012 9.36408C-0.119671 8.8854 -0.119671 8.10919 0.359012 7.6314L0.936573 7.05369C1.4154 6.57501 2.19072 6.57501 2.6694 7.05369L5.54913 9.93357L13.3306 2.15198C13.8094 1.6733 14.5855 1.6733 15.0634 2.15198L15.641 2.72969C16.1196 3.20837 16.1196 3.98444 15.641 4.46237L6.12669 13.9774Z",fill:"#61C699"})))),k.createElement("h6",{className:"request-payment-success-text"},"The request ",k.createElement("br",null),"was sent"),k.createElement("h6",{className:"request-payment-success-subtext"},"Please wait for the customer to pay"),k.createElement("div",{className:"request-payment-success-btn-div"},k.createElement("button",{onClick:E,className:"request-payment-success-btn2"},"Close")))))))}import"bootstrap/dist/js/bootstrap.bundle.min.js";import N,{useState as Vt,useEffect as Qn}from"react";import Dn from"axios";import{PatternFormat as Rn}from"react-number-format";function ei(e){let F=e.merchantPublicKey,T=e==null?void 0:e.discount,V=e==null?void 0:e.tax,$=e==null?void 0:e.surcharge,[je,q]=Vt(!1),[De,de]=Vt(!1),[R,n]=Vt({}),[K,d]=Vt(null),[f,i]=Vt({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:F}),[pe,v]=Vt(""),[fe,we]=Vt(!1),[Oe,Ve]=Vt(null),ve=c=>/^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(c),nt=/[+-]?([0-9]*[.])?[0-9]+/,Ke=c=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(c),at=c=>/^[A-Za-z\s]*$/.test(c),y=()=>{q(!1),n({})},We=()=>q(!0),E=()=>{console.log(Oe,"apiresponse"),x(Oe),we(!1)};function _(){i({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:F}),v("")}function x(c){let l={type:"preview.compiledcheck",other:L(S({},c),{status:!0})};window.parent.postMessage(l,"*")}let ie=async()=>{if(!(Object.keys(R).length>0)){if(n({}),!(f!=null&&f.email)&&K&&!ve(K)){n(c=>L(S({},c),{phone:Qe.phonenumbervalid}));return}if(b())try{de(!0);let c={fractalpayPublicKey:F,amount:pe,phone_number:K,order_id:f.order_id,action:"request",name:f.name,email:f.email,customer_id:e!=null&&e.customerId?e==null?void 0:e.customerId:"",discount:T,surcharge:$,tax:V,require_3ds:e==null?void 0:e.require_3ds},l=await Dn.post(`${He}send-request-pre-auth-payment`,c);(l==null?void 0:l.status)===200&&(we(!0),q(!1),_(),Ve(l==null?void 0:l.data)),de(!1)}catch(c){console.log(c),de(!1)}}},X=He+"images/logo-img.png",r=c=>{let{value:l}=c.target,P=c.target.dataset.token;if(i(L(S({},f),{[P]:l})),P==="name"&&!at(l)){n(Me=>L(S({},Me),{[P]:Qe.onlylettersallowed}));return}let I=R;P==="email"&&!K&&(delete I.phone,n(I)),l&&(delete I[P],n(I)),P==="email"&&!l&&(delete I[P],n(I))},s=c=>{let{value:l}=c;if(Number(l)>0){let P=R;delete P.amount,n(P)}v(l)},b=()=>{let c={};return pe||(c.amount=Qe.amountrequired),f.email&&!Ke(f==null?void 0:f.email)&&(c.email=Qe.invalidemail),!K&&!(f!=null&&f.email)&&(c.phone=Qe.phoneoremailrequired),!K&&!(f!=null&&f.email)&&(c.email=Qe.phoneoremailrequired),!K&&f.email&&!Ke(f==null?void 0:f.email)&&(c.email=Qe.invalidemail),e.from==="merchant"&&!f.order_id&&(c.order_id=Qe.orderidrequired),n(c),Object.keys(c).length===0};Qn(()=>{e&&(i(c=>L(S({},c),{order_id:e.orderID?e.orderID:"",name:e!=null&&e.name?e==null?void 0:e.name:"",email:e!=null&&e.email?e==null?void 0:e.email:""})),v(e.amount?e.amount:""),d(e.phone?`${e.phone}`:null))},[e]);let U=c=>{let l=c==null?void 0:c.value;if(l&&(l==null?void 0:l.length)>0&&(l==null?void 0:l.length)!==10){n(I=>L(S({},I),{phone:Qe.phonenumberlength})),d(l);return}else d(l);let P=R;delete P.phone,l&&!(f!=null&&f.email)&&delete P.email,n(P)};function w(c){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(c))}return N.createElement(N.Fragment,null,N.createElement(dn,null),N.createElement(xt,{loading:De}),N.createElement(N.Fragment,null,N.createElement("button",{className:"paymentBtn",onClick:We},"Send Request"),N.createElement("div",{className:"frac-form"},N.createElement(kt,{open:je,onClose:()=>q(!1),maxWidth:"500px"},N.createElement("div",{className:"request-payment-amount-detail"},N.createElement("p",{className:"request-payment-merchantname"},"Authorization Request"),N.createElement("p",{className:"request-payment-pre-auth-merchantname"},"Pay ",e==null?void 0:e.webname),N.createElement("p",{className:"request-payment-amount"},w(e==null?void 0:e.amount)),(e==null?void 0:e.from)==="merchant"&&N.createElement("p",{className:"request-payment-orderid"},f==null?void 0:f.order_id),N.createElement("span",{className:"request-payment-close-popup",onClick:y},N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},N.createElement("g",{clipPath:"url(#clip0_12425_52336)"},N.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),N.createElement("defs",null,N.createElement("clipPath",{id:"clip0_12425_52336"},N.createElement("rect",{width:"16",height:"16",fill:"white"})))))),N.createElement("form",{className:"request-payment-input-form"},N.createElement("div",{className:"request-payment-list-div"},N.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"FULL NAME"),N.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Full Name","data-token":"name",onChange:r,value:f==null?void 0:f.name}),R.name&&N.createElement("small",{className:"request-payment-error-msg"},R.name)),N.createElement("div",{className:"request-payment-list-div"},N.createElement("label",{htmlFor:"requestPhoneNumber",className:"request-payment-input-label"},"Phone Number"),N.createElement(Rn,{className:"request-payment-input-box",placeholder:"Mobile number",format:"+1 (###) ###-####",value:K,onValueChange:c=>{U(c)}}),R.phone&&N.createElement("small",{className:"request-payment-error-msg"},R.phone)),N.createElement("div",{className:"request-payment-list-div"},N.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"EMAIL"),N.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Email",onChange:r,"data-token":"email",value:f==null?void 0:f.email}),R.email&&N.createElement("small",{className:"request-payment-error-msg"},R.email)),N.createElement("button",{type:"button",className:"request-payment-submit-button",onClick:ie,disabled:De},De?"Loading...":"Send Request"),N.createElement("div",{className:"request-payment-fractal-powerd-by"},N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},N.createElement("path",{d:"M15.2165 4.11839C15.1973 3.69746 15.1973 3.29567 15.1973 2.89387C15.1973 2.56861 14.9486 2.31988 14.6234 2.31988C12.2317 2.31988 10.4141 1.63109 8.90257 0.157848C8.67298 -0.0526158 8.32858 -0.0526158 8.09898 0.157848C6.58748 1.63109 4.76984 2.31988 2.37821 2.31988C2.05295 2.31988 1.80422 2.56861 1.80422 2.89387C1.80422 3.29567 1.80422 3.69746 1.78508 4.11839C1.70855 8.13632 1.59375 13.6466 8.30945 15.9617L8.50078 16L8.69211 15.9617C15.3887 13.6466 15.293 8.15546 15.2165 4.11839ZM8.04159 9.6861C7.92679 9.78176 7.79286 9.83916 7.63979 9.83916H7.62066C7.46759 9.83916 7.31453 9.76263 7.21887 9.64783L5.43949 7.67713L6.30048 6.91181L7.69719 8.46158L10.7967 5.5151L11.5812 6.35695L8.04159 9.6861Z",fill:"#727272"})),"Secure payments powered by ",N.createElement("span",null,"Fractal"),N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},N.createElement("path",{d:"M17.4999 5.49758V7.01156C17.4999 7.05924 17.4595 7.09898 17.411 7.09898H12.3516C12.9169 6.54266 13.4781 5.99032 14.0434 5.434C14.0596 5.4181 14.0838 5.41016 14.104 5.41016H17.411C17.4595 5.41016 17.4999 5.44989 17.4999 5.49758Z",fill:"#61C699"}),N.createElement("path",{d:"M12.3462 10.9037V9.29836C12.3462 9.25067 12.3866 9.21094 12.435 9.21094H13.8523C13.929 9.21094 13.9694 9.30631 13.9129 9.35796C13.392 9.87455 12.8711 10.3911 12.3462 10.9037Z",fill:"#61C699"}),N.createElement("path",{d:"M12.4404 9.00523H15.6949C15.7434 9.00523 15.7838 8.96549 15.7838 8.91781V7.40383C15.7838 7.35614 15.7434 7.31641 15.6949 7.31641H12.4404C12.3919 7.31641 12.3516 7.35614 12.3516 7.40383V8.91781C12.3516 8.96549 12.3919 9.00523 12.4404 9.00523Z",fill:"#61C699"}),N.createElement("path",{d:"M10.1581 0.0120725L11.4906 0.77105C11.531 0.794892 11.5471 0.84655 11.5229 0.890261L8.99114 5.20173C8.78521 4.44275 8.57927 3.68775 8.37334 2.92877C8.36527 2.90493 8.3693 2.88109 8.38142 2.86122L10.0329 0.0438621C10.0612 0.000151419 10.1177 -0.0117697 10.1581 0.0120725Z",fill:"#61C699"}),N.createElement("path",{d:"M12.3382 7.10006L10.9289 6.29737C10.8886 6.27353 10.8724 6.22187 10.8966 6.17816L11.6033 4.97015C11.6436 4.9026 11.7446 4.91452 11.7648 4.99002C11.9546 5.69734 12.1484 6.40068 12.3382 7.10006Z",fill:"#61C699"}),N.createElement("path",{d:"M10.7107 6.0771L12.338 3.30345C12.3622 3.26372 12.346 3.20808 12.3057 3.18424L10.9732 2.42526C10.9328 2.40142 10.8763 2.41732 10.852 2.45705L9.22476 5.2307C9.20053 5.27044 9.21669 5.32607 9.25706 5.34991L10.5896 6.10889C10.634 6.13273 10.6865 6.11683 10.7107 6.0771Z",fill:"#61C699"}),N.createElement("path",{d:"M1.66713 3.51237L2.99963 2.75339C3.04001 2.72955 3.09654 2.74544 3.12077 2.78518L5.65251 7.09665C4.88128 6.89399 4.11408 6.69133 3.34285 6.48867C3.31862 6.4847 3.30247 6.4688 3.29036 6.44893L1.63483 3.63158C1.6106 3.58787 1.62271 3.53621 1.66713 3.51237Z",fill:"#61C699"}),N.createElement("path",{d:"M8.99793 5.20018L7.58871 5.99889C7.54833 6.02274 7.4918 6.00684 7.46757 5.9671L6.76095 4.76307C6.72057 4.69552 6.78517 4.61605 6.86189 4.63591C7.57256 4.82268 8.28726 5.00944 8.99793 5.20018Z",fill:"#61C699"}),N.createElement("path",{d:"M7.27986 6.07054L5.6526 3.2969C5.62837 3.25716 5.57588 3.24127 5.53146 3.26511L4.19896 4.02409C4.15858 4.04793 4.14243 4.09959 4.16666 4.1433L5.79392 6.91694C5.81815 6.95668 5.87064 6.97257 5.91506 6.94873L7.24756 6.18975C7.28794 6.16591 7.30409 6.11425 7.27986 6.07054Z",fill:"#61C699"}),N.createElement("path",{d:"M0.5 12.4998V10.9859C0.5 10.9382 0.540379 10.8984 0.588833 10.8984H5.64829C5.08299 11.4548 4.52172 12.0071 3.95642 12.5634C3.94027 12.5793 3.91604 12.5873 3.89585 12.5873H0.588833C0.540379 12.5873 0.5 12.5475 0.5 12.4998Z",fill:"#61C699"}),N.createElement("path",{d:"M5.65129 7.09766V8.70303C5.65129 8.75072 5.61091 8.79045 5.56246 8.79045H4.14516C4.06844 8.79045 4.02806 8.69508 4.08459 8.64343C4.60548 8.12685 5.12637 7.61424 5.65129 7.09766Z",fill:"#61C699"}),N.createElement("path",{d:"M5.55967 8.99609H2.30514C2.25669 8.99609 2.21631 9.03583 2.21631 9.08352V10.5975C2.21631 10.6452 2.25669 10.6849 2.30514 10.6849H5.55967C5.60813 10.6849 5.6485 10.6452 5.6485 10.5975V9.08352C5.6485 9.03583 5.60813 8.99609 5.55967 8.99609Z",fill:"#61C699"}),N.createElement("path",{d:"M7.82638 17.9865L6.49388 17.2276C6.4535 17.2037 6.43735 17.1521 6.46158 17.1083L8.99333 12.7969C9.19926 13.5559 9.40519 14.3109 9.61112 15.0698C9.6192 15.0937 9.61516 15.1175 9.60305 15.1374L7.95155 17.9547C7.91925 17.9985 7.86676 18.0104 7.82638 17.9865Z",fill:"#61C699"}),N.createElement("path",{d:"M5.64795 10.8984L7.05717 11.7011C7.09755 11.725 7.1137 11.7766 7.08947 11.8203L6.38284 13.0283C6.34246 13.0959 6.24152 13.084 6.22133 13.0085C6.02751 12.3012 5.83773 11.5978 5.64795 10.8984Z",fill:"#61C699"}),N.createElement("path",{d:"M7.2739 11.9258L5.64664 14.6994C5.62241 14.7392 5.63856 14.7948 5.67894 14.8187L7.01144 15.5776C7.05182 15.6015 7.10835 15.5856 7.13258 15.5458L8.75984 12.7722C8.78407 12.7325 8.76792 12.6768 8.72754 12.653L7.39504 11.894C7.35062 11.8702 7.29813 11.8861 7.2739 11.9258Z",fill:"#61C699"}),N.createElement("path",{d:"M16.3199 14.4866L14.9874 15.2456C14.947 15.2694 14.8904 15.2535 14.8662 15.2138L12.3345 10.9023C13.1057 11.105 13.8729 11.3077 14.6441 11.5103C14.6684 11.5143 14.6845 11.5302 14.6966 11.5501L16.3481 14.3674C16.3764 14.4111 16.3643 14.4628 16.3199 14.4866Z",fill:"#61C699"}),N.createElement("path",{d:"M8.99121 12.7983L10.4004 11.9956C10.4408 11.9717 10.4973 11.9876 10.5216 12.0274L11.2282 13.2354C11.2686 13.3029 11.204 13.3824 11.1272 13.3625C10.4166 13.1758 9.70188 12.989 8.99121 12.7983Z",fill:"#61C699"}),N.createElement("path",{d:"M10.7077 11.9285L12.3349 14.7021C12.3592 14.7418 12.4117 14.7577 12.4561 14.7339L13.7886 13.9749C13.829 13.9511 13.8451 13.8994 13.8209 13.8557L12.1936 11.0821C12.1694 11.0423 12.1169 11.0264 12.0725 11.0503L10.74 11.8092C10.6996 11.8331 10.6834 11.8847 10.7077 11.9285Z",fill:"#61C699"}))))),N.createElement(kt,{open:fe,onClose:E,maxWidth:"500px"},N.createElement("div",{className:"fractal-popup-content",style:{padding:"0px",maxWidth:"500px"}},N.createElement("div",{className:"request-payment-success-container"},N.createElement("span",{className:"request-payment-close-popup",onClick:E},N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},N.createElement("g",{clipPath:"url(#clip0_12425_52336)"},N.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),N.createElement("defs",null,N.createElement("clipPath",{id:"clip0_12425_52336"},N.createElement("rect",{width:"16",height:"16",fill:"white"}))))),N.createElement("div",{className:"request-payment-success-tick-div"},N.createElement("div",{className:"request-payment-success-tick"},N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},N.createElement("path",{d:"M6.12669 13.9774C5.97396 14.131 5.76558 14.2167 5.54913 14.2167C5.33267 14.2167 5.1243 14.131 4.97157 13.9774L0.359012 9.36408C-0.119671 8.8854 -0.119671 8.10919 0.359012 7.6314L0.936573 7.05369C1.4154 6.57501 2.19072 6.57501 2.6694 7.05369L5.54913 9.93357L13.3306 2.15198C13.8094 1.6733 14.5855 1.6733 15.0634 2.15198L15.641 2.72969C16.1196 3.20837 16.1196 3.98444 15.641 4.46237L6.12669 13.9774Z",fill:"#61C699"})))),N.createElement("h6",{className:"request-payment-success-text"},"The request ",N.createElement("br",null),"was sent"),N.createElement("h6",{className:"request-payment-success-subtext"},"Please wait for the customer to pay"),N.createElement("div",{className:"request-payment-success-btn-div"},N.createElement("button",{onClick:E,className:"request-payment-success-btn2"},"Close"))))))))}import t,{useEffect as si,useState as tt}from"react";import ti from"react";function Dt(){let e="#000",F="#fff",T="#212529",V="#dee2e6";return ti.createElement("style",null,`
|
|
579
579
|
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
|
|
580
580
|
body
|
|
581
581
|
{
|
|
@@ -804,13 +804,13 @@ var zn=Object.defineProperty,In=Object.defineProperties;var qn=Object.getOwnProp
|
|
|
804
804
|
font-size: 1rem;
|
|
805
805
|
font-weight: 400;
|
|
806
806
|
line-height: 1.5;
|
|
807
|
-
color: ${
|
|
807
|
+
color: ${T};
|
|
808
808
|
-webkit-appearance: none;
|
|
809
809
|
-moz-appearance: none;
|
|
810
810
|
appearance: none;
|
|
811
|
-
background-color: ${
|
|
811
|
+
background-color: ${F};
|
|
812
812
|
background-clip: padding-box;
|
|
813
|
-
border: 1px solid ${
|
|
813
|
+
border: 1px solid ${V};
|
|
814
814
|
border-radius: 0.375rem;
|
|
815
815
|
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
|
|
816
816
|
}
|
|
@@ -828,7 +828,7 @@ var zn=Object.defineProperty,In=Object.defineProperties;var qn=Object.getOwnProp
|
|
|
828
828
|
}
|
|
829
829
|
.card-crdi {
|
|
830
830
|
display: flex;
|
|
831
|
-
border: 1px solid ${
|
|
831
|
+
border: 1px solid ${V};
|
|
832
832
|
border-radius: 0.375rem;
|
|
833
833
|
}
|
|
834
834
|
.card-expiry-new{
|
|
@@ -854,7 +854,7 @@ var zn=Object.defineProperty,In=Object.defineProperties;var qn=Object.getOwnProp
|
|
|
854
854
|
border-top-right-radius: 0;
|
|
855
855
|
border-bottom-right-radius: 0;
|
|
856
856
|
border: 0;
|
|
857
|
-
border-right: 1px solid ${
|
|
857
|
+
border-right: 1px solid ${V};
|
|
858
858
|
}
|
|
859
859
|
|
|
860
860
|
|
|
@@ -868,7 +868,7 @@ var zn=Object.defineProperty,In=Object.defineProperties;var qn=Object.getOwnProp
|
|
|
868
868
|
border-radius: 0;
|
|
869
869
|
border-top: 0;
|
|
870
870
|
border-bottom: 0;
|
|
871
|
-
border-right: 1px solid ${
|
|
871
|
+
border-right: 1px solid ${V};
|
|
872
872
|
}
|
|
873
873
|
|
|
874
874
|
.exp-date input:focus {
|
|
@@ -1169,7 +1169,7 @@ var zn=Object.defineProperty,In=Object.defineProperties;var qn=Object.getOwnProp
|
|
|
1169
1169
|
|
|
1170
1170
|
|
|
1171
1171
|
|
|
1172
|
-
`)}import
|
|
1172
|
+
`)}import Gt from"axios";import ke from"react";import ni from"react";function cn(){return ni.createElement("style",null,`
|
|
1173
1173
|
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
|
|
1174
1174
|
|
|
1175
1175
|
body{
|
|
@@ -1364,7 +1364,7 @@ var zn=Object.defineProperty,In=Object.defineProperties;var qn=Object.getOwnProp
|
|
|
1364
1364
|
gap: 6px;
|
|
1365
1365
|
background-color: #161616;
|
|
1366
1366
|
color: #fff;
|
|
1367
|
-
}`)}function
|
|
1367
|
+
}`)}function Kt(e,F,T){e.preventDefault();let $={type:"preview.compiledcheck",other:{msg:"Payment success!",status:F==="close",data:{tran_id:T,key:F}}};console.log("message:",$),window.parent.postMessage($,"*")}function Rt({onClose:e,tranId:F}){return ke.createElement(ke.Fragment,null,ke.createElement(cn,null),ke.createElement("div",{className:"payment-msg-container"},ke.createElement("div",{className:"charge-payment-success-container"},ke.createElement("div",{className:"charge-payment-success-tick-div"},ke.createElement("div",{className:"charge-payment-success-tick"},ke.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},ke.createElement("path",{d:"M6.12669 13.9774C5.97396 14.131 5.76558 14.2167 5.54913 14.2167C5.33267 14.2167 5.1243 14.131 4.97157 13.9774L0.359012 9.36408C-0.119671 8.8854 -0.119671 8.10919 0.359012 7.6314L0.936573 7.05369C1.4154 6.57501 2.19072 6.57501 2.6694 7.05369L5.54913 9.93357L13.3306 2.15198C13.8094 1.6733 14.5855 1.6733 15.0634 2.15198L15.641 2.72969C16.1196 3.20837 16.1196 3.98444 15.641 4.46237L6.12669 13.9774Z",fill:"#61C699"})))),ke.createElement("h6",{className:"charge-payment-success-text"},"Your charge",ke.createElement("br",null),"was successful"),ke.createElement("h6",{className:"charge-payment-success-subtext"},"We\u2019ve processed your charge"),ke.createElement("div",{className:"charge-success-payment-button-div"},ke.createElement("button",{className:"charge-success-btn1",onClick:T=>Kt(T,"print",F)},ke.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},ke.createElement("path",{d:"M15.7729 8.7272C15.58 8.7272 15.395 8.80383 15.2586 8.94022C15.1222 9.07661 15.0456 9.2616 15.0456 9.45448V12.5185C15.045 13.0559 14.8313 13.5711 14.4513 13.9511C14.0713 14.3311 13.5561 14.5449 13.0187 14.5454H3.98149C3.44409 14.5449 2.92887 14.3311 2.54887 13.9511C2.16887 13.5711 1.95514 13.0559 1.95456 12.5185V9.45448C1.95456 9.2616 1.87794 9.07661 1.74154 8.94022C1.60515 8.80383 1.42017 8.7272 1.22728 8.7272C1.03439 8.7272 0.849407 8.80383 0.713015 8.94022C0.576624 9.07661 0.5 9.2616 0.5 9.45448V12.5185C0.500963 13.4416 0.86807 14.3265 1.52077 14.9792C2.17346 15.6319 3.05844 15.999 3.98149 16H13.0187C13.9417 15.999 14.8267 15.6319 15.4794 14.9792C16.1321 14.3265 16.4992 13.4416 16.5002 12.5185V9.45448C16.5002 9.2616 16.4235 9.07661 16.2871 8.94022C16.1507 8.80383 15.9658 8.7272 15.7729 8.7272Z",fill:"#161616"}),ke.createElement("path",{d:"M4.65059 6.75861L7.7728 9.88082V0.72728C7.7728 0.534394 7.84942 0.349407 7.98581 0.213015C8.1222 0.0766239 8.30719 0 8.50008 0C8.69296 0 8.87795 0.0766239 9.01434 0.213015C9.15073 0.349407 9.22736 0.534394 9.22736 0.72728V9.88082L12.3496 6.75861C12.4867 6.62613 12.6704 6.55283 12.8611 6.55448C13.0518 6.55614 13.2342 6.63263 13.3691 6.76747C13.5039 6.90231 13.5804 7.08472 13.5821 7.27541C13.5837 7.46611 13.5104 7.64982 13.3779 7.78698L9.01427 12.1507C8.87788 12.287 8.69293 12.3636 8.50008 12.3636C8.30723 12.3636 8.12228 12.287 7.98589 12.1507L3.62221 7.78698C3.48973 7.64982 3.41643 7.46611 3.41808 7.27541C3.41974 7.08472 3.49623 6.90231 3.63107 6.76747C3.76592 6.63263 3.94833 6.55614 4.13902 6.55448C4.32971 6.55283 4.51342 6.62613 4.65059 6.75861Z",fill:"#161616"})),"Print receipt"),ke.createElement("button",{className:"charge-success-btn1",onClick:T=>Kt(T,"share",F)},ke.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},ke.createElement("g",{clipPath:"url(#clip0_12420_50683)"},ke.createElement("path",{d:"M9.30194 4.78664V2.31152C9.30194 2.09629 9.3862 1.88988 9.53631 1.73768C9.68634 1.5855 9.8899 1.5 10.1021 1.5C10.312 1.50089 10.5132 1.58542 10.6622 1.73534L16.2633 7.41595C16.3383 7.49142 16.3978 7.58117 16.4385 7.68001C16.4791 7.77894 16.5 7.885 16.5 7.99212C16.5 8.09924 16.4791 8.20531 16.4385 8.30423C16.3978 8.40307 16.3383 8.49283 16.2633 8.5683L10.6622 14.2489C10.5499 14.3606 10.4076 14.4362 10.2531 14.4663C10.0987 14.4964 9.93887 14.4797 9.79372 14.4182C9.64857 14.3568 9.52455 14.2532 9.43701 14.1206C9.34955 13.9881 9.30258 13.8323 9.30194 13.6727V11.157H8.62181C7.35764 11.1379 6.10443 11.3981 4.94932 11.9193C3.79422 12.4406 2.76481 13.2107 1.93249 14.1759C1.83215 14.3113 1.6926 14.4115 1.53337 14.4624C1.37406 14.5134 1.20306 14.5125 1.04431 14.4599C0.882759 14.4046 0.742811 14.2984 0.644952 14.1568C0.547092 14.0152 0.496363 13.8456 0.500203 13.6727C0.500203 6.27171 6.96548 5.00575 9.30194 4.78664ZM8.62181 9.51777C9.15695 9.51607 9.69162 9.55129 10.2221 9.62327C10.4115 9.6524 10.5844 9.74954 10.7092 9.89699C10.834 10.0444 10.9025 10.2324 10.9023 10.4267V11.717L14.567 7.99212L10.9023 4.26727V5.55758C10.9023 5.77281 10.8179 5.97922 10.6679 6.13141C10.5178 6.28359 10.3143 6.36909 10.1021 6.36909C9.37396 6.36909 3.61282 6.5314 2.36457 11.5871C4.17637 10.2324 6.3708 9.50665 8.62181 9.51777Z",fill:"#161616"})),ke.createElement("defs",null,ke.createElement("clipPath",{id:"clip0_12420_50683"},ke.createElement("rect",{width:"16",height:"16",fill:"white",transform:"translate(0.5)"})))),"Send receipt"))),ke.createElement("div",{className:"charge-payment-success-btn-div"},ke.createElement("button",{className:"charge-payment-success-btn1",onClick:T=>Kt(T,"tran",F)},"Go to Transactions"),ke.createElement("button",{className:"charge-payment-success-btn2",onClick:T=>{e(),Kt(T,"close",F)}},"Close"))))}import en from"sweetalert2";import{IoArrowBack as Sn}from"react-icons/io5";import{useEffect as _n}from"react";function It(){return _n(()=>{let e="https://token-cert.dcap.com/v1/client";if(typeof window!="undefined"){if(window.DatacapWebToken){console.log("\u2705 Datacap already available");return}if(document.querySelector(`script[src="${e}"]`))console.log("\u2139\uFE0F Script already in DOM, waiting for Datacap...");else{let F=document.createElement("script");F.src=e,F.async=!0,F.onload=()=>{console.log("\u2705 Datacap script loaded"),window.DatacapWebToken?console.log("\u2705 DatacapWebToken is ready:",window.DatacapWebToken):console.warn("\u26A0\uFE0F Script loaded, but DatacapWebToken not found")},F.onerror=T=>{console.error("\u274C Failed to load Datacap script",T)},document.head.appendChild(F)}}},[]),_n(()=>{let e="forge-cdn-script";if(!document.getElementById(e)){let F=document.createElement("script");F.src="https://cdn.jsdelivr.net/npm/node-forge@1.0.0/dist/forge.min.js",F.id=e,F.async=!0,document.head.appendChild(F)}return()=>{let F=document.getElementById(e);F&&document.head.removeChild(F)}},[]),null}import Ct from"react";import ii from"react";function pn(){return ii.createElement("style",null,`
|
|
1368
1368
|
.card-error .logo-container {
|
|
1369
1369
|
display: flex;
|
|
1370
1370
|
justify-content: center;
|
|
@@ -1469,7 +1469,7 @@ var zn=Object.defineProperty,In=Object.defineProperties;var qn=Object.getOwnProp
|
|
|
1469
1469
|
padding:10px 17px;
|
|
1470
1470
|
cursor:pointer;
|
|
1471
1471
|
}
|
|
1472
|
-
`)}var Rn=({onClose:e,error:N})=>nt.createElement(nt.Fragment,null,nt.createElement(sn,null),nt.createElement("div",{className:"card-error"},nt.createElement("div",{className:"payment-error-container"},nt.createElement("div",{className:"error-icon"},nt.createElement("div",{className:"circle"},nt.createElement("i",{className:"fa fa-times","aria-hidden":"true"})),nt.createElement("div",{className:"error-text"},nt.createElement("div",{className:"payment-error-text"},N),nt.createElement("div",{className:"thank-you-text"},"Try again later ")),nt.createElement("div",{className:"error-btn-div"},nt.createElement("button",{onClick:e},"OK")))))),At=Rn;import{io as ei}from"socket.io-client";var ti=ei(re,{transports:["websocket"],withCredentials:!1}),Qe=ti;var ln=e=>{try{let N=JSON.parse(e);return typeof N=="object"&&N!==null}catch(N){return!1}};function ii(e){var Be,Re,We,Ge,et,Ue,mt,ct,ut,Te,G,st,gt,Yt,be,Bt,pt,me,ke,Kt,Nt,Zt,Je,Tt,en;let[N,Y]=Pe(!1),[j,q]=Pe(!1),[pe,F]=Pe(""),[Le,ee]=Pe(!1),[r,d]=Pe(!1),[y,p]=Pe("card"),[u,he]=Pe("card"),[te,E]=Pe(!0),[fe,le]=Pe(!1),[Me,Ce]=Pe(!1),we=e.merchantPublicKey,ot=ge+"widget/mc-img.svg",Ye=ge+"widget/visa-img.svg",Ee=ge+"widget/ae-img.svg",f=ge+"widget/discover-img.svg",Fe=ge+"widget/card.svg",h=ge+"widget/Trash.svg",i=ge+"widget/bank.svg",m=ge+"widget/secure-img.png",B=ge+"widget/pov-by.png",P=ge+"widget/pax.svg",[s,S]=Pe(),[_,V]=Pe({}),[k,c]=Pe(),[o,M]=Pe({}),[z,Ne]=Pe([]),[Oe,bt]=Pe(),[He,at]=Pe(),[g,St]=Pe(),[je,ye]=Pe(""),oe=()=>Y(!0),O=()=>Y(!1),Ve=()=>{d(!1),p("card"),F(""),ee(!1),ye(""),c({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),M({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),S({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),V({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),Ce(!1),le(!1),bt({card_type:"",cardlastfourdigit:"",expmonth:1,expyear:2025,primary_card:0,firstname:"",id:"",lastname:""}),at({}),he("card"),E(!0)},De=()=>d(!0),vt=l=>{p(l)},rt=(l,a)=>{let L=l;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(L)){(a===""||/^[0-9]+$/.test(a))&&(V(T=>A(I({},T),{[L]:""})),S(T=>A(I({},T),{[L]:a})));return}V(T=>A(I({},T),{[L]:""})),S(T=>A(I({},T),{[L]:a}))},Lt=l=>{let L=l.target.value.replace(/\D/g,""),ne="";/^3[47]/.test(L)?ne=L.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(ce,Z,ie,ue)=>[Z,ie,ue].filter(Boolean).join(" ")):ne=L.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(ce,Z,ie,ue,_e)=>[Z,ie,ue,_e].filter(Boolean).join(" ")),V(T=>A(I({},T),{cardNumber:""})),S(T=>A(I({},T),{cardNumber:ne}))},de=l=>{let{name:a,value:L}=l.target,ne=["routingNumber","accountNumber","confirmAccountNumber"];if(a=="name"){/^[a-zA-Z\s]*$/.test(L)&&(M(T=>A(I({},T),{[a]:""})),c(T=>A(I({},T),{[a]:L})));return}if(ne.includes(a)){(L===""||/^[0-9]+$/.test(L))&&(M(T=>A(I({},T),{[a]:""})),c(T=>A(I({},T),{[a]:L})));return}M(T=>A(I({},T),{[a]:""})),c(T=>A(I({},T),{[a]:L}))},v=()=>{var T,ce,Z,ie,ue,_e;let l={},a=s,L=parseInt((a==null?void 0:a.expiryMonth)||"",10),ne=(a==null?void 0:a.expiryYear)||"";if((T=a==null?void 0:a.cardName)!=null&&T.trim()||(l.cardName="Card name is required"),(ce=a==null?void 0:a.cardNumber)!=null&&ce.trim()||(l.cardNumber="Card number is required"),(!((Z=a==null?void 0:a.expiryMonth)!=null&&Z.trim())||!((ie=a==null?void 0:a.expiryYear)!=null&&ie.trim())||isNaN(L)||L<1||L>12||ne.length!==4)&&(l.expiryMonth="Invalid Expiration Date."),(ue=a==null?void 0:a.cvv)!=null&&ue.trim()||(l.cvv="CVV is required"),(_e=a==null?void 0:a.zipCode)!=null&&_e.trim()||(l.zipCode="ZIP code is required"),a!=null&&a.expiryMonth&&(a!=null&&a.expiryYear)&&a.expiryMonth.length<=2&&a.expiryYear.length===4){let Ke=parseInt(a.expiryMonth,10),J=parseInt(a.expiryYear,10),lt=new Date,ht=lt.getMonth()+1,Ze=lt.getFullYear();(J<Ze||J===Ze&&Ke<ht)&&(l.expiryMonth="Card is expired")}return V(l),Object.keys(l).length>0},w=()=>{var L,ne,T,ce,Z,ie,ue,_e,Ke;let l={},a=k;if((L=a==null?void 0:a.name)!=null&&L.trim()||(l.name="Name is required"),(ne=a==null?void 0:a.accountNumber)!=null&&ne.trim()||(l.accountNumber="account number is required"),(T=a==null?void 0:a.accountNumber)!=null&&T.trim()&&((ce=a==null?void 0:a.accountNumber)==null?void 0:ce.trim())!==((Z=a==null?void 0:a.confirmAccountNumber)==null?void 0:Z.trim())&&(l.confirmAccountNumber="Account numbers must match"),(ie=a==null?void 0:a.bankName)!=null&&ie.trim()||(l.bankName="Bank name is required"),(ue=a==null?void 0:a.routingNumber)!=null&&ue.trim()||(l.routingNumber="Routing Number is required"),a!=null&&a.routingNumber&&((_e=a==null?void 0:a.routingNumber)==null?void 0:_e.length)!==9&&(l.routingNumber="Routing number must be 9 digits"),((Ke=a==null?void 0:a.routingNumber)==null?void 0:Ke.length)==9){let J=a==null?void 0:a.routingNumber,lt=[3,7,1],ht=0;for(let Ze=0;Ze<J.length;Ze++)ht+=parseInt(J[Ze],10)*lt[Ze%3];ht%10!==0&&(l.routingNumber="Invalid routing number")}return M(l),Object.keys(l).length>0},H=async l=>{var a,L,ne,T,ce,Z,ie,ue,_e,Ke,J,lt,ht,Ze,Et,Ae;if(l.preventDefault(),y!=="ach"){if(v())return;{let Ht=DatacapWebToken.validateCardNumber(s==null?void 0:s.cardNumber.replaceAll(" ","")),se=DatacapWebToken.validateExpirationDate(s==null?void 0:s.expiryMonth,s==null?void 0:s.expiryYear),Mt=DatacapWebToken.validateCVV(s==null?void 0:s.cvv),kt={};if(Ht||(kt.cardNumber="Invalid card Number"),se||(kt.expiryMonth="Invalid Expiration Date."),Mt||(kt.cvv="Invalid CVV"),V(kt),Ht&&Mt&&se){q(!0);try{let ft=A(I({},s),{amount:`${e.amount||0}`,fractalpayPublicKey:we,orderId:e==null?void 0:e.orderID,customer_id:e==null?void 0:e.customerId,discount:e==null?void 0:e.discount,surcharge:e==null?void 0:e.surcharge,tax:e==null?void 0:e.tax}),Se=await Ot.post(`${re}create-widget-order`,ft),tn=async function(Xe){if(Xe.Error)F(Xe.Error),q(!1);else{let R=s==null?void 0:s.cardName,K=s==null?void 0:s.zipCode;Xe.name=R,Xe.postal_code=K,Xe.isCardSave=`${fe}`,Xe.isCharge=!0,Xe.posSalesIdEncode=Se==null?void 0:Se.data.data.posSalesIdEncode,console.log(Xe,"resppp"),console.log(Se==null?void 0:Se.data.data.posSalesIdEncode,"fkjdashgfuh"),Qe.emit("sendMessage",Xe),Qe.on(Se==null?void 0:Se.data.data.posSalesIdEncode,ae=>{if(console.log(ae,"socket data"),ln(ae==null?void 0:ae.data)){let $e=JSON.parse(ae.data);console.log("return data : ",$e),$e!=null&&$e.result?(S({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),le(!1),ye($e==null?void 0:$e.transactionId),ee(!0),q(!1)):(q(!1),F(($e==null?void 0:$e.message)||"Something went wrong."))}else F("Something went wrong.")})}};if((g==null?void 0:g.paymentGateway)===32){let Xe={method:"POST",redirect:"follow"};try{let R=await Ot.post(`${yt}api/v1/widget/generate-session`,Xe),K=Number(s==null?void 0:s.expiryYear)%100,ae=s==null?void 0:s.cardNumber;ae=ae==null?void 0:ae.replace(/\s+/g,"");let $e=`${ae}=${K}${s==null?void 0:s.expiryMonth} ${s==null?void 0:s.cvv}`,kn=forge.pki.publicKeyFromPem((L=(a=R==null?void 0:R.data)==null?void 0:a.data)==null?void 0:L.publicKeyPem).encrypt($e,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),_n=forge.util.encode64(kn),Pn={"Content-Type":"application/json","x-app-session-key":(T=(ne=R.data)==null?void 0:ne.data)==null?void 0:T.session_key},Sn=JSON.stringify({enc_track2_data:`${_n}`,algorithm:"RSAES_OAEP_SHA_1",session_key:`${(Z=(ce=R==null?void 0:R.data)==null?void 0:ce.data)==null?void 0:Z.session_key}`});try{let tt=await Ot.post(`${Ft}tokenizer/tokenize`,Sn,{headers:Pn}),Ln=JSON.stringify(A(I({},(ie=tt==null?void 0:tt.data)==null?void 0:ie.data),{isSaveCardChecked:fe,name:s==null?void 0:s.cardName,postal_code:s==null?void 0:s.zipCode,customer_id:e==null?void 0:e.customerId})),Mn=JSON.stringify({pre_sales_id:`${(_e=(ue=Se==null?void 0:Se.data)==null?void 0:ue.data)==null?void 0:_e.posSalesIdEncode}`,token:`${(Ke=tt==null?void 0:tt.data)==null?void 0:Ke.data.token}`,json_response:`${Ln}`}),Fn={method:"POST",headers:JSON.stringify({"Content-Type":"application/json"}),body:Mn,redirect:"follow",isChargeviafractal:!0};Qe.emit("sendMessage",Fn),Qe.on("chargeviafractalgateway",jt=>{var gn;if(console.log(jt,"socket data"),ln(jt==null?void 0:jt.data)){let Ct=JSON.parse(jt==null?void 0:jt.data);console.log(Ct,"dfuigdasuf"),Ct!=null&&Ct.result?(ye((gn=Ct==null?void 0:Ct.data)==null?void 0:gn.transactionId),ee(!0),q(!1)):(q(!1),F((Ct==null?void 0:Ct.message)||"Something went wrong."))}else F("Something went wrong.")})}catch(tt){q(!1),F(((lt=(J=tt==null?void 0:tt.response)==null?void 0:J.data)==null?void 0:lt.message)||(tt==null?void 0:tt.message)||"Something went wrong.")}}catch(R){q(!1),F(((Ze=(ht=R==null?void 0:R.response)==null?void 0:ht.data)==null?void 0:Ze.message)||(R==null?void 0:R.message)||"Something went wrong.")}}else typeof DatacapWebToken!="undefined"&&DatacapWebToken.requestToken(Se==null?void 0:Se.data.data.dctoken,"PaymentForm",tn)}catch(ft){q(!1),F(((Ae=(Et=ft==null?void 0:ft.response)==null?void 0:Et.data)==null?void 0:Ae.message)||(ft==null?void 0:ft.message)||"Something went wrong.")}}}}else{if(w())return;{q(!0);let Ht={fractalpayPublicKey:we,label:(k==null?void 0:k.name)||"John Doe",account_number:k==null?void 0:k.accountNumber,routing_number:k==null?void 0:k.routingNumber,bank_name:k==null?void 0:k.bankName,account_type:k==null?void 0:k.accountType,amount:String(e.amount||0),isSaveAch:Me,customer_id:e==null?void 0:e.customerId,order_id:e==null?void 0:e.orderID,tax:e==null?void 0:e.tax,discount:e==null?void 0:e.discount,surcharge:e==null?void 0:e.surcharge,isChargeACH:!0};Qe.emit("sendMessage",Ht),Qe.on("ach-incoming",se=>{var Mt;console.log(se,"sfhdwhf"),(se==null?void 0:se.status)=="Failed"?typeof(se==null?void 0:se.message)=="object"?Object.values(se==null?void 0:se.message).forEach(kt=>{F(kt||"Something went wrong")}):F((se==null?void 0:se.message)||"Something went wrong"):(ye((Mt=se==null?void 0:se.data)==null?void 0:Mt.transaction_id),ee(!0),q(!1))})}}},xe=async()=>{var l,a,L,ne,T,ce,Z,ie,ue,_e,Ke,J,lt,ht,Ze,Et,Ae,$t,Ht,se,Mt,kt,ft,Se,tn,Xe;oe();try{let R={fractalpayPublicKey:we,customer_id:e==null?void 0:e.customerId},K=await Ot.post(`${re}get-payment-details`,R);if(St((l=K==null?void 0:K.data)==null?void 0:l.data),(L=(a=K==null?void 0:K.data)==null?void 0:a.data)!=null&&L.paymentGateway||(Ve(),F("Something went wrong.")),(T=(ne=K==null?void 0:K.data)==null?void 0:ne.data)!=null&&T.card_list&&((ie=(Z=(ce=K==null?void 0:K.data)==null?void 0:ce.data)==null?void 0:Z.card_list)==null?void 0:ie.length)>0){Ne((_e=(ue=K==null?void 0:K.data)==null?void 0:ue.data)==null?void 0:_e.card_list),p("cardList");let ae=(lt=(J=(Ke=K==null?void 0:K.data)==null?void 0:Ke.data)==null?void 0:J.card_list)==null?void 0:lt.filter($e=>($e==null?void 0:$e.primary_card)==1);(ae!=null&&ae[0]&&((ht=ae==null?void 0:ae[0])==null?void 0:ht.payment_method_type)==((Et=(Ze=K==null?void 0:K.data)==null?void 0:Ze.data)==null?void 0:Et.paymentGateway)||((Ae=ae==null?void 0:ae[0])==null?void 0:Ae.card_type)==="Bank")&&bt(ae[0])}else p("card");(Ht=($t=K==null?void 0:K.data)==null?void 0:$t.data)!=null&&Ht.paymentDeviceList&&((kt=(Mt=(se=K==null?void 0:K.data)==null?void 0:se.data)==null?void 0:Mt.paymentDeviceList)==null?void 0:kt.length)>0&&at((Se=(ft=K==null?void 0:K.data)==null?void 0:ft.data)==null?void 0:Se.paymentDeviceList[0]),O()}catch(R){console.log(R),O(),F(((Xe=(tn=R==null?void 0:R.response)==null?void 0:tn.data)==null?void 0:Xe.message)||(R==null?void 0:R.message)||"Something went wrong")}},W=async()=>{let l=e==null?void 0:e.customerId,a=String(e==null?void 0:e.discount),L=String(e==null?void 0:e.surcharge),ne=String(e==null?void 0:e.tax),T=e==null?void 0:e.merchantPublicKey,ce=e==null?void 0:e.orderID,Z=String(e==null?void 0:e.amount),ie=Oe==null?void 0:Oe.id,ue=Oe==null?void 0:Oe.card_type;if(T&&ce&&Z)if(l)if(ie){let Ke={amount:Z,order_id:ce,customer_id:l,card_id:ie,fractalpayPublicKey:T,isCardSave:fe,discount:a,surcharge:L,tax:ne},_e=Ke,{isCardSave:J}=_e,lt=on(_e,["isCardSave"]),Ze=re+(ue==="Bank"?"charge-ach":"charge-by-card"),Et={"Content-Type":"application/json"};q(!0),Qe.emit("sendMessage",{url:Ze,body:ue=="Bank"?lt:Ke,isChargebycard:!0}),Qe.on("charge-by-card",Ae=>{var $t;console.log(Ae,"response"),(Ae==null?void 0:Ae.result)==!0||(Ae==null?void 0:Ae.status)==!0?(ye(($t=Ae.data)==null?void 0:$t.transaction_id),ee(!0),q(!1)):F((Ae==null?void 0:Ae.message)||"Something went wrong.")})}else F("Please Select A Card/ACH");else F("Please Select Customer");else F("Something went wrong.")},U=async()=>{var T,ce,Z,ie,ue,_e;let l=e==null?void 0:e.merchantPublicKey,a=e==null?void 0:e.orderID,L=String(e==null?void 0:e.amount),ne=e==null?void 0:e.customerId;if(!(He!=null&&He.device_id)){F("Please Select A Payment Device");return}if(l&&a&&L){q(!0);let Ke={amount:L,fractalpayPublicKey:l,customer_order_id:a,device_id:He==null?void 0:He.device_id,customer_id:ne||""};try{let J=await Ot.post(`${re}charge-with-reader`,Ke);console.log(J,"response"),((T=J==null?void 0:J.data)==null?void 0:T.result)==!0?(ye((Z=(ce=J==null?void 0:J.data)==null?void 0:ce.data)==null?void 0:Z.transaction_id),ee(!0),q(!1)):(F(((ie=J==null?void 0:J.data)==null?void 0:ie.message)||"Something went wrong."),q(!1))}catch(J){F(((_e=(ue=J==null?void 0:J.response)==null?void 0:ue.data)==null?void 0:_e.message)||"Something went wrong."),q(!1)}}else F("Something went wrong.")},ze=()=>{u==="card"?W():u==="reader"&&U()};ni(()=>{r&&we&&xe()},[we,r]);let Ie=async l=>{Xt.fire({icon:"warning",text:"Do you want to delete the card?",showCancelButton:!0,confirmButtonText:"Yes",cancelButtonText:"No",reverseButtons:!0,buttonsStyling:!1,customClass:{confirmButton:"swal2-confirm btn btn-dark",cancelButton:"swal2-cancel btn btn-dark",popup:"custom-swal-popup",icon:"custom-swal-icon"}}).then(async a=>{if(a.isConfirmed){q(!0);try{let L={card_id:l,customer_id:e==null?void 0:e.customerId,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey},ne=await Ot.post(`${re}delete-customer-card`,L);q(!1),xe(),Xt.fire({icon:"success",title:"Deleted!",text:"Card deleted.",confirmButtonText:"OK",showConfirmButton:!0,timer:1e3,timerProgressBar:!0,customClass:{confirmButton:"btn btn-dark"}})}catch(L){q(!1),Xt.fire({icon:"error",title:"Error!",text:"Failed to delete the card.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}}else a.dismiss===Xt.DismissReason.cancel&&Xt.fire({icon:"info",text:"Card not deleted",confirmButtonText:"OK",buttonsStyling:!1,customClass:{confirmButton:"btn btn-dark float-end",actions:"swal2-actions-end"}})})},qe=l=>{switch(l==null?void 0:l.toLowerCase()){case"visa":return Ye;case"mastercard":case"mc":case"m/c":return ot;case"amex":case"american express":case"ae":return Ee;case"discover":return f;case"bank":return i;default:return l}};return t.createElement(t.Fragment,null,t.createElement(Pt,null),t.createElement(Ut,null),t.createElement(t.Fragment,null,t.createElement("button",{className:"paymentBtn",onClick:De},"Pay"),t.createElement(wt,{open:r,onClose:Ve},pe&&t.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},t.createElement(At,{error:pe,onClose:Ve})),Le&&t.createElement(Jt,{onClose:Ve,tranId:je}),!pe&&!Le&&t.createElement(t.Fragment,null,(N||j)&&t.createElement(dt,{loading:N||j}),t.createElement("div",{className:"frac-card-payment-page frac-form"},t.createElement("div",{className:"parent-pay-container"},t.createElement("span",{className:"request-payment-close-popup",onClick:Ve},t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},t.createElement("g",{clipPath:"url(#clip0_12425_52336)"},t.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),t.createElement("defs",null,t.createElement("clipPath",{id:"clip0_12425_52336"},t.createElement("rect",{width:"16",height:"16",fill:"white"}))))),t.createElement("div",{className:"pay-main-logo-res"},t.createElement("img",{src:g==null?void 0:g.logo,id:"pay-logos"})),t.createElement("div",{className:"pay-container"},t.createElement("div",{className:"pay-header pay-conatiner-one"},t.createElement("div",{className:"pay-conatiner-one-first"},t.createElement("div",{className:"pay-logo-container"},t.createElement("div",{className:"pay-main-logo"},t.createElement("img",{src:g==null?void 0:g.logo,id:"pay-logos"})),t.createElement("h1",{className:"pay-heading"},"Pay"),(z==null?void 0:z.length)>0&&y!=="cardList"&&t.createElement("button",{className:"res-charge-payment-back-btn ",onClick:()=>p("cardList")}," ",t.createElement(vn,null)," Back")),t.createElement("div",{className:"amt-pay-con"},t.createElement("div",{className:"pay-amount-conatiner"},t.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),t.createElement("strong",{className:"pay-amount"},"$",(Be=Number(e==null?void 0:e.amount))==null?void 0:Be.toFixed(2))),y!="ach"&&t.createElement("div",{style:{display:"flex",gap:"8px",margin:"8px 0"}},t.createElement("img",{src:Ye,alt:"",width:33}),t.createElement("img",{src:ot,width:33,alt:""}),t.createElement("img",{src:Ee,alt:"",width:33}),t.createElement("img",{src:f,width:33,alt:""})))),t.createElement("div",{className:"pay-conatiner-one-last"},t.createElement("img",{src:m,alt:""}),t.createElement("img",{src:B,alt:""}),"Secure payments powered by Fractal"),t.createElement("div",null)),t.createElement("div",{className:"pay-tab pay-conatiner-two"},!N&&t.createElement("div",{className:"col-md-12"},t.createElement("div",{id:"payment-form-div"},y!=="cardList"?t.createElement("div",null,(z==null?void 0:z.length)>0&&t.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>p("cardList")}," ",t.createElement(vn,null)," Back"),(g==null?void 0:g.isSkyFiAccount)&&t.createElement("div",{className:"tab"},t.createElement("button",{className:"tablinks",onClick:l=>{vt("card")},style:{border:y==="card"?"1px solid":""}},t.createElement("i",{className:"fas fa-credit-card me-2",style:{marginRight:"8px",fontSize:"15px"}}),"Card"),t.createElement("button",{className:"tablinks",onClick:l=>{vt("ach")},style:{border:y==="ach"?"1px solid":""}},t.createElement("i",{className:"fas fa-university me-2",style:{marginRight:"8px",fontSize:"15px"}}),"Bank")),t.createElement("div",{className:"res-pay-con"},t.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},t.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),t.createElement("strong",{className:"pay-amount"},"$",(Re=Number(e==null?void 0:e.amount))==null?void 0:Re.toFixed(2))),y!="ach"&&t.createElement("div",null,t.createElement("div",null,t.createElement("img",{src:Ye,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:ot,width:35,alt:""})),t.createElement("div",null,t.createElement("img",{src:Ee,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:f,width:35,alt:""}))))):t.createElement("div",null,t.createElement("h6",{className:"charge-customer-name",style:{marginBottom:"16px !important"}}," Charge ",g==null?void 0:g.customer_name),t.createElement("h6",{className:"card-ach-heading",style:{marginBottom:"10px !important"}}," ",u==="card"?"Cards/Banks":"Readers"," "),t.createElement("div",{className:"res-pay-con"},t.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},t.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),t.createElement("strong",{className:"pay-amount"},"$",(We=Number(e==null?void 0:e.amount))==null?void 0:We.toFixed(2))),t.createElement("div",null,t.createElement("div",null,t.createElement("img",{src:Ye,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:ot,width:35,alt:""})),t.createElement("div",null,t.createElement("img",{src:Ee,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:f,width:35,alt:""}))))),t.createElement("div",{id:"ach",style:{display:y==="cardList"?"block":"none"},className:"tabcontent"},t.createElement("div",{className:"card-lint-div-in"},t.createElement("div",{className:"card-list-div"},u==="card"?t.createElement(t.Fragment,null,(g==null?void 0:g.card_list)&&((Ge=g==null?void 0:g.card_list)==null?void 0:Ge.length)>0&&((et=g==null?void 0:g.card_list)==null?void 0:et.map((l,a)=>t.createElement("div",{className:"card-list-single-div",key:a},t.createElement("div",{className:"card-number-radio"},t.createElement("input",{disabled:(g==null?void 0:g.paymentGateway)!=(l==null?void 0:l.payment_method_type)&&(l==null?void 0:l.card_type)!="Bank",type:"radio",className:"cardRadio",name:"selected_card",id:"",checked:Oe===l,onChange:L=>bt(l)}),t.createElement("label",{htmlFor:"",className:"card-number-last-four"},"**** ",l==null?void 0:l.cardlastfourdigit),(l==null?void 0:l.card_type)!="Bank"&&t.createElement("h6",{className:"card-expiry-date"},l==null?void 0:l.expmonth,"/",l==null?void 0:l.expyear)),t.createElement("div",{className:"card-number-radio"},t.createElement("span",{className:"visa-card"},t.createElement("img",{src:qe(l==null?void 0:l.card_type),alt:""})),t.createElement("span",{className:"visa-card",style:{cursor:"pointer"},onClick:()=>Ie(l==null?void 0:l.id)},t.createElement("img",{src:h,alt:""}))))))):t.createElement(t.Fragment,null,(g==null?void 0:g.paymentDeviceList)&&((Ue=g==null?void 0:g.paymentDeviceList)==null?void 0:Ue.length)>0&&((mt=g==null?void 0:g.paymentDeviceList)==null?void 0:mt.map((l,a)=>t.createElement("div",{className:"card-list-single-div",key:a},t.createElement("div",{className:"card-number-radio"},t.createElement("input",{type:"radio",className:"cardRadio",name:"selected_reader",id:"",checked:He===l,onChange:L=>at(l)}),t.createElement("label",{htmlFor:"",className:"card-number-last-four"},l==null?void 0:l.device_name)),t.createElement("div",{className:"card-number-radio"},t.createElement("span",{className:"visa-card"},t.createElement("img",{src:P,alt:""})))))))),t.createElement("div",{className:"pay-with-other-card",onClick:()=>p("card")},"Pay With Other Card",t.createElement("img",{src:Fe,alt:""})),u==="card"&&(g==null?void 0:g.paymentDeviceList)&&((ct=g==null?void 0:g.paymentDeviceList)==null?void 0:ct.length)>0&&t.createElement("div",{className:"pay-with-other-card ",onClick:()=>he("reader")},"Pay With Reader",t.createElement("img",{src:P,alt:""})),u==="reader"&&(g==null?void 0:g.paymentDeviceList)&&((ut=g==null?void 0:g.paymentDeviceList)==null?void 0:ut.length)>0&&t.createElement("div",{className:"pay-with-other-card ",onClick:()=>he("card")},"Pay With Saved Card",t.createElement("img",{src:Fe,alt:""}))),t.createElement("div",{className:"form-group",style:{padding:"0"}},t.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:ze},"$",(Te=Number(e==null?void 0:e.amount))==null?void 0:Te.toFixed(2)))),t.createElement("div",{id:"card",style:{display:y==="card"?"block":"none"},className:"tabcontent"},te?t.createElement("form",{id:"PaymentForm",style:{textAlign:"start"},onSubmit:H},t.createElement("div",{className:"ach-scrl",style:{minHeight:g!=null&&g.isSkyFiAccount&&(z==null?void 0:z.length)>0?"398px":g!=null&&g.isSkyFiAccount&&(z==null?void 0:z.length)==0?"456px":(z==null?void 0:z.length)>0?"462px":"520px",overflow:"auto",marginRight:"5px"}},t.createElement("div",{className:"form-group"},t.createElement("label",{htmlFor:"cardHolderName"},"NAME ON CARD "),t.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"John Doe",value:(s==null?void 0:s.cardName)||"",onChange:l=>{let a=l.target.value;/^[a-zA-Z\s]*$/.test(a)&&rt("cardName",a)}}),(_==null?void 0:_.cardName)&&t.createElement("span",{className:"error-span"},_==null?void 0:_.cardName)),t.createElement("div",{className:"form-group"},t.createElement("label",{htmlFor:"cardNumber"},"CARD NUMBER"),t.createElement("div",{className:"toggle-num-wrapper"},t.createElement("input",{className:"form-control card-number-new",type:"text",maxLength:19,inputMode:"numeric",placeholder:"0000 0000 0000 0000",value:(s==null?void 0:s.cardNumber)||"",onChange:l=>Lt(l),"data-token":"card_number"}),t.createElement("div",{className:"card-crdi card-expiry-new"},t.createElement("div",{className:"exp-date-year-container"},t.createElement("div",{className:"exp-date form-group"},t.createElement("input",{"data-token":"exp_month",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"MM",maxLength:2,value:(s==null?void 0:s.expiryMonth)||"",onChange:l=>rt("expiryMonth",l.target.value)})),t.createElement("div",{className:"exp-year form-group"},t.createElement("input",{"data-token":"exp_year",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"YYYY",maxLength:4,value:(s==null?void 0:s.expiryYear)||"",onChange:l=>rt("expiryYear",l.target.value)})),t.createElement("div",{className:"security-digit form-group"},t.createElement("input",{"data-token":"cvv",className:"form-control card-cvv-in required",type:"text",style:{maxHeight:"36px"},maxLength:4,placeholder:"CVC",value:(s==null?void 0:s.cvv)||"",onChange:l=>rt("cvv",l.target.value)})))),(_==null?void 0:_.cardNumber)&&t.createElement("span",{className:"error-span"},_==null?void 0:_.cardNumber),t.createElement("p",{style:{margin:"0"}},_!=null&&_.expiryMonth||_!=null&&_.expiryYear?t.createElement("span",{className:"error-span",style:{paddingRight:"4px"}},_==null?void 0:_.expiryMonth):"",(_==null?void 0:_.cvv)&&t.createElement("span",{className:"error-span"},_==null?void 0:_.cvv)))),t.createElement("div",{className:"form-group"},t.createElement("label",{htmlFor:"OrderId"},"Order ID / Description"),t.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"OID123456",disabled:!0,value:(G=e==null?void 0:e.orderID)!=null?G:"",style:{background:"#F6F6F7",color:"#727272"}})),t.createElement("div",{className:"form-group"},t.createElement("label",{htmlFor:"zip"},"ZIP"),t.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"000000",value:(st=s==null?void 0:s.zipCode)!=null?st:"",onChange:l=>rt("zipCode",l.target.value)}),(_==null?void 0:_.zipCode)&&t.createElement("span",{className:"error-span"},_==null?void 0:_.zipCode)),(e==null?void 0:e.customerId)&&t.createElement("div",{className:"form-group"},t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px",paddingTop:"10px"}},t.createElement("input",{type:"checkbox",id:"save_card",className:"toggle-checkbox",checked:fe,onChange:l=>le(l.target.checked)}),t.createElement("label",{htmlFor:"save_card",className:"toggle-label"}),t.createElement("label",{htmlFor:"save_card"},"Save card for future payments "),t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},t.createElement("g",{clipPath:"url(#clip0_12420_50192)"},t.createElement("rect",{width:"20",height:"20",fill:"white"}),t.createElement("circle",{cx:"10",cy:"10",r:"10",fill:"#E0DFE2"}),t.createElement("path",{d:"M9.03406 12.0979V12.0072C9.04055 11.4153 9.10057 10.9443 9.21411 10.5943C9.3309 10.2442 9.49635 9.96102 9.71046 9.74463C9.92457 9.52824 10.1825 9.33095 10.4842 9.15274C10.6788 9.03182 10.854 8.89658 11.0097 8.74702C11.1655 8.59745 11.2887 8.42562 11.3796 8.2315C11.4704 8.03739 11.5158 7.82259 11.5158 7.58711C11.5158 7.3039 11.4477 7.05887 11.3114 6.85203C11.1752 6.64519 10.9935 6.48608 10.7664 6.3747C10.5426 6.26014 10.2928 6.20286 10.017 6.20286C9.76723 6.20286 9.52879 6.25378 9.3017 6.35561C9.07461 6.45744 8.88646 6.61655 8.73723 6.83294C8.588 7.04614 8.50203 7.3214 8.47932 7.65871H7C7.02271 7.08592 7.17032 6.60223 7.44282 6.20764C7.71533 5.80986 8.07543 5.50915 8.52311 5.30549C8.97405 5.10183 9.47202 5 10.017 5C10.6139 5 11.1363 5.10979 11.5839 5.32936C12.0316 5.54574 12.3788 5.84964 12.6253 6.24105C12.8751 6.62928 13 7.08274 13 7.60143C13 7.95784 12.9432 8.27924 12.8297 8.56563C12.7161 8.84885 12.5539 9.10183 12.3431 9.32458C12.1354 9.54733 11.8856 9.74463 11.5937 9.91647C11.3179 10.0851 11.0941 10.2601 10.9221 10.4415C10.7534 10.6229 10.6302 10.8377 10.5523 11.0859C10.4745 11.3341 10.4323 11.6412 10.4258 12.0072V12.0979H9.03406ZM9.76886 15C9.50284 15 9.27413 14.9077 9.08273 14.7232C8.89132 14.5354 8.79562 14.3095 8.79562 14.0453C8.79562 13.7844 8.89132 13.5617 9.08273 13.3771C9.27413 13.1893 9.50284 13.0955 9.76886 13.0955C10.0316 13.0955 10.2587 13.1893 10.4501 13.3771C10.6448 13.5617 10.7421 13.7844 10.7421 14.0453C10.7421 14.2204 10.6967 14.3811 10.6058 14.5274C10.5182 14.6706 10.4015 14.7852 10.2555 14.8711C10.1095 14.957 9.94728 15 9.76886 15Z",fill:"#161616"})),t.createElement("defs",null,t.createElement("clipPath",{id:"clip0_12420_50192"},t.createElement("rect",{width:"20",height:"20",fill:"white"}))))))),t.createElement("div",{className:"form-group",style:{marginTop:"20px",padding:"0"}},(g==null?void 0:g.paymentDeviceList)&&((gt=g==null?void 0:g.paymentDeviceList)==null?void 0:gt.length)>0&&t.createElement("button",{type:"button",style:{marginBottom:"10px"},className:"pay-button",onClick:()=>E(!te)},te?"Pay With Reader":"Pay With Card"),t.createElement("button",{type:"submit",style:{margin:0},className:"pay-button"},"$",(Yt=Number(e==null?void 0:e.amount))==null?void 0:Yt.toFixed(2)))):t.createElement(t.Fragment,null,t.createElement("h6",{className:"card-ach-heading",style:{marginBottom:"10px !important"}},"Readers"),t.createElement("div",{className:"card-lint-div-in"},t.createElement("div",{className:"card-list-div"},(g==null?void 0:g.paymentDeviceList)&&((be=g==null?void 0:g.paymentDeviceList)==null?void 0:be.length)>0&&((Bt=g==null?void 0:g.paymentDeviceList)==null?void 0:Bt.map((l,a)=>t.createElement("div",{className:"card-list-single-div",key:a},t.createElement("div",{className:"card-number-radio"},t.createElement("input",{type:"radio",className:"cardRadio",name:"selected_reader",id:"",checked:He===l,onChange:L=>at(l)}),t.createElement("label",{htmlFor:"",className:"card-number-last-four"},l==null?void 0:l.device_name)),t.createElement("div",{className:"card-number-radio"},t.createElement("span",{className:"visa-card"},t.createElement("img",{src:P,alt:""})))))))),t.createElement("div",{className:"form-group",style:{marginTop:"20px",padding:"0"}},(g==null?void 0:g.paymentDeviceList)&&((pt=g==null?void 0:g.paymentDeviceList)==null?void 0:pt.length)>0&&t.createElement("button",{type:"button",style:{marginBottom:"10px"},className:"pay-button",onClick:()=>E(!te)},te?"Pay With Reader":"Pay With Card"),t.createElement("button",{onClick:U,className:"pay-button"},"$",(me=Number(e==null?void 0:e.amount))==null?void 0:me.toFixed(2))))),t.createElement("div",{id:"ach",style:{display:y==="ach"?"block":"none"},className:"tabcontent"},t.createElement("form",{id:"ACHPaymentForm",style:{textAlign:"start"},onSubmit:H},t.createElement("div",{className:"ach-scrl",style:{minHeight:g!=null&&g.isSkyFiAccount&&(z==null?void 0:z.length)>0?"378px":g!=null&&g.isSkyFiAccount&&(z==null?void 0:z.length)==0?"436px":(z==null?void 0:z.length)>0?"462px":"520px",maxHeight:g!=null&&g.isSkyFiAccount&&(z==null?void 0:z.length)>0?"358px":((z==null?void 0:z.length)>0,"380px")}},t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"nameonaccount"},"Name on account"),t.createElement("input",{type:"text",id:"nameonaccount",className:"form-control",maxLength:100,placeholder:"John Doe",name:"name",value:(ke=k==null?void 0:k.name)!=null?ke:"",onChange:de}),(o==null?void 0:o.name)&&t.createElement("span",{className:"error-span"},o==null?void 0:o.name)),t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"routingnumber"},"Routing number"),t.createElement("input",{type:"text",id:"routingnumber",className:"form-control",maxLength:9,placeholder:"000000000",name:"routingNumber",value:(Kt=k==null?void 0:k.routingNumber)!=null?Kt:"",onChange:de}),(o==null?void 0:o.routingNumber)&&t.createElement("span",{className:"error-span"},o==null?void 0:o.routingNumber)),t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"accountnumber"},"Account number"),t.createElement("input",{type:"text",id:"accountnumber",className:"form-control",maxLength:16,placeholder:"0000000000",name:"accountNumber",value:(Nt=k==null?void 0:k.accountNumber)!=null?Nt:"",onChange:de}),(o==null?void 0:o.accountNumber)&&t.createElement("span",{className:"error-span"},o==null?void 0:o.accountNumber)),t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"confirmaccountnumber"},"Confirm account number"),t.createElement("input",{type:"text",id:"confirmaccountnumber",className:"form-control",maxLength:16,placeholder:"0000000000",name:"confirmAccountNumber",value:(Zt=k==null?void 0:k.confirmAccountNumber)!=null?Zt:"",onChange:de}),(o==null?void 0:o.confirmAccountNumber)&&t.createElement("span",{className:"error-span"},o==null?void 0:o.confirmAccountNumber)),t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"bankname"},"Bank name"),t.createElement("input",{type:"text",id:"bankname",className:"form-control",maxLength:100,placeholder:"My Bank",name:"bankName",value:(Je=k==null?void 0:k.bankName)!=null?Je:"",onChange:de}),(o==null?void 0:o.bankName)&&t.createElement("span",{className:"error-span"},o==null?void 0:o.bankName)),t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"accounttype"},"Select account type"),t.createElement("select",{name:"accountType",id:"accounttype",className:"form-control",value:(Tt=k==null?void 0:k.accountType)!=null?Tt:"",onChange:de},t.createElement("option",{value:""},"Select account"),t.createElement("option",{value:"Personal Saving"},"Personal Saving"),t.createElement("option",{value:"Business Saving"},"Business Saving"),t.createElement("option",{value:"Personal Checking"},"Personal Checking"),t.createElement("option",{value:"Business Checking"},"Business Checking"))),(e==null?void 0:e.customerId)&&t.createElement("div",{className:"form-group mb-4 save-ach-div",style:{paddingTop:"5px"}},t.createElement("input",{type:"checkbox",id:"saveACH",className:"",maxLength:100,placeholder:"My Bank",checked:Me,onChange:l=>Ce(l.target.checked)}),t.createElement("label",{htmlFor:"saveACH"},"Save ACH")),Me&&t.createElement("div",{className:"form-group mb-4",style:{fontSize:"12px",color:"#727272"}},t.createElement("p",null,"If checked, I agree for ",t.createElement("b",null,"ecommerce")," to have my permission to charge this credit card for agreed upon purchases in the future."))),t.createElement("div",{className:"form-group "},t.createElement("button",{className:"pay-button",style:{margin:"20px 0 0"},type:"submit"},"$",(en=Number(e==null?void 0:e.amount))==null?void 0:en.toFixed(2)))))))))))))))}import n,{useEffect as oi,useState as it}from"react";import Qt from"axios";import dn from"sweetalert2";import{IoArrowBack as Cn}from"react-icons/io5";function ai(e){var ye,oe,O,Ve,De,vt,rt,Lt,de;let[N,Y]=it(!1),[j,q]=it(!1),[pe,F]=it(""),[Le,ee]=it(!1),[r,d]=it(!1),[y,p]=it("card"),[u,he]=it(!1),te=e.merchantPublicKey,E=ge+"widget/mc-img.svg",fe=ge+"widget/visa-img.svg",le=ge+"widget/ae-img.svg",Me=ge+"widget/discover-img.svg",Ce=ge+"widget/card.svg",we=ge+"widget/Trash.svg",ot=ge+"widget/bank.svg",Ye=ge+"widget/secure-img.png",Ee=ge+"widget/pov-by.png",[f,Fe]=it(),[h,i]=it({}),[m,B]=it([]),[P,s]=it(),[S,_]=it(),[V,k]=it(""),c=()=>Y(!0),o=()=>Y(!1),M=()=>{d(!1),p("card"),q(!1),F(""),ee(!1),k(""),Fe({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),i({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),he(!1),s({card_type:"",cardlastfourdigit:"",expmonth:1,expyear:2025,primary_card:0,firstname:"",id:"",lastname:""})},z=()=>d(!0),Ne=(v,w)=>{let H=v;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(H)){(w===""||/^[0-9]+$/.test(w))&&(i(W=>A(I({},W),{[H]:""})),Fe(W=>A(I({},W),{[H]:w})));return}i(W=>A(I({},W),{[H]:""})),Fe(W=>A(I({},W),{[H]:w}))},Oe=v=>{let H=v.target.value.replace(/\D/g,""),xe="";/^3[47]/.test(H)?xe=H.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(U,ze,Ie,qe)=>[ze,Ie,qe].filter(Boolean).join(" ")):xe=H.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(U,ze,Ie,qe,Be)=>[ze,Ie,qe,Be].filter(Boolean).join(" ")),i(W=>A(I({},W),{cardNumber:""})),Fe(W=>A(I({},W),{cardNumber:xe}))},bt=()=>{var W,U,ze,Ie,qe,Be;let v={},w=f,H=parseInt((w==null?void 0:w.expiryMonth)||"",10),xe=(w==null?void 0:w.expiryYear)||"";if((W=w==null?void 0:w.cardName)!=null&&W.trim()||(v.cardName="Card name is required"),(U=w==null?void 0:w.cardNumber)!=null&&U.trim()||(v.cardNumber="Card number is required"),(!((ze=w==null?void 0:w.expiryMonth)!=null&&ze.trim())||!((Ie=w==null?void 0:w.expiryYear)!=null&&Ie.trim())||isNaN(H)||H<1||H>12||xe.length!==4)&&(v.expiryMonth="Invalid Expiration Date."),(qe=w==null?void 0:w.cvv)!=null&&qe.trim()||(v.cvv="CVV is required"),(Be=w==null?void 0:w.zipCode)!=null&&Be.trim()||(v.zipCode="ZIP code is required"),w!=null&&w.expiryMonth&&(w!=null&&w.expiryYear)&&w.expiryMonth.length<=2&&w.expiryYear.length===4){let Re=parseInt(w.expiryMonth,10),We=parseInt(w.expiryYear,10),Ge=new Date,et=Ge.getMonth()+1,Ue=Ge.getFullYear();(We<Ue||We===Ue&&Re<et)&&(v.expiryMonth="Card is expired")}return i(v),Object.keys(v).length>0},He=async v=>{var w,H,xe,W,U,ze,Ie,qe,Be,Re,We,Ge,et,Ue,mt,ct,ut,Te,G;if(v.preventDefault(),y=="card"){if(bt())return;{let gt=DatacapWebToken.validateCardNumber(f==null?void 0:f.cardNumber.replaceAll(" ","")),Yt=DatacapWebToken.validateExpirationDate(f==null?void 0:f.expiryMonth,f==null?void 0:f.expiryYear),be=DatacapWebToken.validateCVV(f==null?void 0:f.cvv),Bt={};if(gt||(Bt.cardNumber="Invalid card Number"),Yt||(Bt.expiryMonth="Invalid Expiration Date."),be||(Bt.cvv="Invalid CVV"),i(Bt),gt&&be&&Yt){q(!0);try{let pt=async function(me){if(me.Error)F(me.Error),q(!1);else{let ke=f==null?void 0:f.cardName,Kt=f==null?void 0:f.zipCode;me.name=ke,me.postal_code=Kt,me.fractalpayPublicKey=e==null?void 0:e.merchantPublicKey,me.amount=e==null?void 0:e.amount,me.order_id=e==null?void 0:e.orderID,me.preAuth_id="",me.isCardSave=u,me.customer_id=e==null?void 0:e.customerId,me.link_token="",me.gateway_id=S==null?void 0:S.paymentGateway,me.discount=e==null?void 0:e.discount,me.tax=e==null?void 0:e.tax,me.surcharge=e==null?void 0:e.surcharge,new Headers().append("Content-Type","application/json");let Zt={method:"POST",body:JSON.stringify(me),redirect:"follow"};Qe.emit("sendMessage",A(I({},Zt),{isChargePreauth:!0})),Qe.on("charge-preauth",Je=>{var Tt;console.log(Je,"datdata"),(Je==null?void 0:Je.status)=="Failed"?(q(!1),F((Je==null?void 0:Je.message)||"Something went wrong. Please try again later.")):(ee(!0),k((Tt=Je==null?void 0:Je.data)==null?void 0:Tt.transaction_id),q(!1),Fe({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}))})}};if((S==null?void 0:S.paymentGateway)===32){let me={method:"POST",redirect:"follow"};try{let ke=await Qt.post(`${yt}api/v1/widget/generate-session`,me),Kt=Number(f==null?void 0:f.expiryYear)%100,Nt=f==null?void 0:f.cardNumber;Nt=Nt==null?void 0:Nt.replace(/\s+/g,"");let Zt=`${Nt}=${Kt}${f==null?void 0:f.expiryMonth} ${f==null?void 0:f.cvv}`,Tt=forge.pki.publicKeyFromPem((H=(w=ke==null?void 0:ke.data)==null?void 0:w.data)==null?void 0:H.publicKeyPem).encrypt(Zt,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),en=forge.util.encode64(Tt),l={"Content-Type":"application/json","x-app-session-key":(W=(xe=ke.data)==null?void 0:xe.data)==null?void 0:W.session_key},a=JSON.stringify({enc_track2_data:`${en}`,algorithm:"RSAES_OAEP_SHA_1",session_key:`${(ze=(U=ke==null?void 0:ke.data)==null?void 0:U.data)==null?void 0:ze.session_key}`});try{let L=await Qt.post(`${Ft}tokenizer/tokenize`,a,{headers:l}),ne=JSON.stringify(A(I({},(Ie=L==null?void 0:L.data)==null?void 0:Ie.data),{name:f==null?void 0:f.cardName,postal_code:f==null?void 0:f.zipCode,customer_id:e==null?void 0:e.customerId,amount:e==null?void 0:e.amount,Token:`${(Be=(qe=L==null?void 0:L.data)==null?void 0:qe.data)==null?void 0:Be.token}`,fractalpayPublicKey:te,order_id:e==null?void 0:e.orderID,preAuth_id:"",isCardSave:u,discount:e==null?void 0:e.discount,surcharge:e==null?void 0:e.surcharge,tax:e==null?void 0:e.tax,link_token:"",ExpirationYear:f==null?void 0:f.expiryYear,ExpirationMonth:f==null?void 0:f.expiryMonth,CVV:f==null?void 0:f.cvv,Last4:(We=(Re=L==null?void 0:L.data)==null?void 0:Re.data)==null?void 0:We.last4,Brand:(et=(Ge=L==null?void 0:L.data)==null?void 0:Ge.data)==null?void 0:et.brand,gateway_id:S==null?void 0:S.paymentGateway})),ce={method:"POST",headers:{"Content-Type":"application/json"},body:ne,redirect:"follow"};Qe.emit("sendMessage",A(I({},ce),{isFractalPreauth:!0})),Qe.on("fractal-charge-preauth",Z=>{var ie;(Z==null?void 0:Z.status)=="Failed"?(q(!1),F((Z==null?void 0:Z.message)||"Something went wrong , Try again later")):(k((ie=Z==null?void 0:Z.data)==null?void 0:ie.transaction_id),ee(!0),q(!1))})}catch(L){console.log(L),q(!1),F(((mt=(Ue=L==null?void 0:L.response)==null?void 0:Ue.data)==null?void 0:mt.message)||(L==null?void 0:L.message)||"Something went wrong , Try again later")}}catch(ke){q(!1),F(((ut=(ct=ke==null?void 0:ke.response)==null?void 0:ct.data)==null?void 0:ut.message)||(ke==null?void 0:ke.message)||"Something went wrong , Try again later")}}else DatacapWebToken.requestToken(S==null?void 0:S.dctoken,"PaymentForm",pt)}catch(pt){q(!1),F(((G=(Te=pt==null?void 0:pt.response)==null?void 0:Te.data)==null?void 0:G.message)||(pt==null?void 0:pt.message)||"Something went wrong.")}}}}},at=async()=>{var v,w,H,xe,W,U,ze,Ie,qe,Be,Re,We,Ge,et,Ue,mt,ct,ut;c();try{let Te={fractalpayPublicKey:te,customer_id:e==null?void 0:e.customerId,preauth:!0},G=await Qt.post(`${re}get-payment-details`,Te);if(_((v=G==null?void 0:G.data)==null?void 0:v.data),(H=(w=G==null?void 0:G.data)==null?void 0:w.data)!=null&&H.paymentGateway||(M(),F("Something went wrong.")),(W=(xe=G==null?void 0:G.data)==null?void 0:xe.data)!=null&&W.card_list&&((Ie=(ze=(U=G==null?void 0:G.data)==null?void 0:U.data)==null?void 0:ze.card_list)==null?void 0:Ie.length)>0){B((Be=(qe=G==null?void 0:G.data)==null?void 0:qe.data)==null?void 0:Be.card_list),p("cardList");let st=(Ge=(We=(Re=G==null?void 0:G.data)==null?void 0:Re.data)==null?void 0:We.card_list)==null?void 0:Ge.filter(gt=>(gt==null?void 0:gt.primary_card)==1);st!=null&&st[0]&&((et=st==null?void 0:st[0])==null?void 0:et.payment_method_type)==((mt=(Ue=G==null?void 0:G.data)==null?void 0:Ue.data)==null?void 0:mt.paymentGateway)&&s(st[0])}else p("card");o()}catch(Te){console.log(Te),o(),F(((ut=(ct=Te==null?void 0:Te.response)==null?void 0:ct.data)==null?void 0:ut.message)||(Te==null?void 0:Te.message)||"Something went wrong")}},g=async()=>{var Re,We,Ge,et,Ue,mt,ct;let v=e==null?void 0:e.customerId,w=e==null?void 0:e.discount,H=e==null?void 0:e.surcharge,xe=e==null?void 0:e.tax,W=e==null?void 0:e.merchantPublicKey,U=e==null?void 0:e.orderID,ze=e==null?void 0:e.amount,Ie=P==null?void 0:P.id,qe=P==null?void 0:P.card_type;if(W&&U&&ze)if(v)if(Ie){let ut={amount:ze,order_id:U,customer_id:v,card_id:Ie,fractalpayPublicKey:W,isCardSave:qe!="Bank",discount:w,surcharge:H,tax:xe},Be=ut,{isCardSave:Te}=Be,G=on(Be,["isCardSave"]),gt=re+"authorize-by-card",Yt={"Content-Type":"application/json"};q(!0);try{let be=await Qt.post(gt,qe=="Bank"?G:ut,{headers:Yt});(Re=be==null?void 0:be.data)!=null&&Re.result&&(k((Ge=(We=be==null?void 0:be.data)==null?void 0:We.data)==null?void 0:Ge.transaction_id),ee(!0),q(!1))}catch(be){q(!1),console.log(be),F(((Ue=(et=be==null?void 0:be.response)==null?void 0:et.data)==null?void 0:Ue.message)||((ct=(mt=be==null?void 0:be.response)==null?void 0:mt.data)==null?void 0:ct.status)||"Something went erong")}}else F("Please Select A Card/ACH");else F("Please Select Customer");else F("Something went wrong.")};oi(()=>{r&&te&&at()},[te,r]);let St=async v=>{dn.fire({icon:"warning",text:"Do you want to delete the card?",showCancelButton:!0,confirmButtonText:"Yes",cancelButtonText:"No",reverseButtons:!0,buttonsStyling:!1,customClass:{confirmButton:"swal2-confirm btn btn-dark",cancelButton:"swal2-cancel btn btn-dark",popup:"custom-swal-popup",icon:"custom-swal-icon"}}).then(async w=>{if(w.isConfirmed){q(!0);try{let H={card_id:v,customer_id:e==null?void 0:e.customerId,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey},xe=await Qt.post(`${re}delete-customer-card`,H);q(!1),at(),dn.fire({icon:"success",title:"Deleted!",text:"The card has been deleted.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}catch(H){q(!1),dn.fire({icon:"error",title:"Error!",text:"Failed to delete the card.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}}})},je=v=>{switch(v==null?void 0:v.toLowerCase()){case"visa":return fe;case"mastercard":case"mc":case"m/c":return E;case"amex":case"american express":case"ae":return le;case"discover":return Me;case"bank":return ot;default:return v}};return n.createElement(n.Fragment,null,n.createElement(Pt,null),n.createElement(Ut,null),n.createElement(n.Fragment,null,n.createElement("button",{className:"paymentBtn",onClick:z},"PreAuth Payment"),n.createElement(wt,{open:r,onClose:M},pe&&n.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},n.createElement(At,{error:pe,onClose:M})),Le&&n.createElement(Jt,{onClose:M,tranId:V}),!pe&&!Le&&n.createElement(n.Fragment,null,(N||j)&&n.createElement(dt,{loading:N||j}),n.createElement("div",null,n.createElement("div",{className:"frac-card-payment-page frac-form"},n.createElement("div",{className:"parent-pay-container"},n.createElement("span",{className:"request-payment-close-popup",onClick:M},n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},n.createElement("g",{clipPath:"url(#clip0_12425_52336)"},n.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),n.createElement("defs",null,n.createElement("clipPath",{id:"clip0_12425_52336"},n.createElement("rect",{width:"16",height:"16",fill:"white"}))))),n.createElement("div",{className:"pay-container"},n.createElement("div",{className:"pay-header pay-conatiner-one"},n.createElement("div",{className:"pay-conatiner-one-first"},n.createElement("div",{className:"pay-logo-container"},n.createElement("div",{className:"pay-main-logo"},n.createElement("img",{src:S==null?void 0:S.logo,id:"pay-logos"})),n.createElement("h1",{className:"pay-heading"},"Pay"),(m==null?void 0:m.length)>0&&y!=="cardList"&&n.createElement("button",{className:"res-charge-payment-back-btn ",onClick:()=>p("cardList")}," ",n.createElement(Cn,null)," Back")),n.createElement("div",{className:"amt-pay-con"},n.createElement("div",{className:"pay-amount-conatiner"},n.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),n.createElement("strong",{className:"pay-amount"},"$",(ye=Number(e==null?void 0:e.amount))==null?void 0:ye.toFixed(2))),y!="ach"&&n.createElement("div",{style:{display:"flex",gap:"8px",margin:"8px 0"}},n.createElement("img",{src:fe,alt:"",width:33}),n.createElement("img",{src:E,width:33,alt:""}),n.createElement("img",{src:le,alt:"",width:33}),n.createElement("img",{src:Me,width:33,alt:""})))),n.createElement("div",{className:"pay-conatiner-one-last"},n.createElement("img",{src:Ye,alt:""}),n.createElement("img",{src:Ee,alt:""}),"Secure payments powered by Fractal"),n.createElement("div",null)),!N&&n.createElement("div",{className:"pay-tab pay-conatiner-two"},n.createElement("div",{className:"col-md-12"},n.createElement("div",{id:"payment-form-div"},y!=="cardList"?n.createElement("div",null,(m==null?void 0:m.length)>0&&n.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>p("cardList")}," ",n.createElement(Cn,null)," Back"),n.createElement("div",{className:""},n.createElement("div",{className:"res-pay-con"},n.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},n.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),n.createElement("strong",{className:"pay-amount"},"$",(oe=Number(e==null?void 0:e.amount))==null?void 0:oe.toFixed(2))),n.createElement("div",null,n.createElement("div",null,n.createElement("img",{src:fe,alt:"",width:35,style:{paddingRight:"5px"}}),n.createElement("img",{src:E,width:35,alt:""})),n.createElement("div",null,n.createElement("img",{src:le,alt:"",width:35,style:{paddingRight:"5px"}}),n.createElement("img",{src:Me,width:35,alt:""})))))):n.createElement("div",null,n.createElement("h6",{className:"charge-customer-name",style:{marginBottom:"16px !important"}}," Charge ",S==null?void 0:S.customer_name),n.createElement("div",{className:"res-pay-con"},n.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},n.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),n.createElement("strong",{className:"pay-amount"},"$",(O=Number(e==null?void 0:e.amount))==null?void 0:O.toFixed(2))),n.createElement("div",null,n.createElement("div",null,n.createElement("img",{src:fe,alt:"",width:35,style:{paddingRight:"5px"}}),n.createElement("img",{src:E,width:35,alt:""})),n.createElement("div",null,n.createElement("img",{src:le,alt:"",width:35,style:{paddingRight:"5px"}}),n.createElement("img",{src:Me,width:35,alt:""})))),n.createElement("h6",{className:"card-ach-heading",style:{marginBottom:"10px !important"}}," Cards")),n.createElement("div",{style:{display:y==="cardList"?"block":"none"},className:"tabcontent"},n.createElement("div",{className:"card-lint-div-in"},n.createElement("div",{className:"card-list-div"},(S==null?void 0:S.card_list)&&((Ve=S==null?void 0:S.card_list)==null?void 0:Ve.length)>0&&((De=S==null?void 0:S.card_list)==null?void 0:De.map((v,w)=>n.createElement("div",{className:"card-list-single-div",key:w},n.createElement("div",{className:"card-number-radio"},n.createElement("input",{disabled:(S==null?void 0:S.paymentGateway)!=(v==null?void 0:v.payment_method_type),type:"radio",className:"cardRadio",name:"selected_card",id:"",checked:P===v,onChange:H=>s(v)}),n.createElement("label",{htmlFor:"",className:"card-number-last-four"},"**** ",v==null?void 0:v.cardlastfourdigit),n.createElement("h6",{className:"card-expiry-date"},v==null?void 0:v.expmonth,"/",v==null?void 0:v.expyear)),n.createElement("div",{className:"card-number-radio"},n.createElement("span",{className:"visa-card"},n.createElement("img",{src:je(v==null?void 0:v.card_type),alt:""})),n.createElement("span",{className:"visa-card",style:{cursor:"pointer"},onClick:()=>St(v==null?void 0:v.id)},n.createElement("img",{src:we,alt:""}))))))),n.createElement("div",{className:"pay-with-other-card ",onClick:()=>p("card")},"Authorize With Other Card",n.createElement("img",{src:Ce,alt:""}))),n.createElement("div",{className:"form-group"},n.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:g},"$",(vt=Number(e==null?void 0:e.amount))==null?void 0:vt.toFixed(2)))),n.createElement("div",{id:"card",style:{display:y==="card"?"block":"none"},className:"tabcontent"},n.createElement("form",{id:"PaymentForm",onSubmit:He},n.createElement("div",{className:"ach-scrl",style:{minHeight:(m==null?void 0:m.length)>0?"462px":"520px",overflow:"auto",marginRight:"5px"}},n.createElement("div",{className:"form-group"},n.createElement("label",{htmlFor:"cardHolderName"},"Name on Card"),n.createElement("input",{type:"text",className:"form-control",placeholder:"John Doe",value:(f==null?void 0:f.cardName)||"",onChange:v=>{let w=v.target.value;/^[a-zA-Z\s]*$/.test(w)&&Ne("cardName",w)}}),(h==null?void 0:h.cardName)&&n.createElement("span",{className:"error-span"},h==null?void 0:h.cardName)),n.createElement("div",{className:"form-group"},n.createElement("label",{htmlFor:"cardNumber"},"Card Number"),n.createElement("div",{className:"toggle-num-wrapper"},n.createElement("input",{className:"form-control card-number-new",type:"text",maxLength:19,inputMode:"numeric",placeholder:"0000 0000 0000 0000",value:(f==null?void 0:f.cardNumber)||"",onChange:v=>Oe(v),"data-token":"card_number"}),n.createElement("div",{className:"card-crdi card-expiry-new"},n.createElement("div",{className:"exp-date-year-container"},n.createElement("div",{className:"exp-date form-group"},n.createElement("input",{"data-token":"exp_month",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"MM",maxLength:2,value:(f==null?void 0:f.expiryMonth)||"",onChange:v=>Ne("expiryMonth",v.target.value)})),n.createElement("div",{className:"exp-year form-group"},n.createElement("input",{"data-token":"exp_year",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"YYYY",maxLength:4,value:(f==null?void 0:f.expiryYear)||"",onChange:v=>Ne("expiryYear",v.target.value)})),n.createElement("div",{className:"security-digit form-group"},n.createElement("input",{"data-token":"cvv",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},maxLength:4,placeholder:"CVC",value:(f==null?void 0:f.cvv)||"",onChange:v=>Ne("cvv",v.target.value)})))),(h==null?void 0:h.cardNumber)&&n.createElement("span",{className:"error-span"},h==null?void 0:h.cardNumber),n.createElement("p",{style:{margin:"0"}},h!=null&&h.expiryMonth||h!=null&&h.expiryYear?n.createElement("span",{className:"error-span",style:{paddingRight:"4px"}},h==null?void 0:h.expiryMonth):"",(h==null?void 0:h.cvv)&&n.createElement("span",{className:"error-span"},h==null?void 0:h.cvv)))),n.createElement("div",{className:"form-group"},n.createElement("label",{htmlFor:"OrderId"},"Order ID / Description"),n.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"OID123456",disabled:!0,value:(rt=f==null?void 0:f.orderId)!=null?rt:"OID123456",onChange:v=>Ne("orderId",v.target.value),style:{background:"#F6F6F7",color:"#727272"}})),n.createElement("div",{className:"form-group"},n.createElement("label",{htmlFor:"zip"},"ZIP"),n.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"000000",value:(Lt=f==null?void 0:f.zipCode)!=null?Lt:"",onChange:v=>Ne("zipCode",v.target.value)}),(h==null?void 0:h.zipCode)&&n.createElement("span",{className:"error-span"},h==null?void 0:h.zipCode)),(e==null?void 0:e.customerId)&&n.createElement("div",{className:"form-group"},n.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px",paddingTop:"10px"}},n.createElement("input",{type:"checkbox",id:"save_card",className:"toggle-checkbox",checked:u,onChange:v=>he(v.target.checked)}),n.createElement("label",{htmlFor:"save_card",className:"toggle-label"}),n.createElement("label",{htmlFor:"save_card"},"Save card for future payments "),n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},n.createElement("g",{clipPath:"url(#clip0_12420_50192)"},n.createElement("rect",{width:"20",height:"20",fill:"white"}),n.createElement("circle",{cx:"10",cy:"10",r:"10",fill:"#E0DFE2"}),n.createElement("path",{d:"M9.03406 12.0979V12.0072C9.04055 11.4153 9.10057 10.9443 9.21411 10.5943C9.3309 10.2442 9.49635 9.96102 9.71046 9.74463C9.92457 9.52824 10.1825 9.33095 10.4842 9.15274C10.6788 9.03182 10.854 8.89658 11.0097 8.74702C11.1655 8.59745 11.2887 8.42562 11.3796 8.2315C11.4704 8.03739 11.5158 7.82259 11.5158 7.58711C11.5158 7.3039 11.4477 7.05887 11.3114 6.85203C11.1752 6.64519 10.9935 6.48608 10.7664 6.3747C10.5426 6.26014 10.2928 6.20286 10.017 6.20286C9.76723 6.20286 9.52879 6.25378 9.3017 6.35561C9.07461 6.45744 8.88646 6.61655 8.73723 6.83294C8.588 7.04614 8.50203 7.3214 8.47932 7.65871H7C7.02271 7.08592 7.17032 6.60223 7.44282 6.20764C7.71533 5.80986 8.07543 5.50915 8.52311 5.30549C8.97405 5.10183 9.47202 5 10.017 5C10.6139 5 11.1363 5.10979 11.5839 5.32936C12.0316 5.54574 12.3788 5.84964 12.6253 6.24105C12.8751 6.62928 13 7.08274 13 7.60143C13 7.95784 12.9432 8.27924 12.8297 8.56563C12.7161 8.84885 12.5539 9.10183 12.3431 9.32458C12.1354 9.54733 11.8856 9.74463 11.5937 9.91647C11.3179 10.0851 11.0941 10.2601 10.9221 10.4415C10.7534 10.6229 10.6302 10.8377 10.5523 11.0859C10.4745 11.3341 10.4323 11.6412 10.4258 12.0072V12.0979H9.03406ZM9.76886 15C9.50284 15 9.27413 14.9077 9.08273 14.7232C8.89132 14.5354 8.79562 14.3095 8.79562 14.0453C8.79562 13.7844 8.89132 13.5617 9.08273 13.3771C9.27413 13.1893 9.50284 13.0955 9.76886 13.0955C10.0316 13.0955 10.2587 13.1893 10.4501 13.3771C10.6448 13.5617 10.7421 13.7844 10.7421 14.0453C10.7421 14.2204 10.6967 14.3811 10.6058 14.5274C10.5182 14.6706 10.4015 14.7852 10.2555 14.8711C10.1095 14.957 9.94728 15 9.76886 15Z",fill:"#161616"})),n.createElement("defs",null,n.createElement("clipPath",{id:"clip0_12420_50192"},n.createElement("rect",{width:"20",height:"20",fill:"white"}))))))),n.createElement("div",{className:"form-group",style:{marginTop:"20px",padding:0}},n.createElement("button",{type:"submit",style:{margin:0},className:"pay-button"},"$",(de=Number(e==null?void 0:e.amount))==null?void 0:de.toFixed(2))))))))))))))))}import $,{useEffect as di,useState as Vt}from"react";import mi from"sweetalert2";import Wt from"axios";import ri from"react";function mn(){let e="#000",N="#fff",Y="#212529",j="#dee2e6";return ri.createElement("style",null,`
|
|
1472
|
+
`)}var oi=({onClose:e,error:F})=>Ct.createElement(Ct.Fragment,null,Ct.createElement(pn,null),Ct.createElement("div",{className:"card-error"},Ct.createElement("div",{className:"payment-error-container"},Ct.createElement("div",{className:"error-icon"},Ct.createElement("div",{className:"circle"},Ct.createElement("i",{className:"fa fa-times","aria-hidden":"true"})),Ct.createElement("div",{className:"error-text"},Ct.createElement("div",{className:"payment-error-text"},F),Ct.createElement("div",{className:"thank-you-text"},"Try again later ")),Ct.createElement("div",{className:"error-btn-div"},Ct.createElement("button",{onClick:e},"OK")))))),Tt=oi;import{io as ai}from"socket.io-client";var ri=ai(He,{transports:["websocket"],withCredentials:!1}),bt=ri;var gn=e=>{try{let F=JSON.parse(e);return typeof F=="object"&&F!==null}catch(F){return!1}};function li(e){var Ge,Ce,lt,u,m,j,Q,B,me,Z,H,ae,ee,se,te,Ae,ne,A,qe,Ft,dt,_e,O,Mt,Xt;let[F,T]=tt(!1),[V,$]=tt(!1),[je,q]=tt(""),[De,de]=tt(!1),[R,n]=tt(!1),[K,d]=tt("card"),[f,i]=tt("card"),[pe,v]=tt(!0),[fe,we]=tt(!1),[Oe,Ve]=tt(!1),ve=e.merchantPublicKey,nt=ue+"widget/mc-img.svg",Ke=ue+"widget/visa-img.svg",at=ue+"widget/ae-img.svg",y=ue+"widget/discover-img.svg",We=ue+"widget/card.svg",E=ue+"widget/Trash.svg",_=ue+"widget/bank.svg",x=ue+"widget/secure-img.png",ie=ue+"widget/pov-by.png",X=ue+"widget/pax.svg",[r,s]=tt(),[b,U]=tt({}),[w,c]=tt(),[l,P]=tt({}),[I,Me]=tt([]),[Je,ht]=tt(),[Xe,ye]=tt(),[h,St]=tt(),[gt,ct]=tt(""),Re=()=>T(!0),rt=()=>T(!1),ut=()=>{n(!1),d("card"),q(""),de(!1),ct(""),c({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),P({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),s({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),U({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),Ve(!1),we(!1),ht({card_type:"",cardlastfourdigit:"",expmonth:1,expyear:2025,primary_card:0,firstname:"",id:"",lastname:""}),ye({}),i("card"),v(!0)},Pt=()=>n(!0),st=g=>{d(g)},ze=(g,p)=>{let Y=g;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(Y)){(p===""||/^[0-9]+$/.test(p))&&(U(W=>L(S({},W),{[Y]:""})),s(W=>L(S({},W),{[Y]:p})));return}U(W=>L(S({},W),{[Y]:""})),s(W=>L(S({},W),{[Y]:p}))},Ie=g=>{let Y=g.target.value.replace(/\D/g,""),Se="";/^3[47]/.test(Y)?Se=Y.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(Te,D,Pe,ce)=>[D,Pe,ce].filter(Boolean).join(" ")):Se=Y.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(Te,D,Pe,ce,Ne)=>[D,Pe,ce,Ne].filter(Boolean).join(" ")),U(W=>L(S({},W),{cardNumber:""})),s(W=>L(S({},W),{cardNumber:Se}))},Ue=g=>{let{name:p,value:Y}=g.target,Se=["routingNumber","accountNumber","confirmAccountNumber"];if(p=="name"){/^[a-zA-Z\s]*$/.test(Y)&&(P(W=>L(S({},W),{[p]:""})),c(W=>L(S({},W),{[p]:Y})));return}if(Se.includes(p)){(Y===""||/^[0-9]+$/.test(Y))&&(P(W=>L(S({},W),{[p]:""})),c(W=>L(S({},W),{[p]:Y})));return}P(W=>L(S({},W),{[p]:""})),c(W=>L(S({},W),{[p]:Y}))},C=()=>{var W,Te,D,Pe,ce,Ne;let g={},p=r,Y=parseInt((p==null?void 0:p.expiryMonth)||"",10),Se=(p==null?void 0:p.expiryYear)||"";if((W=p==null?void 0:p.cardName)!=null&&W.trim()||(g.cardName="Card name is required"),(Te=p==null?void 0:p.cardNumber)!=null&&Te.trim()||(g.cardNumber="Card number is required"),(!((D=p==null?void 0:p.expiryMonth)!=null&&D.trim())||!((Pe=p==null?void 0:p.expiryYear)!=null&&Pe.trim())||isNaN(Y)||Y<1||Y>12||Se.length!==4)&&(g.expiryMonth="Invalid Expiration Date."),(ce=p==null?void 0:p.cvv)!=null&&ce.trim()||(g.cvv="CVV is required"),(Ne=p==null?void 0:p.zipCode)!=null&&Ne.trim()||(g.zipCode="ZIP code is required"),p!=null&&p.expiryMonth&&(p!=null&&p.expiryYear)&&p.expiryMonth.length<=2&&p.expiryYear.length===4){let it=parseInt(p.expiryMonth,10),re=parseInt(p.expiryYear,10),et=new Date,Lt=et.getMonth()+1,ft=et.getFullYear();(re<ft||re===ft&&it<Lt)&&(g.expiryMonth="Card is expired")}return U(g),Object.keys(g).length>0},z=()=>{var Y,Se,W,Te,D,Pe,ce,Ne,it;let g={},p=w;if((Y=p==null?void 0:p.name)!=null&&Y.trim()||(g.name="Name is required"),(Se=p==null?void 0:p.accountNumber)!=null&&Se.trim()||(g.accountNumber="Account number is required"),(W=p==null?void 0:p.accountNumber)!=null&&W.trim()&&((Te=p==null?void 0:p.accountNumber)==null?void 0:Te.trim())!==((D=p==null?void 0:p.confirmAccountNumber)==null?void 0:D.trim())&&(g.confirmAccountNumber="Account numbers must match"),(Pe=p==null?void 0:p.bankName)!=null&&Pe.trim()||(g.bankName="Bank name is required"),(ce=p==null?void 0:p.routingNumber)!=null&&ce.trim()||(g.routingNumber="Routing Number is required"),p!=null&&p.routingNumber&&((Ne=p==null?void 0:p.routingNumber)==null?void 0:Ne.length)!==9&&(g.routingNumber="Routing number must be 9 digits"),((it=p==null?void 0:p.routingNumber)==null?void 0:it.length)==9){let re=p==null?void 0:p.routingNumber,et=[3,7,1],Lt=0;for(let ft=0;ft<re.length;ft++)Lt+=parseInt(re[ft],10)*et[ft%3];Lt%10!==0&&(g.routingNumber="Invalid routing number")}return P(g),Object.keys(g).length>0},oe=async g=>{var p,Y,Se,W,Te,D,Pe,ce,Ne,it,re,et,Lt,ft,Ut,mt;if(g.preventDefault(),K!=="ach"){if(C())return;{let Zt=DatacapWebToken.validateCardNumber(r==null?void 0:r.cardNumber.replaceAll(" ","")),Ze=DatacapWebToken.validateExpirationDate(r==null?void 0:r.expiryMonth,r==null?void 0:r.expiryYear),Ht=DatacapWebToken.validateCVV(r==null?void 0:r.cvv),$t={};if(Zt||($t.cardNumber="Invalid card Number"),Ze||($t.expiryMonth="Invalid Expiration Date."),Ht||($t.cvv="Invalid CVV"),U($t),Zt&&Ht&&Ze){$(!0);try{let zt=L(S({},r),{amount:`${e.amount||0}`,fractalpayPublicKey:ve,orderId:e==null?void 0:e.orderID,customer_id:e==null?void 0:e.customerId,discount:e==null?void 0:e.discount,surcharge:e==null?void 0:e.surcharge,tax:e==null?void 0:e.tax}),ot=await Gt.post(`${He}create-widget-order`,zt),rn=async function(yt){if(yt.Error)q(yt.Error),$(!1);else{let Fe=r==null?void 0:r.cardName,le=r==null?void 0:r.zipCode;yt.name=Fe,yt.postal_code=le,yt.isCardSave=`${fe}`,yt.isCharge=!0,yt.posSalesIdEncode=ot==null?void 0:ot.data.data.posSalesIdEncode,console.log(yt,"resppp"),console.log(ot==null?void 0:ot.data.data.posSalesIdEncode,"fkjdashgfuh"),bt.emit("sendMessage",yt),bt.on(ot==null?void 0:ot.data.data.posSalesIdEncode,$e=>{if(console.log($e,"socket data"),gn($e==null?void 0:$e.data)){let pt=JSON.parse($e.data);console.log("return data : ",pt),pt!=null&&pt.result?(s({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),we(!1),ct(pt==null?void 0:pt.transactionId),de(!0),$(!1)):($(!1),q((pt==null?void 0:pt.message)||"Something went wrong."))}else q("Something went wrong.")})}};if((h==null?void 0:h.paymentGateway)===32){let yt={method:"POST",redirect:"follow"};try{let Fe=await Gt.post(`${Be}api/v1/widget/generate-session`,yt),le=Number(r==null?void 0:r.expiryYear)%100,$e=r==null?void 0:r.cardNumber;$e=$e==null?void 0:$e.replace(/\s+/g,"");let pt=`${$e}=${le}${r==null?void 0:r.expiryMonth} ${r==null?void 0:r.cvv}`,Mn=forge.pki.publicKeyFromPem((Y=(p=Fe==null?void 0:Fe.data)==null?void 0:p.data)==null?void 0:Y.publicKeyPem).encrypt(pt,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),Ln=forge.util.encode64(Mn),zn={"Content-Type":"application/json","x-app-session-key":(W=(Se=Fe.data)==null?void 0:Se.data)==null?void 0:W.session_key},In=JSON.stringify({enc_track2_data:`${Ln}`,algorithm:"RSAES_OAEP_SHA_1",session_key:`${(D=(Te=Fe==null?void 0:Fe.data)==null?void 0:Te.data)==null?void 0:D.session_key}`});try{let vt=await Gt.post(`${Yt}tokenizer/tokenize`,In,{headers:zn}),An=JSON.stringify(L(S({},(Pe=vt==null?void 0:vt.data)==null?void 0:Pe.data),{isSaveCardChecked:fe,name:r==null?void 0:r.cardName,postal_code:r==null?void 0:r.zipCode,customer_id:e==null?void 0:e.customerId})),qn=JSON.stringify({pre_sales_id:`${(Ne=(ce=ot==null?void 0:ot.data)==null?void 0:ce.data)==null?void 0:Ne.posSalesIdEncode}`,token:`${(it=vt==null?void 0:vt.data)==null?void 0:it.data.token}`,json_response:`${An}`}),Yn={method:"POST",headers:JSON.stringify({"Content-Type":"application/json"}),body:qn,redirect:"follow",isChargeviafractal:!0};bt.emit("sendMessage",Yn),bt.on("chargeviafractalgateway",Ot=>{var bn;if(console.log(Ot,"socket data"),gn(Ot==null?void 0:Ot.data)){let qt=JSON.parse(Ot==null?void 0:Ot.data);console.log(qt,"dfuigdasuf"),qt!=null&&qt.result?(ct((bn=qt==null?void 0:qt.data)==null?void 0:bn.transactionId),de(!0),$(!1)):($(!1),q((qt==null?void 0:qt.message)||"Something went wrong."))}else q("Something went wrong.")})}catch(vt){$(!1),q(((et=(re=vt==null?void 0:vt.response)==null?void 0:re.data)==null?void 0:et.message)||(vt==null?void 0:vt.message)||"Something went wrong.")}}catch(Fe){$(!1),q(((ft=(Lt=Fe==null?void 0:Fe.response)==null?void 0:Lt.data)==null?void 0:ft.message)||(Fe==null?void 0:Fe.message)||"Something went wrong.")}}else typeof DatacapWebToken!="undefined"&&DatacapWebToken.requestToken(ot==null?void 0:ot.data.data.dctoken,"PaymentForm",rn)}catch(zt){$(!1),q(((mt=(Ut=zt==null?void 0:zt.response)==null?void 0:Ut.data)==null?void 0:mt.message)||(zt==null?void 0:zt.message)||"Something went wrong.")}}}}else{if(z())return;{$(!0);let Zt={fractalpayPublicKey:ve,label:(w==null?void 0:w.name)||"John Doe",account_number:w==null?void 0:w.accountNumber,routing_number:w==null?void 0:w.routingNumber,bank_name:w==null?void 0:w.bankName,account_type:w==null?void 0:w.accountType,amount:String(e.amount||0),isSaveAch:Oe,customer_id:e==null?void 0:e.customerId,order_id:e==null?void 0:e.orderID,tax:e==null?void 0:e.tax,discount:e==null?void 0:e.discount,surcharge:e==null?void 0:e.surcharge,isChargeACH:!0};bt.emit("sendMessage",Zt),bt.on("ach-incoming",Ze=>{var Ht;console.log(Ze,"sfhdwhf"),(Ze==null?void 0:Ze.status)=="Failed"?typeof(Ze==null?void 0:Ze.message)=="object"?Object.values(Ze==null?void 0:Ze.message).forEach($t=>{q($t||"Something went wrong")}):q((Ze==null?void 0:Ze.message)||"Something went wrong"):(ct((Ht=Ze==null?void 0:Ze.data)==null?void 0:Ht.transaction_id),de(!0),$(!1))})}}},Le=async()=>{var g,p,Y,Se,W,Te,D,Pe,ce,Ne,it,re,et,Lt,ft,Ut,mt,Et,Zt,Ze,Ht,$t,zt,ot,rn,yt;Re();try{let Fe={fractalpayPublicKey:ve,customer_id:e==null?void 0:e.customerId},le=await Gt.post(`${He}get-payment-details`,Fe);if(St((g=le==null?void 0:le.data)==null?void 0:g.data),(Y=(p=le==null?void 0:le.data)==null?void 0:p.data)!=null&&Y.paymentGateway||(ut(),q("Something went wrong.")),(W=(Se=le==null?void 0:le.data)==null?void 0:Se.data)!=null&&W.card_list&&((Pe=(D=(Te=le==null?void 0:le.data)==null?void 0:Te.data)==null?void 0:D.card_list)==null?void 0:Pe.length)>0){Me((Ne=(ce=le==null?void 0:le.data)==null?void 0:ce.data)==null?void 0:Ne.card_list),d("cardList");let $e=(et=(re=(it=le==null?void 0:le.data)==null?void 0:it.data)==null?void 0:re.card_list)==null?void 0:et.filter(pt=>(pt==null?void 0:pt.primary_card)==1);($e!=null&&$e[0]&&((Lt=$e==null?void 0:$e[0])==null?void 0:Lt.payment_method_type)==((Ut=(ft=le==null?void 0:le.data)==null?void 0:ft.data)==null?void 0:Ut.paymentGateway)||((mt=$e==null?void 0:$e[0])==null?void 0:mt.card_type)==="Bank")&&ht($e[0])}else d("card");(Zt=(Et=le==null?void 0:le.data)==null?void 0:Et.data)!=null&&Zt.paymentDeviceList&&(($t=(Ht=(Ze=le==null?void 0:le.data)==null?void 0:Ze.data)==null?void 0:Ht.paymentDeviceList)==null?void 0:$t.length)>0&&ye((ot=(zt=le==null?void 0:le.data)==null?void 0:zt.data)==null?void 0:ot.paymentDeviceList[0]),rt()}catch(Fe){console.log(Fe),rt(),q(((yt=(rn=Fe==null?void 0:Fe.response)==null?void 0:rn.data)==null?void 0:yt.message)||(Fe==null?void 0:Fe.message)||"Something went wrong")}},G=async()=>{let g=e==null?void 0:e.customerId,p=String(e==null?void 0:e.discount),Y=String(e==null?void 0:e.surcharge),Se=String(e==null?void 0:e.tax),W=e==null?void 0:e.merchantPublicKey,Te=e==null?void 0:e.orderID,D=String(e==null?void 0:e.amount),Pe=Je==null?void 0:Je.id,ce=Je==null?void 0:Je.card_type;if(W&&Te&&D)if(g)if(Pe){let it={amount:D,order_id:Te,customer_id:g,card_id:Pe,fractalpayPublicKey:W,isCardSave:fe,discount:p,surcharge:Y,tax:Se},Ne=it,{isCardSave:re}=Ne,et=ln(Ne,["isCardSave"]),ft=He+(ce==="Bank"?"charge-ach":"charge-by-card"),Ut={"Content-Type":"application/json"};$(!0),bt.emit("sendMessage",{url:ft,body:ce=="Bank"?et:it,isChargebycard:!0}),bt.on("charge-by-card",mt=>{var Et;console.log(mt,"response"),(mt==null?void 0:mt.result)==!0||(mt==null?void 0:mt.status)==!0?(ct((Et=mt.data)==null?void 0:Et.transaction_id),de(!0),$(!1)):q((mt==null?void 0:mt.message)||"Something went wrong.")})}else q("Please Select A Card/ACH");else q("Please Select Customer");else q("Something went wrong.")},Ye=async()=>{var W,Te,D,Pe,ce,Ne;let g=e==null?void 0:e.merchantPublicKey,p=e==null?void 0:e.orderID,Y=String(e==null?void 0:e.amount),Se=e==null?void 0:e.customerId;if(!(Xe!=null&&Xe.device_id)){q("Please Select A Payment Device");return}if(g&&p&&Y){$(!0);let it={amount:Y,fractalpayPublicKey:g,customer_order_id:p,device_id:Xe==null?void 0:Xe.device_id,customer_id:Se||""};try{let re=await Gt.post(`${He}charge-with-reader`,it);console.log(re,"response"),((W=re==null?void 0:re.data)==null?void 0:W.result)==!0?(ct((D=(Te=re==null?void 0:re.data)==null?void 0:Te.data)==null?void 0:D.transaction_id),de(!0),$(!1)):(q(((Pe=re==null?void 0:re.data)==null?void 0:Pe.message)||"Something went wrong."),$(!1))}catch(re){q(((Ne=(ce=re==null?void 0:re.response)==null?void 0:ce.data)==null?void 0:Ne.message)||"Something went wrong."),$(!1)}}else q("Something went wrong.")},ge=()=>{f==="card"?G():f==="reader"&&Ye()};si(()=>{R&&ve&&Le()},[ve,R]);let he=async g=>{en.fire({icon:"warning",text:"Do you want to delete the card?",showCancelButton:!0,confirmButtonText:"Yes",cancelButtonText:"No",reverseButtons:!0,buttonsStyling:!1,customClass:{confirmButton:"swal2-confirm btn btn-dark",cancelButton:"swal2-cancel btn btn-dark",popup:"custom-swal-popup",icon:"custom-swal-icon"}}).then(async p=>{if(p.isConfirmed){$(!0);try{let Y={card_id:g,customer_id:e==null?void 0:e.customerId,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey},Se=await Gt.post(`${He}delete-customer-card`,Y);$(!1),Le(),en.fire({icon:"success",title:"Deleted!",text:"Card deleted.",confirmButtonText:"OK",showConfirmButton:!0,timer:1e3,timerProgressBar:!0,customClass:{confirmButton:"btn btn-dark"}})}catch(Y){$(!1),en.fire({icon:"error",title:"Error!",text:"Failed to delete the card.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}}else p.dismiss===en.DismissReason.cancel&&en.fire({icon:"info",text:"Card not deleted",confirmButtonText:"OK",buttonsStyling:!1,customClass:{confirmButton:"btn btn-dark float-end",actions:"swal2-actions-end"}})})},Ee=g=>{switch(g==null?void 0:g.toLowerCase()){case"visa":return Ke;case"mastercard":case"mc":case"m/c":return nt;case"amex":case"american express":case"ae":return at;case"discover":return y;case"bank":return _;default:return g}};return t.createElement(t.Fragment,null,t.createElement(It,null),t.createElement(Dt,null),t.createElement(t.Fragment,null,t.createElement("button",{className:"paymentBtn",onClick:Pt},"Pay"),t.createElement(kt,{open:R,onClose:ut},je&&t.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},t.createElement(Tt,{error:je,onClose:ut})),De&&t.createElement(Rt,{onClose:ut,tranId:gt}),!je&&!De&&t.createElement(t.Fragment,null,(F||V)&&t.createElement(xt,{loading:F||V}),t.createElement("div",{className:"frac-card-payment-page frac-form"},t.createElement("div",{className:"parent-pay-container"},t.createElement("span",{className:"request-payment-close-popup",onClick:ut},t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},t.createElement("g",{clipPath:"url(#clip0_12425_52336)"},t.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),t.createElement("defs",null,t.createElement("clipPath",{id:"clip0_12425_52336"},t.createElement("rect",{width:"16",height:"16",fill:"white"}))))),t.createElement("div",{className:"pay-main-logo-res"},t.createElement("img",{src:h==null?void 0:h.logo,id:"pay-logos"})),t.createElement("div",{className:"pay-container"},t.createElement("div",{className:"pay-header pay-conatiner-one"},t.createElement("div",{className:"pay-conatiner-one-first"},t.createElement("div",{className:"pay-logo-container"},t.createElement("div",{className:"pay-main-logo"},t.createElement("img",{src:h==null?void 0:h.logo,id:"pay-logos"})),t.createElement("h1",{className:"pay-heading"},"Pay"),(I==null?void 0:I.length)>0&&K!=="cardList"&&t.createElement("button",{className:"res-charge-payment-back-btn ",onClick:()=>d("cardList")}," ",t.createElement(Sn,null)," Back")),t.createElement("div",{className:"amt-pay-con"},t.createElement("div",{className:"pay-amount-conatiner"},t.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),t.createElement("strong",{className:"pay-amount"},"$",(Ge=Number(e==null?void 0:e.amount))==null?void 0:Ge.toFixed(2))),K!="ach"&&t.createElement("div",{style:{display:"flex",gap:"8px",margin:"8px 0"}},t.createElement("img",{src:Ke,alt:"",width:33}),t.createElement("img",{src:nt,width:33,alt:""}),t.createElement("img",{src:at,alt:"",width:33}),t.createElement("img",{src:y,width:33,alt:""})))),t.createElement("div",{className:"pay-conatiner-one-last"},t.createElement("img",{src:x,alt:""}),t.createElement("img",{src:ie,alt:""}),"Secure payments powered by Fractal"),t.createElement("div",null)),t.createElement("div",{className:"pay-tab pay-conatiner-two"},!F&&t.createElement("div",{className:"col-md-12"},t.createElement("div",{id:"payment-form-div"},K!=="cardList"?t.createElement("div",null,(I==null?void 0:I.length)>0&&t.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>d("cardList")}," ",t.createElement(Sn,null)," Back"),(h==null?void 0:h.isSkyFiAccount)&&t.createElement("div",{className:"tab"},t.createElement("button",{className:"tablinks",onClick:g=>{st("card")},style:{border:K==="card"?"1px solid":""}},t.createElement("i",{className:"fas fa-credit-card me-2",style:{marginRight:"8px",fontSize:"15px"}}),"Card"),t.createElement("button",{className:"tablinks",onClick:g=>{st("ach")},style:{border:K==="ach"?"1px solid":""}},t.createElement("i",{className:"fas fa-university me-2",style:{marginRight:"8px",fontSize:"15px"}}),"Bank")),t.createElement("div",{className:"res-pay-con"},t.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},t.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),t.createElement("strong",{className:"pay-amount"},"$",(Ce=Number(e==null?void 0:e.amount))==null?void 0:Ce.toFixed(2))),K!="ach"&&t.createElement("div",null,t.createElement("div",null,t.createElement("img",{src:Ke,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:nt,width:35,alt:""})),t.createElement("div",null,t.createElement("img",{src:at,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:y,width:35,alt:""}))))):t.createElement("div",null,t.createElement("h6",{className:"charge-customer-name",style:{marginBottom:"16px !important"}}," Charge ",h==null?void 0:h.customer_name),t.createElement("h6",{className:"card-ach-heading",style:{marginBottom:"10px !important"}}," ",f==="card"?"Cards/Banks":"Readers"," "),t.createElement("div",{className:"res-pay-con"},t.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},t.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),t.createElement("strong",{className:"pay-amount"},"$",(lt=Number(e==null?void 0:e.amount))==null?void 0:lt.toFixed(2))),t.createElement("div",null,t.createElement("div",null,t.createElement("img",{src:Ke,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:nt,width:35,alt:""})),t.createElement("div",null,t.createElement("img",{src:at,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:y,width:35,alt:""}))))),t.createElement("div",{id:"ach",style:{display:K==="cardList"?"block":"none"},className:"tabcontent"},t.createElement("div",{className:"card-lint-div-in"},t.createElement("div",{className:"card-list-div"},f==="card"?t.createElement(t.Fragment,null,(h==null?void 0:h.card_list)&&((u=h==null?void 0:h.card_list)==null?void 0:u.length)>0&&((m=h==null?void 0:h.card_list)==null?void 0:m.map((g,p)=>t.createElement("div",{className:"card-list-single-div",key:p},t.createElement("div",{className:"card-number-radio"},t.createElement("input",{disabled:(h==null?void 0:h.paymentGateway)!=(g==null?void 0:g.payment_method_type)&&(g==null?void 0:g.card_type)!="Bank",type:"radio",className:"cardRadio",name:"selected_card",id:"",checked:Je===g,onChange:Y=>ht(g)}),t.createElement("label",{htmlFor:"",className:"card-number-last-four"},"**** ",g==null?void 0:g.cardlastfourdigit),(g==null?void 0:g.card_type)!="Bank"&&t.createElement("h6",{className:"card-expiry-date"},g==null?void 0:g.expmonth,"/",g==null?void 0:g.expyear)),t.createElement("div",{className:"card-number-radio"},t.createElement("span",{className:"visa-card"},t.createElement("img",{src:Ee(g==null?void 0:g.card_type),alt:""})),t.createElement("span",{className:"visa-card",style:{cursor:"pointer"},onClick:()=>he(g==null?void 0:g.id)},t.createElement("img",{src:E,alt:""}))))))):t.createElement(t.Fragment,null,(h==null?void 0:h.paymentDeviceList)&&((j=h==null?void 0:h.paymentDeviceList)==null?void 0:j.length)>0&&((Q=h==null?void 0:h.paymentDeviceList)==null?void 0:Q.map((g,p)=>t.createElement("div",{className:"card-list-single-div",key:p},t.createElement("div",{className:"card-number-radio"},t.createElement("input",{type:"radio",className:"cardRadio",name:"selected_reader",id:"",checked:Xe===g,onChange:Y=>ye(g)}),t.createElement("label",{htmlFor:"",className:"card-number-last-four"},g==null?void 0:g.device_name)),t.createElement("div",{className:"card-number-radio"},t.createElement("span",{className:"visa-card"},t.createElement("img",{src:X,alt:""})))))))),t.createElement("div",{className:"pay-with-other-card",onClick:()=>d("card")},"Pay With Other Card",t.createElement("img",{src:We,alt:""})),f==="card"&&(h==null?void 0:h.paymentDeviceList)&&((B=h==null?void 0:h.paymentDeviceList)==null?void 0:B.length)>0&&t.createElement("div",{className:"pay-with-other-card ",onClick:()=>i("reader")},"Pay With Reader",t.createElement("img",{src:X,alt:""})),f==="reader"&&(h==null?void 0:h.paymentDeviceList)&&((me=h==null?void 0:h.paymentDeviceList)==null?void 0:me.length)>0&&t.createElement("div",{className:"pay-with-other-card ",onClick:()=>i("card")},"Pay With Saved Card",t.createElement("img",{src:We,alt:""}))),t.createElement("div",{className:"form-group",style:{padding:"0"}},t.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:ge},"$",(Z=Number(e==null?void 0:e.amount))==null?void 0:Z.toFixed(2)))),t.createElement("div",{id:"card",style:{display:K==="card"?"block":"none"},className:"tabcontent"},pe?t.createElement("form",{id:"PaymentForm",style:{textAlign:"start"},onSubmit:oe},t.createElement("div",{className:"ach-scrl",style:{minHeight:h!=null&&h.isSkyFiAccount&&(I==null?void 0:I.length)>0?"398px":h!=null&&h.isSkyFiAccount&&(I==null?void 0:I.length)==0?"456px":(I==null?void 0:I.length)>0?"462px":"520px",overflow:"auto",marginRight:"5px"}},t.createElement("div",{className:"form-group"},t.createElement("label",{htmlFor:"cardHolderName"},"NAME ON CARD "),t.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"John Doe",value:(r==null?void 0:r.cardName)||"",onChange:g=>{let p=g.target.value;/^[a-zA-Z\s]*$/.test(p)&&ze("cardName",p)}}),(b==null?void 0:b.cardName)&&t.createElement("span",{className:"error-span"},b==null?void 0:b.cardName)),t.createElement("div",{className:"form-group"},t.createElement("label",{htmlFor:"cardNumber"},"CARD NUMBER"),t.createElement("div",{className:"toggle-num-wrapper"},t.createElement("input",{className:"form-control card-number-new",type:"text",maxLength:19,inputMode:"numeric",placeholder:"0000 0000 0000 0000",value:(r==null?void 0:r.cardNumber)||"",onChange:g=>Ie(g),"data-token":"card_number"}),t.createElement("div",{className:"card-crdi card-expiry-new"},t.createElement("div",{className:"exp-date-year-container"},t.createElement("div",{className:"exp-date form-group"},t.createElement("input",{"data-token":"exp_month",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"MM",maxLength:2,value:(r==null?void 0:r.expiryMonth)||"",onChange:g=>ze("expiryMonth",g.target.value)})),t.createElement("div",{className:"exp-year form-group"},t.createElement("input",{"data-token":"exp_year",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"YYYY",maxLength:4,value:(r==null?void 0:r.expiryYear)||"",onChange:g=>ze("expiryYear",g.target.value)})),t.createElement("div",{className:"security-digit form-group"},t.createElement("input",{"data-token":"cvv",className:"form-control card-cvv-in required",type:"text",style:{maxHeight:"36px"},maxLength:4,placeholder:"CVC",value:(r==null?void 0:r.cvv)||"",onChange:g=>ze("cvv",g.target.value)})))),(b==null?void 0:b.cardNumber)&&t.createElement("span",{className:"error-span"},b==null?void 0:b.cardNumber),t.createElement("p",{style:{margin:"0"}},b!=null&&b.expiryMonth||b!=null&&b.expiryYear?t.createElement("span",{className:"error-span",style:{paddingRight:"4px"}},b==null?void 0:b.expiryMonth):"",(b==null?void 0:b.cvv)&&t.createElement("span",{className:"error-span"},b==null?void 0:b.cvv)))),t.createElement("div",{className:"form-group"},t.createElement("label",{htmlFor:"OrderId"},"Order ID / Description"),t.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"OID123456",disabled:!0,value:(H=e==null?void 0:e.orderID)!=null?H:"",style:{background:"#F6F6F7",color:"#727272"}})),t.createElement("div",{className:"form-group"},t.createElement("label",{htmlFor:"zip"},"ZIP"),t.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"000000",value:(ae=r==null?void 0:r.zipCode)!=null?ae:"",onChange:g=>ze("zipCode",g.target.value)}),(b==null?void 0:b.zipCode)&&t.createElement("span",{className:"error-span"},b==null?void 0:b.zipCode)),(e==null?void 0:e.customerId)&&t.createElement("div",{className:"form-group"},t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px",paddingTop:"10px"}},t.createElement("input",{type:"checkbox",id:"save_card",className:"toggle-checkbox",checked:fe,onChange:g=>we(g.target.checked)}),t.createElement("label",{htmlFor:"save_card",className:"toggle-label"}),t.createElement("label",{htmlFor:"save_card"},"Save card for future payments "),t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},t.createElement("g",{clipPath:"url(#clip0_12420_50192)"},t.createElement("rect",{width:"20",height:"20",fill:"white"}),t.createElement("circle",{cx:"10",cy:"10",r:"10",fill:"#E0DFE2"}),t.createElement("path",{d:"M9.03406 12.0979V12.0072C9.04055 11.4153 9.10057 10.9443 9.21411 10.5943C9.3309 10.2442 9.49635 9.96102 9.71046 9.74463C9.92457 9.52824 10.1825 9.33095 10.4842 9.15274C10.6788 9.03182 10.854 8.89658 11.0097 8.74702C11.1655 8.59745 11.2887 8.42562 11.3796 8.2315C11.4704 8.03739 11.5158 7.82259 11.5158 7.58711C11.5158 7.3039 11.4477 7.05887 11.3114 6.85203C11.1752 6.64519 10.9935 6.48608 10.7664 6.3747C10.5426 6.26014 10.2928 6.20286 10.017 6.20286C9.76723 6.20286 9.52879 6.25378 9.3017 6.35561C9.07461 6.45744 8.88646 6.61655 8.73723 6.83294C8.588 7.04614 8.50203 7.3214 8.47932 7.65871H7C7.02271 7.08592 7.17032 6.60223 7.44282 6.20764C7.71533 5.80986 8.07543 5.50915 8.52311 5.30549C8.97405 5.10183 9.47202 5 10.017 5C10.6139 5 11.1363 5.10979 11.5839 5.32936C12.0316 5.54574 12.3788 5.84964 12.6253 6.24105C12.8751 6.62928 13 7.08274 13 7.60143C13 7.95784 12.9432 8.27924 12.8297 8.56563C12.7161 8.84885 12.5539 9.10183 12.3431 9.32458C12.1354 9.54733 11.8856 9.74463 11.5937 9.91647C11.3179 10.0851 11.0941 10.2601 10.9221 10.4415C10.7534 10.6229 10.6302 10.8377 10.5523 11.0859C10.4745 11.3341 10.4323 11.6412 10.4258 12.0072V12.0979H9.03406ZM9.76886 15C9.50284 15 9.27413 14.9077 9.08273 14.7232C8.89132 14.5354 8.79562 14.3095 8.79562 14.0453C8.79562 13.7844 8.89132 13.5617 9.08273 13.3771C9.27413 13.1893 9.50284 13.0955 9.76886 13.0955C10.0316 13.0955 10.2587 13.1893 10.4501 13.3771C10.6448 13.5617 10.7421 13.7844 10.7421 14.0453C10.7421 14.2204 10.6967 14.3811 10.6058 14.5274C10.5182 14.6706 10.4015 14.7852 10.2555 14.8711C10.1095 14.957 9.94728 15 9.76886 15Z",fill:"#161616"})),t.createElement("defs",null,t.createElement("clipPath",{id:"clip0_12420_50192"},t.createElement("rect",{width:"20",height:"20",fill:"white"}))))))),t.createElement("div",{className:"form-group",style:{marginTop:"20px",padding:"0"}},(h==null?void 0:h.paymentDeviceList)&&((ee=h==null?void 0:h.paymentDeviceList)==null?void 0:ee.length)>0&&t.createElement("button",{type:"button",style:{marginBottom:"10px"},className:"pay-button",onClick:()=>v(!pe)},pe?"Pay With Reader":"Pay With Card"),t.createElement("button",{type:"submit",style:{margin:0},className:"pay-button"},"$",(se=Number(e==null?void 0:e.amount))==null?void 0:se.toFixed(2)))):t.createElement(t.Fragment,null,t.createElement("h6",{className:"card-ach-heading",style:{marginBottom:"10px !important"}},"Readers"),t.createElement("div",{className:"card-lint-div-in"},t.createElement("div",{className:"card-list-div"},(h==null?void 0:h.paymentDeviceList)&&((te=h==null?void 0:h.paymentDeviceList)==null?void 0:te.length)>0&&((Ae=h==null?void 0:h.paymentDeviceList)==null?void 0:Ae.map((g,p)=>t.createElement("div",{className:"card-list-single-div",key:p},t.createElement("div",{className:"card-number-radio"},t.createElement("input",{type:"radio",className:"cardRadio",name:"selected_reader",id:"",checked:Xe===g,onChange:Y=>ye(g)}),t.createElement("label",{htmlFor:"",className:"card-number-last-four"},g==null?void 0:g.device_name)),t.createElement("div",{className:"card-number-radio"},t.createElement("span",{className:"visa-card"},t.createElement("img",{src:X,alt:""})))))))),t.createElement("div",{className:"form-group",style:{marginTop:"20px",padding:"0"}},(h==null?void 0:h.paymentDeviceList)&&((ne=h==null?void 0:h.paymentDeviceList)==null?void 0:ne.length)>0&&t.createElement("button",{type:"button",style:{marginBottom:"10px"},className:"pay-button",onClick:()=>v(!pe)},pe?"Pay With Reader":"Pay With Card"),t.createElement("button",{onClick:Ye,className:"pay-button"},"$",(A=Number(e==null?void 0:e.amount))==null?void 0:A.toFixed(2))))),t.createElement("div",{id:"ach",style:{display:K==="ach"?"block":"none"},className:"tabcontent"},t.createElement("form",{id:"ACHPaymentForm",style:{textAlign:"start"},onSubmit:oe},t.createElement("div",{className:"ach-scrl",style:{minHeight:h!=null&&h.isSkyFiAccount&&(I==null?void 0:I.length)>0?"378px":h!=null&&h.isSkyFiAccount&&(I==null?void 0:I.length)==0?"436px":(I==null?void 0:I.length)>0?"462px":"520px",maxHeight:h!=null&&h.isSkyFiAccount&&(I==null?void 0:I.length)>0?"358px":((I==null?void 0:I.length)>0,"380px")}},t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"nameonaccount"},"Name on account"),t.createElement("input",{type:"text",id:"nameonaccount",className:"form-control",maxLength:100,placeholder:"John Doe",name:"name",value:(qe=w==null?void 0:w.name)!=null?qe:"",onChange:Ue}),(l==null?void 0:l.name)&&t.createElement("span",{className:"error-span"},l==null?void 0:l.name)),t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"routingnumber"},"Routing number"),t.createElement("input",{type:"text",id:"routingnumber",className:"form-control",maxLength:9,placeholder:"000000000",name:"routingNumber",value:(Ft=w==null?void 0:w.routingNumber)!=null?Ft:"",onChange:Ue}),(l==null?void 0:l.routingNumber)&&t.createElement("span",{className:"error-span"},l==null?void 0:l.routingNumber)),t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"accountnumber"},"Account number"),t.createElement("input",{type:"text",id:"accountnumber",className:"form-control",maxLength:16,placeholder:"0000000000",name:"accountNumber",value:(dt=w==null?void 0:w.accountNumber)!=null?dt:"",onChange:Ue}),(l==null?void 0:l.accountNumber)&&t.createElement("span",{className:"error-span"},l==null?void 0:l.accountNumber)),t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"confirmaccountnumber"},"Confirm account number"),t.createElement("input",{type:"text",id:"confirmaccountnumber",className:"form-control",maxLength:16,placeholder:"0000000000",name:"confirmAccountNumber",value:(_e=w==null?void 0:w.confirmAccountNumber)!=null?_e:"",onChange:Ue}),(l==null?void 0:l.confirmAccountNumber)&&t.createElement("span",{className:"error-span"},l==null?void 0:l.confirmAccountNumber)),t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"bankname"},"Bank name"),t.createElement("input",{type:"text",id:"bankname",className:"form-control",maxLength:100,placeholder:"My Bank",name:"bankName",value:(O=w==null?void 0:w.bankName)!=null?O:"",onChange:Ue}),(l==null?void 0:l.bankName)&&t.createElement("span",{className:"error-span"},l==null?void 0:l.bankName)),t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"accounttype"},"Select account type"),t.createElement("select",{name:"accountType",id:"accounttype",className:"form-control",value:(Mt=w==null?void 0:w.accountType)!=null?Mt:"",onChange:Ue},t.createElement("option",{value:""},"Select account"),t.createElement("option",{value:"Personal Saving"},"Personal Saving"),t.createElement("option",{value:"Business Saving"},"Business Saving"),t.createElement("option",{value:"Personal Checking"},"Personal Checking"),t.createElement("option",{value:"Business Checking"},"Business Checking"))),(e==null?void 0:e.customerId)&&t.createElement("div",{className:"form-group mb-4 save-ach-div",style:{paddingTop:"5px"}},t.createElement("input",{type:"checkbox",id:"saveACH",className:"",maxLength:100,placeholder:"My Bank",checked:Oe,onChange:g=>Ve(g.target.checked)}),t.createElement("label",{htmlFor:"saveACH"},"Save ACH")),Oe&&t.createElement("div",{className:"form-group mb-4",style:{fontSize:"12px",color:"#727272"}},t.createElement("p",null,"If checked, I agree for ",t.createElement("b",null,"ecommerce")," to have my permission to charge this credit card for agreed upon purchases in the future."))),t.createElement("div",{className:"form-group "},t.createElement("button",{className:"pay-button",style:{margin:"20px 0 0"},type:"submit"},"$",(Xt=Number(e==null?void 0:e.amount))==null?void 0:Xt.toFixed(2)))))))))))))))}import o,{useEffect as di,useState as wt}from"react";import tn from"axios";import un from"sweetalert2";import{IoArrowBack as Pn}from"react-icons/io5";function mi(e){var ct,Re,rt,ut,Pt,st,ze,Ie,Ue;let[F,T]=wt(!1),[V,$]=wt(!1),[je,q]=wt(""),[De,de]=wt(!1),[R,n]=wt(!1),[K,d]=wt("card"),[f,i]=wt(!1),pe=e.merchantPublicKey,v=ue+"widget/mc-img.svg",fe=ue+"widget/visa-img.svg",we=ue+"widget/ae-img.svg",Oe=ue+"widget/discover-img.svg",Ve=ue+"widget/card.svg",ve=ue+"widget/Trash.svg",nt=ue+"widget/bank.svg",Ke=ue+"widget/secure-img.png",at=ue+"widget/pov-by.png",[y,We]=wt(),[E,_]=wt({}),[x,ie]=wt([]),[X,r]=wt(),[s,b]=wt(),[U,w]=wt(""),c=()=>T(!0),l=()=>T(!1),P=()=>{n(!1),d("card"),$(!1),q(""),de(!1),w(""),We({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),_({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),i(!1),r({card_type:"",cardlastfourdigit:"",expmonth:1,expyear:2025,primary_card:0,firstname:"",id:"",lastname:""})},I=()=>n(!0),Me=(C,z)=>{let oe=C;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(oe)){(z===""||/^[0-9]+$/.test(z))&&(_(G=>L(S({},G),{[oe]:""})),We(G=>L(S({},G),{[oe]:z})));return}_(G=>L(S({},G),{[oe]:""})),We(G=>L(S({},G),{[oe]:z}))},Je=C=>{let oe=C.target.value.replace(/\D/g,""),Le="";/^3[47]/.test(oe)?Le=oe.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(Ye,ge,he,Ee)=>[ge,he,Ee].filter(Boolean).join(" ")):Le=oe.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(Ye,ge,he,Ee,Ge)=>[ge,he,Ee,Ge].filter(Boolean).join(" ")),_(G=>L(S({},G),{cardNumber:""})),We(G=>L(S({},G),{cardNumber:Le}))},ht=()=>{var G,Ye,ge,he,Ee,Ge;let C={},z=y,oe=parseInt((z==null?void 0:z.expiryMonth)||"",10),Le=(z==null?void 0:z.expiryYear)||"";if((G=z==null?void 0:z.cardName)!=null&&G.trim()||(C.cardName="Card name is required"),(Ye=z==null?void 0:z.cardNumber)!=null&&Ye.trim()||(C.cardNumber="Card number is required"),(!((ge=z==null?void 0:z.expiryMonth)!=null&&ge.trim())||!((he=z==null?void 0:z.expiryYear)!=null&&he.trim())||isNaN(oe)||oe<1||oe>12||Le.length!==4)&&(C.expiryMonth="Invalid Expiration Date."),(Ee=z==null?void 0:z.cvv)!=null&&Ee.trim()||(C.cvv="CVV is required"),(Ge=z==null?void 0:z.zipCode)!=null&&Ge.trim()||(C.zipCode="ZIP code is required"),z!=null&&z.expiryMonth&&(z!=null&&z.expiryYear)&&z.expiryMonth.length<=2&&z.expiryYear.length===4){let Ce=parseInt(z.expiryMonth,10),lt=parseInt(z.expiryYear,10),u=new Date,m=u.getMonth()+1,j=u.getFullYear();(lt<j||lt===j&&Ce<m)&&(C.expiryMonth="Card is expired")}return _(C),Object.keys(C).length>0},Xe=async C=>{var z,oe,Le,G,Ye,ge,he,Ee,Ge,Ce,lt,u,m,j,Q,B,me,Z,H;if(C.preventDefault(),K=="card"){if(ht())return;{let ee=DatacapWebToken.validateCardNumber(y==null?void 0:y.cardNumber.replaceAll(" ","")),se=DatacapWebToken.validateExpirationDate(y==null?void 0:y.expiryMonth,y==null?void 0:y.expiryYear),te=DatacapWebToken.validateCVV(y==null?void 0:y.cvv),Ae={};if(ee||(Ae.cardNumber="Invalid card Number"),se||(Ae.expiryMonth="Invalid Expiration Date."),te||(Ae.cvv="Invalid CVV"),_(Ae),ee&&te&&se){$(!0);try{let ne=async function(A){if(A.Error)q(A.Error),$(!1);else{let qe=y==null?void 0:y.cardName,Ft=y==null?void 0:y.zipCode;A.name=qe,A.postal_code=Ft,A.fractalpayPublicKey=e==null?void 0:e.merchantPublicKey,A.amount=e==null?void 0:e.amount,A.order_id=e==null?void 0:e.orderID,A.preAuth_id="",A.isCardSave=f,A.customer_id=e==null?void 0:e.customerId,A.link_token="",A.gateway_id=s==null?void 0:s.paymentGateway,A.discount=e==null?void 0:e.discount,A.tax=e==null?void 0:e.tax,A.surcharge=e==null?void 0:e.surcharge,new Headers().append("Content-Type","application/json");let _e={method:"POST",body:JSON.stringify(A),redirect:"follow"};bt.emit("sendMessage",L(S({},_e),{isChargePreauth:!0})),bt.on("charge-preauth",O=>{var Mt;console.log(O,"datdata"),(O==null?void 0:O.status)=="Failed"?($(!1),q((O==null?void 0:O.message)||"Something went wrong. Please try again later.")):(de(!0),w((Mt=O==null?void 0:O.data)==null?void 0:Mt.transaction_id),$(!1),We({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}))})}};if((s==null?void 0:s.paymentGateway)===32){let A={method:"POST",redirect:"follow"};try{let qe=await tn.post(`${Be}api/v1/widget/generate-session`,A),Ft=Number(y==null?void 0:y.expiryYear)%100,dt=y==null?void 0:y.cardNumber;dt=dt==null?void 0:dt.replace(/\s+/g,"");let _e=`${dt}=${Ft}${y==null?void 0:y.expiryMonth} ${y==null?void 0:y.cvv}`,Mt=forge.pki.publicKeyFromPem((oe=(z=qe==null?void 0:qe.data)==null?void 0:z.data)==null?void 0:oe.publicKeyPem).encrypt(_e,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),Xt=forge.util.encode64(Mt),g={"Content-Type":"application/json","x-app-session-key":(G=(Le=qe.data)==null?void 0:Le.data)==null?void 0:G.session_key},p=JSON.stringify({enc_track2_data:`${Xt}`,algorithm:"RSAES_OAEP_SHA_1",session_key:`${(ge=(Ye=qe==null?void 0:qe.data)==null?void 0:Ye.data)==null?void 0:ge.session_key}`});try{let Y=await tn.post(`${Yt}tokenizer/tokenize`,p,{headers:g}),Se=JSON.stringify(L(S({},(he=Y==null?void 0:Y.data)==null?void 0:he.data),{name:y==null?void 0:y.cardName,postal_code:y==null?void 0:y.zipCode,customer_id:e==null?void 0:e.customerId,amount:e==null?void 0:e.amount,Token:`${(Ge=(Ee=Y==null?void 0:Y.data)==null?void 0:Ee.data)==null?void 0:Ge.token}`,fractalpayPublicKey:pe,order_id:e==null?void 0:e.orderID,preAuth_id:"",isCardSave:f,discount:e==null?void 0:e.discount,surcharge:e==null?void 0:e.surcharge,tax:e==null?void 0:e.tax,link_token:"",ExpirationYear:y==null?void 0:y.expiryYear,ExpirationMonth:y==null?void 0:y.expiryMonth,CVV:y==null?void 0:y.cvv,Last4:(lt=(Ce=Y==null?void 0:Y.data)==null?void 0:Ce.data)==null?void 0:lt.last4,Brand:(m=(u=Y==null?void 0:Y.data)==null?void 0:u.data)==null?void 0:m.brand,gateway_id:s==null?void 0:s.paymentGateway})),Te={method:"POST",headers:{"Content-Type":"application/json"},body:Se,redirect:"follow"};bt.emit("sendMessage",L(S({},Te),{isFractalPreauth:!0})),bt.on("fractal-charge-preauth",D=>{var Pe;(D==null?void 0:D.status)=="Failed"?($(!1),q((D==null?void 0:D.message)||"Something went wrong , Try again later")):(w((Pe=D==null?void 0:D.data)==null?void 0:Pe.transaction_id),de(!0),$(!1))})}catch(Y){console.log(Y),$(!1),q(((Q=(j=Y==null?void 0:Y.response)==null?void 0:j.data)==null?void 0:Q.message)||(Y==null?void 0:Y.message)||"Something went wrong , Try again later")}}catch(qe){$(!1),q(((me=(B=qe==null?void 0:qe.response)==null?void 0:B.data)==null?void 0:me.message)||(qe==null?void 0:qe.message)||"Something went wrong , Try again later")}}else DatacapWebToken.requestToken(s==null?void 0:s.dctoken,"PaymentForm",ne)}catch(ne){$(!1),q(((H=(Z=ne==null?void 0:ne.response)==null?void 0:Z.data)==null?void 0:H.message)||(ne==null?void 0:ne.message)||"Something went wrong.")}}}}},ye=async()=>{var C,z,oe,Le,G,Ye,ge,he,Ee,Ge,Ce,lt,u,m,j,Q,B,me;c();try{let Z={fractalpayPublicKey:pe,customer_id:e==null?void 0:e.customerId,preauth:!0},H=await tn.post(`${He}get-payment-details`,Z);if(b((C=H==null?void 0:H.data)==null?void 0:C.data),(oe=(z=H==null?void 0:H.data)==null?void 0:z.data)!=null&&oe.paymentGateway||(P(),q("Something went wrong.")),(G=(Le=H==null?void 0:H.data)==null?void 0:Le.data)!=null&&G.card_list&&((he=(ge=(Ye=H==null?void 0:H.data)==null?void 0:Ye.data)==null?void 0:ge.card_list)==null?void 0:he.length)>0){ie((Ge=(Ee=H==null?void 0:H.data)==null?void 0:Ee.data)==null?void 0:Ge.card_list),d("cardList");let ae=(u=(lt=(Ce=H==null?void 0:H.data)==null?void 0:Ce.data)==null?void 0:lt.card_list)==null?void 0:u.filter(ee=>(ee==null?void 0:ee.primary_card)==1);ae!=null&&ae[0]&&((m=ae==null?void 0:ae[0])==null?void 0:m.payment_method_type)==((Q=(j=H==null?void 0:H.data)==null?void 0:j.data)==null?void 0:Q.paymentGateway)&&r(ae[0])}else d("card");l()}catch(Z){console.log(Z),l(),q(((me=(B=Z==null?void 0:Z.response)==null?void 0:B.data)==null?void 0:me.message)||(Z==null?void 0:Z.message)||"Something went wrong")}},h=async()=>{var Ce,lt,u,m,j,Q,B;let C=e==null?void 0:e.customerId,z=e==null?void 0:e.discount,oe=e==null?void 0:e.surcharge,Le=e==null?void 0:e.tax,G=e==null?void 0:e.merchantPublicKey,Ye=e==null?void 0:e.orderID,ge=e==null?void 0:e.amount,he=X==null?void 0:X.id,Ee=X==null?void 0:X.card_type;if(G&&Ye&&ge)if(C)if(he){let me={amount:ge,order_id:Ye,customer_id:C,card_id:he,fractalpayPublicKey:G,isCardSave:Ee!="Bank",discount:z,surcharge:oe,tax:Le},Ge=me,{isCardSave:Z}=Ge,H=ln(Ge,["isCardSave"]),ee=He+"authorize-by-card",se={"Content-Type":"application/json"};$(!0);try{let te=await tn.post(ee,Ee=="Bank"?H:me,{headers:se});(Ce=te==null?void 0:te.data)!=null&&Ce.result&&(w((u=(lt=te==null?void 0:te.data)==null?void 0:lt.data)==null?void 0:u.transaction_id),de(!0),$(!1))}catch(te){$(!1),console.log(te),q(((j=(m=te==null?void 0:te.response)==null?void 0:m.data)==null?void 0:j.message)||((B=(Q=te==null?void 0:te.response)==null?void 0:Q.data)==null?void 0:B.status)||"Something went erong")}}else q("Please Select A Card/ACH");else q("Please Select Customer");else q("Something went wrong.")};di(()=>{R&&pe&&ye()},[pe,R]);let St=async C=>{un.fire({icon:"warning",text:"Do you want to delete the card?",showCancelButton:!0,confirmButtonText:"Yes",cancelButtonText:"No",reverseButtons:!0,buttonsStyling:!1,customClass:{confirmButton:"swal2-confirm btn btn-dark",cancelButton:"swal2-cancel btn btn-dark",popup:"custom-swal-popup",icon:"custom-swal-icon"}}).then(async z=>{if(z.isConfirmed){$(!0);try{let oe={card_id:C,customer_id:e==null?void 0:e.customerId,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey},Le=await tn.post(`${He}delete-customer-card`,oe);$(!1),ye(),un.fire({icon:"success",title:"Deleted!",text:"The card has been deleted.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}catch(oe){$(!1),un.fire({icon:"error",title:"Error!",text:"Failed to delete the card.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}}})},gt=C=>{switch(C==null?void 0:C.toLowerCase()){case"visa":return fe;case"mastercard":case"mc":case"m/c":return v;case"amex":case"american express":case"ae":return we;case"discover":return Oe;case"bank":return nt;default:return C}};return o.createElement(o.Fragment,null,o.createElement(It,null),o.createElement(Dt,null),o.createElement(o.Fragment,null,o.createElement("button",{className:"paymentBtn",onClick:I},"PreAuth Payment"),o.createElement(kt,{open:R,onClose:P},je&&o.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},o.createElement(Tt,{error:je,onClose:P})),De&&o.createElement(Rt,{onClose:P,tranId:U}),!je&&!De&&o.createElement(o.Fragment,null,(F||V)&&o.createElement(xt,{loading:F||V}),o.createElement("div",null,o.createElement("div",{className:"frac-card-payment-page frac-form"},o.createElement("div",{className:"parent-pay-container"},o.createElement("span",{className:"request-payment-close-popup",onClick:P},o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},o.createElement("g",{clipPath:"url(#clip0_12425_52336)"},o.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),o.createElement("defs",null,o.createElement("clipPath",{id:"clip0_12425_52336"},o.createElement("rect",{width:"16",height:"16",fill:"white"}))))),o.createElement("div",{className:"pay-container"},o.createElement("div",{className:"pay-header pay-conatiner-one"},o.createElement("div",{className:"pay-conatiner-one-first"},o.createElement("div",{className:"pay-logo-container"},o.createElement("div",{className:"pay-main-logo"},o.createElement("img",{src:s==null?void 0:s.logo,id:"pay-logos"})),o.createElement("h1",{className:"pay-heading"},"Pay"),(x==null?void 0:x.length)>0&&K!=="cardList"&&o.createElement("button",{className:"res-charge-payment-back-btn ",onClick:()=>d("cardList")}," ",o.createElement(Pn,null)," Back")),o.createElement("div",{className:"amt-pay-con"},o.createElement("div",{className:"pay-amount-conatiner"},o.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),o.createElement("strong",{className:"pay-amount"},"$",(ct=Number(e==null?void 0:e.amount))==null?void 0:ct.toFixed(2))),K!="ach"&&o.createElement("div",{style:{display:"flex",gap:"8px",margin:"8px 0"}},o.createElement("img",{src:fe,alt:"",width:33}),o.createElement("img",{src:v,width:33,alt:""}),o.createElement("img",{src:we,alt:"",width:33}),o.createElement("img",{src:Oe,width:33,alt:""})))),o.createElement("div",{className:"pay-conatiner-one-last"},o.createElement("img",{src:Ke,alt:""}),o.createElement("img",{src:at,alt:""}),"Secure payments powered by Fractal"),o.createElement("div",null)),!F&&o.createElement("div",{className:"pay-tab pay-conatiner-two"},o.createElement("div",{className:"col-md-12"},o.createElement("div",{id:"payment-form-div"},K!=="cardList"?o.createElement("div",null,(x==null?void 0:x.length)>0&&o.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>d("cardList")}," ",o.createElement(Pn,null)," Back"),o.createElement("div",{className:""},o.createElement("div",{className:"res-pay-con"},o.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},o.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),o.createElement("strong",{className:"pay-amount"},"$",(Re=Number(e==null?void 0:e.amount))==null?void 0:Re.toFixed(2))),o.createElement("div",null,o.createElement("div",null,o.createElement("img",{src:fe,alt:"",width:35,style:{paddingRight:"5px"}}),o.createElement("img",{src:v,width:35,alt:""})),o.createElement("div",null,o.createElement("img",{src:we,alt:"",width:35,style:{paddingRight:"5px"}}),o.createElement("img",{src:Oe,width:35,alt:""})))))):o.createElement("div",null,o.createElement("h6",{className:"charge-customer-name",style:{marginBottom:"16px !important"}}," Charge ",s==null?void 0:s.customer_name),o.createElement("div",{className:"res-pay-con"},o.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},o.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),o.createElement("strong",{className:"pay-amount"},"$",(rt=Number(e==null?void 0:e.amount))==null?void 0:rt.toFixed(2))),o.createElement("div",null,o.createElement("div",null,o.createElement("img",{src:fe,alt:"",width:35,style:{paddingRight:"5px"}}),o.createElement("img",{src:v,width:35,alt:""})),o.createElement("div",null,o.createElement("img",{src:we,alt:"",width:35,style:{paddingRight:"5px"}}),o.createElement("img",{src:Oe,width:35,alt:""})))),o.createElement("h6",{className:"card-ach-heading",style:{marginBottom:"10px !important"}}," Cards")),o.createElement("div",{style:{display:K==="cardList"?"block":"none"},className:"tabcontent"},o.createElement("div",{className:"card-lint-div-in"},o.createElement("div",{className:"card-list-div"},(s==null?void 0:s.card_list)&&((ut=s==null?void 0:s.card_list)==null?void 0:ut.length)>0&&((Pt=s==null?void 0:s.card_list)==null?void 0:Pt.map((C,z)=>o.createElement("div",{className:"card-list-single-div",key:z},o.createElement("div",{className:"card-number-radio"},o.createElement("input",{disabled:(s==null?void 0:s.paymentGateway)!=(C==null?void 0:C.payment_method_type),type:"radio",className:"cardRadio",name:"selected_card",id:"",checked:X===C,onChange:oe=>r(C)}),o.createElement("label",{htmlFor:"",className:"card-number-last-four"},"**** ",C==null?void 0:C.cardlastfourdigit),o.createElement("h6",{className:"card-expiry-date"},C==null?void 0:C.expmonth,"/",C==null?void 0:C.expyear)),o.createElement("div",{className:"card-number-radio"},o.createElement("span",{className:"visa-card"},o.createElement("img",{src:gt(C==null?void 0:C.card_type),alt:""})),o.createElement("span",{className:"visa-card",style:{cursor:"pointer"},onClick:()=>St(C==null?void 0:C.id)},o.createElement("img",{src:ve,alt:""}))))))),o.createElement("div",{className:"pay-with-other-card ",onClick:()=>d("card")},"Authorize With Other Card",o.createElement("img",{src:Ve,alt:""}))),o.createElement("div",{className:"form-group"},o.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:h},"$",(st=Number(e==null?void 0:e.amount))==null?void 0:st.toFixed(2)))),o.createElement("div",{id:"card",style:{display:K==="card"?"block":"none"},className:"tabcontent"},o.createElement("form",{id:"PaymentForm",onSubmit:Xe},o.createElement("div",{className:"ach-scrl",style:{minHeight:(x==null?void 0:x.length)>0?"462px":"520px",overflow:"auto",marginRight:"5px"}},o.createElement("div",{className:"form-group"},o.createElement("label",{htmlFor:"cardHolderName"},"Name on Card"),o.createElement("input",{type:"text",className:"form-control",placeholder:"John Doe",value:(y==null?void 0:y.cardName)||"",onChange:C=>{let z=C.target.value;/^[a-zA-Z\s]*$/.test(z)&&Me("cardName",z)}}),(E==null?void 0:E.cardName)&&o.createElement("span",{className:"error-span"},E==null?void 0:E.cardName)),o.createElement("div",{className:"form-group"},o.createElement("label",{htmlFor:"cardNumber"},"Card Number"),o.createElement("div",{className:"toggle-num-wrapper"},o.createElement("input",{className:"form-control card-number-new",type:"text",maxLength:19,inputMode:"numeric",placeholder:"0000 0000 0000 0000",value:(y==null?void 0:y.cardNumber)||"",onChange:C=>Je(C),"data-token":"card_number"}),o.createElement("div",{className:"card-crdi card-expiry-new"},o.createElement("div",{className:"exp-date-year-container"},o.createElement("div",{className:"exp-date form-group"},o.createElement("input",{"data-token":"exp_month",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"MM",maxLength:2,value:(y==null?void 0:y.expiryMonth)||"",onChange:C=>Me("expiryMonth",C.target.value)})),o.createElement("div",{className:"exp-year form-group"},o.createElement("input",{"data-token":"exp_year",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"YYYY",maxLength:4,value:(y==null?void 0:y.expiryYear)||"",onChange:C=>Me("expiryYear",C.target.value)})),o.createElement("div",{className:"security-digit form-group"},o.createElement("input",{"data-token":"cvv",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},maxLength:4,placeholder:"CVC",value:(y==null?void 0:y.cvv)||"",onChange:C=>Me("cvv",C.target.value)})))),(E==null?void 0:E.cardNumber)&&o.createElement("span",{className:"error-span"},E==null?void 0:E.cardNumber),o.createElement("p",{style:{margin:"0"}},E!=null&&E.expiryMonth||E!=null&&E.expiryYear?o.createElement("span",{className:"error-span",style:{paddingRight:"4px"}},E==null?void 0:E.expiryMonth):"",(E==null?void 0:E.cvv)&&o.createElement("span",{className:"error-span"},E==null?void 0:E.cvv)))),o.createElement("div",{className:"form-group"},o.createElement("label",{htmlFor:"OrderId"},"Order ID / Description"),o.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"OID123456",disabled:!0,value:(ze=y==null?void 0:y.orderId)!=null?ze:"OID123456",onChange:C=>Me("orderId",C.target.value),style:{background:"#F6F6F7",color:"#727272"}})),o.createElement("div",{className:"form-group"},o.createElement("label",{htmlFor:"zip"},"ZIP"),o.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"000000",value:(Ie=y==null?void 0:y.zipCode)!=null?Ie:"",onChange:C=>Me("zipCode",C.target.value)}),(E==null?void 0:E.zipCode)&&o.createElement("span",{className:"error-span"},E==null?void 0:E.zipCode)),(e==null?void 0:e.customerId)&&o.createElement("div",{className:"form-group"},o.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px",paddingTop:"10px"}},o.createElement("input",{type:"checkbox",id:"save_card",className:"toggle-checkbox",checked:f,onChange:C=>i(C.target.checked)}),o.createElement("label",{htmlFor:"save_card",className:"toggle-label"}),o.createElement("label",{htmlFor:"save_card"},"Save card for future payments "),o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},o.createElement("g",{clipPath:"url(#clip0_12420_50192)"},o.createElement("rect",{width:"20",height:"20",fill:"white"}),o.createElement("circle",{cx:"10",cy:"10",r:"10",fill:"#E0DFE2"}),o.createElement("path",{d:"M9.03406 12.0979V12.0072C9.04055 11.4153 9.10057 10.9443 9.21411 10.5943C9.3309 10.2442 9.49635 9.96102 9.71046 9.74463C9.92457 9.52824 10.1825 9.33095 10.4842 9.15274C10.6788 9.03182 10.854 8.89658 11.0097 8.74702C11.1655 8.59745 11.2887 8.42562 11.3796 8.2315C11.4704 8.03739 11.5158 7.82259 11.5158 7.58711C11.5158 7.3039 11.4477 7.05887 11.3114 6.85203C11.1752 6.64519 10.9935 6.48608 10.7664 6.3747C10.5426 6.26014 10.2928 6.20286 10.017 6.20286C9.76723 6.20286 9.52879 6.25378 9.3017 6.35561C9.07461 6.45744 8.88646 6.61655 8.73723 6.83294C8.588 7.04614 8.50203 7.3214 8.47932 7.65871H7C7.02271 7.08592 7.17032 6.60223 7.44282 6.20764C7.71533 5.80986 8.07543 5.50915 8.52311 5.30549C8.97405 5.10183 9.47202 5 10.017 5C10.6139 5 11.1363 5.10979 11.5839 5.32936C12.0316 5.54574 12.3788 5.84964 12.6253 6.24105C12.8751 6.62928 13 7.08274 13 7.60143C13 7.95784 12.9432 8.27924 12.8297 8.56563C12.7161 8.84885 12.5539 9.10183 12.3431 9.32458C12.1354 9.54733 11.8856 9.74463 11.5937 9.91647C11.3179 10.0851 11.0941 10.2601 10.9221 10.4415C10.7534 10.6229 10.6302 10.8377 10.5523 11.0859C10.4745 11.3341 10.4323 11.6412 10.4258 12.0072V12.0979H9.03406ZM9.76886 15C9.50284 15 9.27413 14.9077 9.08273 14.7232C8.89132 14.5354 8.79562 14.3095 8.79562 14.0453C8.79562 13.7844 8.89132 13.5617 9.08273 13.3771C9.27413 13.1893 9.50284 13.0955 9.76886 13.0955C10.0316 13.0955 10.2587 13.1893 10.4501 13.3771C10.6448 13.5617 10.7421 13.7844 10.7421 14.0453C10.7421 14.2204 10.6967 14.3811 10.6058 14.5274C10.5182 14.6706 10.4015 14.7852 10.2555 14.8711C10.1095 14.957 9.94728 15 9.76886 15Z",fill:"#161616"})),o.createElement("defs",null,o.createElement("clipPath",{id:"clip0_12420_50192"},o.createElement("rect",{width:"20",height:"20",fill:"white"}))))))),o.createElement("div",{className:"form-group",style:{marginTop:"20px",padding:0}},o.createElement("button",{type:"submit",style:{margin:0},className:"pay-button"},"$",(Ue=Number(e==null?void 0:e.amount))==null?void 0:Ue.toFixed(2))))))))))))))))}import J,{useEffect as ui,useRef as nn,useState as Wt}from"react";import fi from"sweetalert2";import Jt from"axios";import ci from"react";function fn(){let e="#000",F="#fff",T="#212529",V="#dee2e6";return ci.createElement("style",null,`
|
|
1473
1473
|
.add-card {
|
|
1474
1474
|
max-width:380px;
|
|
1475
1475
|
padding: 0 20px
|
|
@@ -1728,7 +1728,7 @@ var zn=Object.defineProperty,In=Object.defineProperties;var qn=Object.getOwnProp
|
|
|
1728
1728
|
}
|
|
1729
1729
|
}
|
|
1730
1730
|
|
|
1731
|
-
`)}import
|
|
1731
|
+
`)}import At from"react";import pi from"react";function hn(){return pi.createElement("style",null,`
|
|
1732
1732
|
.card-success .logo-container {
|
|
1733
1733
|
display: flex;
|
|
1734
1734
|
justify-content: center;
|
|
@@ -1816,7 +1816,7 @@ var zn=Object.defineProperty,In=Object.defineProperties;var qn=Object.getOwnProp
|
|
|
1816
1816
|
color: #161616;
|
|
1817
1817
|
opacity: 0.5;
|
|
1818
1818
|
}
|
|
1819
|
-
`)}var li=({onClose:e})=>xt.createElement(xt.Fragment,null,xt.createElement(cn,null),xt.createElement("div",{className:"card-success"},xt.createElement("div",{className:"payment-success-container"},xt.createElement("div",{className:"success-icon"},xt.createElement("div",{className:"circle"},xt.createElement("i",{className:"fa fa-check-circle","aria-hidden":"true"})),xt.createElement("div",{className:"success-text"},xt.createElement("div",{className:"payment-success-text"},"Your card was added successfully."),xt.createElement("div",{className:"thank-you-text"},"Thank you ")))))),wn=li;function ci(e){var Fe;let[N,Y]=Vt(!1),[j,q]=Vt(!1),[pe,F]=Vt(""),[Le,ee]=Vt(!1),[r,d]=Vt(),[y,p]=Vt({}),[u,he]=Vt(),te=()=>Y(!0),E=()=>Y(!1),fe=h=>{mi.fire({icon:"error",text:h,customClass:{popup:"custom-z-index"}})},le=()=>{ee(!1),q(!1),F(""),d({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""})},Me=()=>ee(!0),Ce=()=>{le()},we=(h,i)=>{let m=h;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(m)){(i===""||/^[0-9]+$/.test(i))&&(p(P=>A(I({},P),{[m]:""})),d(P=>A(I({},P),{[m]:i})));return}p(P=>A(I({},P),{[m]:""})),console.log(i,m),d(P=>A(I({},P),{[m]:i}))},ot=h=>{let m=h.target.value.replace(/\D/g,""),B="";/^3[47]/.test(m)?B=m.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(s,S,_,V)=>[S,_,V].filter(Boolean).join(" ")):B=m.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(s,S,_,V,k)=>[S,_,V,k].filter(Boolean).join(" ")),p(P=>A(I({},P),{cardNumber:""})),d(P=>A(I({},P),{cardNumber:B}))},Ye=()=>{var P,s,S,_,V,k;let h={},i=r,m=parseInt((i==null?void 0:i.expiryMonth)||"",10),B=(i==null?void 0:i.expiryYear)||"";if((P=i==null?void 0:i.cardName)!=null&&P.trim()||(h.cardName="Card name is required"),(s=i==null?void 0:i.cardNumber)!=null&&s.trim()||(h.cardNumber="Card number is required"),(S=i==null?void 0:i.expiryMonth)!=null&&S.trim()?(Number(i==null?void 0:i.expiryMonth)>12||Number(i==null?void 0:i.expiryMonth)<1)&&(h.expiryMonth="Invalid Expiration Month."):h.expiryMonth="Expiration month is required",(_=i==null?void 0:i.expiryYear)!=null&&_.trim()?((V=i==null?void 0:i.expiryYear)==null?void 0:V.trim().length)!==4||Number(i==null?void 0:i.expiryYear)<2025?h.expiryYear="Invalid Expiration Year.":(isNaN(m)||m<1||m>12||B.length!==4)&&(h.expiryMonth="Invalid Expiration Date."):h.expiryYear="Expiration year is required",(k=i==null?void 0:i.cvv)!=null&&k.trim()||(h.cvv="CVC is required"),i!=null&&i.expiryMonth&&(i!=null&&i.expiryYear)&&i.expiryMonth.length<=2&&i.expiryYear.length===4){let c=parseInt(i.expiryMonth,10),o=parseInt(i.expiryYear,10),M=new Date,z=M.getMonth()+1,Ne=M.getFullYear();(o<Ne||o===Ne&&c<z)&&(h.expiryMonth="Card is expired")}return p(h),Object.keys(h).length>0},Ee=async()=>{var h,i,m;te();try{let B={fractalpayPublicKey:e==null?void 0:e.merchantPublicKey,customer_id:e==null?void 0:e.customerId,addcard:!0},P=await Wt.post(`${re}get-payment-details`,B);console.log(P),he((h=P==null?void 0:P.data)==null?void 0:h.data),(m=(i=P==null?void 0:P.data)==null?void 0:i.data)!=null&&m.paymentGateway||(le(),F("Something went wrong.")),E()}catch(B){console.log(B),E(),le(),F("Something went wrong.")}};return di(()=>{e!=null&&e.merchantPublicKey&&Ee()},[e==null?void 0:e.merchantPublicKey]),$.createElement($.Fragment,null,$.createElement(Pt,null),$.createElement(mn,null),$.createElement(dt,{loading:N}),pe&&$.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},$.createElement(At,{error:pe,onClose:le})),j&&$.createElement(wn,{onClose:Ce}),!pe&&!j&&$.createElement($.Fragment,null,$.createElement("div",{className:"container-creditcard add-card modal-content",id:"add-credit-card-panel",style:{margin:"auto"}},$.createElement("form",{id:"creditCardForm",onSubmit:async h=>{var m,B,P,s,S,_,V,k,c,o,M,z,Ne,Oe,bt,He;h.preventDefault();let i=Ye();if(console.log(r),!i){let at=DatacapWebToken.validateCardNumber(r==null?void 0:r.cardNumber.replaceAll(" ","")),g=DatacapWebToken.validateExpirationDate(r==null?void 0:r.expiryMonth,r==null?void 0:r.expiryYear),St=DatacapWebToken.validateCVV(r==null?void 0:r.cvv),je={};if(at||(je.cardNumber="Invalid card Number"),g||(je.expiryMonth="Invalid Expiration Date."),St||(je.cvv="Invalid CVV"),p(je),at&&St&&g){te();try{let ye=async function(oe){var O,Ve,De,vt,rt;if(console.log(oe),oe.Error)console.log(oe==null?void 0:oe.Error),F(oe.Error),E();else{let Lt={userId:e==null?void 0:e.customerId,cardName:r==null?void 0:r.cardName,zip:r==null?void 0:r.zipCode,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey,token:oe};try{let de=await Wt.post(`${re}add-card`,Lt);console.log(de);let v={fractalpayPublicKey:e==null?void 0:e.merchantPublicKey,wallet_id:"",card_number:r==null?void 0:r.cardNumber.replaceAll(" ",""),exp_month:r==null?void 0:r.expiryMonth,exp_year:(O=r==null?void 0:r.expiryYear)==null?void 0:O.slice(-2),cvv:r==null?void 0:r.cvv};try{let w=await Wt.post(`${re}link-wallet`,v);console.log(w),q(!0),E(),d({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),qt(h,"close","")}catch(w){console.log(w),E(),F(((De=(Ve=w==null?void 0:w.response)==null?void 0:Ve.data)==null?void 0:De.message)||(w==null?void 0:w.message)||"Something went wrong.")}}catch(de){console.log(de),E(),F(((rt=(vt=de==null?void 0:de.response)==null?void 0:vt.data)==null?void 0:rt.message)||(de==null?void 0:de.message)||"Something went wrong.")}}};if((u==null?void 0:u.paymentGateway)===32){let oe={method:"POST",redirect:"follow"};try{let O=await Wt.post(`${yt}api/v1/widget/generate-session`,oe),Ve=Number(r==null?void 0:r.expiryYear)%100,De=r==null?void 0:r.cardNumber;De=De==null?void 0:De.replace(/\s+/g,"");let vt=`${De}=${Ve}${r==null?void 0:r.expiryMonth} ${r==null?void 0:r.cvv}`,Lt=forge.pki.publicKeyFromPem((B=(m=O==null?void 0:O.data)==null?void 0:m.data)==null?void 0:B.publicKeyPem).encrypt(vt,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),de=forge.util.encode64(Lt),v={"Content-Type":"application/json","x-app-session-key":(s=(P=O.data)==null?void 0:P.data)==null?void 0:s.session_key},w=JSON.stringify({enc_track2_data:`${de}`,algorithm:"RSAES_OAEP_SHA_1",session_key:`${(_=(S=O==null?void 0:O.data)==null?void 0:S.data)==null?void 0:_.session_key}`});try{let H=await Wt.post(`${Ft}tokenizer/tokenize`,w,{headers:v}),xe=JSON.stringify(A(I({},(V=H==null?void 0:H.data)==null?void 0:V.data),{cvv:r==null?void 0:r.cvv,cardName:r==null?void 0:r.cardName,zip:r==null?void 0:r.zipCode,userId:e==null?void 0:e.customerId,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey})),W={"Content-Type":"application/json"};try{let U=await Wt.post(`${re}add-card`,xe,{headers:W});console.log(U),(k=U==null?void 0:U.data)!=null&&k.result&&(q(!0),E(),qt(h,"close",""))}catch(U){E(),F(((o=(c=U==null?void 0:U.response)==null?void 0:c.data)==null?void 0:o.message)||(U==null?void 0:U.message)||"Something went wrong.")}}catch(H){E(),F(((z=(M=H==null?void 0:H.response)==null?void 0:M.data)==null?void 0:z.message)||(H==null?void 0:H.message)||"Something went wrong.")}}catch(O){E(),F(((Oe=(Ne=O==null?void 0:O.response)==null?void 0:Ne.data)==null?void 0:Oe.message)||(O==null?void 0:O.message)||"Something went wrong.")}}else typeof DatacapWebToken!="undefined"&&DatacapWebToken.requestToken(u==null?void 0:u.dctoken,"creditCardForm",ye)}catch(ye){E(),F(((He=(bt=ye==null?void 0:ye.response)==null?void 0:bt.data)==null?void 0:He.message)||(ye==null?void 0:ye.message)||"Something went wrong.")}}}},style:{padding:"0 10px"}},$.createElement("div",{style:{maxHeight:"350px",minHeight:"0"},className:"card-scrl"},$.createElement("div",{className:"form-group",style:{marginTop:"0",marginBottom:"10px"}},$.createElement("label",{htmlFor:"cardNumber"},"Card Number"),$.createElement("input",{type:"text","data-token":"card_number",placeholder:"Enter card number",maxLength:19,inputMode:"numeric",value:(r==null?void 0:r.cardNumber)||"",onChange:h=>ot(h)}),(y==null?void 0:y.cardNumber)&&$.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},y==null?void 0:y.cardNumber),$.createElement("br",null)),$.createElement("div",{className:"card-dtl"},$.createElement("div",{className:"exp-cvc-container",style:{margin:"0"}},$.createElement("div",{className:"form-group",style:{marginTop:"0"}},$.createElement("label",{htmlFor:"expMonth"},"MM"),$.createElement("input",{"data-token":"exp_month",className:"form-control required",type:"text",placeholder:"MM",maxLength:2,value:(r==null?void 0:r.expiryMonth)||"",onChange:h=>we("expiryMonth",h.target.value)}),(y==null?void 0:y.expiryMonth)&&$.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},y==null?void 0:y.expiryMonth)),$.createElement("div",{className:"form-group",style:{marginTop:"0"}},$.createElement("label",{htmlFor:"expYear"},"YYYY"),$.createElement("input",{"data-token":"exp_year",className:"form-control required",type:"text",placeholder:"YYYY",maxLength:4,value:(r==null?void 0:r.expiryYear)||"",onChange:h=>we("expiryYear",h.target.value)}),(y==null?void 0:y.expiryYear)&&$.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},y==null?void 0:y.expiryYear)),$.createElement("div",{className:"form-group",style:{marginTop:"0"}},$.createElement("label",{htmlFor:"cvc"},"CVC"),$.createElement("input",{"data-token":"cvv",className:"form-control required",type:"text",placeholder:"CVC",maxLength:4,value:(r==null?void 0:r.cvv)||"",onChange:h=>we("cvv",h.target.value)}),(y==null?void 0:y.cvv)&&$.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},y==null?void 0:y.cvv)))),$.createElement("div",{className:"form-group",style:{marginTop:"0"}},$.createElement("label",{htmlFor:"cardholderName"},"Name on card"),$.createElement("input",{type:"text",id:"cardholderName",name:"cardholderName",placeholder:"Name on card required",value:(r==null?void 0:r.cardName)||"",onChange:h=>{let i=h.target.value;/^[a-zA-Z\s]*$/.test(i)&&we("cardName",i)}}),(y==null?void 0:y.cardName)&&$.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},y==null?void 0:y.cardName)),$.createElement("div",{className:"form-group",style:{marginTop:"0"}},$.createElement("label",{htmlFor:"zipcode"},"Zip"),$.createElement("input",{type:"text",id:"",name:"zipcode",placeholder:"Zip",value:(Fe=r==null?void 0:r.zipCode)!=null?Fe:"",onChange:h=>we("zipCode",h.target.value)}),(y==null?void 0:y.zipCode)&&$.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},y==null?void 0:y.zipCode))),$.createElement("input",{type:"submit",className:"idle-green-btn w-100",defaultValue:"Submit"})))))}import C,{useState as Dt}from"react";import Rt from"axios";var Nn={PROPAYKEY:"25",PAYARCKEY:"26",STRIPEKEYCC:"27",PAYRIXKEY:"28",SKYFIACHKEY:"29",JUSTIFIKEY:"30",INFINICEPTKEY:"31",FRACTALKEY:"32"};import ui from"react";function un({}){return ui.createElement("style",null,`
|
|
1819
|
+
`)}var gi=({onClose:e})=>At.createElement(At.Fragment,null,At.createElement(hn,null),At.createElement("div",{className:"card-success"},At.createElement("div",{className:"payment-success-container"},At.createElement("div",{className:"success-icon"},At.createElement("div",{className:"circle"},At.createElement("i",{className:"fa fa-check-circle","aria-hidden":"true"})),At.createElement("div",{className:"success-text"},At.createElement("div",{className:"payment-success-text"},"Your card was added successfully."),At.createElement("div",{className:"thank-you-text"},"Thank you ")))))),Fn=gi;function hi(e){var X;let[F,T]=Wt(!1),[V,$]=Wt(!1),[je,q]=Wt(""),[De,de]=Wt(!1),R=nn(null),n=nn(null),K=nn(null),d=nn(null),f=nn(null),[i,pe]=Wt(),[v,fe]=Wt({}),[we,Oe]=Wt(),Ve=()=>T(!0),ve=()=>T(!1),nt=r=>{fi.fire({icon:"error",text:r,customClass:{popup:"custom-z-index"}})},Ke=()=>{de(!1),$(!1),q(""),pe({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""})},at=()=>de(!0),y=()=>{Ke()},We=(r,s)=>{var w,c,l;let b=r,U=["expiryMonth","expiryYear","zipCode","cvv"];if(console.log(b,s==null?void 0:s.length,"dfih",b==="expiryMonth"&&(s==null?void 0:s.length)===2),b==="expiryMonth"&&(s==null?void 0:s.length)===2&&((w=K==null?void 0:K.current)==null||w.focus()),b==="expiryYear"&&(s==null?void 0:s.length)===4&&((c=d==null?void 0:d.current)==null||c.focus()),b==="cvv"&&(s==null?void 0:s.length)===3&&((l=f==null?void 0:f.current)==null||l.focus()),U.includes(b)){(s===""||/^[0-9]+$/.test(s))&&(fe(P=>L(S({},P),{[b]:""})),pe(P=>L(S({},P),{[b]:s})));return}fe(P=>L(S({},P),{[b]:""})),console.log(s,b),pe(P=>L(S({},P),{[b]:s}))},E=r=>{var w;let b=r.target.value.replace(/\D/g,""),U="";/^3[47]/.test(b)?U=b.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(l,P,I,Me)=>[P,I,Me].filter(Boolean).join(" ")):U=b.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(l,P,I,Me,Je)=>[P,I,Me,Je].filter(Boolean).join(" ")),fe(c=>L(S({},c),{cardNumber:""})),pe(c=>L(S({},c),{cardNumber:U})),console.log(b==null?void 0:b.length,"length"),(b==null?void 0:b.length)===16&&((w=n==null?void 0:n.current)==null||w.focus())},_=()=>{var w,c,l,P,I,Me;let r={},s=i,b=parseInt((s==null?void 0:s.expiryMonth)||"",10),U=(s==null?void 0:s.expiryYear)||"";if((w=s==null?void 0:s.cardName)!=null&&w.trim()||(r.cardName="Card name is required"),(c=s==null?void 0:s.cardNumber)!=null&&c.trim()||(r.cardNumber="Card number is required"),(l=s==null?void 0:s.expiryMonth)!=null&&l.trim()?(Number(s==null?void 0:s.expiryMonth)>12||Number(s==null?void 0:s.expiryMonth)<1)&&(r.expiryMonth="Invalid Expiration Month."):r.expiryMonth="Expiration month is required",(P=s==null?void 0:s.expiryYear)!=null&&P.trim()?((I=s==null?void 0:s.expiryYear)==null?void 0:I.trim().length)!==4||Number(s==null?void 0:s.expiryYear)<2025?r.expiryYear="Invalid Expiration Year.":(isNaN(b)||b<1||b>12||U.length!==4)&&(r.expiryMonth="Invalid Expiration Date."):r.expiryYear="Expiration year is required",(Me=s==null?void 0:s.cvv)!=null&&Me.trim()||(r.cvv="CVC is required"),s!=null&&s.expiryMonth&&(s!=null&&s.expiryYear)&&s.expiryMonth.length<=2&&s.expiryYear.length===4){let Je=parseInt(s.expiryMonth,10),ht=parseInt(s.expiryYear,10),Xe=new Date,ye=Xe.getMonth()+1,h=Xe.getFullYear();(ht<h||ht===h&&Je<ye)&&(r.expiryMonth="Card is expired")}return fe(r),Object.keys(r).length>0},x=async()=>{var r,s,b;Ve();try{let U={fractalpayPublicKey:e==null?void 0:e.merchantPublicKey,customer_id:e==null?void 0:e.customerId,addcard:!0},w=await Jt.post(`${He}get-payment-details`,U);console.log(w),Oe((r=w==null?void 0:w.data)==null?void 0:r.data),(b=(s=w==null?void 0:w.data)==null?void 0:s.data)!=null&&b.paymentGateway||(Ke(),q("Something went wrong.")),ve()}catch(U){console.log(U),ve(),Ke(),q("Something went wrong.")}};return ui(()=>{e!=null&&e.merchantPublicKey&&x()},[e==null?void 0:e.merchantPublicKey]),J.createElement(J.Fragment,null,J.createElement(It,null),J.createElement(fn,null),J.createElement(xt,{loading:F}),je&&J.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},J.createElement(Tt,{error:je,onClose:Ke})),V&&J.createElement(Fn,{onClose:y}),!je&&!V&&J.createElement(J.Fragment,null,J.createElement("div",{className:"container-creditcard add-card modal-content",id:"add-credit-card-panel",style:{margin:"auto"}},J.createElement("form",{id:"creditCardForm",onSubmit:async r=>{var b,U,w,c,l,P,I,Me,Je,ht,Xe,ye,h,St,gt,ct;r.preventDefault();let s=_();if(console.log(i),!s){let Re=DatacapWebToken.validateCardNumber(i==null?void 0:i.cardNumber.replaceAll(" ","")),rt=DatacapWebToken.validateExpirationDate(i==null?void 0:i.expiryMonth,i==null?void 0:i.expiryYear),ut=DatacapWebToken.validateCVV(i==null?void 0:i.cvv),Pt={};if(Re||(Pt.cardNumber="Invalid card Number"),rt||(Pt.expiryMonth="Invalid Expiration Date."),ut||(Pt.cvv="Invalid CVV"),fe(Pt),Re&&ut&&rt){Ve();try{let st=async function(ze){var Ie,Ue,C,z,oe;if(console.log(ze),ze.Error)console.log(ze==null?void 0:ze.Error),q(ze.Error),ve();else{let Le={userId:e==null?void 0:e.customerId,cardName:i==null?void 0:i.cardName,zip:i==null?void 0:i.zipCode,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey,token:ze};try{let G=await Jt.post(`${He}add-card`,Le);console.log(G);let Ye={fractalpayPublicKey:e==null?void 0:e.merchantPublicKey,wallet_id:"",card_number:i==null?void 0:i.cardNumber.replaceAll(" ",""),exp_month:i==null?void 0:i.expiryMonth,exp_year:(Ie=i==null?void 0:i.expiryYear)==null?void 0:Ie.slice(-2),cvv:i==null?void 0:i.cvv};try{let ge=await Jt.post(`${He}link-wallet`,Ye);console.log(ge),$(!0),ve(),pe({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),Kt(r,"close","")}catch(ge){console.log(ge),ve(),q(((C=(Ue=ge==null?void 0:ge.response)==null?void 0:Ue.data)==null?void 0:C.message)||(ge==null?void 0:ge.message)||"Something went wrong.")}}catch(G){console.log(G),ve(),q(((oe=(z=G==null?void 0:G.response)==null?void 0:z.data)==null?void 0:oe.message)||(G==null?void 0:G.message)||"Something went wrong.")}}};if((we==null?void 0:we.paymentGateway)===32){let ze={method:"POST",redirect:"follow"};try{let Ie=await Jt.post(`${Be}api/v1/widget/generate-session`,ze),Ue=Number(i==null?void 0:i.expiryYear)%100,C=i==null?void 0:i.cardNumber;C=C==null?void 0:C.replace(/\s+/g,"");let z=`${C}=${Ue}${i==null?void 0:i.expiryMonth} ${i==null?void 0:i.cvv}`,Le=forge.pki.publicKeyFromPem((U=(b=Ie==null?void 0:Ie.data)==null?void 0:b.data)==null?void 0:U.publicKeyPem).encrypt(z,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),G=forge.util.encode64(Le),Ye={"Content-Type":"application/json","x-app-session-key":(c=(w=Ie.data)==null?void 0:w.data)==null?void 0:c.session_key},ge=JSON.stringify({enc_track2_data:`${G}`,algorithm:"RSAES_OAEP_SHA_1",session_key:`${(P=(l=Ie==null?void 0:Ie.data)==null?void 0:l.data)==null?void 0:P.session_key}`});try{let he=await Jt.post(`${Yt}tokenizer/tokenize`,ge,{headers:Ye}),Ee=JSON.stringify(L(S({},(I=he==null?void 0:he.data)==null?void 0:I.data),{cvv:i==null?void 0:i.cvv,cardName:i==null?void 0:i.cardName,zip:i==null?void 0:i.zipCode,userId:e==null?void 0:e.customerId,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey})),Ge={"Content-Type":"application/json"};try{let Ce=await Jt.post(`${He}add-card`,Ee,{headers:Ge});console.log(Ce),(Me=Ce==null?void 0:Ce.data)!=null&&Me.result&&($(!0),ve(),Kt(r,"close",""))}catch(Ce){ve(),q(((ht=(Je=Ce==null?void 0:Ce.response)==null?void 0:Je.data)==null?void 0:ht.message)||(Ce==null?void 0:Ce.message)||"Something went wrong.")}}catch(he){ve(),q(((ye=(Xe=he==null?void 0:he.response)==null?void 0:Xe.data)==null?void 0:ye.message)||(he==null?void 0:he.message)||"Something went wrong.")}}catch(Ie){ve(),q(((St=(h=Ie==null?void 0:Ie.response)==null?void 0:h.data)==null?void 0:St.message)||(Ie==null?void 0:Ie.message)||"Something went wrong.")}}else typeof DatacapWebToken!="undefined"&&DatacapWebToken.requestToken(we==null?void 0:we.dctoken,"creditCardForm",st)}catch(st){ve(),q(((ct=(gt=st==null?void 0:st.response)==null?void 0:gt.data)==null?void 0:ct.message)||(st==null?void 0:st.message)||"Something went wrong.")}}}},style:{padding:"0 10px"}},J.createElement("div",{style:{maxHeight:"350px",minHeight:"0"},className:"card-scrl"},J.createElement("div",{className:"form-group",style:{marginTop:"0",marginBottom:"10px"}},J.createElement("label",{htmlFor:"cardNumber"},"Card Number"),J.createElement("input",{type:"text","data-token":"card_number",placeholder:"Enter card number",maxLength:19,inputMode:"numeric",value:(i==null?void 0:i.cardNumber)||"",onChange:r=>E(r),ref:R}),(v==null?void 0:v.cardNumber)&&J.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},v==null?void 0:v.cardNumber),J.createElement("br",null)),J.createElement("div",{className:"card-dtl"},J.createElement("div",{className:"exp-cvc-container",style:{margin:"0"}},J.createElement("div",{className:"form-group",style:{marginTop:"0"}},J.createElement("label",{htmlFor:"expMonth"},"MM"),J.createElement("input",{"data-token":"exp_month",className:"form-control required",type:"text",placeholder:"MM",maxLength:2,value:(i==null?void 0:i.expiryMonth)||"",onChange:r=>We("expiryMonth",r.target.value),ref:n}),(v==null?void 0:v.expiryMonth)&&J.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},v==null?void 0:v.expiryMonth)),J.createElement("div",{className:"form-group",style:{marginTop:"0"}},J.createElement("label",{htmlFor:"expYear"},"YYYY"),J.createElement("input",{"data-token":"exp_year",className:"form-control required",type:"text",placeholder:"YYYY",maxLength:4,value:(i==null?void 0:i.expiryYear)||"",onChange:r=>We("expiryYear",r.target.value),ref:K}),(v==null?void 0:v.expiryYear)&&J.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},v==null?void 0:v.expiryYear)),J.createElement("div",{className:"form-group",style:{marginTop:"0"}},J.createElement("label",{htmlFor:"cvc"},"CVC"),J.createElement("input",{"data-token":"cvv",className:"form-control required",type:"text",placeholder:"CVC",maxLength:4,value:(i==null?void 0:i.cvv)||"",onChange:r=>We("cvv",r.target.value),ref:d}),(v==null?void 0:v.cvv)&&J.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},v==null?void 0:v.cvv)))),J.createElement("div",{className:"form-group",style:{marginTop:"0"}},J.createElement("label",{htmlFor:"cardholderName"},"Name on card"),J.createElement("input",{type:"text",id:"cardholderName",name:"cardholderName",placeholder:"Name on card required",value:(i==null?void 0:i.cardName)||"",onChange:r=>{let s=r.target.value;/^[a-zA-Z\s]*$/.test(s)&&We("cardName",s)},ref:f}),(v==null?void 0:v.cardName)&&J.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},v==null?void 0:v.cardName)),J.createElement("div",{className:"form-group",style:{marginTop:"0"}},J.createElement("label",{htmlFor:"zipcode"},"Zip"),J.createElement("input",{type:"text",id:"",name:"zipcode",placeholder:"Zip",value:(X=i==null?void 0:i.zipCode)!=null?X:"",onChange:r=>We("zipCode",r.target.value)}),(v==null?void 0:v.zipCode)&&J.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},v==null?void 0:v.zipCode))),J.createElement("input",{type:"submit",className:"idle-green-btn w-100",defaultValue:"Submit"})))))}import M,{useState as on}from"react";import an from"axios";var mn={PROPAYKEY:"25",PAYARCKEY:"26",STRIPEKEYCC:"27",PAYRIXKEY:"28",SKYFIACHKEY:"29",JUSTIFIKEY:"30",INFINICEPTKEY:"31",FRACTALKEY:"32"};import yi from"react";function yn({}){return yi.createElement("style",null,`
|
|
1820
1820
|
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap");
|
|
1821
1821
|
|
|
1822
1822
|
.creditformbox {
|
|
@@ -1961,4 +1961,598 @@ var zn=Object.defineProperty,In=Object.defineProperties;var qn=Object.getOwnProp
|
|
|
1961
1961
|
color:#ffffff !important;
|
|
1962
1962
|
}
|
|
1963
1963
|
|
|
1964
|
-
`)}function gi({session_token:e,callback:N,isloading:Y,onCancel:j,showChecks:q,merchantName:pe}){var h;let[F,Le]=Dt(!1),[ee,r]=Dt(!1),[d,y]=Dt(),[p,u]=Dt({}),[he,te]=Dt(""),E=()=>Le(!0),fe=()=>Le(!1),le=()=>{var s,S,_,V,k,c,o,M;let i={},m=d,B=parseInt((m==null?void 0:m.expiryMonth)||"",10),P=(m==null?void 0:m.expiryYear)||"";return(s=m==null?void 0:m.firstName)!=null&&s.trim()||(i.firstName="Please enter a first name."),(S=m==null?void 0:m.lastName)!=null&&S.trim()||(i.lastName="Please enter a last name."),(_=m==null?void 0:m.cardNumber)!=null&&_.trim()||(i.cardNumber="Please enter a card number."),(V=m==null?void 0:m.expiryMonth)!=null&&V.trim()?(Number(m==null?void 0:m.expiryMonth)>12||Number(m==null?void 0:m.expiryMonth)<1)&&(i.expiryMonth="Invalid Expiration Month."):i.expiryMonth="Please enter an expiry month.",(k=m==null?void 0:m.expiryYear)!=null&&k.trim()?((c=m==null?void 0:m.expiryYear)==null?void 0:c.trim().length)!==4||Number(m==null?void 0:m.expiryYear)<2025?i.expiryYear="Invalid Expiration Year.":(isNaN(B)||B<1||B>12||P.length!==4)&&(i.expiryMonth="Invalid Expiration Date."):i.expiryYear="Please enter an expiry year.",(o=m==null?void 0:m.cvv)!=null&&o.trim()||(i.cvv="Please enter a CVV."),(M=m==null?void 0:m.zipCode)!=null&&M.trim()||(i.zipCode="Please enter a zip code."),q&&!(m!=null&&m.authHold)&&(i.authHold="You must authorize this before proceeding."),q&&!(m!=null&&m.authorise)&&(i.authorise="Please confirm your authorization to continue."),u(i),Object.keys(i).length>0},Me=i=>{let B=i.target.value.replace(/\D/g,""),P="";/^3[47]/.test(B)?P=B.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(S,_,V,k)=>[_,V,k].filter(Boolean).join(" ")):P=B.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(S,_,V,k,c)=>[_,V,k,c].filter(Boolean).join(" ")),u(s=>A(I({},s),{cardNumber:""})),y(s=>A(I({},s),{cardNumber:P}))},Ce=(i,m)=>{let B=i;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(B)){(m===""||/^[0-9]+$/.test(m))&&(u(s=>A(I({},s),{[B]:""})),y(s=>A(I({},s),{[B]:m})));return}u(s=>A(I({},s),{[B]:""})),y(s=>A(I({},s),{[B]:m}))},we=()=>{let i=DatacapWebToken.validateCardNumber(d==null?void 0:d.cardNumber.replaceAll(" ","")),m=DatacapWebToken.validateExpirationDate(d==null?void 0:d.expiryMonth,d==null?void 0:d.expiryYear),B=DatacapWebToken.validateCVV(d==null?void 0:d.cvv),P={};return i||(P.cardNumber="Invalid card Number"),m||(P.expiryMonth="Invalid Expiration Date."),B||(P.cvv="Invalid CVV"),u(P),i&&B&&m},ot=async i=>{var m,B;if(i.Error)te(i.Error),fe();else{let P={token:i.Token,resp:i},s=await Rt.post(`${yt}api/v1/gateway/update/token/${e}`,P);if((s==null?void 0:s.status)==200){let S=I(I({Token:(B=(m=s==null?void 0:s.data)==null?void 0:m.data)==null?void 0:B.gateway_token,Brand:i.Brand,ExpirationMonth:i.ExpirationMonth,ExpirationYear:i.ExpirationYear,Last4:i.Last4,Bin:i.Bin,CVV:i.CVV,postalCode:d==null?void 0:d.zipCode},q&&{authHold:d==null?void 0:d.authHold}),q&&{authorise:d==null?void 0:d.authorise});fe(),N(S)}}},Ye=async()=>{var i,m,B,P,s,S,_,V,k,c;try{let o={method:"POST",redirect:"follow"},M=await Rt.post(`${yt}api/v1/widget/generate-session`,o),z=Number(d==null?void 0:d.expiryYear)%100,Oe=`${(i=d==null?void 0:d.cardNumber)==null?void 0:i.replace(/\s+/g,"")}=${z}${d==null?void 0:d.expiryMonth} ${d==null?void 0:d.cvv}`,He=forge.pki.publicKeyFromPem((B=(m=M==null?void 0:M.data)==null?void 0:m.data)==null?void 0:B.publicKeyPem).encrypt(Oe,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),at=forge.util.encode64(He),g={"Content-Type":"application/json","x-app-session-key":(s=(P=M.data)==null?void 0:P.data)==null?void 0:s.session_key},St=JSON.stringify({enc_track2_data:at,algorithm:"RSAES_OAEP_SHA_1",session_key:(_=(S=M==null?void 0:M.data)==null?void 0:S.data)==null?void 0:_.session_key}),je=await Rt.post(`${Ft}tokenizer/tokenize`,St,{headers:g});if((je==null?void 0:je.status)==200){let ye=(k=(V=je==null?void 0:je.data)==null?void 0:V.data)==null?void 0:k.token;try{let oe=await Rt.post(`${yt}api/v1/gateway/verify-and-save/${e}`,{token:ye});if((oe==null?void 0:oe.status)==200){let O=(c=oe==null?void 0:oe.data)==null?void 0:c.data,Ve={Token:O.gateway_token,Brand:O.card_data.brand,ExpirationMonth:O.card_data.expire_mm,ExpirationYear:O.card_data.expire_yy,Last4:O.card_data.last4,Bin:O.card_data.bin,postalCode:d==null?void 0:d.zipCode};fe(),N(Ve)}}catch(oe){console.log(oe,"error"),fe()}}}catch(o){console.log(o,"eroror")}},Ee=async i=>{var P,s,S,_,V,k,c;if(i.preventDefault(),!(le()||!we())){E();try{let o=await Rt.get(`${yt}api/v1/gateway/token/${e}`);if((o==null?void 0:o.status)==200){let M=(s=(P=o==null?void 0:o.data)==null?void 0:P.data)==null?void 0:s.gateway_token;((_=(S=o==null?void 0:o.data)==null?void 0:S.data)==null?void 0:_.paymentGateway)==((V=Nn)==null?void 0:V.FRACTALKEY)?await Ye():DatacapWebToken.requestToken(M,"creditCardForm",ot)}}catch(o){fe(),te(((c=(k=o==null?void 0:o.response)==null?void 0:k.data)==null?void 0:c.message)||"Something went wrong!")}}},f=()=>{te("")},Fe=()=>{te(""),y({firstName:"",lastName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",zipCode:"",authHold:!1,authorise:!1}),j()};return C.createElement(C.Fragment,null,C.createElement(Pt,null),C.createElement(un,null),C.createElement(dt,{loading:F||Y}),he&&C.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},C.createElement(At,{error:he,onClose:f})),!he&&C.createElement("div",{className:"creditformbox"},C.createElement("form",{id:"creditCardForm",onSubmit:Ee},C.createElement("div",{className:"name-row"},C.createElement("div",{className:"form-group"},C.createElement("label",null," First Name ",C.createElement("span",{className:"text-danger"},"*")),C.createElement("input",{type:"text",name:"first_name",placeholder:"First Name",value:(d==null?void 0:d.firstName)||"",onChange:i=>Ce("firstName",i.target.value)}),(p==null?void 0:p.firstName)&&C.createElement("small",{className:"error"},p==null?void 0:p.firstName)),C.createElement("div",{className:"form-group"},C.createElement("label",null," Last Name ",C.createElement("span",{className:"text-danger"},"*")),C.createElement("input",{type:"text",name:"last_name",placeholder:"Last Name",value:(d==null?void 0:d.lastName)||"",onChange:i=>Ce("lastName",i.target.value)}),(p==null?void 0:p.lastName)&&C.createElement("small",{className:"error"},p==null?void 0:p.lastName))),C.createElement("div",{className:"form-pay-row"},C.createElement("div",{className:"form-group"},C.createElement("label",null," Card Number ",C.createElement("span",{className:"text-danger"},"*")),C.createElement("input",{type:"text","data-token":"card_number",placeholder:"Card Number",maxLength:19,inputMode:"numeric",value:(d==null?void 0:d.cardNumber)||"",onChange:i=>Me(i)}),(p==null?void 0:p.cardNumber)&&C.createElement("small",{className:"error"},p==null?void 0:p.cardNumber))),C.createElement("div",{className:"card-pay-row"},C.createElement("div",{className:"form-group"},C.createElement("label",null," Exp Month ",C.createElement("span",{className:"text-danger"},"*")),C.createElement("input",{type:"text","data-token":"exp_month",placeholder:"MM",maxLength:2,value:(d==null?void 0:d.expiryMonth)||"",onChange:i=>Ce("expiryMonth",i.target.value)}),(p==null?void 0:p.expiryMonth)&&C.createElement("small",{className:"error"},p==null?void 0:p.expiryMonth)),C.createElement("div",{className:"form-group"},C.createElement("label",null," Exp Year ",C.createElement("span",{className:"text-danger"},"*")),C.createElement("input",{type:"text","data-token":"exp_year",placeholder:"YYYY",maxLength:4,value:(d==null?void 0:d.expiryYear)||"",onChange:i=>Ce("expiryYear",i.target.value)}),(p==null?void 0:p.expiryYear)&&C.createElement("small",{className:"error"},p==null?void 0:p.expiryYear)),C.createElement("div",{className:"form-group"},C.createElement("label",null," CVV ",C.createElement("span",{className:"text-danger"},"*")),C.createElement("input",{type:"text","data-token":"cvv",placeholder:"CVV",maxLength:4,value:(d==null?void 0:d.cvv)||"",onChange:i=>Ce("cvv",i.target.value)}),(p==null?void 0:p.cvv)&&C.createElement("small",{className:"error"},p==null?void 0:p.cvv)),C.createElement("div",{className:"form-group"},C.createElement("label",null," Zip ",C.createElement("span",{className:"text-danger"},"*")),C.createElement("input",{type:"text",name:"zipcode",placeholder:"Zip Code",value:(h=d==null?void 0:d.zipCode)!=null?h:"",onChange:i=>Ce("zipCode",i.target.value)}),(p==null?void 0:p.zipCode)&&C.createElement("small",{className:"error"},p==null?void 0:p.zipCode))),q&&C.createElement(C.Fragment,null,C.createElement("div",{className:"checks-row"},C.createElement("input",{name:"authHold",type:"checkbox",id:"authHold",checked:!!(d!=null&&d.authHold),onChange:i=>Ce("authHold",i.target.checked)}),C.createElement("label",{htmlFor:"authHold",className:"form-check-label"},"To securely save your card on file, we will place a temporary authorization hold of $1.00. This is not a charge and will be released by your card issuer shortly after verification.")),(p==null?void 0:p.authHold)&&C.createElement("small",{className:"check-error"},p==null?void 0:p.authHold),C.createElement("div",{className:"checks-row "},C.createElement("input",{name:"authorise",type:"checkbox",id:"authorise",checked:!!(d!=null&&d.authorise),onChange:i=>Ce("authorise",i.target.checked)}),C.createElement("label",{htmlFor:"authorise",className:"form-check-label see-more"},ee?C.createElement(C.Fragment,null,C.createElement("span",null,"By providing your payment information, you authorize"," ",C.createElement("strong",null,pe),", a Sky Systemz merchant, to securely store your card on file for future payments. Your card information will be encrypted and stored in compliance with PCI-DSS (Payment Card Industry Data Security Standard) regulations using Sky Systemz\u2019s secure payment technology. This information will be used solely for transactions you authorize with"," ",C.createElement("strong",null,pe),". You may request the removal of your stored payment information at any time by contacting"," ",C.createElement("strong",null,pe)," directly. By signing or proceeding with this transaction, you acknowledge and agree to this card on file authorization.",C.createElement("a",{href:"#",onClick:i=>{i.preventDefault(),r(!1)}},"See less ..."))):C.createElement(C.Fragment,null,C.createElement("span",null,"By providing your payment information, you authorize ",pe,", a Sky Systemz merchant, to securely store your card on file for future pay..."," "),C.createElement("a",{href:"#",onClick:i=>{i.preventDefault(),r(!0)}},"See more ...")))),(p==null?void 0:p.authorise)&&C.createElement("small",{className:"check-error"},p==null?void 0:p.authorise)),C.createElement("div",{className:"button-row"},C.createElement("button",{className:"cancelbtn",type:"button",onClick:Fe},"Cancel"),C.createElement("button",{className:"savebtn",type:"submit"},"Save")))))}export{ci as AddCard,gi as AddCardSky,ii as GetPaymentPage,ai as PreAuthPayment,On as RequestPayment,Jn as RequestPreAuthPayment};
|
|
1964
|
+
`)}function xi({session_token:e,callback:F,isloading:T,onCancel:V,showChecks:$,merchantName:je}){var E;let[q,De]=on(!1),[de,R]=on(!1),[n,K]=on(),[d,f]=on({}),[i,pe]=on(""),v=()=>De(!0),fe=()=>De(!1),we=()=>{var r,s,b,U,w,c,l,P;let _={},x=n,ie=parseInt((x==null?void 0:x.expiryMonth)||"",10),X=(x==null?void 0:x.expiryYear)||"";return(r=x==null?void 0:x.firstName)!=null&&r.trim()||(_.firstName="Please enter a first name."),(s=x==null?void 0:x.lastName)!=null&&s.trim()||(_.lastName="Please enter a last name."),(b=x==null?void 0:x.cardNumber)!=null&&b.trim()||(_.cardNumber="Please enter a card number."),(U=x==null?void 0:x.expiryMonth)!=null&&U.trim()?(Number(x==null?void 0:x.expiryMonth)>12||Number(x==null?void 0:x.expiryMonth)<1)&&(_.expiryMonth="Invalid Expiration Month."):_.expiryMonth="Please enter an expiry month.",(w=x==null?void 0:x.expiryYear)!=null&&w.trim()?((c=x==null?void 0:x.expiryYear)==null?void 0:c.trim().length)!==4||Number(x==null?void 0:x.expiryYear)<2025?_.expiryYear="Invalid Expiration Year.":(isNaN(ie)||ie<1||ie>12||X.length!==4)&&(_.expiryMonth="Invalid Expiration Date."):_.expiryYear="Please enter an expiry year.",(l=x==null?void 0:x.cvv)!=null&&l.trim()||(_.cvv="Please enter a CVV."),(P=x==null?void 0:x.zipCode)!=null&&P.trim()||(_.zipCode="Please enter a zip code."),$&&!(x!=null&&x.authHold)&&(_.authHold="You must authorize this before proceeding."),$&&!(x!=null&&x.authorise)&&(_.authorise="Please confirm your authorization to continue."),f(_),Object.keys(_).length>0},Oe=_=>{let ie=_.target.value.replace(/\D/g,""),X="";/^3[47]/.test(ie)?X=ie.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(s,b,U,w)=>[b,U,w].filter(Boolean).join(" ")):X=ie.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(s,b,U,w,c)=>[b,U,w,c].filter(Boolean).join(" ")),f(r=>L(S({},r),{cardNumber:""})),K(r=>L(S({},r),{cardNumber:X}))},Ve=(_,x)=>{let ie=_;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(ie)){(x===""||/^[0-9]+$/.test(x))&&(f(r=>L(S({},r),{[ie]:""})),K(r=>L(S({},r),{[ie]:x})));return}f(r=>L(S({},r),{[ie]:""})),K(r=>L(S({},r),{[ie]:x}))},ve=()=>{let _=DatacapWebToken.validateCardNumber(n==null?void 0:n.cardNumber.replaceAll(" ","")),x=DatacapWebToken.validateExpirationDate(n==null?void 0:n.expiryMonth,n==null?void 0:n.expiryYear),ie=DatacapWebToken.validateCVV(n==null?void 0:n.cvv),X={};return _||(X.cardNumber="Invalid card Number"),x||(X.expiryMonth="Invalid Expiration Date."),ie||(X.cvv="Invalid CVV"),f(X),_&&ie&&x},nt=async _=>{var x,ie;if(_.Error)pe(_.Error),fe();else{let X={token:_.Token,resp:_},r=await an.post(`${Be}api/v1/gateway/update/token/${e}`,X);if((r==null?void 0:r.status)==200){let s=S(S({Token:(ie=(x=r==null?void 0:r.data)==null?void 0:x.data)==null?void 0:ie.gateway_token,Brand:_.Brand,ExpirationMonth:_.ExpirationMonth,ExpirationYear:_.ExpirationYear,Last4:_.Last4,Bin:_.Bin,CVV:_.CVV,postalCode:n==null?void 0:n.zipCode},$&&{authHold:n==null?void 0:n.authHold}),$&&{authorise:n==null?void 0:n.authorise});fe(),F(s)}}},Ke=async()=>{var _,x,ie,X,r,s,b,U,w,c;try{let l={method:"POST",redirect:"follow"},P=await an.post(`${Be}api/v1/widget/generate-session`,l),I=Number(n==null?void 0:n.expiryYear)%100,Je=`${(_=n==null?void 0:n.cardNumber)==null?void 0:_.replace(/\s+/g,"")}=${I}${n==null?void 0:n.expiryMonth} ${n==null?void 0:n.cvv}`,Xe=forge.pki.publicKeyFromPem((ie=(x=P==null?void 0:P.data)==null?void 0:x.data)==null?void 0:ie.publicKeyPem).encrypt(Je,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),ye=forge.util.encode64(Xe),h={"Content-Type":"application/json","x-app-session-key":(r=(X=P.data)==null?void 0:X.data)==null?void 0:r.session_key},St=JSON.stringify({enc_track2_data:ye,algorithm:"RSAES_OAEP_SHA_1",session_key:(b=(s=P==null?void 0:P.data)==null?void 0:s.data)==null?void 0:b.session_key}),gt=await an.post(`${Yt}tokenizer/tokenize`,St,{headers:h});if((gt==null?void 0:gt.status)==200){let ct=(w=(U=gt==null?void 0:gt.data)==null?void 0:U.data)==null?void 0:w.token;try{let Re=await an.post(`${Be}api/v1/gateway/verify-and-save/${e}`,{token:ct});if((Re==null?void 0:Re.status)==200){let rt=(c=Re==null?void 0:Re.data)==null?void 0:c.data,ut={Token:rt.gateway_token,Brand:rt.card_data.brand,ExpirationMonth:rt.card_data.expire_mm,ExpirationYear:rt.card_data.expire_yy,Last4:rt.card_data.last4,Bin:rt.card_data.bin,postalCode:n==null?void 0:n.zipCode};fe(),F(ut)}}catch(Re){console.log(Re,"error"),fe()}}}catch(l){console.log(l,"eroror")}},at=async _=>{var X,r,s,b,U,w,c;if(_.preventDefault(),!(we()||!ve())){v();try{let l=await an.get(`${Be}api/v1/gateway/token/${e}`);if((l==null?void 0:l.status)==200){let P=(r=(X=l==null?void 0:l.data)==null?void 0:X.data)==null?void 0:r.gateway_token;((b=(s=l==null?void 0:l.data)==null?void 0:s.data)==null?void 0:b.paymentGateway)==((U=mn)==null?void 0:U.FRACTALKEY)?await Ke():DatacapWebToken.requestToken(P,"creditCardForm",nt)}}catch(l){fe(),pe(((c=(w=l==null?void 0:l.response)==null?void 0:w.data)==null?void 0:c.message)||"Something went wrong!")}}},y=()=>{pe("")},We=()=>{pe(""),K({firstName:"",lastName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",zipCode:"",authHold:!1,authorise:!1}),V()};return M.createElement(M.Fragment,null,M.createElement(It,null),M.createElement(yn,null),M.createElement(xt,{loading:q||T}),i&&M.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},M.createElement(Tt,{error:i,onClose:y})),!i&&M.createElement("div",{className:"creditformbox"},M.createElement("form",{id:"creditCardForm",onSubmit:at},M.createElement("div",{className:"name-row"},M.createElement("div",{className:"form-group"},M.createElement("label",null," First Name ",M.createElement("span",{className:"text-danger"},"*")),M.createElement("input",{type:"text",name:"first_name",placeholder:"First Name",value:(n==null?void 0:n.firstName)||"",onChange:_=>{let x=_.target.value;/^[a-zA-Z\s]*$/.test(x)&&Ve("firstName",x)}}),(d==null?void 0:d.firstName)&&M.createElement("small",{className:"error"},d==null?void 0:d.firstName)),M.createElement("div",{className:"form-group"},M.createElement("label",null," Last Name ",M.createElement("span",{className:"text-danger"},"*")),M.createElement("input",{type:"text",name:"last_name",placeholder:"Last Name",value:(n==null?void 0:n.lastName)||"",onChange:_=>{let x=_.target.value;/^[a-zA-Z\s]*$/.test(x)&&Ve("lastName",x)}}),(d==null?void 0:d.lastName)&&M.createElement("small",{className:"error"},d==null?void 0:d.lastName))),M.createElement("div",{className:"form-pay-row"},M.createElement("div",{className:"form-group"},M.createElement("label",null," Card Number ",M.createElement("span",{className:"text-danger"},"*")),M.createElement("input",{type:"text","data-token":"card_number",placeholder:"Card Number",maxLength:19,inputMode:"numeric",value:(n==null?void 0:n.cardNumber)||"",onChange:_=>Oe(_)}),(d==null?void 0:d.cardNumber)&&M.createElement("small",{className:"error"},d==null?void 0:d.cardNumber))),M.createElement("div",{className:"card-pay-row"},M.createElement("div",{className:"form-group"},M.createElement("label",null," Exp Month ",M.createElement("span",{className:"text-danger"},"*")),M.createElement("input",{type:"text","data-token":"exp_month",placeholder:"MM",maxLength:2,value:(n==null?void 0:n.expiryMonth)||"",onChange:_=>Ve("expiryMonth",_.target.value)}),(d==null?void 0:d.expiryMonth)&&M.createElement("small",{className:"error"},d==null?void 0:d.expiryMonth)),M.createElement("div",{className:"form-group"},M.createElement("label",null," Exp Year ",M.createElement("span",{className:"text-danger"},"*")),M.createElement("input",{type:"text","data-token":"exp_year",placeholder:"YYYY",maxLength:4,value:(n==null?void 0:n.expiryYear)||"",onChange:_=>Ve("expiryYear",_.target.value)}),(d==null?void 0:d.expiryYear)&&M.createElement("small",{className:"error"},d==null?void 0:d.expiryYear)),M.createElement("div",{className:"form-group"},M.createElement("label",null," CVV ",M.createElement("span",{className:"text-danger"},"*")),M.createElement("input",{type:"text","data-token":"cvv",placeholder:"CVV",maxLength:4,value:(n==null?void 0:n.cvv)||"",onChange:_=>Ve("cvv",_.target.value)}),(d==null?void 0:d.cvv)&&M.createElement("small",{className:"error"},d==null?void 0:d.cvv)),M.createElement("div",{className:"form-group"},M.createElement("label",null," Zip ",M.createElement("span",{className:"text-danger"},"*")),M.createElement("input",{type:"text",name:"zipcode",placeholder:"Zip Code",value:(E=n==null?void 0:n.zipCode)!=null?E:"",onChange:_=>Ve("zipCode",_.target.value)}),(d==null?void 0:d.zipCode)&&M.createElement("small",{className:"error"},d==null?void 0:d.zipCode))),$&&M.createElement(M.Fragment,null,M.createElement("div",{className:"checks-row"},M.createElement("input",{name:"authHold",type:"checkbox",id:"authHold",checked:!!(n!=null&&n.authHold),onChange:_=>Ve("authHold",_.target.checked)}),M.createElement("label",{htmlFor:"authHold",className:"form-check-label"},"To securely save your card on file, we will place a temporary authorization hold of $1.00. This is not a charge and will be released by your card issuer shortly after verification.")),(d==null?void 0:d.authHold)&&M.createElement("small",{className:"check-error"},d==null?void 0:d.authHold),M.createElement("div",{className:"checks-row "},M.createElement("input",{name:"authorise",type:"checkbox",id:"authorise",checked:!!(n!=null&&n.authorise),onChange:_=>Ve("authorise",_.target.checked)}),M.createElement("label",{htmlFor:"authorise",className:"form-check-label see-more"},de?M.createElement(M.Fragment,null,M.createElement("span",null,"By providing your payment information, you authorize"," ",M.createElement("strong",null,je),", a Sky Systemz merchant, to securely store your card on file for future payments. Your card information will be encrypted and stored in compliance with PCI-DSS (Payment Card Industry Data Security Standard) regulations using Sky Systemz\u2019s secure payment technology. This information will be used solely for transactions you authorize with"," ",M.createElement("strong",null,je),". You may request the removal of your stored payment information at any time by contacting"," ",M.createElement("strong",null,je)," directly. By signing or proceeding with this transaction, you acknowledge and agree to this card on file authorization.",M.createElement("a",{href:"#",onClick:_=>{_.preventDefault(),R(!1)}},"See less ..."))):M.createElement(M.Fragment,null,M.createElement("span",null,"By providing your payment information, you authorize ",je,", a Sky Systemz merchant, to securely store your card on file for future pay..."," "),M.createElement("a",{href:"#",onClick:_=>{_.preventDefault(),R(!0)}},"See more ...")))),(d==null?void 0:d.authorise)&&M.createElement("small",{className:"check-error"},d==null?void 0:d.authorise)),M.createElement("div",{className:"button-row"},M.createElement("button",{className:"cancelbtn",type:"button",onClick:We},"Cancel"),M.createElement("button",{className:"savebtn",type:"submit"},"Save")))))}import a,{useState as Nt}from"react";import bi from"react";function xn(){let e="#000",F="#fff",T="#212529",V="#dee2e6";return bi.createElement("style",null,`
|
|
1965
|
+
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
|
|
1966
|
+
body
|
|
1967
|
+
{
|
|
1968
|
+
font-family: 'Inter', sans-serif !important;
|
|
1969
|
+
}
|
|
1970
|
+
input
|
|
1971
|
+
{
|
|
1972
|
+
font-family: 'Inter', sans-serif !important;
|
|
1973
|
+
}
|
|
1974
|
+
.frac-form .form-group-frac{
|
|
1975
|
+
margin:0 !important
|
|
1976
|
+
}
|
|
1977
|
+
.frac-form .mb-4{
|
|
1978
|
+
margin-bottom : 10px !important
|
|
1979
|
+
}
|
|
1980
|
+
.frac-form .save-ach-div{
|
|
1981
|
+
display:flex !important;
|
|
1982
|
+
gap:5px !important;
|
|
1983
|
+
align-items:center
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
.frac-form .card-cvv-in{
|
|
1987
|
+
height : 36px !importantt;
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
.frac-form .pay-payment-amount{
|
|
1991
|
+
text-align:start !important
|
|
1992
|
+
}
|
|
1993
|
+
.frac-form .pay-amount{
|
|
1994
|
+
text-align:start !important
|
|
1995
|
+
}
|
|
1996
|
+
.frac-form .pay-main-logo{
|
|
1997
|
+
text-align:start !important
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
|
|
2001
|
+
|
|
2002
|
+
.paymentBtn {
|
|
2003
|
+
background-color: black;
|
|
2004
|
+
border: none;
|
|
2005
|
+
color: white;
|
|
2006
|
+
padding: 15px 32px;
|
|
2007
|
+
text-align: center;
|
|
2008
|
+
text-decoration: none;
|
|
2009
|
+
display: inline-block;
|
|
2010
|
+
font-size: 16px;
|
|
2011
|
+
margin: 4px 2px;
|
|
2012
|
+
cursor: pointer;
|
|
2013
|
+
border-radius: 180px;
|
|
2014
|
+
/* width: auto; */
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
.main-logo {
|
|
2018
|
+
text-align: center;
|
|
2019
|
+
margin-bottom: 20px;
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
.main-logo img {
|
|
2023
|
+
max-width: 180px;
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
.pay-main-box {
|
|
2027
|
+
width: 365px !important;
|
|
2028
|
+
height: 93%;
|
|
2029
|
+
background: 0 0 #ffffff;
|
|
2030
|
+
border-radius: 12px;
|
|
2031
|
+
|
|
2032
|
+
|
|
2033
|
+
border: 1px solid #E0DFE2;
|
|
2034
|
+
margin: 0 auto;
|
|
2035
|
+
display: block;
|
|
2036
|
+
padding: 0px 26px !important
|
|
2037
|
+
}
|
|
2038
|
+
.pay-main-box .pay-header {
|
|
2039
|
+
display: flex;
|
|
2040
|
+
justify-content: center;
|
|
2041
|
+
align-items: center;
|
|
2042
|
+
text-align: center;
|
|
2043
|
+
}
|
|
2044
|
+
|
|
2045
|
+
.pay-main-box .pay-header button {
|
|
2046
|
+
border: 0;
|
|
2047
|
+
background: none;
|
|
2048
|
+
padding: 0;
|
|
2049
|
+
box-shadow: 0;
|
|
2050
|
+
outline: inherit;
|
|
2051
|
+
}
|
|
2052
|
+
|
|
2053
|
+
.pay-main-box h1 {
|
|
2054
|
+
margin: 0;
|
|
2055
|
+
flex: 1;
|
|
2056
|
+
padding: 10px 0;
|
|
2057
|
+
font-size: 23px;
|
|
2058
|
+
font-weight: 500;
|
|
2059
|
+
color: #35254D;
|
|
2060
|
+
align-items: start;
|
|
2061
|
+
display: flex;
|
|
2062
|
+
}
|
|
2063
|
+
.tab {
|
|
2064
|
+
overflow: hidden;
|
|
2065
|
+
padding: 5px;
|
|
2066
|
+
border-radius: 8px;
|
|
2067
|
+
display: flex;
|
|
2068
|
+
justify-content: space-around;
|
|
2069
|
+
margin-bottom:12px
|
|
2070
|
+
}
|
|
2071
|
+
|
|
2072
|
+
/* Style the buttons inside the tab */
|
|
2073
|
+
.tab button {
|
|
2074
|
+
float: left;
|
|
2075
|
+
border: none;
|
|
2076
|
+
outline: none;
|
|
2077
|
+
cursor: pointer;
|
|
2078
|
+
background:white;
|
|
2079
|
+
padding: 11px 16px;
|
|
2080
|
+
transition: 0.3s;
|
|
2081
|
+
font-size: 16px;
|
|
2082
|
+
width: 143px;
|
|
2083
|
+
border-radius: 5px;
|
|
2084
|
+
box-shadow: inherit;
|
|
2085
|
+
outline: none;
|
|
2086
|
+
color: ${e};
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2089
|
+
/* Change background color of buttons on hover */
|
|
2090
|
+
.tab button:hover {
|
|
2091
|
+
background-color: #f0f0f0;
|
|
2092
|
+
}
|
|
2093
|
+
|
|
2094
|
+
/* Create an active/current tablink class */
|
|
2095
|
+
// .tab button.active {
|
|
2096
|
+
// background-color: #ccc;
|
|
2097
|
+
// }
|
|
2098
|
+
|
|
2099
|
+
/* Style the tab content */
|
|
2100
|
+
|
|
2101
|
+
|
|
2102
|
+
.parent-pay-container{
|
|
2103
|
+
padding: 20px 10% ;
|
|
2104
|
+
}
|
|
2105
|
+
.pay-container{
|
|
2106
|
+
display: grid;
|
|
2107
|
+
grid-template-columns: 2fr 3fr;
|
|
2108
|
+
|
|
2109
|
+
}
|
|
2110
|
+
.pay-main{
|
|
2111
|
+
padding-y: 20px}
|
|
2112
|
+
|
|
2113
|
+
.request-payment-close-popup {
|
|
2114
|
+
position: absolute;
|
|
2115
|
+
right: 20px;
|
|
2116
|
+
top: 20px;
|
|
2117
|
+
cursor: pointer;
|
|
2118
|
+
}
|
|
2119
|
+
.pay-conatiner-one{
|
|
2120
|
+
border-right: 1px solid #E0DFE2;
|
|
2121
|
+
}
|
|
2122
|
+
.pay-conatiner-one-first{
|
|
2123
|
+
min-height:530px
|
|
2124
|
+
}
|
|
2125
|
+
.pay-conatiner-one-last{
|
|
2126
|
+
display:flex;
|
|
2127
|
+
font-size:12px;
|
|
2128
|
+
gap:5px;
|
|
2129
|
+
max-width:250px;
|
|
2130
|
+
align-items:center;
|
|
2131
|
+
color:black !important
|
|
2132
|
+
}
|
|
2133
|
+
.pay-conatiner-one-last img{
|
|
2134
|
+
width : 17px;
|
|
2135
|
+
height:17px
|
|
2136
|
+
}
|
|
2137
|
+
.pay-conatiner-two{
|
|
2138
|
+
padding: 0 5% 0;
|
|
2139
|
+
}
|
|
2140
|
+
.pay-logo-container{
|
|
2141
|
+
border-bottom: 1px solid #E0DFE2
|
|
2142
|
+
}
|
|
2143
|
+
.pay-heading{
|
|
2144
|
+
margin: 0;
|
|
2145
|
+
flex: 1;
|
|
2146
|
+
padding: 10px 0;
|
|
2147
|
+
font-size: 23px;
|
|
2148
|
+
font-weight: 500;
|
|
2149
|
+
color: #35254D;
|
|
2150
|
+
align-items: start;
|
|
2151
|
+
display: flex;
|
|
2152
|
+
}
|
|
2153
|
+
.pay-main-logo > img{
|
|
2154
|
+
width: 50%;
|
|
2155
|
+
}
|
|
2156
|
+
.pay-main-logo-res > img{
|
|
2157
|
+
width: 50%;
|
|
2158
|
+
display : none
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
.pay-payment-amount{
|
|
2162
|
+
display: block;
|
|
2163
|
+
font-size: 12px;
|
|
2164
|
+
color: #727272;
|
|
2165
|
+
margin-bottom: 8px;
|
|
2166
|
+
}
|
|
2167
|
+
.pay-amount-conatiner{
|
|
2168
|
+
margin-top: 6%;
|
|
2169
|
+
}
|
|
2170
|
+
.pay-amount{
|
|
2171
|
+
color: #000000;
|
|
2172
|
+
font-size: 38px;
|
|
2173
|
+
display: block;
|
|
2174
|
+
line-height: 110%;
|
|
2175
|
+
letter-spacing: -1px;
|
|
2176
|
+
}
|
|
2177
|
+
.frac-form label{
|
|
2178
|
+
font-family: 'IBM Plex Mono', monospace !important;
|
|
2179
|
+
color: #727272 !important;
|
|
2180
|
+
margin-bottom: 2px !important;
|
|
2181
|
+
font-weight: 600 !important;
|
|
2182
|
+
font-size: 12px !important;
|
|
2183
|
+
display:block !important;
|
|
2184
|
+
text-align : left !important
|
|
2185
|
+
}
|
|
2186
|
+
.form-control{
|
|
2187
|
+
display: block;
|
|
2188
|
+
width: 100%;
|
|
2189
|
+
padding: .375rem .75rem;
|
|
2190
|
+
font-size: 1rem;
|
|
2191
|
+
font-weight: 400;
|
|
2192
|
+
line-height: 1.5;
|
|
2193
|
+
color: ${T};
|
|
2194
|
+
-webkit-appearance: none;
|
|
2195
|
+
-moz-appearance: none;
|
|
2196
|
+
appearance: none;
|
|
2197
|
+
background-color: ${F};
|
|
2198
|
+
background-clip: padding-box;
|
|
2199
|
+
border: 1px solid ${V};
|
|
2200
|
+
border-radius: 0.375rem;
|
|
2201
|
+
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
|
|
2202
|
+
}
|
|
2203
|
+
.form-control:focus{
|
|
2204
|
+
border-color: #86b7fe;
|
|
2205
|
+
outline: 0;
|
|
2206
|
+
}
|
|
2207
|
+
.toggle-num-wrapper {
|
|
2208
|
+
position: relative;
|
|
2209
|
+
}
|
|
2210
|
+
.card-number-new{
|
|
2211
|
+
border-bottom: none;
|
|
2212
|
+
border-bottom-left-radius: 0px;
|
|
2213
|
+
border-bottom-right-radius: 0px;
|
|
2214
|
+
}
|
|
2215
|
+
.card-crdi {
|
|
2216
|
+
display: flex;
|
|
2217
|
+
border: 1px solid ${V};
|
|
2218
|
+
border-radius: 0.375rem;
|
|
2219
|
+
}
|
|
2220
|
+
.card-expiry-new{
|
|
2221
|
+
border-top-left-radius: 0px;
|
|
2222
|
+
border-top-right-radius: 0px;
|
|
2223
|
+
}
|
|
2224
|
+
.exp-date-year-container{
|
|
2225
|
+
display: flex;
|
|
2226
|
+
flex-wrap: wrap;
|
|
2227
|
+
}
|
|
2228
|
+
.exp-date-year-container .form-group-frac{
|
|
2229
|
+
flex:1;
|
|
2230
|
+
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
.exp-date {
|
|
2234
|
+
float: left;
|
|
2235
|
+
// width: 30%
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2238
|
+
.exp-date input {
|
|
2239
|
+
width: calc(100% + 1px);
|
|
2240
|
+
border-top-right-radius: 0;
|
|
2241
|
+
border-bottom-right-radius: 0;
|
|
2242
|
+
border: 0;
|
|
2243
|
+
border-right: 1px solid ${V};
|
|
2244
|
+
}
|
|
2245
|
+
|
|
2246
|
+
|
|
2247
|
+
.exp-year {
|
|
2248
|
+
float: left;
|
|
2249
|
+
// width: 30%
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2252
|
+
.exp-year input {
|
|
2253
|
+
width: calc(100% + 1px);
|
|
2254
|
+
border-radius: 0;
|
|
2255
|
+
border-top: 0;
|
|
2256
|
+
border-bottom: 0;
|
|
2257
|
+
border-right: 1px solid ${V};
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
.exp-date input:focus {
|
|
2261
|
+
position: relative;
|
|
2262
|
+
z-index: 10;
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
.security-digit {
|
|
2266
|
+
float: right;
|
|
2267
|
+
// width: 40%;
|
|
2268
|
+
position: relative;
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2271
|
+
.security-digit input {
|
|
2272
|
+
border-top-left-radius: 0;
|
|
2273
|
+
border-bottom-left-radius: 0;
|
|
2274
|
+
border-top: 0;
|
|
2275
|
+
border-bottom: 0;
|
|
2276
|
+
border-right:0;
|
|
2277
|
+
}
|
|
2278
|
+
.card-expiry-new{
|
|
2279
|
+
border-top-left-radius: 0px;
|
|
2280
|
+
border-top-right-radius: 0px;
|
|
2281
|
+
}
|
|
2282
|
+
.form-control{box-sizing: border-box ;}
|
|
2283
|
+
#PaymentForm .form-group-frac{
|
|
2284
|
+
padding:5px 0 ;
|
|
2285
|
+
matgin: 0 !important
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
.toggle-label {
|
|
2289
|
+
position: relative;
|
|
2290
|
+
display: inline-block;
|
|
2291
|
+
width: 40px;
|
|
2292
|
+
height: 24px;
|
|
2293
|
+
background-color: #ccc;
|
|
2294
|
+
border-radius: 12px;
|
|
2295
|
+
cursor: pointer;
|
|
2296
|
+
transition: background-color 0.3s;
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
.toggle-label::before {
|
|
2300
|
+
content: "";
|
|
2301
|
+
position: absolute;
|
|
2302
|
+
top: 2px;
|
|
2303
|
+
left: 2px;
|
|
2304
|
+
width: 20px;
|
|
2305
|
+
height: 20px;
|
|
2306
|
+
background: #ffffff;
|
|
2307
|
+
border-radius: 50%;
|
|
2308
|
+
transition: left 300ms linear;
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
.toggle-checkbox {
|
|
2312
|
+
display: none;
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2315
|
+
.toggle-checkbox:checked + .toggle-label {
|
|
2316
|
+
background-color: #4caf50;
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
.toggle-checkbox:checked + .toggle-label::before {
|
|
2320
|
+
left: 18px;
|
|
2321
|
+
}
|
|
2322
|
+
.ach-scrl {
|
|
2323
|
+
max-height: 380px;
|
|
2324
|
+
min-height: 380px;
|
|
2325
|
+
overflow-y: auto;
|
|
2326
|
+
padding-right: 6px;
|
|
2327
|
+
}
|
|
2328
|
+
.mb-4{
|
|
2329
|
+
margin-bottom:4px
|
|
2330
|
+
}
|
|
2331
|
+
.ach-scrl::-webkit-scrollbar {
|
|
2332
|
+
width: 3px;
|
|
2333
|
+
background-color: #F5F5F5;
|
|
2334
|
+
}
|
|
2335
|
+
.ach-scrl::-webkit-scrollbar-thumb {
|
|
2336
|
+
background-color: #35254D;
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2339
|
+
.error-span{
|
|
2340
|
+
color:red !important;
|
|
2341
|
+
font-size:12px !important;
|
|
2342
|
+
text-align: left !important;
|
|
2343
|
+
width: 100% !important;
|
|
2344
|
+
display: block;
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2347
|
+
.charge-customer-name{
|
|
2348
|
+
color: #161616;
|
|
2349
|
+
font-family: Inter;
|
|
2350
|
+
font-size: 24px;
|
|
2351
|
+
font-style: normal;
|
|
2352
|
+
font-weight: 600;
|
|
2353
|
+
line-height: 32px;
|
|
2354
|
+
letter-spacing: -0.48px;
|
|
2355
|
+
text-transform: capitalize;
|
|
2356
|
+
margin-top:0;
|
|
2357
|
+
margin-bottom:16px !important;
|
|
2358
|
+
text-align:left !important
|
|
2359
|
+
}
|
|
2360
|
+
.card-ach-heading {
|
|
2361
|
+
color: #727272;
|
|
2362
|
+
font-family: Inter;
|
|
2363
|
+
font-size: 12px;
|
|
2364
|
+
font-style: normal;
|
|
2365
|
+
font-weight: 500;
|
|
2366
|
+
line-height: 18px;
|
|
2367
|
+
letter-spacing: -0.24px;
|
|
2368
|
+
margin : 0 0 10px !important;
|
|
2369
|
+
text-align : left
|
|
2370
|
+
}
|
|
2371
|
+
.card-list-div{
|
|
2372
|
+
max-height : 190px;
|
|
2373
|
+
overflow-y : auto;
|
|
2374
|
+
border:1px solid #E0DFE2;
|
|
2375
|
+
border-radius : 8px
|
|
2376
|
+
}
|
|
2377
|
+
|
|
2378
|
+
|
|
2379
|
+
.card-list-div::-webkit-scrollbar{
|
|
2380
|
+
width:2px;
|
|
2381
|
+
background-color:#F5F5F5
|
|
2382
|
+
}
|
|
2383
|
+
.card-list-div::-webkit-scrollbar-thumb{
|
|
2384
|
+
background-color:#35254D
|
|
2385
|
+
}
|
|
2386
|
+
|
|
2387
|
+
.card-list-single-div{
|
|
2388
|
+
border-bottom: 1px solid #E0DFE2;
|
|
2389
|
+
padding : 8px 11px;
|
|
2390
|
+
display : flex ;
|
|
2391
|
+
align-items:center;
|
|
2392
|
+
justify-content : space-between;
|
|
2393
|
+
gap:12px
|
|
2394
|
+
}
|
|
2395
|
+
.card-list-single-div:last-child {
|
|
2396
|
+
border-bottom: none;
|
|
2397
|
+
}
|
|
2398
|
+
.card-lint-div-in{
|
|
2399
|
+
min-height:444px}
|
|
2400
|
+
.card-number-radio{
|
|
2401
|
+
display:flex;
|
|
2402
|
+
gap:12px;
|
|
2403
|
+
}
|
|
2404
|
+
.card-number-radio .card-number-last-four{
|
|
2405
|
+
color:#161616 !important;
|
|
2406
|
+
font-family:Inter !important;
|
|
2407
|
+
font-size:14px !important;
|
|
2408
|
+
font-weight:500 !important;
|
|
2409
|
+
font-style:normal !important;
|
|
2410
|
+
line-height : 18px !important;
|
|
2411
|
+
latter-spacing:-0.18px !important
|
|
2412
|
+
}
|
|
2413
|
+
.card-expiry-date{
|
|
2414
|
+
margin:0;
|
|
2415
|
+
color:#00000080;
|
|
2416
|
+
font-family:Inter;
|
|
2417
|
+
font-size:14px;
|
|
2418
|
+
font-weight:500;
|
|
2419
|
+
font-style"normal;
|
|
2420
|
+
line-height : 18px;
|
|
2421
|
+
latter-spacing:-0.18px
|
|
2422
|
+
}
|
|
2423
|
+
.pay-with-other-card {
|
|
2424
|
+
margin-top : 12px;
|
|
2425
|
+
padding:12px 32px;
|
|
2426
|
+
border :1px solid #E0DFE2;
|
|
2427
|
+
border-radius : 1000px;
|
|
2428
|
+
display: flex;
|
|
2429
|
+
justify-content : center;
|
|
2430
|
+
align-items:center;
|
|
2431
|
+
gap:10px;
|
|
2432
|
+
// width:100%;
|
|
2433
|
+
background:white;
|
|
2434
|
+
cursor:pointer;
|
|
2435
|
+
color:#161616;
|
|
2436
|
+
text-align:center
|
|
2437
|
+
font-family: Inter;
|
|
2438
|
+
font-size: 14px;
|
|
2439
|
+
font-style: normal;
|
|
2440
|
+
font-weight: 500;
|
|
2441
|
+
line-height: 24px;
|
|
2442
|
+
letter-spacing: -0.28px;
|
|
2443
|
+
// margin-bottom: 50px;
|
|
2444
|
+
}
|
|
2445
|
+
.charge-payment-back-btn {
|
|
2446
|
+
display: flex;
|
|
2447
|
+
padding: 9px 16px;
|
|
2448
|
+
align-items: center;
|
|
2449
|
+
gap: 6px;
|
|
2450
|
+
margin-bottom: 20px;
|
|
2451
|
+
border-radius: 1000px;
|
|
2452
|
+
border: 1px solid #E0DFE2;
|
|
2453
|
+
background: #FFF;
|
|
2454
|
+
box-shadow: 0px 6px 12px 0px rgba(206, 197, 221, 0.31);
|
|
2455
|
+
font-size:16px;
|
|
2456
|
+
curso:pointer;
|
|
2457
|
+
color:black
|
|
2458
|
+
}
|
|
2459
|
+
.res-charge-payment-back-btn{
|
|
2460
|
+
padding: 9px 16px;
|
|
2461
|
+
align-items: center;
|
|
2462
|
+
gap: 6px;
|
|
2463
|
+
margin-bottom: 20px;
|
|
2464
|
+
border-radius: 1000px;
|
|
2465
|
+
border: 1px solid #E0DFE2;
|
|
2466
|
+
background: #FFF;
|
|
2467
|
+
box-shadow: 0px 6px 12px 0px rgba(206, 197, 221, 0.31);
|
|
2468
|
+
font-size:16px;
|
|
2469
|
+
curso:pointer;
|
|
2470
|
+
color:black;
|
|
2471
|
+
display:none
|
|
2472
|
+
}
|
|
2473
|
+
.btn {
|
|
2474
|
+
padding: 11px 23px;
|
|
2475
|
+
background-color: black;
|
|
2476
|
+
color: white;
|
|
2477
|
+
border: none;
|
|
2478
|
+
border-radius: 6px;
|
|
2479
|
+
font-weight: bold;
|
|
2480
|
+
margin: 0 10px;
|
|
2481
|
+
cursor: pointer;
|
|
2482
|
+
}
|
|
2483
|
+
|
|
2484
|
+
.custom-swal-icon {
|
|
2485
|
+
margin: 20px auto;
|
|
2486
|
+
}
|
|
2487
|
+
|
|
2488
|
+
.custom-swal-popup {
|
|
2489
|
+
font-size: 16px;
|
|
2490
|
+
text-align: center;
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2493
|
+
.frac-form .res-pay-con{
|
|
2494
|
+
display:none
|
|
2495
|
+
}
|
|
2496
|
+
|
|
2497
|
+
@media (max-width: 768px) {
|
|
2498
|
+
.parent-pay-container{
|
|
2499
|
+
padding: 20px 5%;
|
|
2500
|
+
}
|
|
2501
|
+
.pay-container {
|
|
2502
|
+
grid-template-columns: 1fr;
|
|
2503
|
+
padding: 10px 5%;
|
|
2504
|
+
border:1px solid #E0DFE2;
|
|
2505
|
+
border-radius : 12px
|
|
2506
|
+
}
|
|
2507
|
+
.pay-conatiner-one{
|
|
2508
|
+
border-right: none;
|
|
2509
|
+
}
|
|
2510
|
+
.pay-conatiner-one-first{
|
|
2511
|
+
min-height:0
|
|
2512
|
+
}
|
|
2513
|
+
.pay-main-logo > img{
|
|
2514
|
+
display: none;
|
|
2515
|
+
}
|
|
2516
|
+
.pay-main-logo-res > img {
|
|
2517
|
+
display:block;
|
|
2518
|
+
margin:auto
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
.pay-logo-container{
|
|
2522
|
+
border :none
|
|
2523
|
+
}
|
|
2524
|
+
.res-charge-payment-back-btn {
|
|
2525
|
+
display:flex !important
|
|
2526
|
+
}
|
|
2527
|
+
.charge-payment-back-btn{
|
|
2528
|
+
display:none !important
|
|
2529
|
+
}
|
|
2530
|
+
.frac-form .res-pay-con{
|
|
2531
|
+
display:flex;
|
|
2532
|
+
justify-content :space-between;
|
|
2533
|
+
align-items:center;
|
|
2534
|
+
padding-bottom : 10px
|
|
2535
|
+
}
|
|
2536
|
+
.frac-form .amt-pay-con{
|
|
2537
|
+
display:none
|
|
2538
|
+
}
|
|
2539
|
+
.pay-conatiner-one-last{
|
|
2540
|
+
display:none}
|
|
2541
|
+
.pay-conatiner-two{
|
|
2542
|
+
padding:0
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
|
|
2546
|
+
}
|
|
2547
|
+
@media (max-width : 512px){
|
|
2548
|
+
.tab button {
|
|
2549
|
+
padding: 6px 16px;
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
|
|
2553
|
+
|
|
2554
|
+
|
|
2555
|
+
|
|
2556
|
+
|
|
2557
|
+
|
|
2558
|
+
`)}import _t from"axios";var vi=({amount:e,submitBtnText:F="Pay",session_token:T,customerId:V,callback:$,merchantName:je="merchant",isPreAuth:q,surcharge:De="0"})=>{var z,oe,Le,G,Ye,ge,he,Ee,Ge,Ce,lt;let[de,R]=Nt("card"),[n,K]=Nt(),[d,f]=Nt({}),[i,pe]=Nt(),[v,fe]=Nt({}),[we,Oe]=Nt(!1),[Ve,ve]=Nt(!1),[nt,Ke]=Nt(!1),[at,y]=Nt(""),[We,E]=Nt(!1),[_,x]=Nt(""),[ie,X]=Nt(!1),[r,s]=Nt(!1),b=ue+"widget/mc-img.svg",U=ue+"widget/visa-img.svg",w=ue+"widget/ae-img.svg",c=ue+"widget/discover-img.svg",l=ue+"widget/card.svg",P=ue+"widget/Trash.svg",I=ue+"widget/bank.svg",Me=ue+"widget/secure-img.png",Je=ue+"widget/pov-by.png",ht=ue+"widget/pax.svg",Xe=()=>X(!0),ye=()=>X(!1),h=async u=>{var m,j,Q,B,me,Z,H,ae;try{let ee={pass_fee_amount:De,Token:u==null?void 0:u.Token,amount:e,postal_code:u==null?void 0:u.postalCode},se=await _t.post(`${Be}api/v1/gateway/charge/${T}`,ee);if(console.log(se,"charge"),(m=se==null?void 0:se.data)!=null&&m.result){let te={};if(nt&&V)try{let ne={postal_code:n==null?void 0:n.zipCode,customer_id:V,gateway_token:u==null?void 0:u.gateway_token},A=await _t.post(`${Be}api/v1/gateway/add-card/${T}`,ne);(j=A==null?void 0:A.data)!=null&&j.result&&(A=(Q=A==null?void 0:A.data)==null?void 0:Q.data)}catch(ne){console.log(ne,"error"),ye(),y(((me=(B=ne==null?void 0:ne.response)==null?void 0:B.data)==null?void 0:me.message)||"Something went wrong!")}let Ae={cardDetails:S(S({},te),u),callback:(Z=se==null?void 0:se.data)==null?void 0:Z.data};nt||delete Ae.cardDetails,$(Ae),ye(),C()}}catch(ee){y(((ae=(H=ee==null?void 0:ee.response)==null?void 0:H.data)==null?void 0:ae.message)||"Something went wrong!"),ye()}},St=async u=>{var m,j,Q,B,me,Z,H,ae;try{let ee={Token:u==null?void 0:u.Token,amount:e,postal_code:u==null?void 0:u.postalCode},se=await _t.post(`${Be}api/v1/gateway/preauth/${T}`,ee);if(console.log(se,"charge"),(m=se==null?void 0:se.data)!=null&&m.result){let te={};if(nt&&V)try{let ne={postal_code:n==null?void 0:n.zipCode,customer_id:V,gateway_token:u==null?void 0:u.gateway_token},A=await _t.post(`${Be}api/v1/gateway/add-card/${T}`,ne);(j=A==null?void 0:A.data)!=null&&j.result&&(A=(Q=A==null?void 0:A.data)==null?void 0:Q.data)}catch(ne){console.log(ne,"error"),ye(),y(((me=(B=ne==null?void 0:ne.response)==null?void 0:B.data)==null?void 0:me.message)||"Something went wrong!")}let Ae={cardDetails:S(S({},te),u),callback:(Z=se==null?void 0:se.data)==null?void 0:Z.data};nt||delete Ae.cardDetails,$(Ae),ye(),C()}}catch(ee){y(((ae=(H=ee==null?void 0:ee.response)==null?void 0:H.data)==null?void 0:ae.message)||"Something went wrong!"),ye()}},gt=async u=>{var m,j,Q,B;if(u.Error)y(u.Error),ye();else{let me={token:u.Token,resp:u};try{let Z=await _t.post(`${Be}api/v1/gateway/update/token/${T}`,me);if((Z==null?void 0:Z.status)==200){let H={Token:(j=(m=Z==null?void 0:Z.data)==null?void 0:m.data)==null?void 0:j.gateway_token,Brand:u.Brand,ExpirationMonth:u.ExpirationMonth,ExpirationYear:u.ExpirationYear,Last4:u.Last4,Bin:u.Bin,CVV:u.CVV,postalCode:n==null?void 0:n.zipCode},ae;q?St(H):h(H)}}catch(Z){console.log(Z,"error"),ye(),y(((B=(Q=Z==null?void 0:Z.response)==null?void 0:Q.data)==null?void 0:B.message)||"Something went wrong!")}}},ct=()=>ve(!0),Re=u=>{R(u)},rt=()=>{var j,Q,B,me,Z,H,ae,ee,se;let u={},m=i;if((j=m==null?void 0:m.name)!=null&&j.trim()||(u.name="Name is required"),(Q=m==null?void 0:m.accountNumber)!=null&&Q.trim()||(u.accountNumber="Account number is required"),(B=m==null?void 0:m.accountNumber)!=null&&B.trim()&&((me=m==null?void 0:m.accountNumber)==null?void 0:me.trim())!==((Z=m==null?void 0:m.confirmAccountNumber)==null?void 0:Z.trim())&&(u.confirmAccountNumber="Account numbers must match"),(H=m==null?void 0:m.bankName)!=null&&H.trim()||(u.bankName="Bank name is required"),(ae=m==null?void 0:m.routingNumber)!=null&&ae.trim()||(u.routingNumber="Routing Number is required"),m!=null&&m.routingNumber&&((ee=m==null?void 0:m.routingNumber)==null?void 0:ee.length)!==9&&(u.routingNumber="Routing number must be 9 digits"),((se=m==null?void 0:m.routingNumber)==null?void 0:se.length)==9){let te=m==null?void 0:m.routingNumber,Ae=[3,7,1],ne=0;for(let A=0;A<te.length;A++)ne+=parseInt(te[A],10)*Ae[A%3];ne%10!==0&&(u.routingNumber="Invalid routing number")}return fe(u),Object.keys(u).length>0},ut=async()=>{var u,m,j,Q,B,me,Z,H,ae,ee,se,te,Ae,ne,A,qe,Ft,dt;try{let _e={method:"POST",redirect:"follow"},O=await _t.post(`${Be}api/v1/widget/generate-session`,_e),Mt=Number(n==null?void 0:n.expiryYear)%100,g=`${(u=n==null?void 0:n.cardNumber)==null?void 0:u.replace(/\s+/g,"")}=${Mt}${n==null?void 0:n.expiryMonth} ${n==null?void 0:n.cvv}`,Y=forge.pki.publicKeyFromPem((j=(m=O==null?void 0:O.data)==null?void 0:m.data)==null?void 0:j.publicKeyPem).encrypt(g,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),Se=forge.util.encode64(Y),W={"Content-Type":"application/json","x-app-session-key":(B=(Q=O.data)==null?void 0:Q.data)==null?void 0:B.session_key},Te=JSON.stringify({enc_track2_data:Se,algorithm:"RSAES_OAEP_SHA_1",session_key:(Z=(me=O==null?void 0:O.data)==null?void 0:me.data)==null?void 0:Z.session_key}),D=await _t.post(`${Yt}tokenizer/tokenize`,Te,{headers:W});if((D==null?void 0:D.status)==200){let Pe=(ae=(H=D==null?void 0:D.data)==null?void 0:H.data)==null?void 0:ae.token;try{let ce=await _t.post(`${Be}api/v1/gateway/verify-and-save/${T}`,{token:Pe});if((ce==null?void 0:ce.status)==200){let Ne=(ee=ce==null?void 0:ce.data)==null?void 0:ee.data,it={Token:Ne.gateway_token,Brand:Ne.card_data.brand,ExpirationMonth:Ne.card_data.expire_mm,ExpirationYear:Ne.card_data.expire_yy,Last4:Ne.card_data.last4,Bin:Ne.card_data.bin,postalCode:n==null?void 0:n.zipCode},re;if(nt&&V)try{let et={postal_code:n==null?void 0:n.zipCode,customer_id:V,gateway_token:Ne.gateway_token};re=await _t.post(`${Be}api/v1/gateway/add-card/${T}`,et),(se=re==null?void 0:re.data)!=null&&se.result&&console.log((te=re==null?void 0:re.data)==null?void 0:te.data,"add")}catch(et){console.log(et,"error"),ye(),y(((ne=(Ae=et==null?void 0:et.response)==null?void 0:Ae.data)==null?void 0:ne.message)||"Something went wrong!")}q?St(it):h(it)}}catch(ce){console.log(ce,"error"),y(((qe=(A=ce==null?void 0:ce.response)==null?void 0:A.data)==null?void 0:qe.message)||"Something went wrong!"),ye()}}}catch(_e){ye(),console.log(_e,"error"),y(((dt=(Ft=_e==null?void 0:_e.response)==null?void 0:Ft.data)==null?void 0:dt.message)||"Something went wrong!")}},Pt=()=>{var B,me,Z,H,ae,ee;let u={},m=n,j=parseInt((m==null?void 0:m.expiryMonth)||"",10),Q=(m==null?void 0:m.expiryYear)||"";if((B=m==null?void 0:m.cardName)!=null&&B.trim()||(u.cardName="Card name is required"),(me=m==null?void 0:m.cardNumber)!=null&&me.trim()||(u.cardNumber="Card number is required"),(!((Z=m==null?void 0:m.expiryMonth)!=null&&Z.trim())||!((H=m==null?void 0:m.expiryYear)!=null&&H.trim())||isNaN(j)||j<1||j>12||Q.length!==4)&&(u.expiryMonth="Invalid Expiration Date."),(ae=m==null?void 0:m.cvv)!=null&&ae.trim()||(u.cvv="CVV is required"),(ee=m==null?void 0:m.zipCode)!=null&&ee.trim()||(u.zipCode="ZIP code is required"),m!=null&&m.expiryMonth&&(m!=null&&m.expiryYear)&&m.expiryMonth.length<=2&&m.expiryYear.length===4){let se=parseInt(m.expiryMonth,10),te=parseInt(m.expiryYear,10),Ae=new Date,ne=Ae.getMonth()+1,A=Ae.getFullYear();(te<A||te===A&&se<ne)&&(u.expiryMonth="Card is expired")}return f(u),Object.keys(u).length>0},st=async u=>{var m,j,Q,B,me,Z,H,ae,ee,se,te,Ae,ne;if(u.preventDefault(),de!=="ach"){if(Pt())return}else if(rt())return;try{Xe();let A=await _t.get(`${Be}api/v1/gateway/token/${T}`);if((A==null?void 0:A.status)==200){let qe=(j=(m=A==null?void 0:A.data)==null?void 0:m.data)==null?void 0:j.gateway_token,Ft=(B=(Q=A==null?void 0:A.data)==null?void 0:Q.data)==null?void 0:B.paymentGateway;if(de!=="ach")Ft==((me=mn)==null?void 0:me.FRACTALKEY)?await ut():DatacapWebToken.requestToken(qe,"PaymentForm",gt);else{let dt;try{let _e=await _t.post(`${Be}api/v1/gateway/bank-charge/${T}`,{label:i==null?void 0:i.name,account_number:i==null?void 0:i.accountNumber,routing_number:i==null?void 0:i.routingNumber,bank_name:i==null?void 0:i.bankName,account_type:i==null?void 0:i.accountType,amount:e,customer_id:null,isSaveAch:!1,tax:"0.00",discount:"0.00",surcharge:"0.00",order_id:""});if(console.log(_e,"pay by bank"),(Z=_e==null?void 0:_e.data)!=null&&Z.result){if(we&&V)try{let O=await _t.post(`${Be}api/v1/gateway/add-bank/${T}`,{name:i==null?void 0:i.name,account_number:i==null?void 0:i.accountNumber,routing_number:i==null?void 0:i.routingNumber,bank_name:i==null?void 0:i.bankName,account_type:i==null?void 0:i.accountType,customer_id:V||""});console.log(O,"result"),O.data.result&&(dt={bankdetails:(H=O==null?void 0:O.data)==null?void 0:H.data})}catch(O){ye(),y(((ee=(ae=O==null?void 0:O.response)==null?void 0:ae.data)==null?void 0:ee.message)||"Something went wrong!")}dt=L(S({},dt),{callback:(se=_e==null?void 0:_e.data)==null?void 0:se.data}),$(dt),C(),ye()}}catch(_e){console.log(_e,"errororor");let O=(te=_e==null?void 0:_e.response)==null?void 0:te.data;console.log(O,"ererere",Object.values(O==null?void 0:O.message)),typeof(O==null?void 0:O.message)=="object"?Object.values(O==null?void 0:O.message).forEach(Mt=>{y(Mt||"Something went wrong")}):y((O==null?void 0:O.message)||"Something went wrong"),ye()}}}}catch(A){ye(),y(((ne=(Ae=A==null?void 0:A.response)==null?void 0:Ae.data)==null?void 0:ne.message)||"Something went wrong!")}},ze=(u,m)=>{let j=u;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(j)){(m===""||/^[0-9]+$/.test(m))&&(f(B=>L(S({},B),{[j]:""})),K(B=>L(S({},B),{[j]:m})));return}f(B=>L(S({},B),{[j]:""})),K(B=>L(S({},B),{[j]:m}))},Ie=u=>{let j=u.target.value.replace(/\D/g,""),Q="";/^3[47]/.test(j)?Q=j.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(me,Z,H,ae)=>[Z,H,ae].filter(Boolean).join(" ")):Q=j.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(me,Z,H,ae,ee)=>[Z,H,ae,ee].filter(Boolean).join(" ")),f(B=>L(S({},B),{cardNumber:""})),K(B=>L(S({},B),{cardNumber:Q}))},Ue=u=>{let{name:m,value:j}=u.target,Q=["routingNumber","accountNumber","confirmAccountNumber"];if(m=="name"){/^[a-zA-Z\s]*$/.test(j)&&(fe(B=>L(S({},B),{[m]:""})),pe(B=>L(S({},B),{[m]:j})));return}if(Q.includes(m)){(j===""||/^[0-9]+$/.test(j))&&(fe(B=>L(S({},B),{[m]:""})),pe(B=>L(S({},B),{[m]:j})));return}fe(B=>L(S({},B),{[m]:""})),pe(B=>L(S({},B),{[m]:j}))},C=()=>{ve(!1),R("card"),y(""),E(!1),x(""),pe({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),fe({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),K({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),f({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),Oe(!1),Ke(!1)};return a.createElement(a.Fragment,null,a.createElement(It,null),a.createElement(xn,null),a.createElement("button",{className:"paymentBtn",onClick:ct},F),a.createElement(kt,{open:Ve,onClose:C},at&&a.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},a.createElement(Tt,{error:at,onClose:C})),!at&&a.createElement(a.Fragment,null,(ie||r)&&a.createElement(xt,{loading:ie||r}),a.createElement("div",{className:"frac-card-payment-page frac-form"},a.createElement("div",{className:"parent-pay-container"},a.createElement("span",{className:"request-payment-close-popup",onClick:C},a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},a.createElement("g",{clipPath:"url(#clip0_12425_52336)"},a.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),a.createElement("defs",null,a.createElement("clipPath",{id:"clip0_12425_52336"},a.createElement("rect",{width:"16",height:"16",fill:"white"}))))),a.createElement("div",{className:"pay-main-logo-res"}),a.createElement("div",{className:"pay-container"},a.createElement("div",{className:"pay-header pay-conatiner-one"},a.createElement("div",{className:"pay-conatiner-one-first",style:{minHeight:q?"400px":"470px"}},a.createElement("div",{className:"pay-logo-container"},a.createElement("div",{className:"pay-main-logo"}),a.createElement("h1",{className:"pay-heading"},"Pay")),a.createElement("div",{className:"amt-pay-con"},a.createElement("div",{className:"pay-amount-conatiner"},a.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),a.createElement("strong",{className:"pay-amount"},"$",(z=Number(e))==null?void 0:z.toFixed(2))),de!="ach"&&a.createElement("div",{style:{display:"flex",gap:"8px",margin:"8px 0"}},a.createElement("img",{src:U,alt:"",width:33}),a.createElement("img",{src:b,width:33,alt:""}),a.createElement("img",{src:w,alt:"",width:33}),a.createElement("img",{src:c,width:33,alt:""})))),a.createElement("div",{className:"pay-conatiner-one-last"},a.createElement("img",{src:Me,alt:""}),a.createElement("img",{src:Je,alt:""}),"Secure payments powered by Fractal")),a.createElement("div",{className:"pay-tab pay-conatiner-two"},a.createElement("div",{className:"col-md-12"},a.createElement("div",{id:"payment-form-div"},!q&&a.createElement("div",{className:"tab"},a.createElement("button",{className:"tablinks",onClick:u=>{Re("card")},style:{border:de==="card"?"1px solid":""}},a.createElement("i",{className:"fas fa-credit-card me-2",style:{marginRight:"8px",fontSize:"15px"}}),"Card"),a.createElement("button",{className:"tablinks",onClick:u=>{Re("ach")},style:{border:de==="ach"?"1px solid":""}},a.createElement("i",{className:"fas fa-university me-2",style:{marginRight:"8px",fontSize:"15px"}}),"Bank")),a.createElement("div",{className:"res-pay-con"},a.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},a.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),a.createElement("strong",{className:"pay-amount"},"$",(oe=Number(e))==null?void 0:oe.toFixed(2))),de!="ach"&&a.createElement("div",null,a.createElement("div",null,a.createElement("img",{src:U,alt:"",width:35,style:{paddingRight:"5px"}}),a.createElement("img",{src:b,width:35,alt:""})),a.createElement("div",null,a.createElement("img",{src:w,alt:"",width:35,style:{paddingRight:"5px"}}),a.createElement("img",{src:c,width:35,alt:""})))),a.createElement("div",{id:"ach",style:{display:de==="card"?"block":"none"},className:"tabcontent"},a.createElement("form",{id:"PaymentForm",style:{textAlign:"start"},onSubmit:st},a.createElement("div",{className:"ach-scrl",style:{minHeight:"398px",maxHeight:"398px",overflow:"auto",marginRight:"5px"}},a.createElement("div",{className:"form-group-frac"},a.createElement("label",{htmlFor:"cardHolderName"},"NAME ON CARD "),a.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"John Doe",value:(n==null?void 0:n.cardName)||"",onChange:u=>{let m=u.target.value;/^[a-zA-Z\s]*$/.test(m)&&ze("cardName",m)}}),(d==null?void 0:d.cardName)&&a.createElement("span",{className:"error-span"},d==null?void 0:d.cardName)),a.createElement("div",{className:"form-group-frac"},a.createElement("label",{htmlFor:"cardNumber"},"CARD NUMBER"),a.createElement("div",{className:"toggle-num-wrapper"},a.createElement("input",{className:"form-control card-number-new",type:"text",maxLength:19,inputMode:"numeric",placeholder:"0000 0000 0000 0000",value:(n==null?void 0:n.cardNumber)||"",onChange:u=>Ie(u),"data-token":"card_number"}),a.createElement("div",{className:"card-crdi card-expiry-new"},a.createElement("div",{className:"exp-date-year-container"},a.createElement("div",{className:"exp-date form-group-frac"},a.createElement("input",{"data-token":"exp_month",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"MM",maxLength:2,value:(n==null?void 0:n.expiryMonth)||"",onChange:u=>ze("expiryMonth",u.target.value)})),a.createElement("div",{className:"exp-year form-group-frac"},a.createElement("input",{"data-token":"exp_year",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"YYYY",maxLength:4,value:(n==null?void 0:n.expiryYear)||"",onChange:u=>ze("expiryYear",u.target.value)})),a.createElement("div",{className:"security-digit form-group-frac"},a.createElement("input",{"data-token":"cvv",className:"form-control card-cvv-in required",type:"text",style:{maxHeight:"36px"},maxLength:4,placeholder:"CVC",value:(n==null?void 0:n.cvv)||"",onChange:u=>ze("cvv",u.target.value)})))),(d==null?void 0:d.cardNumber)&&a.createElement("span",{className:"error-span"},d==null?void 0:d.cardNumber),a.createElement("p",{style:{margin:"0"}},d!=null&&d.expiryMonth||d!=null&&d.expiryYear?a.createElement("span",{className:"error-span",style:{paddingRight:"4px"}},d==null?void 0:d.expiryMonth):"",(d==null?void 0:d.cvv)&&a.createElement("span",{className:"error-span"},d==null?void 0:d.cvv)))),a.createElement("div",{className:"form-group-frac"},a.createElement("label",{htmlFor:"zip"},"ZIP"),a.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"000000",value:(Le=n==null?void 0:n.zipCode)!=null?Le:"",onChange:u=>ze("zipCode",u.target.value)}),(d==null?void 0:d.zipCode)&&a.createElement("span",{className:"error-span"},d==null?void 0:d.zipCode)),V&&a.createElement("div",{className:"form-group-frac"},a.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px",paddingTop:"10px"}},a.createElement("input",{type:"checkbox",id:"save_card",className:"toggle-checkbox",checked:nt,onChange:u=>Ke(u.target.checked)}),a.createElement("label",{htmlFor:"save_card",className:"toggle-label"}),a.createElement("label",{htmlFor:"save_card"},"Save card for future payments "),a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},a.createElement("g",{clipPath:"url(#clip0_12420_50192)"},a.createElement("rect",{width:"20",height:"20",fill:"white"}),a.createElement("circle",{cx:"10",cy:"10",r:"10",fill:"#E0DFE2"}),a.createElement("path",{d:"M9.03406 12.0979V12.0072C9.04055 11.4153 9.10057 10.9443 9.21411 10.5943C9.3309 10.2442 9.49635 9.96102 9.71046 9.74463C9.92457 9.52824 10.1825 9.33095 10.4842 9.15274C10.6788 9.03182 10.854 8.89658 11.0097 8.74702C11.1655 8.59745 11.2887 8.42562 11.3796 8.2315C11.4704 8.03739 11.5158 7.82259 11.5158 7.58711C11.5158 7.3039 11.4477 7.05887 11.3114 6.85203C11.1752 6.64519 10.9935 6.48608 10.7664 6.3747C10.5426 6.26014 10.2928 6.20286 10.017 6.20286C9.76723 6.20286 9.52879 6.25378 9.3017 6.35561C9.07461 6.45744 8.88646 6.61655 8.73723 6.83294C8.588 7.04614 8.50203 7.3214 8.47932 7.65871H7C7.02271 7.08592 7.17032 6.60223 7.44282 6.20764C7.71533 5.80986 8.07543 5.50915 8.52311 5.30549C8.97405 5.10183 9.47202 5 10.017 5C10.6139 5 11.1363 5.10979 11.5839 5.32936C12.0316 5.54574 12.3788 5.84964 12.6253 6.24105C12.8751 6.62928 13 7.08274 13 7.60143C13 7.95784 12.9432 8.27924 12.8297 8.56563C12.7161 8.84885 12.5539 9.10183 12.3431 9.32458C12.1354 9.54733 11.8856 9.74463 11.5937 9.91647C11.3179 10.0851 11.0941 10.2601 10.9221 10.4415C10.7534 10.6229 10.6302 10.8377 10.5523 11.0859C10.4745 11.3341 10.4323 11.6412 10.4258 12.0072V12.0979H9.03406ZM9.76886 15C9.50284 15 9.27413 14.9077 9.08273 14.7232C8.89132 14.5354 8.79562 14.3095 8.79562 14.0453C8.79562 13.7844 8.89132 13.5617 9.08273 13.3771C9.27413 13.1893 9.50284 13.0955 9.76886 13.0955C10.0316 13.0955 10.2587 13.1893 10.4501 13.3771C10.6448 13.5617 10.7421 13.7844 10.7421 14.0453C10.7421 14.2204 10.6967 14.3811 10.6058 14.5274C10.5182 14.6706 10.4015 14.7852 10.2555 14.8711C10.1095 14.957 9.94728 15 9.76886 15Z",fill:"#161616"})),a.createElement("defs",null,a.createElement("clipPath",{id:"clip0_12420_50192"},a.createElement("rect",{width:"20",height:"20",fill:"white"}))))))),a.createElement("div",{className:"form-group-frac",style:{marginTop:"20px",padding:"0"}},a.createElement("button",{type:"submit",style:{margin:0},className:"pay-button"},"$",(G=Number(e))==null?void 0:G.toFixed(2))))),a.createElement("div",{id:"ach",style:{display:de==="ach"?"block":"none"},className:"tabcontent"},a.createElement("form",{id:"ACHPaymentForm",style:{textAlign:"start"},onSubmit:st},a.createElement("div",{className:"ach-scrl",style:{minHeight:"358px",maxHeight:"378px"}},a.createElement("div",{className:"form-group-frac mb-4"},a.createElement("label",{htmlFor:"nameonaccount"},"Name on account"),a.createElement("input",{type:"text",id:"nameonaccount",className:"form-control",maxLength:100,placeholder:"John Doe",name:"name",value:(Ye=i==null?void 0:i.name)!=null?Ye:"",onChange:Ue}),(v==null?void 0:v.name)&&a.createElement("span",{className:"error-span"},v==null?void 0:v.name)),a.createElement("div",{className:"form-group-frac mb-4"},a.createElement("label",{htmlFor:"routingnumber"},"Routing number"),a.createElement("input",{type:"text",id:"routingnumber",className:"form-control",maxLength:9,placeholder:"000000000",name:"routingNumber",value:(ge=i==null?void 0:i.routingNumber)!=null?ge:"",onChange:Ue}),(v==null?void 0:v.routingNumber)&&a.createElement("span",{className:"error-span"},v==null?void 0:v.routingNumber)),a.createElement("div",{className:"form-group-frac mb-4"},a.createElement("label",{htmlFor:"accountnumber"},"Account number"),a.createElement("input",{type:"text",id:"accountnumber",className:"form-control",maxLength:16,placeholder:"0000000000",name:"accountNumber",value:(he=i==null?void 0:i.accountNumber)!=null?he:"",onChange:Ue}),(v==null?void 0:v.accountNumber)&&a.createElement("span",{className:"error-span"},v==null?void 0:v.accountNumber)),a.createElement("div",{className:"form-group-frac mb-4"},a.createElement("label",{htmlFor:"confirmaccountnumber"},"Confirm account number"),a.createElement("input",{type:"text",id:"confirmaccountnumber",className:"form-control",maxLength:16,placeholder:"0000000000",name:"confirmAccountNumber",value:(Ee=i==null?void 0:i.confirmAccountNumber)!=null?Ee:"",onChange:Ue}),(v==null?void 0:v.confirmAccountNumber)&&a.createElement("span",{className:"error-span"},v==null?void 0:v.confirmAccountNumber)),a.createElement("div",{className:"form-group-frac mb-4"},a.createElement("label",{htmlFor:"bankname"},"Bank name"),a.createElement("input",{type:"text",id:"bankname",className:"form-control",maxLength:100,placeholder:"My Bank",name:"bankName",value:(Ge=i==null?void 0:i.bankName)!=null?Ge:"",onChange:Ue}),(v==null?void 0:v.bankName)&&a.createElement("span",{className:"error-span"},v==null?void 0:v.bankName)),a.createElement("div",{className:"form-group-frac mb-4"},a.createElement("label",{htmlFor:"accounttype"},"Select account type"),a.createElement("select",{name:"accountType",id:"accounttype",className:"form-control",value:(Ce=i==null?void 0:i.accountType)!=null?Ce:"",onChange:Ue},a.createElement("option",{value:""},"Select account"),a.createElement("option",{value:"saving"},"Personal Saving"),a.createElement("option",{value:"saving"},"Business Saving"),a.createElement("option",{value:"checking"},"Personal Checking"),a.createElement("option",{value:"checking"},"Business Checking"))),V&&a.createElement("div",{className:"form-group-frac mb-4 save-ach-div",style:{paddingTop:"5px"}},a.createElement("input",{type:"checkbox",id:"saveACH",className:"",maxLength:100,placeholder:"My Bank",checked:we,onChange:u=>Oe(u.target.checked)}),a.createElement("label",{htmlFor:"saveACH"},"Save ACH")),we&&a.createElement("div",{className:"form-group-frac mb-4",style:{fontSize:"12px",color:"#727272"}},a.createElement("p",null,"If checked, I agree for ",a.createElement("b",null,je||"merchant")," to have my permission to charge this credit card for agreed upon purchases in the future."))),a.createElement("div",{className:"form-group-frac "},a.createElement("button",{className:"pay-button",style:{margin:"20px 0 0"},type:"submit"},"$",(lt=Number(e))==null?void 0:lt.toFixed(2))))))))))))))};export{hi as AddCard,xi as AddCardSky,li as GetPaymentPage,mi as PreAuthPayment,Xn as RequestPayment,ei as RequestPreAuthPayment,vi as Skypay};
|