diff --git a/submissions/chiconnect-bank-api-payout/src/App.jsx b/submissions/chiconnect-bank-api-payout/src/App.jsx index b4122b58..48b3d224 100644 --- a/submissions/chiconnect-bank-api-payout/src/App.jsx +++ b/submissions/chiconnect-bank-api-payout/src/App.jsx @@ -8,6 +8,8 @@ function App() { const [error, setError] = useState('') const [info, setInfo] = useState('') const [banks, setBanks] = useState([]) + const [showConfirmation, setShowConfirmation] = useState(false); + const [confirmationData, setConfirmationData] = useState(null); const [paymentData, setPaymentData] = useState({ bank: '', @@ -15,6 +17,27 @@ function App() { amount: '' }) + const handlePaymentSuccess = (data) => { + setInfo('Payment successful'); + setShowConfirmation(true); + setConfirmationData(data); + } + + + useEffect(() => { + const displayConfirmation = () => { + // Display the modal after a delay (you can adjust the delay time) + setTimeout(() => { + setShowConfirmation(false); // Close the modal after another delay (you can adjust the delay time) + setInfo('Payment successful'); // Show "Payment Successful" message + }, 2000); // Adjust the delay time (in milliseconds) + }; + + if (showConfirmation && confirmationData) { + displayConfirmation(); + } + }, [showConfirmation, confirmationData]); + const handleFormChange = (event) => { const { name, value } = event.target setPaymentData(prevData => { @@ -150,12 +173,22 @@ function App() { } - + + + {showConfirmation && confirmationData && ( +
{`Payment of ${confirmationData.valueInUSD} USD has been successfully sent to ${confirmationData.account_number}`}
+ +Powered by Chimoney
@@ -166,4 +199,4 @@ function App() { ) } -export default App \ No newline at end of file +export default App