1import{u as g,s as j,r,j as e,L as w,p as b,T as _,n as v,v as N,w as V}from"./index-C1fX6R5K.js";import"./i18n-BtccWlCM.js";import"./index-paNpr7jU.js";function S(){const{t}=g("lms"),[n]=j(),[a,p]=r.useState(null),[f,c]=r.useState(null),[d,i]=r.useState(!0),m=n.get("ref")??void 0,l=n.get("orderId")??n.get("mdOrder")??void 0;r.useEffect(()=>{let o=!1,u=0;async function x(){if(!m&&!l){c(t("payments.missing_ref",{defaultValue:"Référence de paiement manquante."})),i(!1);return}try{const s=await V({ref:m,orderId:l});if(o)return;if(p(s),!s.paid&&s.status==="pending"&&u<4){u+=1,setTimeout(x,2e3);return}i(!1)}catch(s){if(o)return;c(s?.response?.data?.message??t("payments.verify_failed",{defaultValue:"Impossible de vérifier ce paiement."})),i(!1)}}return x(),()=>{o=!0}},[m,l]);const h=a?.paid===!0,y=a?.status==="mismatch";return e.jsx("div",{className:"flex min-h-[60vh] items-center justify-center px-4",children:e.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-white/10 bg-white/5 p-8 text-center",children:[d?e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"mx-auto h-10 w-10 animate-spin text-primary"}),e.jsx("h1",{className:"mt-4 text-lg font-semibold text-white",children:t("payments.verifying",{defaultValue:"Vérification du paiementâ¦"})}),e.jsx("p",{className:"mt-2 text-sm text-white/50",children:t("payments.verifying_hint",{defaultValue:"Ne fermez pas cette page."})})]}):h?e.jsxs(e.Fragment,{children:[e.jsx(b,{className:"mx-auto h-12 w-12 text-green-400"}),e.jsx("h1",{className:"mt-4 text-xl font-bold text-white",children:t("payments.success_title",{defaultValue:"Paiement confirmé"})}),e.jsx("p",{className:"mt-2 text-sm text-white/60",children:t("payments.success_body",{defaultValue:"Votre paiement a bien été enregistré."})}),a?.masked_pan&&e.jsxs("p",{className:"mt-3 text-xs text-white/40",children:[a.payment_system," ",a.masked_pan,a.approval_code?` â autorisation ${a.approval_code}`:""]})]}):y?e.jsxs(e.Fragment,{children:[e.jsx(_,{className:"mx-auto h-12 w-12 text-amber-400"}),e.jsx("h1",{className:"mt-4 text-xl font-bold text-white",children:t("payments.review_title",{defaultValue:"Paiement en cours de vérification"})}),e.jsx("p",{className:"mt-2 text-sm text-white/60",children:t("payments.review_body",{defaultValue:"Le montant reçu ne correspond pas à la commande. Notre équipe vérifie votre paiement."})})]}):e.jsxs(e.Fragment,{children:[e.jsx(v,{className:"mx-auto h-12 w-12 text-red-400"}),e.jsx("h1",{className:"mt-4 text-xl font-bold text-white",children:t("payments.failed_title",{defaultValue:"Paiement non abouti"})}),e.jsx("p",{className:"mt-2 text-sm text-white/60",children:f??a?.action_code_description??a?.error_message??t("payments.failed_body",{defaultValue:"Le paiement n'a pas été validé."})})]}),a?.order_number&&e.jsx("p",{className:"mt-4 font-mono text-[11px] text-white/30",children:a.order_number}),!d&&e.jsx(N,{to:"/my/payments",className:"mt-6 inline-block rounded-lg bg-primary px-5 py-2 text-sm font-semibold text-white hover:bg-primary/90",children:t("payments.back_to_payments",{defaultValue:"Retour à mes paiements"})})]})})}export{S 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.