From 383eddc64086cf499b014dbbc7423b95637b7aa3 Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Wed, 17 Apr 2024 17:16:41 +0800 Subject: [PATCH] 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