sinfactura-types 1.10.372 → 1.10.374

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.
@@ -145,13 +145,18 @@ declare global {
145
145
  * repeating the order, because two copies of a resolution order drift and
146
146
  * nothing compares them.
147
147
  *
148
- * ⚠️ **Tested PER LINE, and one line is enough.** The threshold is compared
149
- * against each `items[]` entry's own variance; a session is over it when
150
- * ANY single line is, never against a session-wide average or a summed
151
- * ratio. An averaging consumer will show «within tolerance» for a session
152
- * the api refuses, because one wild line disappears into a hundred exact
153
- * ones. Strictly `>`: a variance exactly equal to the threshold is WITHIN
154
- * it.
148
+ * ⚠️ **Tested PER PRODUCT, and one product is enough.** Lines sharing a
149
+ * `productId` (a lot split) are aggregated first — counted quantities
150
+ * summed, `systemQuantity` taken once — and the threshold is compared
151
+ * against each product's variance; a session is over it when ANY single
152
+ * product is, never against a session-wide average. Measuring a raw line
153
+ * compares a PART against the WHOLE baseline. Strictly `>`: a variance
154
+ * exactly equal to the threshold is WITHIN it.
155
+ *
156
+ * ⚠️ **The api also measures each applied delta against the product's
157
+ * STORED `stock`**, because `systemQuantity` is caller-written; a session
158
+ * must pass both. A consumer predicting the verdict from `systemQuantity`
159
+ * alone can show «within tolerance» when stock moved during the count.
155
160
  *
156
161
  * ⚠️ **A percent, not a fraction.** `10` is ten percent. A writer who sends
157
162
  * `0.10` meaning «10 %» builds a threshold a hundred times too tight, and
package/dist/invoice.d.ts CHANGED
@@ -132,6 +132,17 @@ declare global {
132
132
  */
133
133
  impTrib?: number;
134
134
  discount?: number;
135
+ /**
136
+ * The voucher's total in ITS OWN currency (`currency`; on an export row,
137
+ * `export.monedaId`) — WSFEv1's `ImpTotal`, WSFEX's `Imp_total`. Pesos are
138
+ * `total × currencyValue`; a peso row's `currencyValue` is `1`.
139
+ *
140
+ * ⚠️ Forward-only exception: an EXPORT row written before the
141
+ * voucher-currency change carries the ARS peso base here while
142
+ * `export.impTotal` holds the voucher figure. The reports tell the two
143
+ * apart by whether `total === export.impTotal`
144
+ * (`stacks/lambdas/reports/_format.ts`'s `ventasPesoFactor`).
145
+ */
135
146
  total: number;
136
147
  cae: string;
137
148
  caeExpiration: string;
@@ -287,15 +298,15 @@ declare global {
287
298
  * `Pro_precio_uni` and `Pro_total_item` of this line's `IFexItem`.
288
299
  *
289
300
  * ⚠️ **Voucher currency, never pesos.** On an export voucher the header
290
- * carries one `MonId`/`MonCotiz` and every line is already converted to it,
291
- * so these are denominated in the voucher's currency at the voucher's rate —
292
- * a factor of `export.monedaCtz` away from the peso figures on the same row.
301
+ * carries one `MonId`/`MonCotiz` and every line is already in it, so these
302
+ * are denominated in the voucher's currency.
293
303
  *
294
- * ⚠️ **Do not confuse `fex.precioUni` with `unitPrice` above.** `unitPrice`
295
- * is the PESO per-unit total; `fex.precioUni` is `Pro_precio_uni`, in voucher
296
- * currency and carried at 6 decimal places. Same concept, different
297
- * denomination and different precision — there is no safe arithmetic
298
- * relationship between them that does not go through the rate.
304
+ * ⚠️ **`fex.precioUni` vs `unitPrice` above depends on the row's age.** On a
305
+ * row written from the voucher-currency change on, `unitPrice`/`neto` ARE
306
+ * `Pro_precio_uni` (2 decimals) and equal `fex.precioUni`. On an older export
307
+ * row `unitPrice`/`neto` are the PESO per-unit figures and `fex.precioUni`
308
+ * carries 6 decimal places — a factor of `export.monedaCtz` apart, with no
309
+ * safe arithmetic between them that does not go through the rate.
299
310
  *
300
311
  * Exists so the rendered breakdown cannot silently disagree with the voucher
301
312
  * it claims to represent. The PDF otherwise RE-DERIVES each line from the
@@ -577,5 +588,24 @@ declare global {
577
588
  */
578
589
  updatedAt?: number;
579
590
  }
591
+ /**
592
+ * One line of a `400 INVOICE_MIXED_CURRENCY` refusal's `data.lines`: a line
593
+ * whose currency is not the voucher's own on a `MonId ≠ PES` comprobante (a
594
+ * peso line on a dollar factura). `index` is the line's position in the order
595
+ * lines the voucher would declare; `productId`/`sku` echo the line when it has
596
+ * them. A PES voucher never produces one — dollar lines on a peso voucher are
597
+ * the ordinary flow.
598
+ */
599
+ interface InvoiceMixedCurrencyLine {
600
+ index: number;
601
+ currency: string;
602
+ productId?: string;
603
+ sku?: string;
604
+ }
605
+ /** `data` of a `400 INVOICE_MIXED_CURRENCY` refusal. */
606
+ interface InvoiceMixedCurrencyErrorData {
607
+ voucherCurrency: string;
608
+ lines: InvoiceMixedCurrencyLine[];
609
+ }
580
610
  }
581
611
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.10.372",
3
+ "version": "1.10.374",
4
4
  "description": "Shared wire and entity contracts for the SINFACTURA platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",