diff --git a/src/auth/utils.js b/src/auth/utils.js index 839444c..125c9fe 100644 --- a/src/auth/utils.js +++ b/src/auth/utils.js @@ -97,3 +97,7 @@ export const getHomeRouteForLoggedInUser = (userRole) => { if (userRole === 'client') return { name: 'access-control' }; return { name: 'auth-login' }; }; + +// open payment record +export const local = {en:"en-us", zh:"zh-hk", cn:"zh-cn"}; +export const preferpaymentmethods = ['visa', 'mastercard', 'pps', 'creditcard', 'fps']; diff --git a/src/pages/Payment/FPS/fpscallback.js b/src/pages/Payment/FPS/fpscallback.js index d721243..e1a798e 100644 --- a/src/pages/Payment/FPS/fpscallback.js +++ b/src/pages/Payment/FPS/fpscallback.js @@ -13,7 +13,7 @@ import * as UrlUtils from "utils/ApiPathConst"; // import { useNavigate } from "react-router-dom"; // import FpsIcon from "assets/images/icons/fps.svg"; // import { useLocation } from 'react-router-dom'; -import {paymentPath} from "auth/utils"; +// import {paymentPath} from "auth/utils"; // import {poll} from "utils/Utils"; import * as DateUtils from "utils/DateUtils" @@ -50,7 +50,8 @@ const Fpscallback = () => { // const [transactionDate, setTransactionDate] = React.useState(""); // const [transactionTime, setTransactionTime] = React.useState(""); const [onReady, setOnReady] = React.useState(false); - const paymentStatusApi = "/api/payment/status/"; + // const paymentStatusApi = "/api/payment/status/"; + const [onDownload, setOnDownload] = React.useState(false); React.useEffect(() => { @@ -83,7 +84,7 @@ const Fpscallback = () => { console.log(paymentId) HttpUtils.post({ - url: paymentPath+paymentStatusApi+transactionid, + url: UrlUtils.PAYMENT_STATUS_API+transactionid, params:{ "apprefid": transactionid, "webtoken": webtoken, @@ -109,34 +110,68 @@ const Fpscallback = () => { responseData2.data["transTimeStr"] = DateUtils.dateFormat(responseData2.data.transDateTime, "HH:mm:ss"); setItemList(responseData2.paymentItemList) setPaymentData(responseData2.data); - localStorage.removeItem("paymentId"); + // localStorage.removeItem("paymentId"); } }); } }); - // setTransactionData( - // { - // "amount": 999.99, - // "currencycode": "HKD", - // "paymentdetail": { - // "attemptno": 1, - // "channel": "MobileWallet", - // "paymentid": "C202310268000681", - // "paymentmethod": "04", - // "result": { - // "canretry": "Y", - // "description": "CANC - Cancelled by user or Payment Server.", - // "paymentstatuscode": "CANC", - // "rejectreasoncode": "Payment Cancelled. [PAY-E-9022]" - // }, - // "subtype": "FPS", - // "time": "2023-10-26T09:02:17Z[UTC]" + // const responseData = { + // "amount": 999.99, + // "currencycode": "HKD", + // "paymentdetail": { + // "attemptno": 1, + // "channel": "MobileWallet", + // "paymentid": "C202310268000681", + // "paymentmethod": "04", + // "result": { + // "canretry": "Y", + // "description": "APPR - Cancelled by user or Payment Server.", + // "paymentstatuscode": "APPR", + // "rejectreasoncode": "Payment Cancelled. [PAY-E-9022]" // }, - // "transactionid": "20231026170103921" + // "subtype": "FPS", + // "time": "2023-10-26T09:02:17Z" + // }, + // "transactionid": "test0001" + // } + // setResponeDataData(responseData) + + // HttpUtils.post({ + // url: UrlUtils.PAYMENT_SAVE, + // params: { + // id: paymentId, + // transNo: responseData.transactionid, + // transDateTime: new Date(responseData.paymentdetail.time).toISOString(), + // egisRefNo: responseData.paymentdetail.paymentid, + // status: responseData.paymentdetail.result.paymentstatuscode, + // payload: responseData + // }, + // onSuccess: function (responseData2) { + // responseData2.data["transDateStr"] = DateUtils.dateFormat(responseData2.data.transDateTime, "DD/MM/YYYY"); + // responseData2.data["transTimeStr"] = DateUtils.dateFormat(responseData2.data.transDateTime, "HH:mm:ss"); + // setItemList(responseData2.paymentItemList) + // setPaymentData(responseData2.data); + // localStorage.removeItem("paymentId"); // } - // ) + // }); } + + const doPrint = () => { + const params = new URLSearchParams(window.location.search); + // window.print(); + setOnDownload(true) + HttpUtils.fileDownload({ + url: UrlUtils.GEN_PAYMENT_RECEIPT+"/"+params.get("PAYMENT_ID"), + onResponse:()=>{ + setOnDownload(false) + }, + onError:()=>{ + setOnDownload(false) + } + }); + }; + return ( !onReady ? @@ -146,9 +181,13 @@ const Fpscallback = () => { : transactionData.paymentdetail?.result?.paymentstatuscode === "APPR" ? - ( - - + ( +
+ + +
@@ -158,51 +197,45 @@ const Fpscallback = () => {
{/*row 1*/} - - -
- - - - 您的申請和付款已收到 - - - - - - - - - - - - - - - - - - - - -
+ + + 您的申請和付款已收到 + + + + + + + + + + + + {/*row 2*/}
- ) : - (transactionData.paymentdetail?.result?.paymentstatuscode === "CANC" ? - - +
+ ) : + (transactionData.paymentdetail?.result?.paymentstatuscode === "CANC" ? +
+ + +
@@ -239,9 +272,14 @@ const Fpscallback = () => { {/*row 2*/} - : - - +
+ : +
+ + +
@@ -284,7 +322,8 @@ const Fpscallback = () => { {/*row 2*/} - ) +
+ ) ); }; diff --git a/src/pages/Payment/index.js b/src/pages/Payment/index.js index 4231030..2f549fa 100644 --- a/src/pages/Payment/index.js +++ b/src/pages/Payment/index.js @@ -9,7 +9,7 @@ import { useEffect, useState } from "react"; import { useNavigate, useLocation } from "react-router-dom"; // import * as FormatUtils from "utils/FormatUtils"; // const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); -import {getBowserType} from "auth/utils"; +import * as Utils from "auth/utils"; import { Button, @@ -43,8 +43,8 @@ const Index = () => { const intl = useIntl(); const { locale } = intl; - const local = {en:"en-us", zh:"zh-hk", cn:"zh-cn"}; - const preferpaymentmethods = ['visa', 'mastercard', 'pps', 'creditcard', 'fps']; + // const local = {en:"en-us", zh:"zh-hk", cn:"zh-cn"}; + // const preferpaymentmethods = ['visa', 'mastercard', 'pps', 'creditcard', 'fps']; const [totalAmount, setTotalAmount] = useState(0); const [appIds, setAppIds] = useState([]); @@ -75,7 +75,7 @@ const Index = () => { localStorage.removeItem("webtoken"); localStorage.removeItem("transactionid"); localStorage.removeItem("paymentId"); - if (getBowserType() === "PC_Browser"){ + if (Utils.getBowserType() === "PC_Browser"){ setIsFullScreen(false) } else { setIsFullScreen(true) @@ -139,6 +139,7 @@ const Index = () => { stateParams = { state: { amount: totalAmount, transactionid: transactionData.transactionid, webtoken: transactionData.webtoken, type: "PPS", paymentMethod: "01,PPSB,PPS" } } paymentMethod = "01,PPSB,PPS"; } + if (paymentMethod != "") { HttpUtils.post({ url: UrlUtils.PAYMENT_CREATE, @@ -155,6 +156,24 @@ const Index = () => { } }); } + + // //For testing + // if (paymentMethod != "") { + // HttpUtils.post({ + // url: UrlUtils.PAYMENT_CREATE, + // params: { + // transNo: "test0001", + // payMethod: paymentMethod, + // payAmount: totalAmount, + // appIdList: location.state?.appIdList ?? [] + // }, + // onSuccess: function (responData) { + // localStorage.removeItem("paymentId"); + // localStorage.setItem("paymentId", responData.id) + // navigate(page, stateParams); + // } + // }); + // } } }, [afterConfirmPayment]); @@ -162,12 +181,12 @@ const Index = () => { HttpUtils.post({ url: UrlUtils.PAYMENT_AVAILABLE_PAYMENT, params: { - "locale": locale === 'en' ?local.en:locale === 'zh-HK' ?local.zh:local.cn, + "locale": locale === 'en' ?Utils.local.en:locale === 'zh-HK' ?Utils.local.zh:Utils.local.cn, "amount": totalAmount, // "eserviceids": [ // "", "" // ], - "preferpaymentmethods": preferpaymentmethods + "preferpaymentmethods": Utils.preferpaymentmethods }, onSuccess: (responseData) => { let availableMethods = responseData.availablepaymentmethods; @@ -190,7 +209,18 @@ const Index = () => { } }); - + // HttpUtils.get({ + // url: UrlUtils.PAYMENT_LIMIT_SETTING_LIST, + // params: {}, + // onSuccess: (responseData) => { + // // console.log(responseData) + // setPaymentLimit(responseData) + + // }, + // onError: () =>{ + // // setOnReady(true) + // } + // }); // const responseData = { // "availablepaymentmethods": [ diff --git a/src/pages/PublicNotice/Details_GLD/GazetteDetailCard.js b/src/pages/PublicNotice/Details_GLD/GazetteDetailCard.js index 6e32f86..c4e4b02 100644 --- a/src/pages/PublicNotice/Details_GLD/GazetteDetailCard.js +++ b/src/pages/PublicNotice/Details_GLD/GazetteDetailCard.js @@ -55,7 +55,7 @@ const GazetteDetailCard = ( if (Object.keys(applicationDetailData).length > 0) { setCurrentStatus(applicationDetailData.data.status); setVerified(applicationDetailData.userData.verifiedBy ? true : false); - setIssueNum(applicationDetailData.gazetteIssueDetail.volume+"/"+applicationDetailData.gazetteIssueDetail.year + setIssueNum(applicationDetailData.gazetteIssueDetail.volume+"/"+applicationDetailData.gazetteIssueDetail.issueYear +" No. "+applicationDetailData.gazetteIssueDetail.issueNo); setIssueDate(DateUtils.dateFormat(applicationDetailData.gazetteIssueDetail.issueDate, "D MMM YYYY (ddd)")); setGazetteCode(applicationDetailData.data.groupNo) diff --git a/src/pages/PublicNotice/Details_GLD/index.js b/src/pages/PublicNotice/Details_GLD/index.js index c516cd7..aeadd83 100644 --- a/src/pages/PublicNotice/Details_GLD/index.js +++ b/src/pages/PublicNotice/Details_GLD/index.js @@ -112,7 +112,7 @@ const PublicNoticeDetail_GLD = () => { setApplicationDetailData(response.data); const gazetteIssueDetail = response.data.gazetteIssueDetail; setAapNo(response.data.data.appNo); - setGazetteIssue(gazetteIssueDetail.year + " Vol " + gazetteIssueDetail.volume); + setGazetteIssue(gazetteIssueDetail.issueYear + " Vol " + gazetteIssueDetail.volume); setIssueNum(" No. " + gazetteIssueDetail.issueNo); setIssueDate(DateUtils.dateFormat(gazetteIssueDetail.issueDate, "D MMM YYYY (ddd)")); setGroupNo(response.data.data.groupNo); diff --git a/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js b/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js index 69ccdc6..1c09b23 100644 --- a/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js +++ b/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js @@ -73,7 +73,7 @@ const ApplicationDetailCard = ( setCurrentApplicationDetailData(applicationDetailData.data); setCompanyName(applicationDetailData.companyName); setfileDetail(applicationDetailData.fileDetail); - setIssueNum(applicationDetailData.gazetteIssueDetail.volume + "/" + applicationDetailData.gazetteIssueDetail.year + setIssueNum(applicationDetailData.gazetteIssueDetail.volume + "/" + applicationDetailData.gazetteIssueDetail.issueYear + " No. " + applicationDetailData.gazetteIssueDetail.issueNo); setIssueDate(DateUtils.dateFormat(applicationDetailData.gazetteIssueDetail.issueDate, "D MMM YYYY (ddd)")); diff --git a/src/pages/PublicNotice/Details_Public/index.js b/src/pages/PublicNotice/Details_Public/index.js index 21ace9a..60b4b68 100644 --- a/src/pages/PublicNotice/Details_Public/index.js +++ b/src/pages/PublicNotice/Details_Public/index.js @@ -90,7 +90,7 @@ const DashboardDefault = () => { setApplicationDetailData(response.data); const gazetteIssueDetail = response.data.gazetteIssueDetail; setAapNo(response.data.data.appNo); - setGazetteIssue(gazetteIssueDetail.year + " Vol " + gazetteIssueDetail.volume); + setGazetteIssue(gazetteIssueDetail.issueYear + " Vol " + gazetteIssueDetail.volume); setIssueNum(" No. " + gazetteIssueDetail.issueNo); setProofList(response.data.proofList); setPaymentList(response.data.paymentList); diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js index 01ce47e..55ccdee 100644 --- a/src/utils/ApiPathConst.js +++ b/src/utils/ApiPathConst.js @@ -143,6 +143,7 @@ export const PAYMENT_APP_LIST = apiPath+'/payment/applist';//POST export const PAYMENT_LIMIT_SETTING_LIST = apiPath+'/settings/payment';//GET export const PAYMENT_AVAILABLE_PAYMENT = paymentPath+'/api/payment/availability';//POST export const PAYMENT_TRANSACTION_ID = paymentPath+'/api/payment/transaction';//GET +export const PAYMENT_STATUS_API = paymentPath+'/api/payment/status/';//GET export const DEMAND_NOTE_PREVIEW = apiPath+'/demandNote/preview';//GET export const DEMAND_NOTE_CREATE = apiPath+'/demandNote/create';//POST