diff --git a/src/assets/images/icons/expiredQrcode.png b/src/assets/images/icons/expiredQrcode.png new file mode 100644 index 0000000..b8bd622 Binary files /dev/null and b/src/assets/images/icons/expiredQrcode.png differ diff --git a/src/pages/Payment/FPS/FPS.js b/src/pages/Payment/FPS/FPS.js index 7f87c2b..4107c69 100644 --- a/src/pages/Payment/FPS/FPS.js +++ b/src/pages/Payment/FPS/FPS.js @@ -10,6 +10,7 @@ import * as HttpUtils from "utils/HttpUtils"; import * as UrlUtils from "utils/ApiPathConst"; import { useNavigate } from "react-router-dom"; import FpsIcon from "assets/images/icons/fps.svg"; +import expiredQrcode from "assets/images/icons/expiredQrcode.png"; import { useLocation } from 'react-router-dom'; // import {paymentPath} from "auth/utils"; import {currencyFormat} from "utils/FormatUtils"; @@ -30,6 +31,7 @@ const BackgroundHead = { backgroundPosition: 'right' } + // ==============================|| DASHBOARD - DEFAULT ||============================== // const Index = () => { @@ -39,6 +41,8 @@ const Index = () => { const [locationData, setLocationData] = React.useState({}); const [paymentData, setPaymentData] = React.useState({}); const [onReady, setOnReady] = React.useState(false); + const [qrCodeTimeout, setqrCodeTimeout] = React.useState(false); + const [paymentStatusCode, setPaymentStatusCode] = React.useState(""); const [responeData, setResponeDataData] = React.useState({}); const [fpsTransctionData, setFpsTransctionData] = React.useState({}); @@ -241,6 +245,7 @@ const Index = () => { }, onSuccess: function(responseData){ const paymentstatuscode = responseData.paymentdetail.result.paymentstatuscode; + setPaymentStatusCode(paymentstatuscode) if (paymentstatuscode != "" && paymentstatuscode != "INPR" ){ if (paymentstatuscode === 'APPR') { // const timestamp = Date.now(); @@ -279,26 +284,30 @@ const Index = () => { if (timeOutDate.getTime(){ if (Object.keys(paymentData).length>0){ - HttpUtils.post({ - url: UrlUtils.CANCEL_PAYMENT_URL, - params:{ - "transactionid": paymentData.transactionid, - "webtoken": paymentData.webtoken, - "paymentid": fpsTransctionData.paymentid - }, - onSuccess: function(){ - // navigate('/paymentPage/fps/ackpage'); - let page = '/paymentPage/fps/ackpage'; - let stateParams = { state: { transactionid: paymentData.transactionid} } - navigate(page, stateParams); - } - }); + getPaymentStatus() + if (paymentStatusCode === "INPR"){ + HttpUtils.post({ + url: UrlUtils.CANCEL_PAYMENT_URL, + params:{ + "transactionid": paymentData.transactionid, + "webtoken": paymentData.webtoken, + "paymentid": fpsTransctionData.paymentid + }, + onSuccess: function(){ + // navigate('/paymentPage/fps/ackpage'); + let page = '/paymentPage/fps/ackpage'; + let stateParams = { state: { transactionid: paymentData.transactionid} } + navigate(page, stateParams); + } + }); + } } } @@ -389,7 +398,11 @@ const Index = () => {
- QR Code + { + !qrCodeTimeout? + QR Code + :Expired QR Code + }
{"["+paymentId+"]"}