From a7fe39cf6298c3fc62b78daf99f1a085a30774dc Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Mon, 4 Mar 2024 17:59:17 +0800 Subject: [PATCH] payment update --- src/pages/Payment/index.js | 350 ++++++++++++++++++------------------- 1 file changed, 175 insertions(+), 175 deletions(-) diff --git a/src/pages/Payment/index.js b/src/pages/Payment/index.js index 56d6653..eefedba 100644 --- a/src/pages/Payment/index.js +++ b/src/pages/Payment/index.js @@ -140,29 +140,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) - // 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 ?? [] @@ -174,40 +156,58 @@ const Index = () => { } }); } + + //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) + // 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": [ - // // "", "" - // // ], - // "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": [ + // "", "" + // ], + "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, @@ -222,133 +222,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(() => {