@vitrina/api 17.21.0 → 17.22.1

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
@@ -86585,7 +86585,7 @@ interface paths {
86585
86585
  };
86586
86586
  /**
86587
86587
  * Mes en paralelo: the diff against Chipax for a month
86588
- * @description Balances (per bank account, at month end), payables (per Contraparte, open at month end) and costs (per costo / gasto account, NET as the Resultado counts) must match to the peso. Income is a bridge: Chipax counts it when cashed, Vitrina the documents issued in the month, so the gap is explained line by line. Vitrina's side is computed live; Chipax's side is the newest finished read. `clean` = all three match and the bridge is explained (the exit criterion). Each row's `key` drills down to its items. Before a finished read: `status` not_read / reading / failed and null dimensions. A caller without the patient register (the Contador) sees a patient as «Paciente A. P.» with no RUT and no glosa, on both sides; Chipax boletas carry neither RUT nor name. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:read` and `finanzas_reports:read` (the Contador seat, owners and admins).
86588
+ * @description Balances (per bank account, at month end), payables (per Contraparte, open at month end) and costs (per costo / gasto account, NET as the Resultado counts) must match to the peso. Income is a bridge: Chipax counts it when cashed, Vitrina the documents issued in the month, so the gap is explained line by line. Vitrina's side is computed live; Chipax's side is the newest finished read. `clean` = all three match and the bridge is explained (the exit criterion). Each row's `key` drills down to its items. Rows list the differences first; `difference_count` of each section counts its rows that are not «Cuadra», and the headline `difference_count` is the sum of the sections with `in_headline` (the two reviews, `inherited_overdue` and `possible_duplicates`, are listed beside them and never counted in it). Before a finished read: `status` not_read / reading / failed and null dimensions. A caller without the patient register (the Contador) sees a patient as «Paciente A. P.» with no RUT and no glosa, on both sides; Chipax boletas carry neither RUT nor name. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:read` and `finanzas_reports:read` (the Contador seat, owners and admins).
86589
86589
  */
