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