PageSourceSearch

https://athotel.com/assets/PaymentCallback-DDDg68lG.js

js athotel.com collected 2026-09-24 13:23:44 UTC 10,733 bytes, 1 lines download raw bytes

1import{ah as G,s as P,ai as re,t as ne,Q as oe,e as w,aj as q,ak as ie,v as le}from"./main-CUAAkQlC.js";import{E as H}from"./Error-CYlmz8a-.js";import{t as k,m as I,C as g}from"./checkoutAnalytics-BLv-hl_3.js";import{s as h}from"./socket-CPbjoDPp.js";import{g as ce,i as ue}from"./payment-CUIxa6li.js";import{d as de,r as f,w as me,c as ye,o as pe,b as he,z as n,C as r,f as W,E as c,u as d,O as p,F as D,W as _e,S as $,D as fe,A as o}from"./vendor-primevue-DReEbYQh.js";import{u as ve}from"./vendor-i18n-MtGSQ0mY.js";import"./vendor-fontawesome-EK1pxXkY.js";import"./vendor-luxon-D-syak89.js";import"./vendor-pako-DwGzBETv.js";import"./vendor-posthog-B2YXpdD_.js";import"./vendor-query-Bu7BIdVG.js";import"./vendor-socket-YTJ-CyAn.js";const ke={key:0},ge={class:"error-container"},be={key:1,class:"confirming-container"},Ce={key:0,class:"payment-callback__pending"},Pe={key:0,class:"payment-callback__card"},qe={key:0,class:"payment-callback__hotel"},Ie={key:0,class:"payment-callback__hotel-media"},Ee=["src","alt"],Ae={class:"payment-callback__hotel-copy"},Te={key:0,class:"payment-callback__rating","aria-hidden":"true"},Le={key:1},Se={key:1,class:"payment-callback__divider"},Me={class:"payment-callback__details-title"},we={class:"payment-callback__details"},De={key:0},Ne={key:1},Re={key:2},Fe={class:"payment-callback__actions"},Be={class:"loading-heading"},Ue={class:"loading-message"},Ye={class:"container"},Ve={key:0,class:"pi pi-spin pi-spinner",style:{"font-size":"4rem",color:"gray"}},xe={key:1,class:"pi pi-check-circle",style:{"font-size":"4rem",color:"green"}},Oe={key:2,class:"pi pi-times-circle",style:{"font-size":"4rem",color:"red"}},je=de({__name:"PaymentCallback",setup(Ke){const E=ne(),e=oe();let U;const T=f([]),N=f(!1),b=f(!0),L=f(!1),Y=e.query.provider==="grab"?15e3:e.query.payment_intent_client_secret?12e4:9e4,R=f(0);let F=null;const S=f(!1),u=f(null),J=async()=>{const t=e.query.hotelId;if(!(!t||u.value))try{u.value=await ie({hotelId:t})}catch{}};me(S,t=>{t&&J()},{immediate:!0});const i=ye(()=>{const t=e.query.checkin,a=e.query.checkout;let m=null,l=0;if(t&&a){const ae=new Date(t),se=new Date(a);l=Math.round((se.getTime()-ae.getTime())/(1e3*60*60*24)),Number.isFinite(l)&&l>0?m=`${G(t,V.value)} – ${G(a,V.value)}`:m=null}const y=Number(e.query.adults)||0,_=Number(e.query.children)||0,ee=Number(e.query.rooms)||0,te=e.query.email||P.guest?.email||"";return{dates:m,nights:l,adults:y,children:_,rooms:ee,email:te}}),{t:s,locale:V}=ve(),A=f(s("paymentCallback.errorTitle")),C=f(s("paymentCallback.errorMessage")),Q={prebookId:e.query.prebookId,hotelId:e.query.hotelId,checkin:e.query.checkin,checkout:e.query.checkout,rooms:e.query.rooms,adults:e.query.adults,occupancies:e.query.occupancies,children:e.query.children},v=()=>({prebookId:e.query.prebookId,hotelId:e.query.hotelId,paymentProvider:e.query.paymentProvider||"stripe"}),M=()=>{h.off("payment:check-status:info",O),h.off("payment:check-status:error",j)},B=()=>{h.off("hotels:fetch-rates:rate",K),h.off("hotels:fetch-rates:error",z)},X=async()=>{const t=e.query.redirect_status;if(t==="failed")return k(g.PAYMENT_CALLBACK_VERIFY_FAILED,I(v(),{reason:"redirect_status_failed",redirectStatus:t})),A.value=s("paymentCallback.stripePaymentIncompleteTitle","Payment not completed"),C.value=s("paymentCallback.stripePaymentIncomplete","Your card payment did not finish successfully. Please try again or use another card."),!1;const a=e.query.payment_intent_client_secret;if(typeof a=="string"&&a.includes("_secret_")){const m=typeof e.query.stripePk=="string"&&e.query.stripePk.trim()?e.query.stripePk.trim():void 0;try{const l=await ce(m),{error:y,paymentIntent:_}=await l.retrievePaymentIntent(a);if(y||!_)return k(g.PAYMENT_CALLBACK_VERIFY_FAILED,I(v(),{reason:"retrieve_payment_intent_failed",stripeError:y?.message})),A.value=s("paymentCallback.stripeVerifyFailedTitle","Could not verify payment"),C.value=s("paymentCallback.stripeVerifyFailed","We could not confirm your payment with the card provider. Please try again."),!1;if(!ue(_.status))return k(g.PAYMENT_CALLBACK_VERIFY_FAILED,I(v(),{reason:"payment_intent_incomplete",paymentIntentStatus:_.status})),A.value=s("paymentCallback.stripePaymentIncompleteTitle","Payment not completed"),C.value=s("paymentCallback.stripePaymentIncomplete","Your card payment did not finish successfully. Please try again or use another card."),!1}catch(l){return k(g.PAYMENT_CALLBACK_VERIFY_FAILED,I(v(),{reason:"retrieve_payment_intent_exception",errorMessage:l instanceof H?l.message:"unknown"})),A.value=s("paymentCallback.stripeVerifyFailedTitle","Could not verify payment"),C.value=s("paymentCallback.stripeVerifyFailed","We could not confirm your payment with the card provider. Please try again."),!1}}return!0},x=()=>{const t=!!e.query.datatransTrxId,a={requestId:U,prebookId:e.query.prebookId,domain:w.project.domain,currency:P.currency,userLocale:w.geo?.country||P.locale||"en-US"};t&&(a.datatransTrxId=e.query.datatransTrxId),e.query.paymentStatus&&(a.paymentStatus=e.query.paymentStatus),e.query.method&&(a.method=e.query.method),e.query.paymentMethod&&(a.paymentMethod=e.query.paymentMethod),e.query.paymentProvider?a.paymentProvider=e.query.paymentProvider:e.query.provider&&(a.paymentProvider=e.query.provider),!a.paymentStatus&&e.query.status&&(a.paymentStatus=e.query.status),e.query.previousPaymentMethod&&(a.previousPaymentMethod=e.query.previousPaymentMethod),e.query.previousPaymentProvider&&(a.previousPaymentProvider=e.query.previousPaymentProvider),h.emit("payment:check-status",a)},Z=async()=>{const t=e.query.city;t&&(T.value=[],h.emit("hotels:fetch-rates",{requestId:"similar",pool:"similar",checkin:q.checkin,checkout:q.checkout,rooms:q.rooms,adults:q.adults,children:q.children,currency:P.currency,guestNationality:P.guestNationality,domain:w.project.domain,timeout:3,occupancies:q.occupancies,city:t,isGuestUser:P.isGuestUser}))},O=t=>{if(t.status==="pending"){R.value+=1,F===null&&(F=Date.now());const a=Date.now()-F;if(a>=Y){k(g.PAYMENT_CALLBACK_PENDING_TIMEOUT,I(v(),{pendingPollCount:R.value,pendingElapsedMs:a,timeoutMs:Y})),M(),B(),b.value=!1,S.value=!0;return}b.value=!0,setTimeout(()=>x(),1e3);return}M(),B(),b.value=!1,S.value=!1,k(g.PAYMENT_CALLBACK_CONFIRMED,{...v(),wl_booking_id:t.bookingId,status:t.status}),setTimeout(()=>{if(e.query.fromDashboard==="true"){E.push({name:"dashboard",query:{fromDashboard:"true",prebookId:e.query.prebookId,bookingId:t.bookingId,status:t.status,email:e.query.email||P.guest?.email||""}});return}const m=w.project?.settings?.confirmationConfig;if(m?.redirectUrl&&!m?.autoCloseSeconds){const l=m.redirectUrl;if(!l.startsWith("https://")&&!l.startsWith("http://")){console.warn("Invalid redirect URL format:",l),E.push({name:"confirmation",params:{id:t.bookingId}});return}try{const y=new URL(l,window.location.origin);y.searchParams.set("bookingId",t.bookingId),y.searchParams.set("status",t.status),Object.keys(e.query).forEac
1h(_=>{e.query[_]&&y.searchParams.set(_,e.query[_])}),window.location.href=y.toString()}catch(y){console.error("Error building redirect URL:",y),E.push({name:"confirmation",params:{id:t.bookingId}})}}else E.push({name:"confirmation",params:{id:t.bookingId}})},1e3)},j=t=>{L.value=!0,b.value=!1,M(),k(g.PAYMENT_CALLBACK_FAILED,{...v(),wl_booking_id:t.bookingId,status:t.status,errorMessage:t.message,pendingPollCount:R.value}),console.error("[payment:check-status:error]",t.message??"Payment failed",t),t.errorDetails&&Object.keys(t.errorDetails).length>0?(console.error("[payment:check-status:error] errorDetails (webhook/provider):",t.errorDetails),C.value=[t.message,JSON.stringify(t.errorDetails)].filter(Boolean).join(" — ")):t.message&&(C.value=t.message),h.on("hotels:fetch-rates:rate",K),h.on("hotels:fetch-rates:error",z),N.value=!0,Z()};pe(async()=>{if(U=Math.random().toString(36).substring(7),b.value=!0,!await X()){b.value=!1,L.value=!0;return}k(g.PAYMENT_CALLBACK_STARTED,I(v(),{hasStripeReturnParams:!!e.query.payment_intent_client_secret,redirectStatus:e.query.redirect_status,provider:e.query.provider})),x(),h.on("payment:check-status:info",O),h.on("payment:check-status:error",j)});const K=t=>{t.requestId==="similar"&&(Array.isArray(t.result)&&t.result.forEach(a=>{!a||T.value.find(l=>l.id===a.id)||T.value.push(a)}),N.value=!1)};function z(t){t.requestId==="similar"&&(T.value=[],N.value=!1)}return he(()=>{M(),B()}),(t,a)=>L.value?(o(),n("div",ke,[r("div",ge,[W(H,{errorType:"Booking",title:A.value,message:C.value,paymentInformation:Q,class:"pt-1 pb-3 w-full md:w-6 mx-auto"},null,8,["title","message"])])])):(o(),n("div",be,[S.value?(o(),n("div",Ce,[W(re,{name:"success-badge",width:64,height:64}),r("h2",null,c(d(s)("paymentCallback.pendingTimeoutTitle")),1),r("p",null,c(i.value.email?d(s)("paymentCallback.confirmationEmailPending",{email:i.value.email}):d(s)("paymentCallback.pendingTimeoutMessage")),1),u.value||i.value.dates||i.value.adults?(o(),n("div",Pe,[u.value?(o(),n("div",qe,[u.value.main_photo||u.value.thumbnail?(o(),n("div",Ie,[r("img",{src:u.value.main_photo||u.value.thumbnail,alt:u.value.name,loading:"lazy"},null,8,Ee)])):p("",!0),r("div",Ae,[u.value.stars?(o(),n("div",Te,[(o(),n(D,null,_e(5,m=>r("i",{key:m,class:fe(["pi pi-star-fill",{"payment-callback__rating-star--muted":m>Math.round(u.value.stars)}])},null,2)),64))])):p("",!0),r("h3",null,c(u.value.name),1),u.value.address?(o(),n("p",Le,c(u.value.address),1)):p("",!0)])])):p("",!0),u.value&&(i.value.dates||i.value.adults)?(o(),n("div",Se)):p("",!0),i.value.dates||i.value.adults?(o(),n(D,{key:2},[r("h3",Me,c(d(s)("paymentCallback.detailsTitle")),1),r("dl",we,[i.value.dates?(o(),n("div",De,[r("dt",null,c(d(s)("paymentCallback.datesLabel")),1),r("dd",null,c(i.value.dates)+" ("+c(d(s)("paymentCallback.nightsCount",i.value.nights))+") ",1)])):p("",!0),i.value.adults?(o(),n("div",Ne,[r("dt",null,c(d(s)("paymentCallback.guestsLabel")),1),r("dd",null,[$(c(d(s)("paymentCallback.adultsCount",i.value.adults)),1),i.value.children?(o(),n(D,{key:0},[$(" , "+c(d(s)("paymentCallback.childrenCount",i.value.children)),1)],64)):p("",!0)])])):p("",!0),i.value.rooms?(o(),n("div",Re,[r("dt",null,c(d(s)("paymentCallback.roomsLabel")),1),r("dd",null,c(d(s)("paymentCallback.roomsCount",i.value.rooms)),1)])):p("",!0)])],64)):p("",!0)])):p("",!0),r("div",Fe,[r("button",{type:"button",onClick:a[0]||(a[0]=m=>d(E).push({name:"home"}))},c(d(s)("paymentCallback.searchHotels")),1)])])):(o(),n(D,{key:1},[r("h2",Be,c(d(s)("paymentCallback.confirmingBooking")),1),r("p",Ue,c(d(s)("paymentCallback.dontCloseBrowser")),1),r("div",Ye,[b.value?(o(),n("i",Ve)):L.value?(o(),n("i",Oe)):(o(),n("i",xe))])],64))]))}}),ot=le(je,[["__scopeId","data-v-4cb1bf15"],["__file","PaymentCallback.vue"]]);export{ot 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.