@vitrina/api 17.45.0 → 17.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -38158,6 +38158,10 @@ interface paths {
38158
38158
  * **`credit` IS THE BROKERED FINANCING (ERP S9-7, BR-461–464)** — the financiera and the amount it is lending. ⚠ **It counts in the balance gate BEFORE the cash lands** (BR-463: *"the sale is funded even though the cash is not in"*), which is what makes a FINANCED deal balance at the counter. ⚠ **It is not a payment and has no `instrument`**: `credito` is deliberately absent from the `customer_payment` instrument vocabulary (BR-264/BR-450/BR-1010), so it is BR-418’s own term and never a payment row. `institution` is the credit’s identity on the document (BR-464) and is required; `application_number` is internal. There is no vehicle and no client field — BR-461’s pair is this note’s, already fixed.
38159
38159
  *
38160
38160
  * Omitting `credit` is the **ordinary case even for a financed deal**: the dealership records financing as part of closing, after the fact (112 credits taken against 0 sent in the recovered system), through `PUT /sale-notes/{id}/credit`. The note reads `short` in between, with the gap stated.
38161
+ *
38162
+ * **`approve: true` IS «EMITIR Y APROBAR» (app#7316)** — the note is issued and then approved in the same request, as the caller (car sold, deal won, post-sale obligations opened). At or above the floor it approves for anyone who can issue; below the floor only for a caller holding `price_approval:approve`. Otherwise the note STAYS ISSUED (never half-approved) and the 201 says why under `approval: { approved, reason, message, price_approval_id }` — `reason` = `price_approval_required` (a price approval was filed into the queue; `price_approval_id` names it) or `approval_refused` (any other approval rule: the car was sold by another note, the deal’s board, the mandato…; `message` is the Spanish reason). `approval` is present only when `approve` was sent. Omitted / `false` is «Solo emitir»: today’s behaviour. `approve` with `approved_by`/`approved_at` is a 400.
38163
+ *
38164
+ * **`registered_owner: { name, tax_id }`** is «compra para tercero» (app#7321): the person the car is registered to when it is not the buyer. Typed, no contact record; omitted / `null` = the buyer. Correct it later with `PUT /sale-notes/{id}/registered-owner`.
38161
38165
  */
38162
38166
  post: {
38163
38167
  parameters: {
@@ -38237,6 +38241,8 @@ interface paths {
38237
38241
  credit_application_id?: string | null;
38238
38242
  } | null;
38239
38243
  carry_reservation_abono?: boolean;
38244
+ approve?: boolean;
38245
+ registered_owner?: components["schemas"]["SaleNoteRegisteredOwnerInput"];
38240
38246
  };
38241
38247
  };
38242
38248
  };
@@ -38279,7 +38285,7 @@ interface paths {
38279
38285
  * }
38280
38286
  */
38281
38287
  "application/json": {
38282
- data?: unknown;
38288
+ data: components["schemas"]["SaleNoteIssued"];
38283
38289
  };
38284
38290
  };
38285
38291
  };
