From 0ad449272651403394a17becb6f8022fd0bff4e8 Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Fri, 8 Dec 2023 18:03:18 +0800 Subject: [PATCH] careOf and fps update --- src/pages/Payment/FPS/FPS.js | 70 ++++++++++--------- .../ApplyForm/PublicNoticeApplyForm.js | 13 +++- 2 files changed, 48 insertions(+), 35 deletions(-) diff --git a/src/pages/Payment/FPS/FPS.js b/src/pages/Payment/FPS/FPS.js index 492ac8b..f57b225 100644 --- a/src/pages/Payment/FPS/FPS.js +++ b/src/pages/Payment/FPS/FPS.js @@ -43,16 +43,18 @@ const Index = () => { const [timeDownCount, setTimeDownCount] = React.useState(0); const [paymentId, setPaymentId] = React.useState(""); const [fpsqrcodeurl, setFpsqrcodeurl] = React.useState(""); + const [browserType, setBrowserType] = React.useState(""); + const mobileBrowser = "Mobile"; + const desktopBrowser = "Desktop"; + // const pasgPath = 'https://fps.payapps.hkicl.com.hk'; //PRD - // const pasgPath = 'https://sim.fps.payapps.hkicl.com.hk'; //Testing + const pasgPath = 'https://sim.fps.payapps.hkicl.com.hk'; //Testing const loadPaymentUrl = "/api/payment/wallet/fps"; const cancelPaymentUrl = "/api/payment/cancelpayment"; const paymentStatusApi = "/api/payment/status/"; // const payloadUrl = "/api/payment/wallet/fps/enquiryfpspayload/"; // const receiverUrl = "/noti-api/payment/payment-notification"; - const pasgPath = 'https://sim.fps.payapps.hkicl.com.hk'; //Testing - // const pasgPath = 'https://fps.payapps.hkicl.com.hk'; //PRD - + //timer const currentTimer = React.useRef(); const [time, setTime] = React.useState(0); @@ -64,10 +66,10 @@ const Index = () => { setLocationData(location.state) if (/Android|webOS|iPhone|iPad|iPod|Opera Mini/i.test(navigator.userAgent)) { console.log('Mobile web browser'); - console.log(openPASGUrl) - // renderOpenFPSPaymentAppTemplate(openPASGUrl, $('#openFPSPaymentAppTemplate').html()); + setBrowserType(mobileBrowser) } else { console.log('Desktop web browser'); + setBrowserType(desktopBrowser) } } }, []); @@ -97,11 +99,11 @@ const Index = () => { React.useEffect(() => { // console.log(fpsTransctionData) if(Object.keys(fpsTransctionData).length > 0 ){ - setOnReady(true); setPaymentId(fpsTransctionData.paymentid) currentTimer.current = setInterval(() => { setTime((prevTime) => prevTime + 1); }, 1000); + setOnReady(true); return () => clearInterval(currentTimer.current); } }, [fpsTransctionData]); @@ -258,32 +260,34 @@ const Index = () => {
{"$HK " + paymentData.amount} - - - 請掃描以下二維碼 -
- QR Code -
- {paymentId} -
- 二維碼有效期限3分鐘 -
- 請在規定時間內完成付款流程 -
- {"剩餘時間:"+timeDownCount} -
- - - + {browserType==mobileBrowser? + + + + : + + 請掃描以下二維碼 +
+ QR Code +
+ {paymentId} +
+ 二維碼有效期限3分鐘 +
+ 請在規定時間內完成付款流程 +
+ {"剩餘時間:"+timeDownCount} +
+ }