diff --git a/src/components/MyWallet/Popup/CompleteConfirmCredit.jsx b/src/components/MyWallet/Popup/CompleteConfirmCredit.jsx index c9d62d4..7a579b0 100644 --- a/src/components/MyWallet/Popup/CompleteConfirmCredit.jsx +++ b/src/components/MyWallet/Popup/CompleteConfirmCredit.jsx @@ -18,7 +18,7 @@ function CompleteConfirmCredit({ onClose, confirmCredit }) { {/* Success Icon for now */}
{data?.result == "Charge success" || - data?.return_status == "successful" ? ( + data?.status == "successful" ? (

{data?.result == "Charge success" || - data?.return_status == "successful" + data?.status == "successful" ? "Credit was Successful!" : "Credit was Unsuccessful"}

diff --git a/src/components/MyWallet/Popup/ConfirmAddFund.jsx b/src/components/MyWallet/Popup/ConfirmAddFund.jsx index 49c1fa3..31a99bc 100644 --- a/src/components/MyWallet/Popup/ConfirmAddFund.jsx +++ b/src/components/MyWallet/Popup/ConfirmAddFund.jsx @@ -1,12 +1,11 @@ import { FlutterWaveButton, closePaymentModal } from "flutterwave-react-v3"; import React, { useState } from "react"; import { useDispatch, useSelector } from "react-redux"; -import { useNavigate } from "react-router-dom"; import { toast } from "react-toastify"; +import debounce from "../../../hooks/debounce"; import usersService from "../../../services/UsersService"; import { tableReload } from "../../../store/TableReloads"; import LoadingSpinner from "../../Spinners/LoadingSpinner"; -import debounce from "../../../hooks/debounce"; function ThePaymentText({ value, type }) { const cardDetails = value; @@ -133,11 +132,18 @@ function ConfirmAddFund({ ...config, text: "Proceed", callback: (response) => { - debouncedSuccessPayment(); + debouncedSuccessPayment(); //delays the call for 5 secs setTimeout(() => { - dispatch(tableReload({ type: "WALLETTABLE" })); - onClose() closePaymentModal(); + setConfirmCredit((prev) => ({ + ...prev, + show: { + awaitConfirm: { loader: false, state: false }, + acceptConfirm: { loader: false, state: true }, + }, + data: response, + })); + console.log("**** checking fw res **** ", response); }, 1500); }, }; @@ -150,33 +156,25 @@ function ConfirmAddFund({ .resultTopUp(reqData) .then((res) => { if (res.data.internal_return < 0) { - console.log("**** internal return **** THIS WAS REACHED"); - + console.log("**** internal return **** THIS WAS REACHED"); setRequestStatus({ message: "Could not finish transaction", loading: false, status: false, }); - setTimeout(() => { - setConfirmCredit((prev) => ({ - ...prev, - show: { - awaitConfirm: { loader: false, state: false }, - acceptConfirm: { loader: false, state: true }, - }, - data: res, - })); - }, 1500); + // setConfirmCredit((prev) => ({ + // ...prev, + // show: { + // awaitConfirm: { loader: false, state: false }, + // acceptConfirm: { loader: false, state: true }, + // }, + // data: res, + // })); + + // toast.success("Opps! something went wrong"); + } else return dispatch(tableReload({ type: "WALLETTABLE" })); - toast.success("Opps! something went wrong"); - } else { - setRequestStatus({ - message: "Topup successful", - loading: false, - status: true, - }); - } }) .catch((err) => { setRequestStatus({ @@ -184,11 +182,22 @@ function ConfirmAddFund({ loading: false, status: false, }); + + setTimeout(() => { + setConfirmCredit((prev) => ({ + ...prev, + show: { + awaitConfirm: { loader: false, state: false }, + acceptConfirm: { loader: false, state: true }, + }, + data: err, + })); + }, 1500); toast.success("Opps! something went wrong"); }); }; - const debouncedSuccessPayment = debounce(onSuccessPayment, 5000) + const debouncedSuccessPayment = debounce(onSuccessPayment, 5000); const handlePrevCard = async () => { const { amount, credit_reference, currency } = __confirmData;