@vitrina/api 17.122.1 → 17.123.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 +2030 -421
- package/dist/index.d.ts +2030 -421
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -39120,7 +39120,7 @@ interface paths {
|
|
|
39120
39120
|
*
|
|
39121
39121
|
* **`lead_id` answers "which nota de venta closed this deal?"** (ERP S15-16) — a lead UUID or its folio (`L-89`); a foreign or unknown lead is a 404. It does NOT imply `exclude_voided`, deliberately: a voided document must stay reachable from the deal it closed, or the void becomes the one event that erases the answer. So a deal that was closed, voided and re-issued returns both documents here, and the live one is the row whose `status` is `issued`.
|
|
39122
39122
|
*
|
|
39123
|
-
* **Every row carries `totals`** — the SAME object `GET /sale-notes/{id}` embeds, computed by the same roll-up: `total_a_pagar_clp` (price + IVA + Σ statutory add-ons), `total_pagos_clp`, `saldo_clp`, `payment_count`, `complete` and `gaps`. ⚠ **A POSITIVE `saldo_clp` means the customer has OVERPAID; a NEGATIVE one is what they still owe** (BR-245 — it is the sign the printed document uses). `total_a_pagar_clp` and `saldo_clp` are both **`null`** when `tax_clp` was never recorded, with `gaps` naming it: that is "not computable", never zero, and a client must render it as such rather than treating the unrecorded IVA as 0. Voided rows are totalled like any other — the money against them was really taken, and `status` is what says the document is dead. Do not sum the payments client-side; there is one definition of this balance and this is it.
|
|
39123
|
+
* **Every row carries `totals`** — the SAME object `GET /sale-notes/{id}` embeds, computed by the same roll-up: `total_a_pagar_clp` (price + IVA + Σ statutory add-ons), `total_pagos_clp`, `saldo_clp`, `payment_count`, `complete` and `gaps`. `saldo_clp` counts the payments, the cars taken in part payment (`precio_toma_clp`) and the live credit, the same sum `funding` weighs on `GET /sale-notes/{id}`. ⚠ **A POSITIVE `saldo_clp` means the customer has OVERPAID; a NEGATIVE one is what they still owe** (BR-245 — it is the sign the printed document uses). `total_a_pagar_clp` and `saldo_clp` are both **`null`** when `tax_clp` was never recorded, with `gaps` naming it: that is "not computable", never zero, and a client must render it as such rather than treating the unrecorded IVA as 0. Voided rows are totalled like any other — the money against them was really taken, and `status` is what says the document is dead. Do not sum the payments client-side; there is one definition of this balance and this is it.
|
|
39124
39124
|
*
|
|
39125
39125
|
* **`economics` — only for callers holding `dealership_economics:read`** (absent, not null, for everyone else): `margen_bruto_clp` (Margen bruto), `margen_neto_clp` (Utilidad del negocio), `comisiones_vendedores_clp` (Comisión) and `canal` (where the buyer came from), each the SAME figure `GET /margin` serves — one definition, computed in batch for the page. A figure that is not computable is `null`, never zero, and `gaps` names the missing input (`cost_rollup` = Falta el costo de compra, `liquidacion` = Falta liquidar). A participation with no recorded commission counts as zero, so `comisiones_vendedores_clp` is always a number. A voided row has `economics: null`.
|
|
39126
39126
|
*
|
|
@@ -39418,6 +39418,7 @@ interface paths {
|
|
|
39418
39418
|
effective_from: string;
|
|
39419
39419
|
} | null;
|
|
39420
39420
|
} | components["schemas"]["OwnAddOnItem"] | components["schemas"]["TransferCostsAddOnItem"])[];
|
|
39421
|
+
discounts?: components["schemas"]["SaleNoteDiscountInput"][];
|
|
39421
39422
|
};
|
|
39422
39423
|
};
|
|
39423
39424
|
};
|
|
@@ -39542,7 +39543,7 @@ interface paths {
|
|
|
39542
39543
|
*
|
|
39543
39544
|
* A document belonging to another workspace is a 404, indistinguishable from one that does not exist.
|
|
39544
39545
|
*
|
|
39545
|
-
* **It answers the money too.** `payments` is every amount received against this note with the instrument it arrived as; `totals` carries `total_a_pagar_clp` / `total_pagos_clp` / `saldo_clp` (a POSITIVE saldo is an over-payment, a NEGATIVE one is what the customer still owes); and since ERP S9-5 `funding` carries **BR-418’s verdict** — `standing` is `funded`, `overfunded` (with `saldo_a_favor_del_cliente_clp`), `short` (with `gap_clp`) or `not_computable`, plus the five `terms` it was reached from. `total_a_pagar_clp` INCLUDES the statutory add-ons charged beside the price (BR-243).
|
|
39546
|
+
* **It answers the money too.** `payments` is every amount received against this note with the instrument it arrived as (and `instrument_stated`: `false` when the instrument is the default `transferencia` nobody chose, so a screen shows no medio, like the paper; `null` on a payment recorded before app#8130); `totals` carries `total_a_pagar_clp` / `total_pagos_clp` / `saldo_clp` (a POSITIVE saldo is an over-payment, a NEGATIVE one is what the customer still owes; it counts the cars taken in part payment and the live credit, so it always equals `funding.saldo_clp`); and since ERP S9-5 `funding` carries **BR-418’s verdict** — `standing` is `funded`, `overfunded` (with `saldo_a_favor_del_cliente_clp`), `short` (with `gap_clp`) or `not_computable`, plus the five `terms` it was reached from. `total_a_pagar_clp` INCLUDES the statutory add-ons charged beside the price (BR-243).
|
|
39546
39547
|
*
|
|
39547
39548
|
* Nothing here is stored: the standing is DERIVED from the rows on every read, there is no `funding_standing` column, and there is nothing to write. A document issued without a funding plan reads `short`, which is the honest state and not an error.
|
|
39548
39549
|
*
|
|
@@ -39614,6 +39615,7 @@ interface paths {
|
|
|
39614
39615
|
* "sale_note_id": "d4d4d4d4-0000-4000-8000-000000000001",
|
|
39615
39616
|
* "carried_from_reservation_id": null,
|
|
39616
39617
|
* "instrument": "transferencia",
|
|
39618
|
+
* "instrument_stated": true,
|
|
39617
39619
|
* "amount_clp": 13800000,
|
|
39618
39620
|
* "paid_on": "2026-09-19",
|
|
39619
39621
|
* "bank": "Banco de Chile",
|
|
@@ -39657,6 +39659,10 @@ interface paths {
|
|
|
39657
39659
|
* },
|
|
39658
39660
|
* "trade_ins": [],
|
|
39659
39661
|
* "credit": null,
|
|
39662
|
+
* "discounts": [],
|
|
39663
|
+
* "discounts_total_clp": 0,
|
|
39664
|
+
* "price_before_discounts_clp": 13800000,
|
|
39665
|
+
* "price_after_discounts": 13800000,
|
|
39660
39666
|
* "timeline": [
|
|
39661
39667
|
* {
|
|
39662
39668
|
* "step": "emitted",
|
|
@@ -39751,6 +39757,8 @@ interface paths {
|
|
|
39751
39757
|
* **`observaciones`** (app#7581) rides the same body: a string sets the text printed on the nota de venta (trimmed, up to 2000 characters), `null` or blank clears it. It is not a money fact: it applies on an issued or approved note with no price approval, no `history` entry and no `compraventa_outdated` (audited as `sale_notes.set_observaciones`). Sent alone it answers 200 with `correction.outcome` `applied` (or `unchanged`) and `change_id: null`; on a voided note it is the same **409** `sale_note_voided`.
|
|
39752
39758
|
*
|
|
39753
39759
|
* **`trade_ins`** (vitrina-app#7725): `[{ vehicle_id, precio_toma_clp }]` changes the precio de toma of cars this sale already took in part payment (cars are neither added nor removed here), on an issued or approved note. In one transaction, per car that moved: the trade-in line (the credit: the saldo follows on the next read), the car’s `retoma` cost (so its Ganancia follows when it sells), its live nota de compra’s amount (stamped as corrected) and a `history` entry (`kind: terms`, field `precio_toma_clp`). `correction.trade_ins` lists what moved: `{ vehicle_id, from_clp, to_clp, purchase_note_id, purchase_note_display_id, change_id }` (`[]` when nothing moved). 400 for a car the sale did not take, and `discounts_exceed_price` when the new price is below the nota de compra’s «Descuentos».
|
|
39760
|
+
*
|
|
39761
|
+
* **«Descuento» lines** (app#8131): `net_clp` / `tax_clp` are the note’s amounts AFTER its Descuentos, as `GET` serves them. **`sale_price_clp`** is «Corregir precio» in the dealer’s terms: the Precio de venta as typed (IVA included when afecto), before the Descuentos, which the server subtracts (not combinable with `net_clp` / `tax_clp`; 400 `discounts_exceed_price` when they reach it). When the price moves, a «Gastos de transferencia» line that was never typed by hand follows the new price after Descuentos (a `history` entry `kind: add_on` with `to.estimated: true`); a typed one is left alone.
|
|
39754
39762
|
*/
|
|
39755
39763
|
patch: {
|
|
39756
39764
|
parameters: {
|
|
@@ -39771,6 +39779,7 @@ interface paths {
|
|
|
39771
39779
|
*/
|
|
39772
39780
|
"application/json": {
|
|
39773
39781
|
net_clp?: number;
|
|
39782
|
+
sale_price_clp?: number;
|
|
39774
39783
|
tax_clp?: number | null;
|
|
39775
39784
|
/** @enum {string} */
|
|
39776
39785
|
tax_treatment?: "afecto" | "exento" | "no_gravado" | "pass_through";
|
|
@@ -39832,6 +39841,7 @@ interface paths {
|
|
|
39832
39841
|
* "sale_note_id": "d4d4d4d4-0000-4000-8000-000000000001",
|
|
39833
39842
|
* "carried_from_reservation_id": null,
|
|
39834
39843
|
* "instrument": "transferencia",
|
|
39844
|
+
* "instrument_stated": true,
|
|
39835
39845
|
* "amount_clp": 13800000,
|
|
39836
39846
|
* "paid_on": "2026-09-19",
|
|
39837
39847
|
* "bank": "Banco de Chile",
|
|
@@ -39875,6 +39885,10 @@ interface paths {
|
|
|
39875
39885
|
* },
|
|
39876
39886
|
* "trade_ins": [],
|
|
39877
39887
|
* "credit": null,
|
|
39888
|
+
* "discounts": [],
|
|
39889
|
+
* "discounts_total_clp": 0,
|
|
39890
|
+
* "price_before_discounts_clp": 13800000,
|
|
39891
|
+
* "price_after_discounts": 13800000,
|
|
39878
39892
|
* "timeline": [
|
|
39879
39893
|
* {
|
|
39880
39894
|
* "step": "emitted",
|
|
@@ -39942,6 +39956,7 @@ interface paths {
|
|
|
39942
39956
|
* "sale_note_id": "d4d4d4d4-0000-4000-8000-000000000001",
|
|
39943
39957
|
* "carried_from_reservation_id": null,
|
|
39944
39958
|
* "instrument": "transferencia",
|
|
39959
|
+
* "instrument_stated": true,
|
|
39945
39960
|
* "amount_clp": 13800000,
|
|
39946
39961
|
* "paid_on": "2026-09-19",
|
|
39947
39962
|
* "bank": "Banco de Chile",
|
|
@@ -39985,6 +40000,10 @@ interface paths {
|
|
|
39985
40000
|
* },
|
|
39986
40001
|
* "trade_ins": [],
|
|
39987
40002
|
* "credit": null,
|
|
40003
|
+
* "discounts": [],
|
|
40004
|
+
* "discounts_total_clp": 0,
|
|
40005
|
+
* "price_before_discounts_clp": 13800000,
|
|
40006
|
+
* "price_after_discounts": 13800000,
|
|
39988
40007
|
* "timeline": [
|
|
39989
40008
|
* {
|
|
39990
40009
|
* "step": "emitted",
|
|
@@ -40771,6 +40790,7 @@ interface paths {
|
|
|
40771
40790
|
* "sale_note_id": "d4d4d4d4-0000-4000-8000-000000000001",
|
|
40772
40791
|
* "carried_from_reservation_id": null,
|
|
40773
40792
|
* "instrument": "transferencia",
|
|
40793
|
+
* "instrument_stated": true,
|
|
40774
40794
|
* "amount_clp": 13800000,
|
|
40775
40795
|
* "paid_on": "2026-09-19",
|
|
40776
40796
|
* "bank": "Banco de Chile",
|
|
@@ -40814,6 +40834,10 @@ interface paths {
|
|
|
40814
40834
|
* },
|
|
40815
40835
|
* "trade_ins": [],
|
|
40816
40836
|
* "credit": null,
|
|
40837
|
+
* "discounts": [],
|
|
40838
|
+
* "discounts_total_clp": 0,
|
|
40839
|
+
* "price_before_discounts_clp": 13800000,
|
|
40840
|
+
* "price_after_discounts": 13800000,
|
|
40817
40841
|
* "timeline": [
|
|
40818
40842
|
* {
|
|
40819
40843
|
* "step": "emitted",
|
|
@@ -40990,6 +41014,7 @@ interface paths {
|
|
|
40990
41014
|
* "sale_note_id": "d4d4d4d4-0000-4000-8000-000000000001",
|
|
40991
41015
|
* "carried_from_reservation_id": null,
|
|
40992
41016
|
* "instrument": "transferencia",
|
|
41017
|
+
* "instrument_stated": true,
|
|
40993
41018
|
* "amount_clp": 13800000,
|
|
40994
41019
|
* "paid_on": "2026-09-19",
|
|
40995
41020
|
* "bank": "Banco de Chile",
|
|
@@ -41033,6 +41058,10 @@ interface paths {
|
|
|
41033
41058
|
* },
|
|
41034
41059
|
* "trade_ins": [],
|
|
41035
41060
|
* "credit": null,
|
|
41061
|
+
* "discounts": [],
|
|
41062
|
+
* "discounts_total_clp": 0,
|
|
41063
|
+
* "price_before_discounts_clp": 13800000,
|
|
41064
|
+
* "price_after_discounts": 13800000,
|
|
41036
41065
|
* "timeline": [
|
|
41037
41066
|
* {
|
|
41038
41067
|
* "step": "emitted",
|
|
@@ -41303,6 +41332,7 @@ interface paths {
|
|
|
41303
41332
|
* "sale_note_id": "d4d4d4d4-0000-4000-8000-000000000001",
|
|
41304
41333
|
* "carried_from_reservation_id": null,
|
|
41305
41334
|
* "instrument": "transferencia",
|
|
41335
|
+
* "instrument_stated": true,
|
|
41306
41336
|
* "amount_clp": 13800000,
|
|
41307
41337
|
* "paid_on": "2026-09-19",
|
|
41308
41338
|
* "bank": "Banco de Chile",
|
|
@@ -41346,6 +41376,10 @@ interface paths {
|
|
|
41346
41376
|
* },
|
|
41347
41377
|
* "trade_ins": [],
|
|
41348
41378
|
* "credit": null,
|
|
41379
|
+
* "discounts": [],
|
|
41380
|
+
* "discounts_total_clp": 0,
|
|
41381
|
+
* "price_before_discounts_clp": 13800000,
|
|
41382
|
+
* "price_after_discounts": 13800000,
|
|
41349
41383
|
* "timeline": [
|
|
41350
41384
|
* {
|
|
41351
41385
|
* "step": "emitted",
|
|
@@ -41512,6 +41546,7 @@ interface paths {
|
|
|
41512
41546
|
* "sale_note_id": "d4d4d4d4-0000-4000-8000-000000000001",
|
|
41513
41547
|
* "carried_from_reservation_id": null,
|
|
41514
41548
|
* "instrument": "transferencia",
|
|
41549
|
+
* "instrument_stated": true,
|
|
41515
41550
|
* "amount_clp": 13800000,
|
|
41516
41551
|
* "paid_on": "2026-09-19",
|
|
41517
41552
|
* "bank": "Banco de Chile",
|
|
@@ -41555,6 +41590,10 @@ interface paths {
|
|
|
41555
41590
|
* },
|
|
41556
41591
|
* "trade_ins": [],
|
|
41557
41592
|
* "credit": null,
|
|
41593
|
+
* "discounts": [],
|
|
41594
|
+
* "discounts_total_clp": 0,
|
|
41595
|
+
* "price_before_discounts_clp": 13800000,
|
|
41596
|
+
* "price_after_discounts": 13800000,
|
|
41558
41597
|
* "timeline": [
|
|
41559
41598
|
* {
|
|
41560
41599
|
* "step": "emitted",
|
|
@@ -41747,6 +41786,7 @@ interface paths {
|
|
|
41747
41786
|
* "sale_note_id": "d4d4d4d4-0000-4000-8000-000000000001",
|
|
41748
41787
|
* "carried_from_reservation_id": null,
|
|
41749
41788
|
* "instrument": "transferencia",
|
|
41789
|
+
* "instrument_stated": true,
|
|
41750
41790
|
* "amount_clp": 13800000,
|
|
41751
41791
|
* "paid_on": "2026-09-19",
|
|
41752
41792
|
* "bank": "Banco de Chile",
|
|
@@ -41790,6 +41830,10 @@ interface paths {
|
|
|
41790
41830
|
* },
|
|
41791
41831
|
* "trade_ins": [],
|
|
41792
41832
|
* "credit": null,
|
|
41833
|
+
* "discounts": [],
|
|
41834
|
+
* "discounts_total_clp": 0,
|
|
41835
|
+
* "price_before_discounts_clp": 13800000,
|
|
41836
|
+
* "price_after_discounts": 13800000,
|
|
41793
41837
|
* "timeline": [
|
|
41794
41838
|
* {
|
|
41795
41839
|
* "step": "emitted",
|
|
@@ -41909,7 +41953,7 @@ interface paths {
|
|
|
41909
41953
|
};
|
|
41910
41954
|
trace?: never;
|
|
41911
41955
|
};
|
|
41912
|
-
"/sale-notes/{id}/
|
|
41956
|
+
"/sale-notes/{id}/discounts": {
|
|
41913
41957
|
parameters: {
|
|
41914
41958
|
query?: never;
|
|
41915
41959
|
header?: never;
|
|
@@ -41919,10 +41963,10 @@ interface paths {
|
|
|
41919
41963
|
get?: never;
|
|
41920
41964
|
put?: never;
|
|
41921
41965
|
/**
|
|
41922
|
-
*
|
|
41923
|
-
* @description
|
|
41966
|
+
* Add a «Descuento» line to a nota de venta
|
|
41967
|
+
* @description Adds a «Descuento» (app#8131, ADR 0166 decision 7): `{ description, amount_clp }`, the detail the paper prints and what it takes off what the buyer pays for the car (IVA included when afecto). On a note that is ISSUED or APPROVED and not voided, with `sale_notes:write`, like an add-on. The Precio de venta stays as typed (`price_before_discounts_clp` on the read); the note’s `net_clp` / `tax_clp` become the price after every Descuento (`price_after_discounts`), so `totals`, `funding`, Ganancias, the defaulted commissions, the receivable and a consigned car’s liquidación use the net. In one transaction, through the same path as `PATCH /sale-notes/{id}`: the line, the amounts, the defaulted commissions, the «Gastos de transferencia» estimate when it was never typed by hand, the receivable and a `history` entry (`kind: terms`, `changes.discount: { from: null, to: { discount_id, description, amount_clp } }` beside `net_clp` / `tax_clp`). Responds with the read of `GET /sale-notes/{id}` plus `correction`.
|
|
41924
41968
|
*
|
|
41925
|
-
* **
|
|
41969
|
+
* **201** applied. **202** `correction.outcome = pending_approval`: on an APPROVED note, a price after Descuentos below the floor by a caller without `price_approval:approve` is filed as a price approval whose `proposed_terms.discount` carries the line; granting it adds the line. **400** `details.reason = discounts_exceed_price` when the Descuentos would equal or exceed the Precio de venta, or a blank detail / a non-positive amount. **409** `details.blocked_reason` = `sale_note_voided`, or `tax_not_recorded` (an afecto note with no IVA recorded).
|
|
41926
41970
|
*/
|
|
41927
41971
|
post: {
|
|
41928
41972
|
parameters: {
|
|
@@ -41933,14 +41977,23 @@ interface paths {
|
|
|
41933
41977
|
};
|
|
41934
41978
|
path: {
|
|
41935
41979
|
id: string;
|
|
41936
|
-
lineId: string;
|
|
41937
41980
|
};
|
|
41938
41981
|
cookie?: never;
|
|
41939
41982
|
};
|
|
41940
|
-
requestBody?:
|
|
41983
|
+
requestBody?: {
|
|
41984
|
+
content: {
|
|
41985
|
+
/**
|
|
41986
|
+
* @example {
|
|
41987
|
+
* "description": "Por pago al contado",
|
|
41988
|
+
* "amount_clp": 200000
|
|
41989
|
+
* }
|
|
41990
|
+
*/
|
|
41991
|
+
"application/json": components["schemas"]["SaleNoteDiscountInput"];
|
|
41992
|
+
};
|
|
41993
|
+
};
|
|
41941
41994
|
responses: {
|
|
41942
|
-
/** @description The nota de venta, as GET /sale-notes/{id} reads it */
|
|
41943
|
-
|
|
41995
|
+
/** @description The nota de venta, as GET /sale-notes/{id} reads it, plus correction */
|
|
41996
|
+
201: {
|
|
41944
41997
|
headers: {
|
|
41945
41998
|
[name: string]: unknown;
|
|
41946
41999
|
};
|
|
@@ -41959,11 +42012,11 @@ interface paths {
|
|
|
41959
42012
|
* "observaciones": "Se entrega con dos llaves y la mantención al día.",
|
|
41960
42013
|
* "seller_of_record": "automotora",
|
|
41961
42014
|
* "salesperson_id": "11111111-0000-4000-8000-000000000001",
|
|
41962
|
-
* "net_clp":
|
|
42015
|
+
* "net_clp": 8300000,
|
|
41963
42016
|
* "list_price_clp": 12490000,
|
|
41964
42017
|
* "discount_clp": 590000,
|
|
41965
|
-
* "tax_clp":
|
|
41966
|
-
* "tax_treatment": "
|
|
42018
|
+
* "tax_clp": 0,
|
|
42019
|
+
* "tax_treatment": "exento",
|
|
41967
42020
|
* "status": "issued",
|
|
41968
42021
|
* "issued_at": "2026-09-19T13:00:00.000Z",
|
|
41969
42022
|
* "emitted_by": "11111111-0000-4000-8000-000000000001",
|
|
@@ -41984,6 +42037,7 @@ interface paths {
|
|
|
41984
42037
|
* "sale_note_id": "d4d4d4d4-0000-4000-8000-000000000001",
|
|
41985
42038
|
* "carried_from_reservation_id": null,
|
|
41986
42039
|
* "instrument": "transferencia",
|
|
42040
|
+
* "instrument_stated": true,
|
|
41987
42041
|
* "amount_clp": 13800000,
|
|
41988
42042
|
* "paid_on": "2026-09-19",
|
|
41989
42043
|
* "bank": "Banco de Chile",
|
|
@@ -42027,6 +42081,18 @@ interface paths {
|
|
|
42027
42081
|
* },
|
|
42028
42082
|
* "trade_ins": [],
|
|
42029
42083
|
* "credit": null,
|
|
42084
|
+
* "discounts": [
|
|
42085
|
+
* {
|
|
42086
|
+
* "id": "01a1c1df-a6ea-779f-9310-bdbb2eadd201",
|
|
42087
|
+
* "description": "Por pago al contado",
|
|
42088
|
+
* "amount_clp": 200000,
|
|
42089
|
+
* "created_at": "2026-11-22T15:00:00.000Z",
|
|
42090
|
+
* "created_by": "11111111-0000-4000-8000-000000000001"
|
|
42091
|
+
* }
|
|
42092
|
+
* ],
|
|
42093
|
+
* "discounts_total_clp": 200000,
|
|
42094
|
+
* "price_before_discounts_clp": 8500000,
|
|
42095
|
+
* "price_after_discounts": 8300000,
|
|
42030
42096
|
* "timeline": [
|
|
42031
42097
|
* {
|
|
42032
42098
|
* "step": "emitted",
|
|
@@ -42038,45 +42104,12 @@ interface paths {
|
|
|
42038
42104
|
* }
|
|
42039
42105
|
* }
|
|
42040
42106
|
* ],
|
|
42041
|
-
* "
|
|
42042
|
-
* "
|
|
42043
|
-
* "
|
|
42044
|
-
* "
|
|
42045
|
-
* "
|
|
42046
|
-
*
|
|
42047
|
-
* "recalculation_offered": true
|
|
42048
|
-
* },
|
|
42049
|
-
* "history": [
|
|
42050
|
-
* {
|
|
42051
|
-
* "id": "01a1c1df-a6ea-779f-9310-bdbb2eadd1a8",
|
|
42052
|
-
* "kind": "add_on",
|
|
42053
|
-
* "changes": {
|
|
42054
|
-
* "add_on": {
|
|
42055
|
-
* "from": {
|
|
42056
|
-
* "line_id": "01a1c1df-a6ea-779f-9310-bdbb2eadd1a9",
|
|
42057
|
-
* "kind": "otro",
|
|
42058
|
-
* "description": "Garantía extendida",
|
|
42059
|
-
* "charge_clp": 119000,
|
|
42060
|
-
* "tax_treatment": "afecto"
|
|
42061
|
-
* },
|
|
42062
|
-
* "to": {
|
|
42063
|
-
* "line_id": "01a1c1df-a6ea-779f-9310-bdbb2eadd1a9",
|
|
42064
|
-
* "kind": "otro",
|
|
42065
|
-
* "description": "Garantía extendida 24 meses",
|
|
42066
|
-
* "charge_clp": 150000,
|
|
42067
|
-
* "tax_treatment": "afecto"
|
|
42068
|
-
* }
|
|
42069
|
-
* }
|
|
42070
|
-
* },
|
|
42071
|
-
* "at": "2026-11-15T13:20:00.000Z",
|
|
42072
|
-
* "actor": null,
|
|
42073
|
-
* "on_approved_note": true,
|
|
42074
|
-
* "price_approval_id": null,
|
|
42075
|
-
* "authorised_by": null
|
|
42076
|
-
* }
|
|
42077
|
-
* ],
|
|
42078
|
-
* "compraventa_outdated": false,
|
|
42079
|
-
* "pending_price_change": null
|
|
42107
|
+
* "correction": {
|
|
42108
|
+
* "outcome": "applied",
|
|
42109
|
+
* "price_approval_id": null,
|
|
42110
|
+
* "change_id": "01a1c1df-a6ea-779f-9310-bdbb2eadd202",
|
|
42111
|
+
* "trade_ins": []
|
|
42112
|
+
* }
|
|
42080
42113
|
* }
|
|
42081
42114
|
* }
|
|
42082
42115
|
*/
|
|
@@ -42088,131 +42121,8 @@ interface paths {
|
|
|
42088
42121
|
};
|
|
42089
42122
|
};
|
|
42090
42123
|
};
|
|
42091
|
-
/** @description
|
|
42092
|
-
|
|
42093
|
-
headers: {
|
|
42094
|
-
[name: string]: unknown;
|
|
42095
|
-
};
|
|
42096
|
-
content: {
|
|
42097
|
-
"application/json": components["schemas"]["Error"];
|
|
42098
|
-
};
|
|
42099
|
-
};
|
|
42100
|
-
/** @description Unauthorized */
|
|
42101
|
-
401: {
|
|
42102
|
-
headers: {
|
|
42103
|
-
[name: string]: unknown;
|
|
42104
|
-
};
|
|
42105
|
-
content: {
|
|
42106
|
-
"application/json": components["schemas"]["Error"];
|
|
42107
|
-
};
|
|
42108
|
-
};
|
|
42109
|
-
/** @description Forbidden */
|
|
42110
|
-
403: {
|
|
42111
|
-
headers: {
|
|
42112
|
-
[name: string]: unknown;
|
|
42113
|
-
};
|
|
42114
|
-
content: {
|
|
42115
|
-
"application/json": components["schemas"]["Error"];
|
|
42116
|
-
};
|
|
42117
|
-
};
|
|
42118
|
-
/** @description Not found */
|
|
42119
|
-
404: {
|
|
42120
|
-
headers: {
|
|
42121
|
-
[name: string]: unknown;
|
|
42122
|
-
};
|
|
42123
|
-
content: {
|
|
42124
|
-
"application/json": components["schemas"]["Error"];
|
|
42125
|
-
};
|
|
42126
|
-
};
|
|
42127
|
-
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
42128
|
-
409: {
|
|
42129
|
-
headers: {
|
|
42130
|
-
[name: string]: unknown;
|
|
42131
|
-
};
|
|
42132
|
-
content: {
|
|
42133
|
-
"application/json": components["schemas"]["Error"];
|
|
42134
|
-
};
|
|
42135
|
-
};
|
|
42136
|
-
/** @description Rate limited */
|
|
42137
|
-
429: {
|
|
42138
|
-
headers: {
|
|
42139
|
-
[name: string]: unknown;
|
|
42140
|
-
};
|
|
42141
|
-
content: {
|
|
42142
|
-
"application/json": components["schemas"]["Error"];
|
|
42143
|
-
};
|
|
42144
|
-
};
|
|
42145
|
-
};
|
|
42146
|
-
};
|
|
42147
|
-
delete?: never;
|
|
42148
|
-
options?: never;
|
|
42149
|
-
head?: never;
|
|
42150
|
-
patch?: never;
|
|
42151
|
-
trace?: never;
|
|
42152
|
-
};
|
|
42153
|
-
"/sale-notes/{id}/approve": {
|
|
42154
|
-
parameters: {
|
|
42155
|
-
query?: never;
|
|
42156
|
-
header?: never;
|
|
42157
|
-
path?: never;
|
|
42158
|
-
cookie?: never;
|
|
42159
|
-
};
|
|
42160
|
-
get?: never;
|
|
42161
|
-
put?: never;
|
|
42162
|
-
/**
|
|
42163
|
-
* Approve a nota de venta (the sale fan-out)
|
|
42164
|
-
* @description **`cancelled_visits` (vitrina-app#7960)** — when the call takes the car out of stock (sold, or `active: false`), its future visits and test drives are cancelled right after the commit, as always, and the answer says what happened to them: `{ count, told: [{ appointment_id, starts_at, name, channel }], not_told: [{ appointment_id, starts_at, name, phone, reason }], hidden_count, message }`. `told` = the customer gets the cancellation notice through that conversation channel. `not_told` = call them: `reason` is `no_conversation` (typed by hand), `channel_unreachable` or `window_closed` (WhatsApp, Instagram or Messenger and the customer has not written in 24 hours; no template is sent, so the notice is not attempted). `phone` is the contact’s phone, `null` when none is on file. Visits in another salesperson’s agenda that the caller’s role does not see (the GET /appointments ceiling) are only counted, in `hidden_count`. `message` is one Spanish sentence (`null` when `count` is 0). The block is a prediction read a moment before the notices go out, from the rule they obey. ABSENT when the call did not take the car out of stock; `null` when the summary could not be read (the call still succeeded and the visits are still cancelled).
|
|
42165
|
-
*
|
|
42166
|
-
* **A car returned to its owner** (`returned_to_owner: true`, app#7961) is not sold or reserved: the call answers **409** with `details.reason: vehicle_returned_to_owner`, `details.vehicle_id`, `details.consignment_id` (the returned contract) and a Spanish sentence, before anything is written and before any folio is taken. The ways back are undoing the return (`POST /consignments/{id}/undo-return`) or a new consignment. Voiding a note or a reserva of that car is never refused.
|
|
42167
|
-
*
|
|
42168
|
-
* **Below the floor without `price_approval:approve` (app#7589):** **409** `details.reason: price_approval_required` with `details.price_approval_pending` and `details.price_approval_id`. When none was pending the call files one in the caller's name first, so the answer always says the approval is requested: «No puedes cerrar la venta V-41 todavía: el precio está bajo el mínimo y un administrador tiene que aprobarlo primero. La aprobación del precio ya está pedida.» The answer carries `price_approval` like every note read.
|
|
42169
|
-
*
|
|
42170
|
-
* **Closed by a member holding `price_approval:approve` (app#7704):** the note’s pending price request (if any, and not filed by that same member) is resolved `approved` by them in the same transaction, audited as `price_approvals.decide`; it leaves the approval queue and its count.
|
|
42171
|
-
*
|
|
42172
|
-
* Approves the document — the instant it becomes **legally valid** (BR-485) and the instant every consequence of the sale fires. All of it happens in **ONE database transaction**, so either all of it happened or none of it did:
|
|
42173
|
-
*
|
|
42174
|
-
* * the document is stamped with WHO approved it and WHEN (BR-484);
|
|
42175
|
-
* * **the car is marked `vendido`** (BR-486), which is TERMINAL — a sold unit never sells or lists again (ADR 0030, regla de Estadía);
|
|
42176
|
-
* * every **vigente cotización** on that unit is voided in the same write (BR-215), so the car is never left sold with a live price commitment standing on it;
|
|
42177
|
-
* * the **Negocio** the note names (`lead_id`) is closed WON (BR-487), by a real stage move rather than a status patch.
|
|
42178
|
-
*
|
|
42179
|
-
* Afterwards the document appears in `GET /sale-notes/post-sale-obligations` (BR-489) and its Contrato de Compraventa and Declaración de Responsabilidad become printable (BR-488). The unit’s portal adverts are retracted immediately AFTER the transaction commits — never before, because a queue job cannot be rolled back and a rolled-back approval must not unpublish a car that was not sold.
|
|
42180
|
-
*
|
|
42181
|
-
* **The body is empty and strict.** The approver is the authenticated principal and the instant is server-stamped; a body naming either is a 400. Back-dating an approval is expressible only on `POST /sale-notes` (`approved_at`), and only for the ADR 0058 §11 talonario cutover.
|
|
42182
|
-
*
|
|
42183
|
-
* **Refusals write NOTHING** — not the stamp, not the sold flag, not the quote deaths, not the deal close, and no advert job:
|
|
42184
|
-
*
|
|
42185
|
-
* * **409** when the sale’s price is below the level this organisation requires an authorisation for and no APPROVED `price_approval` names this document (BR-433/BR-434 — a salesperson cannot authorise their own discount). Raise one with `POST /price-approvals` and have somebody else decide it. A caller holding `price_approval:approve` (an owner or admin) is not refused: approving the sale is their authorisation of the price. The refusal deliberately states no figure: the shortfall and the reference are cost disclosures gated on `dealership_economics:read`.
|
|
42186
|
-
* * **409** when the unit has already been sold by another document.
|
|
42187
|
-
* * A consigned car never refuses over its mandato: the approval emits it when the contract can produce it, and otherwise it is produced with `POST /consignments/{id}/contract` when someone asks for it.
|
|
42188
|
-
* * **409** when the document is already approved, or is voided — an approval names a person and a moment and cannot be restated.
|
|
42189
|
-
* * **400** when the deal’s board has no Won column, or forbids the move onto it.
|
|
42190
|
-
*
|
|
42191
|
-
* Two simultaneous approvals resolve to exactly one 200 and one 409, and the fan-out runs once.
|
|
42192
|
-
*
|
|
42193
|
-
* Requires `sale_notes:write` — approving is the completion of the same act as issuing, not a separate authority (unlike `sale_notes:void`).
|
|
42194
|
-
*/
|
|
42195
|
-
post: {
|
|
42196
|
-
parameters: {
|
|
42197
|
-
query?: never;
|
|
42198
|
-
header?: {
|
|
42199
|
-
/** @description Replay-safe retries: resending the SAME key with the SAME body returns the original response (`X-Idempotent-Replay: 1`) instead of creating a second copy — safe to send whenever a response might not have arrived. The same key with a DIFFERENT body answers `409 IDEMPOTENCY_KEY_CONFLICT`; use a fresh key per operation. */
|
|
42200
|
-
"Idempotency-Key"?: string;
|
|
42201
|
-
};
|
|
42202
|
-
path: {
|
|
42203
|
-
id: string;
|
|
42204
|
-
};
|
|
42205
|
-
cookie?: never;
|
|
42206
|
-
};
|
|
42207
|
-
requestBody?: {
|
|
42208
|
-
content: {
|
|
42209
|
-
/** @example {} */
|
|
42210
|
-
"application/json": Record<string, never>;
|
|
42211
|
-
};
|
|
42212
|
-
};
|
|
42213
|
-
responses: {
|
|
42214
|
-
/** @description The approved nota de venta */
|
|
42215
|
-
200: {
|
|
42124
|
+
/** @description Waiting for a manager: the price approval carries the line */
|
|
42125
|
+
202: {
|
|
42216
42126
|
headers: {
|
|
42217
42127
|
[name: string]: unknown;
|
|
42218
42128
|
};
|
|
@@ -42231,48 +42141,762 @@ interface paths {
|
|
|
42231
42141
|
* "observaciones": "Se entrega con dos llaves y la mantención al día.",
|
|
42232
42142
|
* "seller_of_record": "automotora",
|
|
42233
42143
|
* "salesperson_id": "11111111-0000-4000-8000-000000000001",
|
|
42234
|
-
* "net_clp":
|
|
42144
|
+
* "net_clp": 8300000,
|
|
42235
42145
|
* "list_price_clp": 12490000,
|
|
42236
42146
|
* "discount_clp": 590000,
|
|
42237
|
-
* "tax_clp":
|
|
42238
|
-
* "tax_treatment": "
|
|
42239
|
-
* "status": "
|
|
42147
|
+
* "tax_clp": 0,
|
|
42148
|
+
* "tax_treatment": "exento",
|
|
42149
|
+
* "status": "issued",
|
|
42240
42150
|
* "issued_at": "2026-09-19T13:00:00.000Z",
|
|
42241
42151
|
* "emitted_by": "11111111-0000-4000-8000-000000000001",
|
|
42242
|
-
* "approved_by":
|
|
42243
|
-
* "approved_at":
|
|
42152
|
+
* "approved_by": null,
|
|
42153
|
+
* "approved_at": null,
|
|
42244
42154
|
* "voided_at": null,
|
|
42245
42155
|
* "void_reason": null,
|
|
42246
42156
|
* "voided_by": null,
|
|
42247
42157
|
* "created_at": "2026-09-19T13:00:00.000Z",
|
|
42248
42158
|
* "updated_at": "2026-09-19T13:00:00.000Z",
|
|
42249
|
-
* "
|
|
42250
|
-
*
|
|
42251
|
-
*
|
|
42252
|
-
*
|
|
42253
|
-
*
|
|
42254
|
-
*
|
|
42255
|
-
*
|
|
42256
|
-
*
|
|
42257
|
-
*
|
|
42258
|
-
*
|
|
42259
|
-
*
|
|
42260
|
-
*
|
|
42261
|
-
*
|
|
42262
|
-
*
|
|
42263
|
-
*
|
|
42264
|
-
*
|
|
42265
|
-
*
|
|
42159
|
+
* "receivable_obligation_id": "01a1c1df-a6ea-779f-9310-bdbb2eadd184",
|
|
42160
|
+
* "print_missing_fields": [],
|
|
42161
|
+
* "payments": [
|
|
42162
|
+
* {
|
|
42163
|
+
* "id": "d6d6d6d6-0000-4000-8000-000000000002",
|
|
42164
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
42165
|
+
* "reservation_id": null,
|
|
42166
|
+
* "sale_note_id": "d4d4d4d4-0000-4000-8000-000000000001",
|
|
42167
|
+
* "carried_from_reservation_id": null,
|
|
42168
|
+
* "instrument": "transferencia",
|
|
42169
|
+
* "instrument_stated": true,
|
|
42170
|
+
* "amount_clp": 13800000,
|
|
42171
|
+
* "paid_on": "2026-09-19",
|
|
42172
|
+
* "bank": "Banco de Chile",
|
|
42173
|
+
* "account_number": null,
|
|
42174
|
+
* "document_number": null,
|
|
42175
|
+
* "note": null,
|
|
42176
|
+
* "card_fee_bps": null,
|
|
42177
|
+
* "card_surcharge_clp": null,
|
|
42178
|
+
* "card_surcharge_source": null,
|
|
42179
|
+
* "created_at": "2026-09-19T13:05:00.000Z"
|
|
42180
|
+
* }
|
|
42181
|
+
* ],
|
|
42182
|
+
* "totals": {
|
|
42183
|
+
* "total_a_pagar_clp": 13800000,
|
|
42184
|
+
* "total_pagos_clp": 13800000,
|
|
42185
|
+
* "saldo_clp": 0,
|
|
42186
|
+
* "recargo_tarjeta_clp": 0,
|
|
42187
|
+
* "total_a_cobrar_clp": 13800000,
|
|
42188
|
+
* "payment_count": 1,
|
|
42189
|
+
* "complete": true,
|
|
42190
|
+
* "gaps": []
|
|
42191
|
+
* },
|
|
42192
|
+
* "funding": {
|
|
42193
|
+
* "standing": "funded",
|
|
42194
|
+
* "balanced": true,
|
|
42195
|
+
* "terms": {
|
|
42196
|
+
* "price_clp": 13800000,
|
|
42197
|
+
* "add_on_charges_clp": 0,
|
|
42198
|
+
* "payments_clp": 13800000,
|
|
42199
|
+
* "retoma_clp": 0,
|
|
42200
|
+
* "credit_clp": 0
|
|
42201
|
+
* },
|
|
42202
|
+
* "total_a_pagar_clp": 13800000,
|
|
42203
|
+
* "total_consideration_clp": 13800000,
|
|
42204
|
+
* "saldo_clp": 0,
|
|
42205
|
+
* "gap_clp": null,
|
|
42206
|
+
* "saldo_a_favor_del_cliente_clp": null,
|
|
42207
|
+
* "payment_count": 1,
|
|
42208
|
+
* "complete": true,
|
|
42209
|
+
* "gaps": []
|
|
42210
|
+
* },
|
|
42211
|
+
* "trade_ins": [],
|
|
42212
|
+
* "credit": null,
|
|
42213
|
+
* "discounts": [
|
|
42214
|
+
* {
|
|
42215
|
+
* "id": "01a1c1df-a6ea-779f-9310-bdbb2eadd201",
|
|
42216
|
+
* "description": "Por pago al contado",
|
|
42217
|
+
* "amount_clp": 200000,
|
|
42218
|
+
* "created_at": "2026-11-22T15:00:00.000Z",
|
|
42219
|
+
* "created_by": "11111111-0000-4000-8000-000000000001"
|
|
42220
|
+
* }
|
|
42221
|
+
* ],
|
|
42222
|
+
* "discounts_total_clp": 200000,
|
|
42223
|
+
* "price_before_discounts_clp": 8500000,
|
|
42224
|
+
* "price_after_discounts": 8300000,
|
|
42225
|
+
* "timeline": [
|
|
42226
|
+
* {
|
|
42227
|
+
* "step": "emitted",
|
|
42228
|
+
* "at": "2026-09-19T13:00:00.000Z",
|
|
42229
|
+
* "actor": {
|
|
42230
|
+
* "id": "11111111-0000-4000-8000-000000000001",
|
|
42231
|
+
* "name": "Martina Reyes",
|
|
42232
|
+
* "kind": "member"
|
|
42266
42233
|
* }
|
|
42267
|
-
*
|
|
42268
|
-
*
|
|
42269
|
-
*
|
|
42234
|
+
* }
|
|
42235
|
+
* ],
|
|
42236
|
+
* "correction": {
|
|
42237
|
+
* "outcome": "applied",
|
|
42238
|
+
* "price_approval_id": null,
|
|
42239
|
+
* "change_id": "01a1c1df-a6ea-779f-9310-bdbb2eadd202",
|
|
42240
|
+
* "trade_ins": []
|
|
42270
42241
|
* }
|
|
42271
42242
|
* }
|
|
42272
42243
|
* }
|
|
42273
42244
|
*/
|
|
42274
42245
|
"application/json": {
|
|
42275
|
-
data
|
|
42246
|
+
data: components["schemas"]["SaleNoteRead"];
|
|
42247
|
+
meta?: {
|
|
42248
|
+
[key: string]: unknown;
|
|
42249
|
+
};
|
|
42250
|
+
};
|
|
42251
|
+
};
|
|
42252
|
+
};
|
|
42253
|
+
/** @description Validation error */
|
|
42254
|
+
400: {
|
|
42255
|
+
headers: {
|
|
42256
|
+
[name: string]: unknown;
|
|
42257
|
+
};
|
|
42258
|
+
content: {
|
|
42259
|
+
"application/json": components["schemas"]["Error"];
|
|
42260
|
+
};
|
|
42261
|
+
};
|
|
42262
|
+
/** @description Unauthorized */
|
|
42263
|
+
401: {
|
|
42264
|
+
headers: {
|
|
42265
|
+
[name: string]: unknown;
|
|
42266
|
+
};
|
|
42267
|
+
content: {
|
|
42268
|
+
"application/json": components["schemas"]["Error"];
|
|
42269
|
+
};
|
|
42270
|
+
};
|
|
42271
|
+
/** @description Forbidden */
|
|
42272
|
+
403: {
|
|
42273
|
+
headers: {
|
|
42274
|
+
[name: string]: unknown;
|
|
42275
|
+
};
|
|
42276
|
+
content: {
|
|
42277
|
+
"application/json": components["schemas"]["Error"];
|
|
42278
|
+
};
|
|
42279
|
+
};
|
|
42280
|
+
/** @description Not found */
|
|
42281
|
+
404: {
|
|
42282
|
+
headers: {
|
|
42283
|
+
[name: string]: unknown;
|
|
42284
|
+
};
|
|
42285
|
+
content: {
|
|
42286
|
+
"application/json": components["schemas"]["Error"];
|
|
42287
|
+
};
|
|
42288
|
+
};
|
|
42289
|
+
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
42290
|
+
409: {
|
|
42291
|
+
headers: {
|
|
42292
|
+
[name: string]: unknown;
|
|
42293
|
+
};
|
|
42294
|
+
content: {
|
|
42295
|
+
"application/json": components["schemas"]["Error"];
|
|
42296
|
+
};
|
|
42297
|
+
};
|
|
42298
|
+
/** @description Rate limited */
|
|
42299
|
+
429: {
|
|
42300
|
+
headers: {
|
|
42301
|
+
[name: string]: unknown;
|
|
42302
|
+
};
|
|
42303
|
+
content: {
|
|
42304
|
+
"application/json": components["schemas"]["Error"];
|
|
42305
|
+
};
|
|
42306
|
+
};
|
|
42307
|
+
};
|
|
42308
|
+
};
|
|
42309
|
+
delete?: never;
|
|
42310
|
+
options?: never;
|
|
42311
|
+
head?: never;
|
|
42312
|
+
patch?: never;
|
|
42313
|
+
trace?: never;
|
|
42314
|
+
};
|
|
42315
|
+
"/sale-notes/{id}/discounts/{discountId}": {
|
|
42316
|
+
parameters: {
|
|
42317
|
+
query?: never;
|
|
42318
|
+
header?: never;
|
|
42319
|
+
path?: never;
|
|
42320
|
+
cookie?: never;
|
|
42321
|
+
};
|
|
42322
|
+
get?: never;
|
|
42323
|
+
put?: never;
|
|
42324
|
+
post?: never;
|
|
42325
|
+
/**
|
|
42326
|
+
* Remove a «Descuento» line from a nota de venta
|
|
42327
|
+
* @description Removes one «Descuento» (app#8131) from a nota de venta that is ISSUED or APPROVED and not voided: the price after Descuentos goes back up by its amount (never a price approval). Same transaction and same `history` entry as adding one (`changes.discount: { from: <the line>, to: null }`). Responds with the read of `GET /sale-notes/{id}` plus `correction`. **404** when `discountId` is not a Descuento of this note; **409** `sale_note_voided`. Requires `sale_notes:write`.
|
|
42328
|
+
*/
|
|
42329
|
+
delete: {
|
|
42330
|
+
parameters: {
|
|
42331
|
+
query?: never;
|
|
42332
|
+
header?: never;
|
|
42333
|
+
path: {
|
|
42334
|
+
id: string;
|
|
42335
|
+
discountId: string;
|
|
42336
|
+
};
|
|
42337
|
+
cookie?: never;
|
|
42338
|
+
};
|
|
42339
|
+
requestBody?: never;
|
|
42340
|
+
responses: {
|
|
42341
|
+
/** @description The nota de venta, as GET /sale-notes/{id} reads it, plus correction */
|
|
42342
|
+
200: {
|
|
42343
|
+
headers: {
|
|
42344
|
+
[name: string]: unknown;
|
|
42345
|
+
};
|
|
42346
|
+
content: {
|
|
42347
|
+
/**
|
|
42348
|
+
* @example {
|
|
42349
|
+
* "data": {
|
|
42350
|
+
* "id": "d4d4d4d4-0000-4000-8000-000000000001",
|
|
42351
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
42352
|
+
* "display_id": "V-118",
|
|
42353
|
+
* "display_seq": 118,
|
|
42354
|
+
* "vehicle_id": "e1e1e1e1-0000-4000-8000-000000000002",
|
|
42355
|
+
* "buyer_contact_id": "22222222-0000-4000-8000-000000000002",
|
|
42356
|
+
* "lead_id": null,
|
|
42357
|
+
* "converted_from_reservation_id": null,
|
|
42358
|
+
* "observaciones": "Se entrega con dos llaves y la mantención al día.",
|
|
42359
|
+
* "seller_of_record": "automotora",
|
|
42360
|
+
* "salesperson_id": "11111111-0000-4000-8000-000000000001",
|
|
42361
|
+
* "net_clp": 8300000,
|
|
42362
|
+
* "list_price_clp": 12490000,
|
|
42363
|
+
* "discount_clp": 590000,
|
|
42364
|
+
* "tax_clp": 0,
|
|
42365
|
+
* "tax_treatment": "exento",
|
|
42366
|
+
* "status": "issued",
|
|
42367
|
+
* "issued_at": "2026-09-19T13:00:00.000Z",
|
|
42368
|
+
* "emitted_by": "11111111-0000-4000-8000-000000000001",
|
|
42369
|
+
* "approved_by": null,
|
|
42370
|
+
* "approved_at": null,
|
|
42371
|
+
* "voided_at": null,
|
|
42372
|
+
* "void_reason": null,
|
|
42373
|
+
* "voided_by": null,
|
|
42374
|
+
* "created_at": "2026-09-19T13:00:00.000Z",
|
|
42375
|
+
* "updated_at": "2026-09-19T13:00:00.000Z",
|
|
42376
|
+
* "receivable_obligation_id": "01a1c1df-a6ea-779f-9310-bdbb2eadd184",
|
|
42377
|
+
* "print_missing_fields": [],
|
|
42378
|
+
* "payments": [
|
|
42379
|
+
* {
|
|
42380
|
+
* "id": "d6d6d6d6-0000-4000-8000-000000000002",
|
|
42381
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
42382
|
+
* "reservation_id": null,
|
|
42383
|
+
* "sale_note_id": "d4d4d4d4-0000-4000-8000-000000000001",
|
|
42384
|
+
* "carried_from_reservation_id": null,
|
|
42385
|
+
* "instrument": "transferencia",
|
|
42386
|
+
* "instrument_stated": true,
|
|
42387
|
+
* "amount_clp": 13800000,
|
|
42388
|
+
* "paid_on": "2026-09-19",
|
|
42389
|
+
* "bank": "Banco de Chile",
|
|
42390
|
+
* "account_number": null,
|
|
42391
|
+
* "document_number": null,
|
|
42392
|
+
* "note": null,
|
|
42393
|
+
* "card_fee_bps": null,
|
|
42394
|
+
* "card_surcharge_clp": null,
|
|
42395
|
+
* "card_surcharge_source": null,
|
|
42396
|
+
* "created_at": "2026-09-19T13:05:00.000Z"
|
|
42397
|
+
* }
|
|
42398
|
+
* ],
|
|
42399
|
+
* "totals": {
|
|
42400
|
+
* "total_a_pagar_clp": 13800000,
|
|
42401
|
+
* "total_pagos_clp": 13800000,
|
|
42402
|
+
* "saldo_clp": 0,
|
|
42403
|
+
* "recargo_tarjeta_clp": 0,
|
|
42404
|
+
* "total_a_cobrar_clp": 13800000,
|
|
42405
|
+
* "payment_count": 1,
|
|
42406
|
+
* "complete": true,
|
|
42407
|
+
* "gaps": []
|
|
42408
|
+
* },
|
|
42409
|
+
* "funding": {
|
|
42410
|
+
* "standing": "funded",
|
|
42411
|
+
* "balanced": true,
|
|
42412
|
+
* "terms": {
|
|
42413
|
+
* "price_clp": 13800000,
|
|
42414
|
+
* "add_on_charges_clp": 0,
|
|
42415
|
+
* "payments_clp": 13800000,
|
|
42416
|
+
* "retoma_clp": 0,
|
|
42417
|
+
* "credit_clp": 0
|
|
42418
|
+
* },
|
|
42419
|
+
* "total_a_pagar_clp": 13800000,
|
|
42420
|
+
* "total_consideration_clp": 13800000,
|
|
42421
|
+
* "saldo_clp": 0,
|
|
42422
|
+
* "gap_clp": null,
|
|
42423
|
+
* "saldo_a_favor_del_cliente_clp": null,
|
|
42424
|
+
* "payment_count": 1,
|
|
42425
|
+
* "complete": true,
|
|
42426
|
+
* "gaps": []
|
|
42427
|
+
* },
|
|
42428
|
+
* "trade_ins": [],
|
|
42429
|
+
* "credit": null,
|
|
42430
|
+
* "discounts": [
|
|
42431
|
+
* {
|
|
42432
|
+
* "id": "01a1c1df-a6ea-779f-9310-bdbb2eadd201",
|
|
42433
|
+
* "description": "Por pago al contado",
|
|
42434
|
+
* "amount_clp": 200000,
|
|
42435
|
+
* "created_at": "2026-11-22T15:00:00.000Z",
|
|
42436
|
+
* "created_by": "11111111-0000-4000-8000-000000000001"
|
|
42437
|
+
* }
|
|
42438
|
+
* ],
|
|
42439
|
+
* "discounts_total_clp": 200000,
|
|
42440
|
+
* "price_before_discounts_clp": 8500000,
|
|
42441
|
+
* "price_after_discounts": 8300000,
|
|
42442
|
+
* "timeline": [
|
|
42443
|
+
* {
|
|
42444
|
+
* "step": "emitted",
|
|
42445
|
+
* "at": "2026-09-19T13:00:00.000Z",
|
|
42446
|
+
* "actor": {
|
|
42447
|
+
* "id": "11111111-0000-4000-8000-000000000001",
|
|
42448
|
+
* "name": "Martina Reyes",
|
|
42449
|
+
* "kind": "member"
|
|
42450
|
+
* }
|
|
42451
|
+
* }
|
|
42452
|
+
* ],
|
|
42453
|
+
* "correction": {
|
|
42454
|
+
* "outcome": "applied",
|
|
42455
|
+
* "price_approval_id": null,
|
|
42456
|
+
* "change_id": "01a1c1df-a6ea-779f-9310-bdbb2eadd202",
|
|
42457
|
+
* "trade_ins": []
|
|
42458
|
+
* }
|
|
42459
|
+
* }
|
|
42460
|
+
* }
|
|
42461
|
+
*/
|
|
42462
|
+
"application/json": {
|
|
42463
|
+
data: components["schemas"]["SaleNoteRead"];
|
|
42464
|
+
meta?: {
|
|
42465
|
+
[key: string]: unknown;
|
|
42466
|
+
};
|
|
42467
|
+
};
|
|
42468
|
+
};
|
|
42469
|
+
};
|
|
42470
|
+
/** @description Validation error */
|
|
42471
|
+
400: {
|
|
42472
|
+
headers: {
|
|
42473
|
+
[name: string]: unknown;
|
|
42474
|
+
};
|
|
42475
|
+
content: {
|
|
42476
|
+
"application/json": components["schemas"]["Error"];
|
|
42477
|
+
};
|
|
42478
|
+
};
|
|
42479
|
+
/** @description Unauthorized */
|
|
42480
|
+
401: {
|
|
42481
|
+
headers: {
|
|
42482
|
+
[name: string]: unknown;
|
|
42483
|
+
};
|
|
42484
|
+
content: {
|
|
42485
|
+
"application/json": components["schemas"]["Error"];
|
|
42486
|
+
};
|
|
42487
|
+
};
|
|
42488
|
+
/** @description Forbidden */
|
|
42489
|
+
403: {
|
|
42490
|
+
headers: {
|
|
42491
|
+
[name: string]: unknown;
|
|
42492
|
+
};
|
|
42493
|
+
content: {
|
|
42494
|
+
"application/json": components["schemas"]["Error"];
|
|
42495
|
+
};
|
|
42496
|
+
};
|
|
42497
|
+
/** @description Not found */
|
|
42498
|
+
404: {
|
|
42499
|
+
headers: {
|
|
42500
|
+
[name: string]: unknown;
|
|
42501
|
+
};
|
|
42502
|
+
content: {
|
|
42503
|
+
"application/json": components["schemas"]["Error"];
|
|
42504
|
+
};
|
|
42505
|
+
};
|
|
42506
|
+
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
42507
|
+
409: {
|
|
42508
|
+
headers: {
|
|
42509
|
+
[name: string]: unknown;
|
|
42510
|
+
};
|
|
42511
|
+
content: {
|
|
42512
|
+
"application/json": components["schemas"]["Error"];
|
|
42513
|
+
};
|
|
42514
|
+
};
|
|
42515
|
+
/** @description Rate limited */
|
|
42516
|
+
429: {
|
|
42517
|
+
headers: {
|
|
42518
|
+
[name: string]: unknown;
|
|
42519
|
+
};
|
|
42520
|
+
content: {
|
|
42521
|
+
"application/json": components["schemas"]["Error"];
|
|
42522
|
+
};
|
|
42523
|
+
};
|
|
42524
|
+
};
|
|
42525
|
+
};
|
|
42526
|
+
options?: never;
|
|
42527
|
+
head?: never;
|
|
42528
|
+
patch?: never;
|
|
42529
|
+
trace?: never;
|
|
42530
|
+
};
|
|
42531
|
+
"/sale-notes/{id}/add-ons/{lineId}/recalculate": {
|
|
42532
|
+
parameters: {
|
|
42533
|
+
query?: never;
|
|
42534
|
+
header?: never;
|
|
42535
|
+
path?: never;
|
|
42536
|
+
cookie?: never;
|
|
42537
|
+
};
|
|
42538
|
+
get?: never;
|
|
42539
|
+
put?: never;
|
|
42540
|
+
/**
|
|
42541
|
+
* Recalculate the transfer tax at the note’s current price
|
|
42542
|
+
* @description Rewrites a `transferencia_municipal` line (app#7318) with the transfer tax computed at the note’s CURRENT price (the same computation as `POST /transfer-tax/preview`, as of the note’s issue day, with permiso de circulación) and the citation of the rate row it used; a reembolso’s cost follows. Only ever on this explicit request: after a price correction `GET /sale-notes/{id}` reads `transfer_tax: { line_id, charge_clp, source: calculated | typed, at_current_price_clp, gaps, recalculation_offered }`, and `recalculation_offered` is `true` only for a CALCULATED line whose amount differs from the current price’s. A typed line is never offered one, but may still be recalculated on request. Re-states the receivable and writes a `history` entry (`kind: add_on`, the `to` snapshot carries `recalculated: true`); a no-op when the amount already matches. Responds with the same read as `GET /sale-notes/{id}`.
|
|
42543
|
+
*
|
|
42544
|
+
* **400** when the line is not the transfer tax; **404** when `lineId` is not an add-on line of this note; **409** `details.blocked_reason` = `transfer_tax_incomplete` (with `details.gaps`) when it cannot be computed, or `sale_note_voided`. Requires `sale_notes:write`.
|
|
42545
|
+
*/
|
|
42546
|
+
post: {
|
|
42547
|
+
parameters: {
|
|
42548
|
+
query?: never;
|
|
42549
|
+
header?: {
|
|
42550
|
+
/** @description Replay-safe retries: resending the SAME key with the SAME body returns the original response (`X-Idempotent-Replay: 1`) instead of creating a second copy — safe to send whenever a response might not have arrived. The same key with a DIFFERENT body answers `409 IDEMPOTENCY_KEY_CONFLICT`; use a fresh key per operation. */
|
|
42551
|
+
"Idempotency-Key"?: string;
|
|
42552
|
+
};
|
|
42553
|
+
path: {
|
|
42554
|
+
id: string;
|
|
42555
|
+
lineId: string;
|
|
42556
|
+
};
|
|
42557
|
+
cookie?: never;
|
|
42558
|
+
};
|
|
42559
|
+
requestBody?: never;
|
|
42560
|
+
responses: {
|
|
42561
|
+
/** @description The nota de venta, as GET /sale-notes/{id} reads it */
|
|
42562
|
+
200: {
|
|
42563
|
+
headers: {
|
|
42564
|
+
[name: string]: unknown;
|
|
42565
|
+
};
|
|
42566
|
+
content: {
|
|
42567
|
+
/**
|
|
42568
|
+
* @example {
|
|
42569
|
+
* "data": {
|
|
42570
|
+
* "id": "d4d4d4d4-0000-4000-8000-000000000001",
|
|
42571
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
42572
|
+
* "display_id": "V-118",
|
|
42573
|
+
* "display_seq": 118,
|
|
42574
|
+
* "vehicle_id": "e1e1e1e1-0000-4000-8000-000000000002",
|
|
42575
|
+
* "buyer_contact_id": "22222222-0000-4000-8000-000000000002",
|
|
42576
|
+
* "lead_id": null,
|
|
42577
|
+
* "converted_from_reservation_id": null,
|
|
42578
|
+
* "observaciones": "Se entrega con dos llaves y la mantención al día.",
|
|
42579
|
+
* "seller_of_record": "automotora",
|
|
42580
|
+
* "salesperson_id": "11111111-0000-4000-8000-000000000001",
|
|
42581
|
+
* "net_clp": 11900000,
|
|
42582
|
+
* "list_price_clp": 12490000,
|
|
42583
|
+
* "discount_clp": 590000,
|
|
42584
|
+
* "tax_clp": 1900000,
|
|
42585
|
+
* "tax_treatment": "afecto",
|
|
42586
|
+
* "status": "issued",
|
|
42587
|
+
* "issued_at": "2026-09-19T13:00:00.000Z",
|
|
42588
|
+
* "emitted_by": "11111111-0000-4000-8000-000000000001",
|
|
42589
|
+
* "approved_by": null,
|
|
42590
|
+
* "approved_at": null,
|
|
42591
|
+
* "voided_at": null,
|
|
42592
|
+
* "void_reason": null,
|
|
42593
|
+
* "voided_by": null,
|
|
42594
|
+
* "created_at": "2026-09-19T13:00:00.000Z",
|
|
42595
|
+
* "updated_at": "2026-09-19T13:00:00.000Z",
|
|
42596
|
+
* "receivable_obligation_id": "01a1c1df-a6ea-779f-9310-bdbb2eadd184",
|
|
42597
|
+
* "print_missing_fields": [],
|
|
42598
|
+
* "payments": [
|
|
42599
|
+
* {
|
|
42600
|
+
* "id": "d6d6d6d6-0000-4000-8000-000000000002",
|
|
42601
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
42602
|
+
* "reservation_id": null,
|
|
42603
|
+
* "sale_note_id": "d4d4d4d4-0000-4000-8000-000000000001",
|
|
42604
|
+
* "carried_from_reservation_id": null,
|
|
42605
|
+
* "instrument": "transferencia",
|
|
42606
|
+
* "instrument_stated": true,
|
|
42607
|
+
* "amount_clp": 13800000,
|
|
42608
|
+
* "paid_on": "2026-09-19",
|
|
42609
|
+
* "bank": "Banco de Chile",
|
|
42610
|
+
* "account_number": null,
|
|
42611
|
+
* "document_number": null,
|
|
42612
|
+
* "note": null,
|
|
42613
|
+
* "card_fee_bps": null,
|
|
42614
|
+
* "card_surcharge_clp": null,
|
|
42615
|
+
* "card_surcharge_source": null,
|
|
42616
|
+
* "created_at": "2026-09-19T13:05:00.000Z"
|
|
42617
|
+
* }
|
|
42618
|
+
* ],
|
|
42619
|
+
* "totals": {
|
|
42620
|
+
* "total_a_pagar_clp": 13800000,
|
|
42621
|
+
* "total_pagos_clp": 13800000,
|
|
42622
|
+
* "saldo_clp": 0,
|
|
42623
|
+
* "recargo_tarjeta_clp": 0,
|
|
42624
|
+
* "total_a_cobrar_clp": 13800000,
|
|
42625
|
+
* "payment_count": 1,
|
|
42626
|
+
* "complete": true,
|
|
42627
|
+
* "gaps": []
|
|
42628
|
+
* },
|
|
42629
|
+
* "funding": {
|
|
42630
|
+
* "standing": "funded",
|
|
42631
|
+
* "balanced": true,
|
|
42632
|
+
* "terms": {
|
|
42633
|
+
* "price_clp": 13800000,
|
|
42634
|
+
* "add_on_charges_clp": 0,
|
|
42635
|
+
* "payments_clp": 13800000,
|
|
42636
|
+
* "retoma_clp": 0,
|
|
42637
|
+
* "credit_clp": 0
|
|
42638
|
+
* },
|
|
42639
|
+
* "total_a_pagar_clp": 13800000,
|
|
42640
|
+
* "total_consideration_clp": 13800000,
|
|
42641
|
+
* "saldo_clp": 0,
|
|
42642
|
+
* "gap_clp": null,
|
|
42643
|
+
* "saldo_a_favor_del_cliente_clp": null,
|
|
42644
|
+
* "payment_count": 1,
|
|
42645
|
+
* "complete": true,
|
|
42646
|
+
* "gaps": []
|
|
42647
|
+
* },
|
|
42648
|
+
* "trade_ins": [],
|
|
42649
|
+
* "credit": null,
|
|
42650
|
+
* "discounts": [],
|
|
42651
|
+
* "discounts_total_clp": 0,
|
|
42652
|
+
* "price_before_discounts_clp": 13800000,
|
|
42653
|
+
* "price_after_discounts": 13800000,
|
|
42654
|
+
* "timeline": [
|
|
42655
|
+
* {
|
|
42656
|
+
* "step": "emitted",
|
|
42657
|
+
* "at": "2026-09-19T13:00:00.000Z",
|
|
42658
|
+
* "actor": {
|
|
42659
|
+
* "id": "11111111-0000-4000-8000-000000000001",
|
|
42660
|
+
* "name": "Martina Reyes",
|
|
42661
|
+
* "kind": "member"
|
|
42662
|
+
* }
|
|
42663
|
+
* }
|
|
42664
|
+
* ],
|
|
42665
|
+
* "transfer_tax": {
|
|
42666
|
+
* "line_id": "01a1c1df-a6ea-779f-9310-bdbb2eadd1a7",
|
|
42667
|
+
* "charge_clp": 120000,
|
|
42668
|
+
* "source": "calculated",
|
|
42669
|
+
* "at_current_price_clp": 135000,
|
|
42670
|
+
* "gaps": [],
|
|
42671
|
+
* "recalculation_offered": true
|
|
42672
|
+
* },
|
|
42673
|
+
* "history": [
|
|
42674
|
+
* {
|
|
42675
|
+
* "id": "01a1c1df-a6ea-779f-9310-bdbb2eadd1a8",
|
|
42676
|
+
* "kind": "add_on",
|
|
42677
|
+
* "changes": {
|
|
42678
|
+
* "add_on": {
|
|
42679
|
+
* "from": {
|
|
42680
|
+
* "line_id": "01a1c1df-a6ea-779f-9310-bdbb2eadd1a9",
|
|
42681
|
+
* "kind": "otro",
|
|
42682
|
+
* "description": "Garantía extendida",
|
|
42683
|
+
* "charge_clp": 119000,
|
|
42684
|
+
* "tax_treatment": "afecto"
|
|
42685
|
+
* },
|
|
42686
|
+
* "to": {
|
|
42687
|
+
* "line_id": "01a1c1df-a6ea-779f-9310-bdbb2eadd1a9",
|
|
42688
|
+
* "kind": "otro",
|
|
42689
|
+
* "description": "Garantía extendida 24 meses",
|
|
42690
|
+
* "charge_clp": 150000,
|
|
42691
|
+
* "tax_treatment": "afecto"
|
|
42692
|
+
* }
|
|
42693
|
+
* }
|
|
42694
|
+
* },
|
|
42695
|
+
* "at": "2026-11-15T13:20:00.000Z",
|
|
42696
|
+
* "actor": null,
|
|
42697
|
+
* "on_approved_note": true,
|
|
42698
|
+
* "price_approval_id": null,
|
|
42699
|
+
* "authorised_by": null
|
|
42700
|
+
* }
|
|
42701
|
+
* ],
|
|
42702
|
+
* "compraventa_outdated": false,
|
|
42703
|
+
* "pending_price_change": null
|
|
42704
|
+
* }
|
|
42705
|
+
* }
|
|
42706
|
+
*/
|
|
42707
|
+
"application/json": {
|
|
42708
|
+
data: components["schemas"]["SaleNoteRead"];
|
|
42709
|
+
meta?: {
|
|
42710
|
+
[key: string]: unknown;
|
|
42711
|
+
};
|
|
42712
|
+
};
|
|
42713
|
+
};
|
|
42714
|
+
};
|
|
42715
|
+
/** @description Validation error */
|
|
42716
|
+
400: {
|
|
42717
|
+
headers: {
|
|
42718
|
+
[name: string]: unknown;
|
|
42719
|
+
};
|
|
42720
|
+
content: {
|
|
42721
|
+
"application/json": components["schemas"]["Error"];
|
|
42722
|
+
};
|
|
42723
|
+
};
|
|
42724
|
+
/** @description Unauthorized */
|
|
42725
|
+
401: {
|
|
42726
|
+
headers: {
|
|
42727
|
+
[name: string]: unknown;
|
|
42728
|
+
};
|
|
42729
|
+
content: {
|
|
42730
|
+
"application/json": components["schemas"]["Error"];
|
|
42731
|
+
};
|
|
42732
|
+
};
|
|
42733
|
+
/** @description Forbidden */
|
|
42734
|
+
403: {
|
|
42735
|
+
headers: {
|
|
42736
|
+
[name: string]: unknown;
|
|
42737
|
+
};
|
|
42738
|
+
content: {
|
|
42739
|
+
"application/json": components["schemas"]["Error"];
|
|
42740
|
+
};
|
|
42741
|
+
};
|
|
42742
|
+
/** @description Not found */
|
|
42743
|
+
404: {
|
|
42744
|
+
headers: {
|
|
42745
|
+
[name: string]: unknown;
|
|
42746
|
+
};
|
|
42747
|
+
content: {
|
|
42748
|
+
"application/json": components["schemas"]["Error"];
|
|
42749
|
+
};
|
|
42750
|
+
};
|
|
42751
|
+
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
42752
|
+
409: {
|
|
42753
|
+
headers: {
|
|
42754
|
+
[name: string]: unknown;
|
|
42755
|
+
};
|
|
42756
|
+
content: {
|
|
42757
|
+
"application/json": components["schemas"]["Error"];
|
|
42758
|
+
};
|
|
42759
|
+
};
|
|
42760
|
+
/** @description Rate limited */
|
|
42761
|
+
429: {
|
|
42762
|
+
headers: {
|
|
42763
|
+
[name: string]: unknown;
|
|
42764
|
+
};
|
|
42765
|
+
content: {
|
|
42766
|
+
"application/json": components["schemas"]["Error"];
|
|
42767
|
+
};
|
|
42768
|
+
};
|
|
42769
|
+
};
|
|
42770
|
+
};
|
|
42771
|
+
delete?: never;
|
|
42772
|
+
options?: never;
|
|
42773
|
+
head?: never;
|
|
42774
|
+
patch?: never;
|
|
42775
|
+
trace?: never;
|
|
42776
|
+
};
|
|
42777
|
+
"/sale-notes/{id}/approve": {
|
|
42778
|
+
parameters: {
|
|
42779
|
+
query?: never;
|
|
42780
|
+
header?: never;
|
|
42781
|
+
path?: never;
|
|
42782
|
+
cookie?: never;
|
|
42783
|
+
};
|
|
42784
|
+
get?: never;
|
|
42785
|
+
put?: never;
|
|
42786
|
+
/**
|
|
42787
|
+
* Approve a nota de venta (the sale fan-out)
|
|
42788
|
+
* @description **`cancelled_visits` (vitrina-app#7960)** — when the call takes the car out of stock (sold, or `active: false`), its future visits and test drives are cancelled right after the commit, as always, and the answer says what happened to them: `{ count, told: [{ appointment_id, starts_at, name, channel }], not_told: [{ appointment_id, starts_at, name, phone, reason }], hidden_count, message }`. `told` = the customer gets the cancellation notice through that conversation channel. `not_told` = call them: `reason` is `no_conversation` (typed by hand), `channel_unreachable` or `window_closed` (WhatsApp, Instagram or Messenger and the customer has not written in 24 hours; no template is sent, so the notice is not attempted). `phone` is the contact’s phone, `null` when none is on file. Visits in another salesperson’s agenda that the caller’s role does not see (the GET /appointments ceiling) are only counted, in `hidden_count`. `message` is one Spanish sentence (`null` when `count` is 0). The block is a prediction read a moment before the notices go out, from the rule they obey. ABSENT when the call did not take the car out of stock; `null` when the summary could not be read (the call still succeeded and the visits are still cancelled).
|
|
42789
|
+
*
|
|
42790
|
+
* **A car returned to its owner** (`returned_to_owner: true`, app#7961) is not sold or reserved: the call answers **409** with `details.reason: vehicle_returned_to_owner`, `details.vehicle_id`, `details.consignment_id` (the returned contract) and a Spanish sentence, before anything is written and before any folio is taken. The ways back are undoing the return (`POST /consignments/{id}/undo-return`) or a new consignment. Voiding a note or a reserva of that car is never refused.
|
|
42791
|
+
*
|
|
42792
|
+
* **Below the floor without `price_approval:approve` (app#7589):** **409** `details.reason: price_approval_required` with `details.price_approval_pending` and `details.price_approval_id`. When none was pending the call files one in the caller's name first, so the answer always says the approval is requested: «No puedes cerrar la venta V-41 todavía: el precio está bajo el mínimo y un administrador tiene que aprobarlo primero. La aprobación del precio ya está pedida.» The answer carries `price_approval` like every note read.
|
|
42793
|
+
*
|
|
42794
|
+
* **Closed by a member holding `price_approval:approve` (app#7704):** the note’s pending price request (if any, and not filed by that same member) is resolved `approved` by them in the same transaction, audited as `price_approvals.decide`; it leaves the approval queue and its count.
|
|
42795
|
+
*
|
|
42796
|
+
* Approves the document — the instant it becomes **legally valid** (BR-485) and the instant every consequence of the sale fires. All of it happens in **ONE database transaction**, so either all of it happened or none of it did:
|
|
42797
|
+
*
|
|
42798
|
+
* * the document is stamped with WHO approved it and WHEN (BR-484);
|
|
42799
|
+
* * **the car is marked `vendido`** (BR-486), which is TERMINAL — a sold unit never sells or lists again (ADR 0030, regla de Estadía);
|
|
42800
|
+
* * every **vigente cotización** on that unit is voided in the same write (BR-215), so the car is never left sold with a live price commitment standing on it;
|
|
42801
|
+
* * the **Negocio** the note names (`lead_id`) is closed WON (BR-487), by a real stage move rather than a status patch.
|
|
42802
|
+
*
|
|
42803
|
+
* Afterwards the document appears in `GET /sale-notes/post-sale-obligations` (BR-489) and its Contrato de Compraventa and Declaración de Responsabilidad become printable (BR-488). The unit’s portal adverts are retracted immediately AFTER the transaction commits — never before, because a queue job cannot be rolled back and a rolled-back approval must not unpublish a car that was not sold.
|
|
42804
|
+
*
|
|
42805
|
+
* **The body is empty and strict.** The approver is the authenticated principal and the instant is server-stamped; a body naming either is a 400. Back-dating an approval is expressible only on `POST /sale-notes` (`approved_at`), and only for the ADR 0058 §11 talonario cutover.
|
|
42806
|
+
*
|
|
42807
|
+
* **Refusals write NOTHING** — not the stamp, not the sold flag, not the quote deaths, not the deal close, and no advert job:
|
|
42808
|
+
*
|
|
42809
|
+
* * **409** when the sale’s price is below the level this organisation requires an authorisation for and no APPROVED `price_approval` names this document (BR-433/BR-434 — a salesperson cannot authorise their own discount). Raise one with `POST /price-approvals` and have somebody else decide it. A caller holding `price_approval:approve` (an owner or admin) is not refused: approving the sale is their authorisation of the price. The refusal deliberately states no figure: the shortfall and the reference are cost disclosures gated on `dealership_economics:read`.
|
|
42810
|
+
* * **409** when the unit has already been sold by another document.
|
|
42811
|
+
* * A consigned car never refuses over its mandato: the approval emits it when the contract can produce it, and otherwise it is produced with `POST /consignments/{id}/contract` when someone asks for it.
|
|
42812
|
+
* * **409** when the document is already approved, or is voided — an approval names a person and a moment and cannot be restated.
|
|
42813
|
+
* * **400** when the deal’s board has no Won column, or forbids the move onto it.
|
|
42814
|
+
*
|
|
42815
|
+
* Two simultaneous approvals resolve to exactly one 200 and one 409, and the fan-out runs once.
|
|
42816
|
+
*
|
|
42817
|
+
* Requires `sale_notes:write` — approving is the completion of the same act as issuing, not a separate authority (unlike `sale_notes:void`).
|
|
42818
|
+
*/
|
|
42819
|
+
post: {
|
|
42820
|
+
parameters: {
|
|
42821
|
+
query?: never;
|
|
42822
|
+
header?: {
|
|
42823
|
+
/** @description Replay-safe retries: resending the SAME key with the SAME body returns the original response (`X-Idempotent-Replay: 1`) instead of creating a second copy — safe to send whenever a response might not have arrived. The same key with a DIFFERENT body answers `409 IDEMPOTENCY_KEY_CONFLICT`; use a fresh key per operation. */
|
|
42824
|
+
"Idempotency-Key"?: string;
|
|
42825
|
+
};
|
|
42826
|
+
path: {
|
|
42827
|
+
id: string;
|
|
42828
|
+
};
|
|
42829
|
+
cookie?: never;
|
|
42830
|
+
};
|
|
42831
|
+
requestBody?: {
|
|
42832
|
+
content: {
|
|
42833
|
+
/** @example {} */
|
|
42834
|
+
"application/json": Record<string, never>;
|
|
42835
|
+
};
|
|
42836
|
+
};
|
|
42837
|
+
responses: {
|
|
42838
|
+
/** @description The approved nota de venta */
|
|
42839
|
+
200: {
|
|
42840
|
+
headers: {
|
|
42841
|
+
[name: string]: unknown;
|
|
42842
|
+
};
|
|
42843
|
+
content: {
|
|
42844
|
+
/**
|
|
42845
|
+
* @example {
|
|
42846
|
+
* "data": {
|
|
42847
|
+
* "id": "d4d4d4d4-0000-4000-8000-000000000001",
|
|
42848
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
42849
|
+
* "display_id": "V-118",
|
|
42850
|
+
* "display_seq": 118,
|
|
42851
|
+
* "vehicle_id": "e1e1e1e1-0000-4000-8000-000000000002",
|
|
42852
|
+
* "buyer_contact_id": "22222222-0000-4000-8000-000000000002",
|
|
42853
|
+
* "lead_id": null,
|
|
42854
|
+
* "converted_from_reservation_id": null,
|
|
42855
|
+
* "observaciones": "Se entrega con dos llaves y la mantención al día.",
|
|
42856
|
+
* "seller_of_record": "automotora",
|
|
42857
|
+
* "salesperson_id": "11111111-0000-4000-8000-000000000001",
|
|
42858
|
+
* "net_clp": 11900000,
|
|
42859
|
+
* "list_price_clp": 12490000,
|
|
42860
|
+
* "discount_clp": 590000,
|
|
42861
|
+
* "tax_clp": 1900000,
|
|
42862
|
+
* "tax_treatment": "afecto",
|
|
42863
|
+
* "status": "approved",
|
|
42864
|
+
* "issued_at": "2026-09-19T13:00:00.000Z",
|
|
42865
|
+
* "emitted_by": "11111111-0000-4000-8000-000000000001",
|
|
42866
|
+
* "approved_by": "11111111-0000-4000-8000-000000000001",
|
|
42867
|
+
* "approved_at": "2026-09-19T14:10:00.000Z",
|
|
42868
|
+
* "voided_at": null,
|
|
42869
|
+
* "void_reason": null,
|
|
42870
|
+
* "voided_by": null,
|
|
42871
|
+
* "created_at": "2026-09-19T13:00:00.000Z",
|
|
42872
|
+
* "updated_at": "2026-09-19T13:00:00.000Z",
|
|
42873
|
+
* "cancelled_visits": {
|
|
42874
|
+
* "count": 2,
|
|
42875
|
+
* "told": [
|
|
42876
|
+
* {
|
|
42877
|
+
* "appointment_id": "dddddddd-0000-4000-8000-000000000001",
|
|
42878
|
+
* "starts_at": "2026-09-20T14:00:00.000Z",
|
|
42879
|
+
* "name": "Juan Pérez",
|
|
42880
|
+
* "channel": "whatsapp"
|
|
42881
|
+
* }
|
|
42882
|
+
* ],
|
|
42883
|
+
* "not_told": [
|
|
42884
|
+
* {
|
|
42885
|
+
* "appointment_id": "dddddddd-0000-4000-8000-000000000002",
|
|
42886
|
+
* "starts_at": "2026-09-21T15:30:00.000Z",
|
|
42887
|
+
* "name": "María Soto",
|
|
42888
|
+
* "phone": "+56 9 1234 5678",
|
|
42889
|
+
* "reason": "no_conversation"
|
|
42890
|
+
* }
|
|
42891
|
+
* ],
|
|
42892
|
+
* "hidden_count": 0,
|
|
42893
|
+
* "message": "Se cancelaron 2 visitas de este auto. A Juan Pérez se le avisó por WhatsApp. A María Soto no se le pudo avisar (la visita no tiene conversación): su teléfono es +56 9 1234 5678."
|
|
42894
|
+
* }
|
|
42895
|
+
* }
|
|
42896
|
+
* }
|
|
42897
|
+
*/
|
|
42898
|
+
"application/json": {
|
|
42899
|
+
data?: unknown;
|
|
42276
42900
|
meta?: {
|
|
42277
42901
|
[key: string]: unknown;
|
|
42278
42902
|
};
|
|
@@ -46901,9 +47525,9 @@ interface paths {
|
|
|
46901
47525
|
*
|
|
46902
47526
|
* **It is a write, and the scope is `consignments:write`.** The call brings a binding legal instrument into existence — BR-823 calls it "the only instrument permitting a dealer to sell a car it does not own" — storing bytes and appending an append-only row a court may later read.
|
|
46903
47527
|
*
|
|
46904
|
-
* **There is no body and nothing is caller-supplied.** The parties, the vehicle, the comisión, the vencimiento and the clause prose are all read off the rows. A **409** names whichever fact the instrument cannot state without: no MANDANTE linked, no
|
|
47528
|
+
* **There is no body and nothing is caller-supplied.** The parties, the vehicle, the comisión, the vencimiento and the clause prose are all read off the rows. A **409** names whichever fact the instrument cannot state without: no MANDANTE linked, no name on the mandante, no patente on the vehicle, or an unconfigured or ambiguous dealership identity. The owner’s RUT and domicilio are not gaps (app#8132): missing, they print as a line to complete by hand («RUT N° __________», «con domicilio en __________»), worded for a person when there is no RUT; printing again once they are on file gives the full text (company wording for a RUT of 50.000.000 or more; a tipo de persona set by hand wins). A missing Precio cliente or commission is not a gap (the sentences that state them are left out). The standard text also prints «Si se vende en $X, el dueño recibe $Y» at the car’s published price after the commission of a sale (the higher of the percentage and the Comisión mínima) and its IVA, when the car has a price and the contract a commission (variables `EJEMPLO_PRECIO_VENTA`, `EJEMPLO_MONTO_DUENO`).
|
|
46905
47529
|
*
|
|
46906
|
-
* **Legal data on request (app#7589).** The mandato asks for the data it prints only here: `GET /consignments/{id}/contract/requirements` lists it as one form, and this call may carry it as the optional body `{ legal_data: { "<missing_fields[].key>": "<value>" } }`: each value is saved where it belongs (the dealership’s Datos legales, created when the workspace has none, needs `organization_legal:write`; the owner’s contact needs `contacts:write`, else **403**; an unknown key is a **400**) and the contract prints in the same call. Still missing → **409** `details.blocked_reason: consignment_contract_data_missing` with `details.missing` (labels), `details.missing_fields` (the same shape as the requirements) and `details.legacy_blocked_reason` (`automotora_identity_missing` | `mandante_incomplete`, the code this refusal had before). The tipo de persona is never asked.
|
|
47530
|
+
* **Legal data on request (app#7589).** The mandato asks for the data it prints only here: `GET /consignments/{id}/contract/requirements` lists it as one form, and this call may carry it as the optional body `{ legal_data: { "<missing_fields[].key | blank_fields[].key>": "<value>" } }`: each value is saved where it belongs (the dealership’s Datos legales, created when the workspace has none, needs `organization_legal:write`; the owner’s contact needs `contacts:write`, else **403**; an unknown key is a **400**) and the contract prints in the same call. Still missing → **409** `details.blocked_reason: consignment_contract_data_missing` with `details.missing` (labels), `details.missing_fields` (the same shape as the requirements) and `details.legacy_blocked_reason` (`automotora_identity_missing` | `mandante_incomplete`, the code this refusal had before). The tipo de persona is never asked.
|
|
46907
47531
|
*
|
|
46908
47532
|
* **RE-PRINTING IS NOT A NEW INSTRUMENT.** The rendered bytes are a pure function of the contract — the printed date comes from the contract itself and the PDF `creationDate` is pinned to it, never a print-time clock (BR-501 corrected) — so a second call on an unchanged contract returns the **same artefact id and the same `sha256`** with `frozen: true` and a **200**, having written nothing. When an input genuinely changed — a renegotiated mínimo (a new `terms_version`), a corrected RUT, an edited comisión, a new template version — a **201** carries a NEW artefact whose `supersedes_id` names the previous one; the previous bytes are never edited, because `rendered_document` refuses an UPDATE outright.
|
|
46909
47533
|
*
|
|
@@ -46932,7 +47556,7 @@ interface paths {
|
|
|
46932
47556
|
* }
|
|
46933
47557
|
*/
|
|
46934
47558
|
"application/json": {
|
|
46935
|
-
/** @description Values keyed by `missing_fields[].key` (e.g. `{"owner.tax_id": "12.345.678-5", "house.comuna_code": "13123"}`). Comunas are CUT codes. Blank values are ignored. */
|
|
47559
|
+
/** @description Values keyed by `missing_fields[].key` or `blank_fields[].key` (e.g. `{"owner.tax_id": "12.345.678-5", "house.comuna_code": "13123"}`). Comunas are CUT codes. Blank values are ignored. */
|
|
46936
47560
|
legal_data?: {
|
|
46937
47561
|
[key: string]: string;
|
|
46938
47562
|
};
|
|
@@ -47083,7 +47707,7 @@ interface paths {
|
|
|
47083
47707
|
* What the contrato de consignación still needs
|
|
47084
47708
|
* @description The data the mandato prints and this consignment does not have yet, as ONE short form (app#7589). Asked only when the dealer requests the contract.
|
|
47085
47709
|
*
|
|
47086
|
-
* `ready: true` = it prints now. `missing_fields[]` = `{ key, label, input, saved_to: { resource, id, field } }`: `key` is what `POST /consignments/{id}/contract` takes in `legal_data`; `label` is Spanish; `input` is `text` | `rut` | `comuna` (CUT code); `saved_to.resource` is `organization_legal` (the dealership’s Datos legales; `id: null` = created on save) or `contact` (the owner). Keys: `house.legal_name|tax_id|address_street|comuna_code` (what the mandato prints), plus `house.giro|representative_name` only when the workspace has no Datos legales yet (the record cannot exist without them); `owner.name
|
|
47710
|
+
* `ready: true` = it prints now. `missing_fields[]` = `{ key, label, input, saved_to: { resource, id, field } }`: `key` is what `POST /consignments/{id}/contract` takes in `legal_data`; `label` is Spanish; `input` is `text` | `rut` | `comuna` (CUT code); `saved_to.resource` is `organization_legal` (the dealership’s Datos legales; `id: null` = created on save) or `contact` (the owner). Keys: `house.legal_name|tax_id|address_street|comuna_code` (what the mandato prints), plus `house.giro|representative_name` only when the workspace has no Datos legales yet (the record cannot exist without them); `owner.name`. The tipo de persona, the escritura and the representative’s RUT are never asked. The owner’s RUT, calle and comuna never hold the print (app#8132): missing, they print as a line to complete by hand («RUT N° __________», «con domicilio en __________», worded for a person when there is no RUT) and are listed in `blank_fields[]` (same item shape, keys `owner.tax_id|address_street|comuna_code`) with `ready: true`; `legal_data` still saves them. `blocked` (`{ reason, message }`, else `null`) is a state no form fixes: `owner_missing` (no owner linked), `vehicle_plate_missing`, `automotora_identity_ambiguous`.
|
|
47087
47711
|
*/
|
|
47088
47712
|
get: {
|
|
47089
47713
|
parameters: {
|
|
@@ -47106,8 +47730,9 @@ interface paths {
|
|
|
47106
47730
|
* @example {
|
|
47107
47731
|
* "data": {
|
|
47108
47732
|
* "consignment_contract_id": "d7d7d7d7-0000-4000-8000-000000000001",
|
|
47109
|
-
* "ready":
|
|
47110
|
-
* "missing_fields": [
|
|
47733
|
+
* "ready": true,
|
|
47734
|
+
* "missing_fields": [],
|
|
47735
|
+
* "blank_fields": [
|
|
47111
47736
|
* {
|
|
47112
47737
|
* "key": "owner.tax_id",
|
|
47113
47738
|
* "label": "RUT del dueño",
|
|
@@ -48641,6 +49266,7 @@ interface paths {
|
|
|
48641
49266
|
* "sale_note_id": null,
|
|
48642
49267
|
* "carried_from_reservation_id": null,
|
|
48643
49268
|
* "instrument": "transferencia",
|
|
49269
|
+
* "instrument_stated": true,
|
|
48644
49270
|
* "amount_clp": 300000,
|
|
48645
49271
|
* "paid_on": "2026-09-18",
|
|
48646
49272
|
* "bank": "Banco Estado",
|
|
@@ -48853,6 +49479,7 @@ interface paths {
|
|
|
48853
49479
|
* "sale_note_id": null,
|
|
48854
49480
|
* "carried_from_reservation_id": null,
|
|
48855
49481
|
* "instrument": "transferencia",
|
|
49482
|
+
* "instrument_stated": true,
|
|
48856
49483
|
* "amount_clp": 300000,
|
|
48857
49484
|
* "paid_on": "2026-09-18",
|
|
48858
49485
|
* "bank": "Banco Estado",
|
|
@@ -49777,6 +50404,7 @@ interface paths {
|
|
|
49777
50404
|
* "sale_note_id": "d4d4d4d4-0000-4000-8000-000000000001",
|
|
49778
50405
|
* "carried_from_reservation_id": "d3d3d3d3-0000-4000-8000-000000000001",
|
|
49779
50406
|
* "instrument": "transferencia",
|
|
50407
|
+
* "instrument_stated": true,
|
|
49780
50408
|
* "amount_clp": 300000,
|
|
49781
50409
|
* "paid_on": "2026-09-18",
|
|
49782
50410
|
* "bank": "Banco Estado",
|
|
@@ -49902,6 +50530,7 @@ interface paths {
|
|
|
49902
50530
|
* "sale_note_id": "d4d4d4d4-0000-4000-8000-000000000001",
|
|
49903
50531
|
* "carried_from_reservation_id": "d3d3d3d3-0000-4000-8000-000000000001",
|
|
49904
50532
|
* "instrument": "tarjeta_credito",
|
|
50533
|
+
* "instrument_stated": true,
|
|
49905
50534
|
* "amount_clp": 8900000,
|
|
49906
50535
|
* "paid_on": "2026-09-24",
|
|
49907
50536
|
* "bank": null,
|
|
@@ -50030,7 +50659,7 @@ interface paths {
|
|
|
50030
50659
|
reservation_id?: string;
|
|
50031
50660
|
sale_note_id?: string;
|
|
50032
50661
|
/**
|
|
50033
|
-
* @description Medio de pago. Opcional: si se omite queda `transferencia` (ADR 0159: un pago pide solo su monto).
|
|
50662
|
+
* @description Medio de pago. Opcional: si se omite queda `transferencia` (ADR 0159: un pago pide solo su monto) con `instrument_stated: false`, y la nota de venta, la reserva y el contrato no nombran el medio (app#8130).
|
|
50034
50663
|
* @enum {string}
|
|
50035
50664
|
*/
|
|
50036
50665
|
instrument?: "efectivo" | "transferencia" | "cheque" | "vale_vista" | "tarjeta" | "tarjeta_debito" | "tarjeta_credito" | "otro";
|
|
@@ -50061,6 +50690,7 @@ interface paths {
|
|
|
50061
50690
|
* "sale_note_id": null,
|
|
50062
50691
|
* "carried_from_reservation_id": null,
|
|
50063
50692
|
* "instrument": "transferencia",
|
|
50693
|
+
* "instrument_stated": true,
|
|
50064
50694
|
* "amount_clp": 300000,
|
|
50065
50695
|
* "paid_on": "2026-09-18",
|
|
50066
50696
|
* "bank": "Banco Estado",
|
|
@@ -51232,15 +51862,107 @@ interface paths {
|
|
|
51232
51862
|
};
|
|
51233
51863
|
};
|
|
51234
51864
|
};
|
|
51235
|
-
put?: never;
|
|
51236
|
-
post?: never;
|
|
51865
|
+
put?: never;
|
|
51866
|
+
post?: never;
|
|
51867
|
+
/**
|
|
51868
|
+
* Remove a typed Costo de compra
|
|
51869
|
+
* @description The dealer typed a Costo de compra by mistake and empties the field (vitrina-app#7719): the bare cost (`kind: "compra"` with no document link) is removed and the car is back to «sin costo de compra», as if none had been typed. Needs `dealership_economics:write`. 204 with no body. A cost that comes from a document is never removed here and answers the same 409 as a correction, with `error.details.code`: `purchase_cost_on_purchase_note` (+ `purchase_note_id`), `purchase_cost_on_trade_in` (+ `sale_note_id`), `purchase_cost_consigned_vehicle`. 404 for an id of another workspace or none at all. The profit report (`GET /margin`) drops the cost on the next read.
|
|
51870
|
+
*/
|
|
51871
|
+
delete: {
|
|
51872
|
+
parameters: {
|
|
51873
|
+
query?: never;
|
|
51874
|
+
header?: never;
|
|
51875
|
+
path: {
|
|
51876
|
+
id: string;
|
|
51877
|
+
};
|
|
51878
|
+
cookie?: never;
|
|
51879
|
+
};
|
|
51880
|
+
requestBody?: never;
|
|
51881
|
+
responses: {
|
|
51882
|
+
/** @description No content */
|
|
51883
|
+
204: {
|
|
51884
|
+
headers: {
|
|
51885
|
+
[name: string]: unknown;
|
|
51886
|
+
};
|
|
51887
|
+
content?: never;
|
|
51888
|
+
};
|
|
51889
|
+
/** @description Validation error */
|
|
51890
|
+
400: {
|
|
51891
|
+
headers: {
|
|
51892
|
+
[name: string]: unknown;
|
|
51893
|
+
};
|
|
51894
|
+
content: {
|
|
51895
|
+
"application/json": components["schemas"]["Error"];
|
|
51896
|
+
};
|
|
51897
|
+
};
|
|
51898
|
+
/** @description Unauthorized */
|
|
51899
|
+
401: {
|
|
51900
|
+
headers: {
|
|
51901
|
+
[name: string]: unknown;
|
|
51902
|
+
};
|
|
51903
|
+
content: {
|
|
51904
|
+
"application/json": components["schemas"]["Error"];
|
|
51905
|
+
};
|
|
51906
|
+
};
|
|
51907
|
+
/** @description Forbidden */
|
|
51908
|
+
403: {
|
|
51909
|
+
headers: {
|
|
51910
|
+
[name: string]: unknown;
|
|
51911
|
+
};
|
|
51912
|
+
content: {
|
|
51913
|
+
"application/json": components["schemas"]["Error"];
|
|
51914
|
+
};
|
|
51915
|
+
};
|
|
51916
|
+
/** @description Not found */
|
|
51917
|
+
404: {
|
|
51918
|
+
headers: {
|
|
51919
|
+
[name: string]: unknown;
|
|
51920
|
+
};
|
|
51921
|
+
content: {
|
|
51922
|
+
"application/json": components["schemas"]["Error"];
|
|
51923
|
+
};
|
|
51924
|
+
};
|
|
51925
|
+
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
51926
|
+
409: {
|
|
51927
|
+
headers: {
|
|
51928
|
+
[name: string]: unknown;
|
|
51929
|
+
};
|
|
51930
|
+
content: {
|
|
51931
|
+
"application/json": components["schemas"]["Error"];
|
|
51932
|
+
};
|
|
51933
|
+
};
|
|
51934
|
+
/** @description Rate limited */
|
|
51935
|
+
429: {
|
|
51936
|
+
headers: {
|
|
51937
|
+
[name: string]: unknown;
|
|
51938
|
+
};
|
|
51939
|
+
content: {
|
|
51940
|
+
"application/json": components["schemas"]["Error"];
|
|
51941
|
+
};
|
|
51942
|
+
};
|
|
51943
|
+
};
|
|
51944
|
+
};
|
|
51945
|
+
options?: never;
|
|
51946
|
+
head?: never;
|
|
51947
|
+
patch?: never;
|
|
51948
|
+
trace?: never;
|
|
51949
|
+
};
|
|
51950
|
+
"/contacts/{id}/dealer-documents": {
|
|
51951
|
+
parameters: {
|
|
51952
|
+
query?: never;
|
|
51953
|
+
header?: never;
|
|
51954
|
+
path?: never;
|
|
51955
|
+
cookie?: never;
|
|
51956
|
+
};
|
|
51237
51957
|
/**
|
|
51238
|
-
*
|
|
51239
|
-
* @description
|
|
51958
|
+
* A contact’s dealer documents
|
|
51959
|
+
* @description Automotive workspaces only (any other vertical gets the not-found answer of the vertical gate). Notas de venta where the contact is the buyer, notas de compra where they are the seller, consignments where they are the owner and reservas where they are the client, newest first, voided ones included with `voided: true`. Each row carries `kind`, `id` to open it, `display_id` (the folio; null for a consignment), `date`, `status`, `amount_clp` and `vehicle_ref`. Each kind is returned only if the caller holds the scope of its own list: `sale_notes:read`, `purchase_notes:read`, `consignments:read`, `reservations:read`. `limit` defaults to 50 (max 200); `meta.total` is the number of rows returned.
|
|
51240
51960
|
*/
|
|
51241
|
-
|
|
51961
|
+
get: {
|
|
51242
51962
|
parameters: {
|
|
51243
|
-
query?:
|
|
51963
|
+
query?: {
|
|
51964
|
+
limit?: number;
|
|
51965
|
+
};
|
|
51244
51966
|
header?: never;
|
|
51245
51967
|
path: {
|
|
51246
51968
|
id: string;
|
|
@@ -51249,12 +51971,44 @@ interface paths {
|
|
|
51249
51971
|
};
|
|
51250
51972
|
requestBody?: never;
|
|
51251
51973
|
responses: {
|
|
51252
|
-
/** @description
|
|
51253
|
-
|
|
51974
|
+
/** @description The contact’s dealer documents */
|
|
51975
|
+
200: {
|
|
51254
51976
|
headers: {
|
|
51255
51977
|
[name: string]: unknown;
|
|
51256
51978
|
};
|
|
51257
|
-
content
|
|
51979
|
+
content: {
|
|
51980
|
+
/**
|
|
51981
|
+
* @example {
|
|
51982
|
+
* "data": [
|
|
51983
|
+
* {
|
|
51984
|
+
* "kind": "sale_note",
|
|
51985
|
+
* "id": "5b1f6e0e-2c0a-4d57-9a55-3f2f3a7c9d10",
|
|
51986
|
+
* "display_id": "V-47",
|
|
51987
|
+
* "date": "2026-11-05T15:00:00.000Z",
|
|
51988
|
+
* "status": "approved",
|
|
51989
|
+
* "voided": false,
|
|
51990
|
+
* "amount_clp": 7000000,
|
|
51991
|
+
* "vehicle_ref": {
|
|
51992
|
+
* "id": "0a3c1d52-8a6e-4f0e-b2c1-6d5f2b9e7a11",
|
|
51993
|
+
* "title": "Kia Rio 2019",
|
|
51994
|
+
* "make": "Kia",
|
|
51995
|
+
* "model": "Rio",
|
|
51996
|
+
* "version": null,
|
|
51997
|
+
* "year": 2019,
|
|
51998
|
+
* "registration_number": "KJHG12",
|
|
51999
|
+
* "deleted": false
|
|
52000
|
+
* }
|
|
52001
|
+
* }
|
|
52002
|
+
* ],
|
|
52003
|
+
* "meta": {
|
|
52004
|
+
* "total": 1
|
|
52005
|
+
* }
|
|
52006
|
+
* }
|
|
52007
|
+
*/
|
|
52008
|
+
"application/json": {
|
|
52009
|
+
data: components["schemas"]["ContactDealerDocument"][];
|
|
52010
|
+
};
|
|
52011
|
+
};
|
|
51258
52012
|
};
|
|
51259
52013
|
/** @description Validation error */
|
|
51260
52014
|
400: {
|
|
@@ -51312,6 +52066,9 @@ interface paths {
|
|
|
51312
52066
|
};
|
|
51313
52067
|
};
|
|
51314
52068
|
};
|
|
52069
|
+
put?: never;
|
|
52070
|
+
post?: never;
|
|
52071
|
+
delete?: never;
|
|
51315
52072
|
options?: never;
|
|
51316
52073
|
head?: never;
|
|
51317
52074
|
patch?: never;
|
|
@@ -192484,21 +193241,269 @@ interface paths {
|
|
|
192484
193241
|
delete?: never;
|
|
192485
193242
|
options?: never;
|
|
192486
193243
|
head?: never;
|
|
192487
|
-
patch?: never;
|
|
192488
|
-
trace?: never;
|
|
192489
|
-
};
|
|
192490
|
-
"/consignments/
|
|
192491
|
-
parameters: {
|
|
192492
|
-
query?: never;
|
|
192493
|
-
header?: never;
|
|
192494
|
-
path?: never;
|
|
192495
|
-
cookie?: never;
|
|
192496
|
-
};
|
|
193244
|
+
patch?: never;
|
|
193245
|
+
trace?: never;
|
|
193246
|
+
};
|
|
193247
|
+
"/consignments/terms/last": {
|
|
193248
|
+
parameters: {
|
|
193249
|
+
query?: never;
|
|
193250
|
+
header?: never;
|
|
193251
|
+
path?: never;
|
|
193252
|
+
cookie?: never;
|
|
193253
|
+
};
|
|
193254
|
+
/**
|
|
193255
|
+
* The workspace’s last consignment terms
|
|
193256
|
+
* @description What a new consignment form arrives with (app#8134): the commission of the most recent contract created in this workspace that states a commission or a Comisión mínima, whatever its estado (a returned, settled or expired contract counts; a consignment has no voided state; a contract with neither is skipped). Not a setting: nothing is stored, the last contract is the memory.
|
|
193257
|
+
*
|
|
193258
|
+
* `data` is `null` when the workspace has no such contract (200, never an error). Otherwise `{ consignment_contract_id, created_at, comision_type, comision_value, comision_mas_iva, comision_minima_clp, comision_minima_mas_iva }`: `comision_value` is percentage points (5 = 5 %) for `percentage` and whole CLP for `fixed`; `comision_type`/`comision_value` are both null when only a minimum was agreed. Precio cliente, plazo, cobro por retiro anticipado and observaciones are per car and are not returned.
|
|
193259
|
+
*/
|
|
193260
|
+
get: {
|
|
193261
|
+
parameters: {
|
|
193262
|
+
query?: never;
|
|
193263
|
+
header?: never;
|
|
193264
|
+
path?: never;
|
|
193265
|
+
cookie?: never;
|
|
193266
|
+
};
|
|
193267
|
+
requestBody?: never;
|
|
193268
|
+
responses: {
|
|
193269
|
+
/** @description The last terms, or null */
|
|
193270
|
+
200: {
|
|
193271
|
+
headers: {
|
|
193272
|
+
[name: string]: unknown;
|
|
193273
|
+
};
|
|
193274
|
+
content: {
|
|
193275
|
+
/**
|
|
193276
|
+
* @example {
|
|
193277
|
+
* "data": {
|
|
193278
|
+
* "consignment_contract_id": "d7d7d7d7-0000-4000-8000-000000000001",
|
|
193279
|
+
* "created_at": "2026-11-20T15:04:05.000Z",
|
|
193280
|
+
* "comision_type": "percentage",
|
|
193281
|
+
* "comision_value": 5,
|
|
193282
|
+
* "comision_mas_iva": true,
|
|
193283
|
+
* "comision_minima_clp": 500000,
|
|
193284
|
+
* "comision_minima_mas_iva": true
|
|
193285
|
+
* }
|
|
193286
|
+
* }
|
|
193287
|
+
*/
|
|
193288
|
+
"application/json": {
|
|
193289
|
+
data: components["schemas"]["LastConsignmentTerms"];
|
|
193290
|
+
};
|
|
193291
|
+
};
|
|
193292
|
+
};
|
|
193293
|
+
/** @description Validation error */
|
|
193294
|
+
400: {
|
|
193295
|
+
headers: {
|
|
193296
|
+
[name: string]: unknown;
|
|
193297
|
+
};
|
|
193298
|
+
content: {
|
|
193299
|
+
"application/json": components["schemas"]["Error"];
|
|
193300
|
+
};
|
|
193301
|
+
};
|
|
193302
|
+
/** @description Unauthorized */
|
|
193303
|
+
401: {
|
|
193304
|
+
headers: {
|
|
193305
|
+
[name: string]: unknown;
|
|
193306
|
+
};
|
|
193307
|
+
content: {
|
|
193308
|
+
"application/json": components["schemas"]["Error"];
|
|
193309
|
+
};
|
|
193310
|
+
};
|
|
193311
|
+
/** @description Forbidden */
|
|
193312
|
+
403: {
|
|
193313
|
+
headers: {
|
|
193314
|
+
[name: string]: unknown;
|
|
193315
|
+
};
|
|
193316
|
+
content: {
|
|
193317
|
+
"application/json": components["schemas"]["Error"];
|
|
193318
|
+
};
|
|
193319
|
+
};
|
|
193320
|
+
/** @description Not found */
|
|
193321
|
+
404: {
|
|
193322
|
+
headers: {
|
|
193323
|
+
[name: string]: unknown;
|
|
193324
|
+
};
|
|
193325
|
+
content: {
|
|
193326
|
+
"application/json": components["schemas"]["Error"];
|
|
193327
|
+
};
|
|
193328
|
+
};
|
|
193329
|
+
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
193330
|
+
409: {
|
|
193331
|
+
headers: {
|
|
193332
|
+
[name: string]: unknown;
|
|
193333
|
+
};
|
|
193334
|
+
content: {
|
|
193335
|
+
"application/json": components["schemas"]["Error"];
|
|
193336
|
+
};
|
|
193337
|
+
};
|
|
193338
|
+
/** @description Rate limited */
|
|
193339
|
+
429: {
|
|
193340
|
+
headers: {
|
|
193341
|
+
[name: string]: unknown;
|
|
193342
|
+
};
|
|
193343
|
+
content: {
|
|
193344
|
+
"application/json": components["schemas"]["Error"];
|
|
193345
|
+
};
|
|
193346
|
+
};
|
|
193347
|
+
};
|
|
193348
|
+
};
|
|
193349
|
+
put?: never;
|
|
193350
|
+
post?: never;
|
|
193351
|
+
delete?: never;
|
|
193352
|
+
options?: never;
|
|
193353
|
+
head?: never;
|
|
193354
|
+
patch?: never;
|
|
193355
|
+
trace?: never;
|
|
193356
|
+
};
|
|
193357
|
+
"/consignments/{id}": {
|
|
193358
|
+
parameters: {
|
|
193359
|
+
query?: never;
|
|
193360
|
+
header?: never;
|
|
193361
|
+
path?: never;
|
|
193362
|
+
cookie?: never;
|
|
193363
|
+
};
|
|
193364
|
+
/**
|
|
193365
|
+
* Fetch one contract
|
|
193366
|
+
* @description The contract as stored, whatever its state, plus two read-only additions (app#8132). `worked_example`: `null`, or `{ sale_price_clp, owner_amount_clp }` at the car’s price, computed with the liquidación’s own formula (the higher of the percentage and the Comisión mínima, each with its own «más IVA»); `null` when the car has no price or the contract has neither commission nor minimum, exactly as the printed sentence. `sale_note`: `null`, or `{ id, display_id, status }` of the sale that closed the car (live approved nota de venta; `null` while there is none). `owner_payment`: `null` with no closed sale, otherwise what is owed to the owner, the same block as `owner_payment` on `GET /sale-notes/{id}` (`settled`, `estimated_amount_clp` or `amount_paid_clp`, `paid_at`, `paid_at_stated`, `liquidacion_id`, the owner). The same three fields sit on `data.consignment` of `POST /consignments/take`.
|
|
193367
|
+
*/
|
|
193368
|
+
get: {
|
|
193369
|
+
parameters: {
|
|
193370
|
+
query?: never;
|
|
193371
|
+
header?: never;
|
|
193372
|
+
path: {
|
|
193373
|
+
id: string;
|
|
193374
|
+
};
|
|
193375
|
+
cookie?: never;
|
|
193376
|
+
};
|
|
193377
|
+
requestBody?: never;
|
|
193378
|
+
responses: {
|
|
193379
|
+
/** @description The contract */
|
|
193380
|
+
200: {
|
|
193381
|
+
headers: {
|
|
193382
|
+
[name: string]: unknown;
|
|
193383
|
+
};
|
|
193384
|
+
content: {
|
|
193385
|
+
/**
|
|
193386
|
+
* @example {
|
|
193387
|
+
* "data": {
|
|
193388
|
+
* "id": "d7d7d7d7-0000-4000-8000-000000000001",
|
|
193389
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
193390
|
+
* "vehicle_id": "e1e1e1e1-0000-4000-8000-000000000001",
|
|
193391
|
+
* "dueno_contact_id": "22222222-0000-4000-8000-000000000004",
|
|
193392
|
+
* "modalidad": "en_local",
|
|
193393
|
+
* "contract_structure": "mandato_con_representacion",
|
|
193394
|
+
* "comision_type": "percentage",
|
|
193395
|
+
* "comision_value": 10,
|
|
193396
|
+
* "comision_mas_iva": true,
|
|
193397
|
+
* "comision_minima_clp": 500000,
|
|
193398
|
+
* "comision_minima_mas_iva": true,
|
|
193399
|
+
* "cobro_retiro_anticipado_clp": null,
|
|
193400
|
+
* "minimo_clp": 8000000,
|
|
193401
|
+
* "precio_cliente_clp": 8000000,
|
|
193402
|
+
* "vencimiento": "2026-12-31",
|
|
193403
|
+
* "estado": "activo",
|
|
193404
|
+
* "vencimiento_reminded_at": null,
|
|
193405
|
+
* "liquidacion_due_notified_at": null,
|
|
193406
|
+
* "created_at": "2026-08-20T10:00:00.000Z",
|
|
193407
|
+
* "updated_at": "2026-08-20T10:00:00.000Z",
|
|
193408
|
+
* "sale_iva_regime": "exento",
|
|
193409
|
+
* "notes": null,
|
|
193410
|
+
* "observaciones": "Se entrega con dos llaves.",
|
|
193411
|
+
* "returned_at": null,
|
|
193412
|
+
* "return_deactivated_vehicle": null,
|
|
193413
|
+
* "not_on_lot": false,
|
|
193414
|
+
* "worked_example": {
|
|
193415
|
+
* "sale_price_clp": 8990000,
|
|
193416
|
+
* "owner_amount_clp": 7920190
|
|
193417
|
+
* },
|
|
193418
|
+
* "sale_note": null,
|
|
193419
|
+
* "owner_payment": null
|
|
193420
|
+
* }
|
|
193421
|
+
* }
|
|
193422
|
+
*/
|
|
193423
|
+
"application/json": {
|
|
193424
|
+
data?: unknown;
|
|
193425
|
+
meta?: {
|
|
193426
|
+
[key: string]: unknown;
|
|
193427
|
+
};
|
|
193428
|
+
};
|
|
193429
|
+
};
|
|
193430
|
+
};
|
|
193431
|
+
/** @description Validation error */
|
|
193432
|
+
400: {
|
|
193433
|
+
headers: {
|
|
193434
|
+
[name: string]: unknown;
|
|
193435
|
+
};
|
|
193436
|
+
content: {
|
|
193437
|
+
"application/json": components["schemas"]["Error"];
|
|
193438
|
+
};
|
|
193439
|
+
};
|
|
193440
|
+
/** @description Unauthorized */
|
|
193441
|
+
401: {
|
|
193442
|
+
headers: {
|
|
193443
|
+
[name: string]: unknown;
|
|
193444
|
+
};
|
|
193445
|
+
content: {
|
|
193446
|
+
"application/json": components["schemas"]["Error"];
|
|
193447
|
+
};
|
|
193448
|
+
};
|
|
193449
|
+
/** @description Forbidden */
|
|
193450
|
+
403: {
|
|
193451
|
+
headers: {
|
|
193452
|
+
[name: string]: unknown;
|
|
193453
|
+
};
|
|
193454
|
+
content: {
|
|
193455
|
+
"application/json": components["schemas"]["Error"];
|
|
193456
|
+
};
|
|
193457
|
+
};
|
|
193458
|
+
/** @description Not found */
|
|
193459
|
+
404: {
|
|
193460
|
+
headers: {
|
|
193461
|
+
[name: string]: unknown;
|
|
193462
|
+
};
|
|
193463
|
+
content: {
|
|
193464
|
+
"application/json": components["schemas"]["Error"];
|
|
193465
|
+
};
|
|
193466
|
+
};
|
|
193467
|
+
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
193468
|
+
409: {
|
|
193469
|
+
headers: {
|
|
193470
|
+
[name: string]: unknown;
|
|
193471
|
+
};
|
|
193472
|
+
content: {
|
|
193473
|
+
"application/json": components["schemas"]["Error"];
|
|
193474
|
+
};
|
|
193475
|
+
};
|
|
193476
|
+
/** @description Rate limited */
|
|
193477
|
+
429: {
|
|
193478
|
+
headers: {
|
|
193479
|
+
[name: string]: unknown;
|
|
193480
|
+
};
|
|
193481
|
+
content: {
|
|
193482
|
+
"application/json": components["schemas"]["Error"];
|
|
193483
|
+
};
|
|
193484
|
+
};
|
|
193485
|
+
};
|
|
193486
|
+
};
|
|
193487
|
+
put?: never;
|
|
193488
|
+
post?: never;
|
|
193489
|
+
delete?: never;
|
|
193490
|
+
options?: never;
|
|
193491
|
+
head?: never;
|
|
192497
193492
|
/**
|
|
192498
|
-
*
|
|
192499
|
-
* @description
|
|
193493
|
+
* Update a contract
|
|
193494
|
+
* @description Edits the terms, and can move `estado` — except to `vendido`, which is a **409** directing you to the sell action, so a sale can never be recorded without producing its Liquidación. Other transitions are checked against the state machine and an illegal one is also a 409.
|
|
193495
|
+
*
|
|
193496
|
+
* `estado: "devuelto"` is the return (`POST /consignments/{id}/return`, same effects): an active car is set inactive in the same transaction, and the 200 carries `return_outcome` and `cancelled_visits`.
|
|
193497
|
+
*
|
|
193498
|
+
* Moving `vencimiento` RE-ARMS the expiry reminder: the "already reminded" stamp is cleared, so a pushed-out date produces a fresh nudge rather than staying silent.
|
|
193499
|
+
*
|
|
193500
|
+
* Supplying `minimo_clp` RENEGOTIATES the mínimo rather than editing a column: it appends an immutable revision to the contract’s terms history (`GET /consignments/{id}/terms`), dated `minimo_effective_on` or today. `precio_cliente_clp` is the same field under its new name. Sending the value already governing, with no `minimo_effective_on`, is a no-op (a form may resend every field). A different value on a date that already has a revision, today or later, CORRECTS it (app#7704): that revision is marked replaced and the new value governs the same date, so the date keeps one revision with the last value (the audit row keeps the previous one). A date already past is never rewritten: a second revision there is a **409**.
|
|
193501
|
+
*
|
|
193502
|
+
* A raised Precio cliente writes through to the vehicle’s floor while the contract is active. Withdrawing it (null) clears the floor only while the floor still holds the withdrawn price, so a floor the dealer set by hand is kept; the contract ending never clears it.
|
|
193503
|
+
*
|
|
193504
|
+
* `comision_minima_clp`, `comision_minima_mas_iva`, `cobro_retiro_anticipado_clp` and `observaciones` are plain edits (null clears).
|
|
192500
193505
|
*/
|
|
192501
|
-
|
|
193506
|
+
patch: {
|
|
192502
193507
|
parameters: {
|
|
192503
193508
|
query?: never;
|
|
192504
193509
|
header?: never;
|
|
@@ -192507,9 +193512,42 @@ interface paths {
|
|
|
192507
193512
|
};
|
|
192508
193513
|
cookie?: never;
|
|
192509
193514
|
};
|
|
192510
|
-
requestBody?:
|
|
193515
|
+
requestBody?: {
|
|
193516
|
+
content: {
|
|
193517
|
+
/**
|
|
193518
|
+
* @example {
|
|
193519
|
+
* "precio_cliente_clp": 8300000
|
|
193520
|
+
* }
|
|
193521
|
+
*/
|
|
193522
|
+
"application/json": {
|
|
193523
|
+
/** Format: uuid */
|
|
193524
|
+
dueno_contact_id?: string;
|
|
193525
|
+
/** @enum {string} */
|
|
193526
|
+
modalidad?: "en_local" | "virtual";
|
|
193527
|
+
/** @enum {string} */
|
|
193528
|
+
comision_type?: "percentage" | "fixed";
|
|
193529
|
+
comision_value?: number;
|
|
193530
|
+
comision_mas_iva?: boolean;
|
|
193531
|
+
minimo_clp?: number | null;
|
|
193532
|
+
minimo_effective_on?: string;
|
|
193533
|
+
vencimiento?: string | null;
|
|
193534
|
+
/** @enum {string} */
|
|
193535
|
+
estado?: "activo" | "vendido" | "devuelto" | "vencido";
|
|
193536
|
+
/** @enum {string|null} */
|
|
193537
|
+
sale_iva_regime?: "afecto" | "exento" | null;
|
|
193538
|
+
/** @description Internal free-text notes. Never printed on the document. Blank clears them. */
|
|
193539
|
+
notes?: string | null;
|
|
193540
|
+
precio_cliente_clp?: number | null;
|
|
193541
|
+
comision_minima_clp?: number | null;
|
|
193542
|
+
comision_minima_mas_iva?: boolean;
|
|
193543
|
+
cobro_retiro_anticipado_clp?: number | null;
|
|
193544
|
+
/** @description Internal free-text notes. Never printed on the document. Blank clears them. */
|
|
193545
|
+
observaciones?: string | null;
|
|
193546
|
+
};
|
|
193547
|
+
};
|
|
193548
|
+
};
|
|
192511
193549
|
responses: {
|
|
192512
|
-
/** @description The contract */
|
|
193550
|
+
/** @description The updated contract. With `estado: devuelto` it is a return and also carries `return_outcome` and, when the car was set inactive, `cancelled_visits`. */
|
|
192513
193551
|
200: {
|
|
192514
193552
|
headers: {
|
|
192515
193553
|
[name: string]: unknown;
|
|
@@ -192530,8 +193568,8 @@ interface paths {
|
|
|
192530
193568
|
* "comision_minima_clp": 500000,
|
|
192531
193569
|
* "comision_minima_mas_iva": true,
|
|
192532
193570
|
* "cobro_retiro_anticipado_clp": null,
|
|
192533
|
-
* "minimo_clp":
|
|
192534
|
-
* "precio_cliente_clp":
|
|
193571
|
+
* "minimo_clp": 8300000,
|
|
193572
|
+
* "precio_cliente_clp": 8300000,
|
|
192535
193573
|
* "vencimiento": "2026-12-31",
|
|
192536
193574
|
* "estado": "activo",
|
|
192537
193575
|
* "vencimiento_reminded_at": null,
|
|
@@ -192548,7 +193586,24 @@ interface paths {
|
|
|
192548
193586
|
* }
|
|
192549
193587
|
*/
|
|
192550
193588
|
"application/json": {
|
|
192551
|
-
data
|
|
193589
|
+
data: {
|
|
193590
|
+
/** @description When the return wrote `devuelto`. `null` on a contract that is not returned, and on an early withdrawal. */
|
|
193591
|
+
returned_at: string | null;
|
|
193592
|
+
/** @description `true` = this return set the car inactive; `false` = the car was already inactive; `null` = not recorded. */
|
|
193593
|
+
return_deactivated_vehicle: boolean | null;
|
|
193594
|
+
/** @description Present when this call returned the car: whether it set the car inactive, whether Cierre de avisos was queued, and one neutral Spanish sentence. */
|
|
193595
|
+
return_outcome?: {
|
|
193596
|
+
/** Format: uuid */
|
|
193597
|
+
vehicle_id: string;
|
|
193598
|
+
vehicle_deactivated: boolean;
|
|
193599
|
+
vehicle_was_inactive: boolean;
|
|
193600
|
+
ads_closing: boolean;
|
|
193601
|
+
message: string;
|
|
193602
|
+
};
|
|
193603
|
+
cancelled_visits?: components["schemas"]["CancelledVisits"] & unknown;
|
|
193604
|
+
} & {
|
|
193605
|
+
[key: string]: unknown;
|
|
193606
|
+
};
|
|
192552
193607
|
meta?: {
|
|
192553
193608
|
[key: string]: unknown;
|
|
192554
193609
|
};
|
|
@@ -192611,71 +193666,109 @@ interface paths {
|
|
|
192611
193666
|
};
|
|
192612
193667
|
};
|
|
192613
193668
|
};
|
|
193669
|
+
trace?: never;
|
|
193670
|
+
};
|
|
193671
|
+
"/consignments/take": {
|
|
193672
|
+
parameters: {
|
|
193673
|
+
query?: never;
|
|
193674
|
+
header?: never;
|
|
193675
|
+
path?: never;
|
|
193676
|
+
cookie?: never;
|
|
193677
|
+
};
|
|
193678
|
+
get?: never;
|
|
192614
193679
|
put?: never;
|
|
192615
|
-
post?: never;
|
|
192616
|
-
delete?: never;
|
|
192617
|
-
options?: never;
|
|
192618
|
-
head?: never;
|
|
192619
193680
|
/**
|
|
192620
|
-
*
|
|
192621
|
-
* @description
|
|
193681
|
+
* Take a car in consignment in one call
|
|
193682
|
+
* @description «Guardar e imprimir contrato» (app#8133, ADR 0166 decision 2): the car, the owner and the consignment are saved together, or nothing is; then the contract is printed.
|
|
192622
193683
|
*
|
|
192623
|
-
* `
|
|
193684
|
+
* **The car:** `vehicle_id` (a car already in Stock) OR `vehicle` with the five facts of «Agregar vehículo» (`registration_number`, `make`, `model`, `year`, `price_amount`; `vehicle_type` defaults to `auto`). A new car is created exactly as `POST /vehicles` creates it (plate stored clean, same plate checks) and needs `marketplace:write`.
|
|
192624
193685
|
*
|
|
192625
|
-
*
|
|
193686
|
+
* **The owner:** `owner_contact_id` OR `owner` with a `name` and, optionally, `tax_id`, `phone`, `address_street` (with `comuna_code`) and `comuna_code`. A new owner is created as `POST /contacts` creates it and needs `contacts:write`.
|
|
192626
193687
|
*
|
|
192627
|
-
*
|
|
193688
|
+
* **The terms:** at the top level, exactly as `POST /consignments` takes them; `modalidad` defaults to `en_local`. `generate_contract` (default true) prints the contract after saving.
|
|
192628
193689
|
*
|
|
192629
|
-
* A
|
|
193690
|
+
* **All or nothing.** A refusal (a plate already in Stock, a car already consigned, a RUT that belongs to another contact, and with `generate_contract` a car with no patente or an owner with no name) saves nothing and answers with `error.field_errors` keyed by the request’s dot paths (`vehicle.registration_number`, `owner.tax_id`, `vehicle_id`, `owner_contact_id`, `comision_value`, …). The same webhooks as the separate calls fire once, after the commit (`vehicle.created`, `contact.created`, `consignment.created`).
|
|
192630
193691
|
*
|
|
192631
|
-
* `
|
|
193692
|
+
* **The contract** (`data.contract`): `status: ready` with `document` (the same artefact `GET /consignments/{id}/contract` lists) and `pdf_path` (`GET /consignments/{id}/contract/pdf`); `status: pending` when the car and the consignment were saved but the contract could not be printed for a reason of the dealership’s own (`pending.reason`: `house_legal_data_missing` with the fields in `pending.missing_fields`, `automotora_identity_ambiguous`, `consignment_template_wording`, `contract_not_issued`), printable later with `POST /consignments/{id}/contract`; `status: not_requested` with `generate_contract: false`. A consignment whose contract printed here counts as emitted for the sale (ADR 0114 §5). Answers 201.
|
|
192632
193693
|
*/
|
|
192633
|
-
|
|
193694
|
+
post: {
|
|
192634
193695
|
parameters: {
|
|
192635
193696
|
query?: never;
|
|
192636
|
-
header?:
|
|
192637
|
-
|
|
192638
|
-
|
|
193697
|
+
header?: {
|
|
193698
|
+
/** @description Replay-safe retries: resending the SAME key with the SAME body returns the original response (`X-Idempotent-Replay: 1`) instead of creating a second copy — safe to send whenever a response might not have arrived. The same key with a DIFFERENT body answers `409 IDEMPOTENCY_KEY_CONFLICT`; use a fresh key per operation. */
|
|
193699
|
+
"Idempotency-Key"?: string;
|
|
192639
193700
|
};
|
|
193701
|
+
path?: never;
|
|
192640
193702
|
cookie?: never;
|
|
192641
193703
|
};
|
|
192642
193704
|
requestBody?: {
|
|
192643
193705
|
content: {
|
|
192644
193706
|
/**
|
|
192645
193707
|
* @example {
|
|
192646
|
-
* "
|
|
193708
|
+
* "vehicle": {
|
|
193709
|
+
* "registration_number": "kztl-12",
|
|
193710
|
+
* "make": "Toyota",
|
|
193711
|
+
* "model": "Yaris",
|
|
193712
|
+
* "year": 2019,
|
|
193713
|
+
* "price_amount": 8990000
|
|
193714
|
+
* },
|
|
193715
|
+
* "owner": {
|
|
193716
|
+
* "name": "Rosa Pérez"
|
|
193717
|
+
* },
|
|
193718
|
+
* "comision_type": "percentage",
|
|
193719
|
+
* "comision_value": 5,
|
|
193720
|
+
* "comision_mas_iva": true,
|
|
193721
|
+
* "comision_minima_clp": 500000,
|
|
193722
|
+
* "comision_minima_mas_iva": true
|
|
192647
193723
|
* }
|
|
192648
193724
|
*/
|
|
192649
193725
|
"application/json": {
|
|
192650
|
-
/**
|
|
192651
|
-
|
|
192652
|
-
|
|
193726
|
+
/**
|
|
193727
|
+
* Format: uuid
|
|
193728
|
+
* @description Un auto que ya está en Stock. Uno de `vehicle_id` o `vehicle`.
|
|
193729
|
+
*/
|
|
193730
|
+
vehicle_id?: string;
|
|
193731
|
+
vehicle?: components["schemas"]["TakeConsignmentVehicle"];
|
|
193732
|
+
/**
|
|
193733
|
+
* Format: uuid
|
|
193734
|
+
* @description Un contacto que ya existe como dueño. Uno de `owner_contact_id` o `owner`.
|
|
193735
|
+
*/
|
|
193736
|
+
owner_contact_id?: string;
|
|
193737
|
+
owner?: components["schemas"]["TakeConsignmentOwner"];
|
|
193738
|
+
/**
|
|
193739
|
+
* @description Dónde está el auto. Por defecto `en_local`.
|
|
193740
|
+
* @enum {string}
|
|
193741
|
+
*/
|
|
192653
193742
|
modalidad?: "en_local" | "virtual";
|
|
192654
|
-
/** @enum {string} */
|
|
192655
|
-
comision_type?: "percentage" | "fixed";
|
|
192656
|
-
comision_value?: number;
|
|
193743
|
+
/** @enum {string|null} */
|
|
193744
|
+
comision_type?: "percentage" | "fixed" | null;
|
|
193745
|
+
comision_value?: number | null;
|
|
192657
193746
|
comision_mas_iva?: boolean;
|
|
192658
193747
|
minimo_clp?: number | null;
|
|
192659
193748
|
minimo_effective_on?: string;
|
|
192660
193749
|
vencimiento?: string | null;
|
|
192661
|
-
/** @enum {string} */
|
|
192662
|
-
estado?: "activo" | "vendido" | "devuelto" | "vencido";
|
|
192663
193750
|
/** @enum {string|null} */
|
|
192664
193751
|
sale_iva_regime?: "afecto" | "exento" | null;
|
|
192665
193752
|
/** @description Internal free-text notes. Never printed on the document. Blank clears them. */
|
|
192666
193753
|
notes?: string | null;
|
|
193754
|
+
/** @description Precio cliente: lo que el dueño espera recibir por el auto, en pesos. Opcional: vacío, el contrato no menciona precio del dueño y la venta no tiene piso. Mismo dato que `minimo_clp` (nombre anterior, que se sigue aceptando); si se envían ambos deben coincidir. Cuando existe es el piso del vigilante de precios del auto. */
|
|
192667
193755
|
precio_cliente_clp?: number | null;
|
|
193756
|
+
/** @description Comisión mínima en pesos. La comisión de una venta es la mayor entre el porcentaje y este mínimo. No es un piso del precio de venta. */
|
|
192668
193757
|
comision_minima_clp?: number | null;
|
|
193758
|
+
/** @description «más IVA» de la Comisión mínima, aparte del de la comisión porcentual. Por defecto true. */
|
|
192669
193759
|
comision_minima_mas_iva?: boolean;
|
|
193760
|
+
/** @description Cobro por retiro anticipado en pesos: lo que paga el dueño si retira el auto antes de la venta. Se imprime en el contrato. */
|
|
192670
193761
|
cobro_retiro_anticipado_clp?: number | null;
|
|
192671
|
-
/** @description
|
|
193762
|
+
/** @description Observaciones que se imprimen en el contrato. Distintas de `notes`, que es interno y no se imprime. */
|
|
192672
193763
|
observaciones?: string | null;
|
|
193764
|
+
/** @description Imprimir el contrato al guardar. Por defecto true. */
|
|
193765
|
+
generate_contract?: boolean;
|
|
192673
193766
|
};
|
|
192674
193767
|
};
|
|
192675
193768
|
};
|
|
192676
193769
|
responses: {
|
|
192677
|
-
/** @description The
|
|
192678
|
-
|
|
193770
|
+
/** @description The car, the owner, the consignment and the contract */
|
|
193771
|
+
201: {
|
|
192679
193772
|
headers: {
|
|
192680
193773
|
[name: string]: unknown;
|
|
192681
193774
|
};
|
|
@@ -192683,57 +193776,148 @@ interface paths {
|
|
|
192683
193776
|
/**
|
|
192684
193777
|
* @example {
|
|
192685
193778
|
* "data": {
|
|
192686
|
-
* "
|
|
192687
|
-
*
|
|
192688
|
-
*
|
|
192689
|
-
*
|
|
192690
|
-
*
|
|
192691
|
-
*
|
|
192692
|
-
*
|
|
192693
|
-
*
|
|
192694
|
-
*
|
|
192695
|
-
*
|
|
192696
|
-
*
|
|
192697
|
-
*
|
|
192698
|
-
*
|
|
192699
|
-
*
|
|
192700
|
-
*
|
|
192701
|
-
*
|
|
192702
|
-
*
|
|
192703
|
-
*
|
|
192704
|
-
*
|
|
192705
|
-
*
|
|
192706
|
-
*
|
|
192707
|
-
*
|
|
192708
|
-
*
|
|
192709
|
-
*
|
|
192710
|
-
*
|
|
192711
|
-
*
|
|
193779
|
+
* "vehicle": {
|
|
193780
|
+
* "id": "e1e1e1e1-0000-4000-8000-000000000001",
|
|
193781
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
193782
|
+
* "origin_integration_id": null,
|
|
193783
|
+
* "source": "manual",
|
|
193784
|
+
* "make": "Toyota",
|
|
193785
|
+
* "model": "Yaris",
|
|
193786
|
+
* "version": "1.8 XEI CVT",
|
|
193787
|
+
* "year": 2019,
|
|
193788
|
+
* "title": null,
|
|
193789
|
+
* "short_title": null,
|
|
193790
|
+
* "price_amount": 8990000,
|
|
193791
|
+
* "price_clp": 13990000,
|
|
193792
|
+
* "watch_enabled": false,
|
|
193793
|
+
* "floor_price_clp": null,
|
|
193794
|
+
* "target_position": null,
|
|
193795
|
+
* "abono_amount_clp": 300000,
|
|
193796
|
+
* "merged_into": null,
|
|
193797
|
+
* "deleted_at": null,
|
|
193798
|
+
* "price_currency": "CLP",
|
|
193799
|
+
* "odometer_value": 42500,
|
|
193800
|
+
* "odometer_unit": "KM",
|
|
193801
|
+
* "fuel_type": "Bencina",
|
|
193802
|
+
* "gear_type": "Automática",
|
|
193803
|
+
* "body_style": "Sedán",
|
|
193804
|
+
* "color": "Gris",
|
|
193805
|
+
* "doors": 4,
|
|
193806
|
+
* "registration_number": "KZTL12",
|
|
193807
|
+
* "vin": "9BWZZZ377NP004512",
|
|
193808
|
+
* "plate_normalized": "FGXY21",
|
|
193809
|
+
* "listing_type": "Usado",
|
|
193810
|
+
* "record_type": null,
|
|
193811
|
+
* "type": "Car",
|
|
193812
|
+
* "merch_label": null,
|
|
193813
|
+
* "featured_at": null,
|
|
193814
|
+
* "vehicle_type": "auto",
|
|
193815
|
+
* "sale_status": null,
|
|
193816
|
+
* "status": "disponible",
|
|
193817
|
+
* "reserved_at": null,
|
|
193818
|
+
* "reserved_by_name": null,
|
|
193819
|
+
* "sold_at": null,
|
|
193820
|
+
* "location_id": "b1b1b1b1-0000-4000-8000-000000000001",
|
|
193821
|
+
* "estacionamiento": null,
|
|
193822
|
+
* "description": "Mantenimientos al día en concesionario.",
|
|
193823
|
+
* "photos": [
|
|
193824
|
+
* {
|
|
193825
|
+
* "url": "https://images.example.cl/corolla-2022-1.jpg",
|
|
193826
|
+
* "order": 0
|
|
193827
|
+
* }
|
|
193828
|
+
* ],
|
|
193829
|
+
* "attributes": {},
|
|
193830
|
+
* "tags": [],
|
|
193831
|
+
* "searchable_text": "toyota corolla 1.8 xei cvt sedán bencina automática gris 2022",
|
|
193832
|
+
* "active": true,
|
|
193833
|
+
* "protected_fields": [],
|
|
193834
|
+
* "deactivated_by": null,
|
|
193835
|
+
* "tenencia": "consignacion",
|
|
193836
|
+
* "tenencia_source": "default",
|
|
193837
|
+
* "tenencia_declared_by": null,
|
|
193838
|
+
* "tenencia_declared_at": null,
|
|
193839
|
+
* "not_dealership_owned": false,
|
|
193840
|
+
* "not_dealership_owned_at": null,
|
|
193841
|
+
* "not_dealership_owned_by": null,
|
|
193842
|
+
* "iva_regime": null,
|
|
193843
|
+
* "keys_count": null,
|
|
193844
|
+
* "municipalidad_comuna_code": null,
|
|
193845
|
+
* "last_service_date": null,
|
|
193846
|
+
* "service_odometer_km": null,
|
|
193847
|
+
* "published_at": null,
|
|
193848
|
+
* "last_seen_at": null,
|
|
193849
|
+
* "created_at": "2026-09-15T18:34:48.575Z",
|
|
193850
|
+
* "updated_at": "2026-09-15T18:34:48.575Z",
|
|
193851
|
+
* "live_sale_note": null,
|
|
193852
|
+
* "active_reservation": null,
|
|
193853
|
+
* "sin_costo": true,
|
|
193854
|
+
* "not_on_lot": false
|
|
193855
|
+
* },
|
|
193856
|
+
* "vehicle_created": true,
|
|
193857
|
+
* "plate_released_from": [],
|
|
193858
|
+
* "owner": {
|
|
193859
|
+
* "id": "22222222-0000-4000-8000-000000000004",
|
|
193860
|
+
* "name": "Rosa Pérez"
|
|
193861
|
+
* },
|
|
193862
|
+
* "owner_created": true,
|
|
193863
|
+
* "consignment": {
|
|
193864
|
+
* "id": "d7d7d7d7-0000-4000-8000-000000000001",
|
|
193865
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
193866
|
+
* "vehicle_id": "e1e1e1e1-0000-4000-8000-000000000001",
|
|
193867
|
+
* "dueno_contact_id": "22222222-0000-4000-8000-000000000004",
|
|
193868
|
+
* "modalidad": "en_local",
|
|
193869
|
+
* "contract_structure": "mandato_con_representacion",
|
|
193870
|
+
* "comision_type": "percentage",
|
|
193871
|
+
* "comision_value": 5,
|
|
193872
|
+
* "comision_mas_iva": true,
|
|
193873
|
+
* "comision_minima_clp": 500000,
|
|
193874
|
+
* "comision_minima_mas_iva": true,
|
|
193875
|
+
* "cobro_retiro_anticipado_clp": null,
|
|
193876
|
+
* "minimo_clp": null,
|
|
193877
|
+
* "precio_cliente_clp": null,
|
|
193878
|
+
* "vencimiento": null,
|
|
193879
|
+
* "estado": "activo",
|
|
193880
|
+
* "vencimiento_reminded_at": null,
|
|
193881
|
+
* "liquidacion_due_notified_at": null,
|
|
193882
|
+
* "created_at": "2026-08-20T10:00:00.000Z",
|
|
193883
|
+
* "updated_at": "2026-08-20T10:00:00.000Z",
|
|
193884
|
+
* "sale_iva_regime": "exento",
|
|
193885
|
+
* "notes": null,
|
|
193886
|
+
* "observaciones": null,
|
|
193887
|
+
* "returned_at": null,
|
|
193888
|
+
* "return_deactivated_vehicle": null,
|
|
193889
|
+
* "not_on_lot": false,
|
|
193890
|
+
* "worked_example": {
|
|
193891
|
+
* "sale_price_clp": 8990000,
|
|
193892
|
+
* "owner_amount_clp": 8395000
|
|
193893
|
+
* },
|
|
193894
|
+
* "sale_note": null,
|
|
193895
|
+
* "owner_payment": null
|
|
193896
|
+
* },
|
|
193897
|
+
* "contract": {
|
|
193898
|
+
* "status": "ready",
|
|
193899
|
+
* "document": {
|
|
193900
|
+
* "id": "ddddddd0-0000-4000-8000-000000000001",
|
|
193901
|
+
* "subject_kind": "consignment_contract",
|
|
193902
|
+
* "subject_id": "d7d7d7d7-0000-4000-8000-000000000001",
|
|
193903
|
+
* "template_key": "mandato-de-consignacion",
|
|
193904
|
+
* "template_version": "mandato-de-consignacion-estandar",
|
|
193905
|
+
* "terms_version": 1,
|
|
193906
|
+
* "sha256": "9f2c4e1a7b3d5f6081a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708",
|
|
193907
|
+
* "byte_size": 41872,
|
|
193908
|
+
* "rendered_at": "2026-09-19T15:10:00.000Z",
|
|
193909
|
+
* "rendered_by": "11111111-0000-4000-8000-000000000001",
|
|
193910
|
+
* "supersedes_id": null,
|
|
193911
|
+
* "superseded_by_id": null
|
|
193912
|
+
* },
|
|
193913
|
+
* "pending": null,
|
|
193914
|
+
* "pdf_path": "/api/v1/consignments/d7d7d7d7-0000-4000-8000-000000000001/contract/pdf"
|
|
193915
|
+
* }
|
|
192712
193916
|
* }
|
|
192713
193917
|
* }
|
|
192714
193918
|
*/
|
|
192715
193919
|
"application/json": {
|
|
192716
|
-
data
|
|
192717
|
-
/** @description When the return wrote `devuelto`. `null` on a contract that is not returned, and on an early withdrawal. */
|
|
192718
|
-
returned_at: string | null;
|
|
192719
|
-
/** @description `true` = this return set the car inactive; `false` = the car was already inactive; `null` = not recorded. */
|
|
192720
|
-
return_deactivated_vehicle: boolean | null;
|
|
192721
|
-
/** @description Present when this call returned the car: whether it set the car inactive, whether Cierre de avisos was queued, and one neutral Spanish sentence. */
|
|
192722
|
-
return_outcome?: {
|
|
192723
|
-
/** Format: uuid */
|
|
192724
|
-
vehicle_id: string;
|
|
192725
|
-
vehicle_deactivated: boolean;
|
|
192726
|
-
vehicle_was_inactive: boolean;
|
|
192727
|
-
ads_closing: boolean;
|
|
192728
|
-
message: string;
|
|
192729
|
-
};
|
|
192730
|
-
cancelled_visits?: components["schemas"]["CancelledVisits"] & unknown;
|
|
192731
|
-
} & {
|
|
192732
|
-
[key: string]: unknown;
|
|
192733
|
-
};
|
|
192734
|
-
meta?: {
|
|
192735
|
-
[key: string]: unknown;
|
|
192736
|
-
};
|
|
193920
|
+
data?: unknown;
|
|
192737
193921
|
};
|
|
192738
193922
|
};
|
|
192739
193923
|
};
|
|
@@ -192793,6 +193977,10 @@ interface paths {
|
|
|
192793
193977
|
};
|
|
192794
193978
|
};
|
|
192795
193979
|
};
|
|
193980
|
+
delete?: never;
|
|
193981
|
+
options?: never;
|
|
193982
|
+
head?: never;
|
|
193983
|
+
patch?: never;
|
|
192796
193984
|
trace?: never;
|
|
192797
193985
|
};
|
|
192798
193986
|
"/consignments/{id}/return": {
|
|
@@ -193163,7 +194351,7 @@ interface paths {
|
|
|
193163
194351
|
* Sell the car and settle with the owner
|
|
193164
194352
|
* @description One atomic action doing two things: moves the contract to `vendido`, and produces the **Liquidación** — sale price minus commission equals the amount owed to the owner, minus every retained cost line the owner bears (derived from the car's cost ledger, never sent; a 409 if they exceed the payout), plus the payment record. Requires `amount_venta_clp`; `paid_at` records when the owner was actually paid.
|
|
193165
194353
|
*
|
|
193166
|
-
* **No payout detail is required** (ADR 0159): `payout_method` (transferencia, vale_vista or cheque) defaults to `transferencia
|
|
194354
|
+
* **No payout detail is required** (ADR 0159): `payout_method` (transferencia, vale_vista or cheque) defaults to `transferencia`, stored with `payout_method_stated: false` so the liquidación does not name a medio nobody chose; an omitted `paid_at` stores the registration instant with `paid_at_stated: false`, and the paper then reads «Monto a pagar al dueño» with no «pagado el» and no payment sentence (app#8130). `payout_bank`, `payout_account` (the cuenta de destino — only its last four digits are stored and returned as `payout_account_last4`), `payout_operation_number` and `payout_paid_by` («pagado por», an active member of the workspace; defaults to whoever registers it) are optional. What was recorded prints on the liquidación with the payment and registration dates.
|
|
193167
194355
|
*
|
|
193168
194356
|
* **The commission can be set for this sale**: `comision_amount_clp` (net of IVA) replaces what the contract’s terms would compute — a minimum commission, a figure renegotiated at closing. The liquidación then records a fixed commission of that amount; the contract keeps its terms. To charge the owner an additional cost, record it on the car’s cost ledger with a `dueno` share before settling.
|
|
193169
194357
|
*
|
|
@@ -193203,7 +194391,7 @@ interface paths {
|
|
|
193203
194391
|
/** @description Comisión acordada para ESTA venta, neta de IVA, en pesos. Opcional: si se omite, se calcula con los términos del contrato. Cuando se envía, la liquidación la registra como comisión fija (el contrato no cambia) y el «+ IVA» sigue siendo el del contrato. No puede superar `amount_venta_clp`. */
|
|
193204
194392
|
comision_amount_clp?: number;
|
|
193205
194393
|
/**
|
|
193206
|
-
* @description Medio de pago al consignante: `transferencia`, `vale_vista` o `cheque`. Opcional: si se omite queda `transferencia` (ADR 0159: un pago pide solo su monto).
|
|
194394
|
+
* @description Medio de pago al consignante: `transferencia`, `vale_vista` o `cheque`. Opcional: si se omite queda `transferencia` (ADR 0159: un pago pide solo su monto) con `payout_method_stated: false`, y la liquidación no nombra el medio.
|
|
193207
194395
|
* @enum {string}
|
|
193208
194396
|
*/
|
|
193209
194397
|
payout_method?: "transferencia" | "vale_vista" | "cheque";
|
|
@@ -193371,6 +194559,8 @@ interface paths {
|
|
|
193371
194559
|
*
|
|
193372
194560
|
* It carries how the owner was paid (`payout_*`, with `payout_paid_by_name` resolved for display). On a liquidación registered before the payout fields existed they are all `null`; since then `payout_method` is always set and each of the others is `null` when it was not recorded.
|
|
193373
194561
|
*
|
|
194562
|
+
* **What the dealer entered (app#8130).** `payout_method_stated` is `false` when `payout_method` is the default `transferencia` rather than a choice, and `paid_at_stated` is `false` when no payment date was entered (`paid_at` is then the registration instant). Show the medio and the payment date only when their mark is not `false`; while `paid_at_stated` is `false` the liquidación reads «Monto a pagar al dueño». Both are `null` on a liquidación registered before the marks existed: show it as before.
|
|
194563
|
+
*
|
|
193374
194564
|
* `deducciones_clp` is the Σ of the dueño share of every retained cost line the settlement discharged, and `deductions` lists them one by one (`cost_entry_id`, `label`, `entry_date`, `dueno_clp`). Selling a consigned car deducts them all: `monto_owner_clp` is `amount_venta_clp` minus the comisión minus `deducciones_clp`.
|
|
193375
194565
|
*
|
|
193376
194566
|
* `sends` is the log of `POST /consignments/{id}/liquidacion/send`, newest first (last 10): `channel` (`email` | `whatsapp` | `whatsapp_link`), `status` (`sent`, or `opened` for `whatsapp_link`: «abierto en WhatsApp», nothing was delivered by us), `to`, `sent_at`, `by` (member or API key id) and `by_name`. `whatsapp_send_enabled` says whether the workspace may send it through the WhatsApp API (its staff-WhatsApp switch is on). `owner_whatsapp: { phone_digits, window_open }`: the owner’s phone in E.164 digits for `https://wa.me/<digits>` (`null` = no dialable phone: offer email only) and whether their 24 h window is open on this workspace’s WhatsApp. Send through the API when `whatsapp_send_enabled && owner_whatsapp.window_open`; otherwise offer «Abrir WhatsApp» (`channel: whatsapp_link`) when `phone_digits` is set.
|
|
@@ -193512,6 +194702,190 @@ interface paths {
|
|
|
193512
194702
|
patch?: never;
|
|
193513
194703
|
trace?: never;
|
|
193514
194704
|
};
|
|
194705
|
+
"/consignments/{id}/liquidacion/payment": {
|
|
194706
|
+
parameters: {
|
|
194707
|
+
query?: never;
|
|
194708
|
+
header?: never;
|
|
194709
|
+
path?: never;
|
|
194710
|
+
cookie?: never;
|
|
194711
|
+
};
|
|
194712
|
+
get?: never;
|
|
194713
|
+
put?: never;
|
|
194714
|
+
/**
|
|
194715
|
+
* Record the payment of a liquidación registered without one
|
|
194716
|
+
* @description A liquidación registered with no payment date (`paid_at_stated: false`, it reads «Monto a pagar al dueño») receives its payment facts once the owner is paid (app#8130, ADR 0166 decision 6): `paid_at` (required, not in the future) and, optionally, `payout_method`, `payout_bank`, `payout_account` (last 4 digits kept), `payout_operation_number` and `payout_paid_by` (default: the caller, when the liquidación names nobody). Only what is sent is stored; an omitted medio stays as it was (an unchosen one is still not printed). From then on `paid_at_stated` is `true` and the liquidación and its PDF state the payment. ONCE: no money figure (venta, comisión, deducciones, monto al dueño) and no contract state moves. Responds with the same read as `GET /consignments/{id}/liquidacion`.
|
|
194717
|
+
*
|
|
194718
|
+
* **404** when the contract has no liquidación. **409** `details.blocked_reason` = `payment_already_recorded` (it already has a payment date, including one registered before the mark existed) or `not_a_sale_settlement` (an early withdrawal). **400** for a future date or a malformed detail. Requires `consignments:write`.
|
|
194719
|
+
*/
|
|
194720
|
+
post: {
|
|
194721
|
+
parameters: {
|
|
194722
|
+
query?: never;
|
|
194723
|
+
header?: {
|
|
194724
|
+
/** @description Replay-safe retries: resending the SAME key with the SAME body returns the original response (`X-Idempotent-Replay: 1`) instead of creating a second copy — safe to send whenever a response might not have arrived. The same key with a DIFFERENT body answers `409 IDEMPOTENCY_KEY_CONFLICT`; use a fresh key per operation. */
|
|
194725
|
+
"Idempotency-Key"?: string;
|
|
194726
|
+
};
|
|
194727
|
+
path: {
|
|
194728
|
+
id: string;
|
|
194729
|
+
};
|
|
194730
|
+
cookie?: never;
|
|
194731
|
+
};
|
|
194732
|
+
requestBody?: {
|
|
194733
|
+
content: {
|
|
194734
|
+
/**
|
|
194735
|
+
* @example {
|
|
194736
|
+
* "paid_at": "2026-11-25T15:00:00.000Z",
|
|
194737
|
+
* "payout_method": "transferencia",
|
|
194738
|
+
* "payout_bank": "Banco de Chile"
|
|
194739
|
+
* }
|
|
194740
|
+
*/
|
|
194741
|
+
"application/json": {
|
|
194742
|
+
/**
|
|
194743
|
+
* Format: date-time
|
|
194744
|
+
* @description Cuándo se le pagó al dueño (ISO 8601). Requerido; no puede ser futura.
|
|
194745
|
+
*/
|
|
194746
|
+
paid_at: string;
|
|
194747
|
+
/**
|
|
194748
|
+
* @description Medio de pago, cuando se eligió: `transferencia`, `vale_vista` o `cheque`. Omitido = queda el que tenía, y la liquidación no lo nombra si no se había elegido.
|
|
194749
|
+
* @enum {string}
|
|
194750
|
+
*/
|
|
194751
|
+
payout_method?: "transferencia" | "vale_vista" | "cheque";
|
|
194752
|
+
/** @description Banco por el que se pagó. Opcional. */
|
|
194753
|
+
payout_bank?: string;
|
|
194754
|
+
/** @description Cuenta de destino. Opcional; se guardan sus últimos 4 dígitos. */
|
|
194755
|
+
payout_account?: string;
|
|
194756
|
+
/** @description Número de operación del pago. Opcional. */
|
|
194757
|
+
payout_operation_number?: string;
|
|
194758
|
+
/**
|
|
194759
|
+
* Format: uuid
|
|
194760
|
+
* @description «Pagado por»: id de un miembro activo del equipo. Omitido = quien registra el pago, si la liquidación no tenía a nadie.
|
|
194761
|
+
*/
|
|
194762
|
+
payout_paid_by?: string;
|
|
194763
|
+
};
|
|
194764
|
+
};
|
|
194765
|
+
};
|
|
194766
|
+
responses: {
|
|
194767
|
+
/** @description The Liquidación record */
|
|
194768
|
+
200: {
|
|
194769
|
+
headers: {
|
|
194770
|
+
[name: string]: unknown;
|
|
194771
|
+
};
|
|
194772
|
+
content: {
|
|
194773
|
+
/**
|
|
194774
|
+
* @example {
|
|
194775
|
+
* "data": {
|
|
194776
|
+
* "id": "d8d8d8d8-0000-4000-8000-000000000001",
|
|
194777
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
194778
|
+
* "consignment_contract_id": "d7d7d7d7-0000-4000-8000-000000000001",
|
|
194779
|
+
* "vehicle_id": "e1e1e1e1-0000-4000-8000-000000000001",
|
|
194780
|
+
* "settlement_mode": "stated_commission",
|
|
194781
|
+
* "amount_venta_clp": 8900000,
|
|
194782
|
+
* "comision_type": "percentage",
|
|
194783
|
+
* "comision_value": 10,
|
|
194784
|
+
* "comision_amount_clp": 890000,
|
|
194785
|
+
* "monto_owner_clp": 8010000,
|
|
194786
|
+
* "owner_floor_clp": null,
|
|
194787
|
+
* "deducciones_clp": 0,
|
|
194788
|
+
* "deductions": [],
|
|
194789
|
+
* "retiro_motivo": null,
|
|
194790
|
+
* "retiro_by": null,
|
|
194791
|
+
* "payout_method": "transferencia",
|
|
194792
|
+
* "payout_bank": "Banco de Chile",
|
|
194793
|
+
* "payout_account_last4": "5821",
|
|
194794
|
+
* "payout_operation_number": "99887766",
|
|
194795
|
+
* "payout_paid_by": "11111111-0000-4000-8000-000000000001",
|
|
194796
|
+
* "payout_paid_by_name": "Ana Pérez",
|
|
194797
|
+
* "paid_at": "2026-09-18T15:00:00.000Z",
|
|
194798
|
+
* "created_at": "2026-09-18T15:00:05.000Z",
|
|
194799
|
+
* "updated_at": "2026-09-18T15:00:05.000Z",
|
|
194800
|
+
* "comision_minima_applied": false,
|
|
194801
|
+
* "sends": [
|
|
194802
|
+
* {
|
|
194803
|
+
* "channel": "email",
|
|
194804
|
+
* "to": "dueno@example.com",
|
|
194805
|
+
* "status": "sent",
|
|
194806
|
+
* "sent_at": "2026-11-14T15:20:00.000Z",
|
|
194807
|
+
* "by": "11111111-0000-4000-8000-000000000001",
|
|
194808
|
+
* "by_name": "Camila Rojas"
|
|
194809
|
+
* }
|
|
194810
|
+
* ],
|
|
194811
|
+
* "whatsapp_send_enabled": false,
|
|
194812
|
+
* "owner_whatsapp": {
|
|
194813
|
+
* "phone_digits": "56912345678",
|
|
194814
|
+
* "window_open": false
|
|
194815
|
+
* }
|
|
194816
|
+
* }
|
|
194817
|
+
* }
|
|
194818
|
+
*/
|
|
194819
|
+
"application/json": {
|
|
194820
|
+
data?: unknown;
|
|
194821
|
+
meta?: {
|
|
194822
|
+
[key: string]: unknown;
|
|
194823
|
+
};
|
|
194824
|
+
};
|
|
194825
|
+
};
|
|
194826
|
+
};
|
|
194827
|
+
/** @description Validation error */
|
|
194828
|
+
400: {
|
|
194829
|
+
headers: {
|
|
194830
|
+
[name: string]: unknown;
|
|
194831
|
+
};
|
|
194832
|
+
content: {
|
|
194833
|
+
"application/json": components["schemas"]["Error"];
|
|
194834
|
+
};
|
|
194835
|
+
};
|
|
194836
|
+
/** @description Unauthorized */
|
|
194837
|
+
401: {
|
|
194838
|
+
headers: {
|
|
194839
|
+
[name: string]: unknown;
|
|
194840
|
+
};
|
|
194841
|
+
content: {
|
|
194842
|
+
"application/json": components["schemas"]["Error"];
|
|
194843
|
+
};
|
|
194844
|
+
};
|
|
194845
|
+
/** @description Forbidden */
|
|
194846
|
+
403: {
|
|
194847
|
+
headers: {
|
|
194848
|
+
[name: string]: unknown;
|
|
194849
|
+
};
|
|
194850
|
+
content: {
|
|
194851
|
+
"application/json": components["schemas"]["Error"];
|
|
194852
|
+
};
|
|
194853
|
+
};
|
|
194854
|
+
/** @description Not found */
|
|
194855
|
+
404: {
|
|
194856
|
+
headers: {
|
|
194857
|
+
[name: string]: unknown;
|
|
194858
|
+
};
|
|
194859
|
+
content: {
|
|
194860
|
+
"application/json": components["schemas"]["Error"];
|
|
194861
|
+
};
|
|
194862
|
+
};
|
|
194863
|
+
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
194864
|
+
409: {
|
|
194865
|
+
headers: {
|
|
194866
|
+
[name: string]: unknown;
|
|
194867
|
+
};
|
|
194868
|
+
content: {
|
|
194869
|
+
"application/json": components["schemas"]["Error"];
|
|
194870
|
+
};
|
|
194871
|
+
};
|
|
194872
|
+
/** @description Rate limited */
|
|
194873
|
+
429: {
|
|
194874
|
+
headers: {
|
|
194875
|
+
[name: string]: unknown;
|
|
194876
|
+
};
|
|
194877
|
+
content: {
|
|
194878
|
+
"application/json": components["schemas"]["Error"];
|
|
194879
|
+
};
|
|
194880
|
+
};
|
|
194881
|
+
};
|
|
194882
|
+
};
|
|
194883
|
+
delete?: never;
|
|
194884
|
+
options?: never;
|
|
194885
|
+
head?: never;
|
|
194886
|
+
patch?: never;
|
|
194887
|
+
trace?: never;
|
|
194888
|
+
};
|
|
193515
194889
|
"/conversations": {
|
|
193516
194890
|
parameters: {
|
|
193517
194891
|
query?: never;
|
|
@@ -310594,12 +311968,123 @@ interface paths {
|
|
|
310594
311968
|
};
|
|
310595
311969
|
};
|
|
310596
311970
|
/**
|
|
310597
|
-
* Rename a tag’s display name
|
|
310598
|
-
* @description `display_name` is the ONLY editable field, and it is required. The slug `name` is permanent: it is the identity every attachment and every create-by-name call resolves through, so renaming it would detach the tag from itself.
|
|
311971
|
+
* Rename a tag’s display name
|
|
311972
|
+
* @description `display_name` is the ONLY editable field, and it is required. The slug `name` is permanent: it is the identity every attachment and every create-by-name call resolves through, so renaming it would detach the tag from itself.
|
|
311973
|
+
*
|
|
311974
|
+
* In practice that means a tag can be relabelled for people without anything breaking, but its canonical name stays whatever it was first typed as. To change the slug, create a new tag and re-attach.
|
|
311975
|
+
*/
|
|
311976
|
+
put: {
|
|
311977
|
+
parameters: {
|
|
311978
|
+
query?: never;
|
|
311979
|
+
header?: never;
|
|
311980
|
+
path: {
|
|
311981
|
+
id: string;
|
|
311982
|
+
};
|
|
311983
|
+
cookie?: never;
|
|
311984
|
+
};
|
|
311985
|
+
requestBody?: {
|
|
311986
|
+
content: {
|
|
311987
|
+
/**
|
|
311988
|
+
* @example {
|
|
311989
|
+
* "display_name": "Garantía extendida"
|
|
311990
|
+
* }
|
|
311991
|
+
*/
|
|
311992
|
+
"application/json": {
|
|
311993
|
+
display_name: string;
|
|
311994
|
+
};
|
|
311995
|
+
};
|
|
311996
|
+
};
|
|
311997
|
+
responses: {
|
|
311998
|
+
/** @description The updated tag */
|
|
311999
|
+
200: {
|
|
312000
|
+
headers: {
|
|
312001
|
+
[name: string]: unknown;
|
|
312002
|
+
};
|
|
312003
|
+
content: {
|
|
312004
|
+
/**
|
|
312005
|
+
* @example {
|
|
312006
|
+
* "data": {
|
|
312007
|
+
* "id": "12121212-0000-4000-8000-000000000001",
|
|
312008
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
312009
|
+
* "name": "garantia",
|
|
312010
|
+
* "display_name": "Garantía extendida",
|
|
312011
|
+
* "usage_count": 1,
|
|
312012
|
+
* "created_at": "2026-09-22T11:06:38.372Z"
|
|
312013
|
+
* }
|
|
312014
|
+
* }
|
|
312015
|
+
*/
|
|
312016
|
+
"application/json": {
|
|
312017
|
+
data?: unknown;
|
|
312018
|
+
meta?: {
|
|
312019
|
+
[key: string]: unknown;
|
|
312020
|
+
};
|
|
312021
|
+
};
|
|
312022
|
+
};
|
|
312023
|
+
};
|
|
312024
|
+
/** @description Validation error */
|
|
312025
|
+
400: {
|
|
312026
|
+
headers: {
|
|
312027
|
+
[name: string]: unknown;
|
|
312028
|
+
};
|
|
312029
|
+
content: {
|
|
312030
|
+
"application/json": components["schemas"]["Error"];
|
|
312031
|
+
};
|
|
312032
|
+
};
|
|
312033
|
+
/** @description Unauthorized */
|
|
312034
|
+
401: {
|
|
312035
|
+
headers: {
|
|
312036
|
+
[name: string]: unknown;
|
|
312037
|
+
};
|
|
312038
|
+
content: {
|
|
312039
|
+
"application/json": components["schemas"]["Error"];
|
|
312040
|
+
};
|
|
312041
|
+
};
|
|
312042
|
+
/** @description Forbidden */
|
|
312043
|
+
403: {
|
|
312044
|
+
headers: {
|
|
312045
|
+
[name: string]: unknown;
|
|
312046
|
+
};
|
|
312047
|
+
content: {
|
|
312048
|
+
"application/json": components["schemas"]["Error"];
|
|
312049
|
+
};
|
|
312050
|
+
};
|
|
312051
|
+
/** @description Not found */
|
|
312052
|
+
404: {
|
|
312053
|
+
headers: {
|
|
312054
|
+
[name: string]: unknown;
|
|
312055
|
+
};
|
|
312056
|
+
content: {
|
|
312057
|
+
"application/json": components["schemas"]["Error"];
|
|
312058
|
+
};
|
|
312059
|
+
};
|
|
312060
|
+
/** @description Conflict (incl. Idempotency-Key reuse with different body) */
|
|
312061
|
+
409: {
|
|
312062
|
+
headers: {
|
|
312063
|
+
[name: string]: unknown;
|
|
312064
|
+
};
|
|
312065
|
+
content: {
|
|
312066
|
+
"application/json": components["schemas"]["Error"];
|
|
312067
|
+
};
|
|
312068
|
+
};
|
|
312069
|
+
/** @description Rate limited */
|
|
312070
|
+
429: {
|
|
312071
|
+
headers: {
|
|
312072
|
+
[name: string]: unknown;
|
|
312073
|
+
};
|
|
312074
|
+
content: {
|
|
312075
|
+
"application/json": components["schemas"]["Error"];
|
|
312076
|
+
};
|
|
312077
|
+
};
|
|
312078
|
+
};
|
|
312079
|
+
};
|
|
312080
|
+
post?: never;
|
|
312081
|
+
/**
|
|
312082
|
+
* Delete a tag
|
|
312083
|
+
* @description Removes the tag and every attachment to it, across conversations and contacts alike. A 404 for an id that is not there.
|
|
310599
312084
|
*
|
|
310600
|
-
*
|
|
312085
|
+
* It does not stay deleted if anything still uses the name: attaching by name re-creates it, and so does an agent acting on a suggestion. A tag that keeps coming back is being written by something, not resurrected.
|
|
310601
312086
|
*/
|
|
310602
|
-
|
|
312087
|
+
delete: {
|
|
310603
312088
|
parameters: {
|
|
310604
312089
|
query?: never;
|
|
310605
312090
|
header?: never;
|
|
@@ -310608,44 +312093,14 @@ interface paths {
|
|
|
310608
312093
|
};
|
|
310609
312094
|
cookie?: never;
|
|
310610
312095
|
};
|
|
310611
|
-
requestBody?:
|
|
310612
|
-
content: {
|
|
310613
|
-
/**
|
|
310614
|
-
* @example {
|
|
310615
|
-
* "display_name": "Garantía extendida"
|
|
310616
|
-
* }
|
|
310617
|
-
*/
|
|
310618
|
-
"application/json": {
|
|
310619
|
-
display_name: string;
|
|
310620
|
-
};
|
|
310621
|
-
};
|
|
310622
|
-
};
|
|
312096
|
+
requestBody?: never;
|
|
310623
312097
|
responses: {
|
|
310624
|
-
/** @description
|
|
310625
|
-
|
|
312098
|
+
/** @description No content */
|
|
312099
|
+
204: {
|
|
310626
312100
|
headers: {
|
|
310627
312101
|
[name: string]: unknown;
|
|
310628
312102
|
};
|
|
310629
|
-
content
|
|
310630
|
-
/**
|
|
310631
|
-
* @example {
|
|
310632
|
-
* "data": {
|
|
310633
|
-
* "id": "12121212-0000-4000-8000-000000000001",
|
|
310634
|
-
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
310635
|
-
* "name": "garantia",
|
|
310636
|
-
* "display_name": "Garantía extendida",
|
|
310637
|
-
* "usage_count": 1,
|
|
310638
|
-
* "created_at": "2026-09-22T11:06:38.372Z"
|
|
310639
|
-
* }
|
|
310640
|
-
* }
|
|
310641
|
-
*/
|
|
310642
|
-
"application/json": {
|
|
310643
|
-
data?: unknown;
|
|
310644
|
-
meta?: {
|
|
310645
|
-
[key: string]: unknown;
|
|
310646
|
-
};
|
|
310647
|
-
};
|
|
310648
|
-
};
|
|
312103
|
+
content?: never;
|
|
310649
312104
|
};
|
|
310650
312105
|
/** @description Validation error */
|
|
310651
312106
|
400: {
|
|
@@ -310703,30 +312158,101 @@ interface paths {
|
|
|
310703
312158
|
};
|
|
310704
312159
|
};
|
|
310705
312160
|
};
|
|
310706
|
-
|
|
312161
|
+
options?: never;
|
|
312162
|
+
head?: never;
|
|
312163
|
+
patch?: never;
|
|
312164
|
+
trace?: never;
|
|
312165
|
+
};
|
|
312166
|
+
"/vehicles/stats": {
|
|
312167
|
+
parameters: {
|
|
312168
|
+
query?: never;
|
|
312169
|
+
header?: never;
|
|
312170
|
+
path?: never;
|
|
312171
|
+
cookie?: never;
|
|
312172
|
+
};
|
|
310707
312173
|
/**
|
|
310708
|
-
*
|
|
310709
|
-
* @description
|
|
312174
|
+
* Aggregate counts for the whole lot
|
|
312175
|
+
* @description The stock health header — counts across the workspace’s inventory, not a page of vehicles.
|
|
310710
312176
|
*
|
|
310711
|
-
*
|
|
312177
|
+
* `by_tenencia` (Tenencia, ADR 0025) splits the lot four ways: `propio`, `consignacion_en_local`, `consignacion_virtual` and `consignacion_sin_contrato` (consigned on the vehicle row with NO contract in `estado=activo`). The four PARTITION the lot — they sum to `total` — and each equals the length of the list its chip opens: `GET /vehicles?active=false&tenencia=…[&consignacion_modalidad=…]`, the same predicate builder serving both. Like `by_location` and `total`, they count the WHOLE lot rather than active stock only, which is what the Stock screen shows (it sends `active=false`).
|
|
312178
|
+
*
|
|
312179
|
+
* `propio_sin_clasificar` is a SUB-COUNT of `propio` (the own cars nobody declared, `tenencia_source=default`), NOT a fifth bucket: the four above still sum to `total`. Kept for the clients that read it. Since app#7891 a car with no consignment contract is the dealership's own with nothing to declare, so this is not a pending task and a dealer-facing screen does not show it; `propio` already counts these cars.
|
|
312180
|
+
*
|
|
312181
|
+
* `sin_costo` is always 0 since ADR 0162 (app#7720): a car in stock without Costo de compra is not flagged until it is sold. The list `GET /vehicles?view=sin_costo` still works as a filter; only its count is gone. Kept for the clients that read it, and still ABSENT for a caller without `dealership_economics:read`.
|
|
312182
|
+
*
|
|
312183
|
+
* `by_tenencia.not_dealership_owned` (app#7892) is another SUB-COUNT of `propio`, not a bucket: the cars marked «No es de la automotora» (shown for someone else, no consignment contract yet; their tenencia stays `propio`). Opens with `GET /vehicles?active=false¬_dealership_owned=true`.
|
|
312184
|
+
*
|
|
312185
|
+
* `mandato_sin_firmar` (ADR 0114 §5) counts the cars whose consignación (activa, or vendida) has an emitted mandato and no signed copy filed in the expediente. Opens with `GET /vehicles?view=mandato_sin_firmar`, the same predicate.
|
|
312186
|
+
*
|
|
312187
|
+
* The «Datos por completar» and «Pendientes» facet counts of the Stock filters (ADR 0114) — each is the length of the list it opens, built from the same predicate, over the whole lot like `total`:
|
|
312188
|
+
* - `needs_review` — «Revisar marca/modelo»: the marca or modelo did not match the catalogue on save and waits for a person. Opens with `GET /vehicles?active=false&needs_review=true`.
|
|
312189
|
+
* - `sin_sucursal` — «Sin sucursal»: no sucursal assigned. Opens with `GET /vehicles?active=false&sin_sucursal=true`. Always 0 for a member who only sees their own sucursales.
|
|
312190
|
+
* - `sin_estacionamiento` — «Sin estacionamiento»: no estacionamiento in the patio. Opens with `GET /vehicles?active=false&sin_estacionamiento=true`.
|
|
312191
|
+
* - `source_deactivated` — «Retirados del portal»: the portal withdrew the car, it is deactivated and still `disponible`, so nobody has said whether it was sold. Opens with `GET /vehicles?view=source_deactivated`.
|
|
312192
|
+
* - `papers_expired` — «Papeles vencidos»: cars in stock (active, not vendido) holding a paper (SOAP, permiso de circulación, revisión técnica or a named paper) whose «Vence» day has passed and that no later paper of the same kind replaces. Opens with `GET /vehicles?papers_expired=true`.
|
|
312193
|
+
* - `papers_expiring` — «Papeles por vencer»: cars in stock holding a paper whose «Vence» day is today or within the next 30 days. Opens with `GET /vehicles?papers_expiring=true`. A car can be in both.
|
|
312194
|
+
*
|
|
312195
|
+
* Every count respects the caller’s sucursal scope (ADR 0102), the same ceiling the list applies. Automotive-vertical only: a workspace on another vertical gets 403 here however its scopes are set.
|
|
310712
312196
|
*/
|
|
310713
|
-
|
|
312197
|
+
get: {
|
|
310714
312198
|
parameters: {
|
|
310715
312199
|
query?: never;
|
|
310716
312200
|
header?: never;
|
|
310717
|
-
path
|
|
310718
|
-
id: string;
|
|
310719
|
-
};
|
|
312201
|
+
path?: never;
|
|
310720
312202
|
cookie?: never;
|
|
310721
312203
|
};
|
|
310722
312204
|
requestBody?: never;
|
|
310723
312205
|
responses: {
|
|
310724
|
-
/** @description
|
|
310725
|
-
|
|
312206
|
+
/** @description Aggregate stock counts */
|
|
312207
|
+
200: {
|
|
310726
312208
|
headers: {
|
|
310727
312209
|
[name: string]: unknown;
|
|
310728
312210
|
};
|
|
310729
|
-
content
|
|
312211
|
+
content: {
|
|
312212
|
+
/**
|
|
312213
|
+
* @example {
|
|
312214
|
+
* "data": {
|
|
312215
|
+
* "total": 7,
|
|
312216
|
+
* "active": 7,
|
|
312217
|
+
* "by_status": {
|
|
312218
|
+
* "disponible": 6,
|
|
312219
|
+
* "reservado": 1
|
|
312220
|
+
* },
|
|
312221
|
+
* "published": 0,
|
|
312222
|
+
* "with_error": 0,
|
|
312223
|
+
* "unpublished": 7,
|
|
312224
|
+
* "stale": 0,
|
|
312225
|
+
* "sin_costo": 0,
|
|
312226
|
+
* "mandato_sin_firmar": 1,
|
|
312227
|
+
* "needs_review": 1,
|
|
312228
|
+
* "sin_sucursal": 2,
|
|
312229
|
+
* "sin_estacionamiento": 4,
|
|
312230
|
+
* "source_deactivated": 0,
|
|
312231
|
+
* "papers_expired": 1,
|
|
312232
|
+
* "papers_expiring": 2,
|
|
312233
|
+
* "by_location": {
|
|
312234
|
+
* "b1b1b1b1-0000-4000-8000-000000000001": 3,
|
|
312235
|
+
* "b1b1b1b1-0000-4000-8000-000000000002": 1,
|
|
312236
|
+
* "b1b1b1b1-0000-4000-8000-000000000003": 1
|
|
312237
|
+
* },
|
|
312238
|
+
* "by_tenencia": {
|
|
312239
|
+
* "propio": 7,
|
|
312240
|
+
* "consignacion_en_local": 0,
|
|
312241
|
+
* "consignacion_virtual": 0,
|
|
312242
|
+
* "consignacion_sin_contrato": 0,
|
|
312243
|
+
* "propio_sin_clasificar": 7,
|
|
312244
|
+
* "not_dealership_owned": 0
|
|
312245
|
+
* }
|
|
312246
|
+
* }
|
|
312247
|
+
* }
|
|
312248
|
+
*/
|
|
312249
|
+
"application/json": {
|
|
312250
|
+
data?: unknown;
|
|
312251
|
+
meta?: {
|
|
312252
|
+
[key: string]: unknown;
|
|
312253
|
+
};
|
|
312254
|
+
};
|
|
312255
|
+
};
|
|
310730
312256
|
};
|
|
310731
312257
|
/** @description Validation error */
|
|
310732
312258
|
400: {
|
|
@@ -310784,12 +312310,15 @@ interface paths {
|
|
|
310784
312310
|
};
|
|
310785
312311
|
};
|
|
310786
312312
|
};
|
|
312313
|
+
put?: never;
|
|
312314
|
+
post?: never;
|
|
312315
|
+
delete?: never;
|
|
310787
312316
|
options?: never;
|
|
310788
312317
|
head?: never;
|
|
310789
312318
|
patch?: never;
|
|
310790
312319
|
trace?: never;
|
|
310791
312320
|
};
|
|
310792
|
-
"/vehicles/
|
|
312321
|
+
"/vehicles/plate-check": {
|
|
310793
312322
|
parameters: {
|
|
310794
312323
|
query?: never;
|
|
310795
312324
|
header?: never;
|
|
@@ -310797,39 +312326,22 @@ interface paths {
|
|
|
310797
312326
|
cookie?: never;
|
|
310798
312327
|
};
|
|
310799
312328
|
/**
|
|
310800
|
-
*
|
|
310801
|
-
* @description The stock
|
|
310802
|
-
*
|
|
310803
|
-
* `by_tenencia` (Tenencia, ADR 0025) splits the lot four ways: `propio`, `consignacion_en_local`, `consignacion_virtual` and `consignacion_sin_contrato` (consigned on the vehicle row with NO contract in `estado=activo`). The four PARTITION the lot — they sum to `total` — and each equals the length of the list its chip opens: `GET /vehicles?active=false&tenencia=…[&consignacion_modalidad=…]`, the same predicate builder serving both. Like `by_location` and `total`, they count the WHOLE lot rather than active stock only, which is what the Stock screen shows (it sends `active=false`).
|
|
310804
|
-
*
|
|
310805
|
-
* `propio_sin_clasificar` is a SUB-COUNT of `propio` (the own cars nobody declared, `tenencia_source=default`), NOT a fifth bucket: the four above still sum to `total`. Kept for the clients that read it. Since app#7891 a car with no consignment contract is the dealership's own with nothing to declare, so this is not a pending task and a dealer-facing screen does not show it; `propio` already counts these cars.
|
|
310806
|
-
*
|
|
310807
|
-
* `sin_costo` is always 0 since ADR 0162 (app#7720): a car in stock without Costo de compra is not flagged until it is sold. The list `GET /vehicles?view=sin_costo` still works as a filter; only its count is gone. Kept for the clients that read it, and still ABSENT for a caller without `dealership_economics:read`.
|
|
310808
|
-
*
|
|
310809
|
-
* `by_tenencia.not_dealership_owned` (app#7892) is another SUB-COUNT of `propio`, not a bucket: the cars marked «No es de la automotora» (shown for someone else, no consignment contract yet; their tenencia stays `propio`). Opens with `GET /vehicles?active=false¬_dealership_owned=true`.
|
|
310810
|
-
*
|
|
310811
|
-
* `mandato_sin_firmar` (ADR 0114 §5) counts the cars whose consignación (activa, or vendida) has an emitted mandato and no signed copy filed in the expediente. Opens with `GET /vehicles?view=mandato_sin_firmar`, the same predicate.
|
|
310812
|
-
*
|
|
310813
|
-
* The «Datos por completar» and «Pendientes» facet counts of the Stock filters (ADR 0114) — each is the length of the list it opens, built from the same predicate, over the whole lot like `total`:
|
|
310814
|
-
* - `needs_review` — «Revisar marca/modelo»: the marca or modelo did not match the catalogue on save and waits for a person. Opens with `GET /vehicles?active=false&needs_review=true`.
|
|
310815
|
-
* - `sin_sucursal` — «Sin sucursal»: no sucursal assigned. Opens with `GET /vehicles?active=false&sin_sucursal=true`. Always 0 for a member who only sees their own sucursales.
|
|
310816
|
-
* - `sin_estacionamiento` — «Sin estacionamiento»: no estacionamiento in the patio. Opens with `GET /vehicles?active=false&sin_estacionamiento=true`.
|
|
310817
|
-
* - `source_deactivated` — «Retirados del portal»: the portal withdrew the car, it is deactivated and still `disponible`, so nobody has said whether it was sold. Opens with `GET /vehicles?view=source_deactivated`.
|
|
310818
|
-
* - `papers_expired` — «Papeles vencidos»: cars in stock (active, not vendido) holding a paper (SOAP, permiso de circulación, revisión técnica or a named paper) whose «Vence» day has passed and that no later paper of the same kind replaces. Opens with `GET /vehicles?papers_expired=true`.
|
|
310819
|
-
* - `papers_expiring` — «Papeles por vencer»: cars in stock holding a paper whose «Vence» day is today or within the next 30 days. Opens with `GET /vehicles?papers_expiring=true`. A car can be in both.
|
|
310820
|
-
*
|
|
310821
|
-
* Every count respects the caller’s sucursal scope (ADR 0102), the same ceiling the list applies. Automotive-vertical only: a workspace on another vertical gets 403 here however its scopes are set.
|
|
312329
|
+
* Which car already has this plate
|
|
312330
|
+
* @description Asks, before anything is saved, whether a car of this workspace already holds a plate, so a form can offer that car instead of a second one. Read-only. The answer is the same rule `POST /vehicles` applies when it saves: an active car, or a hidden car still in stock, holds the plate; a car that left the dealership (sold, or returned to its owner) does not, so its plate is free. The plate is read the way `POST /vehicles` reads it («kztl-12» is `KZTL12`). `vehicle` is null for a free plate, an empty plate, a placeholder («en trámite») and a type with no plate. Automotive-vertical only: a workspace on another vertical gets 403 here however its scopes are set.
|
|
310822
312331
|
*/
|
|
310823
312332
|
get: {
|
|
310824
312333
|
parameters: {
|
|
310825
|
-
query
|
|
312334
|
+
query: {
|
|
312335
|
+
plate: string;
|
|
312336
|
+
vehicle_type?: "auto" | "camion" | "maquinaria" | "nautico" | "moto";
|
|
312337
|
+
};
|
|
310826
312338
|
header?: never;
|
|
310827
312339
|
path?: never;
|
|
310828
312340
|
cookie?: never;
|
|
310829
312341
|
};
|
|
310830
312342
|
requestBody?: never;
|
|
310831
312343
|
responses: {
|
|
310832
|
-
/** @description
|
|
312344
|
+
/** @description The car holding the plate, or null */
|
|
310833
312345
|
200: {
|
|
310834
312346
|
headers: {
|
|
310835
312347
|
[name: string]: unknown;
|
|
@@ -310838,44 +312350,33 @@ interface paths {
|
|
|
310838
312350
|
/**
|
|
310839
312351
|
* @example {
|
|
310840
312352
|
* "data": {
|
|
310841
|
-
* "
|
|
310842
|
-
* "
|
|
310843
|
-
*
|
|
310844
|
-
* "
|
|
310845
|
-
* "
|
|
310846
|
-
*
|
|
310847
|
-
* "published": 0,
|
|
310848
|
-
* "with_error": 0,
|
|
310849
|
-
* "unpublished": 7,
|
|
310850
|
-
* "stale": 0,
|
|
310851
|
-
* "sin_costo": 0,
|
|
310852
|
-
* "mandato_sin_firmar": 1,
|
|
310853
|
-
* "needs_review": 1,
|
|
310854
|
-
* "sin_sucursal": 2,
|
|
310855
|
-
* "sin_estacionamiento": 4,
|
|
310856
|
-
* "source_deactivated": 0,
|
|
310857
|
-
* "papers_expired": 1,
|
|
310858
|
-
* "papers_expiring": 2,
|
|
310859
|
-
* "by_location": {
|
|
310860
|
-
* "b1b1b1b1-0000-4000-8000-000000000001": 3,
|
|
310861
|
-
* "b1b1b1b1-0000-4000-8000-000000000002": 1,
|
|
310862
|
-
* "b1b1b1b1-0000-4000-8000-000000000003": 1
|
|
310863
|
-
* },
|
|
310864
|
-
* "by_tenencia": {
|
|
310865
|
-
* "propio": 7,
|
|
310866
|
-
* "consignacion_en_local": 0,
|
|
310867
|
-
* "consignacion_virtual": 0,
|
|
310868
|
-
* "consignacion_sin_contrato": 0,
|
|
310869
|
-
* "propio_sin_clasificar": 7,
|
|
310870
|
-
* "not_dealership_owned": 0
|
|
312353
|
+
* "plate": "KZTL12",
|
|
312354
|
+
* "vehicle": {
|
|
312355
|
+
* "id": "11111111-0000-4000-8000-000000000001",
|
|
312356
|
+
* "name": "Toyota Yaris 2019",
|
|
312357
|
+
* "status": "disponible",
|
|
312358
|
+
* "active": true
|
|
310871
312359
|
* }
|
|
310872
312360
|
* }
|
|
310873
312361
|
* }
|
|
310874
312362
|
*/
|
|
310875
312363
|
"application/json": {
|
|
310876
|
-
data
|
|
310877
|
-
|
|
310878
|
-
|
|
312364
|
+
data: {
|
|
312365
|
+
/**
|
|
312366
|
+
* @description La patente limpia (sin guion ni espacios, en mayúsculas), o null si lo escrito no es una patente chilena.
|
|
312367
|
+
* @example KZTL12
|
|
312368
|
+
*/
|
|
312369
|
+
plate: string | null;
|
|
312370
|
+
/** @description El auto del workspace que ya tiene esa patente en el stock (activo, u oculto pero todavía en el stock). null si la patente está libre. Un auto que ya salió (vendido, o devuelto a su dueño) no la retiene. */
|
|
312371
|
+
vehicle: {
|
|
312372
|
+
/** Format: uuid */
|
|
312373
|
+
id: string;
|
|
312374
|
+
/** @example Toyota Yaris 2019 */
|
|
312375
|
+
name: string | null;
|
|
312376
|
+
/** @example disponible */
|
|
312377
|
+
status: string;
|
|
312378
|
+
active: boolean;
|
|
312379
|
+
} | null;
|
|
310879
312380
|
};
|
|
310880
312381
|
};
|
|
310881
312382
|
};
|
|
@@ -333701,6 +335202,10 @@ interface components {
|
|
|
333701
335202
|
description?: string;
|
|
333702
335203
|
charge_clp?: number;
|
|
333703
335204
|
};
|
|
335205
|
+
SaleNoteDiscountInput: {
|
|
335206
|
+
description: string;
|
|
335207
|
+
amount_clp: number;
|
|
335208
|
+
};
|
|
333704
335209
|
SaleNoteFieldChange: {
|
|
333705
335210
|
from?: unknown;
|
|
333706
335211
|
to?: unknown;
|
|
@@ -333768,6 +335273,10 @@ interface components {
|
|
|
333768
335273
|
/** @enum {string} */
|
|
333769
335274
|
tax_treatment?: "afecto" | "exento" | "no_gravado" | "pass_through";
|
|
333770
335275
|
issued_at?: string;
|
|
335276
|
+
discount?: {
|
|
335277
|
+
description: string;
|
|
335278
|
+
amount_clp: number;
|
|
335279
|
+
};
|
|
333771
335280
|
};
|
|
333772
335281
|
SaleNotePendingPriceChange: {
|
|
333773
335282
|
/** Format: uuid */
|
|
@@ -333822,6 +335331,29 @@ interface components {
|
|
|
333822
335331
|
created_at: string;
|
|
333823
335332
|
}[];
|
|
333824
335333
|
};
|
|
335334
|
+
SaleNoteOwnerPayment: {
|
|
335335
|
+
/** Format: uuid */
|
|
335336
|
+
consignment_contract_id: string;
|
|
335337
|
+
/** Format: uuid */
|
|
335338
|
+
dueno_contact_id: string | null;
|
|
335339
|
+
dueno_name: string | null;
|
|
335340
|
+
settled: boolean;
|
|
335341
|
+
estimated_amount_clp: number | null;
|
|
335342
|
+
amount_paid_clp: number | null;
|
|
335343
|
+
paid_at: string | null;
|
|
335344
|
+
paid_at_stated: boolean | null;
|
|
335345
|
+
/** Format: uuid */
|
|
335346
|
+
liquidacion_id: string | null;
|
|
335347
|
+
};
|
|
335348
|
+
SaleNoteDiscount: {
|
|
335349
|
+
/** Format: uuid */
|
|
335350
|
+
id: string;
|
|
335351
|
+
description: string;
|
|
335352
|
+
amount_clp: number;
|
|
335353
|
+
created_at: string;
|
|
335354
|
+
/** Format: uuid */
|
|
335355
|
+
created_by: string | null;
|
|
335356
|
+
};
|
|
333825
335357
|
SaleNoteRead: {
|
|
333826
335358
|
/** Format: uuid */
|
|
333827
335359
|
id: string;
|
|
@@ -333843,6 +335375,11 @@ interface components {
|
|
|
333843
335375
|
pending_price_change: components["schemas"]["SaleNotePendingPriceChange"] | null;
|
|
333844
335376
|
transfer_tax: components["schemas"]["SaleNoteTransferTax"] | null;
|
|
333845
335377
|
settlement_difference: components["schemas"]["SettlementDifference"] | null;
|
|
335378
|
+
owner_payment: components["schemas"]["SaleNoteOwnerPayment"] | null;
|
|
335379
|
+
discounts: components["schemas"]["SaleNoteDiscount"][];
|
|
335380
|
+
discounts_total_clp: number;
|
|
335381
|
+
price_before_discounts_clp: number | null;
|
|
335382
|
+
price_after_discounts: number | null;
|
|
333846
335383
|
} & {
|
|
333847
335384
|
[key: string]: unknown;
|
|
333848
335385
|
};
|
|
@@ -333985,7 +335522,10 @@ interface components {
|
|
|
333985
335522
|
/** Format: uuid */
|
|
333986
335523
|
consignment_contract_id: string;
|
|
333987
335524
|
ready: boolean;
|
|
335525
|
+
/** @description What still holds the print: the dealership’s Datos legales and the owner’s name. */
|
|
333988
335526
|
missing_fields: components["schemas"]["ConsignmentContractMissingField"][];
|
|
335527
|
+
/** @description The owner’s facts that print as a line to complete by hand (app#8132): `owner.tax_id`, `owner.address_street`, `owner.comuna_code`. Never holds the print; `legal_data` still saves them. */
|
|
335528
|
+
blank_fields: components["schemas"]["ConsignmentContractMissingField"][];
|
|
333989
335529
|
blocked: {
|
|
333990
335530
|
reason: string;
|
|
333991
335531
|
message: string;
|
|
@@ -334092,6 +335632,29 @@ interface components {
|
|
|
334092
335632
|
/** @description El monto que escribió la automotora: net_clp más el IVA cuando la compra fue con factura, si no net_clp. Sirve para mostrar el monto al reabrir el costo. */
|
|
334093
335633
|
amount_paid_clp: number;
|
|
334094
335634
|
};
|
|
335635
|
+
DealerDocumentVehicleRef: {
|
|
335636
|
+
/** Format: uuid */
|
|
335637
|
+
id: string;
|
|
335638
|
+
title: string | null;
|
|
335639
|
+
make: string | null;
|
|
335640
|
+
model: string | null;
|
|
335641
|
+
version: string | null;
|
|
335642
|
+
year: number | null;
|
|
335643
|
+
registration_number: string | null;
|
|
335644
|
+
deleted: boolean;
|
|
335645
|
+
} | null;
|
|
335646
|
+
ContactDealerDocument: {
|
|
335647
|
+
/** @enum {string} */
|
|
335648
|
+
kind: "sale_note" | "purchase_note" | "consignment" | "reservation";
|
|
335649
|
+
/** Format: uuid */
|
|
335650
|
+
id: string;
|
|
335651
|
+
display_id: string | null;
|
|
335652
|
+
date: string;
|
|
335653
|
+
status: string;
|
|
335654
|
+
voided: boolean;
|
|
335655
|
+
amount_clp: number | null;
|
|
335656
|
+
vehicle_ref: components["schemas"]["DealerDocumentVehicleRef"];
|
|
335657
|
+
};
|
|
334095
335658
|
/** @description A Mercado Pago checkout payment: its payment id, a link to it and its status. Null for every other movement. */
|
|
334096
335659
|
GatewayPaymentRef: {
|
|
334097
335660
|
/** @enum {string} */
|
|
@@ -343554,6 +345117,52 @@ interface components {
|
|
|
343554
345117
|
/** @description Fields that must be non-blank for this instrument. Empty = only paid_on and amount_clp. */
|
|
343555
345118
|
required_fields: ("bank" | "account_number" | "document_number" | "note")[];
|
|
343556
345119
|
};
|
|
345120
|
+
LastConsignmentTerms: {
|
|
345121
|
+
/** Format: uuid */
|
|
345122
|
+
consignment_contract_id: string;
|
|
345123
|
+
created_at: string;
|
|
345124
|
+
/** @enum {string|null} */
|
|
345125
|
+
comision_type: "percentage" | "fixed" | null;
|
|
345126
|
+
comision_value: number | null;
|
|
345127
|
+
comision_mas_iva: boolean;
|
|
345128
|
+
comision_minima_clp: number | null;
|
|
345129
|
+
comision_minima_mas_iva: boolean;
|
|
345130
|
+
} | null;
|
|
345131
|
+
/** @description Un auto nuevo. Uno de `vehicle_id` o `vehicle`. */
|
|
345132
|
+
TakeConsignmentVehicle: {
|
|
345133
|
+
/**
|
|
345134
|
+
* @description Patente, como la escribió el usuario (con guion o espacios está bien; se guarda limpia).
|
|
345135
|
+
* @example KZTL-12
|
|
345136
|
+
*/
|
|
345137
|
+
registration_number: string;
|
|
345138
|
+
/** @example Toyota */
|
|
345139
|
+
make: string;
|
|
345140
|
+
/** @example Yaris */
|
|
345141
|
+
model: string;
|
|
345142
|
+
/** @example 2019 */
|
|
345143
|
+
year: number;
|
|
345144
|
+
/**
|
|
345145
|
+
* @description Precio de venta publicado, en pesos. Obligatorio.
|
|
345146
|
+
* @example 8990000
|
|
345147
|
+
*/
|
|
345148
|
+
price_amount: number;
|
|
345149
|
+
/**
|
|
345150
|
+
* @description Tipo de vehículo. Por defecto `auto`.
|
|
345151
|
+
* @enum {string}
|
|
345152
|
+
*/
|
|
345153
|
+
vehicle_type?: "auto" | "camion" | "maquinaria" | "nautico" | "moto";
|
|
345154
|
+
};
|
|
345155
|
+
/** @description Un dueño nuevo. Uno de `owner_contact_id` o `owner`. */
|
|
345156
|
+
TakeConsignmentOwner: {
|
|
345157
|
+
/** @example Rosa Pérez */
|
|
345158
|
+
name: string;
|
|
345159
|
+
/** @description RUT del dueño, opcional. Sin RUT el contrato imprime una línea en blanco. */
|
|
345160
|
+
tax_id?: string | null;
|
|
345161
|
+
phone?: string | null;
|
|
345162
|
+
/** @description Calle y número, opcional. Necesita `comuna_code` (una dirección sin comuna no se guarda). */
|
|
345163
|
+
address_street?: string | null;
|
|
345164
|
+
comuna_code?: string | null;
|
|
345165
|
+
};
|
|
343557
345166
|
AdOrigin: {
|
|
343558
345167
|
/**
|
|
343559
345168
|
* @description Where the thread lives — the conversation channel.
|