@fractalpay/fractalpay-next-dev 0.0.88 → 0.0.90
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.js +12 -12
- package/dist/index.mjs +12 -12
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var oi=Object.defineProperty,ri=Object.defineProperties;var si=Object.getOwnPropertyDescriptors;var kn=Object.getOwnPropertySymbols;var Wn=Object.prototype.hasOwnProperty,Un=Object.prototype.propertyIsEnumerable;var Zn=(e,f,q)=>f in e?oi(e,f,{enumerable:!0,configurable:!0,writable:!0,value:q}):e[f]=q,k=(e,f)=>{for(var q in f||(f={}))Wn.call(f,q)&&Zn(e,q,f[q]);if(kn)for(var q of kn(f))Un.call(f,q)&&Zn(e,q,f[q]);return e},B=(e,f)=>ri(e,si(f));var _n=(e,f)=>{var q={};for(var O in e)Wn.call(e,O)&&f.indexOf(O)<0&&(q[O]=e[O]);if(e!=null&&kn)for(var O of kn(e))f.indexOf(O)<0&&Un.call(e,O)&&(q[O]=e[O]);return q};var li=(e,f)=>()=>(f||e((f={exports:{}}).exports,f),f.exports);var Jn=li((oa,pi)=>{pi.exports={name:"@fractalpay/fractalpay-next-dev",version:"0.0.90",private:!1,scripts:{dev:"next dev -p 4001",build:"next build",start:"next start",lint:"next lint",bundle:"tsup src/app/index.ts"},dependencies:{"@types/yup":"^0.29.14",axios:"^1.8.1",bootstrap:"^5.3.3","credit-card-type":"^10.0.1",formik:"^2.4.6","node-forge":"^1.3.1","react-bootstrap":"^2.10.5","react-bs-datatable":"^3.15.0","react-datepicker":"^7.5.0","react-icons":"^5.5.0","react-number-format":"^5.4.3","react-toastify":"^10.0.6","socket.io-client":"^4.8.1","styled-components":"^6.1.15",sweetalert2:"^11.22.0",yup:"^1.6.1"},peerdependencies:{next:"15.0.3",react:">=18.0.0 <20.0.0","react-dom":">=18.0.0 <20.0.0"},devDependencies:{"@types/estree":"^1.0.8","@types/node":"^20","@types/node-forge":"^1.3.11","@types/react":"^18","@types/react-dom":"^18",autoprefixer:"^10.4.20","credit-card-type":"^10.0.1",eslint:"^8","eslint-config-next":"15.0.3",next:"^15.0.3",react:"^18.3.1","react-bs-datatable":"^3.15.0","react-datepicker":"^7.5.0","react-dom":"^18.3.1","react-toastify":"^10.0.6",tsup:"^8.4.0",typescript:"^5"},author:"Mukul",license:"MIT",keywords:["nextjs","next","typescript","tailwindcss"],main:"dist/index.js",publishConfig:{access:"public"}}});import"bootstrap/dist/js/bootstrap.bundle.min.js";import _,{useState as Dt,useEffect as Qn}from"react";import Qt from"react";import di from"react";var mi=e=>di.createElement("style",null,`
|
|
2
2
|
|
|
3
3
|
.loader {
|
|
4
4
|
position: fixed; /* Fixed position to cover the viewport */
|
|
@@ -81,7 +81,7 @@ var ai=Object.defineProperty,oi=Object.defineProperties;var ri=Object.getOwnProp
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
`),
|
|
84
|
+
`),Gn=mi;var ci=e=>Qt.createElement(Qt.Fragment,null,Qt.createElement(Gn,null),(e==null?void 0:e.loading)&&Qt.createElement("div",{className:"loader"},Qt.createElement("div",{className:"lds-ellipsis"},Qt.createElement("div",null),Qt.createElement("div",null),Qt.createElement("div",null),Qt.createElement("div",null)))),Ft=ci;var{name:pn}=Jn();console.log(pn,"dgijiisdfhg");var R="https://fractal-userdata-upload.s3.us-east-1.amazonaws.com/";pn==="@fractalpay/fractalpay-next-dev"?(be="https://dev-sky-node.fractalpay.com/",Fe="https://dev-widget.fractalpay.com/",wt="https://api-dev.merchant-trends.com/",an="https://token-cert.dcap.com/v1/client"):pn==="@fractalpay/fractalpay-next-test"?(be="https://testapi.fractalpay.com/",Fe="https://staging-widget.fractalpay.com/",wt="https://api-dev.merchant-trends.com/",an="https://token-cert.dcap.com/v1/client"):pn==="@fractalpay/fractalpay-next-testprod"?(be="https://sky-node-prod.fractalpay.com/",Fe="https://widget-prod.fractalpay.com/",wt="https://api.merchant-trends.com/",an="https://token.dcap.com/v1/client"):pn==="@fractalpay/fractalpay-next"?(be="https://api.fractalpay.com/",Fe="https://widget.fractalpay.com/",wt="https://api.merchant-trends.com/",an="https://token.dcap.com/v1/client"):(Fe="http://localhost:8082/",be="http://localhost:8081/",wt="https://api-dev.merchant-trends.com/",an="https://token-cert.dcap.com/v1/client");var be,Fe,wt,an;var tt={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 un from"react";import ui from"react";var gi=e=>ui.createElement("style",null,`
|
|
85
85
|
.fractal-input::placeholder {
|
|
86
86
|
color: #35254D;
|
|
87
87
|
opacity: 1;
|
|
@@ -334,7 +334,7 @@ var ai=Object.defineProperty,oi=Object.defineProperties;var ri=Object.getOwnProp
|
|
|
334
334
|
padding: 0px !important;
|
|
335
335
|
border-radius: 12px !important;
|
|
336
336
|
}
|
|
337
|
-
`),
|
|
337
|
+
`),Xn=gi;var fi=({open:e,onClose:f,children:q,maxWidth:O})=>e?un.createElement(un.Fragment,null,un.createElement(Xn,null),un.createElement("div",{className:"fractal-popup"},un.createElement("div",{className:"fractal-popup-content request-payment-popup-container",style:{maxWidth:`${O!=null?O:"auto"}`}},q))):null,$t=fi;import xi from"axios";import{PatternFormat as bi}from"react-number-format";import hi from"react";var yi=e=>hi.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;
|
|
@@ -595,7 +595,7 @@ var ai=Object.defineProperty,oi=Object.defineProperties;var ri=Object.getOwnProp
|
|
|
595
595
|
font-style: normal;
|
|
596
596
|
font-weight: 500;
|
|
597
597
|
}
|
|
598
|
-
`),_n=hi;function bi(e){let f=e.merchantPublicKey,q=e==null?void 0:e.discount,O=e==null?void 0:e.tax,Y=e==null?void 0:e.surcharge,[Ae,I]=Dt(!1),[Qe,Se]=Dt(!1),[se,T]=Dt({}),[D,ue]=Dt(null),[n,u]=Dt({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:f}),[b,E]=Dt(void 0),[h,he]=Dt(""),[Q,Be]=Dt(!1),[c,ut]=Dt(null),V=l=>/^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(l),gt=/[+-]?([0-9]*[.])?[0-9]+/,y=l=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(l),Te=l=>/^[A-Za-z\s]*$/.test(l),W=(l,v)=>{let C=(parseFloat(v)||0)/100,me=l/(1+C);return Math.round(me*100)/100};Xn(()=>{if(e!=null&&e.pass_fee){let l=W(e==null?void 0:e.amount,e==null?void 0:e.surcharge);E(l)}},[e==null?void 0:e.pass_fee]);let Ee=()=>{I(!1),T({})},ke=()=>I(!0),xt=()=>{console.log(c,"apiresponse"),s(c),Be(!1)};function w(){u({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:f}),he("")}function s(l){let v={type:"preview.compiledcheck",other:B(k({},l),{status:!0})};window.parent.postMessage(v,"*")}let m=async()=>{if(!(Object.keys(se).length>0)){if(T({}),!(n!=null&&n.email)&&D&&!V(D)){T(l=>B(k({},l),{phone:tt.phonenumbervalid}));return}if(S())try{Se(!0);let l={fractalpayPublicKey:f,amount:h,phone_number:D,order_id:n.order_id,action:"request",name:n.name,email:n.email,customer_id:e!=null&&e.customerId?e==null?void 0:e.customerId:"",discount:q,surcharge:Y,tax:O,require_3ds:e==null?void 0:e.require_3ds,pass_fee:e==null?void 0:e.pass_fee},v=await yi.post(`${Me}create-widget-order`,l);(v==null?void 0:v.status)===200&&(Be(!0),I(!1),w(),ut(v==null?void 0:v.data)),Se(!1)}catch(l){console.log(l),Se(!1)}}},K=Me+"images/logo-img.png",x=l=>{let{value:v}=l.target,C=l.target.dataset.token;if(u(B(k({},n),{[C]:v})),C==="name"&&!Te(v)){T(J=>B(k({},J),{[C]:tt.onlylettersallowed}));return}let me=se;C==="email"&&!D&&(delete me.phone,T(me)),v&&(delete me[C],T(me)),C==="email"&&!v&&(delete me[C],T(me))},p=l=>{let{value:v}=l;if(Number(v)>0){let C=se;delete C.amount,T(C)}he(v)},S=()=>{let l={};return h||(l.amount=tt.amountrequired),n.email&&!y(n==null?void 0:n.email)&&(l.email=tt.invalidemail),!D&&!(n!=null&&n.email)&&(l.phone=tt.phoneoremailrequired),!D&&!(n!=null&&n.email)&&(l.email=tt.phoneoremailrequired),!D&&n.email&&!y(n==null?void 0:n.email)&&(l.email=tt.invalidemail),e.from==="merchant"&&!n.order_id&&(l.order_id=tt.orderidrequired),T(l),Object.keys(l).length===0};Xn(()=>{e&&(u(l=>B(k({},l),{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:""})),he(e.amount?e.amount:""),ue(e.phone?`${e.phone}`:null))},[e]);let g=l=>{let v=l==null?void 0:l.value;if(v&&(v==null?void 0:v.length)>0&&(v==null?void 0:v.length)!==10){T(me=>B(k({},me),{phone:tt.phonenumberlength})),ue(v);return}else ue(v);let C=se;delete C.phone,v&&!(n!=null&&n.email)&&delete C.email,T(C)};function Z(l){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(l))}return _.createElement(_.Fragment,null,_.createElement(_n,null),_.createElement(Ft,{loading:Qe}),_.createElement(_.Fragment,null,_.createElement("button",{className:"paymentBtn",onClick:ke},"Request Payment"),_.createElement($t,{open:Ae,onClose:()=>I(!1),maxWidth:"500px"},_.createElement("div",{style:{maxWidth:"500px"}},_.createElement("div",{className:"request-payment-amount-detail frac-form"},_.createElement("p",{className:"request-payment-merchantname"},"Pay ",e==null?void 0:e.webname),_.createElement("p",{className:"request-payment-amount"},Z(e==null?void 0:e.amount)),b&&b>0&&_.createElement("div",{className:"frac-req-cash-discount"},_.createElement("div",{className:"frac-cashlabel"},"Cash Discount :"),_.createElement("div",null,"$",b.toFixed(2))),(e==null?void 0:e.from)==="merchant"&&_.createElement("p",{className:"request-payment-orderid"},n==null?void 0:n.order_id),_.createElement("span",{className:"request-payment-close-popup",onClick:Ee},_.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},_.createElement("g",{clipPath:"url(#clip0_12425_52336)"},_.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"})),_.createElement("defs",null,_.createElement("clipPath",{id:"clip0_12425_52336"},_.createElement("rect",{width:"16",height:"16",fill:"white"})))))),_.createElement("form",{className:"request-payment-input-form"},_.createElement("div",{className:"request-payment-list-div"},_.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"FULL NAME"),_.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Full Name","data-token":"name",onChange:x,value:n==null?void 0:n.name}),se.name&&_.createElement("small",{className:"request-payment-error-msg"},se.name)),_.createElement("div",{className:"request-payment-list-div"},_.createElement("label",{htmlFor:"requestPhoneNumber",className:"request-payment-input-label"},"Phone Number"),_.createElement(xi,{className:"request-payment-input-box",placeholder:"Mobile number",format:"+1 (###) ###-####",value:D,onValueChange:l=>{g(l)}}),se.phone&&_.createElement("small",{className:"request-payment-error-msg"},se.phone)),_.createElement("div",{className:"request-payment-list-div"},_.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"EMAIL"),_.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Email",onChange:x,"data-token":"email",value:n==null?void 0:n.email}),se.email&&_.createElement("small",{className:"request-payment-error-msg"},se.email)),_.createElement("button",{type:"button",className:"request-payment-submit-button",onClick:m,disabled:Qe},Qe?"Loading...":"Send Request"),_.createElement("div",{className:"request-payment-fractal-powerd-by"},_.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},_.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 ",_.createElement("span",null,"Fractal"),_.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"})))))),_.createElement($t,{open:Q,onClose:xt,maxWidth:"500px"},_.createElement("div",{className:"fractal-popup-content",style:{padding:"0px",maxWidth:"500px"}},_.createElement("div",{className:"request-payment-success-container"},_.createElement("span",{className:"request-payment-close-popup",onClick:xt},_.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},_.createElement("g",{clipPath:"url(#clip0_12425_52336)"},_.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"})),_.createElement("defs",null,_.createElement("clipPath",{id:"clip0_12425_52336"},_.createElement("rect",{width:"16",height:"16",fill:"white"}))))),_.createElement("div",{className:"request-payment-success-tick-div"},_.createElement("div",{className:"request-payment-success-tick"},_.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},_.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"})))),_.createElement("h6",{className:"request-payment-success-text"},"The request ",_.createElement("br",null),"was sent"),_.createElement("h6",{className:"request-payment-success-subtext"},"Please wait for the customer to pay"),_.createElement("div",{className:"request-payment-success-btn-div"},_.createElement("button",{onClick:xt,className:"request-payment-success-btn2"},"Close")))))))}import"bootstrap/dist/js/bootstrap.bundle.min.js";import M,{useState as en,useEffect as vi}from"react";import Ci from"axios";import{PatternFormat as wi}from"react-number-format";function Ni(e){let f=e.merchantPublicKey,q=e==null?void 0:e.discount,O=e==null?void 0:e.tax,Y=e==null?void 0:e.surcharge,[Ae,I]=en(!1),[Qe,Se]=en(!1),[se,T]=en({}),[D,ue]=en(null),[n,u]=en({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:f}),[b,E]=en(""),[h,he]=en(!1),[Q,Be]=en(null),c=S=>/^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(S),ut=/[+-]?([0-9]*[.])?[0-9]+/,V=S=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(S),gt=S=>/^[A-Za-z\s]*$/.test(S),y=()=>{I(!1),T({})},Te=()=>I(!0),W=()=>{console.log(Q,"apiresponse"),ke(Q),he(!1)};function Ee(){u({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:f}),E("")}function ke(S){let g={type:"preview.compiledcheck",other:B(k({},S),{status:!0})};window.parent.postMessage(g,"*")}let xt=async()=>{if(!(Object.keys(se).length>0)){if(T({}),!(n!=null&&n.email)&&D&&!c(D)){T(S=>B(k({},S),{phone:tt.phonenumbervalid}));return}if(K())try{Se(!0);let S={fractalpayPublicKey:f,amount:b,phone_number:D,order_id:n.order_id,action:"request",name:n.name,email:n.email,customer_id:e!=null&&e.customerId?e==null?void 0:e.customerId:"",discount:q,surcharge:Y,tax:O,require_3ds:e==null?void 0:e.require_3ds},g=await Ci.post(`${Me}send-request-pre-auth-payment`,S);(g==null?void 0:g.status)===200&&(he(!0),I(!1),Ee(),Be(g==null?void 0:g.data)),Se(!1)}catch(S){console.log(S),Se(!1)}}},w=Me+"images/logo-img.png",s=S=>{let{value:g}=S.target,Z=S.target.dataset.token;if(u(B(k({},n),{[Z]:g})),Z==="name"&&!gt(g)){T(v=>B(k({},v),{[Z]:tt.onlylettersallowed}));return}let l=se;Z==="email"&&!D&&(delete l.phone,T(l)),g&&(delete l[Z],T(l)),Z==="email"&&!g&&(delete l[Z],T(l))},m=S=>{let{value:g}=S;if(Number(g)>0){let Z=se;delete Z.amount,T(Z)}E(g)},K=()=>{let S={};return b||(S.amount=tt.amountrequired),n.email&&!V(n==null?void 0:n.email)&&(S.email=tt.invalidemail),!D&&!(n!=null&&n.email)&&(S.phone=tt.phoneoremailrequired),!D&&!(n!=null&&n.email)&&(S.email=tt.phoneoremailrequired),!D&&n.email&&!V(n==null?void 0:n.email)&&(S.email=tt.invalidemail),e.from==="merchant"&&!n.order_id&&(S.order_id=tt.orderidrequired),T(S),Object.keys(S).length===0};vi(()=>{e&&(u(S=>B(k({},S),{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:""),ue(e.phone?`${e.phone}`:null))},[e]);let x=S=>{let g=S==null?void 0:S.value;if(g&&(g==null?void 0:g.length)>0&&(g==null?void 0:g.length)!==10){T(l=>B(k({},l),{phone:tt.phonenumberlength})),ue(g);return}else ue(g);let Z=se;delete Z.phone,g&&!(n!=null&&n.email)&&delete Z.email,T(Z)};function p(S){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(S))}return M.createElement(M.Fragment,null,M.createElement(_n,null),M.createElement(Ft,{loading:Qe}),M.createElement(M.Fragment,null,M.createElement("button",{className:"paymentBtn",onClick:Te},"Send Request"),M.createElement("div",{className:"frac-form"},M.createElement($t,{open:Ae,onClose:()=>I(!1),maxWidth:"500px"},M.createElement("div",{className:"request-payment-amount-detail"},M.createElement("p",{className:"request-payment-merchantname"},"Authorization Request"),M.createElement("p",{className:"request-payment-pre-auth-merchantname"},"Pay ",e==null?void 0:e.webname),M.createElement("p",{className:"request-payment-amount"},p(e==null?void 0:e.amount)),(e==null?void 0:e.from)==="merchant"&&M.createElement("p",{className:"request-payment-orderid"},n==null?void 0:n.order_id),M.createElement("span",{className:"request-payment-close-popup",onClick:y},M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},M.createElement("g",{clipPath:"url(#clip0_12425_52336)"},M.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"})),M.createElement("defs",null,M.createElement("clipPath",{id:"clip0_12425_52336"},M.createElement("rect",{width:"16",height:"16",fill:"white"})))))),M.createElement("form",{className:"request-payment-input-form"},M.createElement("div",{className:"request-payment-list-div"},M.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"FULL NAME"),M.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Full Name","data-token":"name",onChange:s,value:n==null?void 0:n.name}),se.name&&M.createElement("small",{className:"request-payment-error-msg"},se.name)),M.createElement("div",{className:"request-payment-list-div"},M.createElement("label",{htmlFor:"requestPhoneNumber",className:"request-payment-input-label"},"Phone Number"),M.createElement(wi,{className:"request-payment-input-box",placeholder:"Mobile number",format:"+1 (###) ###-####",value:D,onValueChange:S=>{x(S)}}),se.phone&&M.createElement("small",{className:"request-payment-error-msg"},se.phone)),M.createElement("div",{className:"request-payment-list-div"},M.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"EMAIL"),M.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Email",onChange:s,"data-token":"email",value:n==null?void 0:n.email}),se.email&&M.createElement("small",{className:"request-payment-error-msg"},se.email)),M.createElement("button",{type:"button",className:"request-payment-submit-button",onClick:xt,disabled:Qe},Qe?"Loading...":"Send Request"),M.createElement("div",{className:"request-payment-fractal-powerd-by"},M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},M.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 ",M.createElement("span",null,"Fractal"),M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}))))),M.createElement($t,{open:h,onClose:W,maxWidth:"500px"},M.createElement("div",{className:"fractal-popup-content",style:{padding:"0px",maxWidth:"500px"}},M.createElement("div",{className:"request-payment-success-container"},M.createElement("span",{className:"request-payment-close-popup",onClick:W},M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},M.createElement("g",{clipPath:"url(#clip0_12425_52336)"},M.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"})),M.createElement("defs",null,M.createElement("clipPath",{id:"clip0_12425_52336"},M.createElement("rect",{width:"16",height:"16",fill:"white"}))))),M.createElement("div",{className:"request-payment-success-tick-div"},M.createElement("div",{className:"request-payment-success-tick"},M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},M.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"})))),M.createElement("h6",{className:"request-payment-success-text"},"The request ",M.createElement("br",null),"was sent"),M.createElement("h6",{className:"request-payment-success-subtext"},"Please wait for the customer to pay"),M.createElement("div",{className:"request-payment-success-btn-div"},M.createElement("button",{onClick:W,className:"request-payment-success-btn2"},"Close"))))))))}import t,{useEffect as ei,useState as Oe}from"react";import ki from"react";function un(){let e="#000",f="#fff",q="#212529",O="#dee2e6";return ki.createElement("style",null,`
|
|
598
|
+
`),Sn=yi;function vi(e){let f=e.merchantPublicKey,q=e==null?void 0:e.discount,O=e==null?void 0:e.tax,Y=e==null?void 0:e.surcharge,[Be,I]=Dt(!1),[Qe,_e]=Dt(!1),[se,T]=Dt({}),[D,ue]=Dt(null),[n,u]=Dt({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:f}),[b,E]=Dt(void 0),[h,fe]=Dt(""),[Q,Te]=Dt(!1),[c,ut]=Dt(null),V=l=>/^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(l),gt=/[+-]?([0-9]*[.])?[0-9]+/,y=l=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(l),qe=l=>/^[A-Za-z\s]*$/.test(l),W=(l,v)=>{let C=(parseFloat(v)||0)/100,ce=l/(1+C);return Math.round(ce*100)/100};Qn(()=>{if(e!=null&&e.pass_fee){let l=W(e==null?void 0:e.amount,e==null?void 0:e.surcharge);E(l)}},[e==null?void 0:e.pass_fee]);let Ee=()=>{I(!1),T({})},Ne=()=>I(!0),xt=()=>{console.log(c,"apiresponse"),s(c),Te(!1)};function w(){u({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:f}),fe("")}function s(l){let v={type:"preview.compiledcheck",other:B(k({},l),{status:!0})};window.parent.postMessage(v,"*")}let m=async()=>{if(!(Object.keys(se).length>0)){if(T({}),!(n!=null&&n.email)&&D&&!V(D)){T(l=>B(k({},l),{phone:tt.phonenumbervalid}));return}if(S())try{_e(!0);let l={fractalpayPublicKey:f,amount:h,phone_number:D,order_id:n.order_id,action:"request",name:n.name,email:n.email,customer_id:e!=null&&e.customerId?e==null?void 0:e.customerId:"",discount:q,surcharge:Y,tax:O,require_3ds:e==null?void 0:e.require_3ds,pass_fee:e==null?void 0:e.pass_fee},v=await xi.post(`${Fe}create-widget-order`,l);(v==null?void 0:v.status)===200&&(Te(!0),I(!1),w(),ut(v==null?void 0:v.data)),_e(!1)}catch(l){console.log(l),_e(!1)}}},K=Fe+"images/logo-img.png",x=l=>{let{value:v}=l.target,C=l.target.dataset.token;if(u(B(k({},n),{[C]:v})),C==="name"&&!qe(v)){T(J=>B(k({},J),{[C]:tt.onlylettersallowed}));return}let ce=se;C==="email"&&!D&&(delete ce.phone,T(ce)),v&&(delete ce[C],T(ce)),C==="email"&&!v&&(delete ce[C],T(ce))},p=l=>{let{value:v}=l;if(Number(v)>0){let C=se;delete C.amount,T(C)}fe(v)},S=()=>{let l={};return h||(l.amount=tt.amountrequired),n.email&&!y(n==null?void 0:n.email)&&(l.email=tt.invalidemail),!D&&!(n!=null&&n.email)&&(l.phone=tt.phoneoremailrequired),!D&&!(n!=null&&n.email)&&(l.email=tt.phoneoremailrequired),!D&&n.email&&!y(n==null?void 0:n.email)&&(l.email=tt.invalidemail),e.from==="merchant"&&!n.order_id&&(l.order_id=tt.orderidrequired),T(l),Object.keys(l).length===0};Qn(()=>{e&&(u(l=>B(k({},l),{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:""})),fe(e.amount?e.amount:""),ue(e.phone?`${e.phone}`:null))},[e]);let g=l=>{let v=l==null?void 0:l.value;if(v&&(v==null?void 0:v.length)>0&&(v==null?void 0:v.length)!==10){T(ce=>B(k({},ce),{phone:tt.phonenumberlength})),ue(v);return}else ue(v);let C=se;delete C.phone,v&&!(n!=null&&n.email)&&delete C.email,T(C)};function Z(l){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(l))}return _.createElement(_.Fragment,null,_.createElement(Sn,null),_.createElement(Ft,{loading:Qe}),_.createElement(_.Fragment,null,_.createElement("button",{className:"paymentBtn",onClick:Ne},"Request Payment"),_.createElement($t,{open:Be,onClose:()=>I(!1),maxWidth:"500px"},_.createElement("div",{style:{maxWidth:"500px"}},_.createElement("div",{className:"request-payment-amount-detail frac-form"},_.createElement("p",{className:"request-payment-merchantname"},"Pay ",e==null?void 0:e.webname),_.createElement("p",{className:"request-payment-amount"},Z(e==null?void 0:e.amount)),b&&b>0&&_.createElement("div",{className:"frac-req-cash-discount"},_.createElement("div",{className:"frac-cashlabel"},"Cash Discount :"),_.createElement("div",null,"$",b.toFixed(2))),(e==null?void 0:e.from)==="merchant"&&_.createElement("p",{className:"request-payment-orderid"},n==null?void 0:n.order_id),_.createElement("span",{className:"request-payment-close-popup",onClick:Ee},_.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},_.createElement("g",{clipPath:"url(#clip0_12425_52336)"},_.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"})),_.createElement("defs",null,_.createElement("clipPath",{id:"clip0_12425_52336"},_.createElement("rect",{width:"16",height:"16",fill:"white"})))))),_.createElement("form",{className:"request-payment-input-form"},_.createElement("div",{className:"request-payment-list-div"},_.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"FULL NAME"),_.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Full Name","data-token":"name",onChange:x,value:n==null?void 0:n.name}),se.name&&_.createElement("small",{className:"request-payment-error-msg"},se.name)),_.createElement("div",{className:"request-payment-list-div"},_.createElement("label",{htmlFor:"requestPhoneNumber",className:"request-payment-input-label"},"Phone Number"),_.createElement(bi,{className:"request-payment-input-box",placeholder:"Mobile number",format:"+1 (###) ###-####",value:D,onValueChange:l=>{g(l)}}),se.phone&&_.createElement("small",{className:"request-payment-error-msg"},se.phone)),_.createElement("div",{className:"request-payment-list-div"},_.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"EMAIL"),_.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Email",onChange:x,"data-token":"email",value:n==null?void 0:n.email}),se.email&&_.createElement("small",{className:"request-payment-error-msg"},se.email)),_.createElement("button",{type:"button",className:"request-payment-submit-button",onClick:m,disabled:Qe},Qe?"Loading...":"Send Request"),_.createElement("div",{className:"request-payment-fractal-powerd-by"},_.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},_.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 ",_.createElement("span",null,"Fractal"),_.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"}),_.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"})))))),_.createElement($t,{open:Q,onClose:xt,maxWidth:"500px"},_.createElement("div",{className:"fractal-popup-content",style:{padding:"0px",maxWidth:"500px"}},_.createElement("div",{className:"request-payment-success-container"},_.createElement("span",{className:"request-payment-close-popup",onClick:xt},_.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},_.createElement("g",{clipPath:"url(#clip0_12425_52336)"},_.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"})),_.createElement("defs",null,_.createElement("clipPath",{id:"clip0_12425_52336"},_.createElement("rect",{width:"16",height:"16",fill:"white"}))))),_.createElement("div",{className:"request-payment-success-tick-div"},_.createElement("div",{className:"request-payment-success-tick"},_.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},_.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"})))),_.createElement("h6",{className:"request-payment-success-text"},"The request ",_.createElement("br",null),"was sent"),_.createElement("h6",{className:"request-payment-success-subtext"},"Please wait for the customer to pay"),_.createElement("div",{className:"request-payment-success-btn-div"},_.createElement("button",{onClick:xt,className:"request-payment-success-btn2"},"Close")))))))}import"bootstrap/dist/js/bootstrap.bundle.min.js";import M,{useState as en,useEffect as Ci}from"react";import wi from"axios";import{PatternFormat as Ni}from"react-number-format";function ki(e){let f=e.merchantPublicKey,q=e==null?void 0:e.discount,O=e==null?void 0:e.tax,Y=e==null?void 0:e.surcharge,[Be,I]=en(!1),[Qe,_e]=en(!1),[se,T]=en({}),[D,ue]=en(null),[n,u]=en({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:f}),[b,E]=en(""),[h,fe]=en(!1),[Q,Te]=en(null),c=S=>/^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(S),ut=/[+-]?([0-9]*[.])?[0-9]+/,V=S=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(S),gt=S=>/^[A-Za-z\s]*$/.test(S),y=()=>{I(!1),T({})},qe=()=>I(!0),W=()=>{console.log(Q,"apiresponse"),Ne(Q),fe(!1)};function Ee(){u({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:f}),E("")}function Ne(S){let g={type:"preview.compiledcheck",other:B(k({},S),{status:!0})};window.parent.postMessage(g,"*")}let xt=async()=>{if(!(Object.keys(se).length>0)){if(T({}),!(n!=null&&n.email)&&D&&!c(D)){T(S=>B(k({},S),{phone:tt.phonenumbervalid}));return}if(K())try{_e(!0);let S={fractalpayPublicKey:f,amount:b,phone_number:D,order_id:n.order_id,action:"request",name:n.name,email:n.email,customer_id:e!=null&&e.customerId?e==null?void 0:e.customerId:"",discount:q,surcharge:Y,tax:O,require_3ds:e==null?void 0:e.require_3ds},g=await wi.post(`${Fe}send-request-pre-auth-payment`,S);(g==null?void 0:g.status)===200&&(fe(!0),I(!1),Ee(),Te(g==null?void 0:g.data)),_e(!1)}catch(S){console.log(S),_e(!1)}}},w=Fe+"images/logo-img.png",s=S=>{let{value:g}=S.target,Z=S.target.dataset.token;if(u(B(k({},n),{[Z]:g})),Z==="name"&&!gt(g)){T(v=>B(k({},v),{[Z]:tt.onlylettersallowed}));return}let l=se;Z==="email"&&!D&&(delete l.phone,T(l)),g&&(delete l[Z],T(l)),Z==="email"&&!g&&(delete l[Z],T(l))},m=S=>{let{value:g}=S;if(Number(g)>0){let Z=se;delete Z.amount,T(Z)}E(g)},K=()=>{let S={};return b||(S.amount=tt.amountrequired),n.email&&!V(n==null?void 0:n.email)&&(S.email=tt.invalidemail),!D&&!(n!=null&&n.email)&&(S.phone=tt.phoneoremailrequired),!D&&!(n!=null&&n.email)&&(S.email=tt.phoneoremailrequired),!D&&n.email&&!V(n==null?void 0:n.email)&&(S.email=tt.invalidemail),e.from==="merchant"&&!n.order_id&&(S.order_id=tt.orderidrequired),T(S),Object.keys(S).length===0};Ci(()=>{e&&(u(S=>B(k({},S),{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:""),ue(e.phone?`${e.phone}`:null))},[e]);let x=S=>{let g=S==null?void 0:S.value;if(g&&(g==null?void 0:g.length)>0&&(g==null?void 0:g.length)!==10){T(l=>B(k({},l),{phone:tt.phonenumberlength})),ue(g);return}else ue(g);let Z=se;delete Z.phone,g&&!(n!=null&&n.email)&&delete Z.email,T(Z)};function p(S){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(S))}return M.createElement(M.Fragment,null,M.createElement(Sn,null),M.createElement(Ft,{loading:Qe}),M.createElement(M.Fragment,null,M.createElement("button",{className:"paymentBtn",onClick:qe},"Send Request"),M.createElement("div",{className:"frac-form"},M.createElement($t,{open:Be,onClose:()=>I(!1),maxWidth:"500px"},M.createElement("div",{className:"request-payment-amount-detail"},M.createElement("p",{className:"request-payment-merchantname"},"Authorization Request"),M.createElement("p",{className:"request-payment-pre-auth-merchantname"},"Pay ",e==null?void 0:e.webname),M.createElement("p",{className:"request-payment-amount"},p(e==null?void 0:e.amount)),(e==null?void 0:e.from)==="merchant"&&M.createElement("p",{className:"request-payment-orderid"},n==null?void 0:n.order_id),M.createElement("span",{className:"request-payment-close-popup",onClick:y},M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},M.createElement("g",{clipPath:"url(#clip0_12425_52336)"},M.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"})),M.createElement("defs",null,M.createElement("clipPath",{id:"clip0_12425_52336"},M.createElement("rect",{width:"16",height:"16",fill:"white"})))))),M.createElement("form",{className:"request-payment-input-form"},M.createElement("div",{className:"request-payment-list-div"},M.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"FULL NAME"),M.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Full Name","data-token":"name",onChange:s,value:n==null?void 0:n.name}),se.name&&M.createElement("small",{className:"request-payment-error-msg"},se.name)),M.createElement("div",{className:"request-payment-list-div"},M.createElement("label",{htmlFor:"requestPhoneNumber",className:"request-payment-input-label"},"Phone Number"),M.createElement(Ni,{className:"request-payment-input-box",placeholder:"Mobile number",format:"+1 (###) ###-####",value:D,onValueChange:S=>{x(S)}}),se.phone&&M.createElement("small",{className:"request-payment-error-msg"},se.phone)),M.createElement("div",{className:"request-payment-list-div"},M.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"EMAIL"),M.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Email",onChange:s,"data-token":"email",value:n==null?void 0:n.email}),se.email&&M.createElement("small",{className:"request-payment-error-msg"},se.email)),M.createElement("button",{type:"button",className:"request-payment-submit-button",onClick:xt,disabled:Qe},Qe?"Loading...":"Send Request"),M.createElement("div",{className:"request-payment-fractal-powerd-by"},M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},M.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 ",M.createElement("span",null,"Fractal"),M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}),M.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"}))))),M.createElement($t,{open:h,onClose:W,maxWidth:"500px"},M.createElement("div",{className:"fractal-popup-content",style:{padding:"0px",maxWidth:"500px"}},M.createElement("div",{className:"request-payment-success-container"},M.createElement("span",{className:"request-payment-close-popup",onClick:W},M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},M.createElement("g",{clipPath:"url(#clip0_12425_52336)"},M.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"})),M.createElement("defs",null,M.createElement("clipPath",{id:"clip0_12425_52336"},M.createElement("rect",{width:"16",height:"16",fill:"white"}))))),M.createElement("div",{className:"request-payment-success-tick-div"},M.createElement("div",{className:"request-payment-success-tick"},M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},M.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"})))),M.createElement("h6",{className:"request-payment-success-text"},"The request ",M.createElement("br",null),"was sent"),M.createElement("h6",{className:"request-payment-success-subtext"},"Please wait for the customer to pay"),M.createElement("div",{className:"request-payment-success-btn-div"},M.createElement("button",{onClick:W,className:"request-payment-success-btn2"},"Close"))))))))}import t,{useEffect as ti,useState as Oe}from"react";import _i from"react";function gn(){let e="#000",f="#fff",q="#212529",O="#dee2e6";return _i.createElement("style",null,`
|
|
599
599
|
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
|
|
600
600
|
body
|
|
601
601
|
{
|
|
@@ -1262,7 +1262,7 @@ var ai=Object.defineProperty,oi=Object.defineProperties;var ri=Object.getOwnProp
|
|
|
1262
1262
|
justify-content: space-between;
|
|
1263
1263
|
min-height: auto;
|
|
1264
1264
|
}
|
|
1265
|
-
`)}import
|
|
1265
|
+
`)}import dn from"axios";import Ie from"react";import Si from"react";function Tn(){return Si.createElement("style",null,`
|
|
1266
1266
|
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
|
|
1267
1267
|
|
|
1268
1268
|
body{
|
|
@@ -1457,7 +1457,7 @@ var ai=Object.defineProperty,oi=Object.defineProperties;var ri=Object.getOwnProp
|
|
|
1457
1457
|
gap: 6px;
|
|
1458
1458
|
background-color: #161616;
|
|
1459
1459
|
color: #fff;
|
|
1460
|
-
}`)}function tn(e,f,q){e.preventDefault();let Y={type:"preview.compiledcheck",other:{msg:"Payment success!",status:f==="close",data:{tran_id:q,key:f}}};console.log("message:",Y),window.parent.postMessage(Y,"*")}function
|
|
1460
|
+
}`)}function tn(e,f,q){e.preventDefault();let Y={type:"preview.compiledcheck",other:{msg:"Payment success!",status:f==="close",data:{tran_id:q,key:f}}};console.log("message:",Y),window.parent.postMessage(Y,"*")}function fn({onClose:e,tranId:f}){return Ie.createElement(Ie.Fragment,null,Ie.createElement(Tn,null),Ie.createElement("div",{className:"payment-msg-container"},Ie.createElement("div",{className:"charge-payment-success-container"},Ie.createElement("div",{className:"charge-payment-success-tick-div"},Ie.createElement("div",{className:"charge-payment-success-tick"},Ie.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},Ie.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"})))),Ie.createElement("h6",{className:"charge-payment-success-text"},"Your charge",Ie.createElement("br",null),"was successful"),Ie.createElement("h6",{className:"charge-payment-success-subtext"},"We\u2019ve processed your charge"),Ie.createElement("div",{className:"charge-success-payment-button-div"},Ie.createElement("button",{className:"charge-success-btn1",onClick:q=>tn(q,"print",f)},Ie.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},Ie.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"}),Ie.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"),Ie.createElement("button",{className:"charge-success-btn1",onClick:q=>tn(q,"share",f)},Ie.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},Ie.createElement("g",{clipPath:"url(#clip0_12420_50683)"},Ie.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"})),Ie.createElement("defs",null,Ie.createElement("clipPath",{id:"clip0_12420_50683"},Ie.createElement("rect",{width:"16",height:"16",fill:"white",transform:"translate(0.5)"})))),"Send receipt"))),Ie.createElement("div",{className:"charge-payment-success-btn-div"},Ie.createElement("button",{className:"charge-payment-success-btn1",onClick:q=>tn(q,"tran",f)},"Go to Transactions"),Ie.createElement("button",{className:"charge-payment-success-btn2",onClick:q=>{e(),tn(q,"close",f)}},"Close"))))}import xn from"sweetalert2";import{IoArrowBack as Mn}from"react-icons/io5";import{useEffect as Dn}from"react";function Ht(){return Dn(()=>{let e=an;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=q=>{console.error("\u274C Failed to load Datacap script",q)},document.head.appendChild(f)}}},[]),Dn(()=>{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 Bt from"react";import Fi from"react";function qn(){return Fi.createElement("style",null,`
|
|
1461
1461
|
.card-error .logo-container {
|
|
1462
1462
|
display: flex;
|
|
1463
1463
|
justify-content: center;
|
|
@@ -1562,7 +1562,7 @@ var ai=Object.defineProperty,oi=Object.defineProperties;var ri=Object.getOwnProp
|
|
|
1562
1562
|
padding:10px 17px;
|
|
1563
1563
|
cursor:pointer;
|
|
1564
1564
|
}
|
|
1565
|
-
`)}var
|
|
1565
|
+
`)}var Mi=({onClose:e,error:f})=>Bt.createElement(Bt.Fragment,null,Bt.createElement(qn,null),Bt.createElement("div",{className:"card-error"},Bt.createElement("div",{className:"payment-error-container"},Bt.createElement("div",{className:"error-icon"},Bt.createElement("div",{className:"circle"},Bt.createElement("i",{className:"fa fa-times","aria-hidden":"true"})),Bt.createElement("div",{className:"error-text"},Bt.createElement("div",{className:"payment-error-text"},f),Bt.createElement("div",{className:"thank-you-text"},"Try again later ")),Bt.createElement("div",{className:"error-btn-div"},Bt.createElement("button",{onClick:e},"OK")))))),Et=Mi;import{io as Pi}from"socket.io-client";var Li=Pi(Fe,{transports:["websocket"],withCredentials:!1}),Mt=Li;var $n=e=>{try{let f=JSON.parse(e);return typeof f=="object"&&f!==null}catch(f){return!1}},Fn=[{value:"personal saving",label:"Personal Saving"},{value:"business saving",label:"Business Saving"},{value:"personal checking",label:"Personal Checking"},{value:"business checking",label:"Business Checking"}];function on(e){let f=Number(e);return isNaN(f)?`$${e}`:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(f)}var zi=R+"widget/mc-img.svg",Ii=R+"widget/visa-img.svg",Ai=R+"widget/ae-img.svg",Bi=R+"widget/discover-img.svg",hn=R+"widget/card.svg",Ti=R+"widget/bank.svg",vo=R+"widget/Trash.svg",Co=R+"widget/secure-img.png",wo=R+"widget/pov-by.png",No=R+"widget/pax.svg",Rn=R+"widget/Bank _New.svg",ei=e=>{switch(e==null?void 0:e.toLowerCase()){case"visa":return Ii;case"mastercard":case"mc":case"m/c":return zi;case"amex":case"american express":case"ae":return Ai;case"discover":case"dcvr":return Bi;case"bank":return Ti;default:return hn}};import Zt from"react";var sn=e=>Zt.createElement(Zt.Fragment,null,Zt.createElement("div",{className:`frac-card-bank-radio ${e.activetab===e.value?"frac-active":""}`,onClick:()=>e.onChange(e.value),role:"radio"},Zt.createElement("div",{className:"frac-card-title-main"},Zt.createElement("img",{src:e.label.toLowerCase()==="card"?hn:Rn,className:"frac-payment-type-logo",alt:""}),Zt.createElement("div",{className:"frac-card-label"},Zt.createElement("div",{className:"frac-card-label-text"},e.label),Zt.createElement("div",{className:"frac-card-label-amount"},on(e.amount)))),Zt.createElement("div",null,Zt.createElement("input",{name:"paymenttype",checked:e.activetab===e.value,type:"radio",value:e.value,onChange:f=>{e.onChange(f.target.value)}}))));import qi from"react";function yn({}){return qi.createElement("style",null,`
|
|
1566
1566
|
.frac-card-bank-radio-main{
|
|
1567
1567
|
display: flex;
|
|
1568
1568
|
flex-direction: column;
|
|
@@ -1632,7 +1632,7 @@ var ai=Object.defineProperty,oi=Object.defineProperties;var ri=Object.getOwnProp
|
|
|
1632
1632
|
.frac-card-bank-radio.frac-active {
|
|
1633
1633
|
background: #F6F6F7;
|
|
1634
1634
|
}
|
|
1635
|
-
`)}import pt from"react";var sn=({listHeading:e="Card",ListItems:f,selectedCard:q,setSelectedCard:O,paymentGateway:Y,handleDeleteCard:Ae,otherButtonAction:I,otherButtonLabel:Qe,headingClass:Se})=>{let se=R+"widget/Trash.svg";return console.log(q,"selectedCard another",f),pt.createElement(pt.Fragment,null,pt.createElement("h6",{className:Se||"card-ach-heading",style:{marginBottom:"10px !important"}},e),pt.createElement("div",{className:"card-lint-div-in"},pt.createElement("div",{className:"card-list-div"},f&&(f==null?void 0:f.length)>0&&(f==null?void 0:f.map((T,D)=>{let ue=!1;return Y&&(ue=Y!=(T==null?void 0:T.payment_method_type)&&(T==null?void 0:T.card_type)!="Bank"),pt.createElement("div",{key:T==null?void 0:T.id,className:"card-list-single-div"},pt.createElement("div",{className:"card-number-radio"},pt.createElement("input",{disabled:ue,type:"radio",className:"cardRadio",name:"selected_card",id:"",checked:(q==null?void 0:q.id)===(T==null?void 0:T.id),onChange:n=>O(T)}),pt.createElement("label",{htmlFor:"",className:"card-number-last-four"},"**** ",T==null?void 0:T.cardlastfourdigit),(T==null?void 0:T.card_type)!="Bank"&&pt.createElement("h6",{className:"card-expiry-date"},T==null?void 0:T.expmonth,"/",T==null?void 0:T.expyear)),pt.createElement("div",{className:"card-number-radio"},pt.createElement("span",{className:"visa-card"},pt.createElement("img",{src:Rn(T==null?void 0:T.card_type),alt:""})),pt.createElement("span",{className:"visa-card",style:{cursor:"pointer"},onClick:()=>Ae(T==null?void 0:T.id)},pt.createElement("img",{src:se,alt:""}))))}))),pt.createElement("div",{className:"pay-with-other-card",onClick:I},Qe,pt.createElement("img",{src:fn,alt:""}))))};function qi(e){var zt,_t,We,Ce,Re,at,Vt,Je,Kt,St,He,et,Ut,qt,Gt,mt,Ot,nn;let[f,q]=Oe(!1),[O,Y]=Oe(!1),[Ae,I]=Oe(""),[Qe,Se]=Oe(!1),[se,T]=Oe(!1),[D,ue]=Oe("card"),[n,u]=Oe("card"),[b,E]=Oe("form"),[h,he]=Oe("form"),[Q,Be]=Oe(!0),[c,ut]=Oe(!1),[V,gt]=Oe(!1),y=e.merchantPublicKey,Te=R+"widget/mc-img.svg",W=R+"widget/visa-img.svg",Ee=R+"widget/ae-img.svg",ke=R+"widget/discover-img.svg",xt=R+"widget/card.svg",w=R+"widget/Trash.svg",s=R+"widget/bank.svg",m=R+"widget/secure-img.png",K=R+"widget/pov-by.png",x=R+"widget/pax.svg",[p,S]=Oe(),[g,Z]=Oe({}),[l,v]=Oe(),[C,me]=Oe({}),[J,De]=Oe([]),[ft,ot]=Oe([]),[Ue,Lt]=Oe(),[rt,st]=Oe(),[ve,Ze]=Oe(Number(e==null?void 0:e.amount));console.log(Ue,"selectedCard");let[$,nt]=Oe(),[qe,lt]=Oe(""),ht=()=>q(!0),Yt=()=>q(!1),Wt=(F,d)=>{let j=(parseFloat(d)||0)/100,_e=F/(1+j);return Math.round(_e*100)/100};ei(()=>{if(se){let F=Wt(e==null?void 0:e.amount,(e==null?void 0:e.surcharge)||0);Ze(F)}},[se,e==null?void 0:e.pass_fee,e==null?void 0:e.amount,e==null?void 0:e.surcharge]);let N=()=>{T(!1),ue("card"),I(""),Se(!1),lt(""),v({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),me({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),S({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),Z({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),gt(!1),ut(!1),Lt({card_type:"",cardlastfourdigit:"",expmonth:1,expyear:2025,primary_card:0,firstname:"",id:"",lastname:""}),st({}),Ze(0),u("card"),Be(!0),he("form"),E("form"),Y(!1),q(!1),ot([]),De([])},L=()=>T(!0),de=F=>{ue(F)},ce=(F,d)=>{let j=F;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(j)){(d===""||/^[0-9]+$/.test(d))&&(Z(ee=>B(k({},ee),{[j]:""})),S(ee=>B(k({},ee),{[j]:d})));return}Z(ee=>B(k({},ee),{[j]:""})),S(ee=>B(k({},ee),{[j]:d}))},le=F=>{let j=F.target.value.replace(/\D/g,""),_e="";/^3[47]/.test(j)?_e=j.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(je,ge,Pe,r)=>[ge,Pe,r].filter(Boolean).join(" ")):_e=j.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(je,ge,Pe,r,o)=>[ge,Pe,r,o].filter(Boolean).join(" ")),Z(ee=>B(k({},ee),{cardNumber:""})),S(ee=>B(k({},ee),{cardNumber:_e}))},$e=F=>{let{name:d,value:j}=F.target,_e=["routingNumber","accountNumber","confirmAccountNumber"];if(d=="name"){/^[a-zA-Z\s]*$/.test(j)&&(me(ee=>B(k({},ee),{[d]:""})),v(ee=>B(k({},ee),{[d]:j})));return}if(_e.includes(d)){(j===""||/^[0-9]+$/.test(j))&&(me(ee=>B(k({},ee),{[d]:""})),v(ee=>B(k({},ee),{[d]:j})));return}me(ee=>B(k({},ee),{[d]:""})),v(ee=>B(k({},ee),{[d]:j}))},Ye=()=>{var ee,je,ge,Pe,r,o;let F={},d=p,j=parseInt((d==null?void 0:d.expiryMonth)||"",10),_e=(d==null?void 0:d.expiryYear)||"";if((ee=d==null?void 0:d.cardName)!=null&&ee.trim()||(F.cardName="Card name is required"),(je=d==null?void 0:d.cardNumber)!=null&&je.trim()||(F.cardNumber="Card number is required"),(!((ge=d==null?void 0:d.expiryMonth)!=null&&ge.trim())||!((Pe=d==null?void 0:d.expiryYear)!=null&&Pe.trim())||isNaN(j)||j<1||j>12||_e.length!==4)&&(F.expiryMonth="Invalid Expiration Date."),(r=d==null?void 0:d.cvv)!=null&&r.trim()||(F.cvv="CVV is required"),(o=d==null?void 0:d.zipCode)!=null&&o.trim()||(F.zipCode="ZIP code is required"),d!=null&&d.expiryMonth&&(d!=null&&d.expiryYear)&&d.expiryMonth.length<=2&&d.expiryYear.length===4){let z=parseInt(d.expiryMonth,10),H=parseInt(d.expiryYear,10),A=new Date,ne=A.getMonth()+1,G=A.getFullYear();(H<G||H===G&&z<ne)&&(F.expiryMonth="Card is expired")}return Z(F),Object.keys(F).length>0},X=()=>{var j,_e,ee,je,ge,Pe,r,o;let F={},d=l;return(j=d==null?void 0:d.name)!=null&&j.trim()||(F.name="Name is required"),(_e=d==null?void 0:d.accountNumber)!=null&&_e.trim()||(F.accountNumber="Account number is required"),(ee=d==null?void 0:d.accountNumber)!=null&&ee.trim()&&((je=d==null?void 0:d.accountNumber)==null?void 0:je.trim())!==((ge=d==null?void 0:d.confirmAccountNumber)==null?void 0:ge.trim())&&(F.confirmAccountNumber="Account numbers must match"),(Pe=d==null?void 0:d.bankName)!=null&&Pe.trim()||(F.bankName="Bank name is required"),(r=d==null?void 0:d.routingNumber)!=null&&r.trim()||(F.routingNumber="Routing Number is required"),d!=null&&d.routingNumber&&((o=d==null?void 0:d.routingNumber)==null?void 0:o.length)!==9&&(F.routingNumber="Routing number must be 9 digits"),((d==null?void 0:d.accountType)==="business saving"||(d==null?void 0:d.accountType)==="business checking")&&(!(d!=null&&d.companyName)||(d==null?void 0:d.companyName)==="")&&(F.companyName="Company Name is required for business accounts"),me(F),Object.keys(F).length>0},Ge=async F=>{var d,j,_e,ee,je,ge,Pe,r,o,z,H,A,ne,G,oe,te;if(F.preventDefault(),D!=="ach"){if(Ye())return;{let ie=DatacapWebToken.validateCardNumber(p==null?void 0:p.cardNumber.replaceAll(" ","")),fe=DatacapWebToken.validateExpirationDate(p==null?void 0:p.expiryMonth,p==null?void 0:p.expiryYear),Ke=DatacapWebToken.validateCVV(p==null?void 0:p.cvv),we={};if(ie||(we.cardNumber="Invalid card Number"),fe||(we.expiryMonth="Invalid Expiration Date."),Ke||(we.cvv="Invalid CVV"),Z(we),ie&&Ke&&fe){Y(!0);try{let pe=B(k({},p),{amount:`${e.amount||0}`,fractalpayPublicKey:y,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,pass_fee:e==null?void 0:e.pass_fee}),Fe=await ln.post(`${Me}create-widget-order`,pe),U=async function(Le){if(Le.Error)I(Le.Error),Y(!1);else{let Ie=p==null?void 0:p.cardName,ct=p==null?void 0:p.zipCode;Le.name=Ie,Le.postal_code=ct,Le.isCardSave=`${c}`,Le.isCharge=!0,Le.posSalesIdEncode=Fe==null?void 0:Fe.data.data.posSalesIdEncode,Mt.emit("sendMessage",Le),Mt.on(Fe==null?void 0:Fe.data.data.posSalesIdEncode,Ve=>{if(qn(Ve==null?void 0:Ve.data)){let Ne=JSON.parse(Ve.data);Ne!=null&&Ne.result?(S({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),ut(!1),lt(Ne==null?void 0:Ne.transactionId),Se(!0),Y(!1)):(Y(!1),I((Ne==null?void 0:Ne.message)||"Something went wrong."))}else I("Something went wrong.")})}};if(($==null?void 0:$.paymentGateway)===32){let Le={method:"POST",redirect:"follow"};try{let Ie=await ln.post(`${be}api/v1/widget/generate-session`,Le),ct=Number(p==null?void 0:p.expiryYear)%100,Ve=p==null?void 0:p.cardNumber;Ve=Ve==null?void 0:Ve.replace(/\s+/g,"");let Ne=`${Ve}=${ct}${p==null?void 0:p.expiryMonth} ${p==null?void 0:p.cvv}`,Pn=forge.pki.publicKeyFromPem((j=(d=Ie==null?void 0:Ie.data)==null?void 0:d.data)==null?void 0:j.publicKeyPem).encrypt(Ne,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),Ln=forge.util.encode64(Pn),zn={"Content-Type":"application/json","x-app-session-key":(ee=(_e=Ie.data)==null?void 0:_e.data)==null?void 0:ee.session_key},Rt=JSON.stringify({enc_track2_data:`${Ln}`,algorithm:"RSAES_OAEP_SHA_1",session_key:`${(ge=(je=Ie==null?void 0:Ie.data)==null?void 0:je.data)==null?void 0:ge.session_key}`});try{let Ct=await ln.post(`${wt}tokenizer/tokenize`,Rt,{headers:zn}),It=JSON.stringify(B(k({},(Pe=Ct==null?void 0:Ct.data)==null?void 0:Pe.data),{isSaveCardChecked:c,name:p==null?void 0:p.cardName,postal_code:p==null?void 0:p.zipCode,customer_id:e==null?void 0:e.customerId})),Jt=JSON.stringify({pre_sales_id:`${(o=(r=Fe==null?void 0:Fe.data)==null?void 0:r.data)==null?void 0:o.posSalesIdEncode}`,token:`${(z=Ct==null?void 0:Ct.data)==null?void 0:z.data.token}`,json_response:`${It}`}),An={method:"POST",headers:JSON.stringify({"Content-Type":"application/json"}),body:Jt,redirect:"follow",isChargeviafractal:!0};Mt.emit("sendMessage",An),Mt.on("chargeviafractalgateway",At=>{var On;if(qn(At==null?void 0:At.data)){let Xt=JSON.parse(At==null?void 0:At.data);Xt!=null&&Xt.result?(lt((On=Xt==null?void 0:Xt.data)==null?void 0:On.transactionId),Se(!0),Y(!1)):(Y(!1),I((Xt==null?void 0:Xt.message)||"Something went wrong."))}else I("Something went wrong.")})}catch(Ct){Y(!1),I(((A=(H=Ct==null?void 0:Ct.response)==null?void 0:H.data)==null?void 0:A.message)||(Ct==null?void 0:Ct.message)||"Something went wrong.")}}catch(Ie){Y(!1),I(((G=(ne=Ie==null?void 0:Ie.response)==null?void 0:ne.data)==null?void 0:G.message)||(Ie==null?void 0:Ie.message)||"Something went wrong.")}}else typeof DatacapWebToken!="undefined"&&DatacapWebToken.requestToken(Fe==null?void 0:Fe.data.data.dctoken,"PaymentForm",U)}catch(pe){Y(!1),I(((te=(oe=pe==null?void 0:pe.response)==null?void 0:oe.data)==null?void 0:te.message)||(pe==null?void 0:pe.message)||"Something went wrong.")}}}}else{if(X())return;{Y(!0);let ie={fractalpayPublicKey:y,label:(l==null?void 0:l.name)||"John Doe",account_number:l==null?void 0:l.accountNumber,routing_number:l==null?void 0:l.routingNumber,bank_name:l==null?void 0:l.bankName,account_type:l==null?void 0:l.accountType,amount:String(ve||0),isSaveAch:V,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,company_name:(l==null?void 0:l.companyName)||""};Mt.emit("sendMessage",ie),Mt.on("ach-incoming",fe=>{var Ke;(fe==null?void 0:fe.status)=="Failed"?typeof(fe==null?void 0:fe.message)=="object"?Object.values(fe==null?void 0:fe.message).forEach(we=>{I(we||"Something went wrong")}):I((fe==null?void 0:fe.message)||"Something went wrong"):(lt((Ke=fe==null?void 0:fe.data)==null?void 0:Ke.transaction_id),Se(!0),Y(!1))})}}},it=async()=>{var F,d,j,_e,ee,je,ge,Pe,r,o,z,H,A,ne,G,oe,te,ae,ie,fe,Ke,we,pe;ht();try{let Fe={fractalpayPublicKey:y,customer_id:e==null?void 0:e.customerId,pass_fee:e==null?void 0:e.pass_fee},U=await ln.post(`${Me}get-payment-details`,Fe);if(nt((F=U==null?void 0:U.data)==null?void 0:F.data),(j=(d=U==null?void 0:U.data)==null?void 0:d.data)!=null&&j.paymentGateway||(N(),I("Something went wrong.")),(ee=(_e=U==null?void 0:U.data)==null?void 0:_e.data)!=null&&ee.card_list&&((Pe=(ge=(je=U==null?void 0:U.data)==null?void 0:je.data)==null?void 0:ge.card_list)==null?void 0:Pe.length)>0){let Le=(z=(o=(r=U==null?void 0:U.data)==null?void 0:r.data)==null?void 0:o.card_list)==null?void 0:z.filter(ct=>(ct==null?void 0:ct.card_type)=="Bank"),Ie=(ne=(A=(H=U==null?void 0:U.data)==null?void 0:H.data)==null?void 0:A.card_list)==null?void 0:ne.filter(ct=>(ct==null?void 0:ct.card_type)!=="Bank");console.log(Le,"hohgohoo",Ie),(Ie==null?void 0:Ie.length)>0&&E("list"),(Le==null?void 0:Le.length)>0&&he("list"),De(Ie),ot(Le)}else ue("card");(oe=(G=U==null?void 0:U.data)==null?void 0:G.data)!=null&&oe.paymentDeviceList&&((ie=(ae=(te=U==null?void 0:U.data)==null?void 0:te.data)==null?void 0:ae.paymentDeviceList)==null?void 0:ie.length)>0&&st((Ke=(fe=U==null?void 0:U.data)==null?void 0:fe.data)==null?void 0:Ke.paymentDeviceList[0]),Yt()}catch(Fe){console.log(Fe),Yt(),I(((pe=(we=Fe==null?void 0:Fe.response)==null?void 0:we.data)==null?void 0:pe.message)||(Fe==null?void 0:Fe.message)||"Something went wrong")}},Nt=async()=>{let F=e==null?void 0:e.customerId,d=String(e==null?void 0:e.discount),j=String(e==null?void 0:e.surcharge),_e=String(e==null?void 0:e.tax),ee=e==null?void 0:e.merchantPublicKey,je=e==null?void 0:e.orderID,ge=String(e==null?void 0:e.amount),Pe=Ue==null?void 0:Ue.id,r=Ue==null?void 0:Ue.card_type;if(ee&&je&&ge&&ve)if(F)if(Pe){let z={amount:r==="Bank"?ve:ge,order_id:je,customer_id:F,card_id:Pe,fractalpayPublicKey:ee,isCardSave:c,discount:d,surcharge:j,tax:_e},o=z,{isCardSave:H}=o,A=kn(o,["isCardSave"]),G=Me+(r==="Bank"?"charge-ach":"charge-by-card"),oe={"Content-Type":"application/json"};Y(!0),Mt.emit("sendMessage",{url:G,body:r=="Bank"?A:z,isChargebycard:!0}),Mt.on("charge-by-card",te=>{var ae;(te==null?void 0:te.result)==!0||(te==null?void 0:te.status)==!0?(lt((ae=te.data)==null?void 0:ae.transaction_id),Se(!0),Y(!1)):I((te==null?void 0:te.message)||"Something went wrong.")})}else I("Please Select A Card/ACH");else I("Please Select Customer");else I("Something went wrong.")},bt=async()=>{var ee,je,ge,Pe,r,o;let F=e==null?void 0:e.merchantPublicKey,d=e==null?void 0:e.orderID,j=String(e==null?void 0:e.amount),_e=e==null?void 0:e.customerId;if(!(rt!=null&&rt.device_id)){I("Please Select A Payment Device");return}if(F&&d&&j){Y(!0);let z={amount:j,fractalpayPublicKey:F,customer_order_id:d,device_id:rt==null?void 0:rt.device_id,customer_id:_e||""};try{let H=await ln.post(`${Me}charge-with-reader`,z);((ee=H==null?void 0:H.data)==null?void 0:ee.result)==!0?(lt((ge=(je=H==null?void 0:H.data)==null?void 0:je.data)==null?void 0:ge.transaction_id),Se(!0),Y(!1)):(I(((Pe=H==null?void 0:H.data)==null?void 0:Pe.message)||"Something went wrong."),Y(!1))}catch(H){I(((o=(r=H==null?void 0:H.response)==null?void 0:r.data)==null?void 0:o.message)||"Something went wrong."),Y(!1)}}else I("Something went wrong.")},dt=()=>{n==="card"?Nt():n==="reader"&&bt()};ei(()=>{se&&y&&it()},[y,se]);let vt=async F=>{yn.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 d=>{if(d.isConfirmed){Y(!0);try{let j={card_id:F,customer_id:e==null?void 0:e.customerId,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey},_e=await ln.post(`${Me}delete-customer-card`,j);Y(!1),it(),yn.fire({icon:"success",title:"Deleted!",text:"Card deleted.",confirmButtonText:"OK",showConfirmButton:!0,timer:1e3,timerProgressBar:!0,customClass:{confirmButton:"btn btn-dark"}})}catch(j){Y(!1),yn.fire({icon:"error",title:"Error!",text:"Failed to delete the card.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}}else d.dismiss===yn.DismissReason.cancel&&yn.fire({icon:"info",text:"Card not deleted",confirmButtonText:"OK",buttonsStyling:!1,customClass:{confirmButton:"btn btn-dark float-end",actions:"swal2-actions-end"}})})},kt=F=>{switch(F==null?void 0:F.toLowerCase()){case"visa":return W;case"mastercard":case"mc":case"m/c":return Te;case"amex":case"american express":case"ae":return Ee;case"discover":case"dcvr":return ke;case"bank":return s;default:return F}},Tt=()=>{let F=ve||0;return(Number(e.amount)-F).toFixed(0)};return console.log(b,"activeinCard","activeinBank",h),t.createElement(t.Fragment,null,t.createElement(Ht,null),t.createElement(un,null),t.createElement(hn,null),t.createElement(t.Fragment,null,t.createElement("button",{className:"paymentBtn",onClick:L},"Pay"),t.createElement($t,{open:se,onClose:N},Ae&&t.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},t.createElement(Et,{error:Ae,onClose:N})),Qe&&t.createElement(gn,{onClose:N,tranId:qe}),!Ae&&!Qe&&t.createElement(t.Fragment,null,(f||O)&&t.createElement(Ft,{loading:f||O}),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:N},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:$==null?void 0:$.logo,id:"pay-logos"})),t.createElement("div",{className:"pay-container"},t.createElement("div",{className:"pay-header pay-conatiner-one frac-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:$==null?void 0:$.logo,id:"pay-logos"})),(J==null?void 0:J.length)>0&&D!=="cardList"&&t.createElement("button",{className:"res-charge-payment-back-btn ",onClick:()=>ue("cardList")}," ",t.createElement(Fn,null)," Back")),t.createElement("div",{className:"amt-pay-con"},t.createElement("div",{className:"pay-amount-conatiner"},t.createElement("small",{className:"pay-payment-amount"},"Select paymet type")),t.createElement("div",{className:"frac-card-bank-radio-main"},t.createElement(rn,{label:"Card",amount:(zt=Number(e==null?void 0:e.amount))==null?void 0:zt.toFixed(2),value:"card",onChange:de,activetab:D}),($==null?void 0:$.isSkyFiAccount)&&t.createElement(rn,{label:"Bank",amount:(_t=Number(ve))==null?void 0:_t.toFixed(2),value:"ach",onChange:de,activetab:D})),ve&&ve>0&&(e!=null&&e.pass_fee)?t.createElement("div",{className:"frac-cash-discount-fee"},t.createElement("small",null,D==="card"?"Cash Discount":"Cash Discount Savings"," "),t.createElement("p",null,"$",(Number(e.amount)-ve).toFixed(2))):null)),t.createElement("div",{className:"pay-conatiner-one-last"},t.createElement("img",{src:m,alt:""}),t.createElement("img",{src:K,alt:""}),"Secure payments powered by Fractal")),t.createElement("div",{className:"pay-tab pay-conatiner-two"},!f&&t.createElement("div",{className:"col-md-12"},t.createElement("div",{id:"payment-form-div"},D!=="cardList"?t.createElement("div",{className:"frac-charge-payment-back-btn-wrap "},(J==null?void 0:J.length)>0&&t.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>ue("cardList")}," ",t.createElement(Fn,null)," Back"),($==null?void 0:$.isSkyFiAccount)&&t.createElement("div",{className:"tab"},t.createElement("button",{className:"tablinks",onClick:F=>{de("card")},style:{border:D==="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:F=>{de("ach")},style:{border:D==="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"},"$",(We=Number(e==null?void 0:e.amount))==null?void 0:We.toFixed(2))),D!="ach"&&t.createElement("div",null,t.createElement("div",null,t.createElement("img",{src:W,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:Te,width:35,alt:""})),t.createElement("div",null,t.createElement("img",{src:Ee,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:ke,width:35,alt:""})))),ve&&ve>0&&t.createElement("div",{className:"res-pay-con frac-cash-discount"},t.createElement("div",{className:"frac-cashlabel"},"Cash Discount"),t.createElement("div",null,"$",ve))):t.createElement("div",null,t.createElement("h6",{className:"charge-customer-name",style:{marginBottom:"16px !important"}}," Charge ",$==null?void 0:$.customer_name),t.createElement("h6",{className:"card-ach-heading",style:{marginBottom:"10px !important"}}," ",n==="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"},"$",(Ce=Number(e==null?void 0:e.amount))==null?void 0:Ce.toFixed(2))),t.createElement("div",null,t.createElement("div",null,t.createElement("img",{src:W,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:Te,width:35,alt:""})),t.createElement("div",null,t.createElement("img",{src:Ee,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:ke,width:35,alt:""}))))),t.createElement("div",{id:"card",style:{display:D==="card"?"block":"none"},className:"tabcontent"},t.createElement("div",{className:"frac-card-payment"},t.createElement("div",{className:"frac-heading-card-wrap"},t.createElement("div",{className:"frac-backarrow"},(J==null?void 0:J.length)>0&&b==="form"&&t.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>E("list")}," ",t.createElement(Fn,null)),ve&&ve>0&&t.createElement("div",{className:"res-pay-con frac-cash-discount"},t.createElement("div",{className:"frac-cashlabel"},"Cash Discount"),t.createElement("div",null,"$",ve))),t.createElement("h6",{className:"frac-card-payment-heading"},"Card Payment")),D!="ach"&&t.createElement("div",{style:{display:"flex",gap:"8px",margin:"8px 0px 19px 0px"}},t.createElement("img",{src:W,alt:"",width:33}),t.createElement("img",{src:Te,width:33,alt:""}),t.createElement("img",{src:Ee,alt:"",width:33}),t.createElement("img",{src:ke,width:33,alt:""}))),b==="list"?t.createElement(t.Fragment,null,t.createElement(sn,{listHeading:"Cards",paymentGateway:$==null?void 0:$.paymentGateway,ListItems:J,selectedCard:Ue,setSelectedCard:Lt,handleDeleteCard:vt,otherButtonLabel:"Pay With Other Card",otherButtonAction:()=>{E("form")}}),t.createElement("div",{className:"form-group",style:{padding:"0"}},t.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:dt},"$",(Re=Number(e==null?void 0:e.amount))==null?void 0:Re.toFixed(2)))):t.createElement("form",{id:"PaymentForm",style:{textAlign:"start"},onSubmit:Ge},t.createElement("div",{className:"ach-scrl",style:{minHeight:$!=null&&$.isSkyFiAccount&&(J==null?void 0:J.length)>0?"444px":$!=null&&$.isSkyFiAccount&&(J==null?void 0:J.length)==0?"456px":(J==null?void 0:J.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:(p==null?void 0:p.cardName)||"",onChange:F=>{let d=F.target.value;/^[a-zA-Z\s]*$/.test(d)&&ce("cardName",d)}}),(g==null?void 0:g.cardName)&&t.createElement("span",{className:"error-span"},g==null?void 0:g.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:(p==null?void 0:p.cardNumber)||"",onChange:F=>le(F),"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:(p==null?void 0:p.expiryMonth)||"",onChange:F=>ce("expiryMonth",F.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:(p==null?void 0:p.expiryYear)||"",onChange:F=>ce("expiryYear",F.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:(p==null?void 0:p.cvv)||"",onChange:F=>ce("cvv",F.target.value)})))),(g==null?void 0:g.cardNumber)&&t.createElement("span",{className:"error-span"},g==null?void 0:g.cardNumber),t.createElement("p",{style:{margin:"0"}},g!=null&&g.expiryMonth||g!=null&&g.expiryYear?t.createElement("span",{className:"error-span",style:{paddingRight:"4px"}},g==null?void 0:g.expiryMonth):"",(g==null?void 0:g.cvv)&&t.createElement("span",{className:"error-span"},g==null?void 0:g.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:(at=e==null?void 0:e.orderID)!=null?at:"",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:(Vt=p==null?void 0:p.zipCode)!=null?Vt:"",onChange:F=>ce("zipCode",F.target.value)}),(g==null?void 0:g.zipCode)&&t.createElement("span",{className:"error-span"},g==null?void 0:g.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:c,onChange:F=>ut(F.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"}},($==null?void 0:$.paymentDeviceList)&&((Je=$==null?void 0:$.paymentDeviceList)==null?void 0:Je.length)>0&&t.createElement("button",{type:"button",style:{marginBottom:"10px"},className:"pay-button",onClick:()=>Be(!Q)},Q?"Pay With Reader":"Pay With Card"),t.createElement("button",{type:"submit",style:{margin:0},className:"pay-button"},"$",(Kt=Number(e==null?void 0:e.amount))==null?void 0:Kt.toFixed(2))))),t.createElement("div",{id:"ach",style:{display:D==="ach"?"block":"none"},className:"tabcontent"},t.createElement("div",{className:"frac-card-payment"},t.createElement("div",{className:"frac-heading-card-wrap"},t.createElement("div",{className:"frac-backarrow"},(ft==null?void 0:ft.length)>0&&h==="form"&&t.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>he("list")}," ",t.createElement(Fn,null)),ve&&ve>0&&t.createElement("div",{className:"res-pay-con frac-cash-discount"},t.createElement("div",{className:"frac-cashlabel"},"Cash Discount Savings"),t.createElement("div",null,"$",Tt()))),t.createElement("h6",{className:"frac-card-payment-heading"},"Bank Payment"))),h==="list"?t.createElement(t.Fragment,null,t.createElement(sn,{listHeading:"Banks",paymentGateway:$==null?void 0:$.paymentGateway,ListItems:ft,selectedCard:Ue,setSelectedCard:Lt,handleDeleteCard:vt,otherButtonLabel:"Pay With Other Bank",otherButtonAction:()=>{he("form")}}),t.createElement("div",{className:"form-group",style:{padding:"0"}},t.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:dt},"$",(St=Number(ve))==null?void 0:St.toFixed(2)))):t.createElement("form",{id:"ACHPaymentForm",style:{textAlign:"start"},onSubmit:Ge},t.createElement("div",{className:"ach-scrl",style:{minHeight:$!=null&&$.isSkyFiAccount&&(J==null?void 0:J.length)>0?"444px":$!=null&&$.isSkyFiAccount&&(J==null?void 0:J.length)==0?"436px":(J==null?void 0:J.length)>0?"462px":"520px",maxHeight:$!=null&&$.isSkyFiAccount&&(J==null?void 0:J.length)>0?"444px":((J==null?void 0:J.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:(He=l==null?void 0:l.name)!=null?He:"",onChange:$e}),(C==null?void 0:C.name)&&t.createElement("span",{className:"error-span"},C==null?void 0:C.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:(et=l==null?void 0:l.routingNumber)!=null?et:"",onChange:$e}),(C==null?void 0:C.routingNumber)&&t.createElement("span",{className:"error-span"},C==null?void 0:C.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:(Ut=l==null?void 0:l.accountNumber)!=null?Ut:"",onChange:$e}),(C==null?void 0:C.accountNumber)&&t.createElement("span",{className:"error-span"},C==null?void 0:C.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:(qt=l==null?void 0:l.confirmAccountNumber)!=null?qt:"",onChange:$e}),(C==null?void 0:C.confirmAccountNumber)&&t.createElement("span",{className:"error-span"},C==null?void 0:C.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:(Gt=l==null?void 0:l.bankName)!=null?Gt:"",onChange:$e}),(C==null?void 0:C.bankName)&&t.createElement("span",{className:"error-span"},C==null?void 0:C.bankName)),((l==null?void 0:l.accountType)==="business saving"||(l==null?void 0:l.accountType)==="business checking")&&t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"companyName"},"Company name"),t.createElement("input",{type:"text",id:"companyName",className:"form-control",maxLength:100,placeholder:"My Company",name:"companyName",value:(mt=l==null?void 0:l.companyName)!=null?mt:"",onChange:$e}),(C==null?void 0:C.companyName)&&t.createElement("span",{className:"error-span"},C==null?void 0:C.companyName)),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:(Ot=l==null?void 0:l.accountType)!=null?Ot:"",onChange:$e},t.createElement("option",{value:""},"Select account"),Sn.map(F=>t.createElement("option",{key:F.value,value:F.value},F.label)))),(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:V,onChange:F=>gt(F.target.checked)}),t.createElement("label",{htmlFor:"saveACH"},"Save ACH")),V&&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"},"$",(nn=Number(ve))==null?void 0:nn.toFixed(2)))))))))))))))}import a,{useEffect as ti,useState as Pt}from"react";import xn from"axios";import $n from"sweetalert2";import{IoArrowBack as ni}from"react-icons/io5";function $i(e){var ve,Ze,$,nt,qe,lt,ht,Yt,Wt;let[f,q]=Pt(!1),[O,Y]=Pt(!1),[Ae,I]=Pt(""),[Qe,Se]=Pt(!1),[se,T]=Pt(!1),[D,ue]=Pt("card"),[n,u]=Pt(!1),b=e.merchantPublicKey,E=R+"widget/mc-img.svg",h=R+"widget/visa-img.svg",he=R+"widget/ae-img.svg",Q=R+"widget/discover-img.svg",Be=R+"widget/card.svg",c=R+"widget/Trash.svg",ut=R+"widget/bank.svg",V=R+"widget/secure-img.png",gt=R+"widget/pov-by.png",[y,Te]=Pt(),[W,Ee]=Pt({}),[ke,xt]=Pt([]),[w,s]=Pt(),[m,K]=Pt(void 0),[x,p]=Pt(),[S,g]=Pt(""),Z=(N,L)=>{let de=(parseFloat(L)||0)/100,ce=N/(1+de);return Math.round(ce*100)/100};ti(()=>{if(e!=null&&e.pass_fee){let N=Z(e==null?void 0:e.amount,e==null?void 0:e.surcharge);K(N)}},[e==null?void 0:e.pass_fee]);let l=()=>q(!0),v=()=>q(!1),C=()=>{T(!1),ue("card"),Y(!1),I(""),Se(!1),g(""),Te({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),Ee({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),u(!1),s({card_type:"",cardlastfourdigit:"",expmonth:1,expyear:2025,primary_card:0,firstname:"",id:"",lastname:""})},me=()=>T(!0),J=(N,L)=>{let de=N;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(de)){(L===""||/^[0-9]+$/.test(L))&&(Ee(le=>B(k({},le),{[de]:""})),Te(le=>B(k({},le),{[de]:L})));return}Ee(le=>B(k({},le),{[de]:""})),Te(le=>B(k({},le),{[de]:L}))},De=N=>{let de=N.target.value.replace(/\D/g,""),ce="";/^3[47]/.test(de)?ce=de.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,($e,Ye,X,Ge)=>[Ye,X,Ge].filter(Boolean).join(" ")):ce=de.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,($e,Ye,X,Ge,it)=>[Ye,X,Ge,it].filter(Boolean).join(" ")),Ee(le=>B(k({},le),{cardNumber:""})),Te(le=>B(k({},le),{cardNumber:ce}))},ft=()=>{var le,$e,Ye,X,Ge,it;let N={},L=y,de=parseInt((L==null?void 0:L.expiryMonth)||"",10),ce=(L==null?void 0:L.expiryYear)||"";if((le=L==null?void 0:L.cardName)!=null&&le.trim()||(N.cardName="Card name is required"),($e=L==null?void 0:L.cardNumber)!=null&&$e.trim()||(N.cardNumber="Card number is required"),(!((Ye=L==null?void 0:L.expiryMonth)!=null&&Ye.trim())||!((X=L==null?void 0:L.expiryYear)!=null&&X.trim())||isNaN(de)||de<1||de>12||ce.length!==4)&&(N.expiryMonth="Invalid Expiration Date."),(Ge=L==null?void 0:L.cvv)!=null&&Ge.trim()||(N.cvv="CVV is required"),(it=L==null?void 0:L.zipCode)!=null&&it.trim()||(N.zipCode="ZIP code is required"),L!=null&&L.expiryMonth&&(L!=null&&L.expiryYear)&&L.expiryMonth.length<=2&&L.expiryYear.length===4){let Nt=parseInt(L.expiryMonth,10),bt=parseInt(L.expiryYear,10),dt=new Date,vt=dt.getMonth()+1,kt=dt.getFullYear();(bt<kt||bt===kt&&Nt<vt)&&(N.expiryMonth="Card is expired")}return Ee(N),Object.keys(N).length>0},ot=async N=>{var L,de,ce,le,$e,Ye,X,Ge,it,Nt,bt,dt,vt,kt,Tt,zt,_t,We,Ce;if(N.preventDefault(),D=="card"){if(ft())return;{let at=DatacapWebToken.validateCardNumber(y==null?void 0:y.cardNumber.replaceAll(" ","")),Vt=DatacapWebToken.validateExpirationDate(y==null?void 0:y.expiryMonth,y==null?void 0:y.expiryYear),Je=DatacapWebToken.validateCVV(y==null?void 0:y.cvv),Kt={};if(at||(Kt.cardNumber="Invalid card Number"),Vt||(Kt.expiryMonth="Invalid Expiration Date."),Je||(Kt.cvv="Invalid CVV"),Ee(Kt),at&&Je&&Vt){Y(!0);try{let St=async function(He){if(He.Error)I(He.Error),Y(!1);else{let et=y==null?void 0:y.cardName,Ut=y==null?void 0:y.zipCode;He.name=et,He.postal_code=Ut,He.fractalpayPublicKey=e==null?void 0:e.merchantPublicKey,He.amount=e==null?void 0:e.amount,He.order_id=e==null?void 0:e.orderID,He.preAuth_id="",He.isCardSave=n,He.customer_id=e==null?void 0:e.customerId,He.link_token="",He.gateway_id=x==null?void 0:x.paymentGateway,He.discount=e==null?void 0:e.discount,He.tax=e==null?void 0:e.tax,He.surcharge=e==null?void 0:e.surcharge,He.pass_fee=e==null?void 0:e.pass_fee,new Headers().append("Content-Type","application/json");let Gt={method:"POST",body:JSON.stringify(He),redirect:"follow"};Mt.emit("sendMessage",B(k({},Gt),{isChargePreauth:!0})),Mt.on("charge-preauth",mt=>{var Ot;console.log(mt,"datdata"),(mt==null?void 0:mt.status)=="Failed"?(Y(!1),I((mt==null?void 0:mt.message)||"Something went wrong. Please try again later.")):(Se(!0),g((Ot=mt==null?void 0:mt.data)==null?void 0:Ot.transaction_id),Y(!1),Te({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}))})}};if((x==null?void 0:x.paymentGateway)===32){let He={method:"POST",redirect:"follow"};try{let et=await xn.post(`${be}api/v1/widget/generate-session`,He),Ut=Number(y==null?void 0:y.expiryYear)%100,qt=y==null?void 0:y.cardNumber;qt=qt==null?void 0:qt.replace(/\s+/g,"");let Gt=`${qt}=${Ut}${y==null?void 0:y.expiryMonth} ${y==null?void 0:y.cvv}`,Ot=forge.pki.publicKeyFromPem((de=(L=et==null?void 0:et.data)==null?void 0:L.data)==null?void 0:de.publicKeyPem).encrypt(Gt,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),nn=forge.util.encode64(Ot),F={"Content-Type":"application/json","x-app-session-key":(le=(ce=et.data)==null?void 0:ce.data)==null?void 0:le.session_key},d=JSON.stringify({enc_track2_data:`${nn}`,algorithm:"RSAES_OAEP_SHA_1",session_key:`${(Ye=($e=et==null?void 0:et.data)==null?void 0:$e.data)==null?void 0:Ye.session_key}`});try{let j=await xn.post(`${wt}tokenizer/tokenize`,d,{headers:F}),_e=JSON.stringify(B(k({},(X=j==null?void 0:j.data)==null?void 0:X.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:`${(it=(Ge=j==null?void 0:j.data)==null?void 0:Ge.data)==null?void 0:it.token}`,fractalpayPublicKey:b,order_id:e==null?void 0:e.orderID,preAuth_id:"",isCardSave:n,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:(bt=(Nt=j==null?void 0:j.data)==null?void 0:Nt.data)==null?void 0:bt.last4,Brand:(vt=(dt=j==null?void 0:j.data)==null?void 0:dt.data)==null?void 0:vt.brand,gateway_id:x==null?void 0:x.paymentGateway,pass_fee:e==null?void 0:e.pass_fee})),je={method:"POST",headers:{"Content-Type":"application/json"},body:_e,redirect:"follow"};Mt.emit("sendMessage",B(k({},je),{isFractalPreauth:!0})),Mt.on("fractal-charge-preauth",ge=>{var Pe;(ge==null?void 0:ge.status)=="Failed"?(Y(!1),I((ge==null?void 0:ge.message)||"Something went wrong , Try again later")):(g((Pe=ge==null?void 0:ge.data)==null?void 0:Pe.transaction_id),Se(!0),Y(!1))})}catch(j){console.log(j),Y(!1),I(((Tt=(kt=j==null?void 0:j.response)==null?void 0:kt.data)==null?void 0:Tt.message)||(j==null?void 0:j.message)||"Something went wrong , Try again later")}}catch(et){Y(!1),I(((_t=(zt=et==null?void 0:et.response)==null?void 0:zt.data)==null?void 0:_t.message)||(et==null?void 0:et.message)||"Something went wrong , Try again later")}}else DatacapWebToken.requestToken(x==null?void 0:x.dctoken,"PaymentForm",St)}catch(St){Y(!1),I(((Ce=(We=St==null?void 0:St.response)==null?void 0:We.data)==null?void 0:Ce.message)||(St==null?void 0:St.message)||"Something went wrong.")}}}}},Ue=async()=>{var N,L,de,ce,le,$e,Ye,X,Ge,it,Nt,bt,dt,vt,kt,Tt,zt,_t;l();try{let We={fractalpayPublicKey:b,customer_id:e==null?void 0:e.customerId,preauth:!0},Ce=await xn.post(`${Me}get-payment-details`,We);if(p((N=Ce==null?void 0:Ce.data)==null?void 0:N.data),(de=(L=Ce==null?void 0:Ce.data)==null?void 0:L.data)!=null&&de.paymentGateway||(C(),I("Something went wrong.")),(le=(ce=Ce==null?void 0:Ce.data)==null?void 0:ce.data)!=null&&le.card_list&&((X=(Ye=($e=Ce==null?void 0:Ce.data)==null?void 0:$e.data)==null?void 0:Ye.card_list)==null?void 0:X.length)>0){xt((it=(Ge=Ce==null?void 0:Ce.data)==null?void 0:Ge.data)==null?void 0:it.card_list),ue("cardList");let Re=(dt=(bt=(Nt=Ce==null?void 0:Ce.data)==null?void 0:Nt.data)==null?void 0:bt.card_list)==null?void 0:dt.filter(at=>(at==null?void 0:at.primary_card)==1);Re!=null&&Re[0]&&((vt=Re==null?void 0:Re[0])==null?void 0:vt.payment_method_type)==((Tt=(kt=Ce==null?void 0:Ce.data)==null?void 0:kt.data)==null?void 0:Tt.paymentGateway)&&s(Re[0])}else ue("card");v()}catch(We){console.log(We),v(),I(((_t=(zt=We==null?void 0:We.response)==null?void 0:zt.data)==null?void 0:_t.message)||(We==null?void 0:We.message)||"Something went wrong")}},Lt=async()=>{var Nt,bt,dt,vt,kt,Tt,zt;let N=e==null?void 0:e.customerId,L=e==null?void 0:e.discount,de=e==null?void 0:e.surcharge,ce=e==null?void 0:e.tax,le=e==null?void 0:e.merchantPublicKey,$e=e==null?void 0:e.orderID,Ye=e==null?void 0:e.amount,X=w==null?void 0:w.id,Ge=w==null?void 0:w.card_type;if(le&&$e&&Ye)if(N)if(X){let _t={amount:Ye,order_id:$e,customer_id:N,card_id:X,fractalpayPublicKey:le,isCardSave:Ge!="Bank",discount:L,surcharge:de,tax:ce},it=_t,{isCardSave:We}=it,Ce=kn(it,["isCardSave"]),at=Me+"authorize-by-card",Vt={"Content-Type":"application/json"};Y(!0);try{let Je=await xn.post(at,Ge=="Bank"?Ce:_t,{headers:Vt});(Nt=Je==null?void 0:Je.data)!=null&&Nt.result&&(g((dt=(bt=Je==null?void 0:Je.data)==null?void 0:bt.data)==null?void 0:dt.transaction_id),Se(!0),Y(!1))}catch(Je){Y(!1),console.log(Je),I(((kt=(vt=Je==null?void 0:Je.response)==null?void 0:vt.data)==null?void 0:kt.message)||((zt=(Tt=Je==null?void 0:Je.response)==null?void 0:Tt.data)==null?void 0:zt.status)||"Something went erong")}}else I("Please Select A Card/ACH");else I("Please Select Customer");else I("Something went wrong.")};ti(()=>{se&&b&&Ue()},[b,se]);let rt=async N=>{$n.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 L=>{if(L.isConfirmed){Y(!0);try{let de={card_id:N,customer_id:e==null?void 0:e.customerId,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey},ce=await xn.post(`${Me}delete-customer-card`,de);Y(!1),Ue(),$n.fire({icon:"success",title:"Deleted!",text:"The card has been deleted.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}catch(de){Y(!1),$n.fire({icon:"error",title:"Error!",text:"Failed to delete the card.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}}})},st=N=>{switch(N==null?void 0:N.toLowerCase()){case"visa":return h;case"mastercard":case"mc":case"m/c":return E;case"amex":case"american express":case"ae":return he;case"discover":case"dcvr":return Q;case"bank":return ut;default:return N}};return a.createElement(a.Fragment,null,a.createElement(Ht,null),a.createElement(un,null),a.createElement(a.Fragment,null,a.createElement("button",{className:"paymentBtn",onClick:me},"PreAuth Payment"),a.createElement($t,{open:se,onClose:C},Ae&&a.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},a.createElement(Et,{error:Ae,onClose:C})),Qe&&a.createElement(gn,{onClose:C,tranId:S}),!Ae&&!Qe&&a.createElement(a.Fragment,null,(f||O)&&a.createElement(Ft,{loading:f||O}),a.createElement("div",null,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-container"},a.createElement("div",{className:"pay-header pay-conatiner-one"},a.createElement("div",{className:"pay-conatiner-one-first"},a.createElement("div",{className:"pay-logo-container"},a.createElement("div",{className:"pay-main-logo"},a.createElement("img",{src:x==null?void 0:x.logo,id:"pay-logos"})),a.createElement("h1",{className:"pay-heading"},"Pay"),(ke==null?void 0:ke.length)>0&&D!=="cardList"&&a.createElement("button",{className:"res-charge-payment-back-btn ",onClick:()=>ue("cardList")}," ",a.createElement(ni,null)," Back")),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"},"$",(ve=Number(e==null?void 0:e.amount))==null?void 0:ve.toFixed(2)),m&&m>0&&a.createElement("div",{style:{width:"80%"},className:"frac-cash-discount"},a.createElement("div",{className:"frac-cashlabel"},"Cash Discount"),a.createElement("div",null,"$",m.toFixed(2)))),D!="ach"&&a.createElement("div",{style:{display:"flex",gap:"8px",margin:"8px 0"}},a.createElement("img",{src:h,alt:"",width:33}),a.createElement("img",{src:E,width:33,alt:""}),a.createElement("img",{src:he,alt:"",width:33}),a.createElement("img",{src:Q,width:33,alt:""})))),a.createElement("div",{className:"pay-conatiner-one-last"},a.createElement("img",{src:V,alt:""}),a.createElement("img",{src:gt,alt:""}),"Secure payments powered by Fractal"),a.createElement("div",null)),!f&&a.createElement("div",{className:"pay-tab pay-conatiner-two"},a.createElement("div",{className:"col-md-12"},a.createElement("div",{id:"payment-form-div"},D!=="cardList"?a.createElement("div",null,(ke==null?void 0:ke.length)>0&&a.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>ue("cardList")}," ",a.createElement(ni,null)," Back"),a.createElement("div",{className:""},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"},"$",(Ze=Number(e==null?void 0:e.amount))==null?void 0:Ze.toFixed(2))),a.createElement("div",null,a.createElement("div",null,a.createElement("img",{src:h,alt:"",width:35,style:{paddingRight:"5px"}}),a.createElement("img",{src:E,width:35,alt:""})),a.createElement("div",null,a.createElement("img",{src:he,alt:"",width:35,style:{paddingRight:"5px"}}),a.createElement("img",{src:Q,width:35,alt:""})))),m&&m>0&&a.createElement("div",{className:"res-pay-con frac-cash-discount"},a.createElement("div",{className:"frac-cashlabel"},"Cash Discount"),a.createElement("div",null,"$",m)))):a.createElement("div",null,a.createElement("h6",{className:"charge-customer-name",style:{marginBottom:"16px !important"}}," Charge ",x==null?void 0:x.customer_name),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"},"$",($=Number(e==null?void 0:e.amount))==null?void 0:$.toFixed(2))),a.createElement("div",null,a.createElement("div",null,a.createElement("img",{src:h,alt:"",width:35,style:{paddingRight:"5px"}}),a.createElement("img",{src:E,width:35,alt:""})),a.createElement("div",null,a.createElement("img",{src:he,alt:"",width:35,style:{paddingRight:"5px"}}),a.createElement("img",{src:Q,width:35,alt:""})))),a.createElement("h6",{className:"card-ach-heading",style:{marginBottom:"10px !important"}}," Cards")),a.createElement("div",{style:{display:D==="cardList"?"block":"none"},className:"tabcontent"},a.createElement("div",{className:"card-lint-div-in"},a.createElement("div",{className:"card-list-div"},(x==null?void 0:x.card_list)&&((nt=x==null?void 0:x.card_list)==null?void 0:nt.length)>0&&((qe=x==null?void 0:x.card_list)==null?void 0:qe.map((N,L)=>a.createElement("div",{className:"card-list-single-div",key:L},a.createElement("div",{className:"card-number-radio"},a.createElement("input",{disabled:(x==null?void 0:x.paymentGateway)!=(N==null?void 0:N.payment_method_type),type:"radio",className:"cardRadio",name:"selected_card",id:"",checked:w===N,onChange:de=>s(N)}),a.createElement("label",{htmlFor:"",className:"card-number-last-four"},"**** ",N==null?void 0:N.cardlastfourdigit),a.createElement("h6",{className:"card-expiry-date"},N==null?void 0:N.expmonth,"/",N==null?void 0:N.expyear)),a.createElement("div",{className:"card-number-radio"},a.createElement("span",{className:"visa-card"},a.createElement("img",{src:st(N==null?void 0:N.card_type),alt:""})),a.createElement("span",{className:"visa-card",style:{cursor:"pointer"},onClick:()=>rt(N==null?void 0:N.id)},a.createElement("img",{src:c,alt:""}))))))),a.createElement("div",{className:"pay-with-other-card ",onClick:()=>ue("card")},"Authorize With Other Card",a.createElement("img",{src:Be,alt:""}))),a.createElement("div",{className:"form-group"},a.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:Lt},"$",(lt=Number(e==null?void 0:e.amount))==null?void 0:lt.toFixed(2)))),a.createElement("div",{id:"card",style:{display:D==="card"?"block":"none"},className:"tabcontent"},a.createElement("form",{id:"PaymentForm",onSubmit:ot},a.createElement("div",{className:"ach-scrl",style:{minHeight:(ke==null?void 0:ke.length)>0?"462px":"520px",overflow:"auto",marginRight:"5px"}},a.createElement("div",{className:"form-group"},a.createElement("label",{htmlFor:"cardHolderName"},"Name on Card"),a.createElement("input",{type:"text",className:"form-control",placeholder:"John Doe",value:(y==null?void 0:y.cardName)||"",onChange:N=>{let L=N.target.value;/^[a-zA-Z\s]*$/.test(L)&&J("cardName",L)}}),(W==null?void 0:W.cardName)&&a.createElement("span",{className:"error-span"},W==null?void 0:W.cardName)),a.createElement("div",{className:"form-group"},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:(y==null?void 0:y.cardNumber)||"",onChange:N=>De(N),"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"},a.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:N=>J("expiryMonth",N.target.value)})),a.createElement("div",{className:"exp-year form-group"},a.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:N=>J("expiryYear",N.target.value)})),a.createElement("div",{className:"security-digit form-group"},a.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:N=>J("cvv",N.target.value)})))),(W==null?void 0:W.cardNumber)&&a.createElement("span",{className:"error-span"},W==null?void 0:W.cardNumber),a.createElement("p",{style:{margin:"0"}},W!=null&&W.expiryMonth||W!=null&&W.expiryYear?a.createElement("span",{className:"error-span",style:{paddingRight:"4px"}},W==null?void 0:W.expiryMonth):"",(W==null?void 0:W.cvv)&&a.createElement("span",{className:"error-span"},W==null?void 0:W.cvv)))),a.createElement("div",{className:"form-group"},a.createElement("label",{htmlFor:"OrderId"},"Order ID / Description"),a.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"OID123456",disabled:!0,value:(ht=y==null?void 0:y.orderId)!=null?ht:"OID123456",onChange:N=>J("orderId",N.target.value),style:{background:"#F6F6F7",color:"#727272"}})),a.createElement("div",{className:"form-group"},a.createElement("label",{htmlFor:"zip"},"ZIP"),a.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"000000",value:(Yt=y==null?void 0:y.zipCode)!=null?Yt:"",onChange:N=>J("zipCode",N.target.value)}),(W==null?void 0:W.zipCode)&&a.createElement("span",{className:"error-span"},W==null?void 0:W.zipCode)),(e==null?void 0:e.customerId)&&a.createElement("div",{className:"form-group"},a.createElement("div",{className:"frac-tooltip-mn",style:{display:"flex",alignItems:"center",gap:"10px",paddingTop:"10px"}},a.createElement("input",{type:"checkbox",id:"save_card",className:"toggle-checkbox",checked:n,onChange:N=>u(N.target.checked)}),a.createElement("label",{htmlFor:"save_card",className:"toggle-label"}),a.createElement("label",{htmlFor:"save_card"},"Save card for future payments "),a.createElement("div",{className:"frac-tooltip-wrapper"},a.createElement("div",{className:"frac-tooltip-icon"},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:"frac-tooltip-text"},a.createElement("p",null,"If checked, I agree to give the ",a.createElement("b",null,(x==null?void 0:x.bname)||"merchant")," permission to charge this credit card for agreed-upon purchases in the future.")))))),a.createElement("div",{className:"form-group",style:{marginTop:"20px",padding:0}},a.createElement("button",{type:"submit",style:{margin:0},className:"pay-button"},"$",(Wt=Number(e==null?void 0:e.amount))==null?void 0:Wt.toFixed(2))))))))))))))))}import re,{useEffect as Vi,useRef as bn,useState as on}from"react";import Ki from"sweetalert2";import dn from"axios";import Yi from"react";function Yn(){let e="#000",f="#fff",q="#212529",O="#dee2e6";return Yi.createElement("style",null,`
|
|
1635
|
+
`)}import pt from"react";var ln=({listHeading:e="Card",ListItems:f,selectedCard:q,setSelectedCard:O,paymentGateway:Y,handleDeleteCard:Be,otherButtonAction:I,otherButtonLabel:Qe,headingClass:_e})=>{let se=R+"widget/Trash.svg";return console.log(q,"selectedCard another",f),pt.createElement(pt.Fragment,null,pt.createElement("h6",{className:_e||"card-ach-heading",style:{marginBottom:"10px !important"}},e),pt.createElement("div",{className:"card-lint-div-in"},pt.createElement("div",{className:"card-list-div"},f&&(f==null?void 0:f.length)>0&&(f==null?void 0:f.map((T,D)=>{let ue=!1;return Y&&(ue=Y!=(T==null?void 0:T.payment_method_type)&&(T==null?void 0:T.card_type)!="Bank"),pt.createElement("div",{key:T==null?void 0:T.id,className:"card-list-single-div"},pt.createElement("div",{className:"card-number-radio"},pt.createElement("input",{disabled:ue,type:"radio",className:"cardRadio",name:"selected_card",id:"",checked:(q==null?void 0:q.id)===(T==null?void 0:T.id),onChange:n=>O(T)}),pt.createElement("label",{htmlFor:"",className:"card-number-last-four"},"**** ",T==null?void 0:T.cardlastfourdigit),(T==null?void 0:T.card_type)!="Bank"&&pt.createElement("h6",{className:"card-expiry-date"},T==null?void 0:T.expmonth,"/",T==null?void 0:T.expyear)),pt.createElement("div",{className:"card-number-radio"},pt.createElement("span",{className:"visa-card"},pt.createElement("img",{src:ei(T==null?void 0:T.card_type),alt:""})),pt.createElement("span",{className:"visa-card",style:{cursor:"pointer"},onClick:()=>Be(T==null?void 0:T.id)},pt.createElement("img",{src:se,alt:""}))))}))),pt.createElement("div",{className:"pay-with-other-card",onClick:I},Qe,pt.createElement("img",{src:hn,alt:""}))))};function $i(e){var zt,_t,We,Ce,Re,at,Vt,Je,Kt,St,je,et,Ut,qt,Gt,mt,Ot,nn;let[f,q]=Oe(!1),[O,Y]=Oe(!1),[Be,I]=Oe(""),[Qe,_e]=Oe(!1),[se,T]=Oe(!1),[D,ue]=Oe("card"),[n,u]=Oe("card"),[b,E]=Oe("form"),[h,fe]=Oe("form"),[Q,Te]=Oe(!0),[c,ut]=Oe(!1),[V,gt]=Oe(!1),y=e.merchantPublicKey,qe=R+"widget/mc-img.svg",W=R+"widget/visa-img.svg",Ee=R+"widget/ae-img.svg",Ne=R+"widget/discover-img.svg",xt=R+"widget/card.svg",w=R+"widget/Trash.svg",s=R+"widget/bank.svg",m=R+"widget/secure-img.png",K=R+"widget/pov-by.png",x=R+"widget/pax.svg",[p,S]=Oe(),[g,Z]=Oe({}),[l,v]=Oe(),[C,ce]=Oe({}),[J,De]=Oe([]),[ft,ot]=Oe([]),[Ue,Lt]=Oe(),[rt,st]=Oe(),[ve,Ze]=Oe(Number(e==null?void 0:e.amount));console.log(Ue,"selectedCard");let[$,nt]=Oe(),[$e,lt]=Oe(""),ht=()=>q(!0),Yt=()=>q(!1),Wt=(F,d)=>{let j=(parseFloat(d)||0)/100,ke=F/(1+j);return Math.round(ke*100)/100};ti(()=>{if(se){let F=Wt(e==null?void 0:e.amount,(e==null?void 0:e.surcharge)||0);Ze(F)}},[se,e==null?void 0:e.pass_fee,e==null?void 0:e.amount,e==null?void 0:e.surcharge]);let N=()=>{T(!1),ue("card"),I(""),_e(!1),lt(""),v({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),ce({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),S({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),Z({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),gt(!1),ut(!1),Lt({card_type:"",cardlastfourdigit:"",expmonth:1,expyear:2025,primary_card:0,firstname:"",id:"",lastname:""}),st({}),Ze(0),u("card"),Te(!0),fe("form"),E("form"),Y(!1),q(!1),ot([]),De([])},L=()=>T(!0),me=F=>{ue(F)},pe=(F,d)=>{let j=F;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(j)){(d===""||/^[0-9]+$/.test(d))&&(Z(ee=>B(k({},ee),{[j]:""})),S(ee=>B(k({},ee),{[j]:d})));return}Z(ee=>B(k({},ee),{[j]:""})),S(ee=>B(k({},ee),{[j]:d}))},le=F=>{let j=F.target.value.replace(/\D/g,""),ke="";/^3[47]/.test(j)?ke=j.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(Ve,ge,Me,r)=>[ge,Me,r].filter(Boolean).join(" ")):ke=j.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(Ve,ge,Me,r,o)=>[ge,Me,r,o].filter(Boolean).join(" ")),Z(ee=>B(k({},ee),{cardNumber:""})),S(ee=>B(k({},ee),{cardNumber:ke}))},Ye=F=>{let{name:d,value:j}=F.target,ke=["routingNumber","accountNumber","confirmAccountNumber"];if(d=="name"){/^[a-zA-Z\s]*$/.test(j)&&(ce(ee=>B(k({},ee),{[d]:""})),v(ee=>B(k({},ee),{[d]:j})));return}if(ke.includes(d)){(j===""||/^[0-9]+$/.test(j))&&(ce(ee=>B(k({},ee),{[d]:""})),v(ee=>B(k({},ee),{[d]:j})));return}ce(ee=>B(k({},ee),{[d]:""})),v(ee=>B(k({},ee),{[d]:j}))},He=()=>{var ee,Ve,ge,Me,r,o;let F={},d=p,j=parseInt((d==null?void 0:d.expiryMonth)||"",10),ke=(d==null?void 0:d.expiryYear)||"";if((ee=d==null?void 0:d.cardName)!=null&&ee.trim()||(F.cardName="Card name is required"),(Ve=d==null?void 0:d.cardNumber)!=null&&Ve.trim()||(F.cardNumber="Card number is required"),(!((ge=d==null?void 0:d.expiryMonth)!=null&&ge.trim())||!((Me=d==null?void 0:d.expiryYear)!=null&&Me.trim())||isNaN(j)||j<1||j>12||ke.length!==4)&&(F.expiryMonth="Invalid Expiration Date."),(r=d==null?void 0:d.cvv)!=null&&r.trim()||(F.cvv="CVV is required"),(o=d==null?void 0:d.zipCode)!=null&&o.trim()||(F.zipCode="ZIP code is required"),d!=null&&d.expiryMonth&&(d!=null&&d.expiryYear)&&d.expiryMonth.length<=2&&d.expiryYear.length===4){let z=parseInt(d.expiryMonth,10),H=parseInt(d.expiryYear,10),A=new Date,ie=A.getMonth()+1,G=A.getFullYear();(H<G||H===G&&z<ie)&&(F.expiryMonth="Card is expired")}return Z(F),Object.keys(F).length>0},X=()=>{var j,ke,ee,Ve,ge,Me,r,o;let F={},d=l;return(j=d==null?void 0:d.name)!=null&&j.trim()||(F.name="Name is required"),(ke=d==null?void 0:d.accountNumber)!=null&&ke.trim()||(F.accountNumber="Account number is required"),(ee=d==null?void 0:d.accountNumber)!=null&&ee.trim()&&((Ve=d==null?void 0:d.accountNumber)==null?void 0:Ve.trim())!==((ge=d==null?void 0:d.confirmAccountNumber)==null?void 0:ge.trim())&&(F.confirmAccountNumber="Account numbers must match"),(Me=d==null?void 0:d.bankName)!=null&&Me.trim()||(F.bankName="Bank name is required"),(r=d==null?void 0:d.routingNumber)!=null&&r.trim()||(F.routingNumber="Routing Number is required"),d!=null&&d.routingNumber&&((o=d==null?void 0:d.routingNumber)==null?void 0:o.length)!==9&&(F.routingNumber="Routing number must be 9 digits"),((d==null?void 0:d.accountType)==="business saving"||(d==null?void 0:d.accountType)==="business checking")&&(!(d!=null&&d.companyName)||(d==null?void 0:d.companyName)==="")&&(F.companyName="Company Name is required for business accounts"),ce(F),Object.keys(F).length>0},Ge=async F=>{var d,j,ke,ee,Ve,ge,Me,r,o,z,H,A,ie,G,oe,te;if(F.preventDefault(),D!=="ach"){if(He())return;{let ae=DatacapWebToken.validateCardNumber(p==null?void 0:p.cardNumber.replaceAll(" ","")),ne=DatacapWebToken.validateExpirationDate(p==null?void 0:p.expiryMonth,p==null?void 0:p.expiryYear),he=DatacapWebToken.validateCVV(p==null?void 0:p.cvv),Pe={};if(ae||(Pe.cardNumber="Invalid card Number"),ne||(Pe.expiryMonth="Invalid Expiration Date."),he||(Pe.cvv="Invalid CVV"),Z(Pe),ae&&he&&ne){Y(!0);try{let Le=B(k({},p),{amount:`${e.amount||0}`,fractalpayPublicKey:y,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,pass_fee:e==null?void 0:e.pass_fee}),Se=await dn.post(`${Fe}create-widget-order`,Le),U=async function(ze){if(ze.Error)I(ze.Error),Y(!1);else{let Ae=p==null?void 0:p.cardName,ct=p==null?void 0:p.zipCode;ze.name=Ae,ze.postal_code=ct,ze.isCardSave=`${c}`,ze.isCharge=!0,ze.posSalesIdEncode=Se==null?void 0:Se.data.data.posSalesIdEncode,Mt.emit("sendMessage",ze),Mt.on(Se==null?void 0:Se.data.data.posSalesIdEncode,Ke=>{if($n(Ke==null?void 0:Ke.data)){let we=JSON.parse(Ke.data);we!=null&&we.result?(S({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),ut(!1),lt(we==null?void 0:we.transactionId),_e(!0),Y(!1)):(Y(!1),I((we==null?void 0:we.message)||"Something went wrong."))}else I("Something went wrong.")})}};if(($==null?void 0:$.paymentGateway)===32){let ze={method:"POST",redirect:"follow"};try{let Ae=await dn.post(`${be}api/v1/widget/generate-session`,ze),ct=Number(p==null?void 0:p.expiryYear)%100,Ke=p==null?void 0:p.cardNumber;Ke=Ke==null?void 0:Ke.replace(/\s+/g,"");let we=`${Ke}=${ct}${p==null?void 0:p.expiryMonth} ${p==null?void 0:p.cvv}`,Ln=forge.pki.publicKeyFromPem((j=(d=Ae==null?void 0:Ae.data)==null?void 0:d.data)==null?void 0:j.publicKeyPem).encrypt(we,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),zn=forge.util.encode64(Ln),In={"Content-Type":"application/json","x-app-session-key":(ee=(ke=Ae.data)==null?void 0:ke.data)==null?void 0:ee.session_key},Rt=JSON.stringify({enc_track2_data:`${zn}`,algorithm:"RSAES_OAEP_SHA_1",session_key:`${(ge=(Ve=Ae==null?void 0:Ae.data)==null?void 0:Ve.data)==null?void 0:ge.session_key}`});try{let Ct=await dn.post(`${wt}tokenizer/tokenize`,Rt,{headers:In}),It=JSON.stringify(B(k({},(Me=Ct==null?void 0:Ct.data)==null?void 0:Me.data),{isSaveCardChecked:c,name:p==null?void 0:p.cardName,postal_code:p==null?void 0:p.zipCode,customer_id:e==null?void 0:e.customerId})),Jt=JSON.stringify({pre_sales_id:`${(o=(r=Se==null?void 0:Se.data)==null?void 0:r.data)==null?void 0:o.posSalesIdEncode}`,token:`${(z=Ct==null?void 0:Ct.data)==null?void 0:z.data.token}`,json_response:`${It}`}),Bn={method:"POST",headers:JSON.stringify({"Content-Type":"application/json"}),body:Jt,redirect:"follow",isChargeviafractal:!0};Mt.emit("sendMessage",Bn),Mt.on("chargeviafractalgateway",At=>{var En;if($n(At==null?void 0:At.data)){let Xt=JSON.parse(At==null?void 0:At.data);Xt!=null&&Xt.result?(lt((En=Xt==null?void 0:Xt.data)==null?void 0:En.transactionId),_e(!0),Y(!1)):(Y(!1),I((Xt==null?void 0:Xt.message)||"Something went wrong."))}else I("Something went wrong.")})}catch(Ct){Y(!1),I(((A=(H=Ct==null?void 0:Ct.response)==null?void 0:H.data)==null?void 0:A.message)||(Ct==null?void 0:Ct.message)||"Something went wrong.")}}catch(Ae){Y(!1),I(((G=(ie=Ae==null?void 0:Ae.response)==null?void 0:ie.data)==null?void 0:G.message)||(Ae==null?void 0:Ae.message)||"Something went wrong.")}}else typeof DatacapWebToken!="undefined"&&DatacapWebToken.requestToken(Se==null?void 0:Se.data.data.dctoken,"PaymentForm",U)}catch(Le){Y(!1),I(((te=(oe=Le==null?void 0:Le.response)==null?void 0:oe.data)==null?void 0:te.message)||(Le==null?void 0:Le.message)||"Something went wrong.")}}}}else{if(X())return;{Y(!0);let ae={fractalpayPublicKey:y,label:(l==null?void 0:l.name)||"John Doe",account_number:l==null?void 0:l.accountNumber,routing_number:l==null?void 0:l.routingNumber,bank_name:l==null?void 0:l.bankName,account_type:l==null?void 0:l.accountType,amount:String(ve||0),isSaveAch:V,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,company_name:(l==null?void 0:l.companyName)||""};Mt.emit("sendMessage",ae),Mt.on("ach-incoming",ne=>{var he;(ne==null?void 0:ne.status)=="Failed"?typeof(ne==null?void 0:ne.message)=="object"?Object.values(ne==null?void 0:ne.message).forEach(Pe=>{I(Pe||"Something went wrong")}):I((ne==null?void 0:ne.message)||"Something went wrong"):(lt((he=ne==null?void 0:ne.data)==null?void 0:he.transaction_id),_e(!0),Y(!1))})}}},it=async()=>{var F,d,j,ke,ee,Ve,ge,Me,r,o,z,H,A,ie,G,oe,te,de,ae,ne,he,Pe,Le;ht();try{let Se={fractalpayPublicKey:y,customer_id:e==null?void 0:e.customerId,pass_fee:e==null?void 0:e.pass_fee},U=await dn.post(`${Fe}get-payment-details`,Se);if(nt((F=U==null?void 0:U.data)==null?void 0:F.data),(j=(d=U==null?void 0:U.data)==null?void 0:d.data)!=null&&j.paymentGateway||(N(),I("Something went wrong.")),(ee=(ke=U==null?void 0:U.data)==null?void 0:ke.data)!=null&&ee.card_list&&((Me=(ge=(Ve=U==null?void 0:U.data)==null?void 0:Ve.data)==null?void 0:ge.card_list)==null?void 0:Me.length)>0){let ze=(z=(o=(r=U==null?void 0:U.data)==null?void 0:r.data)==null?void 0:o.card_list)==null?void 0:z.filter(ct=>(ct==null?void 0:ct.card_type)=="Bank"),Ae=(ie=(A=(H=U==null?void 0:U.data)==null?void 0:H.data)==null?void 0:A.card_list)==null?void 0:ie.filter(ct=>(ct==null?void 0:ct.card_type)!=="Bank");console.log(ze,"hohgohoo",Ae),(Ae==null?void 0:Ae.length)>0&&E("list"),(ze==null?void 0:ze.length)>0&&fe("list"),De(Ae),ot(ze)}else ue("card");(oe=(G=U==null?void 0:U.data)==null?void 0:G.data)!=null&&oe.paymentDeviceList&&((ae=(de=(te=U==null?void 0:U.data)==null?void 0:te.data)==null?void 0:de.paymentDeviceList)==null?void 0:ae.length)>0&&st((he=(ne=U==null?void 0:U.data)==null?void 0:ne.data)==null?void 0:he.paymentDeviceList[0]),Yt()}catch(Se){console.log(Se),Yt(),I(((Le=(Pe=Se==null?void 0:Se.response)==null?void 0:Pe.data)==null?void 0:Le.message)||(Se==null?void 0:Se.message)||"Something went wrong")}},Nt=async()=>{let F=e==null?void 0:e.customerId,d=String(e==null?void 0:e.discount),j=String(e==null?void 0:e.surcharge),ke=String(e==null?void 0:e.tax),ee=e==null?void 0:e.merchantPublicKey,Ve=e==null?void 0:e.orderID,ge=String(e==null?void 0:e.amount),Me=Ue==null?void 0:Ue.id,r=Ue==null?void 0:Ue.card_type;if(ee&&Ve&&ge&&ve)if(F)if(Me){let z={amount:r==="Bank"?ve:ge,order_id:Ve,customer_id:F,card_id:Me,fractalpayPublicKey:ee,isCardSave:c,discount:d,surcharge:j,tax:ke},o=z,{isCardSave:H}=o,A=_n(o,["isCardSave"]),G=Fe+(r==="Bank"?"charge-ach":"charge-by-card"),oe={"Content-Type":"application/json"};Y(!0),Mt.emit("sendMessage",{url:G,body:r=="Bank"?A:z,isChargebycard:!0}),Mt.on("charge-by-card",te=>{var de;(te==null?void 0:te.result)==!0||(te==null?void 0:te.status)==!0?(lt((de=te.data)==null?void 0:de.transaction_id),_e(!0),Y(!1)):I((te==null?void 0:te.message)||"Something went wrong.")})}else I("Please Select A Card/ACH");else I("Please Select Customer");else I("Something went wrong.")},bt=async()=>{var ee,Ve,ge,Me,r,o;let F=e==null?void 0:e.merchantPublicKey,d=e==null?void 0:e.orderID,j=String(e==null?void 0:e.amount),ke=e==null?void 0:e.customerId;if(!(rt!=null&&rt.device_id)){I("Please Select A Payment Device");return}if(F&&d&&j){Y(!0);let z={amount:j,fractalpayPublicKey:F,customer_order_id:d,device_id:rt==null?void 0:rt.device_id,customer_id:ke||""};try{let H=await dn.post(`${Fe}charge-with-reader`,z);((ee=H==null?void 0:H.data)==null?void 0:ee.result)==!0?(lt((ge=(Ve=H==null?void 0:H.data)==null?void 0:Ve.data)==null?void 0:ge.transaction_id),_e(!0),Y(!1)):(I(((Me=H==null?void 0:H.data)==null?void 0:Me.message)||"Something went wrong."),Y(!1))}catch(H){I(((o=(r=H==null?void 0:H.response)==null?void 0:r.data)==null?void 0:o.message)||"Something went wrong."),Y(!1)}}else I("Something went wrong.")},dt=()=>{n==="card"?Nt():n==="reader"&&bt()};ti(()=>{se&&y&&it()},[y,se]);let vt=async F=>{xn.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 d=>{if(d.isConfirmed){Y(!0);try{let j={card_id:F,customer_id:e==null?void 0:e.customerId,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey},ke=await dn.post(`${Fe}delete-customer-card`,j);Y(!1),it(),xn.fire({icon:"success",title:"Deleted!",text:"Card deleted.",confirmButtonText:"OK",showConfirmButton:!0,timer:1e3,timerProgressBar:!0,customClass:{confirmButton:"btn btn-dark"}})}catch(j){Y(!1),xn.fire({icon:"error",title:"Error!",text:"Failed to delete the card.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}}else d.dismiss===xn.DismissReason.cancel&&xn.fire({icon:"info",text:"Card not deleted",confirmButtonText:"OK",buttonsStyling:!1,customClass:{confirmButton:"btn btn-dark float-end",actions:"swal2-actions-end"}})})},kt=F=>{switch(F==null?void 0:F.toLowerCase()){case"visa":return W;case"mastercard":case"mc":case"m/c":return qe;case"amex":case"american express":case"ae":return Ee;case"discover":case"dcvr":return Ne;case"bank":return s;default:return F}},Tt=()=>{let F=ve||0;return(Number(e.amount)-F).toFixed(0)};return console.log(b,"activeinCard","activeinBank",h),t.createElement(t.Fragment,null,t.createElement(Ht,null),t.createElement(gn,null),t.createElement(yn,null),t.createElement(t.Fragment,null,t.createElement("button",{className:"paymentBtn",onClick:L},"Pay"),t.createElement($t,{open:se,onClose:N},Be&&t.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},t.createElement(Et,{error:Be,onClose:N})),Qe&&t.createElement(fn,{onClose:N,tranId:$e}),!Be&&!Qe&&t.createElement(t.Fragment,null,(f||O)&&t.createElement(Ft,{loading:f||O}),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:N},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:$==null?void 0:$.logo,id:"pay-logos"})),t.createElement("div",{className:"pay-container"},t.createElement("div",{className:"pay-header pay-conatiner-one frac-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:$==null?void 0:$.logo,id:"pay-logos"})),(J==null?void 0:J.length)>0&&D!=="cardList"&&t.createElement("button",{className:"res-charge-payment-back-btn ",onClick:()=>ue("cardList")}," ",t.createElement(Mn,null)," Back")),t.createElement("div",{className:"amt-pay-con"},t.createElement("div",{className:"pay-amount-conatiner"},t.createElement("small",{className:"pay-payment-amount"},"Select paymet type")),t.createElement("div",{className:"frac-card-bank-radio-main"},t.createElement(sn,{label:"Card",amount:(zt=Number(e==null?void 0:e.amount))==null?void 0:zt.toFixed(2),value:"card",onChange:me,activetab:D}),($==null?void 0:$.isSkyFiAccount)&&t.createElement(sn,{label:"Bank",amount:(_t=Number(ve))==null?void 0:_t.toFixed(2),value:"ach",onChange:me,activetab:D})),ve&&ve>0&&(e!=null&&e.pass_fee)?t.createElement("div",{className:"frac-cash-discount-fee"},t.createElement("small",null,D==="card"?"Cash Discount":"Cash Discount Savings"," "),t.createElement("p",null,"$",(Number(e.amount)-ve).toFixed(2))):null)),t.createElement("div",{className:"pay-conatiner-one-last"},t.createElement("img",{src:m,alt:""}),t.createElement("img",{src:K,alt:""}),"Secure payments powered by Fractal")),t.createElement("div",{className:"pay-tab pay-conatiner-two"},!f&&t.createElement("div",{className:"col-md-12"},t.createElement("div",{id:"payment-form-div"},D!=="cardList"?t.createElement("div",{className:"frac-charge-payment-back-btn-wrap "},(J==null?void 0:J.length)>0&&t.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>ue("cardList")}," ",t.createElement(Mn,null)," Back"),($==null?void 0:$.isSkyFiAccount)&&t.createElement("div",{className:"tab"},t.createElement("button",{className:"tablinks",onClick:F=>{me("card")},style:{border:D==="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:F=>{me("ach")},style:{border:D==="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"},"$",(We=Number(e==null?void 0:e.amount))==null?void 0:We.toFixed(2))),D!="ach"&&t.createElement("div",null,t.createElement("div",null,t.createElement("img",{src:W,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:qe,width:35,alt:""})),t.createElement("div",null,t.createElement("img",{src:Ee,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:Ne,width:35,alt:""})))),ve&&ve>0&&t.createElement("div",{className:"res-pay-con frac-cash-discount"},t.createElement("div",{className:"frac-cashlabel"},"Cash Discount"),t.createElement("div",null,"$",ve))):t.createElement("div",null,t.createElement("h6",{className:"charge-customer-name",style:{marginBottom:"16px !important"}}," Charge ",$==null?void 0:$.customer_name),t.createElement("h6",{className:"card-ach-heading",style:{marginBottom:"10px !important"}}," ",n==="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"},"$",(Ce=Number(e==null?void 0:e.amount))==null?void 0:Ce.toFixed(2))),t.createElement("div",null,t.createElement("div",null,t.createElement("img",{src:W,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:qe,width:35,alt:""})),t.createElement("div",null,t.createElement("img",{src:Ee,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:Ne,width:35,alt:""}))))),t.createElement("div",{id:"card",style:{display:D==="card"?"block":"none"},className:"tabcontent"},t.createElement("div",{className:"frac-card-payment"},t.createElement("div",{className:"frac-heading-card-wrap"},t.createElement("div",{className:"frac-backarrow"},(J==null?void 0:J.length)>0&&b==="form"&&t.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>E("list")}," ",t.createElement(Mn,null)),ve&&ve>0&&t.createElement("div",{className:"res-pay-con frac-cash-discount"},t.createElement("div",{className:"frac-cashlabel"},"Cash Discount"),t.createElement("div",null,"$",ve))),t.createElement("h6",{className:"frac-card-payment-heading"},"Card Payment")),D!="ach"&&t.createElement("div",{style:{display:"flex",gap:"8px",margin:"8px 0px 19px 0px"}},t.createElement("img",{src:W,alt:"",width:33}),t.createElement("img",{src:qe,width:33,alt:""}),t.createElement("img",{src:Ee,alt:"",width:33}),t.createElement("img",{src:Ne,width:33,alt:""}))),b==="list"?t.createElement(t.Fragment,null,t.createElement(ln,{listHeading:"Cards",paymentGateway:$==null?void 0:$.paymentGateway,ListItems:J,selectedCard:Ue,setSelectedCard:Lt,handleDeleteCard:vt,otherButtonLabel:"Pay With Other Card",otherButtonAction:()=>{E("form")}}),t.createElement("div",{className:"form-group",style:{padding:"0"}},t.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:dt},"$",(Re=Number(e==null?void 0:e.amount))==null?void 0:Re.toFixed(2)))):t.createElement("form",{id:"PaymentForm",style:{textAlign:"start"},onSubmit:Ge},t.createElement("div",{className:"ach-scrl",style:{minHeight:$!=null&&$.isSkyFiAccount&&(J==null?void 0:J.length)>0?"444px":$!=null&&$.isSkyFiAccount&&(J==null?void 0:J.length)==0?"456px":(J==null?void 0:J.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:(p==null?void 0:p.cardName)||"",onChange:F=>{let d=F.target.value;/^[a-zA-Z\s]*$/.test(d)&&pe("cardName",d)}}),(g==null?void 0:g.cardName)&&t.createElement("span",{className:"error-span"},g==null?void 0:g.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:(p==null?void 0:p.cardNumber)||"",onChange:F=>le(F),"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:(p==null?void 0:p.expiryMonth)||"",onChange:F=>pe("expiryMonth",F.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:(p==null?void 0:p.expiryYear)||"",onChange:F=>pe("expiryYear",F.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:(p==null?void 0:p.cvv)||"",onChange:F=>pe("cvv",F.target.value)})))),(g==null?void 0:g.cardNumber)&&t.createElement("span",{className:"error-span"},g==null?void 0:g.cardNumber),t.createElement("p",{style:{margin:"0"}},g!=null&&g.expiryMonth||g!=null&&g.expiryYear?t.createElement("span",{className:"error-span",style:{paddingRight:"4px"}},g==null?void 0:g.expiryMonth):"",(g==null?void 0:g.cvv)&&t.createElement("span",{className:"error-span"},g==null?void 0:g.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:(at=e==null?void 0:e.orderID)!=null?at:"",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:(Vt=p==null?void 0:p.zipCode)!=null?Vt:"",onChange:F=>pe("zipCode",F.target.value)}),(g==null?void 0:g.zipCode)&&t.createElement("span",{className:"error-span"},g==null?void 0:g.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:c,onChange:F=>ut(F.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"}},($==null?void 0:$.paymentDeviceList)&&((Je=$==null?void 0:$.paymentDeviceList)==null?void 0:Je.length)>0&&t.createElement("button",{type:"button",style:{marginBottom:"10px"},className:"pay-button",onClick:()=>Te(!Q)},Q?"Pay With Reader":"Pay With Card"),t.createElement("button",{type:"submit",style:{margin:0},className:"pay-button"},"$",(Kt=Number(e==null?void 0:e.amount))==null?void 0:Kt.toFixed(2))))),t.createElement("div",{id:"ach",style:{display:D==="ach"?"block":"none"},className:"tabcontent"},t.createElement("div",{className:"frac-card-payment"},t.createElement("div",{className:"frac-heading-card-wrap"},t.createElement("div",{className:"frac-backarrow"},(ft==null?void 0:ft.length)>0&&h==="form"&&t.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>fe("list")}," ",t.createElement(Mn,null)),ve&&ve>0&&t.createElement("div",{className:"res-pay-con frac-cash-discount"},t.createElement("div",{className:"frac-cashlabel"},"Cash Discount Savings"),t.createElement("div",null,"$",Tt()))),t.createElement("h6",{className:"frac-card-payment-heading"},"Bank Payment"))),h==="list"?t.createElement(t.Fragment,null,t.createElement(ln,{listHeading:"Banks",paymentGateway:$==null?void 0:$.paymentGateway,ListItems:ft,selectedCard:Ue,setSelectedCard:Lt,handleDeleteCard:vt,otherButtonLabel:"Pay With Other Bank",otherButtonAction:()=>{fe("form")}}),t.createElement("div",{className:"form-group",style:{padding:"0"}},t.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:dt},"$",(St=Number(ve))==null?void 0:St.toFixed(2)))):t.createElement("form",{id:"ACHPaymentForm",style:{textAlign:"start"},onSubmit:Ge},t.createElement("div",{className:"ach-scrl",style:{minHeight:$!=null&&$.isSkyFiAccount&&(J==null?void 0:J.length)>0?"444px":$!=null&&$.isSkyFiAccount&&(J==null?void 0:J.length)==0?"436px":(J==null?void 0:J.length)>0?"462px":"520px",maxHeight:$!=null&&$.isSkyFiAccount&&(J==null?void 0:J.length)>0?"444px":((J==null?void 0:J.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:(je=l==null?void 0:l.name)!=null?je:"",onChange:Ye}),(C==null?void 0:C.name)&&t.createElement("span",{className:"error-span"},C==null?void 0:C.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:(et=l==null?void 0:l.routingNumber)!=null?et:"",onChange:Ye}),(C==null?void 0:C.routingNumber)&&t.createElement("span",{className:"error-span"},C==null?void 0:C.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:(Ut=l==null?void 0:l.accountNumber)!=null?Ut:"",onChange:Ye}),(C==null?void 0:C.accountNumber)&&t.createElement("span",{className:"error-span"},C==null?void 0:C.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:(qt=l==null?void 0:l.confirmAccountNumber)!=null?qt:"",onChange:Ye}),(C==null?void 0:C.confirmAccountNumber)&&t.createElement("span",{className:"error-span"},C==null?void 0:C.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:(Gt=l==null?void 0:l.bankName)!=null?Gt:"",onChange:Ye}),(C==null?void 0:C.bankName)&&t.createElement("span",{className:"error-span"},C==null?void 0:C.bankName)),((l==null?void 0:l.accountType)==="business saving"||(l==null?void 0:l.accountType)==="business checking")&&t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"companyName"},"Company name"),t.createElement("input",{type:"text",id:"companyName",className:"form-control",maxLength:100,placeholder:"My Company",name:"companyName",value:(mt=l==null?void 0:l.companyName)!=null?mt:"",onChange:Ye}),(C==null?void 0:C.companyName)&&t.createElement("span",{className:"error-span"},C==null?void 0:C.companyName)),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:(Ot=l==null?void 0:l.accountType)!=null?Ot:"",onChange:Ye},t.createElement("option",{value:""},"Select account"),Fn.map(F=>t.createElement("option",{key:F.value,value:F.value},F.label)))),(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:V,onChange:F=>gt(F.target.checked)}),t.createElement("label",{htmlFor:"saveACH"},"Save ACH")),V&&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"},"$",(nn=Number(ve))==null?void 0:nn.toFixed(2)))))))))))))))}import a,{useEffect as ni,useState as Pt}from"react";import bn from"axios";import Yn from"sweetalert2";import{IoArrowBack as ii}from"react-icons/io5";function Yi(e){var ve,Ze,$,nt,$e,lt,ht,Yt,Wt;let[f,q]=Pt(!1),[O,Y]=Pt(!1),[Be,I]=Pt(""),[Qe,_e]=Pt(!1),[se,T]=Pt(!1),[D,ue]=Pt("card"),[n,u]=Pt(!1),b=e.merchantPublicKey,E=R+"widget/mc-img.svg",h=R+"widget/visa-img.svg",fe=R+"widget/ae-img.svg",Q=R+"widget/discover-img.svg",Te=R+"widget/card.svg",c=R+"widget/Trash.svg",ut=R+"widget/bank.svg",V=R+"widget/secure-img.png",gt=R+"widget/pov-by.png",[y,qe]=Pt(),[W,Ee]=Pt({}),[Ne,xt]=Pt([]),[w,s]=Pt(),[m,K]=Pt(void 0),[x,p]=Pt(),[S,g]=Pt(""),Z=(N,L)=>{let me=(parseFloat(L)||0)/100,pe=N/(1+me);return Math.round(pe*100)/100};ni(()=>{if(e!=null&&e.pass_fee){let N=Z(e==null?void 0:e.amount,e==null?void 0:e.surcharge);K(N)}},[e==null?void 0:e.pass_fee]);let l=()=>q(!0),v=()=>q(!1),C=()=>{T(!1),ue("card"),Y(!1),I(""),_e(!1),g(""),qe({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),Ee({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),u(!1),s({card_type:"",cardlastfourdigit:"",expmonth:1,expyear:2025,primary_card:0,firstname:"",id:"",lastname:""})},ce=()=>T(!0),J=(N,L)=>{let me=N;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(me)){(L===""||/^[0-9]+$/.test(L))&&(Ee(le=>B(k({},le),{[me]:""})),qe(le=>B(k({},le),{[me]:L})));return}Ee(le=>B(k({},le),{[me]:""})),qe(le=>B(k({},le),{[me]:L}))},De=N=>{let me=N.target.value.replace(/\D/g,""),pe="";/^3[47]/.test(me)?pe=me.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(Ye,He,X,Ge)=>[He,X,Ge].filter(Boolean).join(" ")):pe=me.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(Ye,He,X,Ge,it)=>[He,X,Ge,it].filter(Boolean).join(" ")),Ee(le=>B(k({},le),{cardNumber:""})),qe(le=>B(k({},le),{cardNumber:pe}))},ft=()=>{var le,Ye,He,X,Ge,it;let N={},L=y,me=parseInt((L==null?void 0:L.expiryMonth)||"",10),pe=(L==null?void 0:L.expiryYear)||"";if((le=L==null?void 0:L.cardName)!=null&&le.trim()||(N.cardName="Card name is required"),(Ye=L==null?void 0:L.cardNumber)!=null&&Ye.trim()||(N.cardNumber="Card number is required"),(!((He=L==null?void 0:L.expiryMonth)!=null&&He.trim())||!((X=L==null?void 0:L.expiryYear)!=null&&X.trim())||isNaN(me)||me<1||me>12||pe.length!==4)&&(N.expiryMonth="Invalid Expiration Date."),(Ge=L==null?void 0:L.cvv)!=null&&Ge.trim()||(N.cvv="CVV is required"),(it=L==null?void 0:L.zipCode)!=null&&it.trim()||(N.zipCode="ZIP code is required"),L!=null&&L.expiryMonth&&(L!=null&&L.expiryYear)&&L.expiryMonth.length<=2&&L.expiryYear.length===4){let Nt=parseInt(L.expiryMonth,10),bt=parseInt(L.expiryYear,10),dt=new Date,vt=dt.getMonth()+1,kt=dt.getFullYear();(bt<kt||bt===kt&&Nt<vt)&&(N.expiryMonth="Card is expired")}return Ee(N),Object.keys(N).length>0},ot=async N=>{var L,me,pe,le,Ye,He,X,Ge,it,Nt,bt,dt,vt,kt,Tt,zt,_t,We,Ce;if(N.preventDefault(),D=="card"){if(ft())return;{let at=DatacapWebToken.validateCardNumber(y==null?void 0:y.cardNumber.replaceAll(" ","")),Vt=DatacapWebToken.validateExpirationDate(y==null?void 0:y.expiryMonth,y==null?void 0:y.expiryYear),Je=DatacapWebToken.validateCVV(y==null?void 0:y.cvv),Kt={};if(at||(Kt.cardNumber="Invalid card Number"),Vt||(Kt.expiryMonth="Invalid Expiration Date."),Je||(Kt.cvv="Invalid CVV"),Ee(Kt),at&&Je&&Vt){Y(!0);try{let St=async function(je){if(je.Error)I(je.Error),Y(!1);else{let et=y==null?void 0:y.cardName,Ut=y==null?void 0:y.zipCode;je.name=et,je.postal_code=Ut,je.fractalpayPublicKey=e==null?void 0:e.merchantPublicKey,je.amount=e==null?void 0:e.amount,je.order_id=e==null?void 0:e.orderID,je.preAuth_id="",je.isCardSave=n,je.customer_id=e==null?void 0:e.customerId,je.link_token="",je.gateway_id=x==null?void 0:x.paymentGateway,je.discount=e==null?void 0:e.discount,je.tax=e==null?void 0:e.tax,je.surcharge=e==null?void 0:e.surcharge,je.pass_fee=e==null?void 0:e.pass_fee,new Headers().append("Content-Type","application/json");let Gt={method:"POST",body:JSON.stringify(je),redirect:"follow"};Mt.emit("sendMessage",B(k({},Gt),{isChargePreauth:!0})),Mt.on("charge-preauth",mt=>{var Ot;console.log(mt,"datdata"),(mt==null?void 0:mt.status)=="Failed"?(Y(!1),I((mt==null?void 0:mt.message)||"Something went wrong. Please try again later.")):(_e(!0),g((Ot=mt==null?void 0:mt.data)==null?void 0:Ot.transaction_id),Y(!1),qe({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}))})}};if((x==null?void 0:x.paymentGateway)===32){let je={method:"POST",redirect:"follow"};try{let et=await bn.post(`${be}api/v1/widget/generate-session`,je),Ut=Number(y==null?void 0:y.expiryYear)%100,qt=y==null?void 0:y.cardNumber;qt=qt==null?void 0:qt.replace(/\s+/g,"");let Gt=`${qt}=${Ut}${y==null?void 0:y.expiryMonth} ${y==null?void 0:y.cvv}`,Ot=forge.pki.publicKeyFromPem((me=(L=et==null?void 0:et.data)==null?void 0:L.data)==null?void 0:me.publicKeyPem).encrypt(Gt,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),nn=forge.util.encode64(Ot),F={"Content-Type":"application/json","x-app-session-key":(le=(pe=et.data)==null?void 0:pe.data)==null?void 0:le.session_key},d=JSON.stringify({enc_track2_data:`${nn}`,algorithm:"RSAES_OAEP_SHA_1",session_key:`${(He=(Ye=et==null?void 0:et.data)==null?void 0:Ye.data)==null?void 0:He.session_key}`});try{let j=await bn.post(`${wt}tokenizer/tokenize`,d,{headers:F}),ke=JSON.stringify(B(k({},(X=j==null?void 0:j.data)==null?void 0:X.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:`${(it=(Ge=j==null?void 0:j.data)==null?void 0:Ge.data)==null?void 0:it.token}`,fractalpayPublicKey:b,order_id:e==null?void 0:e.orderID,preAuth_id:"",isCardSave:n,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:(bt=(Nt=j==null?void 0:j.data)==null?void 0:Nt.data)==null?void 0:bt.last4,Brand:(vt=(dt=j==null?void 0:j.data)==null?void 0:dt.data)==null?void 0:vt.brand,gateway_id:x==null?void 0:x.paymentGateway,pass_fee:e==null?void 0:e.pass_fee})),Ve={method:"POST",headers:{"Content-Type":"application/json"},body:ke,redirect:"follow"};Mt.emit("sendMessage",B(k({},Ve),{isFractalPreauth:!0})),Mt.on("fractal-charge-preauth",ge=>{var Me;(ge==null?void 0:ge.status)=="Failed"?(Y(!1),I((ge==null?void 0:ge.message)||"Something went wrong , Try again later")):(g((Me=ge==null?void 0:ge.data)==null?void 0:Me.transaction_id),_e(!0),Y(!1))})}catch(j){console.log(j),Y(!1),I(((Tt=(kt=j==null?void 0:j.response)==null?void 0:kt.data)==null?void 0:Tt.message)||(j==null?void 0:j.message)||"Something went wrong , Try again later")}}catch(et){Y(!1),I(((_t=(zt=et==null?void 0:et.response)==null?void 0:zt.data)==null?void 0:_t.message)||(et==null?void 0:et.message)||"Something went wrong , Try again later")}}else DatacapWebToken.requestToken(x==null?void 0:x.dctoken,"PaymentForm",St)}catch(St){Y(!1),I(((Ce=(We=St==null?void 0:St.response)==null?void 0:We.data)==null?void 0:Ce.message)||(St==null?void 0:St.message)||"Something went wrong.")}}}}},Ue=async()=>{var N,L,me,pe,le,Ye,He,X,Ge,it,Nt,bt,dt,vt,kt,Tt,zt,_t;l();try{let We={fractalpayPublicKey:b,customer_id:e==null?void 0:e.customerId,preauth:!0},Ce=await bn.post(`${Fe}get-payment-details`,We);if(p((N=Ce==null?void 0:Ce.data)==null?void 0:N.data),(me=(L=Ce==null?void 0:Ce.data)==null?void 0:L.data)!=null&&me.paymentGateway||(C(),I("Something went wrong.")),(le=(pe=Ce==null?void 0:Ce.data)==null?void 0:pe.data)!=null&&le.card_list&&((X=(He=(Ye=Ce==null?void 0:Ce.data)==null?void 0:Ye.data)==null?void 0:He.card_list)==null?void 0:X.length)>0){xt((it=(Ge=Ce==null?void 0:Ce.data)==null?void 0:Ge.data)==null?void 0:it.card_list),ue("cardList");let Re=(dt=(bt=(Nt=Ce==null?void 0:Ce.data)==null?void 0:Nt.data)==null?void 0:bt.card_list)==null?void 0:dt.filter(at=>(at==null?void 0:at.primary_card)==1);Re!=null&&Re[0]&&((vt=Re==null?void 0:Re[0])==null?void 0:vt.payment_method_type)==((Tt=(kt=Ce==null?void 0:Ce.data)==null?void 0:kt.data)==null?void 0:Tt.paymentGateway)&&s(Re[0])}else ue("card");v()}catch(We){console.log(We),v(),I(((_t=(zt=We==null?void 0:We.response)==null?void 0:zt.data)==null?void 0:_t.message)||(We==null?void 0:We.message)||"Something went wrong")}},Lt=async()=>{var Nt,bt,dt,vt,kt,Tt,zt;let N=e==null?void 0:e.customerId,L=e==null?void 0:e.discount,me=e==null?void 0:e.surcharge,pe=e==null?void 0:e.tax,le=e==null?void 0:e.merchantPublicKey,Ye=e==null?void 0:e.orderID,He=e==null?void 0:e.amount,X=w==null?void 0:w.id,Ge=w==null?void 0:w.card_type;if(le&&Ye&&He)if(N)if(X){let _t={amount:He,order_id:Ye,customer_id:N,card_id:X,fractalpayPublicKey:le,isCardSave:Ge!="Bank",discount:L,surcharge:me,tax:pe},it=_t,{isCardSave:We}=it,Ce=_n(it,["isCardSave"]),at=Fe+"authorize-by-card",Vt={"Content-Type":"application/json"};Y(!0);try{let Je=await bn.post(at,Ge=="Bank"?Ce:_t,{headers:Vt});(Nt=Je==null?void 0:Je.data)!=null&&Nt.result&&(g((dt=(bt=Je==null?void 0:Je.data)==null?void 0:bt.data)==null?void 0:dt.transaction_id),_e(!0),Y(!1))}catch(Je){Y(!1),console.log(Je),I(((kt=(vt=Je==null?void 0:Je.response)==null?void 0:vt.data)==null?void 0:kt.message)||((zt=(Tt=Je==null?void 0:Je.response)==null?void 0:Tt.data)==null?void 0:zt.status)||"Something went erong")}}else I("Please Select A Card/ACH");else I("Please Select Customer");else I("Something went wrong.")};ni(()=>{se&&b&&Ue()},[b,se]);let rt=async N=>{Yn.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 L=>{if(L.isConfirmed){Y(!0);try{let me={card_id:N,customer_id:e==null?void 0:e.customerId,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey},pe=await bn.post(`${Fe}delete-customer-card`,me);Y(!1),Ue(),Yn.fire({icon:"success",title:"Deleted!",text:"The card has been deleted.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}catch(me){Y(!1),Yn.fire({icon:"error",title:"Error!",text:"Failed to delete the card.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}}})},st=N=>{switch(N==null?void 0:N.toLowerCase()){case"visa":return h;case"mastercard":case"mc":case"m/c":return E;case"amex":case"american express":case"ae":return fe;case"discover":case"dcvr":return Q;case"bank":return ut;default:return N}};return a.createElement(a.Fragment,null,a.createElement(Ht,null),a.createElement(gn,null),a.createElement(a.Fragment,null,a.createElement("button",{className:"paymentBtn",onClick:ce},"PreAuth Payment"),a.createElement($t,{open:se,onClose:C},Be&&a.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},a.createElement(Et,{error:Be,onClose:C})),Qe&&a.createElement(fn,{onClose:C,tranId:S}),!Be&&!Qe&&a.createElement(a.Fragment,null,(f||O)&&a.createElement(Ft,{loading:f||O}),a.createElement("div",null,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-container"},a.createElement("div",{className:"pay-header pay-conatiner-one"},a.createElement("div",{className:"pay-conatiner-one-first"},a.createElement("div",{className:"pay-logo-container"},a.createElement("div",{className:"pay-main-logo"},a.createElement("img",{src:x==null?void 0:x.logo,id:"pay-logos"})),a.createElement("h1",{className:"pay-heading"},"Pay"),(Ne==null?void 0:Ne.length)>0&&D!=="cardList"&&a.createElement("button",{className:"res-charge-payment-back-btn ",onClick:()=>ue("cardList")}," ",a.createElement(ii,null)," Back")),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"},"$",(ve=Number(e==null?void 0:e.amount))==null?void 0:ve.toFixed(2)),m&&m>0&&a.createElement("div",{style:{width:"80%"},className:"frac-cash-discount"},a.createElement("div",{className:"frac-cashlabel"},"Cash Discount"),a.createElement("div",null,"$",m.toFixed(2)))),D!="ach"&&a.createElement("div",{style:{display:"flex",gap:"8px",margin:"8px 0"}},a.createElement("img",{src:h,alt:"",width:33}),a.createElement("img",{src:E,width:33,alt:""}),a.createElement("img",{src:fe,alt:"",width:33}),a.createElement("img",{src:Q,width:33,alt:""})))),a.createElement("div",{className:"pay-conatiner-one-last"},a.createElement("img",{src:V,alt:""}),a.createElement("img",{src:gt,alt:""}),"Secure payments powered by Fractal"),a.createElement("div",null)),!f&&a.createElement("div",{className:"pay-tab pay-conatiner-two"},a.createElement("div",{className:"col-md-12"},a.createElement("div",{id:"payment-form-div"},D!=="cardList"?a.createElement("div",null,(Ne==null?void 0:Ne.length)>0&&a.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>ue("cardList")}," ",a.createElement(ii,null)," Back"),a.createElement("div",{className:""},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"},"$",(Ze=Number(e==null?void 0:e.amount))==null?void 0:Ze.toFixed(2))),a.createElement("div",null,a.createElement("div",null,a.createElement("img",{src:h,alt:"",width:35,style:{paddingRight:"5px"}}),a.createElement("img",{src:E,width:35,alt:""})),a.createElement("div",null,a.createElement("img",{src:fe,alt:"",width:35,style:{paddingRight:"5px"}}),a.createElement("img",{src:Q,width:35,alt:""})))),m&&m>0&&a.createElement("div",{className:"res-pay-con frac-cash-discount"},a.createElement("div",{className:"frac-cashlabel"},"Cash Discount"),a.createElement("div",null,"$",m)))):a.createElement("div",null,a.createElement("h6",{className:"charge-customer-name",style:{marginBottom:"16px !important"}}," Charge ",x==null?void 0:x.customer_name),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"},"$",($=Number(e==null?void 0:e.amount))==null?void 0:$.toFixed(2))),a.createElement("div",null,a.createElement("div",null,a.createElement("img",{src:h,alt:"",width:35,style:{paddingRight:"5px"}}),a.createElement("img",{src:E,width:35,alt:""})),a.createElement("div",null,a.createElement("img",{src:fe,alt:"",width:35,style:{paddingRight:"5px"}}),a.createElement("img",{src:Q,width:35,alt:""})))),a.createElement("h6",{className:"card-ach-heading",style:{marginBottom:"10px !important"}}," Cards")),a.createElement("div",{style:{display:D==="cardList"?"block":"none"},className:"tabcontent"},a.createElement("div",{className:"card-lint-div-in"},a.createElement("div",{className:"card-list-div"},(x==null?void 0:x.card_list)&&((nt=x==null?void 0:x.card_list)==null?void 0:nt.length)>0&&(($e=x==null?void 0:x.card_list)==null?void 0:$e.map((N,L)=>a.createElement("div",{className:"card-list-single-div",key:L},a.createElement("div",{className:"card-number-radio"},a.createElement("input",{disabled:(x==null?void 0:x.paymentGateway)!=(N==null?void 0:N.payment_method_type),type:"radio",className:"cardRadio",name:"selected_card",id:"",checked:w===N,onChange:me=>s(N)}),a.createElement("label",{htmlFor:"",className:"card-number-last-four"},"**** ",N==null?void 0:N.cardlastfourdigit),a.createElement("h6",{className:"card-expiry-date"},N==null?void 0:N.expmonth,"/",N==null?void 0:N.expyear)),a.createElement("div",{className:"card-number-radio"},a.createElement("span",{className:"visa-card"},a.createElement("img",{src:st(N==null?void 0:N.card_type),alt:""})),a.createElement("span",{className:"visa-card",style:{cursor:"pointer"},onClick:()=>rt(N==null?void 0:N.id)},a.createElement("img",{src:c,alt:""}))))))),a.createElement("div",{className:"pay-with-other-card ",onClick:()=>ue("card")},"Authorize With Other Card",a.createElement("img",{src:Te,alt:""}))),a.createElement("div",{className:"form-group"},a.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:Lt},"$",(lt=Number(e==null?void 0:e.amount))==null?void 0:lt.toFixed(2)))),a.createElement("div",{id:"card",style:{display:D==="card"?"block":"none"},className:"tabcontent"},a.createElement("form",{id:"PaymentForm",onSubmit:ot},a.createElement("div",{className:"ach-scrl",style:{minHeight:(Ne==null?void 0:Ne.length)>0?"462px":"520px",overflow:"auto",marginRight:"5px"}},a.createElement("div",{className:"form-group"},a.createElement("label",{htmlFor:"cardHolderName"},"Name on Card"),a.createElement("input",{type:"text",className:"form-control",placeholder:"John Doe",value:(y==null?void 0:y.cardName)||"",onChange:N=>{let L=N.target.value;/^[a-zA-Z\s]*$/.test(L)&&J("cardName",L)}}),(W==null?void 0:W.cardName)&&a.createElement("span",{className:"error-span"},W==null?void 0:W.cardName)),a.createElement("div",{className:"form-group"},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:(y==null?void 0:y.cardNumber)||"",onChange:N=>De(N),"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"},a.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:N=>J("expiryMonth",N.target.value)})),a.createElement("div",{className:"exp-year form-group"},a.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:N=>J("expiryYear",N.target.value)})),a.createElement("div",{className:"security-digit form-group"},a.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:N=>J("cvv",N.target.value)})))),(W==null?void 0:W.cardNumber)&&a.createElement("span",{className:"error-span"},W==null?void 0:W.cardNumber),a.createElement("p",{style:{margin:"0"}},W!=null&&W.expiryMonth||W!=null&&W.expiryYear?a.createElement("span",{className:"error-span",style:{paddingRight:"4px"}},W==null?void 0:W.expiryMonth):"",(W==null?void 0:W.cvv)&&a.createElement("span",{className:"error-span"},W==null?void 0:W.cvv)))),a.createElement("div",{className:"form-group"},a.createElement("label",{htmlFor:"OrderId"},"Order ID / Description"),a.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"OID123456",disabled:!0,value:(ht=y==null?void 0:y.orderId)!=null?ht:"OID123456",onChange:N=>J("orderId",N.target.value),style:{background:"#F6F6F7",color:"#727272"}})),a.createElement("div",{className:"form-group"},a.createElement("label",{htmlFor:"zip"},"ZIP"),a.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"000000",value:(Yt=y==null?void 0:y.zipCode)!=null?Yt:"",onChange:N=>J("zipCode",N.target.value)}),(W==null?void 0:W.zipCode)&&a.createElement("span",{className:"error-span"},W==null?void 0:W.zipCode)),(e==null?void 0:e.customerId)&&a.createElement("div",{className:"form-group"},a.createElement("div",{className:"frac-tooltip-mn",style:{display:"flex",alignItems:"center",gap:"10px",paddingTop:"10px"}},a.createElement("input",{type:"checkbox",id:"save_card",className:"toggle-checkbox",checked:n,onChange:N=>u(N.target.checked)}),a.createElement("label",{htmlFor:"save_card",className:"toggle-label"}),a.createElement("label",{htmlFor:"save_card"},"Save card for future payments "),a.createElement("div",{className:"frac-tooltip-wrapper"},a.createElement("div",{className:"frac-tooltip-icon"},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:"frac-tooltip-text"},a.createElement("p",null,"If checked, I agree to give the ",a.createElement("b",null,(x==null?void 0:x.bname)||"merchant")," permission to charge this credit card for agreed-upon purchases in the future.")))))),a.createElement("div",{className:"form-group",style:{marginTop:"20px",padding:0}},a.createElement("button",{type:"submit",style:{margin:0},className:"pay-button"},"$",(Wt=Number(e==null?void 0:e.amount))==null?void 0:Wt.toFixed(2))))))))))))))))}import re,{useEffect as Ki,useRef as vn,useState as rn}from"react";import Oi from"sweetalert2";import mn from"axios";import Hi from"react";function Hn(){let e="#000",f="#fff",q="#212529",O="#dee2e6";return Hi.createElement("style",null,`
|
|
1636
1636
|
.add-card {
|
|
1637
1637
|
max-width:380px;
|
|
1638
1638
|
padding: 0 20px
|
|
@@ -1891,7 +1891,7 @@ var ai=Object.defineProperty,oi=Object.defineProperties;var ri=Object.getOwnProp
|
|
|
1891
1891
|
}
|
|
1892
1892
|
}
|
|
1893
1893
|
|
|
1894
|
-
`)}import jt from"react";import
|
|
1894
|
+
`)}import jt from"react";import ji from"react";function jn(){return ji.createElement("style",null,`
|
|
1895
1895
|
.card-success .logo-container {
|
|
1896
1896
|
display: flex;
|
|
1897
1897
|
justify-content: center;
|
|
@@ -1979,7 +1979,7 @@ var ai=Object.defineProperty,oi=Object.defineProperties;var ri=Object.getOwnProp
|
|
|
1979
1979
|
color: #161616;
|
|
1980
1980
|
opacity: 0.5;
|
|
1981
1981
|
}
|
|
1982
|
-
`)}var ji=({onClose:e})=>jt.createElement(jt.Fragment,null,jt.createElement(Hn,null),jt.createElement("div",{className:"card-success"},jt.createElement("div",{className:"payment-success-container"},jt.createElement("div",{className:"success-icon"},jt.createElement("div",{className:"circle"},jt.createElement("i",{className:"fa fa-check-circle","aria-hidden":"true"})),jt.createElement("div",{className:"success-text"},jt.createElement("div",{className:"payment-success-text"},"Your card was added successfully."),jt.createElement("div",{className:"thank-you-text"},"Thank you ")))))),ii=ji;function Oi(e){var w;let[f,q]=on(!1),[O,Y]=on(!1),[Ae,I]=on(""),[Qe,Se]=on(!1),se=bn(null),T=bn(null),D=bn(null),ue=bn(null),n=bn(null),[u,b]=on(),[E,h]=on({}),[he,Q]=on(),Be=()=>q(!0),c=()=>q(!1),ut=s=>{Ki.fire({icon:"error",text:s,customClass:{popup:"custom-z-index"}})},V=()=>{Se(!1),Y(!1),I(""),b({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""})},gt=()=>Se(!0),y=()=>{V()},Te=(s,m)=>{var p,S,g;let K=s,x=["expiryMonth","expiryYear","zipCode","cvv"];if(console.log(K,m==null?void 0:m.length,"dfih",K==="expiryMonth"&&(m==null?void 0:m.length)===2),K==="expiryMonth"&&(m==null?void 0:m.length)===2&&((p=D==null?void 0:D.current)==null||p.focus()),K==="expiryYear"&&(m==null?void 0:m.length)===4&&((S=ue==null?void 0:ue.current)==null||S.focus()),K==="cvv"&&(m==null?void 0:m.length)===3&&((g=n==null?void 0:n.current)==null||g.focus()),x.includes(K)){(m===""||/^[0-9]+$/.test(m))&&(h(Z=>B(k({},Z),{[K]:""})),b(Z=>B(k({},Z),{[K]:m})));return}h(Z=>B(k({},Z),{[K]:""})),console.log(m,K),b(Z=>B(k({},Z),{[K]:m}))},W=s=>{var p;let K=s.target.value.replace(/\D/g,""),x="";/^3[47]/.test(K)?x=K.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(g,Z,l,v)=>[Z,l,v].filter(Boolean).join(" ")):x=K.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(g,Z,l,v,C)=>[Z,l,v,C].filter(Boolean).join(" ")),h(S=>B(k({},S),{cardNumber:""})),b(S=>B(k({},S),{cardNumber:x})),console.log(K==null?void 0:K.length,"length"),(K==null?void 0:K.length)===16&&((p=T==null?void 0:T.current)==null||p.focus())},Ee=()=>{var p,S,g,Z,l,v;let s={},m=u,K=parseInt((m==null?void 0:m.expiryMonth)||"",10),x=(m==null?void 0:m.expiryYear)||"";if((p=m==null?void 0:m.cardName)!=null&&p.trim()||(s.cardName="Card name is required"),(S=m==null?void 0:m.cardNumber)!=null&&S.trim()||(s.cardNumber="Card number is required"),(g=m==null?void 0:m.expiryMonth)!=null&&g.trim()?(Number(m==null?void 0:m.expiryMonth)>12||Number(m==null?void 0:m.expiryMonth)<1)&&(s.expiryMonth="Invalid Expiration Month."):s.expiryMonth="Expiration month is required",(Z=m==null?void 0:m.expiryYear)!=null&&Z.trim()?((l=m==null?void 0:m.expiryYear)==null?void 0:l.trim().length)!==4||Number(m==null?void 0:m.expiryYear)<2025?s.expiryYear="Invalid Expiration Year.":(isNaN(K)||K<1||K>12||x.length!==4)&&(s.expiryMonth="Invalid Expiration Date."):s.expiryYear="Expiration year is required",(v=m==null?void 0:m.cvv)!=null&&v.trim()||(s.cvv="CVC is required"),m!=null&&m.expiryMonth&&(m!=null&&m.expiryYear)&&m.expiryMonth.length<=2&&m.expiryYear.length===4){let C=parseInt(m.expiryMonth,10),me=parseInt(m.expiryYear,10),J=new Date,De=J.getMonth()+1,ft=J.getFullYear();(me<ft||me===ft&&C<De)&&(s.expiryMonth="Card is expired")}return h(s),Object.keys(s).length>0},ke=async()=>{var s,m,K;Be();try{let x={fractalpayPublicKey:e==null?void 0:e.merchantPublicKey,customer_id:e==null?void 0:e.customerId,addcard:!0},p=await dn.post(`${Me}get-payment-details`,x);console.log(p),Q((s=p==null?void 0:p.data)==null?void 0:s.data),(K=(m=p==null?void 0:p.data)==null?void 0:m.data)!=null&&K.paymentGateway||(V(),I("Something went wrong.")),c()}catch(x){console.log(x),c(),V(),I("Something went wrong.")}};return Vi(()=>{e!=null&&e.merchantPublicKey&&ke()},[e==null?void 0:e.merchantPublicKey]),re.createElement(re.Fragment,null,re.createElement(Ht,null),re.createElement(Yn,null),re.createElement(Ft,{loading:f}),Ae&&re.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},re.createElement(Et,{error:Ae,onClose:V})),O&&re.createElement(ii,{onClose:y}),!Ae&&!O&&re.createElement(re.Fragment,null,re.createElement("div",{className:"container-creditcard add-card modal-content",id:"add-credit-card-panel",style:{margin:"auto"}},re.createElement("form",{id:"creditCardForm",onSubmit:async s=>{var K,x,p,S,g,Z,l,v,C,me,J,De,ft,ot,Ue,Lt;s.preventDefault();let m=Ee();if(console.log(u),!m){let rt=DatacapWebToken.validateCardNumber(u==null?void 0:u.cardNumber.replaceAll(" ","")),st=DatacapWebToken.validateExpirationDate(u==null?void 0:u.expiryMonth,u==null?void 0:u.expiryYear),ve=DatacapWebToken.validateCVV(u==null?void 0:u.cvv),Ze={};if(rt||(Ze.cardNumber="Invalid card Number"),st||(Ze.expiryMonth="Invalid Expiration Date."),ve||(Ze.cvv="Invalid CVV"),h(Ze),rt&&ve&&st){Be();try{let $=async function(nt){var qe,lt,ht,Yt,Wt;if(console.log(nt),nt.Error)console.log(nt==null?void 0:nt.Error),I(nt.Error),c();else{let N={userId:e==null?void 0:e.customerId,cardName:u==null?void 0:u.cardName,zip:u==null?void 0:u.zipCode,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey,token:nt};try{let L=await dn.post(`${Me}add-card`,N);console.log(L);let de={fractalpayPublicKey:e==null?void 0:e.merchantPublicKey,wallet_id:"",card_number:u==null?void 0:u.cardNumber.replaceAll(" ",""),exp_month:u==null?void 0:u.expiryMonth,exp_year:(qe=u==null?void 0:u.expiryYear)==null?void 0:qe.slice(-2),cvv:u==null?void 0:u.cvv};try{let ce=await dn.post(`${Me}link-wallet`,de);console.log(ce),Y(!0),c(),b({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),tn(s,"close","")}catch(ce){console.log(ce),c(),I(((ht=(lt=ce==null?void 0:ce.response)==null?void 0:lt.data)==null?void 0:ht.message)||(ce==null?void 0:ce.message)||"Something went wrong.")}}catch(L){console.log(L),c(),I(((Wt=(Yt=L==null?void 0:L.response)==null?void 0:Yt.data)==null?void 0:Wt.message)||(L==null?void 0:L.message)||"Something went wrong.")}}};if((he==null?void 0:he.paymentGateway)===32){let nt={method:"POST",redirect:"follow"};try{let qe=await dn.post(`${be}api/v1/widget/generate-session`,nt),lt=Number(u==null?void 0:u.expiryYear)%100,ht=u==null?void 0:u.cardNumber;ht=ht==null?void 0:ht.replace(/\s+/g,"");let Yt=`${ht}=${lt}${u==null?void 0:u.expiryMonth} ${u==null?void 0:u.cvv}`,N=forge.pki.publicKeyFromPem((x=(K=qe==null?void 0:qe.data)==null?void 0:K.data)==null?void 0:x.publicKeyPem).encrypt(Yt,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),L=forge.util.encode64(N),de={"Content-Type":"application/json","x-app-session-key":(S=(p=qe.data)==null?void 0:p.data)==null?void 0:S.session_key},ce=JSON.stringify({enc_track2_data:`${L}`,algorithm:"RSAES_OAEP_SHA_1",session_key:`${(Z=(g=qe==null?void 0:qe.data)==null?void 0:g.data)==null?void 0:Z.session_key}`});try{let le=await dn.post(`${wt}tokenizer/tokenize`,ce,{headers:de}),$e=JSON.stringify(B(k({},(l=le==null?void 0:le.data)==null?void 0:l.data),{cvv:u==null?void 0:u.cvv,cardName:u==null?void 0:u.cardName,zip:u==null?void 0:u.zipCode,userId:e==null?void 0:e.customerId,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey})),Ye={"Content-Type":"application/json"};try{let X=await dn.post(`${Me}add-card`,$e,{headers:Ye});console.log(X),(v=X==null?void 0:X.data)!=null&&v.result&&(Y(!0),c(),tn(s,"close",""))}catch(X){c(),I(((me=(C=X==null?void 0:X.response)==null?void 0:C.data)==null?void 0:me.message)||(X==null?void 0:X.message)||"Something went wrong.")}}catch(le){c(),I(((De=(J=le==null?void 0:le.response)==null?void 0:J.data)==null?void 0:De.message)||(le==null?void 0:le.message)||"Something went wrong.")}}catch(qe){c(),I(((ot=(ft=qe==null?void 0:qe.response)==null?void 0:ft.data)==null?void 0:ot.message)||(qe==null?void 0:qe.message)||"Something went wrong.")}}else typeof DatacapWebToken!="undefined"&&DatacapWebToken.requestToken(he==null?void 0:he.dctoken,"creditCardForm",$)}catch($){c(),I(((Lt=(Ue=$==null?void 0:$.response)==null?void 0:Ue.data)==null?void 0:Lt.message)||($==null?void 0:$.message)||"Something went wrong.")}}}},style:{padding:"0 10px"}},re.createElement("div",{style:{maxHeight:"350px",minHeight:"0"},className:"card-scrl"},re.createElement("div",{className:"form-group",style:{marginTop:"0",marginBottom:"10px"}},re.createElement("label",{htmlFor:"cardNumber"},"Card Number"),re.createElement("input",{type:"text","data-token":"card_number",placeholder:"Enter card number",maxLength:19,inputMode:"numeric",value:(u==null?void 0:u.cardNumber)||"",onChange:s=>W(s),ref:se}),(E==null?void 0:E.cardNumber)&&re.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},E==null?void 0:E.cardNumber),re.createElement("br",null)),re.createElement("div",{className:"card-dtl"},re.createElement("div",{className:"exp-cvc-container",style:{margin:"0"}},re.createElement("div",{className:"form-group",style:{marginTop:"0"}},re.createElement("label",{htmlFor:"expMonth"},"MM"),re.createElement("input",{"data-token":"exp_month",className:"form-control required",type:"text",placeholder:"MM",maxLength:2,value:(u==null?void 0:u.expiryMonth)||"",onChange:s=>Te("expiryMonth",s.target.value),ref:T}),(E==null?void 0:E.expiryMonth)&&re.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},E==null?void 0:E.expiryMonth)),re.createElement("div",{className:"form-group",style:{marginTop:"0"}},re.createElement("label",{htmlFor:"expYear"},"YYYY"),re.createElement("input",{"data-token":"exp_year",className:"form-control required",type:"text",placeholder:"YYYY",maxLength:4,value:(u==null?void 0:u.expiryYear)||"",onChange:s=>Te("expiryYear",s.target.value),ref:D}),(E==null?void 0:E.expiryYear)&&re.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},E==null?void 0:E.expiryYear)),re.createElement("div",{className:"form-group",style:{marginTop:"0"}},re.createElement("label",{htmlFor:"cvc"},"CVC"),re.createElement("input",{"data-token":"cvv",className:"form-control required",type:"text",placeholder:"CVC",maxLength:4,value:(u==null?void 0:u.cvv)||"",onChange:s=>Te("cvv",s.target.value),ref:ue}),(E==null?void 0:E.cvv)&&re.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},E==null?void 0:E.cvv)))),re.createElement("div",{className:"form-group",style:{marginTop:"0"}},re.createElement("label",{htmlFor:"cardholderName"},"Name on card"),re.createElement("input",{type:"text",id:"cardholderName",name:"cardholderName",placeholder:"Name on card required",value:(u==null?void 0:u.cardName)||"",onChange:s=>{let m=s.target.value;/^[a-zA-Z\s]*$/.test(m)&&Te("cardName",m)},ref:n}),(E==null?void 0:E.cardName)&&re.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},E==null?void 0:E.cardName)),re.createElement("div",{className:"form-group",style:{marginTop:"0"}},re.createElement("label",{htmlFor:"zipcode"},"Zip"),re.createElement("input",{type:"text",id:"",name:"zipcode",placeholder:"Zip",value:(w=u==null?void 0:u.zipCode)!=null?w:"",onChange:s=>Te("zipCode",s.target.value)}),(E==null?void 0:E.zipCode)&&re.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},E==null?void 0:E.zipCode))),re.createElement("input",{type:"submit",className:"idle-green-btn w-100",defaultValue:"Submit"})))))}import P,{useState as vn}from"react";import Cn from"axios";var Mn={PROPAYKEY:"25",PAYARCKEY:"26",STRIPEKEYCC:"27",PAYRIXKEY:"28",SKYFIACHKEY:"29",JUSTIFIKEY:"30",INFINICEPTKEY:"31",FRACTALKEY:"32"};import Ei from"react";function jn({}){return Ei.createElement("style",null,`
|
|
1982
|
+
`)}var Vi=({onClose:e})=>jt.createElement(jt.Fragment,null,jt.createElement(jn,null),jt.createElement("div",{className:"card-success"},jt.createElement("div",{className:"payment-success-container"},jt.createElement("div",{className:"success-icon"},jt.createElement("div",{className:"circle"},jt.createElement("i",{className:"fa fa-check-circle","aria-hidden":"true"})),jt.createElement("div",{className:"success-text"},jt.createElement("div",{className:"payment-success-text"},"Your card was added successfully."),jt.createElement("div",{className:"thank-you-text"},"Thank you ")))))),ai=Vi;function Ei(e){var w;let[f,q]=rn(!1),[O,Y]=rn(!1),[Be,I]=rn(""),[Qe,_e]=rn(!1),se=vn(null),T=vn(null),D=vn(null),ue=vn(null),n=vn(null),[u,b]=rn(),[E,h]=rn({}),[fe,Q]=rn(),Te=()=>q(!0),c=()=>q(!1),ut=s=>{Oi.fire({icon:"error",text:s,customClass:{popup:"custom-z-index"}})},V=()=>{_e(!1),Y(!1),I(""),b({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""})},gt=()=>_e(!0),y=()=>{V()},qe=(s,m)=>{var p,S,g;let K=s,x=["expiryMonth","expiryYear","zipCode","cvv"];if(console.log(K,m==null?void 0:m.length,"dfih",K==="expiryMonth"&&(m==null?void 0:m.length)===2),K==="expiryMonth"&&(m==null?void 0:m.length)===2&&((p=D==null?void 0:D.current)==null||p.focus()),K==="expiryYear"&&(m==null?void 0:m.length)===4&&((S=ue==null?void 0:ue.current)==null||S.focus()),K==="cvv"&&(m==null?void 0:m.length)===3&&((g=n==null?void 0:n.current)==null||g.focus()),x.includes(K)){(m===""||/^[0-9]+$/.test(m))&&(h(Z=>B(k({},Z),{[K]:""})),b(Z=>B(k({},Z),{[K]:m})));return}h(Z=>B(k({},Z),{[K]:""})),console.log(m,K),b(Z=>B(k({},Z),{[K]:m}))},W=s=>{var p;let K=s.target.value.replace(/\D/g,""),x="";/^3[47]/.test(K)?x=K.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(g,Z,l,v)=>[Z,l,v].filter(Boolean).join(" ")):x=K.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(g,Z,l,v,C)=>[Z,l,v,C].filter(Boolean).join(" ")),h(S=>B(k({},S),{cardNumber:""})),b(S=>B(k({},S),{cardNumber:x})),console.log(K==null?void 0:K.length,"length"),(K==null?void 0:K.length)===16&&((p=T==null?void 0:T.current)==null||p.focus())},Ee=()=>{var p,S,g,Z,l,v;let s={},m=u,K=parseInt((m==null?void 0:m.expiryMonth)||"",10),x=(m==null?void 0:m.expiryYear)||"";if((p=m==null?void 0:m.cardName)!=null&&p.trim()||(s.cardName="Card name is required"),(S=m==null?void 0:m.cardNumber)!=null&&S.trim()||(s.cardNumber="Card number is required"),(g=m==null?void 0:m.expiryMonth)!=null&&g.trim()?(Number(m==null?void 0:m.expiryMonth)>12||Number(m==null?void 0:m.expiryMonth)<1)&&(s.expiryMonth="Invalid Expiration Month."):s.expiryMonth="Expiration month is required",(Z=m==null?void 0:m.expiryYear)!=null&&Z.trim()?((l=m==null?void 0:m.expiryYear)==null?void 0:l.trim().length)!==4||Number(m==null?void 0:m.expiryYear)<2025?s.expiryYear="Invalid Expiration Year.":(isNaN(K)||K<1||K>12||x.length!==4)&&(s.expiryMonth="Invalid Expiration Date."):s.expiryYear="Expiration year is required",(v=m==null?void 0:m.cvv)!=null&&v.trim()||(s.cvv="CVC is required"),m!=null&&m.expiryMonth&&(m!=null&&m.expiryYear)&&m.expiryMonth.length<=2&&m.expiryYear.length===4){let C=parseInt(m.expiryMonth,10),ce=parseInt(m.expiryYear,10),J=new Date,De=J.getMonth()+1,ft=J.getFullYear();(ce<ft||ce===ft&&C<De)&&(s.expiryMonth="Card is expired")}return h(s),Object.keys(s).length>0},Ne=async()=>{var s,m,K;Te();try{let x={fractalpayPublicKey:e==null?void 0:e.merchantPublicKey,customer_id:e==null?void 0:e.customerId,addcard:!0},p=await mn.post(`${Fe}get-payment-details`,x);console.log(p),Q((s=p==null?void 0:p.data)==null?void 0:s.data),(K=(m=p==null?void 0:p.data)==null?void 0:m.data)!=null&&K.paymentGateway||(V(),I("Something went wrong.")),c()}catch(x){console.log(x),c(),V(),I("Something went wrong.")}};return Ki(()=>{e!=null&&e.merchantPublicKey&&Ne()},[e==null?void 0:e.merchantPublicKey]),re.createElement(re.Fragment,null,re.createElement(Ht,null),re.createElement(Hn,null),re.createElement(Ft,{loading:f}),Be&&re.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},re.createElement(Et,{error:Be,onClose:V})),O&&re.createElement(ai,{onClose:y}),!Be&&!O&&re.createElement(re.Fragment,null,re.createElement("div",{className:"container-creditcard add-card modal-content",id:"add-credit-card-panel",style:{margin:"auto"}},re.createElement("form",{id:"creditCardForm",onSubmit:async s=>{var K,x,p,S,g,Z,l,v,C,ce,J,De,ft,ot,Ue,Lt;s.preventDefault();let m=Ee();if(console.log(u),!m){let rt=DatacapWebToken.validateCardNumber(u==null?void 0:u.cardNumber.replaceAll(" ","")),st=DatacapWebToken.validateExpirationDate(u==null?void 0:u.expiryMonth,u==null?void 0:u.expiryYear),ve=DatacapWebToken.validateCVV(u==null?void 0:u.cvv),Ze={};if(rt||(Ze.cardNumber="Invalid card Number"),st||(Ze.expiryMonth="Invalid Expiration Date."),ve||(Ze.cvv="Invalid CVV"),h(Ze),rt&&ve&&st){Te();try{let $=async function(nt){var $e,lt,ht,Yt,Wt;if(console.log(nt),nt.Error)console.log(nt==null?void 0:nt.Error),I(nt.Error),c();else{let N={userId:e==null?void 0:e.customerId,cardName:u==null?void 0:u.cardName,zip:u==null?void 0:u.zipCode,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey,token:nt};try{let L=await mn.post(`${Fe}add-card`,N);console.log(L);let me={fractalpayPublicKey:e==null?void 0:e.merchantPublicKey,wallet_id:"",card_number:u==null?void 0:u.cardNumber.replaceAll(" ",""),exp_month:u==null?void 0:u.expiryMonth,exp_year:($e=u==null?void 0:u.expiryYear)==null?void 0:$e.slice(-2),cvv:u==null?void 0:u.cvv};try{let pe=await mn.post(`${Fe}link-wallet`,me);console.log(pe),Y(!0),c(),b({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),tn(s,"close","")}catch(pe){console.log(pe),c(),I(((ht=(lt=pe==null?void 0:pe.response)==null?void 0:lt.data)==null?void 0:ht.message)||(pe==null?void 0:pe.message)||"Something went wrong.")}}catch(L){console.log(L),c(),I(((Wt=(Yt=L==null?void 0:L.response)==null?void 0:Yt.data)==null?void 0:Wt.message)||(L==null?void 0:L.message)||"Something went wrong.")}}};if((fe==null?void 0:fe.paymentGateway)===32){let nt={method:"POST",redirect:"follow"};try{let $e=await mn.post(`${be}api/v1/widget/generate-session`,nt),lt=Number(u==null?void 0:u.expiryYear)%100,ht=u==null?void 0:u.cardNumber;ht=ht==null?void 0:ht.replace(/\s+/g,"");let Yt=`${ht}=${lt}${u==null?void 0:u.expiryMonth} ${u==null?void 0:u.cvv}`,N=forge.pki.publicKeyFromPem((x=(K=$e==null?void 0:$e.data)==null?void 0:K.data)==null?void 0:x.publicKeyPem).encrypt(Yt,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),L=forge.util.encode64(N),me={"Content-Type":"application/json","x-app-session-key":(S=(p=$e.data)==null?void 0:p.data)==null?void 0:S.session_key},pe=JSON.stringify({enc_track2_data:`${L}`,algorithm:"RSAES_OAEP_SHA_1",session_key:`${(Z=(g=$e==null?void 0:$e.data)==null?void 0:g.data)==null?void 0:Z.session_key}`});try{let le=await mn.post(`${wt}tokenizer/tokenize`,pe,{headers:me}),Ye=JSON.stringify(B(k({},(l=le==null?void 0:le.data)==null?void 0:l.data),{cvv:u==null?void 0:u.cvv,cardName:u==null?void 0:u.cardName,zip:u==null?void 0:u.zipCode,userId:e==null?void 0:e.customerId,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey})),He={"Content-Type":"application/json"};try{let X=await mn.post(`${Fe}add-card`,Ye,{headers:He});console.log(X),(v=X==null?void 0:X.data)!=null&&v.result&&(Y(!0),c(),tn(s,"close",""))}catch(X){c(),I(((ce=(C=X==null?void 0:X.response)==null?void 0:C.data)==null?void 0:ce.message)||(X==null?void 0:X.message)||"Something went wrong.")}}catch(le){c(),I(((De=(J=le==null?void 0:le.response)==null?void 0:J.data)==null?void 0:De.message)||(le==null?void 0:le.message)||"Something went wrong.")}}catch($e){c(),I(((ot=(ft=$e==null?void 0:$e.response)==null?void 0:ft.data)==null?void 0:ot.message)||($e==null?void 0:$e.message)||"Something went wrong.")}}else typeof DatacapWebToken!="undefined"&&DatacapWebToken.requestToken(fe==null?void 0:fe.dctoken,"creditCardForm",$)}catch($){c(),I(((Lt=(Ue=$==null?void 0:$.response)==null?void 0:Ue.data)==null?void 0:Lt.message)||($==null?void 0:$.message)||"Something went wrong.")}}}},style:{padding:"0 10px"}},re.createElement("div",{style:{maxHeight:"350px",minHeight:"0"},className:"card-scrl"},re.createElement("div",{className:"form-group",style:{marginTop:"0",marginBottom:"10px"}},re.createElement("label",{htmlFor:"cardNumber"},"Card Number"),re.createElement("input",{type:"text","data-token":"card_number",placeholder:"Enter card number",maxLength:19,inputMode:"numeric",value:(u==null?void 0:u.cardNumber)||"",onChange:s=>W(s),ref:se}),(E==null?void 0:E.cardNumber)&&re.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},E==null?void 0:E.cardNumber),re.createElement("br",null)),re.createElement("div",{className:"card-dtl"},re.createElement("div",{className:"exp-cvc-container",style:{margin:"0"}},re.createElement("div",{className:"form-group",style:{marginTop:"0"}},re.createElement("label",{htmlFor:"expMonth"},"MM"),re.createElement("input",{"data-token":"exp_month",className:"form-control required",type:"text",placeholder:"MM",maxLength:2,value:(u==null?void 0:u.expiryMonth)||"",onChange:s=>qe("expiryMonth",s.target.value),ref:T}),(E==null?void 0:E.expiryMonth)&&re.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},E==null?void 0:E.expiryMonth)),re.createElement("div",{className:"form-group",style:{marginTop:"0"}},re.createElement("label",{htmlFor:"expYear"},"YYYY"),re.createElement("input",{"data-token":"exp_year",className:"form-control required",type:"text",placeholder:"YYYY",maxLength:4,value:(u==null?void 0:u.expiryYear)||"",onChange:s=>qe("expiryYear",s.target.value),ref:D}),(E==null?void 0:E.expiryYear)&&re.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},E==null?void 0:E.expiryYear)),re.createElement("div",{className:"form-group",style:{marginTop:"0"}},re.createElement("label",{htmlFor:"cvc"},"CVC"),re.createElement("input",{"data-token":"cvv",className:"form-control required",type:"text",placeholder:"CVC",maxLength:4,value:(u==null?void 0:u.cvv)||"",onChange:s=>qe("cvv",s.target.value),ref:ue}),(E==null?void 0:E.cvv)&&re.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},E==null?void 0:E.cvv)))),re.createElement("div",{className:"form-group",style:{marginTop:"0"}},re.createElement("label",{htmlFor:"cardholderName"},"Name on card"),re.createElement("input",{type:"text",id:"cardholderName",name:"cardholderName",placeholder:"Name on card required",value:(u==null?void 0:u.cardName)||"",onChange:s=>{let m=s.target.value;/^[a-zA-Z\s]*$/.test(m)&&qe("cardName",m)},ref:n}),(E==null?void 0:E.cardName)&&re.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},E==null?void 0:E.cardName)),re.createElement("div",{className:"form-group",style:{marginTop:"0"}},re.createElement("label",{htmlFor:"zipcode"},"Zip"),re.createElement("input",{type:"text",id:"",name:"zipcode",placeholder:"Zip",value:(w=u==null?void 0:u.zipCode)!=null?w:"",onChange:s=>qe("zipCode",s.target.value)}),(E==null?void 0:E.zipCode)&&re.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},E==null?void 0:E.zipCode))),re.createElement("input",{type:"submit",className:"idle-green-btn w-100",defaultValue:"Submit"})))))}import P,{useState as Cn}from"react";import wn from"axios";var Pn={PROPAYKEY:"25",PAYARCKEY:"26",STRIPEKEYCC:"27",PAYRIXKEY:"28",SKYFIACHKEY:"29",JUSTIFIKEY:"30",INFINICEPTKEY:"31",FRACTALKEY:"32"};import Zi from"react";function Vn({}){return Zi.createElement("style",null,`
|
|
1983
1983
|
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap");
|
|
1984
1984
|
|
|
1985
1985
|
.creditformbox {
|
|
@@ -2123,7 +2123,7 @@ var ai=Object.defineProperty,oi=Object.defineProperties;var ri=Object.getOwnProp
|
|
|
2123
2123
|
background:#2979FF !important;
|
|
2124
2124
|
color:#ffffff !important;
|
|
2125
2125
|
}
|
|
2126
|
-
`)}function Zi({session_token:e,callback:f,isloading:q,onCancel:O,showChecks:Y,merchantName:Ae,signCheckbox:I,checkedSignCheckbox:Qe,onCheckSign:Se}){var xt;let[se,T]=vn(!1),[D,ue]=vn(!1),[n,u]=vn(),[b,E]=vn({}),[h,he]=vn(""),Q=()=>T(!0),Be=()=>T(!1),c=()=>{var x,p,S,g,Z,l,v,C;let w={},s=n,m=parseInt((s==null?void 0:s.expiryMonth)||"",10),K=(s==null?void 0:s.expiryYear)||"";return(x=s==null?void 0:s.firstName)!=null&&x.trim()||(w.firstName="Please enter a first name."),(p=s==null?void 0:s.lastName)!=null&&p.trim()||(w.lastName="Please enter a last name."),(S=s==null?void 0:s.cardNumber)!=null&&S.trim()||(w.cardNumber="Please enter a card number."),(g=s==null?void 0:s.expiryMonth)!=null&&g.trim()?(Number(s==null?void 0:s.expiryMonth)>12||Number(s==null?void 0:s.expiryMonth)<1)&&(w.expiryMonth="Invalid Expiration Month."):w.expiryMonth="Please enter an expiry month.",(Z=s==null?void 0:s.expiryYear)!=null&&Z.trim()?((l=s==null?void 0:s.expiryYear)==null?void 0:l.trim().length)!==4||Number(s==null?void 0:s.expiryYear)<2025?w.expiryYear="Invalid Expiration Year.":(isNaN(m)||m<1||m>12||K.length!==4)&&(w.expiryMonth="Invalid Expiration Date."):w.expiryYear="Please enter an expiry year.",(v=s==null?void 0:s.cvv)!=null&&v.trim()||(w.cvv="Please enter a CVV."),(C=s==null?void 0:s.zipCode)!=null&&C.trim()||(w.zipCode="Please enter a zip code."),I&&!Qe&&(w.checkSign="You must authorize this before proceeding."),Y&&!(s!=null&&s.authHold)&&(w.authHold="You must authorize this before proceeding."),Y&&!(s!=null&&s.authorise)&&(w.authorise="Please confirm your authorization to continue."),E(w),Object.keys(w).length>0},ut=w=>{let m=w.target.value.replace(/\D/g,""),K="";/^3[47]/.test(m)?K=m.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(p,S,g,Z)=>[S,g,Z].filter(Boolean).join(" ")):K=m.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(p,S,g,Z,l)=>[S,g,Z,l].filter(Boolean).join(" ")),E(x=>B(k({},x),{cardNumber:""})),u(x=>B(k({},x),{cardNumber:K}))},V=(w,s)=>{let m=w;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(m)){(s===""||/^[0-9]+$/.test(s))&&(E(x=>B(k({},x),{[m]:""})),u(x=>B(k({},x),{[m]:s})));return}E(x=>B(k({},x),{[m]:""})),u(x=>B(k({},x),{[m]:s}))},gt=()=>{let w=DatacapWebToken.validateCardNumber(n==null?void 0:n.cardNumber.replaceAll(" ","")),s=DatacapWebToken.validateExpirationDate(n==null?void 0:n.expiryMonth,n==null?void 0:n.expiryYear),m=DatacapWebToken.validateCVV(n==null?void 0:n.cvv),K={};return w||(K.cardNumber="Invalid card Number"),s||(K.expiryMonth="Invalid Expiration Date."),m||(K.cvv="Invalid CVV"),E(K),w&&m&&s},y=async w=>{var s,m;if(w.Error)he(w.Error),Be();else{let K={token:w.Token,resp:w},x=await Cn.post(`${be}api/v1/gateway/update/token/${e}`,K);if((x==null?void 0:x.status)==200){let p=k(k({Token:(m=(s=x==null?void 0:x.data)==null?void 0:s.data)==null?void 0:m.gateway_token,Brand:w.Brand,ExpirationMonth:w.ExpirationMonth,ExpirationYear:w.ExpirationYear,Last4:w.Last4,Bin:w.Bin,CVV:w.CVV,postalCode:n==null?void 0:n.zipCode},Y&&{authHold:n==null?void 0:n.authHold}),Y&&{authorise:n==null?void 0:n.authorise});Be(),f(p)}}},Te=async()=>{var w,s,m,K,x,p,S,g,Z,l;try{let v={method:"POST",redirect:"follow"},C=await Cn.post(`${be}api/v1/widget/generate-session`,v),me=Number(n==null?void 0:n.expiryYear)%100,De=`${(w=n==null?void 0:n.cardNumber)==null?void 0:w.replace(/\s+/g,"")}=${me}${n==null?void 0:n.expiryMonth} ${n==null?void 0:n.cvv}`,ot=forge.pki.publicKeyFromPem((m=(s=C==null?void 0:C.data)==null?void 0:s.data)==null?void 0:m.publicKeyPem).encrypt(De,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),Ue=forge.util.encode64(ot),Lt={"Content-Type":"application/json","x-app-session-key":(x=(K=C.data)==null?void 0:K.data)==null?void 0:x.session_key},rt=JSON.stringify({enc_track2_data:Ue,algorithm:"RSAES_OAEP_SHA_1",session_key:(S=(p=C==null?void 0:C.data)==null?void 0:p.data)==null?void 0:S.session_key}),st=await Cn.post(`${wt}tokenizer/tokenize`,rt,{headers:Lt});if((st==null?void 0:st.status)==200){let ve=(Z=(g=st==null?void 0:st.data)==null?void 0:g.data)==null?void 0:Z.token;try{let Ze=await Cn.post(`${be}api/v1/gateway/verify-and-save/${e}`,{token:ve});if((Ze==null?void 0:Ze.status)==200){let $=(l=Ze==null?void 0:Ze.data)==null?void 0:l.data,nt={Token:$.gateway_token,Brand:$.card_data.brand,ExpirationMonth:$.card_data.expire_mm,ExpirationYear:$.card_data.expire_yy,Last4:$.card_data.last4,Bin:$.card_data.bin,postalCode:n==null?void 0:n.zipCode};Be(),f(nt)}}catch(Ze){console.log(Ze,"error"),Be()}}}catch(v){console.log(v,"eroror")}},W=async w=>{var K,x,p,S,g,Z,l;if(w.preventDefault(),!(c()||!gt())){Q();try{let v=await Cn.get(`${be}api/v1/gateway/token/${e}`);if((v==null?void 0:v.status)==200){let C=(x=(K=v==null?void 0:v.data)==null?void 0:K.data)==null?void 0:x.gateway_token;((S=(p=v==null?void 0:v.data)==null?void 0:p.data)==null?void 0:S.paymentGateway)==((g=Mn)==null?void 0:g.FRACTALKEY)?await Te():DatacapWebToken.requestToken(C,"creditCardForm",y)}}catch(v){Be(),he(((l=(Z=v==null?void 0:v.response)==null?void 0:Z.data)==null?void 0:l.message)||"Something went wrong!")}}},Ee=()=>{he("")},ke=()=>{he(""),u({firstName:"",lastName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",zipCode:"",authHold:!1,authorise:!1,checkSign:!1}),O()};return P.createElement(P.Fragment,null,P.createElement(Ht,null),P.createElement(jn,null),P.createElement(Ft,{loading:se||q}),h&&P.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},P.createElement(Et,{error:h,onClose:Ee})),!h&&P.createElement("div",{className:"creditformbox"},P.createElement("form",{id:"creditCardForm",onSubmit:W},P.createElement("div",{className:"name-row"},P.createElement("div",{className:"form-group"},P.createElement("label",null," First Name ",P.createElement("span",{className:"text-danger"},"*")),P.createElement("input",{type:"text",name:"first_name",placeholder:"First Name",value:(n==null?void 0:n.firstName)||"",onChange:w=>{let s=w.target.value;/^[a-zA-Z\s]*$/.test(s)&&V("firstName",s)}}),(b==null?void 0:b.firstName)&&P.createElement("small",{className:"error"},b==null?void 0:b.firstName)),P.createElement("div",{className:"form-group"},P.createElement("label",null," Last Name ",P.createElement("span",{className:"text-danger"},"*")),P.createElement("input",{type:"text",name:"last_name",placeholder:"Last Name",value:(n==null?void 0:n.lastName)||"",onChange:w=>{let s=w.target.value;/^[a-zA-Z\s]*$/.test(s)&&V("lastName",s)}}),(b==null?void 0:b.lastName)&&P.createElement("small",{className:"error"},b==null?void 0:b.lastName))),P.createElement("div",{className:"form-pay-row"},P.createElement("div",{className:"form-group"},P.createElement("label",null," Card Number ",P.createElement("span",{className:"text-danger"},"*")),P.createElement("input",{type:"text","data-token":"card_number",placeholder:"Card Number",maxLength:19,inputMode:"numeric",value:(n==null?void 0:n.cardNumber)||"",onChange:w=>ut(w)}),(b==null?void 0:b.cardNumber)&&P.createElement("small",{className:"error"},b==null?void 0:b.cardNumber))),P.createElement("div",{className:"card-pay-row"},P.createElement("div",{className:"form-group"},P.createElement("label",null," Exp Month ",P.createElement("span",{className:"text-danger"},"*")),P.createElement("input",{type:"text","data-token":"exp_month",placeholder:"MM",maxLength:2,value:(n==null?void 0:n.expiryMonth)||"",onChange:w=>V("expiryMonth",w.target.value)}),(b==null?void 0:b.expiryMonth)&&P.createElement("small",{className:"error"},b==null?void 0:b.expiryMonth)),P.createElement("div",{className:"form-group"},P.createElement("label",null," Exp Year ",P.createElement("span",{className:"text-danger"},"*")),P.createElement("input",{type:"text","data-token":"exp_year",placeholder:"YYYY",maxLength:4,value:(n==null?void 0:n.expiryYear)||"",onChange:w=>V("expiryYear",w.target.value)}),(b==null?void 0:b.expiryYear)&&P.createElement("small",{className:"error"},b==null?void 0:b.expiryYear)),P.createElement("div",{className:"form-group"},P.createElement("label",null," CVV ",P.createElement("span",{className:"text-danger"},"*")),P.createElement("input",{type:"text","data-token":"cvv",placeholder:"CVV",maxLength:4,value:(n==null?void 0:n.cvv)||"",onChange:w=>V("cvv",w.target.value)}),(b==null?void 0:b.cvv)&&P.createElement("small",{className:"error"},b==null?void 0:b.cvv)),P.createElement("div",{className:"form-group"},P.createElement("label",null," Zip ",P.createElement("span",{className:"text-danger"},"*")),P.createElement("input",{type:"text",name:"zipcode",placeholder:"Zip Code",value:(xt=n==null?void 0:n.zipCode)!=null?xt:"",onChange:w=>V("zipCode",w.target.value)}),(b==null?void 0:b.zipCode)&&P.createElement("small",{className:"error"},b==null?void 0:b.zipCode))),I&&P.createElement("div",{className:"checks-row"},P.createElement("input",{name:"discalosure",type:"checkbox",id:"disclosureCheck",checked:Qe,onChange:w=>Se(w.target.checked)}),P.createElement("label",{htmlFor:"disclosureCheck",className:"form-check-label"},"Please agree to the following in order to add Payment method.")),I&&(b==null?void 0:b.checkSign)&&P.createElement("small",{className:"check-error"},b==null?void 0:b.checkSign),Y&&P.createElement(P.Fragment,null,P.createElement("div",{className:"checks-row"},P.createElement("input",{name:"authHold",type:"checkbox",id:"authHold",checked:!!(n!=null&&n.authHold),onChange:w=>V("authHold",w.target.checked)}),P.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.")),(b==null?void 0:b.authHold)&&P.createElement("small",{className:"check-error"},b==null?void 0:b.authHold),P.createElement("div",{className:"checks-row "},P.createElement("input",{name:"authorise",type:"checkbox",id:"authorise",checked:!!(n!=null&&n.authorise),onChange:w=>V("authorise",w.target.checked)}),P.createElement("label",{htmlFor:"authorise",className:"form-check-label see-more"},D?P.createElement(P.Fragment,null,P.createElement("span",null,"By providing your payment information, you authorize"," ",P.createElement("strong",null,Ae),", 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"," ",P.createElement("strong",null,Ae),". You may request the removal of your stored payment information at any time by contacting"," ",P.createElement("strong",null,Ae)," directly. By signing or proceeding with this transaction, you acknowledge and agree to this card on file authorization.",P.createElement("a",{href:"#",onClick:w=>{w.preventDefault(),ue(!1)}},"See less ..."))):P.createElement(P.Fragment,null,P.createElement("span",null,"By providing your payment information, you authorize ",Ae,", a Sky Systemz merchant, to securely store your card on file for future pay..."," "),P.createElement("a",{href:"#",onClick:w=>{w.preventDefault(),ue(!0)}},"See more ...")))),(b==null?void 0:b.authorise)&&P.createElement("small",{className:"check-error"},b==null?void 0:b.authorise)),P.createElement("div",{className:"button-row"},P.createElement("button",{className:"cancelbtn",type:"button",onClick:ke},"Cancel"),P.createElement("button",{className:"savebtn",type:"submit"},"Save")))))}import i,{useEffect as Ui,useLayoutEffect as Gi,useState as Xe}from"react";import Wi from"react";function Vn(){let e="#000",f="#fff",q="#212529",O="#dee2e6";return Wi.createElement("style",null,`
|
|
2126
|
+
`)}function Wi({session_token:e,callback:f,isloading:q,onCancel:O,showChecks:Y,merchantName:Be,signCheckbox:I,checkedSignCheckbox:Qe,onCheckSign:_e}){var xt;let[se,T]=Cn(!1),[D,ue]=Cn(!1),[n,u]=Cn(),[b,E]=Cn({}),[h,fe]=Cn(""),Q=()=>T(!0),Te=()=>T(!1),c=()=>{var x,p,S,g,Z,l,v,C;let w={},s=n,m=parseInt((s==null?void 0:s.expiryMonth)||"",10),K=(s==null?void 0:s.expiryYear)||"";return(x=s==null?void 0:s.firstName)!=null&&x.trim()||(w.firstName="Please enter a first name."),(p=s==null?void 0:s.lastName)!=null&&p.trim()||(w.lastName="Please enter a last name."),(S=s==null?void 0:s.cardNumber)!=null&&S.trim()||(w.cardNumber="Please enter a card number."),(g=s==null?void 0:s.expiryMonth)!=null&&g.trim()?(Number(s==null?void 0:s.expiryMonth)>12||Number(s==null?void 0:s.expiryMonth)<1)&&(w.expiryMonth="Invalid Expiration Month."):w.expiryMonth="Please enter an expiry month.",(Z=s==null?void 0:s.expiryYear)!=null&&Z.trim()?((l=s==null?void 0:s.expiryYear)==null?void 0:l.trim().length)!==4||Number(s==null?void 0:s.expiryYear)<2025?w.expiryYear="Invalid Expiration Year.":(isNaN(m)||m<1||m>12||K.length!==4)&&(w.expiryMonth="Invalid Expiration Date."):w.expiryYear="Please enter an expiry year.",(v=s==null?void 0:s.cvv)!=null&&v.trim()||(w.cvv="Please enter a CVV."),(C=s==null?void 0:s.zipCode)!=null&&C.trim()||(w.zipCode="Please enter a zip code."),I&&!Qe&&(w.checkSign="You must authorize this before proceeding."),Y&&!(s!=null&&s.authHold)&&(w.authHold="You must authorize this before proceeding."),Y&&!(s!=null&&s.authorise)&&(w.authorise="Please confirm your authorization to continue."),E(w),Object.keys(w).length>0},ut=w=>{let m=w.target.value.replace(/\D/g,""),K="";/^3[47]/.test(m)?K=m.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(p,S,g,Z)=>[S,g,Z].filter(Boolean).join(" ")):K=m.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(p,S,g,Z,l)=>[S,g,Z,l].filter(Boolean).join(" ")),E(x=>B(k({},x),{cardNumber:""})),u(x=>B(k({},x),{cardNumber:K}))},V=(w,s)=>{let m=w;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(m)){(s===""||/^[0-9]+$/.test(s))&&(E(x=>B(k({},x),{[m]:""})),u(x=>B(k({},x),{[m]:s})));return}E(x=>B(k({},x),{[m]:""})),u(x=>B(k({},x),{[m]:s}))},gt=()=>{let w=DatacapWebToken.validateCardNumber(n==null?void 0:n.cardNumber.replaceAll(" ","")),s=DatacapWebToken.validateExpirationDate(n==null?void 0:n.expiryMonth,n==null?void 0:n.expiryYear),m=DatacapWebToken.validateCVV(n==null?void 0:n.cvv),K={};return w||(K.cardNumber="Invalid card Number"),s||(K.expiryMonth="Invalid Expiration Date."),m||(K.cvv="Invalid CVV"),E(K),w&&m&&s},y=async w=>{var s,m;if(w.Error)fe(w.Error),Te();else{let K={token:w.Token,resp:w},x=await wn.post(`${be}api/v1/gateway/update/token/${e}`,K);if((x==null?void 0:x.status)==200){let p=k(k({Token:(m=(s=x==null?void 0:x.data)==null?void 0:s.data)==null?void 0:m.gateway_token,Brand:w.Brand,ExpirationMonth:w.ExpirationMonth,ExpirationYear:w.ExpirationYear,Last4:w.Last4,Bin:w.Bin,CVV:w.CVV,postalCode:n==null?void 0:n.zipCode},Y&&{authHold:n==null?void 0:n.authHold}),Y&&{authorise:n==null?void 0:n.authorise});Te(),f(p)}}},qe=async()=>{var w,s,m,K,x,p,S,g,Z,l;try{let v={method:"POST",redirect:"follow"},C=await wn.post(`${be}api/v1/widget/generate-session`,v),ce=Number(n==null?void 0:n.expiryYear)%100,De=`${(w=n==null?void 0:n.cardNumber)==null?void 0:w.replace(/\s+/g,"")}=${ce}${n==null?void 0:n.expiryMonth} ${n==null?void 0:n.cvv}`,ot=forge.pki.publicKeyFromPem((m=(s=C==null?void 0:C.data)==null?void 0:s.data)==null?void 0:m.publicKeyPem).encrypt(De,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),Ue=forge.util.encode64(ot),Lt={"Content-Type":"application/json","x-app-session-key":(x=(K=C.data)==null?void 0:K.data)==null?void 0:x.session_key},rt=JSON.stringify({enc_track2_data:Ue,algorithm:"RSAES_OAEP_SHA_1",session_key:(S=(p=C==null?void 0:C.data)==null?void 0:p.data)==null?void 0:S.session_key}),st=await wn.post(`${wt}tokenizer/tokenize`,rt,{headers:Lt});if((st==null?void 0:st.status)==200){let ve=(Z=(g=st==null?void 0:st.data)==null?void 0:g.data)==null?void 0:Z.token;try{let Ze=await wn.post(`${be}api/v1/gateway/verify-and-save/${e}`,{token:ve});if((Ze==null?void 0:Ze.status)==200){let $=(l=Ze==null?void 0:Ze.data)==null?void 0:l.data,nt={Token:$.gateway_token,Brand:$.card_data.brand,ExpirationMonth:$.card_data.expire_mm,ExpirationYear:$.card_data.expire_yy,Last4:$.card_data.last4,Bin:$.card_data.bin,postalCode:n==null?void 0:n.zipCode};Te(),f(nt)}}catch(Ze){console.log(Ze,"error"),Te()}}}catch(v){console.log(v,"eroror")}},W=async w=>{var K,x,p,S,g,Z,l;if(w.preventDefault(),!(c()||!gt())){Q();try{let v=await wn.get(`${be}api/v1/gateway/token/${e}`);if((v==null?void 0:v.status)==200){let C=(x=(K=v==null?void 0:v.data)==null?void 0:K.data)==null?void 0:x.gateway_token;((S=(p=v==null?void 0:v.data)==null?void 0:p.data)==null?void 0:S.paymentGateway)==((g=Pn)==null?void 0:g.FRACTALKEY)?await qe():DatacapWebToken.requestToken(C,"creditCardForm",y)}}catch(v){Te(),fe(((l=(Z=v==null?void 0:v.response)==null?void 0:Z.data)==null?void 0:l.message)||"Something went wrong!")}}},Ee=()=>{fe("")},Ne=()=>{fe(""),u({firstName:"",lastName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",zipCode:"",authHold:!1,authorise:!1,checkSign:!1}),O()};return P.createElement(P.Fragment,null,P.createElement(Ht,null),P.createElement(Vn,null),P.createElement(Ft,{loading:se||q}),h&&P.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},P.createElement(Et,{error:h,onClose:Ee})),!h&&P.createElement("div",{className:"creditformbox"},P.createElement("form",{id:"creditCardForm",onSubmit:W},P.createElement("div",{className:"name-row"},P.createElement("div",{className:"form-group"},P.createElement("label",null," First Name ",P.createElement("span",{className:"text-danger"},"*")),P.createElement("input",{type:"text",name:"first_name",placeholder:"First Name",value:(n==null?void 0:n.firstName)||"",onChange:w=>{let s=w.target.value;/^[a-zA-Z\s]*$/.test(s)&&V("firstName",s)}}),(b==null?void 0:b.firstName)&&P.createElement("small",{className:"error"},b==null?void 0:b.firstName)),P.createElement("div",{className:"form-group"},P.createElement("label",null," Last Name ",P.createElement("span",{className:"text-danger"},"*")),P.createElement("input",{type:"text",name:"last_name",placeholder:"Last Name",value:(n==null?void 0:n.lastName)||"",onChange:w=>{let s=w.target.value;/^[a-zA-Z\s]*$/.test(s)&&V("lastName",s)}}),(b==null?void 0:b.lastName)&&P.createElement("small",{className:"error"},b==null?void 0:b.lastName))),P.createElement("div",{className:"form-pay-row"},P.createElement("div",{className:"form-group"},P.createElement("label",null," Card Number ",P.createElement("span",{className:"text-danger"},"*")),P.createElement("input",{type:"text","data-token":"card_number",placeholder:"Card Number",maxLength:19,inputMode:"numeric",value:(n==null?void 0:n.cardNumber)||"",onChange:w=>ut(w)}),(b==null?void 0:b.cardNumber)&&P.createElement("small",{className:"error"},b==null?void 0:b.cardNumber))),P.createElement("div",{className:"card-pay-row"},P.createElement("div",{className:"form-group"},P.createElement("label",null," Exp Month ",P.createElement("span",{className:"text-danger"},"*")),P.createElement("input",{type:"text","data-token":"exp_month",placeholder:"MM",maxLength:2,value:(n==null?void 0:n.expiryMonth)||"",onChange:w=>V("expiryMonth",w.target.value)}),(b==null?void 0:b.expiryMonth)&&P.createElement("small",{className:"error"},b==null?void 0:b.expiryMonth)),P.createElement("div",{className:"form-group"},P.createElement("label",null," Exp Year ",P.createElement("span",{className:"text-danger"},"*")),P.createElement("input",{type:"text","data-token":"exp_year",placeholder:"YYYY",maxLength:4,value:(n==null?void 0:n.expiryYear)||"",onChange:w=>V("expiryYear",w.target.value)}),(b==null?void 0:b.expiryYear)&&P.createElement("small",{className:"error"},b==null?void 0:b.expiryYear)),P.createElement("div",{className:"form-group"},P.createElement("label",null," CVV ",P.createElement("span",{className:"text-danger"},"*")),P.createElement("input",{type:"text","data-token":"cvv",placeholder:"CVV",maxLength:4,value:(n==null?void 0:n.cvv)||"",onChange:w=>V("cvv",w.target.value)}),(b==null?void 0:b.cvv)&&P.createElement("small",{className:"error"},b==null?void 0:b.cvv)),P.createElement("div",{className:"form-group"},P.createElement("label",null," Zip ",P.createElement("span",{className:"text-danger"},"*")),P.createElement("input",{type:"text",name:"zipcode",placeholder:"Zip Code",value:(xt=n==null?void 0:n.zipCode)!=null?xt:"",onChange:w=>V("zipCode",w.target.value)}),(b==null?void 0:b.zipCode)&&P.createElement("small",{className:"error"},b==null?void 0:b.zipCode))),I&&P.createElement("div",{className:"checks-row"},P.createElement("input",{name:"discalosure",type:"checkbox",id:"disclosureCheck",checked:Qe,onChange:w=>_e(w.target.checked)}),P.createElement("label",{htmlFor:"disclosureCheck",className:"form-check-label"},"Please agree to the following in order to add Payment method.")),I&&(b==null?void 0:b.checkSign)&&P.createElement("small",{className:"check-error"},b==null?void 0:b.checkSign),Y&&P.createElement(P.Fragment,null,P.createElement("div",{className:"checks-row"},P.createElement("input",{name:"authHold",type:"checkbox",id:"authHold",checked:!!(n!=null&&n.authHold),onChange:w=>V("authHold",w.target.checked)}),P.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.")),(b==null?void 0:b.authHold)&&P.createElement("small",{className:"check-error"},b==null?void 0:b.authHold),P.createElement("div",{className:"checks-row "},P.createElement("input",{name:"authorise",type:"checkbox",id:"authorise",checked:!!(n!=null&&n.authorise),onChange:w=>V("authorise",w.target.checked)}),P.createElement("label",{htmlFor:"authorise",className:"form-check-label see-more"},D?P.createElement(P.Fragment,null,P.createElement("span",null,"By providing your payment information, you authorize"," ",P.createElement("strong",null,Be),", 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"," ",P.createElement("strong",null,Be),". You may request the removal of your stored payment information at any time by contacting"," ",P.createElement("strong",null,Be)," directly. By signing or proceeding with this transaction, you acknowledge and agree to this card on file authorization.",P.createElement("a",{href:"#",onClick:w=>{w.preventDefault(),ue(!1)}},"See less ..."))):P.createElement(P.Fragment,null,P.createElement("span",null,"By providing your payment information, you authorize ",Be,", a Sky Systemz merchant, to securely store your card on file for future pay..."," "),P.createElement("a",{href:"#",onClick:w=>{w.preventDefault(),ue(!0)}},"See more ...")))),(b==null?void 0:b.authorise)&&P.createElement("small",{className:"check-error"},b==null?void 0:b.authorise)),P.createElement("div",{className:"button-row"},P.createElement("button",{className:"cancelbtn",type:"button",onClick:Ne},"Cancel"),P.createElement("button",{className:"savebtn",type:"submit"},"Save")))))}import i,{useEffect as Gi,useLayoutEffect as Ji,useState as Xe}from"react";import Ui from"react";function Kn(){let e="#000",f="#fff",q="#212529",O="#dee2e6";return Ui.createElement("style",null,`
|
|
2127
2127
|
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
|
|
2128
2128
|
body
|
|
2129
2129
|
{
|
|
@@ -2851,4 +2851,4 @@ position:relative;
|
|
|
2851
2851
|
|
|
2852
2852
|
|
|
2853
2853
|
|
|
2854
|
-
`)}import yt from"axios";import{IoArrowBack as Kn}from"react-icons/io5";import mn from"sweetalert2";var Ji=({amount:e,submitBtnText:f="Pay",session_token:q,customerId:O,callback:Y,merchantName:Ae="merchant",isPreAuth:I,surcharge:Qe="0",submitBtnClass:Se,submitBtnIcon:se,isRequest:T,pass_fee:D,pass_fee_amount:ue})=>{var Ut,qt,Gt,mt,Ot,nn,F,d,j,_e,ee,je,ge,Pe;let[n,u]=Xe("card"),[b,E]=Xe("card"),[h,he]=Xe(),[Q,Be]=Xe({}),[c,ut]=Xe(),[V,gt]=Xe({}),[y,Te]=Xe(!1),[W,Ee]=Xe(!1),[ke,xt]=Xe(!1),[w,s]=Xe(""),[m,K]=Xe(!1),[x,p]=Xe(""),[S,g]=Xe(!1),[Z,l]=Xe(!1),[v,C]=Xe([]),[me,J]=Xe([]),[De,ft]=Xe(),[ot,Ue]=Xe(Number(e)),[Lt,rt]=Xe("form"),[st,ve]=Xe("form"),[Ze,$]=Xe(!1),nt=R+"widget/mc-img.svg",qe=R+"widget/visa-img.svg",lt=R+"widget/ae-img.svg",ht=R+"widget/discover-img.svg",Yt=R+"widget/card.svg",Wt=R+"widget/Trash.svg",N=R+"widget/bank.svg",L=R+"widget/secure-img.png",de=R+"widget/pov-by.png",ce=R+"widget/pax.svg",le=R+"widget/cardicon.svg",$e=R+"widget/bankicon.svg",Ye=()=>g(!0),X=()=>g(!1),Ge=async r=>{var o,z,H,A,ne,G,oe,te;console.log(r,"ndfkjhdskjfhds");try{let ae={pass_fee_amount:ue,pass_fee:D,Token:r==null?void 0:r.Token,amount:e,postal_code:r==null?void 0:r.postalCode},ie=await yt.post(`${be}api/v1/gateway/charge/${q}`,ae);if((o=ie==null?void 0:ie.data)!=null&&o.result){let fe={};if(ke&&O)try{let we={postal_code:h==null?void 0:h.zipCode,customer_id:O,gateway_token:(r==null?void 0:r.gateway_token)||(r==null?void 0:r.Token)},pe=await yt.post(`${be}api/v1/gateway/add-card/${q}`,we);(z=pe==null?void 0:pe.data)!=null&&z.result&&(pe=(H=pe==null?void 0:pe.data)==null?void 0:H.data)}catch(we){console.log(we,"error"),X(),s(((ne=(A=we==null?void 0:we.response)==null?void 0:A.data)==null?void 0:ne.message)||"Something went wrong!")}let Ke={cardDetails:k(k({},fe),r),callback:B(k({},(G=ie==null?void 0:ie.data)==null?void 0:G.data),{name:h==null?void 0:h.cardName,isPreAuth:I})};ke||delete Ke.cardDetails,Y(Ke),X(),at()}}catch(ae){s(((te=(oe=ae==null?void 0:ae.response)==null?void 0:oe.data)==null?void 0:te.message)||"Something went wrong!"),X()}},it=async r=>{var o,z,H,A,ne,G,oe,te;try{let ae={Token:r==null?void 0:r.Token,amount:e,postal_code:r==null?void 0:r.postalCode},ie=await yt.post(`${be}api/v1/gateway/preauth/${q}`,ae);if((o=ie==null?void 0:ie.data)!=null&&o.result){let fe={};if(ke&&O)try{console.log(ie,"preAuthResponse");let we={postal_code:h==null?void 0:h.zipCode,customer_id:O,gateway_token:(r==null?void 0:r.Token)||(r==null?void 0:r.gateway_token)},pe=await yt.post(`${be}api/v1/gateway/add-card/${q}`,we);(z=pe==null?void 0:pe.data)!=null&&z.result&&(pe=(H=pe==null?void 0:pe.data)==null?void 0:H.data)}catch(we){console.log(we,"error"),X(),s(((ne=(A=we==null?void 0:we.response)==null?void 0:A.data)==null?void 0:ne.message)||"Something went wrong!")}let Ke={cardDetails:k(k({},fe),r),callback:B(k({},(G=ie==null?void 0:ie.data)==null?void 0:G.data),{name:h==null?void 0:h.cardName,isPreAuth:I})};ke||delete Ke.cardDetails,Y(Ke),X(),at()}}catch(ae){s(((te=(oe=ae==null?void 0:ae.response)==null?void 0:oe.data)==null?void 0:te.message)||"Something went wrong!"),X()}},Nt=async r=>{var o,z,H,A;if(r.Error)s(r.Error),X();else{let ne={token:r.Token,resp:r};try{let G=await yt.post(`${be}api/v1/gateway/update/token/${q}`,ne);if((G==null?void 0:G.status)==200){let oe={Token:(z=(o=G==null?void 0:G.data)==null?void 0:o.data)==null?void 0:z.gateway_token,Brand:r.Brand,ExpirationMonth:r.ExpirationMonth,ExpirationYear:r.ExpirationYear,Last4:r.Last4,Bin:r.Bin,CVV:r.CVV,postalCode:h==null?void 0:h.zipCode},te;I?it(oe):Ge(oe)}}catch(G){console.log(G,"error"),X(),s(((A=(H=G==null?void 0:G.response)==null?void 0:H.data)==null?void 0:A.message)||"Something went wrong!")}}},bt=()=>Ee(!0),dt=r=>{u(r)},vt=()=>{var z,H,A,ne,G,oe,te,ae;let r={},o=c;return(z=o==null?void 0:o.name)!=null&&z.trim()||(r.name="Name is required"),(H=o==null?void 0:o.accountNumber)!=null&&H.trim()||(r.accountNumber="Account number is required"),(A=o==null?void 0:o.accountNumber)!=null&&A.trim()&&((ne=o==null?void 0:o.accountNumber)==null?void 0:ne.trim())!==((G=o==null?void 0:o.confirmAccountNumber)==null?void 0:G.trim())&&(r.confirmAccountNumber="Account numbers must match"),(oe=o==null?void 0:o.bankName)!=null&&oe.trim()||(r.bankName="Bank name is required"),(te=o==null?void 0:o.routingNumber)!=null&&te.trim()||(r.routingNumber="Routing Number is required"),o!=null&&o.routingNumber&&((ae=o==null?void 0:o.routingNumber)==null?void 0:ae.length)!==9&&(r.routingNumber="Routing number must be 9 digits"),((o==null?void 0:o.accountType)==="business saving"||(o==null?void 0:o.accountType)==="business checking")&&(!(o!=null&&o.companyName)||(o==null?void 0:o.companyName)==="")&&(r.companyName="Company Name is required for business accounts"),gt(r),Object.keys(r).length>0},kt=async()=>{var r,o,z,H,A,ne,G,oe,te,ae,ie,fe,Ke,we,pe,Fe;try{let U={method:"POST",redirect:"follow"},Le=await yt.post(`${be}api/v1/widget/generate-session`,U),Ie=Number(h==null?void 0:h.expiryYear)%100,Ve=`${(r=h==null?void 0:h.cardNumber)==null?void 0:r.replace(/\s+/g,"")}=${Ie}${h==null?void 0:h.expiryMonth} ${h==null?void 0:h.cvv}`,wn=forge.pki.publicKeyFromPem((z=(o=Le==null?void 0:Le.data)==null?void 0:o.data)==null?void 0:z.publicKeyPem).encrypt(Ve,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),Pn=forge.util.encode64(wn),Ln={"Content-Type":"application/json","x-app-session-key":(A=(H=Le.data)==null?void 0:H.data)==null?void 0:A.session_key},zn=JSON.stringify({enc_track2_data:Pn,algorithm:"RSAES_OAEP_SHA_1",session_key:(G=(ne=Le==null?void 0:Le.data)==null?void 0:ne.data)==null?void 0:G.session_key}),Rt=await yt.post(`${wt}tokenizer/tokenize`,zn,{headers:Ln});if((Rt==null?void 0:Rt.status)==200){let Ct=(te=(oe=Rt==null?void 0:Rt.data)==null?void 0:oe.data)==null?void 0:te.token;try{let It=await yt.post(`${be}api/v1/gateway/verify-and-save/${q}`,{token:Ct});if((It==null?void 0:It.status)==200){let Jt=(ae=It==null?void 0:It.data)==null?void 0:ae.data,In={Token:Jt.gateway_token,Brand:Jt.card_data.brand,ExpirationMonth:Jt.card_data.expire_mm,ExpirationYear:Jt.card_data.expire_yy,Last4:Jt.card_data.last4,Bin:Jt.card_data.bin,postalCode:h==null?void 0:h.zipCode},An;if(ke&&O)try{let At={postal_code:h==null?void 0:h.zipCode,customer_id:O,gateway_token:Jt.gateway_token};An=await yt.post(`${be}api/v1/gateway/add-card/${q}`,At)}catch(At){console.log(At,"error"),X(),s(((fe=(ie=At==null?void 0:At.response)==null?void 0:ie.data)==null?void 0:fe.message)||"Something went wrong!")}I?it(In):Ge(In)}}catch(It){console.log(It,"error"),s(((we=(Ke=It==null?void 0:It.response)==null?void 0:Ke.data)==null?void 0:we.message)||"Something went wrong!"),X()}}}catch(U){X(),console.log(U,"error"),s(((Fe=(pe=U==null?void 0:U.response)==null?void 0:pe.data)==null?void 0:Fe.message)||"Something went wrong!")}},Tt=()=>{var A,ne,G,oe,te,ae;let r={},o=h,z=parseInt((o==null?void 0:o.expiryMonth)||"",10),H=(o==null?void 0:o.expiryYear)||"";if((A=o==null?void 0:o.cardName)!=null&&A.trim()||(r.cardName="Card name is required"),(ne=o==null?void 0:o.cardNumber)!=null&&ne.trim()||(r.cardNumber="Card number is required"),(!((G=o==null?void 0:o.expiryMonth)!=null&&G.trim())||!((oe=o==null?void 0:o.expiryYear)!=null&&oe.trim())||isNaN(z)||z<1||z>12||H.length!==4)&&(r.expiryMonth="Invalid Expiration Date."),(te=o==null?void 0:o.cvv)!=null&&te.trim()||(r.cvv="CVV is required"),(ae=o==null?void 0:o.zipCode)!=null&&ae.trim()||(r.zipCode="ZIP code is required"),o!=null&&o.expiryMonth&&(o!=null&&o.expiryYear)&&o.expiryMonth.length<=2&&o.expiryYear.length===4){let ie=parseInt(o.expiryMonth,10),fe=parseInt(o.expiryYear,10),Ke=new Date,we=Ke.getMonth()+1,pe=Ke.getFullYear();(fe<pe||fe===pe&&ie<we)&&(r.expiryMonth="Card is expired")}return Be(r),Object.keys(r).length>0},zt=()=>{let r=DatacapWebToken.validateCardNumber(h==null?void 0:h.cardNumber.replaceAll(" ","")),o=DatacapWebToken.validateExpirationDate(h==null?void 0:h.expiryMonth,h==null?void 0:h.expiryYear),z=DatacapWebToken.validateCVV(h==null?void 0:h.cvv),H={};return r||(H.cardNumber="Invalid card Number"),o||(H.expiryMonth="Invalid Expiration Date."),z||(H.cvv="Invalid CVV"),Be(H),r&&z&&o},_t=async r=>{var o,z,H,A,ne,G,oe,te,ae,ie,fe,Ke,we,pe,Fe;if(r.preventDefault(),n!=="ach"){if(Tt()||!zt())return}else if(vt())return;try{Ye();let U=await yt.get(`${be}api/v1/gateway/token/${q}`);if((U==null?void 0:U.status)==200){let Le=(z=(o=U==null?void 0:U.data)==null?void 0:o.data)==null?void 0:z.gateway_token,Ie=(A=(H=U==null?void 0:U.data)==null?void 0:H.data)==null?void 0:A.paymentGateway;if(n!=="ach")Ie==((ne=Mn)==null?void 0:ne.FRACTALKEY)?await kt():DatacapWebToken.requestToken(Le,"PaymentForm",Nt);else{let ct;try{let Ve=await yt.post(`${be}api/v1/gateway/bank-charge/${q}`,{label:c==null?void 0:c.name,account_number:c==null?void 0:c.accountNumber,routing_number:c==null?void 0:c.routingNumber,bank_name:c==null?void 0:c.bankName,account_type:c==null?void 0:c.accountType,amount:`${ot}`,customer_id:null,isSaveAch:!1,tax:"0.00",discount:"0.00",surcharge:"0.00",order_id:"",company_name:(c==null?void 0:c.companyName)||""});if((G=Ve==null?void 0:Ve.data)!=null&&G.result){if(y&&O)try{let Ne=await yt.post(`${be}api/v1/gateway/add-bank/${q}`,{name:c==null?void 0:c.name,account_number:c==null?void 0:c.accountNumber,routing_number:c==null?void 0:c.routingNumber,bank_name:c==null?void 0:c.bankName,account_type:c==null?void 0:c.accountType,customer_id:O||"",company_name:(c==null?void 0:c.companyName)||""});Ne.data.result&&(ct={bankDetails:B(k({},(oe=Ne==null?void 0:Ne.data)==null?void 0:oe.data),{account_type:c==null?void 0:c.accountType})})}catch(Ne){X(),s(((ae=(te=Ne==null?void 0:Ne.response)==null?void 0:te.data)==null?void 0:ae.message)||"Something went wrong!")}ct=B(k({},ct),{callback:B(k({},(ie=Ve==null?void 0:Ve.data)==null?void 0:ie.data),{name:c==null?void 0:c.name,isPreAuth:I})}),Y(ct),at(),X()}}catch(Ve){console.log(Ve,"errororor");let Ne=(fe=Ve==null?void 0:Ve.response)==null?void 0:fe.data;typeof(Ne==null?void 0:Ne.message)=="object"?Object.values(Ne==null?void 0:Ne.message).forEach(wn=>{s(wn||"Something went wrong")}):s((Ne==null?void 0:Ne.message)||"Something went wrong"),X()}}}}catch(U){X(),Y({error:((we=(Ke=U==null?void 0:U.response)==null?void 0:Ke.data)==null?void 0:we.message)||"Something went wrong!"}),s(((Fe=(pe=U==null?void 0:U.response)==null?void 0:pe.data)==null?void 0:Fe.message)||"Something went wrong!")}},We=(r,o)=>{let z=r;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(z)){(o===""||/^[0-9]+$/.test(o))&&(Be(A=>B(k({},A),{[z]:""})),he(A=>B(k({},A),{[z]:o})));return}Be(A=>B(k({},A),{[z]:""})),he(A=>B(k({},A),{[z]:o}))},Ce=r=>{let z=r.target.value.replace(/\D/g,""),H="";/^3[47]/.test(z)?H=z.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(ne,G,oe,te)=>[G,oe,te].filter(Boolean).join(" ")):H=z.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(ne,G,oe,te,ae)=>[G,oe,te,ae].filter(Boolean).join(" ")),Be(A=>B(k({},A),{cardNumber:""})),he(A=>B(k({},A),{cardNumber:H}))},Re=r=>{let{name:o,value:z}=r.target,H=["routingNumber","accountNumber","confirmAccountNumber"];if(o=="name"){/^[a-zA-Z\s]*$/.test(z)&&(gt(A=>B(k({},A),{[o]:""})),ut(A=>B(k({},A),{[o]:z})));return}if(H.includes(o)){(z===""||/^[0-9]+$/.test(z))&&(gt(A=>B(k({},A),{[o]:""})),ut(A=>B(k({},A),{[o]:z})));return}gt(A=>B(k({},A),{[o]:""})),ut(A=>B(k({},A),{[o]:z}))},at=()=>{Ee(!1),u("card"),s(""),K(!1),p(""),ut({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),gt({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),he({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),Be({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),Te(!1),xt(!1),ve("form"),rt("form"),$(!1),Ue(0),C([])},Vt=async()=>{var r,o,z,H;Ye();try{let A={isPreAuth:I,customerId:O},ne=await yt.post(`${be}api/v1/gateway/card-list/${q}`,A);console.log("cardListData",ne);let G=((o=(r=ne==null?void 0:ne.data)==null?void 0:r.data)==null?void 0:o.cardList)||[],oe=G==null?void 0:G.filter(ae=>(ae==null?void 0:ae.card_type)=="Bank"),te=G==null?void 0:G.filter(ae=>(ae==null?void 0:ae.card_type)!=="Bank");te&&(te==null?void 0:te.length)>0?(u("card"),rt("list"),C(te)):u("card"),oe&&(oe==null?void 0:oe.length)>0&&(ve("list"),J(oe)),X()}catch(A){console.log(A),X(),s(((H=(z=A==null?void 0:A.response)==null?void 0:z.data)==null?void 0:H.message)||(A==null?void 0:A.message)||"Something went wrong")}};console.log(me,"lists",v);let Je=r=>{switch(r==null?void 0:r.toLowerCase()){case"visa":return qe;case"mastercard":case"mc":case"m/c":return nt;case"amex":case"american express":case"ae":return lt;case"discover":case"dcvr":return ht;case"bank":return N;default:return r}},Kt=async r=>{mn.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 o=>{var z,H;if(o.isConfirmed){l(!0);try{let A={card_id:r,customer_id:O},ne=await yt.patch(`${be}api/v1/gateway/delete-card/${q}`,A);(z=ne==null?void 0:ne.data)!=null&&z.result?(l(!1),Vt(),mn.fire({icon:"success",title:"Deleted!",text:((H=ne==null?void 0:ne.data)==null?void 0:H.message)||"Card deleted.",confirmButtonText:"OK",showConfirmButton:!0,timer:1e3,timerProgressBar:!0,customClass:{confirmButton:"btn btn-dark"}})):(l(!1),mn.fire({icon:"error",title:"Failure!",text:"Card not deleted.",timer:1e3,timerProgressBar:!0,customClass:{confirmButton:"btn btn-dark"}}))}catch(A){l(!1),mn.fire({icon:"error",title:"Error!",text:"Failed to delete the card.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}}else o.dismiss===mn.DismissReason.cancel&&mn.fire({icon:"info",text:"Card not deleted",confirmButtonText:"OK",buttonsStyling:!1,customClass:{confirmButton:"btn btn-dark float-end",actions:"swal2-actions-end"}})})},St=async()=>{var H,A,ne,G;let r=O,o=De==null?void 0:De.id,z=De==null?void 0:De.card_type;if(e)if(r)if(o){let oe={amount:(z==null?void 0:z.toLowerCase())==="bank"?`${ot}`:e,customer_id:r,card_id:o};I&&(oe.isPreauth=!0),console.log(oe,"chargeobj");let te=be+"api/v1/gateway/charge-by-saved-details/"+q,ae={"Content-Type":"application/json"};try{Ye();let ie=await yt.post(te,oe);console.log(ie,"res"),(H=ie==null?void 0:ie.data)!=null&&H.result&&(Y({callback:B(k({},(A=ie==null?void 0:ie.data)==null?void 0:A.data),{isPreAuth:I})}),X(),at())}catch(ie){console.log(ie==null?void 0:ie.response,"error by saved details"),X(),s(((G=(ne=ie==null?void 0:ie.response)==null?void 0:ne.data)==null?void 0:G.message)||"Something went wrong!")}}else s("Please Select A Card/ACH");else s("Please Select Customer");else s("Something went wrong.")};console.log(W,e,O);let He=async()=>{var r,o;try{Ye();let z=await yt.get(`${be}api/v1/gateway/get-payment-details/${q}`);console.log(z,"respinse"),(z==null?void 0:z.status)==200&&($((o=(r=z==null?void 0:z.data)==null?void 0:r.data)==null?void 0:o.isBankActive),X())}catch(z){console.log(z,"error while getting payment details"),X()}};Gi(()=>{W&&He()},[W]),Ui(()=>{if(W&&ue){let r=Number(e)-Number(ue);r&&!isNaN(r)&&Ue(r)}else Ue(Number(e));O&&W&&!T&&Vt()},[O,W,e]);let et=()=>I?"Cards":"Cards/Bank";return console.log(Ze,"scdgfhasgcf"),i.createElement(i.Fragment,null,i.createElement("link",{href:"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css"}),i.createElement(Ht,null),i.createElement(Vn,null),i.createElement(hn,null),i.createElement("button",{className:Se||"paymentBtn",onClick:bt},f,se),i.createElement($t,{open:W,onClose:at},w&&i.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},i.createElement(Et,{error:w,onClose:at})),!w&&i.createElement(i.Fragment,null,(S||Z)&&i.createElement(Ft,{loading:S||Z}),i.createElement("div",{className:"frac-card-payment-page frac-form frac-new-form"},i.createElement("div",{className:"parent-pay-container"},i.createElement("span",{className:"request-payment-close-popup",onClick:at},i.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},i.createElement("g",{clipPath:"url(#clip0_12425_52336)"},i.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"})),i.createElement("defs",null,i.createElement("clipPath",{id:"clip0_12425_52336"},i.createElement("rect",{width:"16",height:"16",fill:"white"}))))),i.createElement("div",{className:"pay-main-logo-res"}),i.createElement("div",{className:"pay-container"},i.createElement("div",{className:"pay-header pay-conatiner-one"},i.createElement("div",{className:"pay-conatiner-one-first"},i.createElement("div",{className:"pay-logo-container"},i.createElement("div",{className:"pay-main-logo"}),i.createElement("h1",{className:"pay-heading"},"Pay"),(v==null?void 0:v.length)>0&&n!=="cardList"&&i.createElement("button",{className:"res-charge-payment-back-btn ",onClick:()=>u("cardList")}," ",i.createElement(Kn,null)," Back")),i.createElement("div",{className:"amt-pay-con"},i.createElement("div",{className:"pay-amount-conatiner"},i.createElement("small",{className:"pay-payment-amount"},"Select payment type"),i.createElement("div",{className:"frac-card-bank-radio-main"},i.createElement(rn,{label:"Card",amount:(Ut=Number(e))==null?void 0:Ut.toFixed(2),value:"card",onChange:dt,activetab:n}),!I&&Ze&&i.createElement(rn,{label:"Bank",amount:(qt=Number(ot))==null?void 0:qt.toFixed(2),value:"ach",onChange:dt,activetab:n})),D&&ot&&ot>0?i.createElement("div",{className:"frac-cash-discount-fee"},i.createElement("small",null,n==="card"?"Cash Discount":"Cash Discount Savings"," "),i.createElement("p",null,"$",(Number(e)-Number(ot)).toFixed(2))):null))),i.createElement("div",{className:"pay-conatiner-one-last"},i.createElement("img",{src:L,alt:""}),i.createElement("img",{src:de,alt:""}),"Secure payments powered by Fractal")),i.createElement("div",{className:"pay-tab pay-conatiner-two"},i.createElement("div",{className:"col-md-12"},i.createElement("div",{id:"payment-form-div"},i.createElement("div",{id:"ach",style:{display:n==="card"?"block":"none"},className:"tabcontent"},i.createElement("div",{className:"frac-heading-card-wrap"},i.createElement("div",{className:"frac-backarrow"},(v==null?void 0:v.length)>0&&Lt==="form"&&i.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>rt("list")}," ",i.createElement(Kn,null))),i.createElement("h6",{className:"frac-card-payment-heading"},"Card Payment")),i.createElement("div",{style:{display:"flex",gap:"8px",margin:"8px 0px 19px 0px"}},i.createElement("img",{src:qe,alt:"",width:33}),i.createElement("img",{src:nt,width:33,alt:""}),i.createElement("img",{src:lt,alt:"",width:33}),i.createElement("img",{src:ht,width:33,alt:""})),Lt==="list"&&(v==null?void 0:v.length)>0?i.createElement(i.Fragment,null,i.createElement(sn,{headingClass:"card-ach-heading-frac",listHeading:"Card",ListItems:v,selectedCard:De,setSelectedCard:ft,handleDeleteCard:Kt,otherButtonLabel:"Pay With Other Card",otherButtonAction:()=>{rt("form")}}),i.createElement("div",{className:"form-group-frac",style:{padding:"0"}},i.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:St},an((Gt=Number(e))==null?void 0:Gt.toFixed(2))))):i.createElement("form",{id:"PaymentForm",style:{textAlign:"start"},onSubmit:_t},i.createElement("div",{className:"ach-scrl",style:{minHeight:"398px",maxHeight:"398px",overflow:"auto",marginRight:"5px"}},i.createElement("div",{className:"form-group-frac"},i.createElement("label",{htmlFor:"cardHolderName"},"NAME ON CARD "),i.createElement("input",{type:"text",className:"form-control-frac",maxLength:100,placeholder:"John Doe",value:(h==null?void 0:h.cardName)||"",onChange:r=>{let o=r.target.value;/^[a-zA-Z\s]*$/.test(o)&&We("cardName",o)}}),(Q==null?void 0:Q.cardName)&&i.createElement("span",{className:"error-span"},Q==null?void 0:Q.cardName)),i.createElement("div",{className:"form-group-frac"},i.createElement("label",{htmlFor:"cardNumber"},"CARD NUMBER"),i.createElement("div",{className:"toggle-num-wrapper"},i.createElement("input",{className:"form-control-frac card-number-new",type:"text",maxLength:19,inputMode:"numeric",placeholder:"0000 0000 0000 0000",value:(h==null?void 0:h.cardNumber)||"",onChange:r=>Ce(r),"data-token":"card_number"}),i.createElement("div",{className:"card-crdi card-expiry-new"},i.createElement("div",{className:"exp-date-year-container"},i.createElement("div",{className:"exp-date form-group-frac"},i.createElement("input",{"data-token":"exp_month",className:"form-control-frac required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"MM",maxLength:2,value:(h==null?void 0:h.expiryMonth)||"",onChange:r=>We("expiryMonth",r.target.value)})),i.createElement("div",{className:"exp-year form-group-frac"},i.createElement("input",{"data-token":"exp_year",className:"form-control-frac required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"YYYY",maxLength:4,value:(h==null?void 0:h.expiryYear)||"",onChange:r=>We("expiryYear",r.target.value)})),i.createElement("div",{className:"security-digit form-group-frac"},i.createElement("input",{"data-token":"cvv",className:"form-control-frac card-cvv-in required",type:"text",style:{maxHeight:"36px"},maxLength:4,placeholder:"CVC",value:(h==null?void 0:h.cvv)||"",onChange:r=>We("cvv",r.target.value)})))),(Q==null?void 0:Q.cardNumber)&&i.createElement("span",{className:"error-span"},Q==null?void 0:Q.cardNumber),i.createElement("p",{style:{margin:"0"}},Q!=null&&Q.expiryMonth||Q!=null&&Q.expiryYear?i.createElement("span",{className:"error-span",style:{paddingRight:"4px"}},Q==null?void 0:Q.expiryMonth):"",(Q==null?void 0:Q.cvv)&&i.createElement("span",{className:"error-span"},Q==null?void 0:Q.cvv)))),i.createElement("div",{className:"form-group-frac"},i.createElement("label",{htmlFor:"zip"},"ZIP"),i.createElement("input",{type:"text",className:"form-control-frac",maxLength:100,placeholder:"000000",value:(mt=h==null?void 0:h.zipCode)!=null?mt:"",onChange:r=>We("zipCode",r.target.value)}),(Q==null?void 0:Q.zipCode)&&i.createElement("span",{className:"error-span"},Q==null?void 0:Q.zipCode)),O&&i.createElement("div",{className:"form-group-frac"},i.createElement("div",{className:"frac-tooltip-mn",style:{display:"flex",alignItems:"center",gap:"10px",paddingTop:"10px"}},i.createElement("input",{type:"checkbox",id:"save_card",className:"toggle-checkbox",checked:ke,onChange:r=>xt(r.target.checked)}),i.createElement("label",{htmlFor:"save_card",className:"toggle-label"}),i.createElement("label",{htmlFor:"save_card"},"Save card for future payments "),i.createElement("div",{className:"frac-tooltip-wrapper"},i.createElement("div",{className:"frac-tooltip-icon"},i.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},i.createElement("circle",{cx:"10",cy:"10",r:"10",fill:"#E0DFE2"}),i.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"}))),i.createElement("div",{className:"frac-tooltip-text"},i.createElement("p",null,"If checked, I agree to give the ",i.createElement("b",null,Ae||"merchant")," permission to charge this credit card for agreed-upon purchases in the future.")))))),i.createElement("div",{className:"form-group-frac",style:{marginTop:"20px",padding:"0"}},i.createElement("button",{type:"submit",style:{margin:0},className:"pay-button"},an((Ot=Number(e))==null?void 0:Ot.toFixed(2)))))),i.createElement("div",{id:"ach",style:{display:n==="ach"?"block":"none"},className:"tabcontent"},i.createElement(i.Fragment,null,i.createElement("div",{className:"frac-heading-card-wrap"},i.createElement("div",{className:"frac-backarrow"},(me==null?void 0:me.length)>0&&st==="form"&&i.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>ve("list")}," ",i.createElement(Kn,null))),i.createElement("h6",{className:"frac-card-payment-heading"},"Bank Payment")),st==="list"&&(me==null?void 0:me.length)>0?i.createElement(i.Fragment,null,i.createElement(sn,{headingClass:"card-ach-heading-frac",listHeading:"Banks",ListItems:me,selectedCard:De,setSelectedCard:ft,handleDeleteCard:Kt,otherButtonLabel:"Pay With Other Bank",otherButtonAction:()=>{ve("form")}}),i.createElement("div",{className:"form-group-frac",style:{padding:"0"}},i.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:St},an((nn=Number(ot))==null?void 0:nn.toFixed(2))))):i.createElement("form",{id:"ACHPaymentForm",style:{textAlign:"start"},onSubmit:_t},i.createElement("div",{className:"ach-scrl",style:{minHeight:"444px",maxHeight:"444px"}},i.createElement("div",{className:"form-group-frac mb-4"},i.createElement("label",{htmlFor:"nameonaccount"},"Name on account"),i.createElement("input",{type:"text",id:"nameonaccount",className:"form-control-frac",maxLength:100,placeholder:"John Doe",name:"name",value:(F=c==null?void 0:c.name)!=null?F:"",onChange:Re}),(V==null?void 0:V.name)&&i.createElement("span",{className:"error-span"},V==null?void 0:V.name)),i.createElement("div",{className:"form-group-frac mb-4"},i.createElement("label",{htmlFor:"routingnumber"},"Routing number"),i.createElement("input",{type:"text",id:"routingnumber",className:"form-control-frac",maxLength:9,placeholder:"000000000",name:"routingNumber",value:(d=c==null?void 0:c.routingNumber)!=null?d:"",onChange:Re}),(V==null?void 0:V.routingNumber)&&i.createElement("span",{className:"error-span"},V==null?void 0:V.routingNumber)),i.createElement("div",{className:"form-group-frac mb-4"},i.createElement("label",{htmlFor:"accountnumber"},"Account number"),i.createElement("input",{type:"text",id:"accountnumber",className:"form-control-frac",maxLength:16,placeholder:"0000000000",name:"accountNumber",value:(j=c==null?void 0:c.accountNumber)!=null?j:"",onChange:Re}),(V==null?void 0:V.accountNumber)&&i.createElement("span",{className:"error-span"},V==null?void 0:V.accountNumber)),i.createElement("div",{className:"form-group-frac mb-4"},i.createElement("label",{htmlFor:"confirmaccountnumber"},"Confirm account number"),i.createElement("input",{type:"text",id:"confirmaccountnumber",className:"form-control-frac",maxLength:16,placeholder:"0000000000",name:"confirmAccountNumber",value:(_e=c==null?void 0:c.confirmAccountNumber)!=null?_e:"",onChange:Re}),(V==null?void 0:V.confirmAccountNumber)&&i.createElement("span",{className:"error-span"},V==null?void 0:V.confirmAccountNumber)),i.createElement("div",{className:"form-group-frac mb-4"},i.createElement("label",{htmlFor:"bankname"},"Bank name"),i.createElement("input",{type:"text",id:"bankname",className:"form-control-frac",maxLength:100,placeholder:"My Bank",name:"bankName",value:(ee=c==null?void 0:c.bankName)!=null?ee:"",onChange:Re}),(V==null?void 0:V.bankName)&&i.createElement("span",{className:"error-span"},V==null?void 0:V.bankName)),((c==null?void 0:c.accountType)==="business saving"||(c==null?void 0:c.accountType)==="business checking")&&i.createElement("div",{className:"form-group-frac mb-4"},i.createElement("label",{htmlFor:"companyName"},"Company name"),i.createElement("input",{type:"text",id:"companyName",className:"form-control",maxLength:100,placeholder:"My Company",name:"companyName",value:(je=c==null?void 0:c.companyName)!=null?je:"",onChange:Re}),(V==null?void 0:V.companyName)&&i.createElement("span",{className:"error-span"},V==null?void 0:V.companyName)),i.createElement("div",{className:"form-group-frac mb-4"},i.createElement("label",{htmlFor:"accounttype"},"Select account type"),i.createElement("select",{name:"accountType",id:"accounttype",className:"form-control-frac",value:(ge=c==null?void 0:c.accountType)!=null?ge:"",onChange:Re},i.createElement("option",{value:""},"Select account"),Sn.map(r=>i.createElement("option",{key:r.value,value:r.value},r.label)))),O&&i.createElement("div",{className:"form-group-frac mb-4 save-ach-div",style:{paddingTop:"5px"}},i.createElement("input",{type:"checkbox",id:"saveACH",className:"",maxLength:100,placeholder:"My Bank",checked:y,onChange:r=>Te(r.target.checked)}),i.createElement("label",{className:"saveachlabel",htmlFor:"saveACH"},"Save ACH")),y&&i.createElement("div",{className:"form-group-frac mb-4 saveachtext"},i.createElement("p",null,"If checked, I agree to give the ",i.createElement("b",null,Ae||"merchant")," permission to charge this bank account for agreed-upon purchases in the future."))),i.createElement("div",{className:"form-group-frac "},i.createElement("button",{className:"pay-button",style:{margin:"20px 0 0"},type:"submit"},an((Pe=Number(ot))==null?void 0:Pe.toFixed(2))))))))))))))))};export{Oi as AddCard,Zi as CardOnFile,qi as GetPaymentPage,Ji as PaymentWidget,$i as PreAuthPayment,bi as RequestPayment,Ni as RequestPreAuthPayment};
|
|
2854
|
+
`)}import yt from"axios";import{IoArrowBack as On}from"react-icons/io5";import cn from"sweetalert2";var Xi=({amount:e,submitBtnText:f="Pay",session_token:q,customerId:O,callback:Y,merchantName:Be="merchant",isPreAuth:I,surcharge:Qe="0",submitBtnClass:_e,submitBtnIcon:se,isRequest:T,pass_fee:D,pass_fee_amount:ue})=>{var Ut,qt,Gt,mt,Ot,nn,F,d,j,ke,ee,Ve,ge,Me;let[n,u]=Xe("card"),[b,E]=Xe("card"),[h,fe]=Xe(),[Q,Te]=Xe({}),[c,ut]=Xe(),[V,gt]=Xe({}),[y,qe]=Xe(!1),[W,Ee]=Xe(!1),[Ne,xt]=Xe(!1),[w,s]=Xe(""),[m,K]=Xe(!1),[x,p]=Xe(""),[S,g]=Xe(!1),[Z,l]=Xe(!1),[v,C]=Xe([]),[ce,J]=Xe([]),[De,ft]=Xe(),[ot,Ue]=Xe(Number(e)),[Lt,rt]=Xe("form"),[st,ve]=Xe("form"),[Ze,$]=Xe(!1),nt=R+"widget/mc-img.svg",$e=R+"widget/visa-img.svg",lt=R+"widget/ae-img.svg",ht=R+"widget/discover-img.svg",Yt=R+"widget/card.svg",Wt=R+"widget/Trash.svg",N=R+"widget/bank.svg",L=R+"widget/secure-img.png",me=R+"widget/pov-by.png",pe=R+"widget/pax.svg",le=R+"widget/cardicon.svg",Ye=R+"widget/bankicon.svg",He=()=>g(!0),X=()=>g(!1),Ge=async r=>{var o,z,H,A,ie,G,oe,te,de;console.log(r,"ndfkjhdskjfhds");try{let ae={pass_fee_amount:ue,pass_fee:D,Token:r==null?void 0:r.Token,amount:e,postal_code:r==null?void 0:r.postalCode},ne=await yt.post(`${be}api/v1/gateway/charge/${q}`,ae);if((o=ne==null?void 0:ne.data)!=null&&o.result){let he;if(Ne&&O)try{let Le={postal_code:h==null?void 0:h.zipCode,customer_id:O,gateway_token:(r==null?void 0:r.gateway_token)||(r==null?void 0:r.Token)};he=await yt.post(`${be}api/v1/gateway/add-card/${q}`,Le);debugger;console.log((z=he==null?void 0:he.data)==null?void 0:z.data,"addCard?.data?.data"),(H=he==null?void 0:he.data)!=null&&H.result&&(he=(A=he==null?void 0:he.data)==null?void 0:A.data)}catch(Le){console.log(Le,"error"),X(),s(((G=(ie=Le==null?void 0:Le.response)==null?void 0:ie.data)==null?void 0:G.message)||"Something went wrong!")}let Pe={cardDetails:k(k({},he),r),callback:B(k({},(oe=ne==null?void 0:ne.data)==null?void 0:oe.data),{name:h==null?void 0:h.cardName,isPreAuth:I})};Ne||delete Pe.cardDetails,Y(Pe),X(),at()}}catch(ae){s(((de=(te=ae==null?void 0:ae.response)==null?void 0:te.data)==null?void 0:de.message)||"Something went wrong!"),X()}},it=async r=>{var o,z,H,A,ie,G,oe,te;try{let de={Token:r==null?void 0:r.Token,amount:e,postal_code:r==null?void 0:r.postalCode},ae=await yt.post(`${be}api/v1/gateway/preauth/${q}`,de);if((o=ae==null?void 0:ae.data)!=null&&o.result){let ne;if(Ne&&O)try{console.log(ae,"preAuthResponse");let Pe={postal_code:h==null?void 0:h.zipCode,customer_id:O,gateway_token:(r==null?void 0:r.Token)||(r==null?void 0:r.gateway_token)};ne=await yt.post(`${be}api/v1/gateway/add-card/${q}`,Pe),(z=ne==null?void 0:ne.data)!=null&&z.result&&(ne=(H=ne==null?void 0:ne.data)==null?void 0:H.data)}catch(Pe){console.log(Pe,"error"),X(),s(((ie=(A=Pe==null?void 0:Pe.response)==null?void 0:A.data)==null?void 0:ie.message)||"Something went wrong!")}let he={cardDetails:k(k({},ne),r),callback:B(k({},(G=ae==null?void 0:ae.data)==null?void 0:G.data),{name:h==null?void 0:h.cardName,isPreAuth:I})};Ne||delete he.cardDetails,Y(he),X(),at()}}catch(de){s(((te=(oe=de==null?void 0:de.response)==null?void 0:oe.data)==null?void 0:te.message)||"Something went wrong!"),X()}},Nt=async r=>{var o,z,H,A;if(r.Error)s(r.Error),X();else{let ie={token:r.Token,resp:r};try{let G=await yt.post(`${be}api/v1/gateway/update/token/${q}`,ie);if((G==null?void 0:G.status)==200){let oe={Token:(z=(o=G==null?void 0:G.data)==null?void 0:o.data)==null?void 0:z.gateway_token,Brand:r.Brand,ExpirationMonth:r.ExpirationMonth,ExpirationYear:r.ExpirationYear,Last4:r.Last4,Bin:r.Bin,CVV:r.CVV,postalCode:h==null?void 0:h.zipCode},te;I?it(oe):Ge(oe)}}catch(G){console.log(G,"error"),X(),s(((A=(H=G==null?void 0:G.response)==null?void 0:H.data)==null?void 0:A.message)||"Something went wrong!")}}},bt=()=>Ee(!0),dt=r=>{u(r)},vt=()=>{var z,H,A,ie,G,oe,te,de;let r={},o=c;return(z=o==null?void 0:o.name)!=null&&z.trim()||(r.name="Name is required"),(H=o==null?void 0:o.accountNumber)!=null&&H.trim()||(r.accountNumber="Account number is required"),(A=o==null?void 0:o.accountNumber)!=null&&A.trim()&&((ie=o==null?void 0:o.accountNumber)==null?void 0:ie.trim())!==((G=o==null?void 0:o.confirmAccountNumber)==null?void 0:G.trim())&&(r.confirmAccountNumber="Account numbers must match"),(oe=o==null?void 0:o.bankName)!=null&&oe.trim()||(r.bankName="Bank name is required"),(te=o==null?void 0:o.routingNumber)!=null&&te.trim()||(r.routingNumber="Routing Number is required"),o!=null&&o.routingNumber&&((de=o==null?void 0:o.routingNumber)==null?void 0:de.length)!==9&&(r.routingNumber="Routing number must be 9 digits"),((o==null?void 0:o.accountType)==="business saving"||(o==null?void 0:o.accountType)==="business checking")&&(!(o!=null&&o.companyName)||(o==null?void 0:o.companyName)==="")&&(r.companyName="Company Name is required for business accounts"),gt(r),Object.keys(r).length>0},kt=async()=>{var r,o,z,H,A,ie,G,oe,te,de,ae,ne,he,Pe,Le,Se;try{let U={method:"POST",redirect:"follow"},ze=await yt.post(`${be}api/v1/widget/generate-session`,U),Ae=Number(h==null?void 0:h.expiryYear)%100,Ke=`${(r=h==null?void 0:h.cardNumber)==null?void 0:r.replace(/\s+/g,"")}=${Ae}${h==null?void 0:h.expiryMonth} ${h==null?void 0:h.cvv}`,Nn=forge.pki.publicKeyFromPem((z=(o=ze==null?void 0:ze.data)==null?void 0:o.data)==null?void 0:z.publicKeyPem).encrypt(Ke,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),Ln=forge.util.encode64(Nn),zn={"Content-Type":"application/json","x-app-session-key":(A=(H=ze.data)==null?void 0:H.data)==null?void 0:A.session_key},In=JSON.stringify({enc_track2_data:Ln,algorithm:"RSAES_OAEP_SHA_1",session_key:(G=(ie=ze==null?void 0:ze.data)==null?void 0:ie.data)==null?void 0:G.session_key}),Rt=await yt.post(`${wt}tokenizer/tokenize`,In,{headers:zn});if((Rt==null?void 0:Rt.status)==200){let Ct=(te=(oe=Rt==null?void 0:Rt.data)==null?void 0:oe.data)==null?void 0:te.token;try{let It=await yt.post(`${be}api/v1/gateway/verify-and-save/${q}`,{token:Ct});if((It==null?void 0:It.status)==200){let Jt=(de=It==null?void 0:It.data)==null?void 0:de.data,An={Token:Jt.gateway_token,Brand:Jt.card_data.brand,ExpirationMonth:Jt.card_data.expire_mm,ExpirationYear:Jt.card_data.expire_yy,Last4:Jt.card_data.last4,Bin:Jt.card_data.bin,postalCode:h==null?void 0:h.zipCode},Bn;if(Ne&&O)try{let At={postal_code:h==null?void 0:h.zipCode,customer_id:O,gateway_token:Jt.gateway_token};Bn=await yt.post(`${be}api/v1/gateway/add-card/${q}`,At)}catch(At){console.log(At,"error"),X(),s(((ne=(ae=At==null?void 0:At.response)==null?void 0:ae.data)==null?void 0:ne.message)||"Something went wrong!")}I?it(An):Ge(An)}}catch(It){console.log(It,"error"),s(((Pe=(he=It==null?void 0:It.response)==null?void 0:he.data)==null?void 0:Pe.message)||"Something went wrong!"),X()}}}catch(U){X(),console.log(U,"error"),s(((Se=(Le=U==null?void 0:U.response)==null?void 0:Le.data)==null?void 0:Se.message)||"Something went wrong!")}},Tt=()=>{var A,ie,G,oe,te,de;let r={},o=h,z=parseInt((o==null?void 0:o.expiryMonth)||"",10),H=(o==null?void 0:o.expiryYear)||"";if((A=o==null?void 0:o.cardName)!=null&&A.trim()||(r.cardName="Card name is required"),(ie=o==null?void 0:o.cardNumber)!=null&&ie.trim()||(r.cardNumber="Card number is required"),(!((G=o==null?void 0:o.expiryMonth)!=null&&G.trim())||!((oe=o==null?void 0:o.expiryYear)!=null&&oe.trim())||isNaN(z)||z<1||z>12||H.length!==4)&&(r.expiryMonth="Invalid Expiration Date."),(te=o==null?void 0:o.cvv)!=null&&te.trim()||(r.cvv="CVV is required"),(de=o==null?void 0:o.zipCode)!=null&&de.trim()||(r.zipCode="ZIP code is required"),o!=null&&o.expiryMonth&&(o!=null&&o.expiryYear)&&o.expiryMonth.length<=2&&o.expiryYear.length===4){let ae=parseInt(o.expiryMonth,10),ne=parseInt(o.expiryYear,10),he=new Date,Pe=he.getMonth()+1,Le=he.getFullYear();(ne<Le||ne===Le&&ae<Pe)&&(r.expiryMonth="Card is expired")}return Te(r),Object.keys(r).length>0},zt=()=>{let r=DatacapWebToken.validateCardNumber(h==null?void 0:h.cardNumber.replaceAll(" ","")),o=DatacapWebToken.validateExpirationDate(h==null?void 0:h.expiryMonth,h==null?void 0:h.expiryYear),z=DatacapWebToken.validateCVV(h==null?void 0:h.cvv),H={};return r||(H.cardNumber="Invalid card Number"),o||(H.expiryMonth="Invalid Expiration Date."),z||(H.cvv="Invalid CVV"),Te(H),r&&z&&o},_t=async r=>{var o,z,H,A,ie,G,oe,te,de,ae,ne,he,Pe,Le,Se;if(r.preventDefault(),n!=="ach"){if(Tt()||!zt())return}else if(vt())return;try{He();let U=await yt.get(`${be}api/v1/gateway/token/${q}`);if((U==null?void 0:U.status)==200){let ze=(z=(o=U==null?void 0:U.data)==null?void 0:o.data)==null?void 0:z.gateway_token,Ae=(A=(H=U==null?void 0:U.data)==null?void 0:H.data)==null?void 0:A.paymentGateway;if(n!=="ach")Ae==((ie=Pn)==null?void 0:ie.FRACTALKEY)?await kt():DatacapWebToken.requestToken(ze,"PaymentForm",Nt);else{let ct;try{let Ke=await yt.post(`${be}api/v1/gateway/bank-charge/${q}`,{label:c==null?void 0:c.name,account_number:c==null?void 0:c.accountNumber,routing_number:c==null?void 0:c.routingNumber,bank_name:c==null?void 0:c.bankName,account_type:c==null?void 0:c.accountType,amount:`${ot}`,customer_id:null,isSaveAch:!1,tax:"0.00",discount:"0.00",surcharge:"0.00",order_id:"",company_name:(c==null?void 0:c.companyName)||""});if((G=Ke==null?void 0:Ke.data)!=null&&G.result){if(y&&O)try{let we=await yt.post(`${be}api/v1/gateway/add-bank/${q}`,{name:c==null?void 0:c.name,account_number:c==null?void 0:c.accountNumber,routing_number:c==null?void 0:c.routingNumber,bank_name:c==null?void 0:c.bankName,account_type:c==null?void 0:c.accountType,customer_id:O||"",company_name:(c==null?void 0:c.companyName)||""});we.data.result&&(ct={bankDetails:B(k({},(oe=we==null?void 0:we.data)==null?void 0:oe.data),{account_type:c==null?void 0:c.accountType})})}catch(we){X(),s(((de=(te=we==null?void 0:we.response)==null?void 0:te.data)==null?void 0:de.message)||"Something went wrong!")}ct=B(k({},ct),{callback:B(k({},(ae=Ke==null?void 0:Ke.data)==null?void 0:ae.data),{name:c==null?void 0:c.name,isPreAuth:I})}),Y(ct),at(),X()}}catch(Ke){console.log(Ke,"errororor");let we=(ne=Ke==null?void 0:Ke.response)==null?void 0:ne.data;typeof(we==null?void 0:we.message)=="object"?Object.values(we==null?void 0:we.message).forEach(Nn=>{s(Nn||"Something went wrong")}):s((we==null?void 0:we.message)||"Something went wrong"),X()}}}}catch(U){X(),Y({error:((Pe=(he=U==null?void 0:U.response)==null?void 0:he.data)==null?void 0:Pe.message)||"Something went wrong!"}),s(((Se=(Le=U==null?void 0:U.response)==null?void 0:Le.data)==null?void 0:Se.message)||"Something went wrong!")}},We=(r,o)=>{let z=r;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(z)){(o===""||/^[0-9]+$/.test(o))&&(Te(A=>B(k({},A),{[z]:""})),fe(A=>B(k({},A),{[z]:o})));return}Te(A=>B(k({},A),{[z]:""})),fe(A=>B(k({},A),{[z]:o}))},Ce=r=>{let z=r.target.value.replace(/\D/g,""),H="";/^3[47]/.test(z)?H=z.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(ie,G,oe,te)=>[G,oe,te].filter(Boolean).join(" ")):H=z.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(ie,G,oe,te,de)=>[G,oe,te,de].filter(Boolean).join(" ")),Te(A=>B(k({},A),{cardNumber:""})),fe(A=>B(k({},A),{cardNumber:H}))},Re=r=>{let{name:o,value:z}=r.target,H=["routingNumber","accountNumber","confirmAccountNumber"];if(o=="name"){/^[a-zA-Z\s]*$/.test(z)&&(gt(A=>B(k({},A),{[o]:""})),ut(A=>B(k({},A),{[o]:z})));return}if(H.includes(o)){(z===""||/^[0-9]+$/.test(z))&&(gt(A=>B(k({},A),{[o]:""})),ut(A=>B(k({},A),{[o]:z})));return}gt(A=>B(k({},A),{[o]:""})),ut(A=>B(k({},A),{[o]:z}))},at=()=>{Ee(!1),u("card"),s(""),K(!1),p(""),ut({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),gt({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),fe({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),Te({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),qe(!1),xt(!1),ve("form"),rt("form"),$(!1),Ue(0),C([])},Vt=async()=>{var r,o,z,H;He();try{let A={isPreAuth:I,customerId:O},ie=await yt.post(`${be}api/v1/gateway/card-list/${q}`,A);console.log("cardListData",ie);let G=((o=(r=ie==null?void 0:ie.data)==null?void 0:r.data)==null?void 0:o.cardList)||[],oe=G==null?void 0:G.filter(de=>(de==null?void 0:de.card_type)=="Bank"),te=G==null?void 0:G.filter(de=>(de==null?void 0:de.card_type)!=="Bank");te&&(te==null?void 0:te.length)>0?(u("card"),rt("list"),C(te)):u("card"),oe&&(oe==null?void 0:oe.length)>0&&(ve("list"),J(oe)),X()}catch(A){console.log(A),X(),s(((H=(z=A==null?void 0:A.response)==null?void 0:z.data)==null?void 0:H.message)||(A==null?void 0:A.message)||"Something went wrong")}};console.log(ce,"lists",v);let Je=r=>{switch(r==null?void 0:r.toLowerCase()){case"visa":return $e;case"mastercard":case"mc":case"m/c":return nt;case"amex":case"american express":case"ae":return lt;case"discover":case"dcvr":return ht;case"bank":return N;default:return r}},Kt=async r=>{cn.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 o=>{var z,H;if(o.isConfirmed){l(!0);try{let A={card_id:r,customer_id:O},ie=await yt.patch(`${be}api/v1/gateway/delete-card/${q}`,A);(z=ie==null?void 0:ie.data)!=null&&z.result?(l(!1),Vt(),cn.fire({icon:"success",title:"Deleted!",text:((H=ie==null?void 0:ie.data)==null?void 0:H.message)||"Card deleted.",confirmButtonText:"OK",showConfirmButton:!0,timer:1e3,timerProgressBar:!0,customClass:{confirmButton:"btn btn-dark"}})):(l(!1),cn.fire({icon:"error",title:"Failure!",text:"Card not deleted.",timer:1e3,timerProgressBar:!0,customClass:{confirmButton:"btn btn-dark"}}))}catch(A){l(!1),cn.fire({icon:"error",title:"Error!",text:"Failed to delete the card.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}}else o.dismiss===cn.DismissReason.cancel&&cn.fire({icon:"info",text:"Card not deleted",confirmButtonText:"OK",buttonsStyling:!1,customClass:{confirmButton:"btn btn-dark float-end",actions:"swal2-actions-end"}})})},St=async()=>{var H,A,ie,G;let r=O,o=De==null?void 0:De.id,z=De==null?void 0:De.card_type;if(e)if(r)if(o){let oe={amount:(z==null?void 0:z.toLowerCase())==="bank"?`${ot}`:e,customer_id:r,card_id:o};I&&(oe.isPreauth=!0),console.log(oe,"chargeobj");let te=be+"api/v1/gateway/charge-by-saved-details/"+q,de={"Content-Type":"application/json"};try{He();let ae=await yt.post(te,oe);console.log(ae,"res"),(H=ae==null?void 0:ae.data)!=null&&H.result&&(Y({callback:B(k({},(A=ae==null?void 0:ae.data)==null?void 0:A.data),{isPreAuth:I})}),X(),at())}catch(ae){console.log(ae==null?void 0:ae.response,"error by saved details"),X(),s(((G=(ie=ae==null?void 0:ae.response)==null?void 0:ie.data)==null?void 0:G.message)||"Something went wrong!")}}else s("Please Select A Card/ACH");else s("Please Select Customer");else s("Something went wrong.")};console.log(W,e,O);let je=async()=>{var r,o;try{He();let z=await yt.get(`${be}api/v1/gateway/get-payment-details/${q}`);console.log(z,"respinse"),(z==null?void 0:z.status)==200&&($((o=(r=z==null?void 0:z.data)==null?void 0:r.data)==null?void 0:o.isBankActive),X())}catch(z){console.log(z,"error while getting payment details"),X()}};Ji(()=>{W&&je()},[W]),Gi(()=>{if(W&&ue){let r=Number(e)-Number(ue);r&&!isNaN(r)&&Ue(r)}else Ue(Number(e));O&&W&&!T&&Vt()},[O,W,e]);let et=()=>I?"Cards":"Cards/Bank";return console.log(Ze,"scdgfhasgcf"),i.createElement(i.Fragment,null,i.createElement("link",{href:"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css"}),i.createElement(Ht,null),i.createElement(Kn,null),i.createElement(yn,null),i.createElement("button",{className:_e||"paymentBtn",onClick:bt},f,se),i.createElement($t,{open:W,onClose:at},w&&i.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},i.createElement(Et,{error:w,onClose:at})),!w&&i.createElement(i.Fragment,null,(S||Z)&&i.createElement(Ft,{loading:S||Z}),i.createElement("div",{className:"frac-card-payment-page frac-form frac-new-form"},i.createElement("div",{className:"parent-pay-container"},i.createElement("span",{className:"request-payment-close-popup",onClick:at},i.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},i.createElement("g",{clipPath:"url(#clip0_12425_52336)"},i.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"})),i.createElement("defs",null,i.createElement("clipPath",{id:"clip0_12425_52336"},i.createElement("rect",{width:"16",height:"16",fill:"white"}))))),i.createElement("div",{className:"pay-main-logo-res"}),i.createElement("div",{className:"pay-container"},i.createElement("div",{className:"pay-header pay-conatiner-one"},i.createElement("div",{className:"pay-conatiner-one-first"},i.createElement("div",{className:"pay-logo-container"},i.createElement("div",{className:"pay-main-logo"}),i.createElement("h1",{className:"pay-heading"},"Pay"),(v==null?void 0:v.length)>0&&n!=="cardList"&&i.createElement("button",{className:"res-charge-payment-back-btn ",onClick:()=>u("cardList")}," ",i.createElement(On,null)," Back")),i.createElement("div",{className:"amt-pay-con"},i.createElement("div",{className:"pay-amount-conatiner"},i.createElement("small",{className:"pay-payment-amount"},"Select payment type"),i.createElement("div",{className:"frac-card-bank-radio-main"},i.createElement(sn,{label:"Card",amount:(Ut=Number(e))==null?void 0:Ut.toFixed(2),value:"card",onChange:dt,activetab:n}),!I&&Ze&&i.createElement(sn,{label:"Bank",amount:(qt=Number(ot))==null?void 0:qt.toFixed(2),value:"ach",onChange:dt,activetab:n})),D&&ot&&ot>0?i.createElement("div",{className:"frac-cash-discount-fee"},i.createElement("small",null,n==="card"?"Cash Discount":"Cash Discount Savings"," "),i.createElement("p",null,"$",(Number(e)-Number(ot)).toFixed(2))):null))),i.createElement("div",{className:"pay-conatiner-one-last"},i.createElement("img",{src:L,alt:""}),i.createElement("img",{src:me,alt:""}),"Secure payments powered by Fractal")),i.createElement("div",{className:"pay-tab pay-conatiner-two"},i.createElement("div",{className:"col-md-12"},i.createElement("div",{id:"payment-form-div"},i.createElement("div",{id:"ach",style:{display:n==="card"?"block":"none"},className:"tabcontent"},i.createElement("div",{className:"frac-heading-card-wrap"},i.createElement("div",{className:"frac-backarrow"},(v==null?void 0:v.length)>0&&Lt==="form"&&i.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>rt("list")}," ",i.createElement(On,null))),i.createElement("h6",{className:"frac-card-payment-heading"},"Card Payment")),i.createElement("div",{style:{display:"flex",gap:"8px",margin:"8px 0px 19px 0px"}},i.createElement("img",{src:$e,alt:"",width:33}),i.createElement("img",{src:nt,width:33,alt:""}),i.createElement("img",{src:lt,alt:"",width:33}),i.createElement("img",{src:ht,width:33,alt:""})),Lt==="list"&&(v==null?void 0:v.length)>0?i.createElement(i.Fragment,null,i.createElement(ln,{headingClass:"card-ach-heading-frac",listHeading:"Card",ListItems:v,selectedCard:De,setSelectedCard:ft,handleDeleteCard:Kt,otherButtonLabel:"Pay With Other Card",otherButtonAction:()=>{rt("form")}}),i.createElement("div",{className:"form-group-frac",style:{padding:"0"}},i.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:St},on((Gt=Number(e))==null?void 0:Gt.toFixed(2))))):i.createElement("form",{id:"PaymentForm",style:{textAlign:"start"},onSubmit:_t},i.createElement("div",{className:"ach-scrl",style:{minHeight:"398px",maxHeight:"398px",overflow:"auto",marginRight:"5px"}},i.createElement("div",{className:"form-group-frac"},i.createElement("label",{htmlFor:"cardHolderName"},"NAME ON CARD "),i.createElement("input",{type:"text",className:"form-control-frac",maxLength:100,placeholder:"John Doe",value:(h==null?void 0:h.cardName)||"",onChange:r=>{let o=r.target.value;/^[a-zA-Z\s]*$/.test(o)&&We("cardName",o)}}),(Q==null?void 0:Q.cardName)&&i.createElement("span",{className:"error-span"},Q==null?void 0:Q.cardName)),i.createElement("div",{className:"form-group-frac"},i.createElement("label",{htmlFor:"cardNumber"},"CARD NUMBER"),i.createElement("div",{className:"toggle-num-wrapper"},i.createElement("input",{className:"form-control-frac card-number-new",type:"text",maxLength:19,inputMode:"numeric",placeholder:"0000 0000 0000 0000",value:(h==null?void 0:h.cardNumber)||"",onChange:r=>Ce(r),"data-token":"card_number"}),i.createElement("div",{className:"card-crdi card-expiry-new"},i.createElement("div",{className:"exp-date-year-container"},i.createElement("div",{className:"exp-date form-group-frac"},i.createElement("input",{"data-token":"exp_month",className:"form-control-frac required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"MM",maxLength:2,value:(h==null?void 0:h.expiryMonth)||"",onChange:r=>We("expiryMonth",r.target.value)})),i.createElement("div",{className:"exp-year form-group-frac"},i.createElement("input",{"data-token":"exp_year",className:"form-control-frac required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"YYYY",maxLength:4,value:(h==null?void 0:h.expiryYear)||"",onChange:r=>We("expiryYear",r.target.value)})),i.createElement("div",{className:"security-digit form-group-frac"},i.createElement("input",{"data-token":"cvv",className:"form-control-frac card-cvv-in required",type:"text",style:{maxHeight:"36px"},maxLength:4,placeholder:"CVC",value:(h==null?void 0:h.cvv)||"",onChange:r=>We("cvv",r.target.value)})))),(Q==null?void 0:Q.cardNumber)&&i.createElement("span",{className:"error-span"},Q==null?void 0:Q.cardNumber),i.createElement("p",{style:{margin:"0"}},Q!=null&&Q.expiryMonth||Q!=null&&Q.expiryYear?i.createElement("span",{className:"error-span",style:{paddingRight:"4px"}},Q==null?void 0:Q.expiryMonth):"",(Q==null?void 0:Q.cvv)&&i.createElement("span",{className:"error-span"},Q==null?void 0:Q.cvv)))),i.createElement("div",{className:"form-group-frac"},i.createElement("label",{htmlFor:"zip"},"ZIP"),i.createElement("input",{type:"text",className:"form-control-frac",maxLength:100,placeholder:"000000",value:(mt=h==null?void 0:h.zipCode)!=null?mt:"",onChange:r=>We("zipCode",r.target.value)}),(Q==null?void 0:Q.zipCode)&&i.createElement("span",{className:"error-span"},Q==null?void 0:Q.zipCode)),O&&i.createElement("div",{className:"form-group-frac"},i.createElement("div",{className:"frac-tooltip-mn",style:{display:"flex",alignItems:"center",gap:"10px",paddingTop:"10px"}},i.createElement("input",{type:"checkbox",id:"save_card",className:"toggle-checkbox",checked:Ne,onChange:r=>xt(r.target.checked)}),i.createElement("label",{htmlFor:"save_card",className:"toggle-label"}),i.createElement("label",{htmlFor:"save_card"},"Save card for future payments "),i.createElement("div",{className:"frac-tooltip-wrapper"},i.createElement("div",{className:"frac-tooltip-icon"},i.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},i.createElement("circle",{cx:"10",cy:"10",r:"10",fill:"#E0DFE2"}),i.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"}))),i.createElement("div",{className:"frac-tooltip-text"},i.createElement("p",null,"If checked, I agree to give the ",i.createElement("b",null,Be||"merchant")," permission to charge this credit card for agreed-upon purchases in the future.")))))),i.createElement("div",{className:"form-group-frac",style:{marginTop:"20px",padding:"0"}},i.createElement("button",{type:"submit",style:{margin:0},className:"pay-button"},on((Ot=Number(e))==null?void 0:Ot.toFixed(2)))))),i.createElement("div",{id:"ach",style:{display:n==="ach"?"block":"none"},className:"tabcontent"},i.createElement(i.Fragment,null,i.createElement("div",{className:"frac-heading-card-wrap"},i.createElement("div",{className:"frac-backarrow"},(ce==null?void 0:ce.length)>0&&st==="form"&&i.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>ve("list")}," ",i.createElement(On,null))),i.createElement("h6",{className:"frac-card-payment-heading"},"Bank Payment")),st==="list"&&(ce==null?void 0:ce.length)>0?i.createElement(i.Fragment,null,i.createElement(ln,{headingClass:"card-ach-heading-frac",listHeading:"Banks",ListItems:ce,selectedCard:De,setSelectedCard:ft,handleDeleteCard:Kt,otherButtonLabel:"Pay With Other Bank",otherButtonAction:()=>{ve("form")}}),i.createElement("div",{className:"form-group-frac",style:{padding:"0"}},i.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:St},on((nn=Number(ot))==null?void 0:nn.toFixed(2))))):i.createElement("form",{id:"ACHPaymentForm",style:{textAlign:"start"},onSubmit:_t},i.createElement("div",{className:"ach-scrl",style:{minHeight:"444px",maxHeight:"444px"}},i.createElement("div",{className:"form-group-frac mb-4"},i.createElement("label",{htmlFor:"nameonaccount"},"Name on account"),i.createElement("input",{type:"text",id:"nameonaccount",className:"form-control-frac",maxLength:100,placeholder:"John Doe",name:"name",value:(F=c==null?void 0:c.name)!=null?F:"",onChange:Re}),(V==null?void 0:V.name)&&i.createElement("span",{className:"error-span"},V==null?void 0:V.name)),i.createElement("div",{className:"form-group-frac mb-4"},i.createElement("label",{htmlFor:"routingnumber"},"Routing number"),i.createElement("input",{type:"text",id:"routingnumber",className:"form-control-frac",maxLength:9,placeholder:"000000000",name:"routingNumber",value:(d=c==null?void 0:c.routingNumber)!=null?d:"",onChange:Re}),(V==null?void 0:V.routingNumber)&&i.createElement("span",{className:"error-span"},V==null?void 0:V.routingNumber)),i.createElement("div",{className:"form-group-frac mb-4"},i.createElement("label",{htmlFor:"accountnumber"},"Account number"),i.createElement("input",{type:"text",id:"accountnumber",className:"form-control-frac",maxLength:16,placeholder:"0000000000",name:"accountNumber",value:(j=c==null?void 0:c.accountNumber)!=null?j:"",onChange:Re}),(V==null?void 0:V.accountNumber)&&i.createElement("span",{className:"error-span"},V==null?void 0:V.accountNumber)),i.createElement("div",{className:"form-group-frac mb-4"},i.createElement("label",{htmlFor:"confirmaccountnumber"},"Confirm account number"),i.createElement("input",{type:"text",id:"confirmaccountnumber",className:"form-control-frac",maxLength:16,placeholder:"0000000000",name:"confirmAccountNumber",value:(ke=c==null?void 0:c.confirmAccountNumber)!=null?ke:"",onChange:Re}),(V==null?void 0:V.confirmAccountNumber)&&i.createElement("span",{className:"error-span"},V==null?void 0:V.confirmAccountNumber)),i.createElement("div",{className:"form-group-frac mb-4"},i.createElement("label",{htmlFor:"bankname"},"Bank name"),i.createElement("input",{type:"text",id:"bankname",className:"form-control-frac",maxLength:100,placeholder:"My Bank",name:"bankName",value:(ee=c==null?void 0:c.bankName)!=null?ee:"",onChange:Re}),(V==null?void 0:V.bankName)&&i.createElement("span",{className:"error-span"},V==null?void 0:V.bankName)),((c==null?void 0:c.accountType)==="business saving"||(c==null?void 0:c.accountType)==="business checking")&&i.createElement("div",{className:"form-group-frac mb-4"},i.createElement("label",{htmlFor:"companyName"},"Company name"),i.createElement("input",{type:"text",id:"companyName",className:"form-control",maxLength:100,placeholder:"My Company",name:"companyName",value:(Ve=c==null?void 0:c.companyName)!=null?Ve:"",onChange:Re}),(V==null?void 0:V.companyName)&&i.createElement("span",{className:"error-span"},V==null?void 0:V.companyName)),i.createElement("div",{className:"form-group-frac mb-4"},i.createElement("label",{htmlFor:"accounttype"},"Select account type"),i.createElement("select",{name:"accountType",id:"accounttype",className:"form-control-frac",value:(ge=c==null?void 0:c.accountType)!=null?ge:"",onChange:Re},i.createElement("option",{value:""},"Select account"),Fn.map(r=>i.createElement("option",{key:r.value,value:r.value},r.label)))),O&&i.createElement("div",{className:"form-group-frac mb-4 save-ach-div",style:{paddingTop:"5px"}},i.createElement("input",{type:"checkbox",id:"saveACH",className:"",maxLength:100,placeholder:"My Bank",checked:y,onChange:r=>qe(r.target.checked)}),i.createElement("label",{className:"saveachlabel",htmlFor:"saveACH"},"Save ACH")),y&&i.createElement("div",{className:"form-group-frac mb-4 saveachtext"},i.createElement("p",null,"If checked, I agree to give the ",i.createElement("b",null,Be||"merchant")," permission to charge this bank account for agreed-upon purchases in the future."))),i.createElement("div",{className:"form-group-frac "},i.createElement("button",{className:"pay-button",style:{margin:"20px 0 0"},type:"submit"},on((Me=Number(ot))==null?void 0:Me.toFixed(2))))))))))))))))};export{Ei as AddCard,Wi as CardOnFile,$i as GetPaymentPage,Xi as PaymentWidget,Yi as PreAuthPayment,vi as RequestPayment,ki as RequestPreAuthPayment};
|