| @@ -9,11 +9,13 @@ import { | |||||
| } from '@mui/material'; | } from '@mui/material'; | ||||
| import * as React from "react"; | import * as React from "react"; | ||||
| import * as HttpUtils from "utils/HttpUtils"; | import * as HttpUtils from "utils/HttpUtils"; | ||||
| import * as UrlUtils from "utils/ApiPathConst"; | |||||
| // import { useNavigate } from "react-router-dom"; | // import { useNavigate } from "react-router-dom"; | ||||
| // import FpsIcon from "assets/images/icons/fps.svg"; | // import FpsIcon from "assets/images/icons/fps.svg"; | ||||
| import { useLocation } from 'react-router-dom'; | |||||
| // import { useLocation } from 'react-router-dom'; | |||||
| import {paymentPath} from "auth/utils"; | import {paymentPath} from "auth/utils"; | ||||
| // import {poll} from "utils/Utils"; | // import {poll} from "utils/Utils"; | ||||
| import * as DateUtils from "utils/DateUtils" | |||||
| import Loadable from 'components/Loadable'; | import Loadable from 'components/Loadable'; | ||||
| const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | ||||
| @@ -35,12 +37,13 @@ const BackgroundHead = { | |||||
| const AckPage = () => { | const AckPage = () => { | ||||
| // const navigate = useNavigate() | // const navigate = useNavigate() | ||||
| const location = useLocation(); | |||||
| // const location = useLocation(); | |||||
| const [locationData, setLocationData] = React.useState({}); | |||||
| // const [locationData, setLocationData] = React.useState({}); | |||||
| const [paymentData, setPaymentData] = React.useState({}); | const [paymentData, setPaymentData] = React.useState({}); | ||||
| const [responeData, setResponeDataData] = React.useState({}); | const [responeData, setResponeDataData] = React.useState({}); | ||||
| const [itemList, setItemList] = React.useState([]); | |||||
| const [transactionData, setTransactionData] = React.useState({}); | const [transactionData, setTransactionData] = React.useState({}); | ||||
| // const [transactionDate, setTransactionDate] = React.useState(""); | // const [transactionDate, setTransactionDate] = React.useState(""); | ||||
| // const [transactionTime, setTransactionTime] = React.useState(""); | // const [transactionTime, setTransactionTime] = React.useState(""); | ||||
| @@ -49,28 +52,9 @@ const AckPage = () => { | |||||
| React.useEffect(() => { | React.useEffect(() => { | ||||
| console.log (location.state) | |||||
| if(Object.keys(location.state).length > 0){ | |||||
| console.log (location.state) | |||||
| setLocationData(location.state) | |||||
| } | |||||
| loadForm(); | |||||
| }, []); | }, []); | ||||
| React.useEffect(() => { | |||||
| console.log (locationData) | |||||
| if (Object.keys(locationData).length > 0){ | |||||
| setPaymentData(locationData) | |||||
| // loadForm(); | |||||
| } | |||||
| }, [locationData]); | |||||
| React.useEffect(() => { | |||||
| console.log (paymentData) | |||||
| if (Object.keys(paymentData).length > 0){ | |||||
| loadForm(); | |||||
| } | |||||
| }, [paymentData]); | |||||
| React.useEffect(() => { | React.useEffect(() => { | ||||
| console.log(responeData) | console.log(responeData) | ||||
| if(Object.keys(responeData).length > 0){ | if(Object.keys(responeData).length > 0){ | ||||
| @@ -79,7 +63,7 @@ const AckPage = () => { | |||||
| }, [responeData]); | }, [responeData]); | ||||
| React.useEffect(() => { | React.useEffect(() => { | ||||
| console.log(paymentData) | |||||
| // console.log(paymentData) | |||||
| console.log(transactionData) | console.log(transactionData) | ||||
| if(Object.keys(transactionData).length > 0 ){ | if(Object.keys(transactionData).length > 0 ){ | ||||
| setOnReady(true); | setOnReady(true); | ||||
| @@ -112,7 +96,7 @@ const AckPage = () => { | |||||
| url: UrlUtils.PAYMENT_SAVE, | url: UrlUtils.PAYMENT_SAVE, | ||||
| params: { | params: { | ||||
| id: localStorage.getItem("paymentId"), | id: localStorage.getItem("paymentId"), | ||||
| transNo: transactionData.transicationId, | |||||
| transNo: responseData.transactionid, | |||||
| transDateTime: responseData.paymentdetail.time.replace("[UTC]", ""), | transDateTime: responseData.paymentdetail.time.replace("[UTC]", ""), | ||||
| egisRefNo: responseData.paymentdetail.paymentid, | egisRefNo: responseData.paymentdetail.paymentid, | ||||
| status: responseData.paymentdetail.result.paymentstatuscode, | status: responseData.paymentdetail.result.paymentstatuscode, | ||||
| @@ -17,7 +17,6 @@ import Loadable from 'components/Loadable'; | |||||
| const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | ||||
| import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | ||||
| import { object } from 'prop-types'; | |||||
| const BackgroundHead = { | const BackgroundHead = { | ||||
| backgroundImage: `url(${titleBackgroundImg})`, | backgroundImage: `url(${titleBackgroundImg})`, | ||||
| width: '100%', | width: '100%', | ||||
| @@ -108,7 +107,7 @@ const Index = () => { | |||||
| localStorage.removeItem("webtoken") | localStorage.removeItem("webtoken") | ||||
| localStorage.setItem("transactionid", paymentData.transactionid) | localStorage.setItem("transactionid", paymentData.transactionid) | ||||
| localStorage.setItem("webtoken", paymentData.webtoken) | localStorage.setItem("webtoken", paymentData.webtoken) | ||||
| HttpUtils.post({ | HttpUtils.post({ | ||||
| url: paymentPath+loadPaymentUrl, | url: paymentPath+loadPaymentUrl, | ||||
| params:{ | params:{ | ||||
| @@ -158,7 +157,7 @@ const Index = () => { | |||||
| } | } | ||||
| const getPaymentStatus = () => { | const getPaymentStatus = () => { | ||||
| if(object.keys(paymentData).length > 0){ | |||||
| if(Object.keys(paymentData).length > 0){ | |||||
| HttpUtils.post({ | HttpUtils.post({ | ||||
| url: paymentPath+paymentStatusApi+paymentData.transactionid, | url: paymentPath+paymentStatusApi+paymentData.transactionid, | ||||
| params:{ | params:{ | ||||
| @@ -169,11 +168,11 @@ const Index = () => { | |||||
| const paymentstatuscode = responseData.paymentdetail.result.paymentstatuscode; | const paymentstatuscode = responseData.paymentdetail.result.paymentstatuscode; | ||||
| if (paymentstatuscode != "" && paymentstatuscode != "INPR" ){ | if (paymentstatuscode != "" && paymentstatuscode != "INPR" ){ | ||||
| if (paymentstatuscode === 'APPR') { | if (paymentstatuscode === 'APPR') { | ||||
| const timestamp = Date.now(); | |||||
| navigate('/paymentPage/fps/ackpage', {state:{transactionDateTime:timestamp,transactionid:paymentData.transactionid} }); | |||||
| // const timestamp = Date.now(); | |||||
| navigate('/paymentPage/fps/ackpage'); | |||||
| } else if (paymentstatuscode === 'CANC') { | } else if (paymentstatuscode === 'CANC') { | ||||
| const timestamp = Date.now(); | |||||
| navigate('/paymentPage/fps/ackpage', {state:{transactionDateTime:timestamp,transactionid:paymentData.transactionid} }); | |||||
| // const timestamp = Date.now(); | |||||
| navigate('/paymentPage/fps/ackpage'); | |||||
| } else { | } else { | ||||
| // window.top.location.href = paymentPath + payment.config.errPagePath; | // window.top.location.href = paymentPath + payment.config.errPagePath; | ||||
| alert("ERROR") | alert("ERROR") | ||||
| @@ -192,7 +191,7 @@ const Index = () => { | |||||
| const timeOutDate = new Date(fpsmerchanttimeoutdatetime); | const timeOutDate = new Date(fpsmerchanttimeoutdatetime); | ||||
| const currentTime = new Date; | const currentTime = new Date; | ||||
| const timedowncount = Math.round((timeOutDate.getTime() - currentTime.getTime()) / 1000); | const timedowncount = Math.round((timeOutDate.getTime() - currentTime.getTime()) / 1000); | ||||
| setTimeDownCount(timedowncount) | |||||
| setTimeDownCount(timedowncount); | |||||
| // console.log(time) | // console.log(time) | ||||
| // console.log(timeOutDate) | // console.log(timeOutDate) | ||||
| // console.log(currentTime) | // console.log(currentTime) | ||||
| @@ -206,7 +205,7 @@ const Index = () => { | |||||
| },[time]) | },[time]) | ||||
| const cancelPayment = ()=>{ | const cancelPayment = ()=>{ | ||||
| if (object.keys(paymentData).length>0){ | |||||
| if (Object.keys(paymentData).length>0){ | |||||
| HttpUtils.post({ | HttpUtils.post({ | ||||
| url: paymentPath+cancelPaymentUrl, | url: paymentPath+cancelPaymentUrl, | ||||
| params:{ | params:{ | ||||
| @@ -215,8 +214,7 @@ const Index = () => { | |||||
| "paymentid": fpsTransctionData.paymentid | "paymentid": fpsTransctionData.paymentid | ||||
| }, | }, | ||||
| onSuccess: function(){ | onSuccess: function(){ | ||||
| const timestamp = Date.now(); | |||||
| navigate('/paymentPage/fps/ackpage', {state:{transactionDateTime:timestamp,transactionid:paymentData.transactionid} }); | |||||
| navigate('/paymentPage/fps/ackpage'); | |||||
| } | } | ||||
| }); | }); | ||||
| } | } | ||||
| @@ -110,7 +110,7 @@ const MultiPaymentWindow = (props) => { | |||||
| </Grid> | </Grid> | ||||
| <Grid item> | <Grid item> | ||||
| <FormLabel sx={{ fontSize: "16px", color: "#000000", textAlign: "center" }}> | <FormLabel sx={{ fontSize: "16px", color: "#000000", textAlign: "center" }}> | ||||
| {transactionData.transicationId} | |||||
| {transactionData.transactionid} | |||||
| </FormLabel> | </FormLabel> | ||||
| </Grid> | </Grid> | ||||
| </Grid> | </Grid> | ||||
| @@ -12,6 +12,7 @@ import * as HttpUtils from "utils/HttpUtils"; | |||||
| import * as UrlUtils from "utils/ApiPathConst"; | import * as UrlUtils from "utils/ApiPathConst"; | ||||
| //import { useNavigate } from 'react-router-dom'; | //import { useNavigate } from 'react-router-dom'; | ||||
| import { paymentPath } from "auth/utils"; | import { paymentPath } from "auth/utils"; | ||||
| import * as DateUtils from "utils/DateUtils" | |||||
| import Loadable from 'components/Loadable'; | import Loadable from 'components/Loadable'; | ||||
| const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); | ||||
| @@ -118,7 +119,7 @@ const Index = () => { | |||||
| url: UrlUtils.PAYMENT_SAVE, | url: UrlUtils.PAYMENT_SAVE, | ||||
| params: { | params: { | ||||
| id: localStorage.getItem("paymentId"), | id: localStorage.getItem("paymentId"), | ||||
| transNo: transactionData.transicationId, | |||||
| transNo: responseData.transactionid, | |||||
| transDateTime: responseData.paymentdetail.time.replace("[UTC]", ""), | transDateTime: responseData.paymentdetail.time.replace("[UTC]", ""), | ||||
| egisRefNo: responseData.paymentdetail.paymentid, | egisRefNo: responseData.paymentdetail.paymentid, | ||||
| status: responseData.paymentdetail.result.paymentstatuscode, | status: responseData.paymentdetail.result.paymentstatuscode, | ||||
| @@ -19,6 +19,14 @@ import { | |||||
| Box | Box | ||||
| } from '@mui/material'; | } from '@mui/material'; | ||||
| //icon | |||||
| import VisaIcon from "assets/images/icons/visacard.svg"; | |||||
| import MasterIcon from "assets/images/icons/mastercard.svg"; | |||||
| import JcbIcon from "assets/images/icons/jcb.svg"; | |||||
| import UnionPayIcon from "assets/images/icons/unionpay.svg"; | |||||
| import PpsIcon from "assets/images/icons/ppshk.svg"; | |||||
| import FpsIcon from "assets/images/icons/fps.svg"; | |||||
| import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' | ||||
| const BackgroundHead = { | const BackgroundHead = { | ||||
| backgroundImage: `url(${titleBackgroundImg})`, | backgroundImage: `url(${titleBackgroundImg})`, | ||||
| @@ -124,7 +132,7 @@ const Index = () => { | |||||
| HttpUtils.post({ | HttpUtils.post({ | ||||
| url: UrlUtils.PAYMENT_CREATE, | url: UrlUtils.PAYMENT_CREATE, | ||||
| params: { | params: { | ||||
| transNo: transactionData.transicationId, | |||||
| transNo: transactionData.transactionid, | |||||
| payMethod: paymentMethod, | payMethod: paymentMethod, | ||||
| payAmount: totalAmount, | payAmount: totalAmount, | ||||
| appIdList: location.state?.appIdList ?? [] | appIdList: location.state?.appIdList ?? [] | ||||
| @@ -420,14 +428,14 @@ const Index = () => { | |||||
| </Grid> | </Grid> | ||||
| </Grid> | </Grid> | ||||
| </Grid> | </Grid> | ||||
| {availableMethodData.length > 0? | |||||
| {availableMethods.length > 0? | |||||
| !onReady ? | !onReady ? | ||||
| <LoadingComponent />: | <LoadingComponent />: | ||||
| <Grid item xs={12} md={12}> | <Grid item xs={12} md={12}> | ||||
| <Grid container spacing={1} direction="row" justifyContent="flex-start" alignItems="center"> | <Grid container spacing={1} direction="row" justifyContent="flex-start" alignItems="center"> | ||||
| <Grid item> | <Grid item> | ||||
| <Typography variant="h5" sx={{ textAlign: "left" }}> | <Typography variant="h5" sx={{ textAlign: "left" }}> | ||||
| 付款方式: | |||||
| 請選擇付款方式: | |||||
| </Typography> | </Typography> | ||||
| </Grid> | </Grid> | ||||
| <Grid item> | <Grid item> | ||||