@vitrina/api 11.39.0 → 11.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -30407,6 +30407,8 @@ interface paths {
30407
30407
  *
30408
30408
  * **`lead_id` names the deal this document CLOSES** (ERP S15-16) — a lead UUID or its folio (`L-89`). Omit it for a walk-in sale with no CRM deal; absent means "no originating deal", never "unknown". The link is then queryable both ways: `GET /sale-notes?lead_id=…` from the deal, and the `lead_id` field on the document itself. A deal has **at most one live closing document** — a second one is a **409** until the first is voided, enforced by a partial unique index rather than by a pre-read, so two concurrent issues cannot both win. The link is set here and never edited: there is no update endpoint, and the correction path is the one ADR 0058 §10 already defines — void (the row, its folio and its link all survive) and issue a replacement.
30409
30409
  *
30410
+ * **Every sale has exactly one Vendedor** (ADR 0114 §3) — the team member who closed it: the `closer` participation, echoed on `salesperson_id`. When the request names nobody, the Vendedor defaults to the assignee of the `lead_id` deal, else the car's Responsable del auto (`vehicle.responsible_user_id`), skipping anyone who is no longer an active member. When neither resolves, the emit is a **400** with `field_errors.salesperson_id` and **no folio consumed**. The default is a proposal: naming someone else always wins.
30411
+ *
30410
30412
  * `approved_by` and `approved_at` are all-or-nothing. Timestamps accept either UTC (`…Z`) or an explicit offset (`…-04:00`, Chile). Unknown body keys are a **400** — `tax` is one character from `tax_clp`, and silently discarding it would record "no IVA was entered" for a caller who entered it. Answers 201.
30411
30413
  *
30412
30414
  * **`funding` IS THE BALANCE GATE (ERP S9-5, BR-418)** — where the money for this sale comes from. Supplying it makes the gate BINDING on this request: `price + Σ statutory add-ons` is weighed against `Σ these payments + retoma + credit` BEFORE anything is written, a short plan is a **400 that states the gap** with **no folio consumed**, and a plan that holds is written into the SAME transaction as the document — so a payment the database refuses rolls `V-n` back rather than burning it on a half-funded sale. **Over-funding is allowed** and comes back labelled as `saldo_a_favor_del_cliente_clp`; it is never an error and is never silently clamped.
package/dist/index.d.ts CHANGED
@@ -30407,6 +30407,8 @@ interface paths {
30407
30407
  *
30408
30408
  * **`lead_id` names the deal this document CLOSES** (ERP S15-16) — a lead UUID or its folio (`L-89`). Omit it for a walk-in sale with no CRM deal; absent means "no originating deal", never "unknown". The link is then queryable both ways: `GET /sale-notes?lead_id=…` from the deal, and the `lead_id` field on the document itself. A deal has **at most one live closing document** — a second one is a **409** until the first is voided, enforced by a partial unique index rather than by a pre-read, so two concurrent issues cannot both win. The link is set here and never edited: there is no update endpoint, and the correction path is the one ADR 0058 §10 already defines — void (the row, its folio and its link all survive) and issue a replacement.
30409
30409
  *
30410
+ * **Every sale has exactly one Vendedor** (ADR 0114 §3) — the team member who closed it: the `closer` participation, echoed on `salesperson_id`. When the request names nobody, the Vendedor defaults to the assignee of the `lead_id` deal, else the car's Responsable del auto (`vehicle.responsible_user_id`), skipping anyone who is no longer an active member. When neither resolves, the emit is a **400** with `field_errors.salesperson_id` and **no folio consumed**. The default is a proposal: naming someone else always wins.
30411
+ *
30410
30412
  * `approved_by` and `approved_at` are all-or-nothing. Timestamps accept either UTC (`…Z`) or an explicit offset (`…-04:00`, Chile). Unknown body keys are a **400** — `tax` is one character from `tax_clp`, and silently discarding it would record "no IVA was entered" for a caller who entered it. Answers 201.
30411
30413
  *
30412
30414
  * **`funding` IS THE BALANCE GATE (ERP S9-5, BR-418)** — where the money for this sale comes from. Supplying it makes the gate BINDING on this request: `price + Σ statutory add-ons` is weighed against `Σ these payments + retoma + credit` BEFORE anything is written, a short plan is a **400 that states the gap** with **no folio consumed**, and a plan that holds is written into the SAME transaction as the document — so a payment the database refuses rolls `V-n` back rather than burning it on a half-funded sale. **Over-funding is allowed** and comes back labelled as `saldo_a_favor_del_cliente_clp`; it is never an error and is never silently clamped.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitrina/api",
3
- "version": "11.39.0",
3
+ "version": "11.40.0",
4
4
  "description": "Typed TypeScript SDK for the Vitrina API pública — generated from the committed openapi.public.json (ADR 0106).",
5
5
  "type": "module",
6
6
  "license": "MIT",