"use strict";exports.id=6213,exports.ids=[6213],exports.modules={36213:(a,t,e)=>{e.r(t),e.d(t,{fulfillSmmOrder:()=>o});var r=e(72331),d=e(23564);async function o(a){let t=await r.default.order.findUnique({where:{id:a},include:{smmProduct:!0,user:!0}});if(!t)throw Error("Order not found");if("PENDING"===t.status||"PAID"===t.status){if(!t.smmProduct)throw Error("Not an SMM order");try{let e=t.targetId||"",o=t.quantity;if(!e)throw Error("Target (Link/Username) is empty");let n=await (0,d.jv)(t.smmProduct.serviceId,e,o);return await r.default.order.update({where:{id:a},data:{status:"PROCESSING",smmTrxId:n.id}}),{success:!0,trxId:n.id}}catch(t){throw console.error("[SMM FULFILLMENT ERROR]",t),await r.default.order.update({where:{id:a},data:{status:"FAILED",adminNote:`Zaynflazz Error: ${t.message}`}}),t}}}},23564:(a,t,e)=>{e.d(t,{HS:()=>o,jv:()=>n});let r=process.env.ZAYNFLAZZ_API_KEY||"",d="https://zaynflazz.com/api";async function o(){let a=new URLSearchParams;a.append("api_key",r),a.append("action","layanan");let t=await fetch(`${d}/sosial-media`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:a.toString()}),e=await t.json();if(!1===e.status&&e.data?.pesan)throw Error(e.data.pesan);return e.data&&Array.isArray(e.data)?e.data:Array.isArray(e)?e:e.data&&"object"==typeof e.data&&e.data.sid?[e.data]:[]}async function n(a,t,e,o,n){let s=new URLSearchParams;s.append("api_key",r),s.append("action","pemesanan"),s.append("layanan",a),s.append("target",t),s.append("jumlah",e.toString()),o&&s.append("custom_comments",o),n&&s.append("custom_link",n);let i=await fetch(`${d}/sosial-media`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s.toString()}),p=await i.json();if(!1===p.status||!p.data||!p.data.id)throw Error(p.data?.pesan||"Order gagal di proses oleh provider");return p.data}}};