[skip ci] fix payload retry transaction on history transaction
This commit is contained in:
@ -24,15 +24,14 @@ interface ResendTransactionProps {
|
||||
selectedTransactionForResend: any | null; // Adjust the type as per your requirements
|
||||
}
|
||||
|
||||
const ResendTransaction = ({ isOpen, onClose, selectedTransactionForResend }: ResendTransactionProps) => {
|
||||
|
||||
const ResendTransaction = ({
|
||||
isOpen,
|
||||
onClose,
|
||||
selectedTransactionForResend
|
||||
}: ResendTransactionProps) => {
|
||||
// const { showResendDialog, handleResendDialog, selectedTransactionForResend } = useTransactionContext();
|
||||
const { GetData, PostData } = useCallApi();
|
||||
const {
|
||||
showDetailDialog,
|
||||
setShowDetailDialog,
|
||||
selectedTransactionId
|
||||
} = useTransactionContext();
|
||||
const { showDetailDialog, setShowDetailDialog, selectedTransactionId } = useTransactionContext();
|
||||
const { reload } = useDataGrid();
|
||||
const [transactionDetails, setTransactionDetails] = useState<any>(null);
|
||||
const [alert, setAlert] = useState({
|
||||
@ -81,9 +80,8 @@ const ResendTransaction = ({ isOpen, onClose, selectedTransactionForResend }: Re
|
||||
|
||||
// console.log(selectedTransactionForResend);
|
||||
|
||||
|
||||
const doResendTransaction = useCallback(async (data: any | null, pintransactiion: string) => {
|
||||
|
||||
const doResendTransaction = useCallback(
|
||||
async (data: any | null, pintransactiion: string) => {
|
||||
if (pintransactiion.trim() === '') {
|
||||
setAlert({ show: true, message: 'Please fill pin.' });
|
||||
return;
|
||||
@ -118,7 +116,7 @@ const ResendTransaction = ({ isOpen, onClose, selectedTransactionForResend }: Re
|
||||
amount: String(data.transfer.amount),
|
||||
pin: pintransactiion,
|
||||
type: data.transfer.type
|
||||
}
|
||||
};
|
||||
break;
|
||||
case 'U':
|
||||
apiEndpoint = `${API_URL}/transaction/topup`;
|
||||
@ -128,7 +126,7 @@ const ResendTransaction = ({ isOpen, onClose, selectedTransactionForResend }: Re
|
||||
pin_p24: data.transfer.pin_p24,
|
||||
amount: String(data.transfer.amount),
|
||||
pin: pintransactiion
|
||||
}
|
||||
};
|
||||
break;
|
||||
case 'W':
|
||||
apiEndpoint = `${API_URL}/transaction/withdraw`;
|
||||
@ -138,25 +136,25 @@ const ResendTransaction = ({ isOpen, onClose, selectedTransactionForResend }: Re
|
||||
destination_iban: data.transfer.destination_iban,
|
||||
amount: String(data.transfer.amount),
|
||||
pin: pintransactiion
|
||||
}
|
||||
};
|
||||
break;
|
||||
case 'P':
|
||||
let walletParam = "";
|
||||
let walletParam = '';
|
||||
apiEndpoint = `${API_URL}/transaction/purchase`;
|
||||
if (data.origin_wallet.name === 'Emoney Account') {
|
||||
walletParam = "emoney";
|
||||
walletParam = 'emoney';
|
||||
} else if (data.origin_wallet.name === 'Point Account') {
|
||||
walletParam = "point";
|
||||
walletParam = 'point';
|
||||
}
|
||||
apiJsonData = {
|
||||
id_origin_customer: data.origin_customer.id,
|
||||
code_product: data.purchase.code,
|
||||
code_product: data.purchase.product.code,
|
||||
wallet: walletParam,
|
||||
destination_number: data.purchase.destination_number,
|
||||
destination_amount: data.purchase.destination_amount,
|
||||
destination_amount: data.purchase.destination_amount ?? 0,
|
||||
pin: pintransactiion,
|
||||
purpose: data.purchase.purpose
|
||||
}
|
||||
purpose: data.purchase.purpose ?? 'Purchase'
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
||||
@ -183,10 +181,12 @@ const ResendTransaction = ({ isOpen, onClose, selectedTransactionForResend }: Re
|
||||
|
||||
doSaveLogActivity(createActivity);
|
||||
} else {
|
||||
setAlert({ show: true, message: response?.message.message });
|
||||
setAlert({ show: true, message: response?.message });
|
||||
toast.error('Failed Retry Transaction');
|
||||
}
|
||||
}, [selectedTransactionForResend, PostData]);
|
||||
},
|
||||
[selectedTransactionForResend, PostData]
|
||||
);
|
||||
|
||||
if (!isOpen) return null;
|
||||
|
||||
@ -201,7 +201,7 @@ const ResendTransaction = ({ isOpen, onClose, selectedTransactionForResend }: Re
|
||||
<p className="text-sm">You will retry this transaction!</p>
|
||||
</Alert>
|
||||
{alert.show && (
|
||||
<Alert variant="danger">
|
||||
<Alert variant="danger" className="my-2">
|
||||
<h3>{alert.message}</h3>
|
||||
</Alert>
|
||||
)}
|
||||
@ -222,7 +222,10 @@ const ResendTransaction = ({ isOpen, onClose, selectedTransactionForResend }: Re
|
||||
{/* <Button variant="outline" onClick={() => handleResendDialog(false, null)}>
|
||||
Cancel
|
||||
</Button> */}
|
||||
<button className="btn btn-primary" onClick={() => doResendTransaction(selectedTransactionForResend, formField.pin)}>
|
||||
<button
|
||||
className="btn btn-primary"
|
||||
onClick={() => doResendTransaction(selectedTransactionForResend, formField.pin)}
|
||||
>
|
||||
Retry
|
||||
</button>
|
||||
</DialogFooter>
|
||||
|
||||
Reference in New Issue
Block a user