1import{r,j as e}from"./vendor-react-CV6oP_vj.js";import{c as y,b as f,C as b,a as g,f as p,B as j,g as N}from"./index-BBakkP5p.js";import{C as w}from"./circle-x-F03raywV.js";import{C}from"./credit-card-Dw950Ej_.js";import{P as k}from"./phone-cXJhzx4j.js";function L(){const t=y(),h=f(),n=new URLSearchParams(h).get("bookingId"),[c,l]=r.useState(!1),[m,x]=r.useState(!1),[i,d]=r.useState(!1),o=t.focusLocation!=="United Kingdom"?t.focusLocation:"";r.useEffect(()=>{document.title=o?`Complete Payment | ${o} Taxi | ${t.brandName}`:`Complete Payment | ${t.brandName}`;const a=o?`Complete your ${o} taxi booking payment. Pay securely with ${t.brandName}.`:`Complete your taxi booking payment. Pay securely with ${t.brandName}.`;let s=document.querySelector('meta[name="description"]');s||(s=document.createElement("meta"),s.setAttribute("name","description"),document.head.appendChild(s)),s.setAttribute("content",a)},[t.brandName,o]),r.useEffect(()=>{!n||m||c||(l(!0),fetch(`/api/bookings/${n}/payment-cancelled`,{method:"POST",headers:{"Content-Type":"application/json"}}).then(a=>a.json()).then(a=>{console.log("[Payment Cancelled] Booking sent to staff for follow-up:",a),x(!0)}).catch(a=>{console.error("[Payment Cancelled] Failed to notify staff:",a)}).finally(()=>l(!1)))},[n,m,c]);const u=async()=>{if(!(!n||i)){d(!0);try{const s=await(await N("POST",`/api/bookings/${n}/retry-payment`)).json();s.checkoutUrl&&(window.location.href=s.checkoutUrl)}catch(a){console.error("[Payment Retry] Failed:",a)}finally{d(!1)}}};return e.jsx("div",{className:"min-h-screen bg-black py-12","data-testid":"booking-cancel-page",children:e.jsxs("div",{className:"container mx-auto px-4 max-w-xl",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"w-20 h-20 rounded-full bg-red-500/20 flex items-center justify-center mx-auto mb-4",children:e.jsx(w,{className:"h-10 w-10 text-red-500"})}),e.jsx("h1",{className:"text-3xl md:text-4xl font-bold text-white mb-2",children:"Payment Not Completed"}),e.jsx("p",{className:"text-white/70 text-lg",children:"Your booking is reserved â please complete payment to confirm"})]}),e.jsx(b,{className:"bg-black border-2 border-primary/50 mb-6",children:e.jsx(g,{className:"pt-6",children:e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx("p",{className:"text-white/80",children:"Your booking has been received but payment was not completed. Please click below to complete your payment securely."}),c&&e.jsxs("div",{className:"flex items-center justify-center gap-2 text-primary",children:[e.jsx(p,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{className:"text-sm",children:"Processing..."})]}),e.jsx(j,{className:"bg-primary text-black w-full py-6 text-lg font-bold",onClick:u,disabled:i,"data-testid":"button-complete-payment",children:i?e.jsxs(e.Fragment,{children:[e.jsx(p,{className:"h-5 w-5 mr-2 animate-spin"}),"Redirecting to Payment..."]}):e.jsxs(e.Fragment,{children:[e.jsx(C,{className:"h-5 w-5 mr-2"}),"Complete Payment Now"]})}),e.jsx("p",{className:"text-white/50 text-sm",children:"You will be redirected to our secure payment page to complete your booking."})]})})}),e.jsx("div",{className:"text-center space-y-4",children:t.phone&&e.jsxs("p",{className:"text-white/60",children:["Need help? Call us on"," ",e.jsxs("a",{href:`tel:${t.phone.replace(/\s/g,"")}`,className:"text-primary font-semibold hover:underline inline-flex items-center gap-1",children:[e.jsx(k,{className:"h-4 w-4"}),t.phone]})]})})]})})}export{L 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.