@vitrina/api 17.87.0 → 17.89.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 +173 -13
- package/dist/index.d.ts +173 -13
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -44132,6 +44132,8 @@ interface paths {
|
|
|
44132
44132
|
*
|
|
44133
44133
|
* It also carries the unit it bought, the same as each row of the list: `vehicle` is `{ id, make, model, year, registration_number }` or `null`, and `vehicle_count` says how many units the document acquired (`vehicle` is the FIRST of them when there are several, and `null` exactly when the count is `0`).
|
|
44134
44134
|
*
|
|
44135
|
+
* Since vitrina-app#7723 it also carries what the «Modificar» form opens with: `acquisition` (the car’s cost under this note, with `invoice_includes_iva` and `amount_paid_clp`, or `null`) and `retentions` (the note’s live «Descuentos», each with `description` and `net_clp`).
|
|
44136
|
+
*
|
|
44135
44137
|
* A document belonging to another workspace is a 404, indistinguishable from one that does not exist.
|
|
44136
44138
|
*/
|
|
44137
44139
|
get: {
|
|
@@ -44181,7 +44183,42 @@ interface paths {
|
|
|
44181
44183
|
* "year": 2020,
|
|
44182
44184
|
* "registration_number": "KXPT21"
|
|
44183
44185
|
* },
|
|
44184
|
-
* "vehicle_count": 1
|
|
44186
|
+
* "vehicle_count": 1,
|
|
44187
|
+
* "acquisition": {
|
|
44188
|
+
* "id": "7b0e1c52-3a1f-4d8e-9c2a-5f6b7c8d9e01",
|
|
44189
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
44190
|
+
* "vehicle_id": "e1e1e1e1-0000-4000-8000-000000000001",
|
|
44191
|
+
* "kind": "compra",
|
|
44192
|
+
* "counterparty_contact_id": "22222222-0000-4000-8000-000000000003",
|
|
44193
|
+
* "acquired_on": "2026-09-12",
|
|
44194
|
+
* "purchase_note_id": "d5d5d5d5-0000-4000-8000-000000000001",
|
|
44195
|
+
* "consignment_contract_id": null,
|
|
44196
|
+
* "sale_note_id": null,
|
|
44197
|
+
* "net_clp": 6020000,
|
|
44198
|
+
* "tax_clp": null,
|
|
44199
|
+
* "tax_treatment": "no_gravado",
|
|
44200
|
+
* "borne_by": "automotora",
|
|
44201
|
+
* "generates_fiscal_credit": false,
|
|
44202
|
+
* "created_at": "2026-09-12T10:15:00.000Z",
|
|
44203
|
+
* "updated_at": "2026-09-12T10:15:00.000Z",
|
|
44204
|
+
* "invoice_includes_iva": false,
|
|
44205
|
+
* "amount_paid_clp": 6020000
|
|
44206
|
+
* },
|
|
44207
|
+
* "retentions": [
|
|
44208
|
+
* {
|
|
44209
|
+
* "id": "9c1d2e3f-4a5b-4c6d-8e7f-0a1b2c3d4e5f",
|
|
44210
|
+
* "vehicle_id": "e1e1e1e1-0000-4000-8000-000000000001",
|
|
44211
|
+
* "kind": "expense",
|
|
44212
|
+
* "description": "Multas",
|
|
44213
|
+
* "net_clp": 180000,
|
|
44214
|
+
* "tax_clp": null,
|
|
44215
|
+
* "tax_treatment": "no_gravado",
|
|
44216
|
+
* "incurred_on": "2026-09-12",
|
|
44217
|
+
* "purchase_note_id": "d5d5d5d5-0000-4000-8000-000000000001",
|
|
44218
|
+
* "retained": true,
|
|
44219
|
+
* "voided_at": null
|
|
44220
|
+
* }
|
|
44221
|
+
* ]
|
|
44185
44222
|
* }
|
|
44186
44223
|
* }
|
|
44187
44224
|
*/
|
|
@@ -44255,8 +44292,10 @@ interface paths {
|
|
|
44255
44292
|
options?: never;
|
|
44256
44293
|
head?: never;
|
|
44257
44294
|
/**
|
|
44258
|
-
*
|
|
44259
|
-
* @description
|
|
44295
|
+
* Modify a nota de compra
|
|
44296
|
+
* @description **Everything is editable until the note is voided** (vitrina-app#7723): seller, car, price, date, «Descuentos», forma de pago, observaciones and the «Compra con factura (incluye IVA)» tick. **The car’s cost follows in the same write**: the acquisition takes the new payout (price − Descuentos), the seller, the day and the tax split; `acquisition.retentions` replaces the Descuentos (the old cost lines are voided, never edited); `acquisition.vehicle_id` moves the cost and the Descuentos to another car (the old one is left without a cost). Send `invoice_includes_iva` on every save of the form. The answer is the note as `GET` returns it plus `previous` (what it said before); every change is also an audit-log row with who and when. Refusals (`error.details.code`): `purchase_note_voided` (409), `discounts_exceed_price` (400), `vehicle_has_documented_cost` (409), `vehicle_sold_by_other_seller` (409), `purchase_note_has_several_cars` (409, a legacy note that bought several cars: price, tick, car or Descuentos), `purchase_note_changed_meanwhile` (409).
|
|
44297
|
+
*
|
|
44298
|
+
* Corrects a LIVE document and **stamps it**: `corrected_at` and the acting principal are written onto the row, so a reader of the document can tell it has been changed since it was issued without joining an audit table. The folio and the status are never touched.
|
|
44260
44299
|
*
|
|
44261
44300
|
* **An ABSENT field is left alone; an explicit `null` CLEARS it.** On `tax_clp` that is the difference between "not recorded" and "no tax", which ADR 0058 §2 keeps apart — so correcting away an amount entered by mistake is expressible without being confused with zero.
|
|
44262
44301
|
*
|
|
@@ -44279,7 +44318,16 @@ interface paths {
|
|
|
44279
44318
|
content: {
|
|
44280
44319
|
/**
|
|
44281
44320
|
* @example {
|
|
44282
|
-
* "net_clp": 6150000
|
|
44321
|
+
* "net_clp": 6150000,
|
|
44322
|
+
* "invoice_includes_iva": false,
|
|
44323
|
+
* "acquisition": {
|
|
44324
|
+
* "retentions": [
|
|
44325
|
+
* {
|
|
44326
|
+
* "description": "Multas",
|
|
44327
|
+
* "net_clp": 180000
|
|
44328
|
+
* }
|
|
44329
|
+
* ]
|
|
44330
|
+
* }
|
|
44283
44331
|
* }
|
|
44284
44332
|
*/
|
|
44285
44333
|
"application/json": {
|
|
@@ -44304,6 +44352,30 @@ interface paths {
|
|
|
44304
44352
|
/** @enum {string} */
|
|
44305
44353
|
tax_treatment: "afecto" | "exento" | "no_gravado" | "pass_through";
|
|
44306
44354
|
}[];
|
|
44355
|
+
/** @description «Compra con factura (incluye IVA)». Mándalo en cada guardado del formulario. true: `net_clp` (o el precio actual si no viene) incluye IVA y se separa como al emitir. false: el precio completo es el costo, sin IVA aparte. Sin el campo, `net_clp` es el precio sin IVA y los campos de impuesto quedan como se indiquen. */
|
|
44356
|
+
invoice_includes_iva?: boolean;
|
|
44357
|
+
acquisition?: {
|
|
44358
|
+
/**
|
|
44359
|
+
* Format: uuid
|
|
44360
|
+
* @description Otro auto para la nota. Su costo y sus descuentos pasan a ese auto; el auto anterior queda sin costo de compra. Sin el campo, el auto no cambia.
|
|
44361
|
+
*/
|
|
44362
|
+
vehicle_id?: string;
|
|
44363
|
+
/** @description Los «Descuentos» pasan a ser exactamente esta lista (`[]` = ninguno). Sin el campo, no cambian. */
|
|
44364
|
+
retentions?: {
|
|
44365
|
+
/** @description Qué se descuenta («Multas», «Prenda», «Permiso de circulación»), hasta 200 caracteres. Se imprime en la nota de compra. */
|
|
44366
|
+
description?: string | null;
|
|
44367
|
+
/** Format: uuid */
|
|
44368
|
+
category_id?: string;
|
|
44369
|
+
net_clp: number;
|
|
44370
|
+
tax_clp?: number | null;
|
|
44371
|
+
/** @enum {string} */
|
|
44372
|
+
tax_treatment?: "afecto" | "exento" | "no_gravado" | "pass_through";
|
|
44373
|
+
incurred_on?: string | null;
|
|
44374
|
+
/** Format: uuid */
|
|
44375
|
+
supplier_contact_id?: string | null;
|
|
44376
|
+
document_ref?: string | null;
|
|
44377
|
+
}[];
|
|
44378
|
+
};
|
|
44307
44379
|
};
|
|
44308
44380
|
};
|
|
44309
44381
|
};
|
|
@@ -44336,7 +44408,57 @@ interface paths {
|
|
|
44336
44408
|
* "void_reason": null,
|
|
44337
44409
|
* "voided_by": null,
|
|
44338
44410
|
* "created_at": "2026-09-12T10:15:00.000Z",
|
|
44339
|
-
* "updated_at": "2026-09-12T10:15:00.000Z"
|
|
44411
|
+
* "updated_at": "2026-09-12T10:15:00.000Z",
|
|
44412
|
+
* "lines": [],
|
|
44413
|
+
* "vehicle": {
|
|
44414
|
+
* "id": "e1e1e1e1-0000-4000-8000-000000000001",
|
|
44415
|
+
* "make": "Mazda",
|
|
44416
|
+
* "model": "CX-5",
|
|
44417
|
+
* "year": 2020,
|
|
44418
|
+
* "registration_number": "KXPT21"
|
|
44419
|
+
* },
|
|
44420
|
+
* "vehicle_count": 1,
|
|
44421
|
+
* "acquisition": {
|
|
44422
|
+
* "id": "7b0e1c52-3a1f-4d8e-9c2a-5f6b7c8d9e01",
|
|
44423
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
44424
|
+
* "vehicle_id": "e1e1e1e1-0000-4000-8000-000000000001",
|
|
44425
|
+
* "kind": "compra",
|
|
44426
|
+
* "counterparty_contact_id": "22222222-0000-4000-8000-000000000003",
|
|
44427
|
+
* "acquired_on": "2026-09-12",
|
|
44428
|
+
* "purchase_note_id": "d5d5d5d5-0000-4000-8000-000000000001",
|
|
44429
|
+
* "consignment_contract_id": null,
|
|
44430
|
+
* "sale_note_id": null,
|
|
44431
|
+
* "net_clp": 5970000,
|
|
44432
|
+
* "tax_clp": null,
|
|
44433
|
+
* "tax_treatment": "no_gravado",
|
|
44434
|
+
* "borne_by": "automotora",
|
|
44435
|
+
* "generates_fiscal_credit": false,
|
|
44436
|
+
* "created_at": "2026-09-12T10:15:00.000Z",
|
|
44437
|
+
* "updated_at": "2026-09-12T10:15:00.000Z",
|
|
44438
|
+
* "invoice_includes_iva": false,
|
|
44439
|
+
* "amount_paid_clp": 5970000
|
|
44440
|
+
* },
|
|
44441
|
+
* "retentions": [
|
|
44442
|
+
* {
|
|
44443
|
+
* "id": "9c1d2e3f-4a5b-4c6d-8e7f-0a1b2c3d4e5f",
|
|
44444
|
+
* "vehicle_id": "e1e1e1e1-0000-4000-8000-000000000001",
|
|
44445
|
+
* "kind": "expense",
|
|
44446
|
+
* "description": "Multas",
|
|
44447
|
+
* "net_clp": 180000,
|
|
44448
|
+
* "tax_clp": null,
|
|
44449
|
+
* "tax_treatment": "no_gravado",
|
|
44450
|
+
* "incurred_on": "2026-09-12",
|
|
44451
|
+
* "purchase_note_id": "d5d5d5d5-0000-4000-8000-000000000001",
|
|
44452
|
+
* "retained": true,
|
|
44453
|
+
* "voided_at": null
|
|
44454
|
+
* }
|
|
44455
|
+
* ],
|
|
44456
|
+
* "previous": {
|
|
44457
|
+
* "net_clp": 6200000,
|
|
44458
|
+
* "tax_clp": null,
|
|
44459
|
+
* "vehicle_id": "e1e1e1e1-0000-4000-8000-000000000001",
|
|
44460
|
+
* "discounts_clp": 180000
|
|
44461
|
+
* }
|
|
44340
44462
|
* }
|
|
44341
44463
|
* }
|
|
44342
44464
|
*/
|
|
@@ -44518,6 +44640,8 @@ interface paths {
|
|
|
44518
44640
|
*
|
|
44519
44641
|
* The actor comes from the authenticated principal; a `voided_by` in the body is IGNORED rather than rejected — a self-declared actor is not an attestation. Voiding twice is a **409**: the first actor and reason stand.
|
|
44520
44642
|
*
|
|
44643
|
+
* **The car keeps its cost** (vitrina-app#7723): in the same transaction each car the note bought keeps the note’s total (payout + «Descuentos») as a plain Costo de compra, no longer linked to the note, and the Descuentos stop counting apart. That cost can then be corrected by typing it (`POST /vehicle-acquisitions`) or taken over by a new nota de compra. `void_outcome` says what happened per car, and `void_outcome.message` is ready to show as is. Voiding a voided note is a 409 `purchase_note_voided`.
|
|
44644
|
+
*
|
|
44521
44645
|
* Requires `purchase_notes:void`, which is a DIFFERENT authority from `purchase_notes:write` — holding the write scope does not permit a void.
|
|
44522
44646
|
*/
|
|
44523
44647
|
post: {
|
|
@@ -44573,7 +44697,20 @@ interface paths {
|
|
|
44573
44697
|
* "void_reason": "se anuló la compra: el vendedor desistió antes de firmar",
|
|
44574
44698
|
* "voided_by": "11111111-0000-4000-8000-000000000001",
|
|
44575
44699
|
* "created_at": "2026-09-12T10:15:00.000Z",
|
|
44576
|
-
* "updated_at": "2026-09-12T10:15:00.000Z"
|
|
44700
|
+
* "updated_at": "2026-09-12T10:15:00.000Z",
|
|
44701
|
+
* "lines": [],
|
|
44702
|
+
* "void_outcome": {
|
|
44703
|
+
* "vehicles": [
|
|
44704
|
+
* {
|
|
44705
|
+
* "vehicle_id": "e1e1e1e1-0000-4000-8000-000000000001",
|
|
44706
|
+
* "acquisition_id": "7b0e1c52-3a1f-4d8e-9c2a-5f6b7c8d9e01",
|
|
44707
|
+
* "purchase_cost_clp": 6200000,
|
|
44708
|
+
* "invoice_includes_iva": false,
|
|
44709
|
+
* "discounts_clp": 180000
|
|
44710
|
+
* }
|
|
44711
|
+
* ],
|
|
44712
|
+
* "message": "Anulaste la nota de compra P-9. El Mazda CX-5 2020 (KXPT21) conserva su costo de compra de $6.200.000 como costo escrito a mano: puedes corregirlo en la ficha del auto o registrar una nota de compra nueva. Los descuentos de la nota ($180.000) ya no se cuentan aparte: quedan dentro de ese costo."
|
|
44713
|
+
* }
|
|
44577
44714
|
* }
|
|
44578
44715
|
* }
|
|
44579
44716
|
*/
|
|
@@ -156147,10 +156284,10 @@ interface paths {
|
|
|
156147
156284
|
direccion?: string | null;
|
|
156148
156285
|
ocupacion?: string | null;
|
|
156149
156286
|
/**
|
|
156150
|
-
* @description What `rut` holds. `
|
|
156287
|
+
* @description What `rut` holds (the column name is historical). `rut` (Chile), `curp` (Mexico), `cedula_co` (Colombia), `dni_ar` (Argentina), `dni_pe` (Peru) or `passport`. Default: the workspace country's own document when a document is given (`rut` in Chile; `GET /tenant/settings` → `locale_resolved.patient_document`). A country's own document must have its shape (400 `invalid_document`) and is compared by its digits (DNI, cédula) or letters and digits (CURP); a passport as typed.
|
|
156151
156288
|
* @enum {string|null}
|
|
156152
156289
|
*/
|
|
156153
|
-
document_kind?: "rut" | "passport" | null;
|
|
156290
|
+
document_kind?: "rut" | "curp" | "cedula_co" | "dni_ar" | "dni_pe" | "passport" | null;
|
|
156154
156291
|
emergency_contact_name?: string | null;
|
|
156155
156292
|
emergency_contact_phone?: string | null;
|
|
156156
156293
|
phone_secondary?: string | null;
|
|
@@ -312735,10 +312872,10 @@ interface paths {
|
|
|
312735
312872
|
direccion?: string | null;
|
|
312736
312873
|
ocupacion?: string | null;
|
|
312737
312874
|
/**
|
|
312738
|
-
* @description What `rut` holds. `
|
|
312875
|
+
* @description What `rut` holds (the column name is historical). `rut` (Chile), `curp` (Mexico), `cedula_co` (Colombia), `dni_ar` (Argentina), `dni_pe` (Peru) or `passport`. Default: the workspace country's own document when a document is given (`rut` in Chile; `GET /tenant/settings` → `locale_resolved.patient_document`). A country's own document must have its shape (400 `invalid_document`) and is compared by its digits (DNI, cédula) or letters and digits (CURP); a passport as typed.
|
|
312739
312876
|
* @enum {string|null}
|
|
312740
312877
|
*/
|
|
312741
|
-
document_kind?: "rut" | "passport" | null;
|
|
312878
|
+
document_kind?: "rut" | "curp" | "cedula_co" | "dni_ar" | "dni_pe" | "passport" | null;
|
|
312742
312879
|
emergency_contact_name?: string | null;
|
|
312743
312880
|
emergency_contact_phone?: string | null;
|
|
312744
312881
|
phone_secondary?: string | null;
|
|
@@ -312764,7 +312901,13 @@ interface paths {
|
|
|
312764
312901
|
name?: string | null;
|
|
312765
312902
|
phone?: string | null;
|
|
312766
312903
|
email?: string | null;
|
|
312904
|
+
/** @description The apoderado’s document (the field name is historical): the workspace country’s own document, or a passport with `document_kind: passport`. */
|
|
312767
312905
|
rut?: string | null;
|
|
312906
|
+
/**
|
|
312907
|
+
* @description What `rut` holds: the workspace country’s own document (the default) or `passport`.
|
|
312908
|
+
* @enum {string|null}
|
|
312909
|
+
*/
|
|
312910
|
+
document_kind?: "rut" | "curp" | "cedula_co" | "dni_ar" | "dni_pe" | "passport" | null;
|
|
312768
312911
|
phone_whatsapp?: boolean | null;
|
|
312769
312912
|
relation?: string | null;
|
|
312770
312913
|
} | null;
|
|
@@ -312894,6 +313037,7 @@ interface paths {
|
|
|
312894
313037
|
parameters: {
|
|
312895
313038
|
query: {
|
|
312896
313039
|
document: string;
|
|
313040
|
+
kind?: "rut" | "curp" | "cedula_co" | "dni_ar" | "dni_pe" | "passport";
|
|
312897
313041
|
passport?: "true" | "false";
|
|
312898
313042
|
};
|
|
312899
313043
|
header?: never;
|
|
@@ -313467,10 +313611,10 @@ interface paths {
|
|
|
313467
313611
|
direccion?: string | null;
|
|
313468
313612
|
ocupacion?: string | null;
|
|
313469
313613
|
/**
|
|
313470
|
-
* @description What `rut` holds. `
|
|
313614
|
+
* @description What `rut` holds (the column name is historical). `rut` (Chile), `curp` (Mexico), `cedula_co` (Colombia), `dni_ar` (Argentina), `dni_pe` (Peru) or `passport`. Default: the workspace country's own document when a document is given (`rut` in Chile; `GET /tenant/settings` → `locale_resolved.patient_document`). A country's own document must have its shape (400 `invalid_document`) and is compared by its digits (DNI, cédula) or letters and digits (CURP); a passport as typed.
|
|
313471
313615
|
* @enum {string|null}
|
|
313472
313616
|
*/
|
|
313473
|
-
document_kind?: "rut" | "passport" | null;
|
|
313617
|
+
document_kind?: "rut" | "curp" | "cedula_co" | "dni_ar" | "dni_pe" | "passport" | null;
|
|
313474
313618
|
emergency_contact_name?: string | null;
|
|
313475
313619
|
emergency_contact_phone?: string | null;
|
|
313476
313620
|
phone_secondary?: string | null;
|
|
@@ -313496,7 +313640,13 @@ interface paths {
|
|
|
313496
313640
|
name?: string | null;
|
|
313497
313641
|
phone?: string | null;
|
|
313498
313642
|
email?: string | null;
|
|
313643
|
+
/** @description The apoderado’s document (the field name is historical): the workspace country’s own document, or a passport with `document_kind: passport`. */
|
|
313499
313644
|
rut?: string | null;
|
|
313645
|
+
/**
|
|
313646
|
+
* @description What `rut` holds: the workspace country’s own document (the default) or `passport`.
|
|
313647
|
+
* @enum {string|null}
|
|
313648
|
+
*/
|
|
313649
|
+
document_kind?: "rut" | "curp" | "cedula_co" | "dni_ar" | "dni_pe" | "passport" | null;
|
|
313500
313650
|
phone_whatsapp?: boolean | null;
|
|
313501
313651
|
relation?: string | null;
|
|
313502
313652
|
} | null;
|
|
@@ -322559,6 +322709,16 @@ interface components {
|
|
|
322559
322709
|
timezone_source: "stored" | "country_default" | "legacy_guess";
|
|
322560
322710
|
/** @enum {string} */
|
|
322561
322711
|
currency_source: "stored" | "country_default" | "legacy_guess";
|
|
322712
|
+
/** @description The workspace country's main patient document (vitrina-app#7475); null where the country has none (patients give a passport). Every patient form reads this one spec. */
|
|
322713
|
+
patient_document?: {
|
|
322714
|
+
/** @enum {string} */
|
|
322715
|
+
kind: "rut" | "curp" | "cedula_co" | "dni_ar" | "dni_pe";
|
|
322716
|
+
/** @description What a person calls it: «RUT», «DNI»… */
|
|
322717
|
+
label: string;
|
|
322718
|
+
placeholder: string;
|
|
322719
|
+
/** @description The accepted shape (an HTML/Meta `pattern`). */
|
|
322720
|
+
pattern: string | null;
|
|
322721
|
+
} | null;
|
|
322562
322722
|
};
|
|
322563
322723
|
/**
|
|
322564
322724
|
* @description Write-only secret: the Slack incoming-webhook URL is never returned. `••••` when one is configured; absent otherwise. Read `slack_webhook_configured` instead.
|
|
@@ -340954,7 +341114,7 @@ interface components {
|
|
|
340954
341114
|
min_chars?: number;
|
|
340955
341115
|
max_chars?: number;
|
|
340956
341116
|
/** @enum {string} */
|
|
340957
|
-
preset?: "email" | "phone" | "rut" | "cpf" | "dni_ar" | "dni_pe" | "patente";
|
|
341117
|
+
preset?: "email" | "phone" | "rut" | "cpf" | "dni_ar" | "dni_pe" | "curp" | "cedula_co" | "patente";
|
|
340958
341118
|
visible_when?: components["schemas"]["WhatsappFlowCondition"];
|
|
340959
341119
|
required_when?: components["schemas"]["WhatsappFlowCondition"];
|
|
340960
341120
|
sensitive?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -44132,6 +44132,8 @@ interface paths {
|
|
|
44132
44132
|
*
|
|
44133
44133
|
* It also carries the unit it bought, the same as each row of the list: `vehicle` is `{ id, make, model, year, registration_number }` or `null`, and `vehicle_count` says how many units the document acquired (`vehicle` is the FIRST of them when there are several, and `null` exactly when the count is `0`).
|
|
44134
44134
|
*
|
|
44135
|
+
* Since vitrina-app#7723 it also carries what the «Modificar» form opens with: `acquisition` (the car’s cost under this note, with `invoice_includes_iva` and `amount_paid_clp`, or `null`) and `retentions` (the note’s live «Descuentos», each with `description` and `net_clp`).
|
|
44136
|
+
*
|
|
44135
44137
|
* A document belonging to another workspace is a 404, indistinguishable from one that does not exist.
|
|
44136
44138
|
*/
|
|
44137
44139
|
get: {
|
|
@@ -44181,7 +44183,42 @@ interface paths {
|
|
|
44181
44183
|
* "year": 2020,
|
|
44182
44184
|
* "registration_number": "KXPT21"
|
|
44183
44185
|
* },
|
|
44184
|
-
* "vehicle_count": 1
|
|
44186
|
+
* "vehicle_count": 1,
|
|
44187
|
+
* "acquisition": {
|
|
44188
|
+
* "id": "7b0e1c52-3a1f-4d8e-9c2a-5f6b7c8d9e01",
|
|
44189
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
44190
|
+
* "vehicle_id": "e1e1e1e1-0000-4000-8000-000000000001",
|
|
44191
|
+
* "kind": "compra",
|
|
44192
|
+
* "counterparty_contact_id": "22222222-0000-4000-8000-000000000003",
|
|
44193
|
+
* "acquired_on": "2026-09-12",
|
|
44194
|
+
* "purchase_note_id": "d5d5d5d5-0000-4000-8000-000000000001",
|
|
44195
|
+
* "consignment_contract_id": null,
|
|
44196
|
+
* "sale_note_id": null,
|
|
44197
|
+
* "net_clp": 6020000,
|
|
44198
|
+
* "tax_clp": null,
|
|
44199
|
+
* "tax_treatment": "no_gravado",
|
|
44200
|
+
* "borne_by": "automotora",
|
|
44201
|
+
* "generates_fiscal_credit": false,
|
|
44202
|
+
* "created_at": "2026-09-12T10:15:00.000Z",
|
|
44203
|
+
* "updated_at": "2026-09-12T10:15:00.000Z",
|
|
44204
|
+
* "invoice_includes_iva": false,
|
|
44205
|
+
* "amount_paid_clp": 6020000
|
|
44206
|
+
* },
|
|
44207
|
+
* "retentions": [
|
|
44208
|
+
* {
|
|
44209
|
+
* "id": "9c1d2e3f-4a5b-4c6d-8e7f-0a1b2c3d4e5f",
|
|
44210
|
+
* "vehicle_id": "e1e1e1e1-0000-4000-8000-000000000001",
|
|
44211
|
+
* "kind": "expense",
|
|
44212
|
+
* "description": "Multas",
|
|
44213
|
+
* "net_clp": 180000,
|
|
44214
|
+
* "tax_clp": null,
|
|
44215
|
+
* "tax_treatment": "no_gravado",
|
|
44216
|
+
* "incurred_on": "2026-09-12",
|
|
44217
|
+
* "purchase_note_id": "d5d5d5d5-0000-4000-8000-000000000001",
|
|
44218
|
+
* "retained": true,
|
|
44219
|
+
* "voided_at": null
|
|
44220
|
+
* }
|
|
44221
|
+
* ]
|
|
44185
44222
|
* }
|
|
44186
44223
|
* }
|
|
44187
44224
|
*/
|
|
@@ -44255,8 +44292,10 @@ interface paths {
|
|
|
44255
44292
|
options?: never;
|
|
44256
44293
|
head?: never;
|
|
44257
44294
|
/**
|
|
44258
|
-
*
|
|
44259
|
-
* @description
|
|
44295
|
+
* Modify a nota de compra
|
|
44296
|
+
* @description **Everything is editable until the note is voided** (vitrina-app#7723): seller, car, price, date, «Descuentos», forma de pago, observaciones and the «Compra con factura (incluye IVA)» tick. **The car’s cost follows in the same write**: the acquisition takes the new payout (price − Descuentos), the seller, the day and the tax split; `acquisition.retentions` replaces the Descuentos (the old cost lines are voided, never edited); `acquisition.vehicle_id` moves the cost and the Descuentos to another car (the old one is left without a cost). Send `invoice_includes_iva` on every save of the form. The answer is the note as `GET` returns it plus `previous` (what it said before); every change is also an audit-log row with who and when. Refusals (`error.details.code`): `purchase_note_voided` (409), `discounts_exceed_price` (400), `vehicle_has_documented_cost` (409), `vehicle_sold_by_other_seller` (409), `purchase_note_has_several_cars` (409, a legacy note that bought several cars: price, tick, car or Descuentos), `purchase_note_changed_meanwhile` (409).
|
|
44297
|
+
*
|
|
44298
|
+
* Corrects a LIVE document and **stamps it**: `corrected_at` and the acting principal are written onto the row, so a reader of the document can tell it has been changed since it was issued without joining an audit table. The folio and the status are never touched.
|
|
44260
44299
|
*
|
|
44261
44300
|
* **An ABSENT field is left alone; an explicit `null` CLEARS it.** On `tax_clp` that is the difference between "not recorded" and "no tax", which ADR 0058 §2 keeps apart — so correcting away an amount entered by mistake is expressible without being confused with zero.
|
|
44262
44301
|
*
|
|
@@ -44279,7 +44318,16 @@ interface paths {
|
|
|
44279
44318
|
content: {
|
|
44280
44319
|
/**
|
|
44281
44320
|
* @example {
|
|
44282
|
-
* "net_clp": 6150000
|
|
44321
|
+
* "net_clp": 6150000,
|
|
44322
|
+
* "invoice_includes_iva": false,
|
|
44323
|
+
* "acquisition": {
|
|
44324
|
+
* "retentions": [
|
|
44325
|
+
* {
|
|
44326
|
+
* "description": "Multas",
|
|
44327
|
+
* "net_clp": 180000
|
|
44328
|
+
* }
|
|
44329
|
+
* ]
|
|
44330
|
+
* }
|
|
44283
44331
|
* }
|
|
44284
44332
|
*/
|
|
44285
44333
|
"application/json": {
|
|
@@ -44304,6 +44352,30 @@ interface paths {
|
|
|
44304
44352
|
/** @enum {string} */
|
|
44305
44353
|
tax_treatment: "afecto" | "exento" | "no_gravado" | "pass_through";
|
|
44306
44354
|
}[];
|
|
44355
|
+
/** @description «Compra con factura (incluye IVA)». Mándalo en cada guardado del formulario. true: `net_clp` (o el precio actual si no viene) incluye IVA y se separa como al emitir. false: el precio completo es el costo, sin IVA aparte. Sin el campo, `net_clp` es el precio sin IVA y los campos de impuesto quedan como se indiquen. */
|
|
44356
|
+
invoice_includes_iva?: boolean;
|
|
44357
|
+
acquisition?: {
|
|
44358
|
+
/**
|
|
44359
|
+
* Format: uuid
|
|
44360
|
+
* @description Otro auto para la nota. Su costo y sus descuentos pasan a ese auto; el auto anterior queda sin costo de compra. Sin el campo, el auto no cambia.
|
|
44361
|
+
*/
|
|
44362
|
+
vehicle_id?: string;
|
|
44363
|
+
/** @description Los «Descuentos» pasan a ser exactamente esta lista (`[]` = ninguno). Sin el campo, no cambian. */
|
|
44364
|
+
retentions?: {
|
|
44365
|
+
/** @description Qué se descuenta («Multas», «Prenda», «Permiso de circulación»), hasta 200 caracteres. Se imprime en la nota de compra. */
|
|
44366
|
+
description?: string | null;
|
|
44367
|
+
/** Format: uuid */
|
|
44368
|
+
category_id?: string;
|
|
44369
|
+
net_clp: number;
|
|
44370
|
+
tax_clp?: number | null;
|
|
44371
|
+
/** @enum {string} */
|
|
44372
|
+
tax_treatment?: "afecto" | "exento" | "no_gravado" | "pass_through";
|
|
44373
|
+
incurred_on?: string | null;
|
|
44374
|
+
/** Format: uuid */
|
|
44375
|
+
supplier_contact_id?: string | null;
|
|
44376
|
+
document_ref?: string | null;
|
|
44377
|
+
}[];
|
|
44378
|
+
};
|
|
44307
44379
|
};
|
|
44308
44380
|
};
|
|
44309
44381
|
};
|
|
@@ -44336,7 +44408,57 @@ interface paths {
|
|
|
44336
44408
|
* "void_reason": null,
|
|
44337
44409
|
* "voided_by": null,
|
|
44338
44410
|
* "created_at": "2026-09-12T10:15:00.000Z",
|
|
44339
|
-
* "updated_at": "2026-09-12T10:15:00.000Z"
|
|
44411
|
+
* "updated_at": "2026-09-12T10:15:00.000Z",
|
|
44412
|
+
* "lines": [],
|
|
44413
|
+
* "vehicle": {
|
|
44414
|
+
* "id": "e1e1e1e1-0000-4000-8000-000000000001",
|
|
44415
|
+
* "make": "Mazda",
|
|
44416
|
+
* "model": "CX-5",
|
|
44417
|
+
* "year": 2020,
|
|
44418
|
+
* "registration_number": "KXPT21"
|
|
44419
|
+
* },
|
|
44420
|
+
* "vehicle_count": 1,
|
|
44421
|
+
* "acquisition": {
|
|
44422
|
+
* "id": "7b0e1c52-3a1f-4d8e-9c2a-5f6b7c8d9e01",
|
|
44423
|
+
* "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
|
|
44424
|
+
* "vehicle_id": "e1e1e1e1-0000-4000-8000-000000000001",
|
|
44425
|
+
* "kind": "compra",
|
|
44426
|
+
* "counterparty_contact_id": "22222222-0000-4000-8000-000000000003",
|
|
44427
|
+
* "acquired_on": "2026-09-12",
|
|
44428
|
+
* "purchase_note_id": "d5d5d5d5-0000-4000-8000-000000000001",
|
|
44429
|
+
* "consignment_contract_id": null,
|
|
44430
|
+
* "sale_note_id": null,
|
|
44431
|
+
* "net_clp": 5970000,
|
|
44432
|
+
* "tax_clp": null,
|
|
44433
|
+
* "tax_treatment": "no_gravado",
|
|
44434
|
+
* "borne_by": "automotora",
|
|
44435
|
+
* "generates_fiscal_credit": false,
|
|
44436
|
+
* "created_at": "2026-09-12T10:15:00.000Z",
|
|
44437
|
+
* "updated_at": "2026-09-12T10:15:00.000Z",
|
|
44438
|
+
* "invoice_includes_iva": false,
|
|
44439
|
+
* "amount_paid_clp": 5970000
|
|
44440
|
+
* },
|
|
44441
|
+
* "retentions": [
|
|
44442
|
+
* {
|
|
44443
|
+
* "id": "9c1d2e3f-4a5b-4c6d-8e7f-0a1b2c3d4e5f",
|
|
44444
|
+
* "vehicle_id": "e1e1e1e1-0000-4000-8000-000000000001",
|
|
44445
|
+
* "kind": "expense",
|
|
44446
|
+
* "description": "Multas",
|
|
44447
|
+
* "net_clp": 180000,
|
|
44448
|
+
* "tax_clp": null,
|
|
44449
|
+
* "tax_treatment": "no_gravado",
|
|
44450
|
+
* "incurred_on": "2026-09-12",
|
|
44451
|
+
* "purchase_note_id": "d5d5d5d5-0000-4000-8000-000000000001",
|
|
44452
|
+
* "retained": true,
|
|
44453
|
+
* "voided_at": null
|
|
44454
|
+
* }
|
|
44455
|
+
* ],
|
|
44456
|
+
* "previous": {
|
|
44457
|
+
* "net_clp": 6200000,
|
|
44458
|
+
* "tax_clp": null,
|
|
44459
|
+
* "vehicle_id": "e1e1e1e1-0000-4000-8000-000000000001",
|
|
44460
|
+
* "discounts_clp": 180000
|
|
44461
|
+
* }
|
|
44340
44462
|
* }
|
|
44341
44463
|
* }
|
|
44342
44464
|
*/
|
|
@@ -44518,6 +44640,8 @@ interface paths {
|
|
|
44518
44640
|
*
|
|
44519
44641
|
* The actor comes from the authenticated principal; a `voided_by` in the body is IGNORED rather than rejected — a self-declared actor is not an attestation. Voiding twice is a **409**: the first actor and reason stand.
|
|
44520
44642
|
*
|
|
44643
|
+
* **The car keeps its cost** (vitrina-app#7723): in the same transaction each car the note bought keeps the note’s total (payout + «Descuentos») as a plain Costo de compra, no longer linked to the note, and the Descuentos stop counting apart. That cost can then be corrected by typing it (`POST /vehicle-acquisitions`) or taken over by a new nota de compra. `void_outcome` says what happened per car, and `void_outcome.message` is ready to show as is. Voiding a voided note is a 409 `purchase_note_voided`.
|
|
44644
|
+
*
|
|
44521
44645
|
* Requires `purchase_notes:void`, which is a DIFFERENT authority from `purchase_notes:write` — holding the write scope does not permit a void.
|
|
44522
44646
|
*/
|
|
44523
44647
|
post: {
|
|
@@ -44573,7 +44697,20 @@ interface paths {
|
|
|
44573
44697
|
* "void_reason": "se anuló la compra: el vendedor desistió antes de firmar",
|
|
44574
44698
|
* "voided_by": "11111111-0000-4000-8000-000000000001",
|
|
44575
44699
|
* "created_at": "2026-09-12T10:15:00.000Z",
|
|
44576
|
-
* "updated_at": "2026-09-12T10:15:00.000Z"
|
|
44700
|
+
* "updated_at": "2026-09-12T10:15:00.000Z",
|
|
44701
|
+
* "lines": [],
|
|
44702
|
+
* "void_outcome": {
|
|
44703
|
+
* "vehicles": [
|
|
44704
|
+
* {
|
|
44705
|
+
* "vehicle_id": "e1e1e1e1-0000-4000-8000-000000000001",
|
|
44706
|
+
* "acquisition_id": "7b0e1c52-3a1f-4d8e-9c2a-5f6b7c8d9e01",
|
|
44707
|
+
* "purchase_cost_clp": 6200000,
|
|
44708
|
+
* "invoice_includes_iva": false,
|
|
44709
|
+
* "discounts_clp": 180000
|
|
44710
|
+
* }
|
|
44711
|
+
* ],
|
|
44712
|
+
* "message": "Anulaste la nota de compra P-9. El Mazda CX-5 2020 (KXPT21) conserva su costo de compra de $6.200.000 como costo escrito a mano: puedes corregirlo en la ficha del auto o registrar una nota de compra nueva. Los descuentos de la nota ($180.000) ya no se cuentan aparte: quedan dentro de ese costo."
|
|
44713
|
+
* }
|
|
44577
44714
|
* }
|
|
44578
44715
|
* }
|
|
44579
44716
|
*/
|
|
@@ -156147,10 +156284,10 @@ interface paths {
|
|
|
156147
156284
|
direccion?: string | null;
|
|
156148
156285
|
ocupacion?: string | null;
|
|
156149
156286
|
/**
|
|
156150
|
-
* @description What `rut` holds. `
|
|
156287
|
+
* @description What `rut` holds (the column name is historical). `rut` (Chile), `curp` (Mexico), `cedula_co` (Colombia), `dni_ar` (Argentina), `dni_pe` (Peru) or `passport`. Default: the workspace country's own document when a document is given (`rut` in Chile; `GET /tenant/settings` → `locale_resolved.patient_document`). A country's own document must have its shape (400 `invalid_document`) and is compared by its digits (DNI, cédula) or letters and digits (CURP); a passport as typed.
|
|
156151
156288
|
* @enum {string|null}
|
|
156152
156289
|
*/
|
|
156153
|
-
document_kind?: "rut" | "passport" | null;
|
|
156290
|
+
document_kind?: "rut" | "curp" | "cedula_co" | "dni_ar" | "dni_pe" | "passport" | null;
|
|
156154
156291
|
emergency_contact_name?: string | null;
|
|
156155
156292
|
emergency_contact_phone?: string | null;
|
|
156156
156293
|
phone_secondary?: string | null;
|
|
@@ -312735,10 +312872,10 @@ interface paths {
|
|
|
312735
312872
|
direccion?: string | null;
|
|
312736
312873
|
ocupacion?: string | null;
|
|
312737
312874
|
/**
|
|
312738
|
-
* @description What `rut` holds. `
|
|
312875
|
+
* @description What `rut` holds (the column name is historical). `rut` (Chile), `curp` (Mexico), `cedula_co` (Colombia), `dni_ar` (Argentina), `dni_pe` (Peru) or `passport`. Default: the workspace country's own document when a document is given (`rut` in Chile; `GET /tenant/settings` → `locale_resolved.patient_document`). A country's own document must have its shape (400 `invalid_document`) and is compared by its digits (DNI, cédula) or letters and digits (CURP); a passport as typed.
|
|
312739
312876
|
* @enum {string|null}
|
|
312740
312877
|
*/
|
|
312741
|
-
document_kind?: "rut" | "passport" | null;
|
|
312878
|
+
document_kind?: "rut" | "curp" | "cedula_co" | "dni_ar" | "dni_pe" | "passport" | null;
|
|
312742
312879
|
emergency_contact_name?: string | null;
|
|
312743
312880
|
emergency_contact_phone?: string | null;
|
|
312744
312881
|
phone_secondary?: string | null;
|
|
@@ -312764,7 +312901,13 @@ interface paths {
|
|
|
312764
312901
|
name?: string | null;
|
|
312765
312902
|
phone?: string | null;
|
|
312766
312903
|
email?: string | null;
|
|
312904
|
+
/** @description The apoderado’s document (the field name is historical): the workspace country’s own document, or a passport with `document_kind: passport`. */
|
|
312767
312905
|
rut?: string | null;
|
|
312906
|
+
/**
|
|
312907
|
+
* @description What `rut` holds: the workspace country’s own document (the default) or `passport`.
|
|
312908
|
+
* @enum {string|null}
|
|
312909
|
+
*/
|
|
312910
|
+
document_kind?: "rut" | "curp" | "cedula_co" | "dni_ar" | "dni_pe" | "passport" | null;
|
|
312768
312911
|
phone_whatsapp?: boolean | null;
|
|
312769
312912
|
relation?: string | null;
|
|
312770
312913
|
} | null;
|
|
@@ -312894,6 +313037,7 @@ interface paths {
|
|
|
312894
313037
|
parameters: {
|
|
312895
313038
|
query: {
|
|
312896
313039
|
document: string;
|
|
313040
|
+
kind?: "rut" | "curp" | "cedula_co" | "dni_ar" | "dni_pe" | "passport";
|
|
312897
313041
|
passport?: "true" | "false";
|
|
312898
313042
|
};
|
|
312899
313043
|
header?: never;
|
|
@@ -313467,10 +313611,10 @@ interface paths {
|
|
|
313467
313611
|
direccion?: string | null;
|
|
313468
313612
|
ocupacion?: string | null;
|
|
313469
313613
|
/**
|
|
313470
|
-
* @description What `rut` holds. `
|
|
313614
|
+
* @description What `rut` holds (the column name is historical). `rut` (Chile), `curp` (Mexico), `cedula_co` (Colombia), `dni_ar` (Argentina), `dni_pe` (Peru) or `passport`. Default: the workspace country's own document when a document is given (`rut` in Chile; `GET /tenant/settings` → `locale_resolved.patient_document`). A country's own document must have its shape (400 `invalid_document`) and is compared by its digits (DNI, cédula) or letters and digits (CURP); a passport as typed.
|
|
313471
313615
|
* @enum {string|null}
|
|
313472
313616
|
*/
|
|
313473
|
-
document_kind?: "rut" | "passport" | null;
|
|
313617
|
+
document_kind?: "rut" | "curp" | "cedula_co" | "dni_ar" | "dni_pe" | "passport" | null;
|
|
313474
313618
|
emergency_contact_name?: string | null;
|
|
313475
313619
|
emergency_contact_phone?: string | null;
|
|
313476
313620
|
phone_secondary?: string | null;
|
|
@@ -313496,7 +313640,13 @@ interface paths {
|
|
|
313496
313640
|
name?: string | null;
|
|
313497
313641
|
phone?: string | null;
|
|
313498
313642
|
email?: string | null;
|
|
313643
|
+
/** @description The apoderado’s document (the field name is historical): the workspace country’s own document, or a passport with `document_kind: passport`. */
|
|
313499
313644
|
rut?: string | null;
|
|
313645
|
+
/**
|
|
313646
|
+
* @description What `rut` holds: the workspace country’s own document (the default) or `passport`.
|
|
313647
|
+
* @enum {string|null}
|
|
313648
|
+
*/
|
|
313649
|
+
document_kind?: "rut" | "curp" | "cedula_co" | "dni_ar" | "dni_pe" | "passport" | null;
|
|
313500
313650
|
phone_whatsapp?: boolean | null;
|
|
313501
313651
|
relation?: string | null;
|
|
313502
313652
|
} | null;
|
|
@@ -322559,6 +322709,16 @@ interface components {
|
|
|
322559
322709
|
timezone_source: "stored" | "country_default" | "legacy_guess";
|
|
322560
322710
|
/** @enum {string} */
|
|
322561
322711
|
currency_source: "stored" | "country_default" | "legacy_guess";
|
|
322712
|
+
/** @description The workspace country's main patient document (vitrina-app#7475); null where the country has none (patients give a passport). Every patient form reads this one spec. */
|
|
322713
|
+
patient_document?: {
|
|
322714
|
+
/** @enum {string} */
|
|
322715
|
+
kind: "rut" | "curp" | "cedula_co" | "dni_ar" | "dni_pe";
|
|
322716
|
+
/** @description What a person calls it: «RUT», «DNI»… */
|
|
322717
|
+
label: string;
|
|
322718
|
+
placeholder: string;
|
|
322719
|
+
/** @description The accepted shape (an HTML/Meta `pattern`). */
|
|
322720
|
+
pattern: string | null;
|
|
322721
|
+
} | null;
|
|
322562
322722
|
};
|
|
322563
322723
|
/**
|
|
322564
322724
|
* @description Write-only secret: the Slack incoming-webhook URL is never returned. `••••` when one is configured; absent otherwise. Read `slack_webhook_configured` instead.
|
|
@@ -340954,7 +341114,7 @@ interface components {
|
|
|
340954
341114
|
min_chars?: number;
|
|
340955
341115
|
max_chars?: number;
|
|
340956
341116
|
/** @enum {string} */
|
|
340957
|
-
preset?: "email" | "phone" | "rut" | "cpf" | "dni_ar" | "dni_pe" | "patente";
|
|
341117
|
+
preset?: "email" | "phone" | "rut" | "cpf" | "dni_ar" | "dni_pe" | "curp" | "cedula_co" | "patente";
|
|
340958
341118
|
visible_when?: components["schemas"]["WhatsappFlowCondition"];
|
|
340959
341119
|
required_when?: components["schemas"]["WhatsappFlowCondition"];
|
|
340960
341120
|
sensitive?: boolean;
|
package/package.json
CHANGED