"use strict";(()=>{var e={};e.id=8651,e.ids=[8651],e.modules={72934:e=>{e.exports=require("next/dist/client/components/action-async-storage.external.js")},54580:e=>{e.exports=require("next/dist/client/components/request-async-storage.external.js")},45869:e=>{e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},6005:e=>{e.exports=require("node:crypto")},11278:(e,t,n)=>{n.r(t),n.d(t,{originalPathname:()=>f,patchFetch:()=>h,requestAsyncStorage:()=>m,routeModule:()=>d,serverHooks:()=>x,staticGenerationAsyncStorage:()=>y});var s={};n.r(s),n.d(s,{GET:()=>l});var r=n(49303),a=n(88716),o=n(60670),i=n(87070),u=n(70446),c=n(19191),p=n(90455);async function l(e){let t=await (0,u.Gg)(),n=t.user?.id;if(!n||!t.authenticated)return i.NextResponse.json({error:"Unauthorized"},{status:401});let s=(0,p.LP)(t),r=e.nextUrl.searchParams.get("orderId");if(!r)return i.NextResponse.json({error:"orderId is required"},{status:400});try{let e=await (0,c.F)(`/customers/v1/${n}/mobile/orders/${r}/live_tracking_screen`,{apiBase:"mobile",token:s,cache:"no-store"});if(!e.ok)return console.error("[payments/status] order fetch failed:",e.status,e.statusText),i.NextResponse.json({error:"Failed to fetch order details"},{status:e.status});let t=await e.json(),a=t?.data,o=a?.order?.paymentMethod||a?.paymentMethod;return i.NextResponse.json({paymentStatus:o?.paymentStatus??null,paymentId:o?.paymentId??null,attemptToPayURL:o?.attemptToPayURL??null,paymentSuccessUrl:o?.paymentSuccessUrl??null,paymentFailUrl:o?.paymentFailUrl??null})}catch(e){return console.error("[payments/status] error:",e?.message||e),i.NextResponse.json({error:"Failed to fetch payment status"},{status:500})}}let d=new r.AppRouteRouteModule({definition:{kind:a.x.APP_ROUTE,page:"/api/payments/status/route",pathname:"/api/payments/status",filename:"route",bundlePath:"app/api/payments/status/route"},resolvedPagePath:"/Users/ferlando/Desktop/baboon-nextjs/app/api/payments/status/route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:m,staticGenerationAsyncStorage:y,serverHooks:x}=d,f="/api/payments/status/route";function h(){return(0,o.patchFetch)({serverHooks:x,staticGenerationAsyncStorage:y})}},19191:(e,t,n)=>{n.d(t,{F:()=>o,q:()=>a});var s=n(47090),r=n(70446);async function a(e,t={}){let{apiBase:n="mobile",method:a="GET",body:o,token:i,langCode:u,notificationToken:c,headers:p={},revalidate:l,cache:d}=t,m=s.Y8[n],y=`${m}${e.startsWith("/")?e:"/"+e}`,x={"Content-Type":"application/json","User-Agent":"BaboonWeb",...p};i&&(x.Authorization=i),u&&(x.langCode=u);let f=c;if(!f)try{f=(await (0,r.Gg)()).fcmToken}catch{}f&&(x.notificationToken=f);let h={method:a,headers:x};o&&"GET"!==a&&(h.body=JSON.stringify(o)),void 0!==l&&(h.next={revalidate:l}),d&&(h.cache=d);let g=await fetch(y,h);if(!g.ok)throw Error(`API request failed: ${g.status} ${g.statusText}`);return g.json()}async function o(e,t={}){let{apiBase:n="mobile",method:a="GET",body:o,token:i,langCode:u,notificationToken:c,headers:p={}}=t,l=s.Y8[n],d=`${l}${e.startsWith("/")?e:"/"+e}`,m={"Content-Type":"application/json","User-Agent":"BaboonWeb",...p};i&&(m.Authorization=i),u&&(m.langCode=u);let y=c;if(!y)try{y=(await (0,r.Gg)()).fcmToken}catch{}y&&(m.notificationToken=y);let x={method:a,headers:m};return o&&"GET"!==a&&(x.body=JSON.stringify(o)),fetch(d,x)}},90455:(e,t,n)=>{function s(e){return e.token?e.token:e.user?.token?e.user.token:process.env.BABOON_APP_BUSINESS_TOKEN||""}function r(){return process.env.BABOON_APP_BUSINESS_TOKEN||""}n.d(t,{I2:()=>r,LP:()=>s})},47090:(e,t,n)=>{n.d(t,{RF:()=>s,Y8:()=>a,pH:()=>r});let s=["al","en","it"],r={AL:{latitude:41.327546,longitude:19.818698,cityId:1,countryId:1},XK:{latitude:42.662914,longitude:21.165503,cityId:2,countryId:2}},a={mobile:process.env.BABOON_API_MOBILE_URL,legacy:process.env.BABOON_API_URL,sysadmin:process.env.BABOON_API_SYSADMIN_URL,payment:process.env.BABOON_API_PAYMENT_URL}},70446:(e,t,n)=>{n.d(t,{Gg:()=>i,dx:()=>a,l7:()=>o,yK:()=>u});var s=n(78632),r=n(71615);let a={password:process.env.SESSION_SECRET,cookieName:"baboon-session",cookieOptions:{secure:!0,httpOnly:!0,sameSite:"lax",maxAge:604800}},o={...a,cookieName:"baboon-admin-session"};async function i(){let e=await (0,r.cookies)();return(0,s.iW)(e,a)}async function u(){let e=await (0,r.cookies)();return(0,s.iW)(e,o)}}};var t=require("../../../../webpack-runtime.js");t.C(e);var n=e=>t(t.s=e),s=t.X(0,[8948,3314,8632,5972],()=>n(11278));module.exports=s})();