PageSourceSearch

https://guardianlife.com.bd/assets/PaymentStatus-BTPF4qPu.js

js guardianlife.com.bd collected 2026-10-07 06:54:04 UTC 8,081 bytes, 1 lines download raw bytes

1import{t as k,o as L,l as u,k as e}from"./index-CcxOV0Tu.js";import{P as E}from"./PageContainer-Cunob_XE.js";import{e as S}from"./dashboardApi-C27BhrxY.js";import"./axios-mIN8J_VR.js";const D=()=>{const[t]=k(),p=L(),[s,h]=u.useState(null),[b,f]=u.useState(!0);u.useEffect(()=>{(async()=>{f(!0);const y=(t.get("status")||t.get("payment_status")||"success").toLowerCase(),N=t.get("proposal_id")||t.get("proposal_no")||t.get("proposal")||t.get("value_a"),w=t.get("amount")||t.get("total_amount")||t.get("currency_amount"),v=t.get("tran_id")||t.get("transaction_id")||t.get("val_id")||t.get("bank_tran_id");let l=null;try{const a=sessionStorage.getItem("last_payment_details");a&&(l=JSON.parse(a))}catch(a){console.error("Error parsing session payment details:",a)}let i=N||l?.proposal_id||"",d=w||l?.amount||"",m=v||l?.transaction_id||"",g=l?.timestamp||new Date().toISOString();if(!i||!d)try{const a=await S(),x=Array.isArray(a)?a:a?.data&&Array.isArray(a.data)?a.data:[];if(x&&x.length>0){const o=x[0];i||(i=o.proposalNo||o.proposal_no||""),d||(d=o.premium||o.total_premium||o.coverage||""),m||(m=`TXN-${Math.floor(1e7+Math.random()*9e7)}`),o.requestDate&&(g=o.requestDate)}}catch(a){console.warn("Could not fetch proposal data from pending API:",a)}h(i?{proposalId:i,amount:d||"0",tranId:m||`TXN-${Math.floor(1e7+Math.random()*9e7)}`,timestamp:g,status:y}:null),f(!1)})()},[t]);const r=(s?.status||"success")==="success"||(s?.status||"")==="successful"||(s?.status||"")==="ok",n=(s?.status||"")==="cancel"||(s?.status||"")==="cancelled",c=!r&&!n,j=s?.timestamp?new Date(s.timestamp).toLocaleString("en-US",{month:"short",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0}):new Date().toLocaleString("en-US",{month:"short",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0});return b?e.jsx("main",{className:"min-h-screen bg-[#F8F9FA] py-16 px-4 flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-[#EB6925]"}),e.jsx("span",{className:"text-gray-500 font-semibold text-sm",children:"Loading transaction details..."})]})}):e.jsx("main",{className:"min-h-screen bg-[#F8F9FA] py-12 px-4 sm:px-6 lg:px-8 flex items-center justify-center",children:e.jsx(E,{children:e.jsx("div",{className:"max-w-[460px] w-full mx-auto",children:e.jsxs("div",{className:"bg-white rounded-[28px] border border-gray-100/80 shadow-2xl shadow-gray-200/60 overflow-hidden p-7 sm:p-9 flex flex-col items-center text-center",children:[e.jsxs("div",{className:`w-20 h-20 rounded-full flex items-center justify-center mb-6 shadow-xl ${r?"bg-[#00C278] text-white shadow-emerald-200/80":n?"bg-[#F59E0B] text-white shadow-amber-200/80":"bg-[#EF4444] text-white shadow-red-200/80"}`,children:[r&&e.jsx("svg",{className:"w-10 h-10 stroke-[3]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),n&&e.jsx("svg",{className:"w-10 h-10 stroke-[2.5]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),c&&e.jsx("svg",{className:"w-10 h-10 stroke-[2.5]",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})]}),e.jsxs("h1",{className:"text-2xl sm:text-3xl font-black text-[#2A2B68] tracking-wide uppercase mb-3",children:[r&&"PAYMENT SUCCESSFUL!",n&&"PAYMENT CANCELLED",c&&"PAYMENT FAILED"]}),e.jsxs("p",{className:"text-gray-500 text-xs sm:text-sm font-medium leading-relaxed max-w-sm mb-6",children:[r&&e.jsxs(e.Fragment,{children:["Your policy proposal has been successfully registered and payment received under Proposal Number"," ",e.jsx("strong",{className:"text-gray-800 font-extrabold",children:s?.proposalId}),"."]}),n&&e.jsxs(e.Fragment,{children:["The payment process was cancelled for Proposal Number"," ",e.jsx("strong",{className:"text-gray-800 font-extrabold",children:s?.proposalId}),"."]}),c&&e.jsxs(e.Fragment,{children:["We could not process payment for Proposal Number"," ",e.jsx("strong",{className:"text-gray-800 font-extrabold",children:s?.proposalId}),"."]})]}),e.jsxs("div",{className:"w-full text-left mb-6",children:[e.jsx("h2",{className:"text-[11px] font-extrabold text-gray-400 uppercase tracking-widest mb-3",children:"TRANSACTION SUMMARY"}),e.jsxs("div",{className:"bg-white rounded-2xl p-5 border border-gray-150 shadow-sm flex flex-col gap-3.5 text-xs sm:text-sm font-semibold",children:[e.jsxs("div",{className:"flex justify-between items-center py-0.5 border-b border-gray-100 pb-2.5",children:[e.jsx("span",{className:"text-gray-500",children:"Proposal ID"}),e.jsx("span",{className:"text-[#2A2B68] font-extrabold",children:s?.proposalId||"—"})]}),e.jsxs("div",{className:"flex justify-between items-center py-0.5 border-b border-gray-100 pb-2.5",children:[e.jsx("span",{className:"text-gray-500",children:"Transaction ID"}),e.jsx("span",{className:"text-gray-800 font-extrabold font-mono text-xs",children:s?.tranId||"—"})]}),e.jsxs("div",{className:"flex justify-between items-center py-0.5 border-b border-gray-100 pb-2.5",children:[e.jsx("span",{className:"text-gray-500",children:"Date & Time"}),e.jsx("span",{className:"text-gray-600 font-medium",children:j})]}),e.jsxs("div",{className:"flex justify-between items-center py-0.5 border-b border-gray-100 pb-2.5",children:[e.jsx("span",{className:"text-gray-500",children:"Payment Status"}),e.jsx("span",{className:`px-3 py-0.5 rounded-full text-xs font-extrabold ${r?"bg-emerald-50 text-[#00C278] border border-emerald-100":n?"bg-amber-50 text-amber-600 border border-amber-100":"bg-red-50 text-red-600 border border-red-100"}`,children:r?"Success":n?"Cancelled":"Failed"})]}),e.jsxs("div",{className:"flex justify-between items-center pt-1 text-sm sm:text-base",children:[e.jsx("span",{className:"text-gray-800 font-bold",children:"Total Amount"}),e.jsxs("span",{className:"text-[#EB6925] font-black",children:["BDT ",s?.amount?Number(s.amount).toLocaleStr
1ing():"0"]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 w-full",children:[e.jsxs("button",{type:"button",onClick:()=>p("/dashboard"),className:"bg-[#EB6925] hover:bg-[#d55919] text-white font-bold py-3.5 px-6 rounded-xl flex items-center justify-between shadow-lg shadow-orange-200/80 w-full transition-all group",children:[e.jsx("span",{className:"text-sm font-extrabold",children:"Go to Dashboard"}),e.jsx("span",{className:"w-8 h-8 rounded-full bg-white text-[#EB6925] flex items-center justify-center shrink-0 ml-2 group-hover:translate-x-0.5 transition-transform",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2.5",d:"M9 5l7 7-7 7"})})})]}),e.jsxs("button",{type:"button",onClick:()=>p("/"),className:"bg-white border-2 border-[#EB6925] text-[#EB6925] hover:bg-orange-50/50 font-bold py-3.5 px-6 rounded-xl flex items-center justify-between w-full transition-all group",children:[e.jsx("span",{className:"text-sm font-extrabold",children:"Return to Home"}),e.jsx("span",{className:"w-8 h-8 rounded-full bg-[#EB6925] text-white flex items-center justify-center shrink-0 ml-2 group-hover:translate-x-0.5 transition-transform",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2.5",d:"M9 5l7 7-7 7"})})})]})]}),e.jsxs("p",{className:"text-xs text-gray-400 font-semibold mt-8 text-center",children:["Need help? Contact Guardian Life customer support at ",e.jsx("a",{href:"tel:16622",className:"text-[#EB6925] font-extrabold hover:underline",children:"16622"})]})]})})})})};export{D 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.