瀏覽代碼

update token handle in create payment

master
Alex Cheung 1 年之前
父節點
當前提交
c420102c21
共有 1 個文件被更改,包括 181 次插入179 次删除
  1. +181
    -179
      src/pages/Payment/index.js

+ 181
- 179
src/pages/Payment/index.js 查看文件

@@ -149,32 +149,11 @@ const Index = () => {
paymentMethod = "01,PPSB,PPS";
}
// if (paymentMethod != "") {
// HttpUtils.post({
// url: UrlUtils.PAYMENT_CREATE,
// params: {
// transNo: transactionData.transactionid,
// payMethod: paymentMethod,
// payAmount: totalAmount,
// appIdList: location.state?.appIdList ?? []
// },
// onSuccess: function (responData) {
// localStorage.removeItem("paymentId");
// localStorage.setItem("paymentId", responData.id)
// setOnPayment(false)
// const result = handleRefreshTokenFunction();
// console.log(result)
// navigate(page, stateParams);
// }
// });
// }

//For testing
if (paymentMethod != "") {
HttpUtils.post({
url: UrlUtils.PAYMENT_CREATE,
params: {
transNo: "test0002",
transNo: transactionData.transactionid,
payMethod: paymentMethod,
payAmount: totalAmount,
appIdList: location.state?.appIdList ?? []
@@ -182,48 +161,71 @@ const Index = () => {
onSuccess: function (responData) {
localStorage.removeItem("paymentId");
localStorage.setItem("paymentId", responData.id)
setOnPayment(false)
let result = handleRefreshTokenFunction();
console.log(result)
// console.log(result)
if(result){
navigate(page, stateParams);
}
}
});
}

//For testing
// if (paymentMethod != "") {
// HttpUtils.post({
// url: UrlUtils.PAYMENT_CREATE,
// params: {
// transNo: "test0002",
// payMethod: paymentMethod,
// payAmount: totalAmount,
// appIdList: location.state?.appIdList ?? []
// },
// onSuccess: function (responData) {
// localStorage.removeItem("paymentId");
// localStorage.setItem("paymentId", responData.id)
// let result = handleRefreshTokenFunction();
// console.log(result)
// if(result){
// navigate(page, stateParams);
// }
// }
// });
// }
}
}, [afterConfirmPayment]);

