"use strict";(()=>{var e={};e.id=1387,e.ids=[1387],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")},94833:(e,t,n)=>{n.r(t),n.d(t,{originalPathname:()=>f,patchFetch:()=>g,requestAsyncStorage:()=>y,routeModule:()=>d,serverHooks:()=>x,staticGenerationAsyncStorage:()=>m});var a={};n.r(a),n.d(a,{GET:()=>l});var o=n(49303),s=n(88716),r=n(60670),i=n(87070),p=n(19191),c=n(70446),u=n(90455);async function l(e){let t=e.nextUrl.searchParams.get("paymentId");if(!t)return i.NextResponse.json({error:"paymentId is required"},{status:400});let n=await (0,c.Gg)(),a=(0,u.LP)(n);try{let e=await (0,p.F)(`/payments/attempt-to-pay?paymentId=${t}`,{apiBase:"payment",token:a,cache:"no-store"});if((e.headers.get("content-type")||"").includes("text/html")){let t=await e.text();return i.NextResponse.json({data:t})}let n=await e.json();return i.NextResponse.json(n,{status:e.status})}catch(e){return console.error("Payment attempt failed:",{paymentId:t,error:e}),i.NextResponse.json({error:"Payment attempt failed"},{status:500})}}let d=new o.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/payments/attempt-to-pay/route",pathname:"/api/payments/attempt-to-pay",filename:"route",bundlePath:"app/api/payments/attempt-to-pay/route"},resolvedPagePath:"/Users/ferlando/Desktop/baboon-nextjs/app/api/payments/attempt-to-pay/route.ts",nextConfigOutput:"standalone",userland:a}),{requestAsyncStorage:y,staticGenerationAsyncStorage:m,serverHooks:x}=d,f="/api/payments/attempt-to-pay/route";function g(){return(0,r.patchFetch)({serverHooks:x,staticGenerationAsyncStorage:m})}},19191:(e,t,n)=>{n.d(t,{F:()=>r,q:()=>s});var a=n(47090),o=n(70446);async function s(e,t={}){let{apiBase:n="mobile",method:s="GET",body:r,token:i,langCode:p,notificationToken:c,headers:u={},revalidate:l,cache:d}=t,y=a.Y8[n],m=`${y}${e.startsWith("/")?e:"/"+e}`,x={"Content-Type":"application/json","User-Agent":"BaboonWeb",...u};i&&(x.Authorization=i),p&&(x.langCode=p);let f=c;if(!f)try{f=(await (0,o.Gg)()).fcmToken}catch{}f&&(x.notificationToken=f);let g={method:s,headers:x};r&&"GET"!==s&&(g.body=JSON.stringify(r)),void 0!==l&&(g.next={revalidate:l}),d&&(g.cache=d);let h=await fetch(m,g);if(!h.ok)throw Error(`API request failed: ${h.status} ${h.statusText}`);return h.json()}async function r(e,t={}){let{apiBase:n="mobile",method:s="GET",body:r,token:i,langCode:p,notificationToken:c,headers:u={}}=t,l=a.Y8[n],d=`${l}${e.startsWith("/")?e:"/"+e}`,y={"Content-Type":"application/json","User-Agent":"BaboonWeb",...u};i&&(y.Authorization=i),p&&(y.langCode=p);let m=c;if(!m)try{m=(await (0,o.Gg)()).fcmToken}catch{}m&&(y.notificationToken=m);let x={method:s,headers:y};return r&&"GET"!==s&&(x.body=JSON.stringify(r)),fetch(d,x)}},90455:(e,t,n)=>{function a(e){return e.token?e.token:e.user?.token?e.user.token:process.env.BABOON_APP_BUSINESS_TOKEN||""}function o(){return process.env.BABOON_APP_BUSINESS_TOKEN||""}n.d(t,{I2:()=>o,LP:()=>a})},47090:(e,t,n)=>{n.d(t,{RF:()=>a,Y8:()=>s,pH:()=>o});let a=["al","en","it"],o={AL:{latitude:41.327546,longitude:19.818698,cityId:1,countryId:1},XK:{latitude:42.662914,longitude:21.165503,cityId:2,countryId:2}},s={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:()=>s,l7:()=>r,yK:()=>p});var a=n(78632),o=n(71615);let s={password:process.env.SESSION_SECRET,cookieName:"baboon-session",cookieOptions:{secure:!0,httpOnly:!0,sameSite:"lax",maxAge:604800}},r={...s,cookieName:"baboon-admin-session"};async function i(){let e=await (0,o.cookies)();return(0,a.iW)(e,s)}async function p(){let e=await (0,o.cookies)();return(0,a.iW)(e,r)}}};var t=require("../../../../webpack-runtime.js");t.C(e);var n=e=>t(t.s=e),a=t.X(0,[8948,3314,8632,5972],()=>n(94833));module.exports=a})();