1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2999],{68799:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/payment/card/[invoiceNumber]",function(){return a(71322)}])},76864:function(e,t,a){"use strict";a.d(t,{Z:function(){return d}});var s=a(36734),n=a(51776),r=a(42152),l=a(78888),i=a(25514),c=a(28757);function d(e){let{open:t,setOpen:a,message:d}=e,{t:o}=(0,c.Z)("common");return(0,s.jsx)(r.u.Root,{show:t,as:n.Fragment,children:(0,s.jsxs)(l.V,{as:"div",className:"relative z-10",onClose:a,children:[(0,s.jsx)(r.u.Child,{as:n.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)("div",{className:"fixed inset-0 transition-opacity bg-gray-500 bg-opacity-75"})}),(0,s.jsx)("div",{className:"fixed inset-0 z-10 overflow-y-auto",children:(0,s.jsx)("div",{className:"flex items-end justify-center min-h-full p-4 text-center sm:items-center sm:p-0",children:(0,s.jsx)(r.u.Child,{as:n.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:(0,s.jsxs)(l.V.Panel,{className:"relative px-4 pt-5 pb-4 overflow-hidden text-left transition-all transform bg-white rounded-lg shadow-xl sm:my-8 sm:w-full sm:max-w-sm sm:p-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"flex items-center justify-center w-12 h-12 mx-auto bg-red-100 rounded-full",children:(0,s.jsx)(i.Z,{className:"w-6 h-6 text-red-600","aria-hidden":"true"})}),(0,s.jsxs)("div",{className:"mt-3 text-center sm:mt-5",children:[(0,s.jsx)(l.V.Title,{as:"h3",className:"text-base font-semibold leading-6 text-gray-900",children:o("Failed to Generate Payment")}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)("p",{className:"text-sm text-gray-500",children:d})})]})]}),(0,s.jsx)("div",{className:"mt-5 sm:mt-6",children:(0,s.jsx)("button",{type:"button",className:"inline-flex justify-center w-full px-3 py-2 text-sm font-semibold text-white bg-red-600 rounded-md shadow-sm hover:bg-red-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-600",onClick:()=>a(!1),children:o("Close")})})]})})})})]})})}},71322:function(e,t,a){"use strict";a.r(t),a.d(t,{__N_SSP:function(){return b},default:function(){return y}});var s=a(36734),n=a(18775),r=a(77194),l=a(86084),i=a(76864),c=a(5390),d=a(67832),o=a.n(d),m=a(33906),u=a(51776),x=a(32292),h=a(28757),f=a(24180),p=a(68837),v=a(78389),g=a(71918),b=!0;function y(e){let{payment:t,auth:a}=e,d=(0,m.useRouter)(),[b,y]=(0,u.useState)(),[j,N]=(0,u.useState)(),[w,_]=(0,u.useState)(),[C,E]=(0,u.useState)(),[P,k]=(0,u.useState)(!1),[S,I]=(0,u.useState)("MM"),[T,M]=(0,u.useState)("YYYY"),[Z,F]=(0,u.useState)(""),[O,V]=(0,u.useState)(""),[D,Y]=(0,u.useState)(!1),[L,R]=(0,u.useState)(""),{t:U}=(0,h.Z)("common"),{control:z,formState:{errors:A}}=(0,f.cI)({}),B=e=>{let t=e.target.value;t>12||t<0?F(U("Month must be between 1 and 12")):(F(""),I(t))},Q=e=>{let t=e.target.value;t<23?(V(U("Year must over 23")),M(t)):(V(""),M(t))},W=async()=>{try{let e=function(e,t,a,s,n){let r=e.padStart(2,"0");return{amount:null==a?void 0:a.totalPayment,card_number:s,card_exp_month:r,card_exp_year:"20"+t,card_cvn:n,is_multiple_use:!1,should_authenticate:!0}}((0,v.WU)(S,"MM"),T,t,j,w);x.setPublishableKey("xnd_public_production_N9xET1Qy1cAPoaCIus6AQEm5IkVNMBUjxM1HDUzMBw0RVc7lgiHOLpWz"),x.card.createToken(e,q)}catch(e){e instanceof Error||alert(U("Unknown error occurred"))}};function q(e,t){if(!e)switch(t.status){case U("APPROVED"):case U("VERIFIED"):break;case U("FAILED"):alert(JSON.stringify(t));break;case U("IN_REVIEW"):y(t),k(!0);break;default:alert(U("Unknown token status"))}}return(0,u.useEffect)(()=>{window.addEventListener("message",e=>{if(!0==P&&"https://redirect.xendit.co"==e.origin){let t=JSON.parse(e.data);E(t)}})},[P]),(0,u.useEffect)(()=>{(async function(){if(null!=C){let s=.04*t.totalPayment,n=t.totalPayment+s,r={token_id:C.id,authentication_id:C.authentication_id,external_id:null==t?void 0:t.invoiceNumber,amount:n};try{var e;let s=new c.Z;s.url="xendit/card",s.mode="service",s.body=r;let n=await s.call();if(n.errors){R(U("There was an error when trying to generate payment")),Y(!0);return}let l=new c.Z;l.url="v1/order/payment",l.auth=!0,l.token="Bearer ".concat(a.access_token),l.mode="crm",l.body={invoiceNumber:null==t?void 0:t.invoiceNumber,paymentType:"OP",paymentChannel:"CC",paymentMethod:null==n?void 0:null===(e=n.data)||void 0===e?void 0:e.charge_type,paymentDetails:null==n?void 0:n.data},await l.call()}catch(e){e instanceof Error?alert(e.message):alert("Unknown error occurred")}await d.push({pathname:"/detail/".concat(null==t?void 0:t.invoiceNumber)})}})()},[C]),(0,s.jsxs)(n.Z,{title:"Payment for Invoice ".concat(t.invoiceNumber),children:[(0,s.jsxs)("div",{className:"grid justify-center grid-cols-1 mx-2 my-10 lg:gap-5 lg:mx-0 lg::grid-cols-3 sm:justify-normal item-center",children:[(0,s.jsxs)("div",{className:"col-span-2 mb-2 ",children:[(0,s.jsxs)("div",{className:"border rounded-lg",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-8 px-4 py-8 border-b sm:px-8 ",children:[(0,s.jsx)("h1",{className:"text-xl font-bold",children:U("Credit/Debit Card")}),(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(o(),{src:"/img/payment/card/visa.svg",width:40,height:40,alt:"jcb.svg"}),(0,s.jsx)(o(),{src:"/img/payment/card/mastercard.svg",width:40,height:40,alt:"jcb.svg"}),(0,s.jsx)(o(),{src:"/img/payment/card/jcb.svg",width:40,height:40,alt:"jcb.svg"})]})]}),b?(0,s.jsx)("iframe",{onClick:()=>k(!0),id:"xendit-iframe",className:"w-[600px] h-[700px]",src:null==b?void 0:b.payer_authentication_url}):(0,s.jsxs)("div",{className:"flex flex-col gap-6 px-4 py-10 sm:px-8",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)("p",{children:U("Credit/Debit Card Number")}),(0,s.jsxs)("div",{className:"relative w-full",children:[(0,s.jsx)(f.Qr,{control:z,name:"creditCard",render:()=>(0,s.jsx)(g.Input,{maxLength:16,crossOrigin:"",placeholder:"0000 000 0000 0000",className:"rounded-md !border-t-blue-gray-200 focus:!border-t-gray-900",labelProps:{className:"before:content-none after:content-none"},containerProps:{className:"min-w-0"},onChange:e=>N(e.target.value),value:j}),rules:{required:"Credit card/debit card field are required",validate:{
1isCreditCard:e=>/^[0-9]+$/.test(e)||"Enter the credit card or debit card correctly"}}}),(null==A?void 0:A.creditCard)&&(0,s.jsx)("div",{className:"absolute top-0 flex items-center h-full right-3",children:(0,s.jsx)(g.Tooltip,{className:"bg-red-700",content:A.creditCard.message,placement:"left",children:(0,s.jsx)(p.Z,{className:"w-5 h-5 text-red-500"})})})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 ",children:[(0,s.jsx)("p",{children:U("Expiration Date (MM/YY)")}),(0,s.jsxs)("div",{className:"flex items-center gap-2 px-2 border border-gray-400 rounded-md",children:[(0,s.jsx)("div",{className:"flex w-32",children:(0,s.jsx)(g.Input,{size:"md",maxLength:2,className:"items-center w-full bg-red-500 border-none rounded-none",labelProps:{className:"before:content-none after:content-none w-full"},value:S,onChange:B})}),(0,s.jsx)("p",{className:"text-gray-500",children:"|"}),(0,s.jsx)("div",{className:"flex w-1/2",children:(0,s.jsx)(g.Input,{maxLength:4,className:"items-center w-full border-none rounded-none",labelProps:{className:"before:content-none after:content-none"},value:T,onChange:Q})})]}),Z&&(0,s.jsx)("div",{className:"text-sm text-red-500",children:Z}),O&&(0,s.jsx)("div",{className:"text-sm text-red-500",children:O})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)("p",{children:U("CVN")}),(0,s.jsx)("div",{className:"flex items-center gap-2 px-2 border border-gray-400 rounded-md",children:(0,s.jsx)(g.Input,{className:"flex items-center border-none rounded-none",labelProps:{className:"before:content-none after:content-none"},onChange:e=>_(e.target.value)})})]})]})]})]}),(0,s.jsx)("div",{className:"flex justify-end py-8",children:(0,s.jsx)("div",{onClick:()=>W(),className:"flex items-center px-4 py-2 font-semibold text-center text-white bg-red-500 rounded-md cursor-pointer hover:bg-red-300",children:U("Pay Now")})})]}),(0,s.jsxs)("div",{className:"w-full py-4 border rounded-md ",children:[(0,s.jsx)(r.Z,{payment:t}),(0,s.jsx)(l.Z,{payment:t})]})]}),(0,s.jsx)(i.Z,{open:D,setOpen:Y,message:L})]})}}},function(e){e.O(0,[509,4885,4838,4434,3365,3001,4741,4735,2246,8775,483,9774,2888,179],function(){return e(e.s=68799)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.