complete popup fixed
This commit is contained in:
@@ -18,7 +18,7 @@ function CompleteConfirmCredit({ onClose, confirmCredit }) {
|
|||||||
{/* Success Icon for now */}
|
{/* Success Icon for now */}
|
||||||
<div className="flex items-center w-full justify-center">
|
<div className="flex items-center w-full justify-center">
|
||||||
{data?.result == "Charge success" ||
|
{data?.result == "Charge success" ||
|
||||||
data?.return_status == "successful" ? (
|
data?.status == "successful" ? (
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="100"
|
width="100"
|
||||||
@@ -57,7 +57,7 @@ function CompleteConfirmCredit({ onClose, confirmCredit }) {
|
|||||||
<div className={`flex items-center`}>
|
<div className={`flex items-center`}>
|
||||||
<h1 className="text-xl font-semibold text-dark-gray dark:text-white tracking-tighter my-1">
|
<h1 className="text-xl font-semibold text-dark-gray dark:text-white tracking-tighter my-1">
|
||||||
{data?.result == "Charge success" ||
|
{data?.result == "Charge success" ||
|
||||||
data?.return_status == "successful"
|
data?.status == "successful"
|
||||||
? "Credit was Successful!"
|
? "Credit was Successful!"
|
||||||
: "Credit was Unsuccessful"}
|
: "Credit was Unsuccessful"}
|
||||||
</h1>
|
</h1>
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
import { FlutterWaveButton, closePaymentModal } from "flutterwave-react-v3";
|
import { FlutterWaveButton, closePaymentModal } from "flutterwave-react-v3";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { useNavigate } from "react-router-dom";
|
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
|
import debounce from "../../../hooks/debounce";
|
||||||
import usersService from "../../../services/UsersService";
|
import usersService from "../../../services/UsersService";
|
||||||
import { tableReload } from "../../../store/TableReloads";
|
import { tableReload } from "../../../store/TableReloads";
|
||||||
import LoadingSpinner from "../../Spinners/LoadingSpinner";
|
import LoadingSpinner from "../../Spinners/LoadingSpinner";
|
||||||
import debounce from "../../../hooks/debounce";
|
|
||||||
|
|
||||||
function ThePaymentText({ value, type }) {
|
function ThePaymentText({ value, type }) {
|
||||||
const cardDetails = value;
|
const cardDetails = value;
|
||||||
@@ -133,11 +132,18 @@ function ConfirmAddFund({
|
|||||||
...config,
|
...config,
|
||||||
text: "Proceed",
|
text: "Proceed",
|
||||||
callback: (response) => {
|
callback: (response) => {
|
||||||
debouncedSuccessPayment();
|
debouncedSuccessPayment(); //delays the call for 5 secs
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
dispatch(tableReload({ type: "WALLETTABLE" }));
|
|
||||||
onClose()
|
|
||||||
closePaymentModal();
|
closePaymentModal();
|
||||||
|
setConfirmCredit((prev) => ({
|
||||||
|
...prev,
|
||||||
|
show: {
|
||||||
|
awaitConfirm: { loader: false, state: false },
|
||||||
|
acceptConfirm: { loader: false, state: true },
|
||||||
|
},
|
||||||
|
data: response,
|
||||||
|
}));
|
||||||
|
console.log("**** checking fw res **** ", response);
|
||||||
}, 1500);
|
}, 1500);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -150,33 +156,25 @@ function ConfirmAddFund({
|
|||||||
.resultTopUp(reqData)
|
.resultTopUp(reqData)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.data.internal_return < 0) {
|
if (res.data.internal_return < 0) {
|
||||||
console.log("**** internal return **** THIS WAS REACHED");
|
console.log("**** internal return **** THIS WAS REACHED");
|
||||||
|
|
||||||
setRequestStatus({
|
setRequestStatus({
|
||||||
message: "Could not finish transaction",
|
message: "Could not finish transaction",
|
||||||
loading: false,
|
loading: false,
|
||||||
status: false,
|
status: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
// setConfirmCredit((prev) => ({
|
||||||
setConfirmCredit((prev) => ({
|
// ...prev,
|
||||||
...prev,
|
// show: {
|
||||||
show: {
|
// awaitConfirm: { loader: false, state: false },
|
||||||
awaitConfirm: { loader: false, state: false },
|
// acceptConfirm: { loader: false, state: true },
|
||||||
acceptConfirm: { loader: false, state: true },
|
// },
|
||||||
},
|
// data: res,
|
||||||
data: res,
|
// }));
|
||||||
}));
|
|
||||||
}, 1500);
|
// 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) => {
|
.catch((err) => {
|
||||||
setRequestStatus({
|
setRequestStatus({
|
||||||
@@ -184,11 +182,22 @@ function ConfirmAddFund({
|
|||||||
loading: false,
|
loading: false,
|
||||||
status: 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");
|
toast.success("Opps! something went wrong");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const debouncedSuccessPayment = debounce(onSuccessPayment, 5000)
|
const debouncedSuccessPayment = debounce(onSuccessPayment, 5000);
|
||||||
|
|
||||||
const handlePrevCard = async () => {
|
const handlePrevCard = async () => {
|
||||||
const { amount, credit_reference, currency } = __confirmData;
|
const { amount, credit_reference, currency } = __confirmData;
|
||||||
|
|||||||
Reference in New Issue
Block a user