import React, { useEffect, useState } from "react"; import GlobalModel from "../common/GlobalModel"; import Invoice from "./Invoice"; import { useSelector } from "react-redux"; import { blockUI, unblockUI } from "../../utils/blockUI"; import { error } from "pdf-lib"; import { useSelfGetSubscription } from "../../hooks/useAuth"; const VerifiedPayment = ({ responsePayment, setStepStatus }) => { const [isGenerateInvoice, setIsGenerateInvoice] = useState(false); const { tenantEnquireId, paymentDetailId, planId } = useSelector( (store) => store.localVariables.selfTenant ); const { mutate: getSubscription, isPending, isError, isSuccess, error, } = useSelfGetSubscription( () => { unblockUI(); setStepStatus?.((prev) => ({ ...prev, 5: "success" })); }, () => { unblockUI(); setStepStatus?.((prev) => ({ ...prev, 5: "failed" })); } ); useEffect(() => { if (responsePayment?.success) { const payload = { tenantEnquireId, paymentDetailId, planId }; getSubscription(payload); } }, [responsePayment]); if (isError) { return (
Unfortunately, your subscription transaction could not be completed.
{JSON.stringify(error, null, 2)}
Please wait while we verify your transaction. Do not refresh or close this page.
Thank you for your payment. Your subscription has been successfully activated.