From bd526b1878132e9091d77f2ee7b0ea19ae9935f0 Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Tue, 16 Apr 2024 14:29:14 +0800 Subject: [PATCH 01/11] api update --- src/utils/ApiPathConst.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js index 3a50e42..156f04f 100644 --- a/src/utils/ApiPathConst.js +++ b/src/utils/ApiPathConst.js @@ -1,4 +1,7 @@ -import {apiPath, paymentPath} from "../auth/utils"; +import { + apiPath, + // paymentPath +} from "../auth/utils"; // GET request export const REFRESH_TOKEN = "/refresh-token" @@ -148,9 +151,12 @@ export const PAYMENT_APP_LIST = apiPath+'/payment/applist';//POST export const PAYMENT_CHECK = apiPath+'/payment/check-payment';//GET 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 PAYMENT_AVAILABLE_PAYMENT = paymentPath+'/api/payment/availability';//POST +export const PAYMENT_AVAILABLE_PAYMENT = apiPath+'/payment/api/availability';//POST +// export const PAYMENT_TRANSACTION_ID = paymentPath+'/api/payment/transaction';//GET +export const PAYMENT_TRANSACTION_ID = apiPath+'/payment/api/transaction';//GET +// export const PAYMENT_STATUS_API = paymentPath+'/api/payment/status/';//POST +export const PAYMENT_STATUS_API = apiPath+'/payment/api/status/';//POST export const DEMAND_NOTE_PREVIEW = apiPath+'/demandNote/preview';//GET export const DEMAND_NOTE_CREATE = apiPath+'/demandNote/create';//POST From e4419c28f44bb371bc55b7c689ccdaf0319a0c4b Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Tue, 16 Apr 2024 18:18:28 +0800 Subject: [PATCH 02/11] set api with backend --- src/pages/Payment/FPS/AckPage.js | 6 +++--- src/pages/Payment/FPS/FPS.js | 5 +++-- src/pages/Payment/PaymentCallback.js | 4 ++-- src/utils/ApiPathConst.js | 3 +++ 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/pages/Payment/FPS/AckPage.js b/src/pages/Payment/FPS/AckPage.js index a9b01a7..dbc7bc7 100644 --- a/src/pages/Payment/FPS/AckPage.js +++ b/src/pages/Payment/FPS/AckPage.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,7 @@ const AckPage = () => { // 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); const intl = useIntl(); const { locale } = intl; @@ -85,7 +85,7 @@ const AckPage = () => { let webtoken = localStorage.getItem("webtoken") HttpUtils.post({ - url: paymentPath+paymentStatusApi+transactionid, + url: UrlUtils.PAYMENT_STATUS_API+transactionid, params:{ "apprefid": transactionid, "webtoken": webtoken, diff --git a/src/pages/Payment/FPS/FPS.js b/src/pages/Payment/FPS/FPS.js index d7864d8..a122d27 100644 --- a/src/pages/Payment/FPS/FPS.js +++ b/src/pages/Payment/FPS/FPS.js @@ -7,6 +7,7 @@ import { } from '@mui/material'; import * as React from "react"; import * as HttpUtils from "utils/HttpUtils"; +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'; @@ -55,7 +56,7 @@ const Index = () => { const pasgPath = 'https://sim.fps.payapps.hkicl.com.hk'; //Testing const loadPaymentUrl = "/api/payment/wallet/fps"; const cancelPaymentUrl = "/api/payment/cancelpayment"; - const paymentStatusApi = "/api/payment/status/"; + // const paymentStatusApi = "/api/payment/status/"; // const payloadUrl = "/api/payment/wallet/fps/enquiryfpspayload/"; // const receiverUrl = "/noti-api/payment/payment-notification"; @@ -198,7 +199,7 @@ const Index = () => { const getPaymentStatus = () => { if(Object.keys(paymentData).length > 0){ HttpUtils.post({ - url: paymentPath+paymentStatusApi+paymentData.transactionid, + url: UrlUtils.PAYMENT_STATUS_API+paymentData.transactionid, params:{ "apprefid": paymentData.transactionid, "webtoken": paymentData.webtoken, diff --git a/src/pages/Payment/PaymentCallback.js b/src/pages/Payment/PaymentCallback.js index 0beac0b..20506d0 100644 --- a/src/pages/Payment/PaymentCallback.js +++ b/src/pages/Payment/PaymentCallback.js @@ -47,7 +47,7 @@ const Index = () => { // const [transactionTime, setTransactionTime] = React.useState(""); const [onReady, setOnReady] = React.useState(false); const updatePaymentApi = "/api/payment/updatepayment"; - const paymentStatusApi = "/api/payment/status/"; + // const paymentStatusApi = "/api/payment/status/"; const intl = useIntl(); const { locale } = intl; @@ -109,7 +109,7 @@ const Index = () => { // ) HttpUtils.post({ - url: paymentPath + paymentStatusApi + transactionid, + url: UrlUtils.PAYMENT_STATUS_API+transactionid, params: { "apprefid": transactionid, "webtoken": localStorage.getItem("webtoken"), diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js index 156f04f..5e20ca3 100644 --- a/src/utils/ApiPathConst.js +++ b/src/utils/ApiPathConst.js @@ -158,6 +158,9 @@ export const PAYMENT_TRANSACTION_ID = apiPath+'/payment/api/transaction';//GET // export const PAYMENT_STATUS_API = paymentPath+'/api/payment/status/';//POST export const PAYMENT_STATUS_API = apiPath+'/payment/api/status/';//POST +export const LOAD_PAYMENT_URL = apiPath+ "/api/payment/wallet/fps";//POST +export const CANCEL_PAYMENT_URL = apiPath+ "/api/payment/cancelpayment";//POST + export const DEMAND_NOTE_PREVIEW = apiPath+'/demandNote/preview';//GET export const DEMAND_NOTE_CREATE = apiPath+'/demandNote/create';//POST export const DEMAND_NOTE_LIST = apiPath+'/demandNote/list';//GET pub From 383eddc64086cf499b014dbbc7423b95637b7aa3 Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Wed, 17 Apr 2024 17:16:41 +0800 Subject: [PATCH 03/11] upload payment api --- src/pages/Payment/Card/index.js | 7 ++++--- src/pages/Payment/FPS/FPS.js | 15 +++++++-------- src/pages/Payment/index.js | 9 ++++++--- src/utils/ApiPathConst.js | 8 +++++--- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/pages/Payment/Card/index.js b/src/pages/Payment/Card/index.js index 9900418..7294907 100644 --- a/src/pages/Payment/Card/index.js +++ b/src/pages/Payment/Card/index.js @@ -7,10 +7,11 @@ import { } from '@mui/material'; import * as React from "react"; import * as HttpUtils from "utils/HttpUtils"; +import * as UrlUtils from "utils/ApiPathConst"; import { useNavigate } 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 VisaIcon from "assets/images/icons/visacard.svg"; import MasterIcon from "assets/images/icons/mastercard.svg"; @@ -45,7 +46,7 @@ const Index = () => { // const [fpsqrcodeurl, setFpsqrcodeurl] = React.useState(""); // const pasgPath = 'https://fps.payapps.hkicl.com.hk'; //PRD // const pasgPath = 'https://sim.fps.payapps.hkicl.com.hk'; //Testing - const loadPaymentUrl = "/api/payment/web/"; + // const loadPaymentUrl = "/api/payment/web/"; // const paymentStatusApi = "/api/payment/status/"; // const payloadUrl = "/api/payment/wallet/fps/enquiryfpspayload/"; // const receiverUrl = "/noti-api/payment/payment-notification"; @@ -74,7 +75,7 @@ const Index = () => { localStorage.setItem("webtoken", paymentData.webtoken) HttpUtils.post({ - url: paymentPath+loadPaymentUrl+(paymentData.type=="PPS"?"pps":"creditcard"), + url: UrlUtils.LOAD_PAYMENT_URL+(paymentData.type=="PPS"?"pps":"creditcard"), params:{ "transactionid": paymentData.transactionid, //"apprefid:": paymentData.transactionid, diff --git a/src/pages/Payment/FPS/FPS.js b/src/pages/Payment/FPS/FPS.js index a122d27..c433744 100644 --- a/src/pages/Payment/FPS/FPS.js +++ b/src/pages/Payment/FPS/FPS.js @@ -11,7 +11,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 {currencyFormat} from "utils/FormatUtils"; // import {poll} from "utils/Utils"; @@ -54,8 +54,8 @@ const Index = () => { const pasgPathPrd = 'https://fps.payapps.hkicl.com.hk'; //PRD const pasgPath = 'https://sim.fps.payapps.hkicl.com.hk'; //Testing - const loadPaymentUrl = "/api/payment/wallet/fps"; - const cancelPaymentUrl = "/api/payment/cancelpayment"; + // const loadPaymentUrl = "/api/payment/wallet/fps"; + // const cancelPaymentUrl = "/api/payment/cancelpayment"; // const paymentStatusApi = "/api/payment/status/"; // const payloadUrl = "/api/payment/wallet/fps/enquiryfpspayload/"; // const receiverUrl = "/noti-api/payment/payment-notification"; @@ -132,10 +132,10 @@ const Index = () => { HttpUtils.post({ - url: paymentPath+loadPaymentUrl, + url: UrlUtils.LOAD_PAYMENT_FPS_URL, params:{ - "transactionid": transactionid, - "webtoken": webtoken, + // "transactionid": transactionid, + // "webtoken": webtoken, "paymentmethod":"04,BCFP,FPS", "order": { "totalamount":paymentData.amount, @@ -190,7 +190,6 @@ const Index = () => { setFpsqrcodeurl(openPASGUrl) setFpsqrcodeurlPrd(openPASGUrlPrd) setFpsqrcodeurlFps(openPASGUrlPrdFps) - } }); @@ -247,7 +246,7 @@ const Index = () => { const cancelPayment = ()=>{ if (Object.keys(paymentData).length>0){ HttpUtils.post({ - url: paymentPath+cancelPaymentUrl, + url: UrlUtils.CANCEL_PAYMENT_URL, params:{ "transactionid": paymentData.transactionid, "webtoken": paymentData.webtoken, diff --git a/src/pages/Payment/index.js b/src/pages/Payment/index.js index 7f1c225..4ec733a 100644 --- a/src/pages/Payment/index.js +++ b/src/pages/Payment/index.js @@ -156,7 +156,8 @@ const Index = () => { transNo: transactionData.transactionid, payMethod: paymentMethod, payAmount: totalAmount, - appIdList: location.state?.appIdList ?? [] + appIdList: location.state?.appIdList ?? [], + webtoken: transactionData.webtoken }, onSuccess: function (responData) { localStorage.removeItem("paymentId"); @@ -171,7 +172,7 @@ const Index = () => { }); } - //For testing + // For testing // if (paymentMethod != "") { // HttpUtils.post({ // url: UrlUtils.PAYMENT_CREATE, @@ -179,7 +180,9 @@ const Index = () => { // transNo: "test0002", // payMethod: paymentMethod, // payAmount: totalAmount, - // appIdList: location.state?.appIdList ?? [] + // appIdList: location.state?.appIdList ?? [], + // webtoken: "test000234123412341234123412354212312412341234124123124124124123124123124124" + // }, // onSuccess: function (responData) { // localStorage.removeItem("paymentId"); diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js index 5e20ca3..a6193c2 100644 --- a/src/utils/ApiPathConst.js +++ b/src/utils/ApiPathConst.js @@ -157,9 +157,11 @@ export const PAYMENT_AVAILABLE_PAYMENT = apiPath+'/payment/api/availability';//P export const PAYMENT_TRANSACTION_ID = apiPath+'/payment/api/transaction';//GET // export const PAYMENT_STATUS_API = paymentPath+'/api/payment/status/';//POST export const PAYMENT_STATUS_API = apiPath+'/payment/api/status/';//POST - -export const LOAD_PAYMENT_URL = apiPath+ "/api/payment/wallet/fps";//POST -export const CANCEL_PAYMENT_URL = apiPath+ "/api/payment/cancelpayment";//POST +// export const LOAD_PAYMENT_URL = paymentPath+ "/api/payment/wallet/fps";//POST +export const LOAD_PAYMENT_FPS_URL = apiPath+ "/payment/api/wallet/fps";//POST +// export const CANCEL_PAYMENT_URL = paymentPath+ "/api/payment/cancelpayment";//POST +export const CANCEL_PAYMENT_URL = apiPath+ "/payment/api/cancelpayment";//POST +export const LOAD_PAYMENT_URL = apiPath+ "/payment/api/web/";//POST export const DEMAND_NOTE_PREVIEW = apiPath+'/demandNote/preview';//GET export const DEMAND_NOTE_CREATE = apiPath+'/demandNote/create';//POST From 300b8208ba90818d730271ddba4236710e926c4e Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Fri, 19 Apr 2024 15:34:47 +0800 Subject: [PATCH 04/11] update get status api --- src/pages/Payment/Details_Public/index.js | 24 +++++++-- src/pages/Payment/FPS/AckPage.js | 59 +++++++++++++---------- src/utils/ApiPathConst.js | 2 + 3 files changed, 54 insertions(+), 31 deletions(-) diff --git a/src/pages/Payment/Details_Public/index.js b/src/pages/Payment/Details_Public/index.js index 5407daf..18f548c 100644 --- a/src/pages/Payment/Details_Public/index.js +++ b/src/pages/Payment/Details_Public/index.js @@ -77,17 +77,31 @@ const Index = () => { const loadForm = () => { if (params.id > 0) { - HttpUtils.get({ url: UrlUtils.PAYMENT_LOAD + "/" + params.id, onSuccess: (responseData) => { if (!responseData.data?.id) { navigate("/paymentPage/search"); } - responseData.data["transDateStr"] = DateUtils.dateFormat(responseData.data.transDateTime, "DD/MM/YYYY"); - responseData.data["transTimeStr"] = DateUtils.dateFormat(responseData.data.transDateTime, "HH:mm:ss"); - setItemList(responseData.paymentItemList) - setRecord(responseData.data); + if(responseData.data.status==null||responseData.data.status=="INPR"){ + HttpUtils.post({ + url: UrlUtils.PAYMENT_RETRY_STATUS_API, + params:{ + "paymentId": params.id + }, + onSuccess: function(responseData2){ + responseData2.paymentItemList.data["transDateStr"] = DateUtils.dateFormat(responseData2.data.transDateTime, "DD/MM/YYYY"); + responseData2.paymentItemList.data["transTimeStr"] = DateUtils.dateFormat(responseData2.data.transDateTime, "HH:mm:ss"); + setItemList(responseData2.paymentItemList) + setRecord(responseData2.data); + } + }); + }else{ + responseData.data["transDateStr"] = DateUtils.dateFormat(responseData.data.transDateTime, "DD/MM/YYYY"); + responseData.data["transTimeStr"] = DateUtils.dateFormat(responseData.data.transDateTime, "HH:mm:ss"); + setItemList(responseData.paymentItemList) + setRecord(responseData.data); + } } }); } diff --git a/src/pages/Payment/FPS/AckPage.js b/src/pages/Payment/FPS/AckPage.js index dbc7bc7..19c6000 100644 --- a/src/pages/Payment/FPS/AckPage.js +++ b/src/pages/Payment/FPS/AckPage.js @@ -85,37 +85,44 @@ const AckPage = () => { let webtoken = localStorage.getItem("webtoken") HttpUtils.post({ - url: UrlUtils.PAYMENT_STATUS_API+transactionid, + url: UrlUtils.PAYMENT_CALLBACK_STATUS_API+transactionid, params:{ "apprefid": transactionid, "webtoken": webtoken, + "paymentId": localStorage.getItem("paymentId") }, onSuccess: function(responseData){ - setResponeDataData(responseData) - - if (responseData.paymentdetail?.result?.paymentstatuscode === "APPR") { - localStorage.removeItem("webtoken"); - localStorage.removeItem("transactionid"); - } - HttpUtils.post({ - url: UrlUtils.PAYMENT_SAVE, - params: { - id: localStorage.getItem("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"); - // setPaymentId(responseData2.id) - } - }); + localStorage.removeItem("webtoken"); + localStorage.removeItem("transactionid"); + setResponeDataData(responseData.transactionData) + responseData.paymentItemList.data["transDateStr"] = DateUtils.dateFormat(responseData.data.transDateTime, "DD/MM/YYYY"); + responseData.paymentItemList.data["transTimeStr"] = DateUtils.dateFormat(responseData.data.transDateTime, "HH:mm:ss"); + setItemList(responseData.paymentItemList) + setPaymentData(responseData.data); + + + // if (responseData.paymentdetail?.result?.paymentstatuscode === "APPR") { + + // } + // HttpUtils.post({ + // url: UrlUtils.PAYMENT_SAVE, + // params: { + // id: localStorage.getItem("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"); + // // setPaymentId(responseData2.id) + // } + // }); } }); diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js index a6193c2..229b4dc 100644 --- a/src/utils/ApiPathConst.js +++ b/src/utils/ApiPathConst.js @@ -162,6 +162,8 @@ export const LOAD_PAYMENT_FPS_URL = apiPath+ "/payment/api/wallet/fps";//POST // export const CANCEL_PAYMENT_URL = paymentPath+ "/api/payment/cancelpayment";//POST export const CANCEL_PAYMENT_URL = apiPath+ "/payment/api/cancelpayment";//POST export const LOAD_PAYMENT_URL = apiPath+ "/payment/api/web/";//POST +export const PAYMENT_CALLBACK_STATUS_API = apiPath+ "/payment/callback/status/";//POST +export const PAYMENT_RETRY_STATUS_API = apiPath+ "/payment/paymentdetail/status";//POST export const DEMAND_NOTE_PREVIEW = apiPath+'/demandNote/preview';//GET export const DEMAND_NOTE_CREATE = apiPath+'/demandNote/create';//POST From 35c100811f6e79c495cbbafb61de57c25d801f81 Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Fri, 19 Apr 2024 16:03:00 +0800 Subject: [PATCH 05/11] update status api --- src/pages/Payment/PaymentCallback.js | 57 ++++++++++++++++------------ 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/src/pages/Payment/PaymentCallback.js b/src/pages/Payment/PaymentCallback.js index 20506d0..24ba657 100644 --- a/src/pages/Payment/PaymentCallback.js +++ b/src/pages/Payment/PaymentCallback.js @@ -109,36 +109,43 @@ const Index = () => { // ) HttpUtils.post({ - url: UrlUtils.PAYMENT_STATUS_API+transactionid, + url: UrlUtils.PAYMENT_CALLBACK_STATUS_API+transactionid, params: { "apprefid": transactionid, "webtoken": localStorage.getItem("webtoken"), + "paymentId": localStorage.getItem("paymentId") }, onSuccess: function (responseData) { - setResponeDataData(responseData) - if (responseData.paymentdetail?.result?.paymentstatuscode === "APPR") { - localStorage.removeItem("webtoken"); - localStorage.removeItem("transactionid"); - } - HttpUtils.post({ - url: UrlUtils.PAYMENT_SAVE, - params: { - id: localStorage.getItem("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"); - // setPaymentId(responseData2.id) - } - }); + localStorage.removeItem("webtoken"); + localStorage.removeItem("transactionid"); + setResponeDataData(responseData.transactionData) + responseData.paymentItemList.data["transDateStr"] = DateUtils.dateFormat(responseData.data.transDateTime, "DD/MM/YYYY"); + responseData.paymentItemList.data["transTimeStr"] = DateUtils.dateFormat(responseData.data.transDateTime, "HH:mm:ss"); + setItemList(responseData.paymentItemList) + setPaymentData(responseData.data); + + // if (responseData.paymentdetail?.result?.paymentstatuscode === "APPR") { + + // } + // HttpUtils.post({ + // url: UrlUtils.PAYMENT_SAVE, + // params: { + // id: localStorage.getItem("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"); + // // setPaymentId(responseData2.id) + // } + // }); } }); } From 0164cad16504851356065102a1be464cdecf75c8 Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Mon, 22 Apr 2024 17:56:09 +0800 Subject: [PATCH 06/11] fix api --- src/pages/Payment/Details_GLD/PaymentDetails.js | 2 +- src/pages/Payment/Details_Public/index.js | 6 ++++++ src/pages/Payment/FPS/AckPage.js | 5 +++-- src/pages/Payment/PaymentCallback.js | 11 ++++++----- src/pages/Payment/Search_Public/DataGrid.js | 3 ++- src/utils/ApiPathConst.js | 3 ++- 6 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/pages/Payment/Details_GLD/PaymentDetails.js b/src/pages/Payment/Details_GLD/PaymentDetails.js index 22e45b0..1262bb5 100644 --- a/src/pages/Payment/Details_GLD/PaymentDetails.js +++ b/src/pages/Payment/Details_GLD/PaymentDetails.js @@ -32,7 +32,7 @@ const PaymentDetails = ({ formData,doPrint,onDownload }) => { }, [data]); const getPaymentMethod=()=>{ - let paymentmethod = data.payload.paymentdetail.paymentmethod; + let paymentmethod = data.payload?.paymentdetail.paymentmethod; if("01" == paymentmethod) return "PPS"; if("02" == paymentmethod || "03" == paymentmethod) return "Credit Card"; if("04" == paymentmethod) return "FPS"; diff --git a/src/pages/Payment/Details_Public/index.js b/src/pages/Payment/Details_Public/index.js index 18f548c..2a13ffb 100644 --- a/src/pages/Payment/Details_Public/index.js +++ b/src/pages/Payment/Details_Public/index.js @@ -94,6 +94,12 @@ const Index = () => { responseData2.paymentItemList.data["transTimeStr"] = DateUtils.dateFormat(responseData2.data.transDateTime, "HH:mm:ss"); setItemList(responseData2.paymentItemList) setRecord(responseData2.data); + }, + onError: function(){ + responseData.data["transDateStr"] = DateUtils.dateFormat(responseData.data.transDateTime, "DD/MM/YYYY"); + responseData.data["transTimeStr"] = DateUtils.dateFormat(responseData.data.transDateTime, "HH:mm:ss"); + setItemList(responseData.paymentItemList) + setRecord(responseData.data); } }); }else{ diff --git a/src/pages/Payment/FPS/AckPage.js b/src/pages/Payment/FPS/AckPage.js index 19c6000..4ec6dd2 100644 --- a/src/pages/Payment/FPS/AckPage.js +++ b/src/pages/Payment/FPS/AckPage.js @@ -85,11 +85,12 @@ const AckPage = () => { let webtoken = localStorage.getItem("webtoken") HttpUtils.post({ - url: UrlUtils.PAYMENT_CALLBACK_STATUS_API+transactionid, + url: UrlUtils.PAYMENT_CALLBACK_STATUS_API, params:{ "apprefid": transactionid, "webtoken": webtoken, - "paymentId": localStorage.getItem("paymentId") + "paymentId": localStorage.getItem("paymentId"), + "transactionid":Number(transactionid) }, onSuccess: function(responseData){ localStorage.removeItem("webtoken"); diff --git a/src/pages/Payment/PaymentCallback.js b/src/pages/Payment/PaymentCallback.js index 24ba657..996f394 100644 --- a/src/pages/Payment/PaymentCallback.js +++ b/src/pages/Payment/PaymentCallback.js @@ -11,7 +11,7 @@ import * as React from "react"; import * as HttpUtils from "utils/HttpUtils"; import * as UrlUtils from "utils/ApiPathConst"; //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'; @@ -46,7 +46,7 @@ const Index = () => { // const [transactionDate, setTransactionDate] = React.useState(""); // const [transactionTime, setTransactionTime] = React.useState(""); const [onReady, setOnReady] = React.useState(false); - const updatePaymentApi = "/api/payment/updatepayment"; + // const updatePaymentApi = "/api/payment/updatepayment"; // const paymentStatusApi = "/api/payment/status/"; const intl = useIntl(); const { locale } = intl; @@ -81,7 +81,7 @@ const Index = () => { let receipt_token = params.get("RECEIPT_TOKEN").replace("%3D", "=") HttpUtils.post({ - url: paymentPath + updatePaymentApi, + url: UrlUtils.UPDATE_PAYMENT_API, params: { "transactionid": transactionid, "receipttoken": receipt_token, @@ -109,11 +109,12 @@ const Index = () => { // ) HttpUtils.post({ - url: UrlUtils.PAYMENT_CALLBACK_STATUS_API+transactionid, + url: UrlUtils.PAYMENT_CALLBACK_STATUS_API, params: { "apprefid": transactionid, "webtoken": localStorage.getItem("webtoken"), - "paymentId": localStorage.getItem("paymentId") + "paymentId": localStorage.getItem("paymentId"), + "transactionid":Number(transactionid) }, onSuccess: function (responseData) { localStorage.removeItem("webtoken"); diff --git a/src/pages/Payment/Search_Public/DataGrid.js b/src/pages/Payment/Search_Public/DataGrid.js index d27e8a7..75b0a1a 100644 --- a/src/pages/Payment/Search_Public/DataGrid.js +++ b/src/pages/Payment/Search_Public/DataGrid.js @@ -74,7 +74,8 @@ export default function SearchPublicNoticeTable({ recordList }) { width: isMdOrLg ? 'auto' : 160, flex: isMdOrLg ? 1 : undefined, valueGetter: (params) => { - return DateUtils.dateStr(params?.value); + // console.log(params) + return DateUtils.dateStr(params?.value?params.value:params.row.created); } }, { diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js index 850685e..aee9b69 100644 --- a/src/utils/ApiPathConst.js +++ b/src/utils/ApiPathConst.js @@ -161,8 +161,9 @@ export const LOAD_PAYMENT_FPS_URL = apiPath+ "/payment/api/wallet/fps";//POST // export const CANCEL_PAYMENT_URL = paymentPath+ "/api/payment/cancelpayment";//POST export const CANCEL_PAYMENT_URL = apiPath+ "/payment/api/cancelpayment";//POST export const LOAD_PAYMENT_URL = apiPath+ "/payment/api/web/";//POST -export const PAYMENT_CALLBACK_STATUS_API = apiPath+ "/payment/callback/status/";//POST +export const PAYMENT_CALLBACK_STATUS_API = apiPath+ "/payment/callback/status";//POST export const PAYMENT_RETRY_STATUS_API = apiPath+ "/payment/paymentdetail/status";//POST +export const UPDATE_PAYMENT_API = apiPath+ "/payment/api/updatepayment";//POST export const DEMAND_NOTE_PREVIEW = apiPath+'/demandNote/preview';//GET export const DEMAND_NOTE_CREATE = apiPath+'/demandNote/create';//POST From 6af48a94531d1313a06d070ee133dc2a11b15869 Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Tue, 23 Apr 2024 18:42:20 +0800 Subject: [PATCH 07/11] update payment --- src/pages/Payment/Details_Public/index.js | 7 +++++-- src/utils/statusUtils/PaymentStatus.js | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pages/Payment/Details_Public/index.js b/src/pages/Payment/Details_Public/index.js index 2a13ffb..9d1dd65 100644 --- a/src/pages/Payment/Details_Public/index.js +++ b/src/pages/Payment/Details_Public/index.js @@ -37,7 +37,7 @@ const Index = () => { const navigate = useNavigate() const intl = useIntl(); - const [record, setRecord] = React.useState(); + const [record, setRecord] = React.useState({}); const [itemList, setItemList] = React.useState([]); const [onReady, setOnReady] = React.useState(false); const [onDownload, setOnDownload] = React.useState(false); @@ -51,7 +51,9 @@ const Index = () => { }, []); React.useEffect(() => { - setOnReady(true); + if (Object.keys(record).length > 0) { + setOnReady(true); + } }, [record]); // const handleResize = () => { @@ -94,6 +96,7 @@ const Index = () => { responseData2.paymentItemList.data["transTimeStr"] = DateUtils.dateFormat(responseData2.data.transDateTime, "HH:mm:ss"); setItemList(responseData2.paymentItemList) setRecord(responseData2.data); + location.reload() }, onError: function(){ responseData.data["transDateStr"] = DateUtils.dateFormat(responseData.data.transDateTime, "DD/MM/YYYY"); diff --git a/src/utils/statusUtils/PaymentStatus.js b/src/utils/statusUtils/PaymentStatus.js index 2bf1223..08eae20 100644 --- a/src/utils/statusUtils/PaymentStatus.js +++ b/src/utils/statusUtils/PaymentStatus.js @@ -21,6 +21,6 @@ function getStatus(params) { if(status == "REJT") return REJT; if(status == "CANC") return CANC; if(status == "INPR") return INPR; - return CANC; + return INPR; } From 9c398c7a349bd9781abb1d41bbbaefdbe230a501 Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Wed, 24 Apr 2024 12:53:43 +0800 Subject: [PATCH 08/11] fix payment detail --- .../Payment/Details_Public/PaymentDetails.js | 20 +++++++++++++------ src/pages/Payment/Details_Public/index.js | 18 +++++++++++++---- src/pages/PublicNotice/ListPanel/index.js | 6 +++--- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/pages/Payment/Details_Public/PaymentDetails.js b/src/pages/Payment/Details_Public/PaymentDetails.js index 66dc04b..ebeebc5 100644 --- a/src/pages/Payment/Details_Public/PaymentDetails.js +++ b/src/pages/Payment/Details_Public/PaymentDetails.js @@ -35,10 +35,18 @@ const PaymentDetails = ({ formData,doPrint,onDownload }) => { }, [data]); const getPaymentMethod=()=>{ - let paymentmethod = data?.payload?.paymentdetail?.paymentmethod; - if("01" == paymentmethod) return "PPS"; - if("02" == paymentmethod || "03" == paymentmethod) return "Credit Card"; - if("04" == paymentmethod) return "FPS"; + let paymentmethod = "" + if (data?.payload!=null) { + paymentmethod = data.payload?.paymentdetail.paymentmethod; + if("01" == paymentmethod) return "PPS"; + if("02" == paymentmethod || "03" == paymentmethod) return "Credit Card"; + if("04" == paymentmethod) return "FPS"; + } else { + paymentmethod = data.payMethod; + if("01,PPSB,PPS" == paymentmethod) return "PPS"; + if("02,BCMP,CreditCard" == paymentmethod || "03,BCMP,CreditCard" == paymentmethod) return "Credit Card"; + if("04,BCFP,FPS" == paymentmethod) return "FPS"; + } return paymentmethod; } @@ -85,7 +93,7 @@ const PaymentDetails = ({ formData,doPrint,onDownload }) => { - {data.payload?.transactionid} + {data.payload?.transactionid?data.payload?.transactionid:data.transNo} @@ -141,7 +149,7 @@ const PaymentDetails = ({ formData,doPrint,onDownload }) => { - {"HK$ " + FormatUtils.currencyFormat(data.payload?.amount)} + {"HK$ " + FormatUtils.currencyFormat(data.payload?.amount?data.payload?.amount:data.payAmount)} diff --git a/src/pages/Payment/Details_Public/index.js b/src/pages/Payment/Details_Public/index.js index 9d1dd65..f425fd9 100644 --- a/src/pages/Payment/Details_Public/index.js +++ b/src/pages/Payment/Details_Public/index.js @@ -36,6 +36,8 @@ const Index = () => { const params = useParams(); const navigate = useNavigate() const intl = useIntl(); + const [responeData, setResponeData] = React.useState({}); + const [transactionData, setTransactionData] = React.useState({}); const [record, setRecord] = React.useState({}); const [itemList, setItemList] = React.useState([]); @@ -46,15 +48,20 @@ const Index = () => { React.useEffect(() => { loadForm(); - // window.addEventListener('resize', handleResize) }, []); React.useEffect(() => { - if (Object.keys(record).length > 0) { + if (Object.keys(responeData).length > 0) { + setTransactionData(responeData); + } + }, [responeData]); + + React.useEffect(() => { + if (Object.keys(transactionData).length > 0) { setOnReady(true); } - }, [record]); + }, [transactionData]); // const handleResize = () => { // setDetailsOrder(window.innerWidth > 1023 ? 2 : -1); @@ -96,13 +103,15 @@ const Index = () => { responseData2.paymentItemList.data["transTimeStr"] = DateUtils.dateFormat(responseData2.data.transDateTime, "HH:mm:ss"); setItemList(responseData2.paymentItemList) setRecord(responseData2.data); - location.reload() + setResponeData(responseData2.paymentItemList) }, onError: function(){ responseData.data["transDateStr"] = DateUtils.dateFormat(responseData.data.transDateTime, "DD/MM/YYYY"); responseData.data["transTimeStr"] = DateUtils.dateFormat(responseData.data.transDateTime, "HH:mm:ss"); setItemList(responseData.paymentItemList) setRecord(responseData.data); + setResponeData(responseData.paymentItemList) + } }); }else{ @@ -110,6 +119,7 @@ const Index = () => { responseData.data["transTimeStr"] = DateUtils.dateFormat(responseData.data.transDateTime, "HH:mm:ss"); setItemList(responseData.paymentItemList) setRecord(responseData.data); + setResponeData(responseData.paymentItemList) } } }); diff --git a/src/pages/PublicNotice/ListPanel/index.js b/src/pages/PublicNotice/ListPanel/index.js index 7976dd5..db5ced0 100644 --- a/src/pages/PublicNotice/ListPanel/index.js +++ b/src/pages/PublicNotice/ListPanel/index.js @@ -118,8 +118,8 @@ const PublicNotice = () => { - - + +