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