complete popup fixed
This commit is contained in:
@@ -18,7 +18,7 @@ function CompleteConfirmCredit({ onClose, confirmCredit }) {
|
||||
{/* Success Icon for now */}
|
||||
<div className="flex items-center w-full justify-center">
|
||||
{data?.result == "Charge success" ||
|
||||
data?.return_status == "successful" ? (
|
||||
data?.status == "successful" ? (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="100"
|
||||
@@ -57,7 +57,7 @@ function CompleteConfirmCredit({ onClose, confirmCredit }) {
|
||||
<div className={`flex items-center`}>
|
||||
<h1 className="text-xl font-semibold text-dark-gray dark:text-white tracking-tighter my-1">
|
||||
{data?.result == "Charge success" ||
|
||||
data?.return_status == "successful"
|
||||
data?.status == "successful"
|
||||
? "Credit was Successful!"
|
||||
: "Credit was Unsuccessful"}
|
||||
</h1>
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user