| @@ -45,7 +45,7 @@ const Index = () => { | |||||
| const [fpsqrcodeurl, setFpsqrcodeurl] = React.useState(""); | const [fpsqrcodeurl, setFpsqrcodeurl] = React.useState(""); | ||||
| const [browserType, setBrowserType] = React.useState(""); | const [browserType, setBrowserType] = React.useState(""); | ||||
| const mobileBrowser = "Mobile"; | const mobileBrowser = "Mobile"; | ||||
| // const desktopBrowser = "Desktop"; | |||||
| const desktopBrowser = "Desktop"; | |||||
| // const pasgPath = 'https://fps.payapps.hkicl.com.hk'; //PRD | // 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 loadPaymentUrl = "/api/payment/wallet/fps"; | ||||
| @@ -67,11 +67,12 @@ const Index = () => { | |||||
| if (/Android|webOS|iPhone|iPad|iPod|Opera Mini/i.test(navigator.userAgent)) { | if (/Android|webOS|iPhone|iPad|iPod|Opera Mini/i.test(navigator.userAgent)) { | ||||
| console.log('Mobile web browser'); | console.log('Mobile web browser'); | ||||
| setBrowserType(mobileBrowser) | setBrowserType(mobileBrowser) | ||||
| setFpsqrcodeurl(openPASGUrl) | |||||
| console.log(openPASGUrl) | console.log(openPASGUrl) | ||||
| // renderOpenFPSPaymentAppTemplate(openPASGUrl, $('#openFPSPaymentAppTemplate').html()); | // renderOpenFPSPaymentAppTemplate(openPASGUrl, $('#openFPSPaymentAppTemplate').html()); | ||||
| } else { | } else { | ||||
| console.log('Desktop web browser'); | console.log('Desktop web browser'); | ||||
| setBrowserType(mobileBrowser) | |||||
| setBrowserType(desktopBrowser) | |||||
| const parsedUrl = new URL("http://127.0.0.1:8080/api/payment/wallet/fps/enquiryfpspayload/vm.JKDDlTOavR3ASviSwUnS1Lw4-"); | const parsedUrl = new URL("http://127.0.0.1:8080/api/payment/wallet/fps/enquiryfpspayload/vm.JKDDlTOavR3ASviSwUnS1Lw4-"); | ||||
| console.log(parsedUrl) | console.log(parsedUrl) | ||||
| const fpsqrcodeurl = parsedUrl.pathname; | const fpsqrcodeurl = parsedUrl.pathname; | ||||
| @@ -182,6 +182,20 @@ const AuthLoginCustom = () => { | |||||
| window.location.assign(url); | window.location.assign(url); | ||||
| } | } | ||||
| const openApp = () => { | |||||
| let callbackUrl = "https://"+iAmSmartCallbackPath()+"/iamsmart/authcallback"; | |||||
| let url = "hk.gov.iamsmart.testapp://" +"auth" | |||||
| + "?clientID=" + clientId | |||||
| + "&responseType=code" | |||||
| +"&source=" + getBowerType() | |||||
| +"&redirectURI="+encodeURIComponent(callbackUrl) | |||||
| +"&scope="+encodeURIComponent("eidapi_auth eidapi_profiles") | |||||
| +"&lang=zh-HK"//en-US, zh-HK, or zh-CN | |||||
| //+"&state=" | |||||
| +"&brokerPage=false" | |||||
| window.location.assign(url); | |||||
| } | |||||
| return ( | return ( | ||||
| <FormikProvider value={formik}> | <FormikProvider value={formik}> | ||||
| @@ -280,6 +294,11 @@ const AuthLoginCustom = () => { | |||||
| <Button onClick={()=>getQRWithIAmSmart()} color="iAmSmart" fullWidth size="large" variant="outlined" startIcon={<img src={iAmSmartICon} alt="iAM Smart" width="30" />}><Typography variant="h5">智方便登入</Typography></Button> | <Button onClick={()=>getQRWithIAmSmart()} color="iAmSmart" fullWidth size="large" variant="outlined" startIcon={<img src={iAmSmartICon} alt="iAM Smart" width="30" />}><Typography variant="h5">智方便登入</Typography></Button> | ||||
| </Stack> | </Stack> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={12}> | |||||
| <Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}> | |||||
| <Button onClick={()=>openApp()} color="iAmSmart" fullWidth size="large" variant="outlined" startIcon={<img src={iAmSmartICon} alt="iAM Smart" width="30" />}><Typography variant="h5">智方便登入(App)</Typography></Button> | |||||
| </Stack> | |||||
| </Grid> | |||||
| <Grid item xs={12}> | <Grid item xs={12}> | ||||
| <Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}> | <Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}> | ||||
| <Link href="https://www.iamsmart.gov.hk/tc/"><Typography align="center" variant="h6">{"了解更多 >"}</Typography></Link> | <Link href="https://www.iamsmart.gov.hk/tc/"><Typography align="center" variant="h6">{"了解更多 >"}</Typography></Link> | ||||