|
|
@@ -13,7 +13,7 @@ import * as UrlUtils from "utils/ApiPathConst"; |
|
|
|
// import { useNavigate } from "react-router-dom"; |
|
|
|
// import FpsIcon from "assets/images/icons/fps.svg"; |
|
|
|
// import { useLocation } from 'react-router-dom'; |
|
|
|
import {paymentPath} from "auth/utils"; |
|
|
|
// import {paymentPath} from "auth/utils"; |
|
|
|
// import {poll} from "utils/Utils"; |
|
|
|
import * as DateUtils from "utils/DateUtils" |
|
|
|
|
|
|
@@ -50,7 +50,8 @@ const Fpscallback = () => { |
|
|
|
// const [transactionDate, setTransactionDate] = React.useState(""); |
|
|
|
// const [transactionTime, setTransactionTime] = React.useState(""); |
|
|
|
const [onReady, setOnReady] = React.useState(false); |
|
|
|
const paymentStatusApi = "/api/payment/status/"; |
|
|
|
// const paymentStatusApi = "/api/payment/status/"; |
|
|
|
const [onDownload, setOnDownload] = React.useState(false); |
|
|
|
|
|
|
|
|
|
|
|
React.useEffect(() => { |
|
|
@@ -83,7 +84,7 @@ const Fpscallback = () => { |
|
|
|
console.log(paymentId) |
|
|
|
|
|
|
|
HttpUtils.post({ |
|
|
|
url: paymentPath+paymentStatusApi+transactionid, |
|
|
|
url: UrlUtils.PAYMENT_STATUS_API+transactionid, |
|
|
|
params:{ |
|
|
|
"apprefid": transactionid, |
|
|
|
"webtoken": webtoken, |
|
|
@@ -109,34 +110,68 @@ const Fpscallback = () => { |
|
|
|
responseData2.data["transTimeStr"] = DateUtils.dateFormat(responseData2.data.transDateTime, "HH:mm:ss"); |
|
|
|
setItemList(responseData2.paymentItemList) |
|
|
|
setPaymentData(responseData2.data); |
|
|
|
localStorage.removeItem("paymentId"); |
|
|
|
// localStorage.removeItem("paymentId"); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
// setTransactionData( |
|
|
|
// { |
|
|
|
// "amount": 999.99, |
|
|
|
// "currencycode": "HKD", |
|
|
|
// "paymentdetail": { |
|
|
|
// "attemptno": 1, |
|
|
|
// "channel": "MobileWallet", |
|
|
|
// "paymentid": "C202310268000681", |
|
|
|
// "paymentmethod": "04", |
|
|
|
// "result": { |
|
|
|
// "canretry": "Y", |
|
|
|
// "description": "CANC - Cancelled by user or Payment Server.", |
|
|
|
// "paymentstatuscode": "CANC", |
|
|
|
// "rejectreasoncode": "Payment Cancelled. [PAY-E-9022]" |
|
|
|
// }, |
|
|
|
// "subtype": "FPS", |
|
|
|
// "time": "2023-10-26T09:02:17Z[UTC]" |
|
|
|
// const responseData = { |
|
|
|
// "amount": 999.99, |
|
|
|
// "currencycode": "HKD", |
|
|
|
// "paymentdetail": { |
|
|
|
// "attemptno": 1, |
|
|
|
// "channel": "MobileWallet", |
|
|
|
// "paymentid": "C202310268000681", |
|
|
|
// "paymentmethod": "04", |
|
|
|
// "result": { |
|
|
|
// "canretry": "Y", |
|
|
|
// "description": "APPR - Cancelled by user or Payment Server.", |
|
|
|
// "paymentstatuscode": "APPR", |
|
|
|
// "rejectreasoncode": "Payment Cancelled. [PAY-E-9022]" |
|
|
|
// }, |
|
|
|
// "transactionid": "20231026170103921" |
|
|
|
// "subtype": "FPS", |
|
|
|
// "time": "2023-10-26T09:02:17Z" |
|
|
|
// }, |
|
|
|
// "transactionid": "test0001" |
|
|
|
// } |
|
|
|
// setResponeDataData(responseData) |
|
|
|
|
|
|
|
// HttpUtils.post({ |
|
|
|
// url: UrlUtils.PAYMENT_SAVE, |
|
|
|
// params: { |
|
|
|
// id: paymentId, |
|
|
|
// transNo: responseData.transactionid, |
|
|
|
// transDateTime: new Date(responseData.paymentdetail.time).toISOString(), |
|
|
|
// egisRefNo: responseData.paymentdetail.paymentid, |
|
|
|
// status: responseData.paymentdetail.result.paymentstatuscode, |
|
|
|
// payload: responseData |
|
|
|
// }, |
|
|
|
// onSuccess: function (responseData2) { |
|
|
|
// responseData2.data["transDateStr"] = DateUtils.dateFormat(responseData2.data.transDateTime, "DD/MM/YYYY"); |
|
|
|
// responseData2.data["transTimeStr"] = DateUtils.dateFormat(responseData2.data.transDateTime, "HH:mm:ss"); |
|
|
|
// setItemList(responseData2.paymentItemList) |
|
|
|
// setPaymentData(responseData2.data); |
|
|
|
// localStorage.removeItem("paymentId"); |
|
|
|
// } |
|
|
|
// ) |
|
|
|
// }); |
|
|
|
} |
|
|
|
|
|
|
|
const doPrint = () => { |
|
|
|
const params = new URLSearchParams(window.location.search); |
|
|
|
// window.print(); |
|
|
|
setOnDownload(true) |
|
|
|
HttpUtils.fileDownload({ |
|
|
|
url: UrlUtils.GEN_PAYMENT_RECEIPT+"/"+params.get("PAYMENT_ID"), |
|
|
|
onResponse:()=>{ |
|
|
|
setOnDownload(false) |
|
|
|
}, |
|
|
|
onError:()=>{ |
|
|
|
setOnDownload(false) |
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
return ( |
|
|
|
!onReady ? |
|
|
|
<Grid container sx={{ minHeight: '87vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center"> |
|
|
@@ -146,9 +181,13 @@ const Fpscallback = () => { |
|
|
|
</Grid> |
|
|
|
: |
|
|
|
transactionData.paymentdetail?.result?.paymentstatuscode === "APPR" ? |
|
|
|
( |
|
|
|
<Grid container sx={{ minHeight: '110vh', backgroundColor: '#fff' }} direction="column" justifyContent="flex-start" alignItems="center" > |
|
|
|
<Grid item xs={12} width="100%"> |
|
|
|
( |
|
|
|
<div> |
|
|
|
<style> |
|
|
|
{`@media print {.printHidden{display: none;} .printOrder{order:-1 !important;}`} |
|
|
|
</style> |
|
|
|
<Grid container className="printheight" sx={{ minHeight: '80%', backgroundColor: '#fff' }} direction="column" justifyContent="flex-start" alignItems="center"> |
|
|
|
<Grid className="printHidden" item xs={12} width="100%"> |
|
|
|
<div style={BackgroundHead} width="100%"> |
|
|
|
<Stack direction="row" height='70px'> |
|
|
|
<Typography ml={15} color='#FFF' variant="h4" sx={{ pt: 2 }}> |
|
|
@@ -158,51 +197,45 @@ const Fpscallback = () => { |
|
|
|
</div> |
|
|
|
</Grid> |
|
|
|
{/*row 1*/} |
|
|
|
<Grid item xs={12} md={12} > |
|
|
|
<Grid container justifyContent="flex-start" alignItems="center" > |
|
|
|
<center> |
|
|
|
<Grid item xs={12} md={12} > |
|
|
|
|
|
|
|
<Typography variant="h3" sx={{ ml: 8, mt: 4, mr: 8, textAlign: "center" }}> |
|
|
|
您的申請和付款已收到 |
|
|
|
</Typography> |
|
|
|
|
|
|
|
<Grid container> |
|
|
|
<Grid item xs={12} md={12} sx={{ textAlign: "center" }}> |
|
|
|
<Grid container justifyContent="center" spacing={2} sx={{ p: 2 }} alignitems="stretch" > |
|
|
|
<Grid item xs={12} md={5} sx={{ pt: 1, pb: 2 }} style={{ height: '100%' }}> |
|
|
|
<Box xs={12} md={12} sx={{ border: '3px solid #eee', borderRadius: '10px' }} > |
|
|
|
<DataGrid |
|
|
|
recordList={itemList} |
|
|
|
/> |
|
|
|
</Box> |
|
|
|
</Grid> |
|
|
|
<Grid item xs={12} md={5} sx={{ pt: 2 }} style={{ height: '100%' }}> |
|
|
|
<Box xs={12} md={12} sx={{ border: '3px solid #eee', borderRadius: '10px' }} > |
|
|
|
<PaymentDetails |
|
|
|
formData={paymentData} |
|
|
|
style={{ |
|
|
|
display: "flex", |
|
|
|
height: "100%", |
|
|
|
flex: 1 |
|
|
|
}} |
|
|
|
/> |
|
|
|
</Box> |
|
|
|
</Grid> |
|
|
|
</Grid> |
|
|
|
</Grid> |
|
|
|
|
|
|
|
</Grid> |
|
|
|
</Grid> |
|
|
|
</center> |
|
|
|
<Grid item xs={12} md={12} spacing={2} sx={{ textAlign: "center" }}> |
|
|
|
<Typography variant="h3" sx={{ ml: 8, mt: 4, mr: 8, textAlign: "center" }}> |
|
|
|
您的申請和付款已收到 |
|
|
|
</Typography> |
|
|
|
<Grid container justifyContent="center" direction="column" spacing={2} sx={{ p: 2 }} alignitems="stretch" > |
|
|
|
<Grid item className="printOrder" xs={12} md={12} sx={{ pt: 2 }} style={{ height: '100%', order: 1 }}> |
|
|
|
<Box xs={12} md={12} sx={{ border: '3px solid #eee', borderRadius: '10px' }} > |
|
|
|
<PaymentDetails |
|
|
|
formData={paymentData} |
|
|
|
doPrint={doPrint} |
|
|
|
onDownload={onDownload} |
|
|
|
style={{ |
|
|
|
display: "flex", |
|
|
|
height: "100%", |
|
|
|
flex: 1 |
|
|
|
}} |
|
|
|
/> |
|
|
|
</Box> |
|
|
|
</Grid> |
|
|
|
<Grid item xs={12} md={12} sx={{ pt: 1, pb: 2 }} style={{ height: '100%', order: 2 }}> |
|
|
|
<Box xs={12} md={12} sx={{ border: '3px solid #eee', borderRadius: '10px' }} > |
|
|
|
<DataGrid |
|
|
|
recordList={itemList} |
|
|
|
/> |
|
|
|
</Box> |
|
|
|
</Grid> |
|
|
|
</Grid> |
|
|
|
</Grid> |
|
|
|
{/*row 2*/} |
|
|
|
</Grid > |
|
|
|
) : |
|
|
|
(transactionData.paymentdetail?.result?.paymentstatuscode === "CANC" ? |
|
|
|
<Grid container sx={{ minHeight: '110vh', backgroundColor: '#fff' }} direction="column" justifyContent="flex-start" alignItems="center" > |
|
|
|
<Grid item xs={12} width="100%"> |
|
|
|
</div> |
|
|
|
) : |
|
|
|
(transactionData.paymentdetail?.result?.paymentstatuscode === "CANC" ? |
|
|
|
<div> |
|
|
|
<style> |
|
|
|
{`@media print {.printHidden{display: none;} .printOrder{order:-1 !important;}`} |
|
|
|
</style> |
|
|
|
<Grid container className="printheight" sx={{ minHeight: '80%', backgroundColor: '#fff' }} direction="column" justifyContent="flex-start" alignItems="center" > |
|
|
|
<Grid className="printHidden" item xs={12} width="100%"> |
|
|
|
<div style={BackgroundHead} width="100%"> |
|
|
|
<Stack direction="row" height='70px'> |
|
|
|
<Typography ml={15} color='#FFF' variant="h4" sx={{ pt: 2 }}> |
|
|
@@ -239,9 +272,14 @@ const Fpscallback = () => { |
|
|
|
</Grid> |
|
|
|
{/*row 2*/} |
|
|
|
</Grid > |
|
|
|
: |
|
|
|
<Grid container sx={{ minHeight: '110vh', backgroundColor: '#fff' }} direction="column" justifyContent="flex-start" alignItems="center" > |
|
|
|
<Grid item xs={12} width="100%"> |
|
|
|
</div> |
|
|
|
: |
|
|
|
<div> |
|
|
|
<style> |
|
|
|
{`@media print {.printHidden{display: none;} .printOrder{order:-1 !important;}`} |
|
|
|
</style> |
|
|
|
<Grid container className="printheight" sx={{ minHeight: '80%', backgroundColor: '#fff' }}direction="column" justifyContent="flex-start" alignItems="center" > |
|
|
|
<Grid className="printHidden" item xs={12} width="100%"> |
|
|
|
<div style={BackgroundHead} width="100%"> |
|
|
|
<Stack direction="row" height='70px'> |
|
|
|
<Typography ml={15} color='#FFF' variant="h4" sx={{ pt: 2 }}> |
|
|
@@ -284,7 +322,8 @@ const Fpscallback = () => { |
|
|
|
</Grid> |
|
|
|
{/*row 2*/} |
|
|
|
</Grid > |
|
|
|
) |
|
|
|
</div> |
|
|
|
) |
|
|
|
); |
|
|
|
}; |
|
|
|
|
|
|
|