| @@ -46,6 +46,7 @@ const Index = () => { | |||||
| const [paymentId, setPaymentId] = React.useState(""); | const [paymentId, setPaymentId] = React.useState(""); | ||||
| const [fpsqrcodeurl, setFpsqrcodeurl] = React.useState(""); | const [fpsqrcodeurl, setFpsqrcodeurl] = React.useState(""); | ||||
| const [fpsqrcodeurlPrd, setFpsqrcodeurlPrd] = React.useState(""); | const [fpsqrcodeurlPrd, setFpsqrcodeurlPrd] = React.useState(""); | ||||
| const [fpsqrcodeurlFps, setFpsqrcodeurlFps] = React.useState(""); | |||||
| const [browserType, setBrowserType] = React.useState(""); | const [browserType, setBrowserType] = React.useState(""); | ||||
| const mobileBrowser = "Mobile"; | const mobileBrowser = "Mobile"; | ||||
| const desktopBrowser = "Desktop"; | const desktopBrowser = "Desktop"; | ||||
| @@ -119,16 +120,21 @@ const Index = () => { | |||||
| // setFpsmerchanttimeoutdatetime(convertedDateString) | // setFpsmerchanttimeoutdatetime(convertedDateString) | ||||
| // setPaymentid("C202310268000681") | // setPaymentid("C202310268000681") | ||||
| // setPaymentstatuscode("APPR") | // setPaymentstatuscode("APPR") | ||||
| const webtoken = paymentData.webtoken; | |||||
| const transactionid = paymentData.transactionid; | |||||
| console.log(webtoken) | |||||
| console.log(transactionid) | |||||
| localStorage.removeItem("transactionid") | localStorage.removeItem("transactionid") | ||||
| localStorage.removeItem("webtoken") | localStorage.removeItem("webtoken") | ||||
| localStorage.setItem("transactionid", paymentData.transactionid) | |||||
| localStorage.setItem("webtoken", paymentData.webtoken) | |||||
| localStorage.setItem("transactionid", transactionid) | |||||
| localStorage.setItem("webtoken", webtoken) | |||||
| HttpUtils.post({ | HttpUtils.post({ | ||||
| url: paymentPath+loadPaymentUrl, | url: paymentPath+loadPaymentUrl, | ||||
| params:{ | params:{ | ||||
| "transactionid": paymentData.transactionid, | |||||
| "webtoken": paymentData.webtoken, | |||||
| "transactionid": transactionid, | |||||
| "webtoken": webtoken, | |||||
| "paymentmethod":"04,BCFP,FPS", | "paymentmethod":"04,BCFP,FPS", | ||||
| "order": { | "order": { | ||||
| "totalamount":paymentData.amount, | "totalamount":paymentData.amount, | ||||
| @@ -169,13 +175,20 @@ const Index = () => { | |||||
| const parsedUrl = new URL(responseData.fpsqrcodeurl); | const parsedUrl = new URL(responseData.fpsqrcodeurl); | ||||
| const fpsqrcodeurl = "https://"+window.location.hostname+'/payment'+parsedUrl.pathname; | 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=' | 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=' | 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) | setFpsqrcodeurl(openPASGUrl) | ||||
| setFpsqrcodeurlPrd(openPASGUrlPrd) | setFpsqrcodeurlPrd(openPASGUrlPrd) | ||||
| setFpsqrcodeurlFps(openPASGUrlPrdFps) | |||||
| } | } | ||||
| }); | }); | ||||
| @@ -254,6 +267,10 @@ const Index = () => { | |||||
| window.location.assign(fpsqrcodeurlPrd); | window.location.assign(fpsqrcodeurlPrd); | ||||
| } | } | ||||
| const mobliePaymentFps = ()=>{ | |||||
| window.location.assign(fpsqrcodeurlFps); | |||||
| } | |||||
| return ( | return ( | ||||
| !onReady ? | !onReady ? | ||||
| <Grid container sx={{ minHeight: '95vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center"> | <Grid container sx={{ minHeight: '95vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center"> | ||||
| @@ -308,6 +325,16 @@ const Index = () => { | |||||
| }} | }} | ||||
| sx={{ m: 4 }} | sx={{ m: 4 }} | ||||
| >請選擇支付程式付款-PRD</Button> | >請選擇支付程式付款-PRD</Button> | ||||
| <Button | |||||
| component="span" | |||||
| variant="contained" | |||||
| size="large" | |||||
| color="primary" | |||||
| onClick={()=>{ | |||||
| mobliePaymentFps(); | |||||
| }} | |||||
| sx={{ m: 4 }} | |||||
| >請選擇支付程式付款-fps prefix</Button> | |||||
| </Typography> | </Typography> | ||||
| : | : | ||||
| <Typography variant="h3" sx={{ ml: 8, mt: 4, mr: 8, textAlign: "center" }}> | <Typography variant="h3" sx={{ ml: 8, mt: 4, mr: 8, textAlign: "center" }}> | ||||
| @@ -35,6 +35,8 @@ import { EyeInvisibleOutlined, EyeOutlined } from '@ant-design/icons'; | |||||
| import axios from 'axios'; | import axios from 'axios'; | ||||
| import { useParams,Link } from 'react-router-dom'; | import { useParams,Link } from 'react-router-dom'; | ||||
| import CancelOutlinedIcon from '@mui/icons-material/CancelOutlined'; | import CancelOutlinedIcon from '@mui/icons-material/CancelOutlined'; | ||||
| import LocaleContext from "components/I18nProvider"; | |||||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
| const Index = () => { | const Index = () => { | ||||
| @@ -46,11 +48,13 @@ const Index = () => { | |||||
| const [verifyState, setVerifyState] = React.useState(null) | const [verifyState, setVerifyState] = React.useState(null) | ||||
| const [enterUseEffect, setEnterUseEffect] = React.useState(false) | const [enterUseEffect, setEnterUseEffect] = React.useState(false) | ||||
| const [username, setUsername] = React.useState("") | const [username, setUsername] = React.useState("") | ||||
| const { setLocale } = React.useContext(LocaleContext); | |||||
| const params = useParams() | const params = useParams() | ||||
| const intl = useIntl(); | const intl = useIntl(); | ||||
| React.useEffect(() => { | React.useEffect(() => { | ||||
| console.log(params); | |||||
| setEnterUseEffect(true) | setEnterUseEffect(true) | ||||
| }, []); | }, []); | ||||
| @@ -75,13 +79,13 @@ const Index = () => { | |||||
| setUsername(response.data.username) | setUsername(response.data.username) | ||||
| setVerifyState(true) | setVerifyState(true) | ||||
| } else { | } else { | ||||
| setVerifyState(true) | |||||
| setVerifyState(false) | |||||
| } | } | ||||
| setLoding(false) | setLoding(false) | ||||
| } | } | ||||
| ).catch(error => { | ).catch(error => { | ||||
| console.log(error) | console.log(error) | ||||
| setVerifyState(true) | |||||
| setVerifyState(false) | |||||
| setLoding(false) | setLoding(false) | ||||
| }); | }); | ||||
| @@ -90,16 +94,14 @@ const Index = () => { | |||||
| const goLogin = async (values) =>{ | const goLogin = async (values) =>{ | ||||
| dispatch(handleLogoutFunction()); | dispatch(handleLogoutFunction()); | ||||
| console.log(username) | |||||
| await axios.patch(UrlUtils.PATCH_FORGOT_PASSWORD_NEW_PASSWORD, { | |||||
| params: { | |||||
| HttpUtils.post({ | |||||
| url: UrlUtils.POST_FORGOT_PASSWORD_NEW_PASSWORD, | |||||
| params:{ | |||||
| username: username, | username: username, | ||||
| newPassword: values.password | newPassword: values.password | ||||
| } | |||||
| }).then( | |||||
| (response)=>{ | |||||
| if (response.status === 204) { | |||||
| useJwt | |||||
| }, | |||||
| onSuccess: () => { | |||||
| useJwt | |||||
| .login({ username: username, password: values.password }) | .login({ username: username, password: values.password }) | ||||
| .then((response) => { | .then((response) => { | ||||
| // console.log(response) | // console.log(response) | ||||
| @@ -139,28 +141,10 @@ const Index = () => { | |||||
| .catch((error) => { | .catch((error) => { | ||||
| // setSuccess(false) | // setSuccess(false) | ||||
| console.error(error) | console.error(error) | ||||
| console.error(error.response.data.error) | |||||
| setErrorMassage(error.response.data.error) | |||||
| setOpen(true) | |||||
| // console.error(error.response.data.error) | |||||
| // setErrorMassage(error.response.data.error) | |||||
| // setOpen(true) | |||||
| }); | }); | ||||
| } else { | |||||
| setVerifyState(true) | |||||
| } | |||||
| setLoding(false) | |||||
| } | |||||
| ).catch(error => { | |||||
| console.log(error) | |||||
| setVerifyState(true) | |||||
| setLoding(false) | |||||
| }); | |||||
| HttpUtils.patch({ | |||||
| url: UrlUtils.PATCH_FORGOT_PASSWORD_NEW_PASSWORD, | |||||
| params:{ | |||||
| username: username, | |||||
| newPassword: values.password | |||||
| }, | |||||
| onSuccess: () => { | |||||
| }, | }, | ||||
| onFail: (response)=>{ | onFail: (response)=>{ | ||||
| console.log("Fail"); | console.log("Fail"); | ||||
| @@ -336,7 +320,7 @@ const Index = () => { | |||||
| name="username" | name="username" | ||||
| label={intl.formatMessage({id: 'userLoginName'}) + ":"} | label={intl.formatMessage({id: 'userLoginName'}) + ":"} | ||||
| placeholder={intl.formatMessage({id: 'userLoginName'})} | placeholder={intl.formatMessage({id: 'userLoginName'})} | ||||
| defaultValue={username} | |||||
| // defaultValue={username} | |||||
| value={username} | value={username} | ||||
| disabled={true} /> | disabled={true} /> | ||||
| </Grid> | </Grid> | ||||
| @@ -420,7 +404,7 @@ const Index = () => { | |||||
| name="confirmPassword" | name="confirmPassword" | ||||
| label={intl.formatMessage({id: 'confirmPassword'}) + ":"} | label={intl.formatMessage({id: 'confirmPassword'}) + ":"} | ||||
| placeholder={intl.formatMessage({id: 'confirmPassword'})} | placeholder={intl.formatMessage({id: 'confirmPassword'})} | ||||
| defaultValue={formik.values.confirmPassword.trim()} | |||||
| // defaultValue={formik.values.confirmPassword.trim()} | |||||
| value={formik.values.confirmPassword.trim()} | value={formik.values.confirmPassword.trim()} | ||||
| error={Boolean(formik.touched.confirmPassword && formik.errors.confirmPassword)} | error={Boolean(formik.touched.confirmPassword && formik.errors.confirmPassword)} | ||||
| onBlur={formik.handleBlur} | onBlur={formik.handleBlur} | ||||
| @@ -74,7 +74,7 @@ export const GET_USER_EMAIL = apiPath+'/user/email'; | |||||
| export const GET_ID = apiPath+'/user/verifyID'; | export const GET_ID = apiPath+'/user/verifyID'; | ||||
| export const GET_VERIFY_USER_ACCOUNT = apiPath+'/user/verifyEmail'; | export const GET_VERIFY_USER_ACCOUNT = apiPath+'/user/verifyEmail'; | ||||
| export const GET_FORGOT_PASSWORD_VERIFY_USER_ACCOUNT = apiPath+'/user/verifyForgotPasswordEmail'; | export const GET_FORGOT_PASSWORD_VERIFY_USER_ACCOUNT = apiPath+'/user/verifyForgotPasswordEmail'; | ||||
| export const PATCH_FORGOT_PASSWORD_NEW_PASSWORD = apiPath+'/user/forgotPassword/newPassword'; | |||||
| export const POST_FORGOT_PASSWORD_NEW_PASSWORD = apiPath+'/user/forgotPasswordNewPassword'; | |||||
| //Public | //Public | ||||