|
|
@@ -37,6 +37,7 @@ const Index = () => { |
|
|
const [paymentData, setPaymentData] = React.useState({}); |
|
|
const [paymentData, setPaymentData] = React.useState({}); |
|
|
const [onReady, setOnReady] = React.useState(false); |
|
|
const [onReady, setOnReady] = React.useState(false); |
|
|
|
|
|
|
|
|
|
|
|
const [responeData, setResponeDataData] = React.useState({}); |
|
|
const [fpsTransctionData, setFpsTransctionData] = React.useState({}); |
|
|
const [fpsTransctionData, setFpsTransctionData] = React.useState({}); |
|
|
const [fpsmerchanttimeoutdatetime, setFpsmerchanttimeoutdatetime] = React.useState(""); |
|
|
const [fpsmerchanttimeoutdatetime, setFpsmerchanttimeoutdatetime] = React.useState(""); |
|
|
|
|
|
|
|
|
@@ -76,9 +77,16 @@ const Index = () => { |
|
|
} |
|
|
} |
|
|
}, [paymentData]); |
|
|
}, [paymentData]); |
|
|
|
|
|
|
|
|
|
|
|
React.useEffect(() => { |
|
|
|
|
|
console.log(responeData) |
|
|
|
|
|
if(Object.keys(responeData).length > 0 && fpsmerchanttimeoutdatetime!=""){ |
|
|
|
|
|
setFpsTransctionData(responeData) |
|
|
|
|
|
} |
|
|
|
|
|
}, [responeData]); |
|
|
|
|
|
|
|
|
React.useEffect(() => { |
|
|
React.useEffect(() => { |
|
|
console.log(fpsTransctionData) |
|
|
console.log(fpsTransctionData) |
|
|
if(Object.keys(fpsTransctionData).length > 0 && fpsmerchanttimeoutdatetime!=""){ |
|
|
|
|
|
|
|
|
if(Object.keys(fpsTransctionData).length > 0 ){ |
|
|
setOnReady(true); |
|
|
setOnReady(true); |
|
|
currentTimer.current = setInterval(() => { |
|
|
currentTimer.current = setInterval(() => { |
|
|
setTime((prevTime) => prevTime + 1); |
|
|
setTime((prevTime) => prevTime + 1); |
|
|
@@ -126,7 +134,7 @@ const Index = () => { |
|
|
"fpsqrcodeurl": "<fpsqrcodeurl>" |
|
|
"fpsqrcodeurl": "<fpsqrcodeurl>" |
|
|
} |
|
|
} |
|
|
*/ |
|
|
*/ |
|
|
setFpsTransctionData(responseData) |
|
|
|
|
|
|
|
|
setResponeDataData(responseData) |
|
|
const timeoutdatetime = responseData.fpsmerchanttimeoutdatetime |
|
|
const timeoutdatetime = responseData.fpsmerchanttimeoutdatetime |
|
|
const convertedDateString = timeoutdatetime.replace("[UTC]", ""); |
|
|
const convertedDateString = timeoutdatetime.replace("[UTC]", ""); |
|
|
setFpsmerchanttimeoutdatetime(convertedDateString) |
|
|
setFpsmerchanttimeoutdatetime(convertedDateString) |
|
|
@@ -143,9 +151,8 @@ const Index = () => { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const getPaymentStatus = () => { |
|
|
const getPaymentStatus = () => { |
|
|
console.log(fpsTransctionData.paymentstatuscode) |
|
|
|
|
|
HttpUtils.post({ |
|
|
HttpUtils.post({ |
|
|
url: paymentPath+paymentStatusApi+fpsTransctionData.transactionid, |
|
|
|
|
|
|
|
|
url: paymentPath+paymentStatusApi+paymentData.transactionid, |
|
|
params:{ |
|
|
params:{ |
|
|
"apprefid": paymentData.transactionid, |
|
|
"apprefid": paymentData.transactionid, |
|
|
"webtoken": paymentData.webtoken, |
|
|
"webtoken": paymentData.webtoken, |
|
|
@@ -155,7 +162,7 @@ const Index = () => { |
|
|
if (paymentstatuscode != "" && paymentstatuscode != "INPR" ){ |
|
|
if (paymentstatuscode != "" && paymentstatuscode != "INPR" ){ |
|
|
if (paymentstatuscode === 'APPR') { |
|
|
if (paymentstatuscode === 'APPR') { |
|
|
const timestamp = Date.now(); |
|
|
const timestamp = Date.now(); |
|
|
navigate('/payment/fps/ackpage', {state:{transactionDateTime:timestamp,transactionid:paymentData.transactionid,webtoken:paymentData.webtoken, paymentid:paymentid} }); |
|
|
|
|
|
|
|
|
navigate('/payment/fps/ackpage', {state:{transactionDateTime:timestamp,transactionid:paymentData.transactionid,webtoken:paymentData.webtoken, paymentid:responseData.paymentdetail.paymentid} }); |
|
|
} else if (paymentstatuscode === 'CANC') { |
|
|
} else if (paymentstatuscode === 'CANC') { |
|
|
// window.top.location.href = paymentPath + payment.config.indexPagePath; |
|
|
// window.top.location.href = paymentPath + payment.config.indexPagePath; |
|
|
navigate('/payment'); |
|
|
navigate('/payment'); |
|
|
@@ -167,7 +174,7 @@ const Index = () => { |
|
|
}, |
|
|
}, |
|
|
onError: function(){ |
|
|
onError: function(){ |
|
|
cancelPayment() |
|
|
cancelPayment() |
|
|
clearInterval(currentTimer.current); |
|
|
|
|
|
|
|
|
// clearInterval(currentTimer.current); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
@@ -176,10 +183,13 @@ const Index = () => { |
|
|
const timeOutDate = new Date(fpsmerchanttimeoutdatetime); |
|
|
const timeOutDate = new Date(fpsmerchanttimeoutdatetime); |
|
|
const currentTime = new Date; |
|
|
const currentTime = new Date; |
|
|
console.log(time) |
|
|
console.log(time) |
|
|
|
|
|
console.log(timeOutDate) |
|
|
|
|
|
console.log(currentTime) |
|
|
getPaymentStatus(); |
|
|
getPaymentStatus(); |
|
|
if (timeOutDate.getTime()<currentTime.getTime()){ |
|
|
if (timeOutDate.getTime()<currentTime.getTime()){ |
|
|
console.log("stop"); |
|
|
console.log("stop"); |
|
|
clearInterval(currentTimer.current); |
|
|
clearInterval(currentTimer.current); |
|
|
|
|
|
cancelPayment() |
|
|
} |
|
|
} |
|
|
},[time]) |
|
|
},[time]) |
|
|
|
|
|
|
|
|
|