From 5385eedb2442c0353c3a276641b315b0c2f7f214 Mon Sep 17 00:00:00 2001 From: Wikzyy Date: Thu, 29 May 2025 22:15:28 +0700 Subject: [PATCH] update withdrawal emoney - set msisdn destination hardcode - set origin with id_customer --- .../withdrawl-emoney/blocks/WithdrawInput.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/pages/transaction/withdrawl-emoney/blocks/WithdrawInput.tsx b/src/pages/transaction/withdrawl-emoney/blocks/WithdrawInput.tsx index b68aef1..abd7514 100644 --- a/src/pages/transaction/withdrawl-emoney/blocks/WithdrawInput.tsx +++ b/src/pages/transaction/withdrawl-emoney/blocks/WithdrawInput.tsx @@ -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); };