feat(sync): synchronize customer adresses and orders from Hiboutik sales (#1)

Co-authored-by: MastersGame <quentin.duwa1210@gmail.com>
Reviewed-on: #1
This commit is contained in:
2026-11-07 09:56:53 +00:00
parent c5f65dcb62
commit 9dddf7562a
16 changed files with 755 additions and 17 deletions

View File

@@ -60,6 +60,18 @@ export interface CustomerAddressHiboutikDto {
other: string;
}
/**
* Address as returned by Hiboutik `GET /customers_addresses/:address_id`: the embedded address plus the company
* details and its last update. One API call per address, so only fetched for addresses with a company.
*/
export interface CustomerAddressDetailsHiboutikDto extends CustomerAddressHiboutikDto {
tax_number: string;
company_number: string;
legal_status: string;
/** Local time, "YYYY-MM-DD HH:mm:ss". */
updated_at: string;
}
/** Sale header embedded in {@link FullCustomerHiboutikDto}: no sale lines, they come from `GET /sales/:sale_id`. */
export interface CustomerSaleHiboutikDto {
sale_id: number;

View File

@@ -0,0 +1,40 @@
/**
* Sale as returned by Hiboutik `GET /sales/:sale_id`, with its lines.
* Only the fields used by the sync are typed: the payload also carries many computed copies (dates split in parts,
* totals by tax, customer and store details...).
*/
export interface SaleHiboutikDto {
sale_id: number;
/** Local time, "YYYY-MM-DD HH:mm:ss". */
created_at: string;
/** Local time, "0000-00-00 00:00:00" while the sale is not completed. */
completed_at: string;
store_id: number;
customer_id: number;
currency: string;
/** Decimal as a string, taxes included. */
total: string;
/** Payment type code, e.g. "CB", "ESP", "WEB". */
payment: string;
/** 1 for a quotation. */
quotation: number;
line_items: SaleLineHiboutikDto[];
}
/** Line of a {@link SaleHiboutikDto}: a snapshot of the product at sale time. */
export interface SaleLineHiboutikDto {
line_item_id: number;
product_id: number;
/** Hiboutik size id, 0 for a product without sizes. */
product_size: number;
/** Negative for a returned item. */
quantity: number;
product_model: string;
product_barcode: string;
/** Size name, empty for a product without sizes. */
size_name: string;
/** Unit price before discount, taxes included (decimal as a string). */
item_unit_gross_wo_discount: string;
/** Unit price actually paid, discount deducted, taxes included (decimal as a string). */
item_unit_gross: string;
}