This commit is contained in:
frontend perkafean
2024-09-10 09:21:16 +00:00
parent 762bee40bb
commit f46639e05c
10 changed files with 768 additions and 337 deletions

View File

@@ -50,6 +50,30 @@ export async function declineTransaction(transactionId) {
}
}
export async function cancelTransaction(transactionId) {
try {
console.log(transactionId);
const token = getLocalStorage("auth");
const response = await fetch(
`${API_BASE_URL}/transaction/claim-transaction/${transactionId}`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
}
);
if (!response.ok) {
return false;
}
return true;
} catch (error) {
console.error("Error:", error);
}
}
export async function handleClaimHasPaid(transactionId) {
try {
console.log(transactionId);
@@ -264,6 +288,7 @@ export const handlePaymentFromGuestDevice = async (
payment_type,
serving_type,
tableNo,
notes,
socketId
) => {
try {
@@ -291,6 +316,7 @@ export const handlePaymentFromGuestDevice = async (
serving_type,
tableNo,
transactions: structuredItems,
notes: notes,
socketId,
}),
}