1import{_ as S}from"./UUeMfES3.js";import{_ as E}from"./DiOu9IcE.js";import{u as B}from"./D3kQEEZ2.js";import{u as M}from"./BO8uTh1f.js";import{L as $}from"./DNRlwzMC.js";import{e as z,r as a,G as A,q as L,c as p,a as t,l as Y,b as _,z as j,j as o,t as q,w as D,o as f,d as F}from"./DISDuky7.js";import"./MR_7Oyn8.js";import"./C2J25oLi.js";import"./BAgu7smg.js";import"./C5MtcGO_.js";import"./CNnhEClc.js";import"./DOHbS119.js";import"./CQ1i4-_z.js";import"./Bvs4t5bG.js";import"./Bx2EM-6T.js";import"./CgHzJb3y.js";const G={class:"space-y-4"},R={class:"grid grid-cols-2 gap-4"},T={key:0,class:"text-red-500 text-sm mt-2"},U={key:0,class:"flex items-center gap-2"},H={key:1},ie=z({__name:"StripeCardForm",props:{invoice:{}},emits:["success","ready"],async setup(h,{emit:w}){let d,x;const k=w,v=h,l=a(""),n=a(!1),b=a(""),r=a("");let i;const u={number:a(),expiry:a(),cvc:a()},{axios:N}=M(),C=([d,x]=A(()=>B()),d=await d,x(),d);L(async()=>{const s=`/ticket/onward/invoice/${v.invoice._id}/stripe/payment`;b.value=await N.post(s).then(m=>m.data.client_secret),k("ready",b.value);const e=C.elements(),c={base:{fontSize:"16px",color:"#424770","::placeholder":{color:"#aab7c4"}},invalid:{color:"#9e2146"}};i={number:e.create("cardNumber",{style:c}
1),expiry:e.create("cardExpiry",{style:c}),cvc:e.create("cardCvc",{style:c})};for(const m in i){const y=m;i[y].mount(u[y].value),i[y].on("change",P=>{var g;return r.value=((g=P.error)==null?void 0:g.message)||""})}});const V=async()=>{if(!l.value.trim())return r.value="Please enter cardholder name";if(!n.value)return r.value="",n.value=!0,await C.confirmCardPayment(b.value,{payment_method:{card:i.number,billing_details:{name:l.value.trim(),email:v.invoice.ticket.contact.email,phone:v.invoice.ticket.contact.phone}}}).then(({paymentIntent:s,error:e})=>{if(e)throw e;s.status==="succeeded"&&k("success",s)}).catch(s=>r.value=s.message||"Payment failed").finally(()=>n.value=!1)};return(s,e)=>{const c=S;return f(),p("div",G,[t("div",null,[e[1]||(e[1]=t("label",{class:"block text-sm font-medium mb-2"},"Card Number",-1)),t("div",{ref:u.number,class:"p-3 border rounded-md"},null,512)]),t("div",R,[t("div",null,[e[2]||(e[2]=t("label",{class:"block text-sm font-medium mb-2"},"Expiration (MM/YY)",-1)),t("div",{ref:u.expiry,class:"p-3 border rounded-md"},null,512)]),t("div",null,[e[3]||(e[3]=t("label",{class:"block text-sm font-medium mb-2"},"CVV",-1)),t("div",{ref:u.cvc,class:"p-3 border rounded-md"},null,512)])]),t("div",null,[e[4]||(e[4]=t("label",{class:"block text-sm font-medium mb-2"},"Cardholder Name",-1)),_(c,{class:"w-full",modelValue:o(l),"onUpdate:modelValue":e[0]||(e[0]=m=>j(l)?l.value=m:null),placeholder:"Enter cardholder name"},null,8,["modelValue"])]),o(r)?(f(),p("div",T,q(o(r)),1)):Y("",!0),_(o(E),{class:"w-full",onClick:V,disabled:o(n)},{default:D(()=>[o(n)?(f(),p("span",U,[e[5]||(e[5]=F(" Processing... ")),_(o($),{class:"animate-spin"})])):(f(),p("span",H,"Pay Now"))]),_:1},8,["disabled"])])}}});export{ie as default};
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.