feat(F-188): completed feature
This commit is contained in:
@@ -60,6 +60,20 @@ export const posApi = {
|
||||
/** Atomically confirm a fully allocated sale. */
|
||||
createSale: <T>(data: unknown) =>
|
||||
apiFetch<T>('/pos/sales', { method: 'POST', body: JSON.stringify(data) }),
|
||||
/** Apply additional payments to a pending POS sale. */
|
||||
payRest: <T>(orderId: string, data: unknown) =>
|
||||
apiFetch<T>(`/pos/sales/${encodeURIComponent(orderId)}/payments`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
}),
|
||||
/** List POS sales for the session, optionally filtered by state. */
|
||||
listSales: <T>(params?: { state?: 'PENDING' | 'COMPLETED'; sessionId?: string }) => {
|
||||
const qs = new URLSearchParams();
|
||||
if (params?.state) qs.set('state', params.state);
|
||||
if (params?.sessionId) qs.set('sessionId', params.sessionId);
|
||||
const tail = qs.toString();
|
||||
return apiFetch<T>(`/pos/sales${tail ? `?${tail}` : ''}`);
|
||||
},
|
||||
/** Email the immutable generated receipt. */
|
||||
emailReceipt: <T>(orderId: string, email: string) =>
|
||||
apiFetch<T>(`/pos/sales/${encodeURIComponent(orderId)}/receipt/email`, {
|
||||
|
||||
Reference in New Issue
Block a user