updates
This commit is contained in:
@@ -95,10 +95,6 @@ export interface UpdateInvoiceData {
|
||||
discount_amount?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all invoices
|
||||
* GET /api/invoices
|
||||
*/
|
||||
export const getInvoices = async (params?: {
|
||||
booking_id?: number;
|
||||
status?: string;
|
||||
@@ -109,55 +105,31 @@ export const getInvoices = async (params?: {
|
||||
return response.data;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get invoice by ID
|
||||
* GET /api/invoices/:id
|
||||
*/
|
||||
export const getInvoiceById = async (id: number): Promise<InvoiceResponse> => {
|
||||
const response = await apiClient.get<InvoiceResponse>(`/invoices/${id}`);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get invoices by booking ID
|
||||
* GET /api/invoices/booking/:bookingId
|
||||
*/
|
||||
export const getInvoicesByBooking = async (bookingId: number): Promise<InvoiceResponse> => {
|
||||
const response = await apiClient.get<InvoiceResponse>(`/invoices/booking/${bookingId}`);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create invoice from booking
|
||||
* POST /api/invoices
|
||||
*/
|
||||
export const createInvoice = async (data: CreateInvoiceData): Promise<InvoiceResponse> => {
|
||||
const response = await apiClient.post<InvoiceResponse>('/invoices', data);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
/**
|
||||
* Update invoice
|
||||
* PUT /api/invoices/:id
|
||||
*/
|
||||
export const updateInvoice = async (id: number, data: UpdateInvoiceData): Promise<InvoiceResponse> => {
|
||||
const response = await apiClient.put<InvoiceResponse>(`/invoices/${id}`, data);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
/**
|
||||
* Mark invoice as paid
|
||||
* POST /api/invoices/:id/mark-paid
|
||||
*/
|
||||
export const markInvoiceAsPaid = async (id: number, amount?: number): Promise<InvoiceResponse> => {
|
||||
const response = await apiClient.post<InvoiceResponse>(`/invoices/${id}/mark-paid`, { amount });
|
||||
return response.data;
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete invoice
|
||||
* DELETE /api/invoices/:id
|
||||
*/
|
||||
export const deleteInvoice = async (id: number): Promise<{ status: string; message: string }> => {
|
||||
const response = await apiClient.delete<{ status: string; message: string }>(`/invoices/${id}`);
|
||||
return response.data;
|
||||
|
||||
Reference in New Issue
Block a user