Bladeren bron

payment final update

master
Alex Cheung 1 jaar geleden
bovenliggende
commit
69db0d60b0
5 gewijzigde bestanden met toevoegingen van 55 en 19 verwijderingen
  1. +2
    -0
      src/pages/Payment/Details_Public/index.js
  2. +10
    -5
      src/pages/Payment/FPS/AckPage.js
  3. +41
    -12
      src/pages/Payment/FPS/FPS.js
  4. +1
    -1
      src/pages/PublicNotice/ListPanel/PendingPaymentTab.js
  5. +1
    -1
      src/utils/ApiPathConst.js

+ 2
- 0
src/pages/Payment/Details_Public/index.js Bestand weergeven

@@ -119,6 +119,8 @@ const Index = () => {
responseData.data["transDateStr"] = DateUtils.dateFormat(responseData.data.transDateTime, "DD/MM/YYYY");
responseData.data["transTimeStr"] = DateUtils.dateFormat(responseData.data.transDateTime, "HH:mm:ss");
setResponeData(responseData)
setItemList(responseData.paymentItemList)
setRecord(responseData.data);
}
}
});


+ 10
- 5
src/pages/Payment/FPS/AckPage.js Bestand weergeven

@@ -59,12 +59,17 @@ const AckPage = () => {
React.useEffect(() => {
if (location.state != undefined) {
setLocationData(location.state)
loadForm();
}
}, []);

React.useEffect(() => {
console.log(responeData)
if (Object.keys(locationData).length > 0){
loadForm();
}
}, [locationData]);

React.useEffect(() => {
// console.log(responeData)
if(Object.keys(responeData).length > 0){
setTransactionData(responeData)
}
@@ -72,7 +77,7 @@ const AckPage = () => {

React.useEffect(() => {
// console.log(paymentData)
console.log(transactionData)
// console.log(transactionData)
if(Object.keys(transactionData).length > 0 ){
setOnReady(true);
}
@@ -99,9 +104,9 @@ const AckPage = () => {
onSuccess: function(responseData){
localStorage.removeItem("webtoken");
localStorage.removeItem("transactionid");
responseData.data["transDateStr"] = DateUtils.dateFormat(responseData.data.transDateTime, "DD/MM/YYYY");
responseData.data["transTimeStr"] = DateUtils.dateFormat(responseData.data.transDateTime, "HH:mm:ss");
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);



+ 41
- 12
src/pages/Payment/FPS/FPS.js Bestand weergeven

@@ -115,12 +115,7 @@ const Index = () => {
}, [fpsTransctionData]);


const loadForm = () => () =>{
// const timeoutdatetime = "2023-10-26T09:04:30Z[UTC]"
// const convertedDateString = timeoutdatetime.replace("[UTC]", "");
// setFpsmerchanttimeoutdatetime(convertedDateString)
// setPaymentid("C202310268000681")
// setPaymentstatuscode("APPR")
const loadForm = () => {
const webtoken = paymentData.webtoken;
const transactionid = paymentData.transactionid;
console.log(webtoken)
@@ -130,7 +125,6 @@ const Index = () => {
localStorage.setItem("transactionid", transactionid)
localStorage.setItem("webtoken", webtoken)


HttpUtils.post({
url: UrlUtils.LOAD_PAYMENT_FPS_URL,
params:{
@@ -192,16 +186,48 @@ const Index = () => {
setFpsqrcodeurlFps(openPASGUrlPrdFps)
}
});

//testing
// const timeoutdatetime = "2024-05-06T11:10:30Z[UTC]"
// const convertedDateString = timeoutdatetime.replace("[UTC]", "");
// setFpsmerchanttimeoutdatetime(convertedDateString)
// setPaymentId("C202310268000681")
// const responseData=
// {
// "paymentid": "C202310268000681",
// "paymentstatus": "INPR",
// "fpsmerchanttimeoutdatetime": "2024-05-06T11:10:30Z[UTC]",
// "fpsqrcodeimgbase64": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAuyklEQVR4Xu3dfcy/d1nff2IAAAAASUVORK5CYII=",
// "fpsqrcodeurl": "http://127.0.0.1:8080/api/payment/wallet/fps/enquiryfpspayload/vm.JKDDlTOavR3ASviSwUnS1Lw4-"
// }
// setResponeDataData(responseData)
// const parsedUrl = new URL(responseData.fpsqrcodeurl);
// const fpsqrcodeurl = "https://"+window.location.hostname+'/payment'+parsedUrl.pathname;
// const fpsqrcodeurlwithFps = "https://"+"fps."+window.location.hostname+parsedUrl.pathname;
// console.log(parsedUrl)
// console.log(fpsqrcodeurl)
// console.log(fpsqrcodeurlwithFps)

// const openPASGUrl = pasgPath + '?pay_req_obj=' + encodeURIComponent(fpsqrcodeurl) + '&callback='
// + 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='
// + 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)
// setFpsqrcodeurlPrd(openPASGUrlPrd)
// setFpsqrcodeurlFps(openPASGUrlPrdFps)

}

const getPaymentStatus = () => {
if(Object.keys(paymentData).length > 0){
HttpUtils.post({
url: UrlUtils.PAYMENT_STATUS_API+paymentData.transactionid,
url: UrlUtils.PAYMENT_STATUS_API,
params:{
"apprefid": paymentData.transactionid,
"webtoken": paymentData.webtoken,
// "webtoken": paymentData.webtoken,
"transactionid":Number(paymentData.transactionid)
},
onSuccess: function(responseData){
const paymentstatuscode = responseData.paymentdetail.result.paymentstatuscode;
@@ -241,7 +267,7 @@ const Index = () => {
// console.log(timeOutDate.getTime()-currentTime.getTime())
getPaymentStatus();
if (timeOutDate.getTime()<currentTime.getTime()){
console.log("stop");
// console.log("stop");
clearInterval(currentTimer.current);
cancelPayment()
}
@@ -257,7 +283,10 @@ const Index = () => {
"paymentid": fpsTransctionData.paymentid
},
onSuccess: function(){
navigate('/paymentPage/fps/ackpage');
// navigate('/paymentPage/fps/ackpage');
let page = '/paymentPage/fps/ackpage';
let stateParams = { state: { transactionid: paymentData.transactionid} }
navigate(page, stateParams);
}
});
}


+ 1
- 1
src/pages/PublicNotice/ListPanel/PendingPaymentTab.js Bestand weergeven

@@ -131,7 +131,7 @@ export default function SubmittedTab({ rows }) {
const latestData = {};

responseData.forEach(item => {
console.log(item)
// console.log(item)
const { appId, timeDiff } = item;
if (latestData[appId] === undefined || timeDiff < latestData[appId].timeDiff) {
latestData[appId] = item;


+ 1
- 1
src/utils/ApiPathConst.js Bestand weergeven

@@ -155,7 +155,7 @@ export const PAYMENT_AVAILABLE_PAYMENT = apiPath+'/payment/api/availability';//P
// 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 PAYMENT_STATUS_API = apiPath+'/payment/api/status';//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


Laden…
Annuleren
Opslaan