const getAvailablePayment = () =>{
// HttpUtils.post({
// url: UrlUtils.PAYMENT_AVAILABLE_PAYMENT,
// params: {
// "locale": locale === 'en' ?Utils.local.en:locale === 'zh-HK' ?Utils.local.zh:Utils.local.cn,
// "amount": totalAmount,
// // "eserviceids": [
// // "<eserviceid>", "<eserviceid>"
// // ],
// "preferpaymentmethods": Utils.preferpaymentmethods
// },
// onSuccess: (responseData) => {
// let availableMethods = responseData.availablepaymentmethods;
// setAvailableMethods(availableMethods);
// HttpUtils.get({
// url: UrlUtils.PAYMENT_LIMIT_SETTING_LIST,
// params: {},
// onSuccess: (responseData) => {
// // console.log(responseData)
// setPaymentLimit(responseData)
HttpUtils.post({
url: UrlUtils.PAYMENT_AVAILABLE_PAYMENT,
params: {
"locale": locale === 'en' ?Utils.local.en:locale === 'zh-HK' ?Utils.local.zh:Utils.local.cn,
"amount": totalAmount,
// "eserviceids": [
// "<eserviceid>", "<eserviceid>"
// ],
"preferpaymentmethods": Utils.preferpaymentmethods
},
onSuccess: (responseData) => {
let availableMethods = responseData.availablepaymentmethods;
setAvailableMethods(availableMethods);
HttpUtils.get({
url: UrlUtils.PAYMENT_LIMIT_SETTING_LIST,
params: {},
onSuccess: (responseData) => {
// console.log(responseData)
setPaymentLimit(responseData)
// },
// onError: () =>{
// // setOnReady(true)
// }
// });
// },
// onError: () =>{
// setOnReady(true)
// }
// });
},
onError: () =>{
// setOnReady(true)
}
});
},
onError: () =>{
setOnReady(true)
}
});
HttpUtils.get({
url: UrlUtils.PAYMENT_LIMIT_SETTING_LIST,
@@ -238,133 +240,133 @@ const Index = () => {
}
});

const responseData = {
"availablepaymentmethods": [
{
"active": "Y",
"code": "04,BCFP,FPS",
"pointstonote": [
{
"content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.",
"order": 10,
"type": "INFO"
},
{
"content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.",
"order": 11,
"type": "INFO"
}
],
"subtype": "FPS"
},
{
"active": "Y",
"code": "02,BCMP,CreditCard",
"pointstonote": [
{
"content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.",
"order": 10,
"type": "INFO"
},
{
"content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.",
"order": 11,
"type": "INFO"
},
{
"content": "Merchant Name is applicable to credit card payment method only.",
"order": 40,
"type": "INFO"
},
{
"content": "Under exceptional conditions, a refund may need to be arranged. If the payment is made by Credit Card, the refund can normally be made to the Credit Card account that is used for the payment.",
"order": 41,
"type": "INFO"
},
{
"content": "Some users may receive an error page or have to wait for several minutes before they get a response from the credit card payment gateway. If you experience such a problem, please wait a moment and retry, or change to use other available payment methods. We apologise for any inconvenience caused.",
"order": 42,
"type": "INFO"
},
{
"content": "Different credit card issuers may have implemented different mechanisms to authenticate the cardholder's identity during online payment. Please contact your card issuer if you want to learn more about the J/Secure, MasterCard SecureCode and Verified by Visa service. ",
"order": 43,
"type": "INFO"
}
],
"subtype": "CreditCard",
"supportedcard": [
"JCB",
"MasterCard",
"Visa"
]
},
{
"active": "Y",
"code": "03,BCMP,CreditCard",
"pointstonote": [
{
"content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.",
"order": 10,
"type": "INFO"
},
{
"content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.",
"order": 11,
"type": "INFO"
},
{
"content": "Merchant Name is applicable to credit card payment method only.",
"order": 40,
"type": "INFO"
},
{
"content": "Under exceptional conditions, a refund may need to be arranged. If the payment is made by Credit Card, the refund can normally be made to the Credit Card account that is used for the payment.",
"order": 41,
"type": "INFO"
},
{
"content": "Some users may receive an error page or have to wait for several minutes before they get a response from the credit card payment gateway. If you experience such a problem, please wait a moment and retry, or change to use other available payment methods. We apologise for any inconvenience caused.",
"order": 42,
"type": "INFO"
},
{
"content": "Different credit card issuers may have implemented different mechanisms to authenticate the cardholder's identity during online payment. Please contact your card issuer if you want to learn more about the J/Secure, MasterCard SecureCode and Verified by Visa service. ",
"order": 43,
"type": "INFO"
}
],
"subtype": "CreditCard",
"supportedcard": [
"UnionPay"
]
},
{
"active": "Y",
"code": "01,PPSB,PPS",
"pointstonote": [
{
"content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.",
"order": 10,
"type": "INFO"
},
{
"content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.",
"order": 11,
"type": "INFO"
},
{
"content": "PPS Shop&Buy (PPS) does not support payment via browsers of mobile devices (including mobile phones and tablets) at the moment. If you wish to pay by PPS, please change to use desktop computer. ",
"order": 21,
"type": "INFO"
}
],
"subtype": "PPS"
}
]
};
let availableMethods = responseData.availablepaymentmethods;
setAvailableMethods(availableMethods);
// const responseData = {
// "availablepaymentmethods": [
// {
// "active": "Y",
// "code": "04,BCFP,FPS",
// "pointstonote": [
// {
// "content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.",
// "order": 10,
// "type": "INFO"
// },
// {
// "content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.",
// "order": 11,
// "type": "INFO"
// }
// ],
// "subtype": "FPS"
// },
// {
// "active": "Y",
// "code": "02,BCMP,CreditCard",
// "pointstonote": [
// {
// "content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.",
// "order": 10,
// "type": "INFO"
// },
// {
// "content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.",
// "order": 11,
// "type": "INFO"
// },
// {
// "content": "Merchant Name is applicable to credit card payment method only.",
// "order": 40,
// "type": "INFO"
// },
// {
// "content": "Under exceptional conditions, a refund may need to be arranged. If the payment is made by Credit Card, the refund can normally be made to the Credit Card account that is used for the payment.",
// "order": 41,
// "type": "INFO"
// },
// {
// "content": "Some users may receive an error page or have to wait for several minutes before they get a response from the credit card payment gateway. If you experience such a problem, please wait a moment and retry, or change to use other available payment methods. We apologise for any inconvenience caused.",
// "order": 42,
// "type": "INFO"
// },
// {
// "content": "Different credit card issuers may have implemented different mechanisms to authenticate the cardholder's identity during online payment. Please contact your card issuer if you want to learn more about the J/Secure, MasterCard SecureCode and Verified by Visa service. ",
// "order": 43,
// "type": "INFO"
// }
// ],
// "subtype": "CreditCard",
// "supportedcard": [
// "JCB",
// "MasterCard",
// "Visa"
// ]
// },
// {
// "active": "Y",
// "code": "03,BCMP,CreditCard",
// "pointstonote": [
// {
// "content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.",
// "order": 10,
// "type": "INFO"
// },
// {
// "content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.",
// "order": 11,
// "type": "INFO"
// },
// {
// "content": "Merchant Name is applicable to credit card payment method only.",
// "order": 40,
// "type": "INFO"
// },
// {
// "content": "Under exceptional conditions, a refund may need to be arranged. If the payment is made by Credit Card, the refund can normally be made to the Credit Card account that is used for the payment.",
// "order": 41,
// "type": "INFO"
// },
// {
// "content": "Some users may receive an error page or have to wait for several minutes before they get a response from the credit card payment gateway. If you experience such a problem, please wait a moment and retry, or change to use other available payment methods. We apologise for any inconvenience caused.",
// "order": 42,
// "type": "INFO"
// },
// {
// "content": "Different credit card issuers may have implemented different mechanisms to authenticate the cardholder's identity during online payment. Please contact your card issuer if you want to learn more about the J/Secure, MasterCard SecureCode and Verified by Visa service. ",
// "order": 43,
// "type": "INFO"
// }
// ],
// "subtype": "CreditCard",
// "supportedcard": [
// "UnionPay"
// ]
// },
// {
// "active": "Y",
// "code": "01,PPSB,PPS",
// "pointstonote": [
// {
// "content": "Please take note of the transaction reference number or PRINT this page for making enquiry on the payment status when necessary.",
// "order": 10,
// "type": "INFO"
// },
// {
// "content": "After pressing the 'Pay' button, please DO NOT leave this e-service until you receive the acknowledgement page, otherwise your transaction may not be successful.",
// "order": 11,
// "type": "INFO"
// },
// {
// "content": "PPS Shop&Buy (PPS) does not support payment via browsers of mobile devices (including mobile phones and tablets) at the moment. If you wish to pay by PPS, please change to use desktop computer. ",
// "order": 21,
// "type": "INFO"
// }
// ],
// "subtype": "PPS"
// }
// ]
// };
// let availableMethods = responseData.availablepaymentmethods;
// setAvailableMethods(availableMethods);
}

useEffect(() => {


Loading…
取消
儲存