diff --git a/src/pages/Payment/FPS/FPS.js b/src/pages/Payment/FPS/FPS.js index cdd70e8..492ac8b 100644 --- a/src/pages/Payment/FPS/FPS.js +++ b/src/pages/Payment/FPS/FPS.js @@ -41,8 +41,8 @@ const Index = () => { const [fpsTransctionData, setFpsTransctionData] = React.useState({}); const [fpsmerchanttimeoutdatetime, setFpsmerchanttimeoutdatetime] = React.useState(""); const [timeDownCount, setTimeDownCount] = React.useState(0); - - // const [fpsqrcodeurl, setFpsqrcodeurl] = React.useState(""); + const [paymentId, setPaymentId] = React.useState(""); + const [fpsqrcodeurl, setFpsqrcodeurl] = React.useState(""); // const pasgPath = 'https://fps.payapps.hkicl.com.hk'; //PRD // const pasgPath = 'https://sim.fps.payapps.hkicl.com.hk'; //Testing const loadPaymentUrl = "/api/payment/wallet/fps"; @@ -50,7 +50,9 @@ const Index = () => { 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); @@ -60,6 +62,13 @@ const Index = () => { if(Object.keys(location.state).length > 0){ console.log (location.state) 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()); + } else { + console.log('Desktop web browser'); + } } }, []); @@ -89,6 +98,7 @@ const Index = () => { // console.log(fpsTransctionData) if(Object.keys(fpsTransctionData).length > 0 ){ setOnReady(true); + setPaymentId(fpsTransctionData.paymentid) currentTimer.current = setInterval(() => { setTime((prevTime) => prevTime + 1); }, 1000); @@ -146,11 +156,9 @@ const Index = () => { setFpsmerchanttimeoutdatetime(convertedDateString) // const parsedUrl = new URL(responseData.fpsqrcodeurl); // const fpsqrcodeurl = parsedUrl.pathname; - // const openPASGUrl = pasgPath + '?pay_req_obj=' + encodeURIComponent(responseData.fpsqrcodeurl) + '&callback=' - // + encodeURIComponent(paymentPath + payment.config.fpscallbackPage); - // setFpsqrcodeurl(openPASGUrl) - - + const openPASGUrl = pasgPath + '?pay_req_obj=' + encodeURIComponent(responseData.fpsqrcodeurl) + '&callback=' + + encodeURIComponent("https://"+window.location.hostname+ '/paymentPage/fps/ackpage'); + setFpsqrcodeurl(openPASGUrl) } }); @@ -220,6 +228,10 @@ const Index = () => { } } + const mobliePayment = ()=>{ + window.location.assign(fpsqrcodeurl); + } + return ( !onReady ? @@ -252,7 +264,7 @@ const Index = () => {
QR Code
- {fpsTransctionData.paymentdetails?.paymentid} + {paymentId}
二維碼有效期限3分鐘
@@ -260,7 +272,18 @@ const Index = () => {
{"剩餘時間:"+timeDownCount} - + + + + : + + 請掃描以下二維碼 +
+ QR Code +
+ {paymentId} +
+ 二維碼有效期限3分鐘 +
+ 請在規定時間內完成付款流程 +
+ {"剩餘時間:"+timeDownCount} +
+ } + + + + + + + + {/*row 2*/} + + ) + + + ); +}; + +export default Index; diff --git a/src/routes/LoginRoutes.js b/src/routes/LoginRoutes.js index 0b8a977..feca500 100644 --- a/src/routes/LoginRoutes.js +++ b/src/routes/LoginRoutes.js @@ -20,7 +20,7 @@ const IAmSmart_RegistryCallback = Loadable(lazy(() => import('pages/iAmSmart/Reg //TODO: this page for testing only, please remove at prod const TestMailPage = Loadable(lazy(() => import('pages/pnspsNotifyTest'))); const VerifyPage = Loadable(lazy(() => import('pages/authentication/Verify'))); - +const Testfps = Loadable(lazy(() => import('pages/Payment/FPS/FPSTest'))); // ==============================|| AUTH ROUTING ||============================== // const LoginRoutes = { @@ -78,6 +78,10 @@ const LoginRoutes = { { path: 'verify/:verifyCode/:email', element: + }, + { + path: 'testfps', + element: } ] };