update withdrawal emoney
- set msisdn destination hardcode - set origin with id_customer
This commit is contained in:
@ -10,12 +10,12 @@ import { toast } from 'sonner';
|
||||
|
||||
const WithdrawInput = () => {
|
||||
const initialForm: {
|
||||
msisdn: string;
|
||||
id_customer: string;
|
||||
amount: string;
|
||||
pin: string;
|
||||
purpose: string;
|
||||
} = {
|
||||
msisdn: '',
|
||||
id_customer: '',
|
||||
amount: '',
|
||||
pin: '',
|
||||
purpose: ''
|
||||
@ -72,9 +72,10 @@ const WithdrawInput = () => {
|
||||
|
||||
try {
|
||||
const response = await GetData(`${API_URL_CUSTOMER}/customer/list`, query);
|
||||
console.log(response?.data);
|
||||
setCustomerMsisdn(
|
||||
response?.data.list.map((item: any) => ({
|
||||
value: item.msisdn,
|
||||
value: item.id,
|
||||
label: `${item.msisdn} - ${item.fullname}`
|
||||
}))
|
||||
);
|
||||
@ -91,12 +92,12 @@ const WithdrawInput = () => {
|
||||
|
||||
try {
|
||||
let response = await PostData(`${API_URL}/transaction/transfer`, {
|
||||
msisdn_destination: form.msisdn,
|
||||
msisdn_destination: '1112007',
|
||||
amount: form.amount,
|
||||
pin: form.pin,
|
||||
purpose: form.purpose,
|
||||
id_transaction_type: '380f270b-1f44-406f-a196-d6f784d68eb4',
|
||||
id_origin_customer: getAuth()?.user.customer.id,
|
||||
id_origin_customer: form.id_customer,
|
||||
type: 'S'
|
||||
});
|
||||
if (response?.status == true) {
|
||||
@ -119,7 +120,7 @@ const WithdrawInput = () => {
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
|
||||
if (form.amount == '' || form.msisdn == '' || form.pin == '') {
|
||||
if (form.amount == '' || form.id_customer == '' || form.pin == '') {
|
||||
setAlert({
|
||||
show: true,
|
||||
message: 'Please fill in all required fields.'
|
||||
@ -145,7 +146,7 @@ const WithdrawInput = () => {
|
||||
};
|
||||
|
||||
const handleMsisdnSelect = (msisdn: string) => {
|
||||
setForm({ ...form, msisdn });
|
||||
setForm({ ...form, id_customer: msisdn });
|
||||
setDropdownOpen(false);
|
||||
setSearchTerm(msisdn);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user