1import{a as u,t as c,b as s,r as l,j as e,S as A}from"./index-DRYNtDfq.js";import{D as j,A as k}from"./DashboardLayout-2PNDDCmu.js";import{E as v}from"./eye-off-BfVU3Ou0.js";import{E as C}from"./eye-CK6SMoQC.js";import{R as w}from"./refresh-cw-D2dmFQzs.js";import{E as R}from"./message-circle-DuGz_h7Q.js";import{C as z}from"./copy-DMRO91DC.js";import{S as N}from"./save-2ZdfPiqL.js";import"./trending-up-CvKbjCgH.js";import"./circle-arrow-down-HHKk6hyR.js";import"./circle-arrow-up-DUs07WdU.js";import"./file-text-CvyTzFOR.js";import"./send-BLEe7uzJ.js";import"./mail-Dy7s7wzw.js";import"./index-BfJPPodk.js";import"./dialog-D6TyplgW.js";function X(){const{user:r}=u(),{data:i,isLoading:x}=c.admin.getSepayConfig.useQuery(void 0,{enabled:r?.role==="admin"}),o=c.admin.updateSepayConfig.useMutation({onSuccess:()=>{s.success("Äã lưu cấu hình SePay"),y.admin.getSepayConfig.invalidate()},onError:t=>s.error(t.message)}),y=c.useUtils(),[a,n]=l.useState({enabled:!1,webhookSecret:"",bankName:"",bankAccount:"",accountName:"",minDeposit:1e4,maxDeposit:5e7}),[d,p]=l.useState(!1);l.useEffect(()=>{i&&n({enabled:i.enabled||!1,webhookSecret:i.webhookSecret||"",bankName:i.bankName||"",bankAccount:i.bankAccount||"",accountName:i.accountName||"",minDeposit:i.minDeposit||1e4,maxDeposit:i.maxDeposit||5e7})},[i]);const S=()=>{if(!a.bankName||!a.bankAccount||!a.accountName){s.error("Vui lòng Äiá»n Äầy Äá»§ thông tin ngân hà ng");return}!a.webhookSecret||a.webhookSecret.includes("***"),o.mutate(a)},b=()=>{const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let g="";for(let h=0;h<32;h++)g+=t.charAt(Math.floor(Math.random()*t.length));n({...a,webhookSecret:g}),p(!0),s.success("Äã tạo Secret Key má»i. Nhá» copy và cấu hình trên SePay Dashboard.")},f=t=>{navigator.clipboard.writeText(t),s.success("Äã copy!")};if(r?.role!=="admin")return null;const m=`${window.location.origin}/api/webhooks/sepay`;return e.jsx(j,{"data-loc":"client/src/pages/admin/AdminSepay.tsx:78",navItems:k,title:"Cà i Äặt SePay",children:e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:79",style:{maxWidth:720,margin:"0 auto"},children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:80",style:{marginBottom:24},children:[e.jsx("h1",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:81",style:{fontSize:22,fontWeight:800,color:"#111827",marginBottom:6},children:"Cà i Äặt SePay"}),e.jsx("p",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:82",style:{fontSize:14,color:"#6b7280"},children:"Cấu hình cá»ng thanh toán SePay Äá» nháºn nạp tiá»n tá»± Äá»ng qua chuyá»n khoản ngân hà ng."})]}),x?e.jsx("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:88",style:{padding:40,textAlign:"center",color:"#9ca3af"},children:"Äang tải..."}):e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:90",style:{display:"flex",flexDirection:"column",gap:20},children:[e.jsx("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:92",style:{background:"#fff",border:"1px solid #e5e7eb",borderRadius:14,padding:24},children:e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:93",className:"flex items-center",style:{justifyContent:"space-between"},children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:94",children:[e.jsx("h3",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:95",style:{fontSize:15,fontWeight:700,color:"#111827",marginBottom:4},children:"KÃch hoạt SePay"}),e.jsx("p",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:96",style:{fontSize:13,color:"#6b7280"},children:"Báºt/tắt chức nÄng nạp tiá»n qua chuyá»n khoản"})]}),e.jsxs("label",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:98",style:{position:"relative",display:"inline-block",width:48,height:26},children:[e.jsx("input",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:99",type:"checkbox",checked:a.enabled,onChange:t=>n({...a,enabled:t.target.checked}),style:{opacity:0,width:0,height:0}}),e.jsx("span",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:105",style:{position:"absolute",curs
1or:"pointer",top:0,left:0,right:0,bottom:0,background:a.enabled?"#7c3aed":"#d1d5db",borderRadius:26,transition:"0.2s"},children:e.jsx("span",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:109",style:{position:"absolute",content:"",height:20,width:20,left:a.enabled?24:4,bottom:3,background:"#fff",borderRadius:"50%",transition:"0.2s"}})})]})]})}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:119",style:{background:"#fff",border:"1px solid #e5e7eb",borderRadius:14,padding:24},children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:120",className:"flex items-center",style:{gap:8,marginBottom:14},children:[e.jsx(A,{"data-loc":"client/src/pages/admin/AdminSepay.tsx:121",style:{width:18,height:18,color:"#7c3aed"}}),e.jsx("h3",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:122",style:{fontSize:15,fontWeight:700,color:"#111827"},children:"Xác thá»±c Webhook (HMAC-SHA256)"})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:126",style:{marginBottom:14,padding:"10px 14px",background:"#f5f3ff",borderRadius:8,border:"1px solid #ede9fe"},children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:127",className:"flex items-center",style:{gap:6},children:[e.jsx("span",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:128",style:{fontSize:12,fontWeight:600,color:"#7c3aed",background:"#ede9fe",padding:"2px 8px",borderRadius:4},children:"HMAC-SHA256"}),e.jsx("span",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:131",style:{fontSize:12,color:"#6b7280"},children:"â Phương thức xác thá»±c khuyến nghá» bá»i SePay"})]}),e.jsxs("p",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:135",style:{fontSize:12,color:"#6b7280",marginTop:6},children:["SePay ký dữ liá»u bằng HMAC-SHA256 và gá»i chữ ký trong header ",e.jsx("code",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:136",style:{background:"#e5e7eb",padding:"1px 4px",borderRadius:3,fontSize:11},children:"X-SePay-Signature"}),". Secret Key phải trùng vá»i Secret Key cấu hình trên SePay Dashboard."]})]}),e.jsx("label",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:141",style:{display:"block",fontSize:13,fontWeight:600,color:"#374151",marginBottom:6},children:"Webhook Secret Key"}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:144",className:"flex",style:{gap:8},children:[e.jsx("input",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:145",type:d?"text":"password",value:a.webhookSecret,onChange:t=>n({...a,webhookSecret:t.target.value}),placeholder:"Nháºp Secret Key (trùng vá»i cấu hình trên SePay)",style:{flex:1,height:40,padding:"0 14px",border:"1px solid #e5e7eb",borderRadius:10,fontSize:13,fontFamily:"monospace"}}),e.jsx("button",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:152",onClick:()=>p(!d),title:d?"Ẩn":"Hiá»n",style:{width:40,height:40,borderRadius:10,border:"1px solid #e5e7eb",background:"#fff",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},children:d?e.jsx(v,{"data-loc":"client/src/pages/admin/AdminSepay.tsx:157",style:{width:16,height:16,color:"#6b7280"}}):e.jsx(C,{"data-loc":"client/src/pages/admin/AdminSepay.tsx:157",style:{width:16,height:16,color:"#6b7280"}})}),e.jsx("button",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:159",onClick:b,title:"Tạo Secret Key ngẫu nhiên",style:{width:40,height:40,borderRadius:10,border:"1px solid #e5e7eb",background:"#fff",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(w,{"data-loc":"client/src/pages/admin/AdminSepay.tsx:164",style:{width:16,height:16,color:"#6b7280"}})})]}),e.jsxs("p",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:167",style:{fontSize:12,color:"#9ca3af",marginTop:8},children:["Cấu hình Secret Key tại"," ",e.jsxs("a",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:169",href:"https://my.sepay.vn/settings/webhook",target:"_blank",rel:"noopener",style:{color:"#7c3aed",textDecoration:"underline"},children:["SePay Dashboard â Bảo máºt â HMAC-SHA256 ",e.jsx(R,{"data-loc":"client/src/pages/admin/AdminSepay.tsx:170",style:{width:11,height:11,display:"inline"}})]})]}),e.jsx("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:175",style:{marginTop:14,padding:"10px 14px",background:"#f9fafb",borderRadius:8},children:e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:176",className:"flex items-center",style:{gap:8},children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:177",style:{flex:1},children:[e.jsx("span",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:178",style:{fontSize:12,fontWeight:600,color:"#374151"},children:"Webhook URL:"})," ",e.jsx("code",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:179",style:{background:"#e5e7eb",padding:"2px 6px",borderRadius:4,fontSize:11},children:m})]}),e.jsx("button",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:183",onClick:()=>f(m),title:"Copy URL",style:{width:32,height:32,borderRadius:8,border:"1px solid #e5e7eb",background:"#fff",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(z,{"data-loc":"client/src/pages/admin/AdminSepay.tsx:188",style:{width:14,height:14,color:"#6b7280"}})})]})}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:194",style:{marginTop:14,padding:"12px 14px",background:"#fffbeb",borderRadius:8,border:"1px solid #fef3c7"},children:[e.jsx("p",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:195",style:{fontSize:12,fontWeight:600,color:"#92400e",marginBottom:6},children:"Hưá»ng dẫn cấu hình trên SePay:"}),e.jsxs("ol",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:196",style:{fontSize:12,color:"#78350f",margin:0,paddingLeft:18,lineHeight:1.8},children:[e.jsx("li",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:197",children:"Và o SePay Dashboard â Webhooks â Chá»n/Tạo webhook"}),e.jsx("li",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:198",children:"URL nháºn webhook: paste URL á» trên"}),e.jsxs("li",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:199",children:["Bảo máºt â Chá»n ",e.jsx("strong",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:199",children:"HMAC-SHA256"})]}),e.jsx("li",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:200",children:"Nháºp Secret Key (giá»ng vá»i Secret Key á» trên)"}),e.jsxs("li",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:201",children:["Loại giao dá»ch: ",e.jsx("strong",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:201",children:"Tiá»n và o"})]}),e.jsxs("li",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:202",children:["Äá»nh dạng: ",e.jsx("strong",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:202",children:"JSON"})]})]})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:208",style:{background:"#fff",border:"1px solid #e5e7eb",borderRadius:14,padding:24},children:[e.jsx("h3",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:209",style:{fontSize:15,fontWeight:700,color:"#111827",marginBottom:14},children:"Thông tin ngân hà ng"}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:210",style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:14},children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:211",children:[e.jsx("label",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:212",style:{display:"block",fontSize:13,fontWeight:600,color:"#374151",marginBottom:6},children:"Tên ngân hà ng (mã)"}),e.jsx("input",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:213",value:a.bankName,onChange:t=>n({...a,bankName:t.target.value}),placeholder:"VD: MBBank, Vietcombank...",style:{width:"100%",height:40,padding:"0 14px",border:"1px solid #e5e7eb",borderRadius:10,fontSize:13}})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:220",children:[e.jsx("label",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:221",style:{display:"block",fontSize:13,fontWeight:600,color:"#374151",marginBottom:6},children:"Sá» tà i khoản"}),e.jsx("input",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:222",value:a.bankAccount,onChange:t=>n({...a,bankAccount:t.target.value}),placeholder:"Sá» tà i khoản ngân hà ng",style:{width:"100%",height:40,padding:"0 14px",border:"1px solid #e5e7eb",borderRadius:10,fontSize:13}})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:229",style:{gridColumn:"1 / -1"},children:[e.jsx("label",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:230",style:{display:"block",fontSize:13,fontWeight:600,color:"#374151",marginBottom:6}
1,children:"Tên chá»§ tà i khoản"}),e.jsx("input",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:231",value:a.accountName,onChange:t=>n({...a,accountName:t.target.value}),placeholder:"Tên chá»§ tà i khoản (viết hoa)",style:{width:"100%",height:40,padding:"0 14px",border:"1px solid #e5e7eb",borderRadius:10,fontSize:13}})]})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:242",style:{background:"#fff",border:"1px solid #e5e7eb",borderRadius:14,padding:24},children:[e.jsx("h3",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:243",style:{fontSize:15,fontWeight:700,color:"#111827",marginBottom:14},children:"Giá»i hạn nạp tiá»n"}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:244",style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:14},children:[e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:245",children:[e.jsx("label",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:246",style:{display:"block",fontSize:13,fontWeight:600,color:"#374151",marginBottom:6},children:"Nạp tá»i thiá»u (Ä)"}),e.jsx("input",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:247",type:"number",value:a.minDeposit,onChange:t=>n({...a,minDeposit:Number(t.target.value)}),style:{width:"100%",height:40,padding:"0 14px",border:"1px solid #e5e7eb",borderRadius:10,fontSize:13}})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:254",children:[e.jsx("label",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:255",style:{display:"block",fontSize:13,fontWeight:600,color:"#374151",marginBottom:6},children:"Nạp tá»i Äa (Ä)"}),e.jsx("input",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:256",type:"number",value:a.maxDeposit,onChange:t=>n({...a,maxDeposit:Number(t.target.value)}),style:{width:"100%",height:40,padding:"0 14px",border:"1px solid #e5e7eb",borderRadius:10,fontSize:13}})]})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:267",style:{background:"#fff",border:"1px solid #e5e7eb",borderRadius:14,padding:24},children:[e.jsx("h3",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:268",style:{fontSize:15,fontWeight:700,color:"#111827",marginBottom:14},children:"Cấu trúc mã thanh toán"}),e.jsx("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:269",style:{padding:"14px 16px",background:"#f0fdf4",borderRadius:10,border:"1px solid #bbf7d0"},children:e.jsxs("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:270",style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"6px 14px",fontSize:13},children:[e.jsx("span",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:271",style:{fontWeight:600,color:"#166534"},children:"Prefix:"}),e.jsx("span",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:272",style:{color:"#15803d"},children:"DH"}),e.jsx("span",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:273",style:{fontWeight:600,color:"#166534"},children:"Suffix:"}),e.jsx("span",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:274",style:{color:"#15803d"},children:"Sá» nguyên, 3â10 ký tá»±"}),e.jsx("span",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:275",style:{fontWeight:600,color:"#166534"},children:"Và dụ:"}),e.jsx("code",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:276",style:{background:"#dcfce7",padding:"2px 8px",borderRadius:4,fontWeight:700,color:"#166534"},children:"DH12345678"})]})}),e.jsx("div",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:279",style:{marginTop:12,padding:"10px 14px",background:"#fef3c7",borderRadius:8,border:"1px solid #fde68a"},children:e.jsxs("p",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:280",style:{fontSize:12,color:"#92400e",margin:0},children:[e.jsx("strong",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:281",children:"Lưu ý:"}),' Cấu trúc nà y phải trùng khá»p vá»i cấu hình "Mã thanh toán" trên SePay Dashboard. Nếu admin Äá»i prefix/suffix trên SePay, phải liên há» dev Äá» cáºp nháºt code tương ứng.']})})]}),e.jsxs("button",{"data-loc":"client/src/pages/admin/AdminSepay.tsx:288",onClick:S,disabled:o.isPending,className:"gradient-primary btn-press flex items-center",style:{height:48,padding:"0 28px",borderRadius:12,border:"none",color:"#fff",fontSize:15,fontWeight:700,cursor:"pointer",gap:8,justifyContent:"center"},children:[e.jsx(N,{"data-loc":"client/src/pages/admin/AdminSepay.tsx:297",style:{width:18,height:18}}),o.isPending?"Äang lưu...":"Lưu cấu hình"]})]})]})})}export{X 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.