|
|
@@ -46,6 +46,7 @@ const Index = () => { |
|
|
|
const [paymentId, setPaymentId] = React.useState(""); |
|
|
|
const [fpsqrcodeurl, setFpsqrcodeurl] = React.useState(""); |
|
|
|
const [fpsqrcodeurlPrd, setFpsqrcodeurlPrd] = React.useState(""); |
|
|
|
const [fpsqrcodeurlFps, setFpsqrcodeurlFps] = React.useState(""); |
|
|
|
const [browserType, setBrowserType] = React.useState(""); |
|
|
|
const mobileBrowser = "Mobile"; |
|
|
|
const desktopBrowser = "Desktop"; |
|
|
@@ -119,16 +120,21 @@ const Index = () => { |
|
|
|
// setFpsmerchanttimeoutdatetime(convertedDateString) |
|
|
|
// setPaymentid("C202310268000681") |
|
|
|
// setPaymentstatuscode("APPR") |
|
|
|
const webtoken = paymentData.webtoken; |
|
|
|
const transactionid = paymentData.transactionid; |
|
|
|
console.log(webtoken) |
|
|
|
console.log(transactionid) |
|
|
|
localStorage.removeItem("transactionid") |
|
|
|
localStorage.removeItem("webtoken") |
|
|
|
localStorage.setItem("transactionid", paymentData.transactionid) |
|
|
|
localStorage.setItem("webtoken", paymentData.webtoken) |
|
|
|
localStorage.setItem("transactionid", transactionid) |
|
|
|
localStorage.setItem("webtoken", webtoken) |
|
|
|
|
|
|
|
|
|
|
|
HttpUtils.post({ |
|
|
|
url: paymentPath+loadPaymentUrl, |
|
|
|
params:{ |
|
|
|
"transactionid": paymentData.transactionid, |
|
|
|
"webtoken": paymentData.webtoken, |
|
|
|
"transactionid": transactionid, |
|
|
|
"webtoken": webtoken, |
|
|
|
"paymentmethod":"04,BCFP,FPS", |
|
|
|
"order": { |
|
|
|
"totalamount":paymentData.amount, |
|
|
@@ -169,13 +175,20 @@ const Index = () => { |
|
|
|
|
|
|
|
const parsedUrl = new URL(responseData.fpsqrcodeurl); |
|
|
|
const fpsqrcodeurl = "https://"+window.location.hostname+'/payment'+parsedUrl.pathname; |
|
|
|
const fpsqrcodeurlwithFps = "https://"+"fps."+window.location.hostname+'/payment'+parsedUrl.pathname; |
|
|
|
console.log(parsedUrl) |
|
|
|
console.log(fpsqrcodeurl) |
|
|
|
console.log(fpsqrcodeurlwithFps) |
|
|
|
|
|
|
|
const openPASGUrl = pasgPath + '?pay_req_obj=' + encodeURIComponent(fpsqrcodeurl) + '&callback=' |
|
|
|
+ encodeURIComponent("https://"+window.location.hostname+ '/paymentPage/fps/fpscallback?TRANSACTION_ID='+paymentData.transactionid+"&WEB_TOKEN="+paymentData.webtoken+"&PAYMENT_ID="+localStorage.getItem("paymentId")); |
|
|
|
+ encodeURIComponent("https://"+window.location.hostname+ '/paymentPage/fps/fpscallback?TRANSACTION_ID='+transactionid+"&WEB_TOKEN="+webtoken+"&PAYMENT_ID="+localStorage.getItem("paymentId")); |
|
|
|
const openPASGUrlPrd = pasgPathPrd + '?pay_req_obj=' + encodeURIComponent(fpsqrcodeurl) + '&callback=' |
|
|
|
+ encodeURIComponent("https://"+window.location.hostname+ '/paymentPage/fps/fpscallback?TRANSACTION_ID='+paymentData.transactionid+"&WEB_TOKEN="+paymentData.webtoken+"&PAYMENT_ID="+localStorage.getItem("paymentId")); |
|
|
|
+ encodeURIComponent("https://"+window.location.hostname+ '/paymentPage/fps/fpscallback?TRANSACTION_ID='+transactionid+"&WEB_TOKEN="+webtoken+"&PAYMENT_ID="+localStorage.getItem("paymentId")); |
|
|
|
const openPASGUrlPrdFps = pasgPath + '?pay_req_obj=' + encodeURIComponent(fpsqrcodeurlwithFps) + '&callback=' |
|
|
|
+ encodeURIComponent("https://"+window.location.hostname+ '/paymentPage/fps/fpscallback?TRANSACTION_ID='+transactionid+"&WEB_TOKEN="+webtoken+"&PAYMENT_ID="+localStorage.getItem("paymentId")); |
|
|
|
setFpsqrcodeurl(openPASGUrl) |
|
|
|
setFpsqrcodeurlPrd(openPASGUrlPrd) |
|
|
|
setFpsqrcodeurlFps(openPASGUrlPrdFps) |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
@@ -254,6 +267,10 @@ const Index = () => { |
|
|
|
window.location.assign(fpsqrcodeurlPrd); |
|
|
|
} |
|
|
|
|
|
|
|
const mobliePaymentFps = ()=>{ |
|
|
|
window.location.assign(fpsqrcodeurlFps); |
|
|
|
} |
|
|
|
|
|
|
|
return ( |
|
|
|
!onReady ? |
|
|
|
<Grid container sx={{ minHeight: '95vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center"> |
|
|
@@ -308,6 +325,16 @@ const Index = () => { |
|
|
|
}} |
|
|
|
sx={{ m: 4 }} |
|
|
|
>請選擇支付程式付款-PRD</Button> |
|
|
|
<Button |
|
|
|
component="span" |
|
|
|
variant="contained" |
|
|
|
size="large" |
|
|
|
color="primary" |
|
|
|
onClick={()=>{ |
|
|
|
mobliePaymentFps(); |
|
|
|
}} |
|
|
|
sx={{ m: 4 }} |
|
|
|
>請選擇支付程式付款-fps prefix</Button> |
|
|
|
</Typography> |
|
|
|
: |
|
|
|
<Typography variant="h3" sx={{ ml: 8, mt: 4, mr: 8, textAlign: "center" }}> |
|
|
|