diff --git a/src/pages/Payment/Card/index.js b/src/pages/Payment/Card/index.js index 0874998..8723459 100644 --- a/src/pages/Payment/Card/index.js +++ b/src/pages/Payment/Card/index.js @@ -52,22 +52,18 @@ const Index = () => { // const payloadUrl = "/api/payment/wallet/fps/enquiryfpspayload/"; // const receiverUrl = "/noti-api/payment/payment-notification"; - //timer - const currentTimer = React.useRef(); - const [time, setTime] = React.useState(0); - React.useEffect(() => { if (location.state != undefined) { setPaymentData(location.state) } - loadForm(); - currentTimer.current = setInterval(() => { - getPaymentStatus(); - setTime((prevTime) => prevTime + 1); - }, 500); - return () => clearInterval(currentTimer.current); }, []); + React.useEffect(() => { + if (Object.keys(paymentData).length > 0){ + loadForm(); + } + }, [paymentData]); + React.useEffect(() => { setOnReady(true); }, [redirecturl]); @@ -115,32 +111,6 @@ const Index = () => { }); } - const getPaymentStatus = () => { - - // HttpUtils.post({ - // url: paymentPath+paymentStatusApi+paymentid, - // params:{ - // "apprefid": paymentData.transactionid, - // "webtoken": paymentData.webtoken, - // }, - // onSuccess: function(responseData){ - // const paymentstatuscode = responseData.paymentdetail.result.paymentstatuscode; - // if (paymentstatuscode === 'APPR') { - // const timestamp = '?t=' + Date.now(); - // window.top.location.href = paymentPath + payment.config.ackPagePath + timestamp; - // } else if (paymentstatuscode === 'CANC') { - // window.top.location.href = paymentPath + payment.config.indexPagePath; - // } else { - // window.top.location.href = paymentPath + payment.config.errPagePath; - // } - // }, - // onError: function(){ - // cancelPayment() - // clearInterval(currentTimer.current); - // } - // }); - }; - React.useEffect(() => { const timeOutDate = new Date(fpsmerchanttimeoutdatetime); const currentTime = new Date; @@ -164,34 +134,6 @@ const Index = () => { }); } - // const getPayload = ()=>{ - // HttpUtils.get({ - // url: payloadUrl+"", - // onSuccess: function(responseData){ - // /* - // { - // "payload": "" - // } - - // */ - // } - // }); - // } - - // const getReceiver = ()=>{ - // HttpUtils.get({ - // url: receiverUrl+"", - // onSuccess: function(responseData){ - // /* - // { - // "payload": "" - // } - - // */ - // } - // }); - // } - const getIcon = () => { if(paymentData.type=="Visa") return VisaIcon; if(paymentData.type=="Mastercard") return MasterIcon;