// material-ui import { Grid, Typography, Stack, // Button, FormLabel, } from '@mui/material'; import * as React from "react"; import * as HttpUtils from "utils/HttpUtils"; //import { useNavigate } from 'react-router-dom'; import { paymentPath } from "auth/utils"; import Loadable from 'components/Loadable'; const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' const BackgroundHead = { backgroundImage: `url(${titleBackgroundImg})`, width: '100%', height: '100%', backgroundSize: 'contain', backgroundRepeat: 'no-repeat', backgroundColor: '#0C489E', backgroundPosition: 'right' } // ==============================|| DASHBOARD - DEFAULT ||============================== // const Index = () => { //const navigate = useNavigate() const [responeData, setResponeDataData] = React.useState({}); const [transactionData, setTransactionData] = React.useState({}); 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/"; React.useEffect(() => { console.log("webtoken: " + localStorage.getItem("webtoken")); if (localStorage.getItem("webtoken") != null && localStorage.getItem("webtoken") != "") { loadForm(); } // else{ // navigate("/dashboard"); // } }, []); React.useEffect(() => { console.log(responeData) if (Object.keys(responeData).length > 0) { setTransactionData(responeData) } }, [responeData]); React.useEffect(() => { console.log(transactionData) if (Object.keys(transactionData).length > 0) { setOnReady(true); } }, [transactionData]); const loadForm = () => { const date = new Date(); const trnDate = date.getDate() + "/" + date.getMonth() + "/" + date.getFullYear(); const trnTime = date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds(); setTransactionDate(trnDate) setTransactionTime(trnTime) const params = new URLSearchParams(window.location.search); let transactionid = params.get("TRANSACTION_ID") let receipt_token = params.get("RECEIPT_TOKEN").replace("%3D", "=") HttpUtils.post({ url: paymentPath + updatePaymentApi, params: { "transactionid": transactionid, "receipttoken": receipt_token, }, onSuccess: function (responseData) { // { // "transactionid": "", // "currencycode":"", // "amount":, // "paymentdetail":{ // "paymentid": "", // "paymentmethod": "", // "time": "