1import{u as H,aA as T,r as q,D as B,aq as M,j as e,S as b,N as k,a as x,t as u,w as h,x as S,b as j,B as p,aM as C,F as _,$ as P,ar as F,a5 as $,s as f,aK as n,ab as N}from"./index-XdapicsC.js";import{L as l}from"./lock-Bb-OW3dC.js";import{C as L}from"./circle-check-eEh8-zfg.js";function K(){const y=H(),[t]=T(),[r,z]=q.useState(null),c=t.get("reservation_id"),i=t.get("amount"),g=t.get("customer_name"),v=t.get("customer_email"),d=t.get("customer_phone"),{data:m,isLoading:D}=B({queryKey:["active-payment-providers"],queryFn:async()=>{const{data:s,error:a}=await N.from("payment_providers").select("*").eq("is_active",!0).order("sort_order");if(a)throw a;return s}}),o=M({mutationFn:async s=>{const{data:{session:a}}=await N.auth.getSession();if(!a)throw new Error("Oturum bulunamadı");const{data:G,error:w}=await N.functions.invoke("initialize-payment",{body:{reservationId:c,amount:parseFloat(i||"0"),customerName:g,customerEmail:v,customerPhone:d,providerType:s}});if(w)throw w;return G},onSuccess:s=>{if(s.formHtml){const a=window.open("","_blank");a&&(a.document.write(s.formHtml),a.document.close()),n.success("Ãdeme sayfası açıldı")}else s.redirectUrl&&(window.location.href=s.redirectUrl)},onError:s=>{n.error(s.message||"Ãdeme baÅlatılamadı")}}),E=()=>
1{if(!r){n.error("Lütfen bir ödeme yöntemi seçin");return}if(!c||!i){n.error("Geçersiz ödeme bilgileri");return}o.mutate(r)};return!c||!i?e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(b,{title:"Hata - Ãdeme",description:"Ãdeme bilgileri eksik"}),e.jsx(k,{}),e.jsx("div",{className:"container mx-auto px-4 py-16",children:e.jsxs(x,{className:"max-w-md mx-auto",children:[e.jsxs(u,{children:[e.jsx(h,{children:"Hata"}),e.jsx(S,{children:"Ãdeme bilgileri eksik veya geçersiz"})]}),e.jsx(j,{children:e.jsxs(p,{onClick:()=>y("/"),className:"w-full",children:[e.jsx(C,{className:"h-4 w-4 mr-2"}),"Ana Sayfaya Dön"]})})]})}),e.jsx(_,{})]}):e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(b,{title:"Ãdeme - TurStore",description:"Güvenli ödeme sayfası"}),e.jsx(k,{}),e.jsx("div",{className:"container mx-auto px-4 py-8",children:e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsxs(p,{variant:"ghost",onClick:()=>y(-1),className:"mb-6",children:[e.jsx(C,{className:"h-4 w-4 mr-2"}),"Geri Dön"]}),e.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[e.jsx("div",{className:"md:col-span-1",children:e.jsxs(x,{children:[e.jsx(u,{children:e.jsx(h,{className:"text-lg",children:"SipariÅ Ãzeti"})}),e.jsxs(j,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"MüÅteri"}),e.jsx("p",{className:"font-medium",children:g}),e.jsx("p",{className:"text-sm text-muted-foreground",children:v}),d&&e.jsx("p",{className:"text-sm text-muted-foreground",children:d})]}),e.jsx(P,{}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm font-medium",children:"Toplam Tutar"}),e.jsxs("span",{className:"text-2xl font-bold text-primary",children:["âº",parseFloat(i).toFixed(2)]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(l,{className:"h-4 w-4"}),e.jsx("span",{children:"Güvenli ödeme"})]})]})]})}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsxs(x,{children:[e.jsxs(u,{children:[e.jsx(h,{children:"Ãdeme Yöntemi Seçin"}),e.jsx(S,{children:"Tercih ettiÄiniz ödeme yöntemini seçerek devam edin"})]}),e.jsxs(j,{className:"space-y-4",children:[D?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(F,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):m&&m.length>0?e.jsx("div",{className:"space-y-3",children:m.map(s=>e.jsx("button",{onClick:()=>z(s.provider_type),className:`w-full p-4 border-2 rounded-lg transition-all text-left ${r===s.provider_type?"border-primary bg-primary/5":"border-border hover:border-primary/50"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`p-2 rounded-lg ${r===s.provider_type?"bg-primary/20":"bg-muted"}`,children:e.jsx($,{className:`h-5 w-5 ${r===s.provider_type?"text-primary":"text-muted-foreground"}`})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:s.display_name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.description||"Güvenli ödeme"})]})]}),r===s.provider_type&&e.jsx(L,{className:"h-5 w-5 text-primary"})]})},s.id))}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx("p",{children:"Åu anda aktif ödeme yöntemi bulunmamaktadır."}),e.jsx("p",{className:"text-sm mt-2",children:"Lütfen daha sonra tekrar deneyin."})]}),e.jsx(P,{className:"my-6"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(p,{onClick:E,disabled:!r||o.isPending,className:"w-full",size:"lg",children:o.isPending?e.jsxs(e.Fragment,{children:[e.jsx(F,{className:"h-4 w-4 mr-2 animate-spin"}),"Ãdeme BaÅlatılıyor..."]}):e.jsxs(e.Fragment,{children:[e.jsx(l,{className:"h-4 w-4 mr-2"}),"Güvenli Ãdeme Yap"]})}),e.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-muted-foreground",children:[e.jsx(l,{className:"h-3 w-3"}),e.jsx("span",{children:"256-bit SSL Åifreleme ile korunmaktadır"})]})]})]})]}),e.jsxs("div",{className:"mt-6 flex flex-wrap justify-center gap-4",children:[e.jsxs(f,{variant:"outline",className:"px-4 py-2",children:[e.jsx(l,{className:"h-3 w-3 mr-1"}),"SSL Sertifikalı"]}),e.jsxs(f,{variant:"outline",className:"px-4 py-2",children:[e.jsx(L,{className:"h-3 w-3 mr-1"}),"PCI-DSS Uyumlu"]}),e.jsx(f,{variant:"outline",className:"px-4 py-2",children:"3D Secure"})]})]})]})]})}),e.jsx(_,{})]})}
1export{K as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.