"use strict";(()=>{var e={};e.id=4070,e.ids=[4070],e.modules={53524:e=>{e.exports=require("@prisma/client")},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")},97050:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>h,patchFetch:()=>v,requestAsyncStorage:()=>m,routeModule:()=>l,serverHooks:()=>y,staticGenerationAsyncStorage:()=>P});var a={};t.r(a),t.d(a,{POST:()=>d});var n=t(49303),s=t(88716),o=t(60670),i=t(87070),p=t(72331);process.env.PAKKASIR_API_KEY;let u=process.env.PAKKASIR_SLUG;async function c(e,r){try{if(!u)throw Error("PAKKASIR_SLUG is not set");return{url:`https://app.pakasir.com/pay/${u}/${e}?order_id=${r}&qris_only=1`,status:"PENDING"}}catch(e){throw console.error("Pakkasir Payment Error:",e),Error("Failed to create payment URL")}}async function d(e){try{let{userId:r,packageId:t}=await e.json();if(!r||!t)return i.NextResponse.json({error:"Missing userId or packageId"},{status:400});let a=await p._.coinPackage.findUnique({where:{id:t}});if(!a)return i.NextResponse.json({error:"Invalid package"},{status:404});let n=await p._.transaction.create({data:{userId:r,type:"TOPUP",amount:a.price,coins:a.coins+(a.bonusCoins||0),status:"PENDING",description:`Topup ${a.name}`}}),s=await c(a.price,n.id);return i.NextResponse.json({success:!0,transactionId:n.id,paymentUrl:s?.url})}catch(e){return console.error("Payment Create Error:",e),i.NextResponse.json({error:e.message||"Internal Server Error"},{status:500})}}let l=new n.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/payment/create/route",pathname:"/api/payment/create",filename:"route",bundlePath:"app/api/payment/create/route"},resolvedPagePath:"C:\\Users\\MSI\\Downloads\\film\\app\\api\\payment\\create\\route.ts",nextConfigOutput:"standalone",userland:a}),{requestAsyncStorage:m,staticGenerationAsyncStorage:P,serverHooks:y}=l,h="/api/payment/create/route";function v(){return(0,o.patchFetch)({serverHooks:y,staticGenerationAsyncStorage:P})}},72331:(e,r,t)=>{t.d(r,{_:()=>n});var a=t(53524);let n=global.prisma||new a.PrismaClient}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),a=r.X(0,[8948,5972],()=>t(97050));module.exports=a})();