From 15820bd328dd92b62a7ec7bf1fe0e9ece6ffdc0d Mon Sep 17 00:00:00 2001 From: anna Date: Wed, 1 Nov 2023 12:10:53 +0800 Subject: [PATCH] update payment callback page --- src/pages/Payment/Card/index.js | 2 +- src/pages/Payment/PaymentSuccess.js | 82 +++++++++++++++++++++++------ src/routes/PublicUserRoutes.js | 2 +- 3 files changed, 67 insertions(+), 19 deletions(-) diff --git a/src/pages/Payment/Card/index.js b/src/pages/Payment/Card/index.js index 8dbdc8c..c9ceebd 100644 --- a/src/pages/Payment/Card/index.js +++ b/src/pages/Payment/Card/index.js @@ -94,7 +94,7 @@ const Index = () => { }, // "locale":"", // "eserviceid":"", - "returnurl": "http://"+window.location.hostname+"/paymentPage/success" + "returnurl": "http://"+window.location.hostname+"/paymentPage/callback" }, ///{state:{transactionid:paymentData.transactionid,webtoken:paymentData.webtoken} } onSuccess: function(responseData){ diff --git a/src/pages/Payment/PaymentSuccess.js b/src/pages/Payment/PaymentSuccess.js index d0ceb94..c351603 100644 --- a/src/pages/Payment/PaymentSuccess.js +++ b/src/pages/Payment/PaymentSuccess.js @@ -36,11 +36,11 @@ 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/"; React.useEffect(() => { - console.log("webtoken: "+localStorage.getItem("webtoken")); + console.log("webtoken: " + localStorage.getItem("webtoken")); if (localStorage.getItem("webtoken") != null && localStorage.getItem("webtoken") != "") { loadForm(); } @@ -79,7 +79,7 @@ const Index = () => { "transactionid": transactionid, "receipttoken": receipt_token, }, - onSuccess: function () { + onSuccess: function (responseData) { // { // "transactionid": "", // "currencycode":"", @@ -103,28 +103,32 @@ const Index = () => { // } // } //} - HttpUtils.post({ - url: paymentPath + paymentStatusApi + transactionid, - params: { - "apprefid": transactionid, - "webtoken": localStorage.getItem("webtoken"), - }, - onSuccess: function (responseData) { - setResponeDataData(responseData) - localStorage.removeItem("webtoken"); - } - }); + if (responseData.paymentdetail?.result?.paymentstatuscode === "APPR") { + setResponeDataData(responseData) + localStorage.removeItem("webtoken"); + localStorage.removeItem("transactionid"); + } + // HttpUtils.post({ + // url: paymentPath + paymentStatusApi + transactionid, + // params: { + // "apprefid": transactionid, + // "webtoken": localStorage.getItem("webtoken"), + // }, + // onSuccess: function (responseData) { + + // } + // }); } }); - + } return ( !onReady ? : - ( + transactionData.paymentdetail?.result?.paymentstatuscode === "APPR" ? (
@@ -235,7 +239,51 @@ const Index = () => { {/*row 2*/} - ) + ) : + ( + + +
+ + 公共啟事:付款失敗 + +
+
+ {/*row 1*/} + + +
+ + + + 支付失敗訊息: +

+ 親愛的用戶,很遺憾地告訴您,您的付款操作未成功。我們在處理您的付款時遇到了問題。請您仔細檢查以下事項: +

+ 您的支付帳戶餘額是否足夠。 +
+ 您提供的付款資訊是否準確無誤。 +
+ 請檢查您的網路連線是否正常。 +

+ 如果您已確認以上問題無誤,但付款成功,請您嘗試以下解決方法: +

+ 嘗試使用其他付款方式進行付款。 +
+ 檢查您的支付帳戶是否有異常或限制。 +
+ 聯絡我們的客服人員尋求協助。 +

+ 如果您需要進一步的協助或有任何疑問,請隨時與我們聯繫。非常抱歉給您帶來不便,我們將盡快解決您的付款問題。謝謝! +
+ +
+
+
+
+ {/*row 2*/} +
+ ) ); }; diff --git a/src/routes/PublicUserRoutes.js b/src/routes/PublicUserRoutes.js index 16158c9..9f3fc31 100644 --- a/src/routes/PublicUserRoutes.js +++ b/src/routes/PublicUserRoutes.js @@ -79,7 +79,7 @@ const PublicDashboard = { element: }, { - path: 'paymentPage/success', + path: 'paymentPage/result', element: }, {