86590
86590
  get: {
86591
86591
  parameters: {
@@ -86626,9 +86626,46 @@ interface paths {
86626
86626
  * "history_from": "2025-01-01",
86627
86627
  * "clean": false,
86628
86628
  * "warnings": [],
86629
+ * "difference_count": 1,
86630
+ * "sections": [
86631
+ * {
86632
+ * "key": "balances",
86633
+ * "difference_count": 0,
86634
+ * "in_headline": true
86635
+ * },
86636
+ * {
86637
+ * "key": "payables",
86638
+ * "difference_count": 1,
86639
+ * "in_headline": true
86640
+ * },
86641
+ * {
86642
+ * "key": "costs",
86643
+ * "difference_count": 0,
86644
+ * "in_headline": true
86645
+ * },
86646
+ * {
86647
+ * "key": "income",
86648
+ * "difference_count": 2,
86649
+ * "in_headline": true
86650
+ * },
86651
+ * {
86652
+ * "key": "inherited_overdue",
86653
+ * "difference_count": 1135,
86654
+ * "in_headline": false
86655
+ * },
86656
+ * {
86657
+ * "key": "possible_duplicates",
86658
+ * "difference_count": 2,
86659
+ * "in_headline": false
86660
+ * }
86661
+ * ],
86629
86662
  * "balances": {
86630
86663
  * "matches": true,
86631
86664
  * "difference_count": 0,
86665
+ * "row_count": 1,
86666
+ * "matching_count": 1,
86667
+ * "item_difference_count": 0,
86668
+ * "without_balance_count": 0,
86632
86669
  * "rows": [
86633
86670
  * {
86634
86671
  * "key": "bank:01930000-0000-7000-8000-0000000000b1",
@@ -86667,6 +86704,9 @@ interface paths {
86667
86704
  * "vitrina_clp": 3800000,
86668
86705
  * "difference_clp": 410000,
86669
86706
  * "difference_count": 1,
86707
+ * "row_count": 1,
86708
+ * "matching_count": 0,
86709
+ * "item_difference_count": 1,
86670
86710
  * "rows": [
86671
86711
  * {
86672
86712
  * "key": "p_0000000000000001",
@@ -86688,9 +86728,15 @@ interface paths {
86688
86728
  * "vitrina_clp": 9340000,
86689
86729
  * "difference_clp": 0,
86690
86730
  * "difference_count": 0,
86731
+ * "row_count": 0,
86732
+ * "matching_count": 0,
86733
+ * "item_difference_count": 0,
86691
86734
  * "rows": []
86692
86735
  * },
86693
86736
  * "income": {
86737
+ * "difference_count": 2,
86738
+ * "row_count": 6,
86739
+ * "matching_count": 4,
86694
86740
  * "bridge": {
86695
86741
  * "vitrina_clp": 31500000,
86696
86742
  * "chipax_clp": 30100000,
@@ -86762,9 +86808,27 @@ interface paths {
86762
86808
  /** @description Balances, payables and costs match and the income bridge is fully explained: the exit criterion of the shadow month. */
86763
86809
  clean: boolean | null;
86764
86810
  warnings: string[];
86811
+ /** @description The headline «{n} diferencias en {month}»: the sum of `difference_count` of the `sections` with `in_headline`. 0 until Chipax has been read. */
86812
+ difference_count: number;
86813
+ /** @description Every section in screen order. The two reviews are present even before Chipax is read. */
86814
+ sections: {
86815
+ /** @enum {string} */
86816
+ key: "balances" | "payables" | "costs" | "income" | "inherited_overdue" | "possible_duplicates";
86817
+ difference_count: number;
86818
+ /** @description true for the four comparisons of Chipax against Vitrina; false for the two reviews (`inherited_overdue`: payables to resolve, see GET /finanzas/inherited-overdue; `possible_duplicates`: groups of repeated bank lines, see GET /finanzas/possible-duplicates), which are a to-do list. */
86819
+ in_headline: boolean;
86820
+ }[];
86765
86821
  balances: {
86766
86822
  matches: boolean;
86823
+ /** @description The section's «N diferencias»: its rows that are not «Cuadra» (Finanzas 40). Income counts its bridge lines that hold items. */
86767
86824
  difference_count: number;
86825
+ /** @description Rows the section lists (income: bridge lines). */
86826
+ row_count: number;
86827
+ /** @description Rows that match, for «{n} cuentas cuadran · Ver». `rows` lists the differences first. */
86828
+ matching_count: number;
86829
+ item_difference_count: number;
86830
+ /** @description Rows with no balance on one side (compared on the month movements): the «un lado no tiene saldo» footnote, once per section. */
86831
+ without_balance_count: number;
86768
86832
  rows: {
86769
86833
  /** @description Pass as `key` to the items endpoint. */
86770
86834
  key: string;
@@ -86822,7 +86886,14 @@ interface paths {
86822
86886
  vitrina_clp: number;
86823
86887
  /** @description Whole CLP. */
86824
86888
  difference_clp: number;
86889
+ /** @description The section's «N diferencias»: its rows that are not «Cuadra» (Finanzas 40). Income counts its bridge lines that hold items. */
86825
86890
  difference_count: number;
86891
+ /** @description Rows the section lists (income: bridge lines). */
86892
+ row_count: number;
86893
+ /** @description Rows that match, for «{n} cuentas cuadran · Ver». `rows` lists the differences first. */
86894
+ matching_count: number;
86895
+ /** @description Items (lines, documents) behind the rows that do not pair. */
86896
+ item_difference_count: number;
86826
86897
  rows: {
86827
86898
  /** @description Pass as `key` to the items endpoint. */
86828
86899
  key: string;
@@ -86849,7 +86920,14 @@ interface paths {
86849
86920
  vitrina_clp: number;
86850
86921
  /** @description Whole CLP. */
86851
86922
  difference_clp: number;
86923
+ /** @description The section's «N diferencias»: its rows that are not «Cuadra» (Finanzas 40). Income counts its bridge lines that hold items. */
86852
86924
  difference_count: number;
86925
+ /** @description Rows the section lists (income: bridge lines). */
86926
+ row_count: number;
86927
+ /** @description Rows that match, for «{n} cuentas cuadran · Ver». `rows` lists the differences first. */
86928
+ matching_count: number;
86929
+ /** @description Items (lines, documents) behind the rows that do not pair. */
86930
+ item_difference_count: number;
86853
86931
  rows: {
86854
86932
  /** @description Pass as `key` to the items endpoint. */
86855
86933
  key: string;
@@ -86878,6 +86956,12 @@ interface paths {
86878
86956
  }[];
86879
86957
  } | null;
86880
86958
  income: {
86959
+ /** @description The section's «N diferencias»: its rows that are not «Cuadra» (Finanzas 40). Income counts its bridge lines that hold items. */
86960
+ difference_count: number;
86961
+ /** @description Rows the section lists (income: bridge lines). */
86962
+ row_count: number;
86963
+ /** @description Rows that match, for «{n} cuentas cuadran · Ver». `rows` lists the differences first. */
86964
+ matching_count: number;
86881
86965
  bridge: {
86882
86966
  /** @description Whole CLP. */
86883
86967
  vitrina_clp: number;
@@ -87300,6 +87384,792 @@ interface paths {
87300
87384
  patch?: never;
87301
87385
  trace?: never;
87302
87386
  };
87387
+ "/finanzas/inherited-overdue": {
87388
+ parameters: {
87389
+ query?: never;
87390
+ header?: never;
87391
+ path?: never;
87392
+ cookie?: never;
87393
+ };
87394
+ /**
87395
+ * Vencido heredado: the payables to review
87396
+ * @description The payables that arrived already more than 90 days overdue (`payment_state = vencido_heredado`): they are out of the cash-flow projection and the balances until someone marks them pagado or anulado. Each carries the open bank payment that most likely settled it (`suggested_match`: exact amount, a payment is suggested to one document only; `signal` says why). `summary` counts the whole filter, `items` is one page. Filter by Contraparte with `contraparte`. A caller without the patient register (the Contador) sees a patient as «Paciente A. P.» and no glosa on money in. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:read`.
87397
+ */
87398
+ get: {
87399
+ parameters: {
87400
+ query?: {
87401
+ contraparte?: string;
87402
+ sort?: "due_date" | "amount";
87403
+ limit?: number;
87404
+ offset?: number | null;
87405
+ };
87406
+ header?: never;
87407
+ path?: never;
87408
+ cookie?: never;
87409
+ };
87410
+ requestBody?: never;
87411
+ responses: {
87412
+ /** @description The page */
87413
+ 200: {
87414
+ headers: {
87415
+ [name: string]: unknown;
87416
+ };
87417
+ content: {
87418
+ /**
87419
+ * @example {
87420
+ * "data": {
87421
+ * "summary": {
87422
+ * "count": 1135,
87423
+ * "amount_clp": 437600000
87424
+ * },
87425
+ * "filter": {
87426
+ * "contraparte_id": null
87427
+ * },
87428
+ * "items": [
87429
+ * {
87430
+ * "id": "01930000-0000-7000-8000-0000000000d1",
87431
+ * "kind": "purchase",
87432
+ * "dte_type": 33,
87433
+ * "label": "Factura electrónica N° 451",
87434
+ * "folio": "451",
87435
+ * "contraparte": {
87436
+ * "id": "01930000-0000-7000-8000-0000000000c1",
87437
+ * "name": "Laboratorio Dental Andes Ltda"
87438
+ * },
87439
+ * "counterparty_name": "Laboratorio Dental Andes Ltda",
87440
+ * "issue_date": "2025-06-10",
87441
+ * "due_date": "2025-07-10",
87442
+ * "arrived_on": "2025-11-02",
87443
+ * "days_overdue": 120,
87444
+ * "total_clp": 302852,
87445
+ * "outstanding_clp": 302852,
87446
+ * "suggested_match": {
87447
+ * "movement_id": "01930000-0000-7000-8000-0000000000a1",
87448
+ * "day": "2025-09-12",
87449
+ * "amount_clp": 302852,
87450
+ * "description": "Transferencia a Laboratorio Dental Andes",
87451
+ * "counterparty_name": "Laboratorio Dental Andes Ltda",
87452
+ * "bank_account_id": "01930000-0000-7000-8000-0000000000b1",
87453
+ * "bank_account_name": "Cuenta corriente",
87454
+ * "institution_name": "BCI",
87455
+ * "number_masked": "•••• 9819",
87456
+ * "signal": "contraparte"
87457
+ * }
87458
+ * }
87459
+ * ],
87460
+ * "total": 1135,
87461
+ * "limit": 50,
87462
+ * "offset": 0
87463
+ * }
87464
+ * }
87465
+ */
87466
+ "application/json": {
87467
+ data: {
87468
+ /** @description The whole filter, not only this page. */
87469
+ summary: {
87470
+ count: number;
87471
+ /** @description What is still open on them (total − retención − links). */
87472
+ amount_clp: number;
87473
+ };
87474
+ filter: {
87475
+ contraparte_id: string | null;
87476
+ };
87477
+ items: {
87478
+ /** Format: uuid */
87479
+ id: string;
87480
+ /** @enum {string} */
87481
+ kind: "purchase" | "honorario" | "manual_expense" | "sale" | "tax";
87482
+ dte_type: number | null;
87483
+ /** @description «Factura electrónica N° 451». */
87484
+ label: string;
87485
+ folio: string | null;
87486
+ contraparte: {
87487
+ id: string;
87488
+ name: string;
87489
+ } | null;
87490
+ counterparty_name: string | null;
87491
+ issue_date: string;
87492
+ due_date: string | null;
87493
+ /** @description The day Vitrina first recorded it. */
87494
+ arrived_on: string;
87495
+ days_overdue: number | null;
87496
+ /** @description Whole CLP. */
87497
+ total_clp: number;
87498
+ /** @description Whole CLP. */
87499
+ outstanding_clp: number;
87500
+ /** @description The open outbound bank line that most likely paid it (exact amount; one payment is suggested to one document). `null` when none fits. */
87501
+ suggested_match: {
87502
+ /** Format: uuid */
87503
+ movement_id: string;
87504
+ day: string;
87505
+ /** @description Whole CLP. */
87506
+ amount_clp: number;
87507
+ description: string;
87508
+ counterparty_name: string | null;
87509
+ bank_account_id: string | null;
87510
+ bank_account_name: string | null;
87511
+ /** @description The bank, for its logo («BCI»). */
87512
+ institution_name: string | null;
87513
+ number_masked: string | null;
87514
+ /**
87515
+ * @description What ties the payment to the document: its folio in the glosa, the same Contraparte, or only the exact amount.
87516
+ * @enum {string}
87517
+ */
87518
+ signal: "folio" | "contraparte" | "amount";
87519
+ } | null;
87520
+ }[];
87521
+ total: number;
87522
+ limit: number;
87523
+ offset: number;
87524
+ };
87525
+ };
87526
+ };
87527
+ };
87528
+ /** @description Validation error */
87529
+ 400: {
87530
+ headers: {
87531
+ [name: string]: unknown;
87532
+ };
87533
+ content: {
87534
+ "application/json": components["schemas"]["Error"];
87535
+ };
87536
+ };
87537
+ /** @description Unauthorized */
87538
+ 401: {
87539
+ headers: {
87540
+ [name: string]: unknown;
87541
+ };
87542
+ content: {
87543
+ "application/json": components["schemas"]["Error"];
87544
+ };
87545
+ };
87546
+ /** @description Forbidden */
87547
+ 403: {
87548
+ headers: {
87549
+ [name: string]: unknown;
87550
+ };
87551
+ content: {
87552
+ "application/json": components["schemas"]["Error"];
87553
+ };
87554
+ };
87555
+ /** @description Not found */
87556
+ 404: {
87557
+ headers: {
87558
+ [name: string]: unknown;
87559
+ };
87560
+ content: {
87561
+ "application/json": components["schemas"]["Error"];
87562
+ };
87563
+ };
87564
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
87565
+ 409: {
87566
+ headers: {
87567
+ [name: string]: unknown;
87568
+ };
87569
+ content: {
87570
+ "application/json": components["schemas"]["Error"];
87571
+ };
87572
+ };
87573
+ /** @description Rate limited */
87574
+ 429: {
87575
+ headers: {
87576
+ [name: string]: unknown;
87577
+ };
87578
+ content: {
87579
+ "application/json": components["schemas"]["Error"];
87580
+ };
87581
+ };
87582
+ };
87583
+ };
87584
+ put?: never;
87585
+ post?: never;
87586
+ delete?: never;
87587
+ options?: never;
87588
+ head?: never;
87589
+ patch?: never;
87590
+ trace?: never;
87591
+ };
87592
+ "/finanzas/inherited-overdue/resolve": {
87593
+ parameters: {
87594
+ query?: never;
87595
+ header?: never;
87596
+ path?: never;
87597
+ cookie?: never;
87598
+ };
87599
+ get?: never;
87600
+ put?: never;
87601
+ /**
87602
+ * Vencido heredado: mark pagado or anulado in bulk
87603
+ * @description Resolves up to 500 inherited payables at once. `pagado`: it was settled; the document leaves the review as paid (no bank link is invented). `anulado`: it never has to be paid; the document is voided, so no report counts it. A document that is no longer inherited is skipped (`not_inherited`), never overwritten. One batch, one `batch_id`: it lands in the audit log (`finanzas.inherited_overdue.pagado` / `.anulado`) and `POST /finanzas/inherited-overdue/batches/{batchId}/undo` puts it back. «anulado» in a closed month needs `?adjustment_reason=` (409 `FINANZAS_PERIOD_CLOSED` otherwise). Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:write`.
87604
+ */
87605
+ post: {
87606
+ parameters: {
87607
+ query?: never;
87608
+ header?: {
87609
+ /** @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. */
87610
+ "Idempotency-Key"?: string;
87611
+ };
87612
+ path?: never;
87613
+ cookie?: never;
87614
+ };
87615
+ requestBody?: {
87616
+ content: {
87617
+ /**
87618
+ * @example {
87619
+ * "document_ids": [
87620
+ * "01930000-0000-7000-8000-0000000000d1"
87621
+ * ],
87622
+ * "resolution": "pagado"
87623
+ * }
87624
+ */
87625
+ "application/json": {
87626
+ /** @description The inherited payables to resolve (1 to 500). */
87627
+ document_ids: string[];
87628
+ /**
87629
+ * @description pagado: it was settled (no bank link is invented; the document leaves the review as paid). anulado: it never has to be paid (it is voided, so no report counts it).
87630
+ * @enum {string}
87631
+ */
87632
+ resolution: "pagado" | "anulado";
87633
+ note?: string;
87634
+ };
87635
+ };
87636
+ };
87637
+ responses: {
87638
+ /** @description The batch */
87639
+ 200: {
87640
+ headers: {
87641
+ [name: string]: unknown;
87642
+ };
87643
+ content: {
87644
+ /**
87645
+ * @example {
87646
+ * "data": {
87647
+ * "batch_id": "01930000-0000-7000-8000-0000000000b9",
87648
+ * "resolution": "pagado",
87649
+ * "resolved": [
87650
+ * "01930000-0000-7000-8000-0000000000d1"
87651
+ * ],
87652
+ * "skipped": [],
87653
+ * "amount_clp": 302852,
87654
+ * "remaining": {
87655
+ * "count": 1134,
87656
+ * "amount_clp": 437297148
87657
+ * }
87658
+ * }
87659
+ * }
87660
+ */
87661
+ "application/json": {
87662
+ data: {
87663
+ /**
87664
+ * Format: uuid
87665
+ * @description Pass it to the undo route («Deshacer»).
87666
+ */
87667
+ batch_id: string;
87668
+ /** @enum {string} */
87669
+ resolution: "pagado" | "anulado";
87670
+ resolved: string[];
87671
+ skipped: {
87672
+ id: string;
87673
+ /**
87674
+ * @description not_inherited: someone already resolved it, or a payment was linked to it.
87675
+ * @enum {string}
87676
+ */
87677
+ reason: "not_found" | "not_inherited";
87678
+ }[];
87679
+ /** @description What was open on the documents resolved. */
87680
+ amount_clp: number;
87681
+ remaining: {
87682
+ count: number;
87683
+ /** @description What is still open on them (total − retención − links). */
87684
+ amount_clp: number;
87685
+ };
87686
+ };
87687
+ };
87688
+ };
87689
+ };
87690
+ /** @description Validation error */
87691
+ 400: {
87692
+ headers: {
87693
+ [name: string]: unknown;
87694
+ };
87695
+ content: {
87696
+ "application/json": components["schemas"]["Error"];
87697
+ };
87698
+ };
87699
+ /** @description Unauthorized */
87700
+ 401: {
87701
+ headers: {
87702
+ [name: string]: unknown;
87703
+ };
87704
+ content: {
87705
+ "application/json": components["schemas"]["Error"];
87706
+ };
87707
+ };
87708
+ /** @description Forbidden */
87709
+ 403: {
87710
+ headers: {
87711
+ [name: string]: unknown;
87712
+ };
87713
+ content: {
87714
+ "application/json": components["schemas"]["Error"];
87715
+ };
87716
+ };
87717
+ /** @description Not found */
87718
+ 404: {
87719
+ headers: {
87720
+ [name: string]: unknown;
87721
+ };
87722
+ content: {
87723
+ "application/json": components["schemas"]["Error"];
87724
+ };
87725
+ };
87726
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
87727
+ 409: {
87728
+ headers: {
87729
+ [name: string]: unknown;
87730
+ };
87731
+ content: {
87732
+ "application/json": components["schemas"]["Error"];
87733
+ };
87734
+ };
87735
+ /** @description Rate limited */
87736
+ 429: {
87737
+ headers: {
87738
+ [name: string]: unknown;
87739
+ };
87740
+ content: {
87741
+ "application/json": components["schemas"]["Error"];
87742
+ };
87743
+ };
87744
+ };
87745
+ };
87746
+ delete?: never;
87747
+ options?: never;
87748
+ head?: never;
87749
+ patch?: never;
87750
+ trace?: never;
87751
+ };
87752
+ "/finanzas/inherited-overdue/batches/{batchId}/undo": {
87753
+ parameters: {
87754
+ query?: never;
87755
+ header?: never;
87756
+ path?: never;
87757
+ cookie?: never;
87758
+ };
87759
+ get?: never;
87760
+ put?: never;
87761
+ /**
87762
+ * Vencido heredado: undo a batch («Deshacer»)
87763
+ * @description Puts the documents of a batch back to «vencido heredado» (a payment linked in the meantime wins and the state follows it). Pass `document_ids` to undo only some. Idempotent: what was already undone comes back in `skipped`. Audited as `finanzas.inherited_overdue.undo`. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:write`.
87764
+ */
87765
+ post: {
87766
+ parameters: {
87767
+ query?: never;
87768
+ header?: {
87769
+ /** @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. */
87770
+ "Idempotency-Key"?: string;
87771
+ };
87772
+ path: {
87773
+ batchId: string;
87774
+ };
87775
+ cookie?: never;
87776
+ };
87777
+ requestBody?: {
87778
+ content: {
87779
+ /** @example {} */
87780
+ "application/json": {
87781
+ /** @description Undo only these documents of the batch (default: the whole batch). */
87782
+ document_ids?: string[];
87783
+ };
87784
+ };
87785
+ };
87786
+ responses: {
87787
+ /** @description The undo */
87788
+ 200: {
87789
+ headers: {
87790
+ [name: string]: unknown;
87791
+ };
87792
+ content: {
87793
+ /**
87794
+ * @example {
87795
+ * "data": {
87796
+ * "batch_id": "01930000-0000-7000-8000-0000000000b9",
87797
+ * "resolution": "pagado",
87798
+ * "undone": [
87799
+ * "01930000-0000-7000-8000-0000000000d1"
87800
+ * ],
87801
+ * "skipped": [],
87802
+ * "remaining": {
87803
+ * "count": 1135,
87804
+ * "amount_clp": 437600000
87805
+ * }
87806
+ * }
87807
+ * }
87808
+ */
87809
+ "application/json": {
87810
+ data: {
87811
+ /** Format: uuid */
87812
+ batch_id: string;
87813
+ /** @enum {string|null} */
87814
+ resolution: "pagado" | "anulado" | null;
87815
+ undone: string[];
87816
+ skipped: string[];
87817
+ remaining: {
87818
+ count: number;
87819
+ /** @description What is still open on them (total − retención − links). */
87820
+ amount_clp: number;
87821
+ };
87822
+ };
87823
+ };
87824
+ };
87825
+ };
87826
+ /** @description Validation error */
87827
+ 400: {
87828
+ headers: {
87829
+ [name: string]: unknown;
87830
+ };
87831
+ content: {
87832
+ "application/json": components["schemas"]["Error"];
87833
+ };
87834
+ };
87835
+ /** @description Unauthorized */
87836
+ 401: {
87837
+ headers: {
87838
+ [name: string]: unknown;
87839
+ };
87840
+ content: {
87841
+ "application/json": components["schemas"]["Error"];
87842
+ };
87843
+ };
87844
+ /** @description Forbidden */
87845
+ 403: {
87846
+ headers: {
87847
+ [name: string]: unknown;
87848
+ };
87849
+ content: {
87850
+ "application/json": components["schemas"]["Error"];
87851
+ };
87852
+ };
87853
+ /** @description Not found */
87854
+ 404: {
87855
+ headers: {
87856
+ [name: string]: unknown;
87857
+ };
87858
+ content: {
87859
+ "application/json": components["schemas"]["Error"];
87860
+ };
87861
+ };
87862
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
87863
+ 409: {
87864
+ headers: {
87865
+ [name: string]: unknown;
87866
+ };
87867
+ content: {
87868
+ "application/json": components["schemas"]["Error"];
87869
+ };
87870
+ };
87871
+ /** @description Rate limited */
87872
+ 429: {
87873
+ headers: {
87874
+ [name: string]: unknown;
87875
+ };
87876
+ content: {
87877
+ "application/json": components["schemas"]["Error"];
87878
+ };
87879
+ };
87880
+ };
87881
+ };
87882
+ delete?: never;
87883
+ options?: never;
87884
+ head?: never;
87885
+ patch?: never;
87886
+ trace?: never;
87887
+ };
87888
+ "/finanzas/inherited-overdue/batches": {
87889
+ parameters: {
87890
+ query?: never;
87891
+ header?: never;
87892
+ path?: never;
87893
+ cookie?: never;
87894
+ };
87895
+ /**
87896
+ * Vencido heredado: the batches already resolved
87897
+ * @description Each bulk action, newest first, with how many of its documents are still resolved (`live_count`). Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:read`.
87898
+ */
87899
+ get: {
87900
+ parameters: {
87901
+ query?: {
87902
+ limit?: number;
87903
+ };
87904
+ header?: never;
87905
+ path?: never;
87906
+ cookie?: never;
87907
+ };
87908
+ requestBody?: never;
87909
+ responses: {
87910
+ /** @description Batches */
87911
+ 200: {
87912
+ headers: {
87913
+ [name: string]: unknown;
87914
+ };
87915
+ content: {
87916
+ /**
87917
+ * @example {
87918
+ * "data": [
87919
+ * {
87920
+ * "batch_id": "01930000-0000-7000-8000-0000000000b9",
87921
+ * "resolution": "pagado",
87922
+ * "resolved_at": "2026-11-08T14:00:00.000Z",
87923
+ * "resolved_by": "00000000-0000-4000-8000-000000000001",
87924
+ * "document_count": 3,
87925
+ * "live_count": 3,
87926
+ * "amount_clp": 908556
87927
+ * }
87928
+ * ]
87929
+ * }
87930
+ */
87931
+ "application/json": {
87932
+ data: {
87933
+ /** Format: uuid */
87934
+ batch_id: string;
87935
+ /** @enum {string} */
87936
+ resolution: "pagado" | "anulado";
87937
+ /** @description ISO 8601 timestamp. */
87938
+ resolved_at: string;
87939
+ resolved_by: string | null;
87940
+ document_count: number;
87941
+ /** @description Documents of the batch not undone. */
87942
+ live_count: number;
87943
+ /** @description Whole CLP. */
87944
+ amount_clp: number;
87945
+ }[];
87946
+ };
87947
+ };
87948
+ };
87949
+ /** @description Validation error */
87950
+ 400: {
87951
+ headers: {
87952
+ [name: string]: unknown;
87953
+ };
87954
+ content: {
87955
+ "application/json": components["schemas"]["Error"];
87956
+ };
87957
+ };
87958
+ /** @description Unauthorized */
87959
+ 401: {
87960
+ headers: {
87961
+ [name: string]: unknown;
87962
+ };
87963
+ content: {
87964
+ "application/json": components["schemas"]["Error"];
87965
+ };
87966
+ };
87967
+ /** @description Forbidden */
87968
+ 403: {
87969
+ headers: {
87970
+ [name: string]: unknown;
87971
+ };
87972
+ content: {
87973
+ "application/json": components["schemas"]["Error"];
87974
+ };
87975
+ };
87976
+ /** @description Not found */
87977
+ 404: {
87978
+ headers: {
87979
+ [name: string]: unknown;
87980
+ };
87981
+ content: {
87982
+ "application/json": components["schemas"]["Error"];
87983
+ };
87984
+ };
87985
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
87986
+ 409: {
87987
+ headers: {
87988
+ [name: string]: unknown;
87989
+ };
87990
+ content: {
87991
+ "application/json": components["schemas"]["Error"];
87992
+ };
87993
+ };
87994
+ /** @description Rate limited */
87995
+ 429: {
87996
+ headers: {
87997
+ [name: string]: unknown;
87998
+ };
87999
+ content: {
88000
+ "application/json": components["schemas"]["Error"];
88001
+ };
88002
+ };
88003
+ };
88004
+ };
88005
+ put?: never;
88006
+ post?: never;
88007
+ delete?: never;
88008
+ options?: never;
88009
+ head?: never;
88010
+ patch?: never;
88011
+ trace?: never;
88012
+ };
88013
+ "/finanzas/possible-duplicates": {
88014
+ parameters: {
88015
+ query?: never;
88016
+ header?: never;
88017
+ path?: never;
88018
+ cookie?: never;
88019
+ };
88020
+ /**
88021
+ * Posibles duplicados: bank lines that repeat
88022
+ * @description Bank lines that repeat under one bank-issued operation id on the same account, day, direction and amount, at least `min_repeats` times (default 3). An id derived from the date (ending in six zeros) is not a bank reference and never counts. READ-ONLY: Vitrina deletes nothing here; someone reviews the list before any change. The Chipax import skips a repeated line of this kind on its next run. A caller without the patient register (the Contador) sees a patient as «Paciente A. P.» and no glosa on money in. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas:read`.
88023
+ */
88024
+ get: {
88025
+ parameters: {
88026
+ query?: {
88027
+ min_repeats?: number;
88028
+ };
88029
+ header?: never;
88030
+ path?: never;
88031
+ cookie?: never;
88032
+ };
88033
+ requestBody?: never;
88034
+ responses: {
88035
+ /** @description The groups */
88036
+ 200: {
88037
+ headers: {
88038
+ [name: string]: unknown;
88039
+ };
88040
+ content: {
88041
+ /**
88042
+ * @example {
88043
+ * "data": {
88044
+ * "min_repeats": 3,
88045
+ * "group_count": 1,
88046
+ * "line_count": 3,
88047
+ * "groups": [
88048
+ * {
88049
+ * "key": "acct|2025121010599320|2527239|outbound|2025-12-10",
88050
+ * "day": "2025-12-10",
88051
+ * "amount_clp": 2527239,
88052
+ * "direction": "outbound",
88053
+ * "bank_operation": "2025121010599320",
88054
+ * "description": "Pk smart4d tasa int. 2,09%",
88055
+ * "repeats": 3,
88056
+ * "total_clp": 7581717,
88057
+ * "bank_account": {
88058
+ * "id": "01930000-0000-7000-8000-0000000000b2",
88059
+ * "name": "Itaú tarjeta de crédito",
88060
+ * "institution_name": "Itaú",
88061
+ * "number_masked": "•••• 5402"
88062
+ * },
88063
+ * "lines": [
88064
+ * {
88065
+ * "id": "01930000-0000-7000-8000-0000000000a1",
88066
+ * "source": "chipax",
88067
+ * "description": "Pk smart4d tasa int. 2,09%"
88068
+ * }
88069
+ * ]
88070
+ * }
88071
+ * ]
88072
+ * }
88073
+ * }
88074
+ */
88075
+ "application/json": {
88076
+ data: {
88077
+ min_repeats: number;
88078
+ group_count: number;
88079
+ line_count: number;
88080
+ groups: {
88081
+ key: string;
88082
+ day: string;
88083
+ /** @description Whole CLP. */
88084
+ amount_clp: number;
88085
+ /** @enum {string} */
88086
+ direction: "inbound" | "outbound";
88087
+ /** @description The bank's own reference for the operation. */
88088
+ bank_operation: string;
88089
+ description: string | null;
88090
+ repeats: number;
88091
+ /** @description amount × repeats. */
88092
+ total_clp: number;
88093
+ bank_account: {
88094
+ id: string | null;
88095
+ name: string | null;
88096
+ institution_name: string | null;
88097
+ number_masked: string | null;
88098
+ };
88099
+ lines: {
88100
+ id: string;
88101
+ source: string;
88102
+ description: string | null;
88103
+ }[];
88104
+ }[];
88105
+ };
88106
+ };
88107
+ };
88108
+ };
88109
+ /** @description Validation error */
88110
+ 400: {
88111
+ headers: {
88112
+ [name: string]: unknown;
88113
+ };
88114
+ content: {
88115
+ "application/json": components["schemas"]["Error"];
88116
+ };
88117
+ };
88118
+ /** @description Unauthorized */
88119
+ 401: {
88120
+ headers: {
88121
+ [name: string]: unknown;
88122
+ };
88123
+ content: {
88124
+ "application/json": components["schemas"]["Error"];
88125
+ };
88126
+ };
88127
+ /** @description Forbidden */
88128
+ 403: {
88129
+ headers: {
88130
+ [name: string]: unknown;
88131
+ };
88132
+ content: {
88133
+ "application/json": components["schemas"]["Error"];
88134
+ };
88135
+ };
88136
+ /** @description Not found */
88137
+ 404: {
88138
+ headers: {
88139
+ [name: string]: unknown;
88140
+ };
88141
+ content: {
88142
+ "application/json": components["schemas"]["Error"];
88143
+ };
88144
+ };
88145
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
88146
+ 409: {
88147
+ headers: {
88148
+ [name: string]: unknown;
88149
+ };
88150
+ content: {
88151
+ "application/json": components["schemas"]["Error"];
88152
+ };
88153
+ };
88154
+ /** @description Rate limited */
88155
+ 429: {
88156
+ headers: {
88157
+ [name: string]: unknown;
88158
+ };
88159
+ content: {
88160
+ "application/json": components["schemas"]["Error"];
88161
+ };
88162
+ };
88163
+ };
88164
+ };
88165
+ put?: never;
88166
+ post?: never;
88167
+ delete?: never;
88168
+ options?: never;
88169
+ head?: never;
88170
+ patch?: never;
88171
+ trace?: never;
88172
+ };
87303
88173
  "/finanzas/chipax": {
87304
88174
  parameters: {
87305
88175
  query?: never;