1import{r as a,j as t}from"./react-DjP1ANNA.js";import{i as C,O as S,P as A}from"./index-BVgXFSN9.js";import"./@babel-DLSbV39L.js";import"./react-dom-CH1r7ODx.js";import"./react-redux-CvGH35IU.js";import"./use-sync-external-store-Bv2BUH2l.js";import"./react-router-dom-B-I8Kkrm.js";import"./react-router-BLLygtAF.js";import"./@remix-run-yqlN7Vj_.js";import"./axios-BimPEqV4.js";import"./redux-BECV-Nlq.js";import"./@mui-Cpwdqv5S.js";import"./react-is-DcfIKM1A.js";import"./clsx-B-dksMZM.js";import"./react-transition-group-CxNLX-ix.js";import"./@emotion-BMnXlmzl.js";import"./hoist-non-react-statics-B-49tuQ9.js";import"./stylis-FDnFs_-n.js";import"./@popperjs-BQBsAJpH.js";import"./jss-CFGRwE_1.js";import"./is-in-browser-I-S1O4Zl.js";import"./jss-plugin-rule-value-function-BFRIntEn.js";import"./jss-plugin-global-BYzrZYyJ.js";import"./jss-plugin-nested-D_ejpMkQ.js";import"./jss-plugin-camel-case-B3itHn0h.js";import"./hyphenate-style-name-HOLnhz8K.js";import"./jss-plugin-default-unit-DI8ZotHi.js";import"./jss-plugin-vendor-prefixer-CJNl0PRb.js";import"./css-vendor-DxT3DpbQ.js";import"./jss-plugin-props-sort-D2CdvUsV.js";import"./redux-persist-C5kDgR2m.js";import"./@reduxjs-Cpep842i.js";import"./redux-thunk-ClJT1hhx.js";import"./socket.io-client-BGdex47s.js";import"./engine.io-client-BY_6WtMP.js";import"./engine.io-parser-BiEtp6m2.js";import"./@socket.io-Dkula2eQ.js";import"./socket.io-parser-BBkuslX-.js";import"./react-helmet-async-BK4tB33I.js";import"./react-fast-compare-CbukUWDo.js";import"./invariant-CvSiY3tr.js";import"./shallowequal--AeqoEPp.js";import"./react-ga4-vDwhweBP.js";import"./jspdf-BNIpv04V.js";import"./fflate-EnPhvkmS.js";import"./react-toastify-mV4AXyxU.js";import"./@lottiefiles-BW4ya4wF.js";import"./crypto-js-BQRu_zAZ.js";import"./@e965-BR7518fZ.js";import"./styled-components-Cz_yWE8X.js";import"./react-infinite-scroll-component-zxdVSlM8.js";import"./react-chat-elements-DcSu28hc.js";import"./dompurify-Bq0E5Q3l.js";import"./emoji-picker-react-C8AahYtu.js";import"./flairup-CpvKgcza.js";import"./react-hook-form-BGrmxbtY.js";import"./otp-input-react-d_JYOq3_.js";import"./react-select-CV5rslID.js";import"./@floating-ui-D6mDMy8Y.js";import"./use-isomorphic-layout-effect-f5bfSEtN.js";import"./memoize-one-BdPwpGay.js";import"./dayjs-ByzvYeBt.js";import"./jszip-BlU_Vd2G.js";import"./file-saver-B72EZ2em.js";import"./react-to-print-Y8s0l9m2.js";import"./html2canvas-CBrSDip1.js";import"./@react-google-maps-mug9B72a.js";import"./lodash-pQOYHdgg.js";import"./react-simple-typewriter-ldWg-Jcc.js";import"./react-circular-progressbar-Bv_m6Qu3.js";import"./react-swipeable-views-Dinl_PID.js";import"./prop-types-BE-839HU.js";import"./warning-C20GYw-A.js";import"./react-swipeable-views-core-_gFpKrjL.js";import"./react-quill-BNkyPIyx.js";import"./quill-BGuB3LiM.js";import"./swiper-Br_ZBqpF.js";import"./react-responsive-carousel-4RjJB35h.js";import"./react-easy-swipe-hxMy2-lg.js";import"./classnames-DzlfNvT2.js";import"./@hookform-CWJHxq4r.js";import"./react-card-flip-DR_S2qIS.js";import"./react-cropper-Bexj_cHZ.js";import"./cropperjs-CH_N_9NM.js";import"./copy-to-clipboard-ljHEMGi2.js";import"./toggle-selection-BHUZwh74.js";import"./react-phone-number-input-B1gYhXcx.js";import"./libphonenumber-js-91HKQ04p.js";import"./input-format-DJEsyv6L.js";import"./country-flag-icons-D4lwPBzr.js";import"./react-scroll-8VRGKgkn.js";import"./lodash.throttle-C9QyS3WI.js";import"./react-hover-video-player-Czw9SE1t.js";/* empty css */import"./bootstrap-Dz-rzKL8.js";/* empty css */const P=({used:n})=>t.jsx("span",{style:{padding:"3px 10px",borderRadius:"12px",fontSize:"12px",fontWeight:600,background:n?"rgba(239,68,68,0.15)":"rgba(34,197,94,0.15)",color:n?"#f87171":"#4ade80"},children:n?"ð´ Already Used":"â
Refundable"}),ye=()=>{var j,b,_,v;const{successToast:n,errorToast:p,errorHandle:m}=C(),[d,c]=a.useState(""),[l,x]=a.useState(""),[u,f]=a.useState(!1),[h,y]=a.useState(!1),[i,s]=a.useState(null),X=async()=>{if(!d.trim()&&!l.trim()){p("Please provide a Razorpay Order ID or Payment ID");return}try{f(!0),s(null);const e={razorpay_order_id:d.trim()||void 0,razorpay_payment_id:l.trim()||void 0},r=await S(e);r!=null&&r.data?s(r.data):p((r==null?void 0:r.message)||"Could not fetch refund preview")}catch(e){m(e)}finally{f(!1)}},R=async()=>{var e;if(!(!i||i.refundableAmount<=0))try{y(!0);const r={razorpay_order_id:i.orderId,razorpay_payment_id:i.paymentId,refundAmount:i.refundableAmount},o=await A(r);(e=o==null?void 0:o.data)!=null&&e.refunded?(n(o.message||"Refund initiated successfully"),s(null),c(""),x("")):p((o==null?void 0:o.message)||"Refund failed. Please try again.")}catch(r){m(r)}finally{y(!1)}},g=i&&i.refundableAmount>0;return t.jsx("div",{className:"row",children:t.jsx("div",{className:"col-lg-12",children:t.jsx("main",{className:"profile_service_input__main",children:t.jsxs("section",{className:"footer_input__Section",children:[t.jsx("div",{className:"profile_service_input__title",children:"Refund Payment"}
1),t.jsxs("div",{style:{marginBottom:"16px"},children:[t.jsxs("div",{className:"display-flex-aic-jcsb margin_10_0",children:[t.jsx("label",{children:"Razorpay Order ID"}),t.jsx("input",{className:"textfield",placeholder:"order_XXXXXXXXXXXXX",value:d,onChange:e=>{c(e.target.value),s(null)}})]}),t.jsxs("div",{className:"display-flex-aic-jcsb margin_10_0",children:[t.jsx("label",{children:"Razorpay Payment ID"}),t.jsx("input",{className:"textfield",placeholder:"pay_XXXXXXXXXXXXX",value:l,onChange:e=>{x(e.target.value),s(null)}})]}),t.jsx("button",{className:"jpfiCard__six-btn-1 cp",onClick:X,disabled:u,style:{marginTop:"8px"},children:u?"Checking...":"Check Refundability"})]}),i&&t.jsxs("div",{style:{marginTop:"16px"},children:[t.jsxs("h4",{style:{color:"#d6dcdd",marginBottom:"12px"},children:["Refund Preview",t.jsxs("span",{style:{fontSize:"12px",marginLeft:"10px",color:"#94a3b8",fontWeight:400},children:["Order: ",i.orderId]})]}),t.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",marginBottom:"16px",fontSize:"13px",color:"#d6dcdd"},children:[t.jsx("thead",{children:t.jsxs("tr",{style:{borderBottom:"1px solid rgba(255,255,255,0.1)"},children:[t.jsx("th",{style:{textAlign:"left",padding:"8px 4px"},children:"Product"}),t.jsx("th",{style:{textAlign:"right",padding:"8px 4px"},children:"Amount (incl. GST)"}),t.jsx("th",{style:{textAlign:"center",padding:"8px 4px"},children:"Status"})]})}),t.jsx("tbody",{children:i.products.map((e,r)=>{var o;return t.jsxs("tr",{style:{borderBottom:"1px solid rgba(255,255,255,0.05)",opacity:e.used?.6:1},children:[t.jsx("td",{style:{padding:"8px 4px"},children:e.name}),t.jsxs("td",{style:{textAlign:"right",padding:"8px 4px"},children:["â¹",(o=e.productTotal)==null?void 0:o.toFixed(2)]}),t.jsx("td",{style:{textAlign:"center",padding:"8px 4px"},children:t.jsx(P,{used:e.used})})]},r)})})]}),t.jsxs("div",{style:{background:"rgba(255,255,255,0.05)",borderRadius:"8px",padding:"12px 16px",marginBottom:"16px",fontSize:"13px",color:"#d6dcdd"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"4px"},children:[t.jsx("span",{children:"Total Paid"}),t.jsxs("span",{children:["â¹",(j=i.totalPaid)==null?void 0:j.toFixed(2)]})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"4px",color:"#f87171"},children:[t.jsx("span",{children:"Non-Refundable (already used)"}),t.jsxs("span",{children:["â¹",(b=i.nonRefundableAmount)==null?void 0:b.toFixed(2)]})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontWeight:700,fontSize:"15px",color:g?"#4ade80":"#f87171",marginTop:"8px",borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"8px"},children:[t.jsx("span",{children:"Refundable Amount"}),t.jsxs("span",{children:["â¹",(_=i.refundableAmount)==null?void 0:_.toFixed(2)]})]})]}),g?t.jsx("button",{className:"jpfiCard__six-btn-1 cp",onClick:R,disabled:h,style:{background:"#16a34a",border:"none"},children:h?"Processing...":`Confirm & Refund â¹${(v=i.refundableAmount)==null?void 0:v.toFixed(2)}`}):t.jsx("p",{style:{color:"#f87171",fontWeight:600},children:"â ï¸ All products have been used. No refund is possible for this order."})]})]})})})})};export{ye 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.