@@ -38368,6 +38374,8 @@ interface paths {
38368
38374
  *
38369
38375
  * **`print_missing_fields`** is what `GET /sale-notes/{id}/pdf` would refuse with right now — the SAME `{ variable, label, fix, contact_id? }` list as its 409 `details.missing_fields` — so a screen can ask for the buyer’s domicilio while the buyer is still at the counter. `[]` when the note prints, and always `[]` on a voided note.
38370
38376
  *
38377
+ * **`history`** lists every correction (app#7317), oldest first: `{ id, kind (terms | buyer | add_on | payment), changes: { field: { from, to } }, at, actor, on_approved_note, price_approval_id, authorised_by }`. **`compraventa_outdated`** is `true` when the compraventa in force was printed before a later price or buyer correction (reprint with `POST /sale-notes/{id}/compraventa`). **`pending_price_change`** is a below-floor correction waiting for a manager: `{ price_approval_id, requested_at, requested_by, requested_price_clp, proposed_terms }`, or `null`.
38378
+ *
38371
38379
  * **`trade_ins` names the cars taken in part-exchange** (ERP S9-6) — one entry per car with the line’s own id (never the vehicle’s: BR-457), the `vehicle_id`, the `precio_toma_clp` allowed for it, and the `acquisition_id` of the `vehicle_acquisition` that arrival created. That is the SALE → UNIT direction; the UNIT → SALE direction needs no surface here, because `vehicle_acquisition.sale_note_id` is projected on every read of `GET /vehicle-acquisitions?vehicle_id=`. `acquisition_id` is `null` once the document has been VOIDED — a void retracts the arrival and keeps the line, so the null says exactly what happened: this credit was agreed, and the arrival it caused has been withdrawn.
38372
38380
  *
38373
38381
  * **`credit` is the LIVE brokered credit, or `null`** (ERP S9-7) — the `institution` that is lending (BR-464 makes the financiera the credit’s identity on the document), the `amount_clp`, and its OWN `state`: `committed` (the bank has promised) or `disbursed` (the money has arrived, with `disbursed_at` / `disbursed_by` beside it). ⚠ **Both count the same in `funding`** (BR-463), so never read `funded` as "the cash is in" — read `credit.state` for that. The committed-vs-collected gap is exactly this pair of fields read side by side. ⚠ **The credit’s state is INDEPENDENT of the document’s `status`**: a voided nota de venta keeps its credit row untouched, and a disbursed credit does not make the document anything. Credits that were REPLACED or REMOVED are tombstoned and are deliberately not served here — they are history, not funding, and listing them beside the live one would invite a client to add them up.
@@ -38492,7 +38500,7 @@ interface paths {
38492
38500
  * }
38493
38501
  */
38494
38502
  "application/json": {
38495
- data?: unknown;
38503
+ data: components["schemas"]["SaleNoteRead"];
38496
38504
  meta?: {
38497
38505
  [key: string]: unknown;
38498
38506
  };
@@ -38561,10 +38569,12 @@ interface paths {
38561
38569
  options?: never;
38562
38570
  head?: never;
38563
38571
  /**
38564
- * Edit the price terms of an issued nota de venta
38565
- * @description Corrects `net_clp`, `tax_clp` (null = not recorded, 0 = no tax), `tax_treatment` and/or `issued_at` on a nota de venta that is ISSUED but not approved and not voided. All optional, at least one; unknown keys are a 400. In one transaction the edit re-derives what issuing at the new terms would have: the buyer’s receivable (the sale note’s open obligation, re-stated from price + IVA + charged add-ons) and the participations’ DEFAULTED commissions (the margin basis and, when the sale’s day moves, the scheme rate); `discount_clp` follows. Payments already recorded, add-on lines, trade-ins, the credit and `list_price_clp` are kept. Responds with the same read as `GET /sale-notes/{id}`; sending the values it already has is a no-op 200.
38572
+ * Correct the price terms of a nota de venta (issued or approved)
38573
+ * @description Corrects `net_clp`, `tax_clp` (null = not recorded, 0 = no tax), `tax_treatment` and/or `issued_at` on a nota de venta that is ISSUED or APPROVED and not voided, with no cutoff. All optional, at least one; unknown keys are a 400. In one transaction the edit re-derives what issuing at the new terms would have: the buyer’s receivable (the sale note’s open obligation, re-stated from price + IVA + charged add-ons) and the participations’ DEFAULTED commissions (the margin basis and, when the sale’s day moves, the scheme rate); `discount_clp` follows. Payments already recorded, add-on lines, trade-ins, the credit and `list_price_clp` are kept; on an approved note the car stays sold and the deal stays won. Every correction writes a `history` entry (actor, instant, each field `{ from, to }`); a compraventa printed before it reads `compraventa_outdated: true` until it is reprinted. Responds with the same read as `GET /sale-notes/{id}` plus `correction: { outcome, price_approval_id, change_id }`, `outcome` = `applied` | `unchanged` (sending the values it already has is a no-op 200) | `pending_approval`.
38574
+ *
38575
+ * **202 `pending_approval`**: on an APPROVED note, a correction that lowers the price below the floor (the price-approval policy, tolerance included) by a caller WITHOUT `price_approval:approve` is not applied. It is filed as a price approval on the note carrying the proposed terms (`proposed_terms` on `GET /price-approvals`), shown as `pending_price_change` on the note; granting it (`POST /price-approvals/{id}/decision`) applies the correction in the same transaction, rejecting it leaves the note as it was. A caller holding `price_approval:approve`, a grant on this note that covers the price, a raise, or a pending (unapproved) note applies directly.
38566
38576
  *
38567
- * **409** with `details.blocked_reason` = `sale_note_approved` (an approved price binds the company) or `sale_note_voided`, and a Spanish message; the way out is void + re-issue. Requires `sale_notes:write`.
38577
+ * **409** with `details.blocked_reason` = `sale_note_voided`, or `sale_note_approved` only when a PENDING note was approved while the edit ran (nothing changed; retry, it now applies the approved-note rule), and a Spanish message. Requires `sale_notes:write`.
38568
38578
  */
38569
38579
  patch: {
38570
38580
  parameters: {
@@ -38703,7 +38713,123 @@ interface paths {
38703
38713
  * }
38704
38714
  */
38705
38715
  "application/json": {
38706
- data?: unknown;
38716
+ data: components["schemas"]["SaleNoteCorrected"];
38717
+ meta?: {
38718
+ [key: string]: unknown;
38719
+ };
38720
+ };
38721
+ };
38722
+ };
38723
+ /** @description Below the floor on an approved note: filed for approval, not applied */
38724
+ 202: {
38725
+ headers: {
38726
+ [name: string]: unknown;
38727
+ };
38728
+ content: {
38729
+ /**
38730
+ * @example {
38731
+ * "data": {
38732
+ * "id": "d4d4d4d4-0000-4000-8000-000000000001",
38733
+ * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
38734
+ * "display_id": "V-118",
38735
+ * "display_seq": 118,
38736
+ * "vehicle_id": "e1e1e1e1-0000-4000-8000-000000000002",
38737
+ * "buyer_contact_id": "22222222-0000-4000-8000-000000000002",
38738
+ * "lead_id": null,
38739
+ * "converted_from_reservation_id": null,
38740
+ * "seller_of_record": "automotora",
38741
+ * "salesperson_id": "11111111-0000-4000-8000-000000000001",
38742
+ * "net_clp": 11900000,
38743
+ * "list_price_clp": 12490000,
38744
+ * "discount_clp": 590000,
38745
+ * "tax_clp": 1900000,
38746
+ * "tax_treatment": "afecto",
38747
+ * "status": "issued",
38748
+ * "issued_at": "2026-09-19T13:00:00.000Z",
38749
+ * "emitted_by": "11111111-0000-4000-8000-000000000001",
38750
+ * "approved_by": null,
38751
+ * "approved_at": null,
38752
+ * "voided_at": null,
38753
+ * "void_reason": null,
38754
+ * "voided_by": null,
38755
+ * "created_at": "2026-09-19T13:00:00.000Z",
38756
+ * "updated_at": "2026-09-19T13:00:00.000Z",
38757
+ * "receivable_obligation_id": "01a1c1df-a6ea-779f-9310-bdbb2eadd184",
38758
+ * "print_missing_fields": [
38759
+ * {
38760
+ * "variable": "COMPRADOR_DOMICILIO",
38761
+ * "label": "Domicilio del comprador",
38762
+ * "fix": "buyer_contact",
38763
+ * "contact_id": "01a1ad2b-a52a-7b04-abf8-389e20e8217a"
38764
+ * }
38765
+ * ],
38766
+ * "payments": [
38767
+ * {
38768
+ * "id": "d6d6d6d6-0000-4000-8000-000000000002",
38769
+ * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
38770
+ * "reservation_id": null,
38771
+ * "sale_note_id": "d4d4d4d4-0000-4000-8000-000000000001",
38772
+ * "carried_from_reservation_id": null,
38773
+ * "instrument": "transferencia",
38774
+ * "amount_clp": 13800000,
38775
+ * "paid_on": "2026-09-19",
38776
+ * "bank": "Banco de Chile",
38777
+ * "account_number": null,
38778
+ * "document_number": null,
38779
+ * "note": null,
38780
+ * "card_fee_bps": null,
38781
+ * "card_surcharge_clp": null,
38782
+ * "card_surcharge_source": null,
38783
+ * "created_at": "2026-09-19T13:05:00.000Z"
38784
+ * }
38785
+ * ],
38786
+ * "totals": {
38787
+ * "total_a_pagar_clp": 13800000,
38788
+ * "total_pagos_clp": 13800000,
38789
+ * "saldo_clp": 0,
38790
+ * "recargo_tarjeta_clp": 0,
38791
+ * "total_a_cobrar_clp": 13800000,
38792
+ * "payment_count": 1,
38793
+ * "complete": true,
38794
+ * "gaps": []
38795
+ * },
38796
+ * "funding": {
38797
+ * "standing": "funded",
38798
+ * "balanced": true,
38799
+ * "terms": {
38800
+ * "price_clp": 13800000,
38801
+ * "add_on_charges_clp": 0,
38802
+ * "payments_clp": 13800000,
38803
+ * "retoma_clp": 0,
38804
+ * "credit_clp": 0
38805
+ * },
38806
+ * "total_a_pagar_clp": 13800000,
38807
+ * "total_consideration_clp": 13800000,
38808
+ * "saldo_clp": 0,
38809
+ * "gap_clp": null,
38810
+ * "saldo_a_favor_del_cliente_clp": null,
38811
+ * "payment_count": 1,
38812
+ * "complete": true,
38813
+ * "gaps": []
38814
+ * },
38815
+ * "trade_ins": [],
38816
+ * "credit": null,
38817
+ * "timeline": [
38818
+ * {
38819
+ * "step": "emitted",
38820
+ * "at": "2026-09-19T13:00:00.000Z",
38821
+ * "actor": {
38822
+ * "id": "11111111-0000-4000-8000-000000000001",
38823
+ * "name": "Martina Reyes",
38824
+ * "kind": "member"
38825
+ * }
38826
+ * }
38827
+ * ]
38828
+ * }
38829
+ * }
38830
+ */
38831
+ "application/json": {
38832
+ data: components["schemas"]["SaleNoteCorrected"];
38707
38833
  meta?: {
38708
38834
  [key: string]: unknown;
38709
38835
  };
@@ -38768,6 +38894,230 @@ interface paths {
38768
38894
  };
38769
38895
  trace?: never;
38770
38896
  };
38897
+ "/sale-notes/{id}/registered-owner": {
38898
+ parameters: {
38899
+ query?: never;
38900
+ header?: never;
38901
+ path?: never;
38902
+ cookie?: never;
38903
+ };
38904
+ get?: never;
38905
+ /**
38906
+ * Set, correct or clear the «compra para tercero» of a nota de venta
38907
+ * @description «Compra para tercero» (app#7321): the person who signs and pays can differ from the person the car is registered to (a father buying for his daughter). `registered_owner: { name, tax_id }` names that person — typed, nothing is created in Contactos; the RUT must checksum and is stored canonical (`12345678-K`). `registered_owner: null` clears it (the car goes in the buyer’s name again). The same field is accepted on `POST /sale-notes` and `POST /reservations/{id}/convert`.
38908
+ *
38909
+ * A live note, issued or approved. The money does not move. Writes a `history` entry (`kind: registered_owner`, `registered_owner_name` and `registered_owner_tax_id` from → to); a compraventa printed before it reads `compraventa_outdated: true`. The printed nota de venta shows the third party beside the buyer, and templates get `{{PROPIETARIO_INSCRITO_NOMBRE}}` / `{{PROPIETARIO_INSCRITO_RUT}}` (the buyer’s when there is none) and `{{PROPIETARIO_INSCRITO_DETALLE}}` (the sentence, or nothing). Responds with the same read as `GET /sale-notes/{id}`; setting what it already has is a no-op 200.
38910
+ *
38911
+ * **400** with a field error on `registered_owner.name` / `registered_owner.tax_id`; **409** `details.blocked_reason` = `sale_note_voided`. Requires `sale_notes:write`.
38912
+ */
38913
+ put: {
38914
+ parameters: {
38915
+ query?: never;
38916
+ header?: never;
38917
+ path: {
38918
+ id: string;
38919
+ };
38920
+ cookie?: never;
38921
+ };
38922
+ requestBody?: {
38923
+ content: {
38924
+ /**
38925
+ * @example {
38926
+ * "registered_owner": {
38927
+ * "name": "Hija Ejemplo Pérez",
38928
+ * "tax_id": "19.312.475-5"
38929
+ * }
38930
+ * }
38931
+ */
38932
+ "application/json": {
38933
+ registered_owner: components["schemas"]["SaleNoteRegisteredOwnerInput"];
38934
+ };
38935
+ };
38936
+ };
38937
+ responses: {
38938
+ /** @description The nota de venta, as GET /sale-notes/{id} reads it */
38939
+ 200: {
38940
+ headers: {
38941
+ [name: string]: unknown;
38942
+ };
38943
+ content: {
38944
+ /**
38945
+ * @example {
38946
+ * "data": {
38947
+ * "id": "d4d4d4d4-0000-4000-8000-000000000001",
38948
+ * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
38949
+ * "display_id": "V-118",
38950
+ * "display_seq": 118,
38951
+ * "vehicle_id": "e1e1e1e1-0000-4000-8000-000000000002",
38952
+ * "buyer_contact_id": "22222222-0000-4000-8000-000000000002",
38953
+ * "lead_id": null,
38954
+ * "converted_from_reservation_id": null,
38955
+ * "seller_of_record": "automotora",
38956
+ * "salesperson_id": "11111111-0000-4000-8000-000000000001",
38957
+ * "net_clp": 11900000,
38958
+ * "list_price_clp": 12490000,
38959
+ * "discount_clp": 590000,
38960
+ * "tax_clp": 1900000,
38961
+ * "tax_treatment": "afecto",
38962
+ * "status": "issued",
38963
+ * "issued_at": "2026-09-19T13:00:00.000Z",
38964
+ * "emitted_by": "11111111-0000-4000-8000-000000000001",
38965
+ * "approved_by": null,
38966
+ * "approved_at": null,
38967
+ * "voided_at": null,
38968
+ * "void_reason": null,
38969
+ * "voided_by": null,
38970
+ * "created_at": "2026-09-19T13:00:00.000Z",
38971
+ * "updated_at": "2026-09-19T13:00:00.000Z",
38972
+ * "receivable_obligation_id": "01a1c1df-a6ea-779f-9310-bdbb2eadd184",
38973
+ * "print_missing_fields": [
38974
+ * {
38975
+ * "variable": "COMPRADOR_DOMICILIO",
38976
+ * "label": "Domicilio del comprador",
38977
+ * "fix": "buyer_contact",
38978
+ * "contact_id": "01a1ad2b-a52a-7b04-abf8-389e20e8217a"
38979
+ * }
38980
+ * ],
38981
+ * "payments": [
38982
+ * {
38983
+ * "id": "d6d6d6d6-0000-4000-8000-000000000002",
38984
+ * "tenant_id": "a1a1a1a1-0000-4000-8000-000000000001",
38985
+ * "reservation_id": null,
38986
+ * "sale_note_id": "d4d4d4d4-0000-4000-8000-000000000001",
38987
+ * "carried_from_reservation_id": null,
38988
+ * "instrument": "transferencia",
38989
+ * "amount_clp": 13800000,
38990
+ * "paid_on": "2026-09-19",
38991
+ * "bank": "Banco de Chile",
38992
+ * "account_number": null,
38993
+ * "document_number": null,
38994
+ * "note": null,
38995
+ * "card_fee_bps": null,
38996
+ * "card_surcharge_clp": null,
38997
+ * "card_surcharge_source": null,
38998
+ * "created_at": "2026-09-19T13:05:00.000Z"
38999
+ * }
39000
+ * ],
39001
+ * "totals": {
39002
+ * "total_a_pagar_clp": 13800000,
39003
+ * "total_pagos_clp": 13800000,
39004
+ * "saldo_clp": 0,
39005
+ * "recargo_tarjeta_clp": 0,
39006
+ * "total_a_cobrar_clp": 13800000,
39007
+ * "payment_count": 1,
39008
+ * "complete": true,
39009
+ * "gaps": []
39010
+ * },
39011
+ * "funding": {
39012
+ * "standing": "funded",
39013
+ * "balanced": true,
39014
+ * "terms": {
39015
+ * "price_clp": 13800000,
39016
+ * "add_on_charges_clp": 0,
39017
+ * "payments_clp": 13800000,
39018
+ * "retoma_clp": 0,
39019
+ * "credit_clp": 0
39020
+ * },
39021
+ * "total_a_pagar_clp": 13800000,
39022
+ * "total_consideration_clp": 13800000,
39023
+ * "saldo_clp": 0,
39024
+ * "gap_clp": null,
39025
+ * "saldo_a_favor_del_cliente_clp": null,
39026
+ * "payment_count": 1,
39027
+ * "complete": true,
39028
+ * "gaps": []
39029
+ * },
39030
+ * "trade_ins": [],
39031
+ * "credit": null,
39032
+ * "timeline": [
39033
+ * {
39034
+ * "step": "emitted",
39035
+ * "at": "2026-09-19T13:00:00.000Z",
39036
+ * "actor": {
39037
+ * "id": "11111111-0000-4000-8000-000000000001",
39038
+ * "name": "Martina Reyes",
39039
+ * "kind": "member"
39040
+ * }
39041
+ * }
39042
+ * ]
39043
+ * },
39044
+ * "registered_owner": {
39045
+ * "name": "Hija Ejemplo Pérez",
39046
+ * "tax_id": "19312475-5"
39047
+ * }
39048
+ * }
39049
+ */
39050
+ "application/json": {
39051
+ data: components["schemas"]["SaleNoteRead"];
39052
+ meta?: {
39053
+ [key: string]: unknown;
39054
+ };
39055
+ };
39056
+ };
39057
+ };
39058
+ /** @description Validation error */
39059
+ 400: {
39060
+ headers: {
39061
+ [name: string]: unknown;
39062
+ };
39063
+ content: {
39064
+ "application/json": components["schemas"]["Error"];
39065
+ };
39066
+ };
39067
+ /** @description Unauthorized */
39068
+ 401: {
39069
+ headers: {
39070
+ [name: string]: unknown;
39071
+ };
39072
+ content: {
39073
+ "application/json": components["schemas"]["Error"];
39074
+ };
39075
+ };
39076
+ /** @description Forbidden */
39077
+ 403: {
39078
+ headers: {
39079
+ [name: string]: unknown;
39080
+ };
39081
+ content: {
39082
+ "application/json": components["schemas"]["Error"];
39083
+ };
39084
+ };
39085
+ /** @description Not found */
39086
+ 404: {
39087
+ headers: {
39088
+ [name: string]: unknown;
39089
+ };
39090
+ content: {
39091
+ "application/json": components["schemas"]["Error"];
39092
+ };
39093
+ };
39094
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
39095
+ 409: {
39096
+ headers: {
39097
+ [name: string]: unknown;
39098
+ };
39099
+ content: {
39100
+ "application/json": components["schemas"]["Error"];
39101
+ };
39102
+ };
39103
+ /** @description Rate limited */
39104
+ 429: {
39105
+ headers: {
39106
+ [name: string]: unknown;
39107
+ };
39108
+ content: {
39109
+ "application/json": components["schemas"]["Error"];
39110
+ };
39111
+ };
39112
+ };
39113
+ };
39114
+ post?: never;
39115
+ delete?: never;
39116
+ options?: never;
39117
+ head?: never;
39118
+ patch?: never;
39119
+ trace?: never;
39120
+ };
38771
39121
  "/sale-notes/{id}/buyer": {
38772
39122
  parameters: {
38773
39123
  query?: never;
@@ -38783,9 +39133,9 @@ interface paths {
38783
39133
  head?: never;
38784
39134
  /**
38785
39135
  * Assign or change the buyer of a nota de venta
38786
- * @description Sets `buyer_contact_id` on a live (issued or approved) nota de venta — the fix for a note issued without its comprador, without voiding it. The contact must belong to this workspace (404 otherwise, or when it was merged away). Responds with the same read as `GET /sale-notes/{id}`. Setting the buyer it already has is a no-op 200.
39136
+ * @description Sets `buyer_contact_id` on a live (issued or approved) nota de venta — the fix for a note issued without its comprador, without voiding it. Writes a `history` entry (`kind: buyer`, `buyer_contact_id` and `buyer_name` from → to). A printed compraventa does not block it: the note reads `compraventa_outdated: true` until it is reprinted. The open receivable and the payments applied to it move to the new buyer in the same transaction. The contact must belong to this workspace (404 otherwise, or when it was merged away). Responds with the same read as `GET /sale-notes/{id}`. Setting the buyer it already has is a no-op 200.
38787
39137
  *
38788
- * **409** with `details.blocked_reason` and a Spanish message when the buyer is already written into something else: `sale_note_voided`, `compraventa_issued` (the contract names the buyer), `trade_ins_recorded` (a retoma came from the current buyer) or `credit_attached` (the credit’s borrower is the current buyer). The way out for those is void + re-issue. Requires `sale_notes:write`.
39138
+ * **409** with `details.blocked_reason` and a Spanish message when the buyer is already written into something else: `sale_note_voided`, `trade_ins_recorded` (a retoma came from the current buyer), `payment_shared` (a payment on the note is also applied to another debt of the current buyer, e.g. the reserva) or `credit_attached` (the credit’s borrower is the current buyer). The way out for those is void + re-issue. Requires `sale_notes:write`.
38789
39139
  */
38790
39140
  patch: {
38791
39141
  parameters: {
@@ -38919,7 +39269,7 @@ interface paths {
38919
39269
  * }
38920
39270
  */
38921
39271
  "application/json": {
38922
- data?: unknown;
39272
+ data: components["schemas"]["SaleNoteRead"];
38923
39273
  meta?: {
38924
39274
  [key: string]: unknown;
38925
39275
  };
@@ -45962,6 +46312,8 @@ interface paths {
45962
46312
  /**
45963
46313
  * Convert a reservation into a nota de venta
45964
46314
  * @description Produces a NEW sale-note document — 201, the same as `POST /sale-notes`. Scoped `sale_notes:write`, borrowed rather than a fifth reservations scope. `net_clp` omitted = the sale inherits the hold’s `agreed_price_clp`; stated = the sale closes at that price. A hold with no agreed price needs `net_clp` (400 otherwise).
46315
+ *
46316
+ * **`approve: true`** is «Emitir y aprobar» (app#7316): the new nota de venta is approved in the same request with the same rules and the same `approval` outcome as `POST /sale-notes`; `sale_note` is then the approved row. **`registered_owner: { name, tax_id }`** is «compra para tercero» (app#7321), as on `POST /sale-notes`.
45965
46317
  */
45966
46318
  post: {
45967
46319
  parameters: {
@@ -45996,6 +46348,8 @@ interface paths {
45996
46348
  issued_at?: string | null;
45997
46349
  lead_id?: string | null;
45998
46350
  carry_transfer_cost?: boolean;
46351
+ approve?: boolean;
46352
+ registered_owner?: components["schemas"]["SaleNoteRegisteredOwnerInput"];
45999
46353
  };
46000
46354
  };
46001
46355
  };
@@ -46099,7 +46453,7 @@ interface paths {
46099
46453
  * }
46100
46454
  */
46101
46455
  "application/json": {
46102
- data?: unknown;
46456
+ data: components["schemas"]["ReservationConverted"];
46103
46457
  };
46104
46458
  };
46105
46459
  };
@@ -46502,7 +46856,7 @@ interface paths {
46502
46856
  * }
46503
46857
  */
46504
46858
  "application/json": {
46505
- data?: unknown;
46859
+ data: components["schemas"]["PriceApproval"][];
46506
46860
  meta?: {
46507
46861
  [key: string]: unknown;
46508
46862
  };
@@ -46625,7 +46979,7 @@ interface paths {
46625
46979
  * }
46626
46980
  */
46627
46981
  "application/json": {
46628
- data?: unknown;
46982
+ data: components["schemas"]["PriceApproval"];
46629
46983
  };
46630
46984
  };
46631
46985
  };
@@ -46859,7 +47213,7 @@ interface paths {
46859
47213
  * }
46860
47214
  */
46861
47215
  "application/json": {
46862
- data?: unknown;
47216
+ data: components["schemas"]["PriceApproval"];
46863
47217
  meta?: {
46864
47218
  [key: string]: unknown;
46865
47219
  };
@@ -46999,7 +47353,7 @@ interface paths {
46999
47353
  * }
47000
47354
  */
47001
47355
  "application/json": {
47002
- data?: unknown;
47356
+ data: components["schemas"]["PriceApproval"];
47003
47357
  meta?: {
47004
47358
  [key: string]: unknown;
47005
47359
  };
@@ -283563,6 +283917,147 @@ interface components {
283563
283917
  retryable: boolean;
283564
283918
  } | null;
283565
283919
  };
283920
+ SaleNoteRegisteredOwner: {
283921
+ name: string;
283922
+ tax_id: string;
283923
+ };
283924
+ SaleNoteApproveOnIssue: {
283925
+ approved: boolean;
283926
+ /** @enum {string|null} */
283927
+ reason: "price_approval_required" | "approval_refused" | null;
283928
+ message: string | null;
283929
+ /** Format: uuid */
283930
+ price_approval_id: string | null;
283931
+ };
283932
+ SaleNoteIssued: {
283933
+ /** Format: uuid */
283934
+ id: string;
283935
+ display_id: string;
283936
+ /** @enum {string} */
283937
+ status: "issued" | "approved" | "voided";
283938
+ /** Format: uuid */
283939
+ buyer_contact_id: string | null;
283940
+ registered_owner: components["schemas"]["SaleNoteRegisteredOwner"] | null;
283941
+ net_clp: number;
283942
+ tax_clp: number | null;
283943
+ /** @enum {string} */
283944
+ tax_treatment: "afecto" | "exento" | "no_gravado" | "pass_through";
283945
+ approval?: components["schemas"]["SaleNoteApproveOnIssue"];
283946
+ } & {
283947
+ [key: string]: unknown;
283948
+ };
283949
+ SaleNoteRegisteredOwnerInput: {
283950
+ name: string;
283951
+ tax_id: string;
283952
+ } | null;
283953
+ SaleNoteFieldChange: {
283954
+ from?: unknown;
283955
+ to?: unknown;
283956
+ };
283957
+ DealActor: {
283958
+ id: string;
283959
+ name: string | null;
283960
+ /** @enum {string} */
283961
+ kind: "member" | "api_key";
283962
+ };
283963
+ SaleNoteHistoryEntry: {
283964
+ /** Format: uuid */
283965
+ id: string;
283966
+ /** @enum {string} */
283967
+ kind: "terms" | "buyer" | "add_on" | "payment" | "registered_owner";
283968
+ changes: {
283969
+ [key: string]: components["schemas"]["SaleNoteFieldChange"];
283970
+ };
283971
+ at: string;
283972
+ actor: components["schemas"]["DealActor"] | null;
283973
+ on_approved_note: boolean;
283974
+ /** Format: uuid */
283975
+ price_approval_id: string | null;
283976
+ authorised_by: components["schemas"]["DealActor"] | null;
283977
+ };
283978
+ ProposedSaleNoteTerms: {
283979
+ net_clp?: number;
283980
+ tax_clp?: number | null;
283981
+ /** @enum {string} */
283982
+ tax_treatment?: "afecto" | "exento" | "no_gravado" | "pass_through";
283983
+ issued_at?: string;
283984
+ };
283985
+ SaleNotePendingPriceChange: {
283986
+ /** Format: uuid */
283987
+ price_approval_id: string;
283988
+ requested_at: string;
283989
+ requested_by: components["schemas"]["DealActor"] | null;
283990
+ requested_price_clp: number;
283991
+ proposed_terms: components["schemas"]["ProposedSaleNoteTerms"];
283992
+ };
283993
+ SaleNoteRead: {
283994
+ /** Format: uuid */
283995
+ id: string;
283996
+ display_id: string;
283997
+ /** @enum {string} */
283998
+ status: "issued" | "approved" | "voided";
283999
+ /** Format: uuid */
284000
+ buyer_contact_id: string | null;
284001
+ registered_owner: components["schemas"]["SaleNoteRegisteredOwner"] | null;
284002
+ net_clp: number;
284003
+ tax_clp: number | null;
284004
+ /** @enum {string} */
284005
+ tax_treatment: "afecto" | "exento" | "no_gravado" | "pass_through";
284006
+ history: components["schemas"]["SaleNoteHistoryEntry"][];
284007
+ compraventa_outdated: boolean;
284008
+ pending_price_change: components["schemas"]["SaleNotePendingPriceChange"] | null;
284009
+ } & {
284010
+ [key: string]: unknown;
284011
+ };
284012
+ SaleNoteCorrection: {
284013
+ /** @enum {string} */
284014
+ outcome: "applied" | "pending_approval" | "unchanged";
284015
+ /** Format: uuid */
284016
+ price_approval_id: string | null;
284017
+ /** Format: uuid */
284018
+ change_id: string | null;
284019
+ };
284020
+ SaleNoteCorrected: components["schemas"]["SaleNoteRead"] & ({
284021
+ correction: components["schemas"]["SaleNoteCorrection"];
284022
+ } & {
284023
+ [key: string]: unknown;
284024
+ });
284025
+ ReservationConverted: {
284026
+ reservation: {
284027
+ /** Format: uuid */
284028
+ id: string;
284029
+ display_id: string;
284030
+ } & {
284031
+ [key: string]: unknown;
284032
+ };
284033
+ sale_note: components["schemas"]["SaleNoteIssued"];
284034
+ carried_payments: {
284035
+ [key: string]: unknown;
284036
+ }[];
284037
+ approval?: components["schemas"]["SaleNoteApproveOnIssue"];
284038
+ } & {
284039
+ [key: string]: unknown;
284040
+ };
284041
+ PriceApproval: {
284042
+ /** Format: uuid */
284043
+ id: string;
284044
+ /** @enum {string} */
284045
+ status: "pending" | "approved" | "rejected";
284046
+ /** Format: uuid */
284047
+ quote_id: string | null;
284048
+ /** Format: uuid */
284049
+ reservation_id: string | null;
284050
+ /** Format: uuid */
284051
+ sale_note_id: string | null;
284052
+ requested_price_clp: number;
284053
+ proposed_terms: components["schemas"]["ProposedSaleNoteTerms"] | null;
284054
+ requester_user_id: string;
284055
+ decider_user_id: string | null;
284056
+ decided_at: string | null;
284057
+ created_at: string;
284058
+ } & {
284059
+ [key: string]: unknown;
284060
+ };
283566
284061
  /** @example 2026-01 */
283567
284062
  OverheadPeriod: string;
283568
284063
  /** @description A Mercado Pago checkout payment: its payment id, a link to it and its status. Null for every other movement. */