transaction topup & disbursement fixing
This commit is contained in:
@ -11,7 +11,7 @@ import { toast } from 'sonner';
|
|||||||
|
|
||||||
const TransactionDisbursement = () => {
|
const TransactionDisbursement = () => {
|
||||||
const [form, setForm] = useState({
|
const [form, setForm] = useState({
|
||||||
customerId: '',
|
msisdn: '',
|
||||||
amount: '',
|
amount: '',
|
||||||
pin: ''
|
pin: ''
|
||||||
});
|
});
|
||||||
@ -21,22 +21,21 @@ const TransactionDisbursement = () => {
|
|||||||
const handleSubmit = async (e: any) => {
|
const handleSubmit = async (e: any) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
console.log('Submitted Data:', form);
|
console.log('Submitted Data:', form);
|
||||||
if (form.amount == '' || form.customerId == '' || form.pin == '') {
|
if (form.amount == '' || form.msisdn == '' || form.pin == '') {
|
||||||
toast.warning('Please fill in all required fields.')
|
toast.warning('Please fill in all required fields.')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// let requestTopup = await PostData(`${API_URL}/transaction/request-topup`, {
|
let requestTopup = await PostData(`${API_URL}/transaction/topup-downline`, {
|
||||||
// amount: form.topupAmount,
|
msisdn_destination: form.msisdn,
|
||||||
// pin: form.pin
|
amount: form.amount,
|
||||||
// })
|
pin: form.pin
|
||||||
// console.log(requestTopup)
|
})
|
||||||
// if (requestTopup?.status == true) {
|
if (requestTopup?.status == true) {
|
||||||
// toast.success('Success Request Topup')
|
toast.success('Success Request Topup')
|
||||||
// } else {
|
} else {
|
||||||
// toast.warning(`${requestTopup?.message}`)
|
toast.warning(`${requestTopup?.message}`)
|
||||||
// }
|
}
|
||||||
toast.warning('Failed')
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.warning('Failed')
|
toast.warning('Failed')
|
||||||
}
|
}
|
||||||
@ -68,11 +67,12 @@ const TransactionDisbursement = () => {
|
|||||||
{/* form */}
|
{/* form */}
|
||||||
<form onSubmit={handleSubmit} className="space-y-6">
|
<form onSubmit={handleSubmit} className="space-y-6">
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="customerId">Customer ID</label><span className="text-red-500">*</span>
|
<label htmlFor="msisdn">Destination MSISDN</label><span className="text-red-500">*</span>
|
||||||
<Input
|
<Input
|
||||||
id="customerId"
|
id="msisdn"
|
||||||
value={form.customerId}
|
type="number"
|
||||||
onChange={(e) => setForm({ ...form, customerId: e.target.value })}
|
value={form.msisdn}
|
||||||
|
onChange={(e) => setForm({ ...form, msisdn: e.target.value })}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@ -30,7 +30,6 @@ const TransactionTopup = () => {
|
|||||||
amount: form.topupAmount,
|
amount: form.topupAmount,
|
||||||
pin: form.pin
|
pin: form.pin
|
||||||
})
|
})
|
||||||
console.log(requestTopup)
|
|
||||||
if (requestTopup?.status == true) {
|
if (requestTopup?.status == true) {
|
||||||
toast.success('Success Request Topup')
|
toast.success('Success Request Topup')
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user