1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="01a0fd72-2dfd-7713-9e91-690a2b8f71bd")}catch(e){}}();(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[306],{7066:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/checkout/callback",function(){return s(81920)}])},81920:function(e,t,s){"use strict";s.r(t),s.d(t,{__N_SSP:function(){return h},default:function(){return f}});var r=s(31549),n=s(44194),a=s(63552),i=s(67418),c=s(84742),o=s(37486),l=s(39355),u=s(34441),m=s(6829),d=s(9211),g=s(64864),y=s(10904);async function p(e,t,s){if(!e)return{tag:"error",message:"No payment session found"};let r=(0,g.yO)(t);if(!r)return{tag:"error",message:"Stripe not configured"};try{let t=await (0,a.J)(r);if(!t)return{tag:"error",message:"Failed to load Stripe"};let n=await t.retrievePaymentIntent(e);if(n.error)return{tag:"stripe_error",error:n.error};let i=e.split("_secret_")[0],c=null;try{let e=await (0,u.po)(async e=>{let{client:t,authBearerToken:s}=e;return t.request(l.Ps` 2 query PaymentMethodByPaymentIntent($paymentIntentId: String!) { 3 paymentMethodByPaymentIntent(paymentIntentId: $paymentIntentId) 4 } 5 `,{paymentIntentId:i},{Authorization:s})});c=e.paymentMethodByPaymentIntent||null}catch(e){console.error("Failed to fetch payment method type:",e)}switch(n.paymentIntent.status){case"succeeded":return{tag:"success",intent:n.paymentIntent};case"processing":return{tag:"processing",paymentMethodType:c};case"requires_action":if("succeeded"===s)return{tag:"processing",paymentMethodType:c};return{tag:"error",message:`Payment ${n.paymentIntent.status}`};default:return{tag:"error",message:`Payment ${n.paymentIntent.status}`}}}catch(e){return{tag:"error",message:e.message||"Unknown error"}}}var h=!0;function f(){let e=(0,o.useRouter)(),{t}=(0,c.$G)("payment"),[s,a]=(0,n.useState)(!1),{confirmPaymentAsync:l}=(0,y.k$)(),u=e.query.payment_intent_client_secret||null,h=e.query.redirect_status,f=(0,g.$G)(e.query.entity),{data:x}=(0,i.a)({queryKey:["paymentStatus",u,f],queryFn:()=>p(u,f,h),enabled:!!u,refetchOnWindowFocus:!1});return((0,n.useEffect)(()=>{if(!x||s)return;let r=async s=>{try{await l(s);let r=sessionStorage.getItem("booking_request_id");sessionStorage.removeItem("stripe_client_secret"),sessionStorage.removeItem("stripe_platform_entity"),sessionStorage.removeItem("booking_space_id"),sessionStorage.removeItem("booking_request_id"),m.C.success(t("successful.title","Payment successful!")),setTimeout(()=>{r?e.push(`/account/requests/${r}`):e.push("/account/requests")},1500)}catch(e){console.error("Failed to confirm payment:",e),m.C.error(e.message||"Failed to confirm payment")}};"success"===x.tag?(a(!0),r(x.intent.id)):"stripe_error"===x.tag?m.C.error(x.error.message||"Payment failed"):"error"===x.tag&&m.C.error(x.message||"Payment failed")},[x,s,l,e,t]),x&&"loading"!==x.tag)?"processing"===x.tag?(0,r.jsx)("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:(0,r.jsx)("div",{className:"max-w-md p-8 bg-white rounded-lg shadow-sm",children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 mb-4 bg-yellow-100 rounded-full",children:(0,r.jsx)("svg",{className:"w-8 h-8 text-yellow-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})})}),(0,r.jsx)("h2",{className:"text-2xl font-semibold text-gray-900 mb-2",children:t("customer_balance"===x.paymentMethodType?"processing.bank_transfer.title":"processing.title","customer_balance"===x.paymentMethodType?"Awaiting Payment":"Payment Processing")}),(0,r.jsx)("p",{className:"text-gray-600 mb-4",children:t((()=>{switch(x.paymentMethodType){case"customer_balance":return"processing.bank_transfer.description";case"sepa_debit":return"processing.sepa.description";
5case"us_bank_account":return"processing.us_bank_account.description";case"card":return"processing.card.description";default:return"processing.default.description"}})(),(()=>{switch(x.paymentMethodType){case"customer_balance":return"Please complete your bank transfer. Your booking is reserved and will be confirmed when we receive the funds. This typically takes 1-5 business days.";case"sepa_debit":return"Your SEPA payment is being processed. This may take 1-14 business days. You will receive a confirmation email once completed.";case"us_bank_account":return"Your bank payment is being processed. This may take 1-14 business days. You will receive a confirmation email once completed.";case"card":return"Your card payment is being processed. This should complete within moments.";default:return"Your payment is being processed. You will receive a confirmation email once completed."}})())}),(0,r.jsx)("button",{onClick:()=>e.push("/account/requests"),className:"btn btn-primary",children:t("processing.viewBookings","View My Bookings")})]})})}):"success"===x.tag?(0,r.jsx)("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:(0,r.jsx)("div",{className:"max-w-md p-8 bg-white rounded-lg shadow-sm",children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 mb-4 bg-green-100 rounded-full",children:(0,r.jsx)("svg",{className:"w-8 h-8 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),(0,r.jsx)("h2",{className:"text-2xl font-semibold text-gray-900 mb-2",children:t("successful.title","Payment Successful!")}),(0,r.jsx)("p",{className:"text-gray-600 mb-4",children:t("successful.description","Your payment has been processed successfully. Redirecting...")})]})})}):(0,r.jsx)("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:(0,r.jsx)("div",{className:"max-w-md p-8 bg-white rounded-lg shadow-sm",children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 mb-4 bg-red-100 rounded-full",children:(0,r.jsx)("svg",{className:"w-8 h-8 text-red-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),(0,r.jsx)("h2",{className:"text-2xl font-semibold text-gray-900 mb-2",children:t("error.title","Payment Failed")}),(0,r.jsx)("p",{className:"text-gray-600 mb-4",children:"stripe_error"===x.tag?x.error.message:"error"===x.tag?x.message:t("error.unknown","An unknown error occurred")}),(0,r.jsx)("button",{onClick:()=>{let t=sessionStorage.getItem("booking_request_id");t?e.push(d._.requests.checkout({id:t})):e.push(d._.requests.list())},className:"btn btn-primary",children:t("error.tryAgain","Try Again")})]})})}):(0,r.jsx)("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 mb-4",children:(0,r.jsxs)("svg",{className:"animate-spin h-8 w-8 text-gray-600",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}),(0,r.jsx)("p",{className:"text-gray-600",children:t("loading","Verifying payment...")})]})})}}},function(e){e.O(0,[9774,2888,179],function(){return e(e.s=7066)}),_N_E=e.O()}]); 6//# chunkId=01a0fd72-2dfd-7713-9e91-690a2b8f71bd
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.