Browse Source

update payment success

master
Anna Ho 1 year ago
parent
commit
84e4f5efe6
1 changed files with 41 additions and 5 deletions
  1. +41
    -5
      src/pages/Payment/PaymentSuccess.js

+ 41
- 5
src/pages/Payment/PaymentSuccess.js View File

@@ -39,6 +39,7 @@ const Index = () => {
const [transactionDate, setTransactionDate] = React.useState("");
const [transactionTime, setTransactionTime] = React.useState("");
const [onReady, setOnReady] = React.useState(false);
const updatePaymentApi = "/api/payment/updatepayment";
const paymentStatusApi = "/api/payment/status/";


@@ -70,17 +71,52 @@ const Index = () => {
setTransactionTime(trnTime)
const params = new URLSearchParams(window.location.pathname);
let transactionid = params.get("TRANSACTION_ID")
let receipt_token = params.get("RECEIPT_TOKEN").replace("%3D", "=")

HttpUtils.post({
url: paymentPath + paymentStatusApi + transactionid,
url: paymentPath + updatePaymentApi,
params: {
"apprefid": transactionid,
"webtoken": params.webtoken,
"transactionid": transactionid,
"receipttoken": receipt_token,
},
onSuccess: function (responseData) {
setResponeDataData(responseData)
onSuccess: function () {
// {
// "transactionid": "<transactionid>",
// "currencycode":"<currencycode>",
// "amount":<amount>,
// "paymentdetail":{
// "paymentid": "<paymentid>",
// "paymentmethod": "<paymentmethod>",
// "time": "<time>",
// "brandname": "<brandname>",
// "channel": "<channeltype>",
// "subtype": "<subtype>",
// "attemptno": "<attemptno>",
// "result": {
// "code": "<code>",
// "paymentstatuscode":
// "<paymentstatuscode>"
// "description": "<description>",
// "rejectreasoncode":
// "<rejectreasoncode>",
// "canretry": "<retry>"
// }
// }
//}
HttpUtils.post({
url: paymentPath + paymentStatusApi + transactionid,
params: {
"apprefid": transactionid,
"webtoken": params.webtoken,
},
onSuccess: function (responseData) {
setResponeDataData(responseData)
}
});
}
});

}

return (


Loading…
Cancel
Save