sinfactura-types 1.10.521 → 1.10.523

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.
@@ -16,15 +16,15 @@
16
16
  // live activation. The PIN only re-selects WHO operates the till; it is
17
17
  // never a standalone authentication.
18
18
  // 4. The ELEVATION TOKEN — 90 seconds, single use, bound to one exact action.
19
- // Not described here yet; its shapes land with the slice that serves it.
19
+ // Its credential is opaque and grants no access-token privileges.
20
20
  //
21
21
  // ⚠️ Rollout is sliced. ENROLMENT (pairing codes, redeem, list, revoke),
22
22
  // ACTIVATION, the OPERATOR PIN, PIN ENROLMENT and the operator-session read are
23
- // served. ELEVATION is not, and has no shape here yet. "Served" means merged: a
23
+ // served, including single-action money-out ELEVATION. "Served" means merged: a
24
24
  // client must still verify the api's deployment on its own route before relying
25
25
  // on one.
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.TERMINAL_PAIRING_CODE_TTL_SECONDS = exports.TERMINAL_ENROLMENT_TTL_SECONDS = exports.TERMINAL_SESSION_ERROR_CODES = exports.TERMINAL_ENROLMENT_ERROR_CODES = void 0;
27
+ exports.TERMINAL_ELEVATION_ERROR_CODES = exports.TERMINAL_ELEVATION_ACTIONS = exports.TERMINAL_PAIRING_CODE_TTL_SECONDS = exports.TERMINAL_ENROLMENT_TTL_SECONDS = exports.TERMINAL_SESSION_ERROR_CODES = exports.TERMINAL_ENROLMENT_ERROR_CODES = void 0;
28
28
  /**
29
29
  * `body.error` codes the SERVED enrolment routes refuse with —
30
30
  * `POST /terminal/pair/codes`, `POST /terminal/pair`, `GET /terminal/sessions`
@@ -115,3 +115,21 @@ exports.TERMINAL_SESSION_ERROR_CODES = [
115
115
  /** The `sf_terminal` cookie's lifetime and the pairing code's, in seconds — the two numbers a client may display. */
116
116
  exports.TERMINAL_ENROLMENT_TTL_SECONDS = 365 * 24 * 60 * 60;
117
117
  exports.TERMINAL_PAIRING_CODE_TTL_SECONDS = 10 * 60;
118
+ /** Money-out actions whose operator sessions require a different ADMIN-or-higher approver. */
119
+ exports.TERMINAL_ELEVATION_ACTIONS = [
120
+ 'order.deposit-refund',
121
+ 'mercadopago.refund',
122
+ 'shift.refund',
123
+ 'shift.cash-out',
124
+ 'cash.withdrawal',
125
+ 'account.cash-debit',
126
+ 'tip.cash-payout',
127
+ ];
128
+ /** Existing PIN, validation and idempotency refusals retain their current codes/statuses. */
129
+ exports.TERMINAL_ELEVATION_ERROR_CODES = [
130
+ 'ELEVATION_FORBIDDEN',
131
+ 'ELEVATION_APPROVER_FORBIDDEN',
132
+ 'OPERATOR_SESSION_STALE',
133
+ 'ELEVATION_REQUIRED',
134
+ 'ELEVATION_INVALID',
135
+ ];
package/dist/invoice.d.ts CHANGED
@@ -157,8 +157,8 @@ declare global {
157
157
  * frozen exactly as declared to ARCA rather than re-derived at read time.
158
158
  *
159
159
  * Stored alongside the array on purpose: `buildTributos` rounds each entry
160
- * and then rounds the sum, so a reader summing the array reproduces it, but
161
- * only while it uses the same rounding. This is the value ARCA reconciled
160
+ * and sums the rounded entries, so a reader summing the array reproduces it,
161
+ * but only while it uses the same rounding. This is the value ARCA reconciled
162
162
  * `ImpTotal == ImpTotConc + ImpNeto + ImpOpEx + ImpTrib + ImpIVA` against,
163
163
  * and that identity is what makes `total` decomposable.
164
164
  *
@@ -179,6 +179,27 @@ declare global {
179
179
  * (`stacks/lambdas/reports/_format.ts`'s `ventasPesoFactor`).
180
180
  */
181
181
  total: number;
182
+ /**
183
+ * The rounding rule this voucher's amounts were built under.
184
+ *
185
+ * `'decimal'` — every per-unit figure, alícuota bucket and voucher total
186
+ * rounded to centavos half away from zero on the DECIMAL value (unit 0.35
187
+ * at 50 % off is 0.18). Written on every Invoice row built under it since
188
+ * the field shipped — factura, CAEA, `pending_cae`, `rejected`, export, and
189
+ * a credit note whose factura carries it.
190
+ *
191
+ * ABSENT ⇒ the row was built under the LEGACY rule, `Number(x.toFixed(2))`
192
+ * on the binary double (the same 0.35 at 50 % off is 0.17). Forward-only,
193
+ * never backfilled: every row written before the field exists is legacy,
194
+ * and so is a NEW credit note crediting such a factura, which is built
195
+ * under its factura's rule so it can credit it exactly.
196
+ *
197
+ * Read where a voucher is rebuilt or re-rendered rather than read back: a
198
+ * credit note's economics follow its factura's rule, the pending-CAE drain
199
+ * rebuilds a row under its own, and the PDF / ESC/POS receipt replay a
200
+ * line under it.
201
+ */
202
+ amountRounding?: 'decimal';
182
203
  cae: string;
183
204
  caeExpiration: string;
184
205
  observations?: string;
package/dist/order.d.ts CHANGED
@@ -1811,9 +1811,10 @@ declare global {
1811
1811
  * one NEGATIVE {@link OrderTender} leg: `amount = −receipt.amount +
1812
1812
  * receipt.change`, the receipt's `method`, `methodLabel`, `source` and
1813
1813
  * `currency`, `reference` = `depositTenderId`, `deposit: { kind: 'refund',
1814
- * refunds: depositTenderId }`. Admin tier only (ADMIN, SUPERVISOR or MANAGER;
1815
- * `403 ROLE_FORBIDDEN` otherwise, PRINTER and ACCOUNTANT included), and denied
1816
- * under impersonation. Same opt-in `Idempotency-Key` as `mode: 'deposit'`: a
1814
+ * refunds: depositTenderId }`. A password session requires ADMIN, SUPERVISOR
1815
+ * or MANAGER; a PIN operator requires a single-use action-bound elevation
1816
+ * from a different admin approver. PRINTER, ACCOUNTANT and impersonation are
1817
+ * refused. Same opt-in `Idempotency-Key` as `mode: 'deposit'`: a
1817
1818
  * same-key retry replays the first 200.
1818
1819
  *
1819
1820
  * A CASH refund books one `'refund'` `CashEvent` (an outcome) of the net the
@@ -1862,7 +1863,7 @@ declare global {
1862
1863
  * `ORDER_VERSION_CONFLICT` and `FX_CONVERSION_UNAVAILABLE` as `mode: 'tender'`
1863
1864
  * answers them.
1864
1865
  */
1865
- interface OrderDepositRefundRequest {
1866
+ interface OrderDepositRefundRequest extends TerminalElevationAuthorization {
1866
1867
  mode: 'deposit-refund';
1867
1868
  orderId: string;
1868
1869
  /** The `tenderId` of the seña RECEIPT leg to give back. */
@@ -210,6 +210,30 @@ declare global {
210
210
  name: string;
211
211
  startedAt: number;
212
212
  } | null;
213
+ /** Approval request from a current PIN operator and matching terminal cookie. */
214
+ interface TerminalElevationRequest {
215
+ approverId: string;
216
+ pin: string;
217
+ action: TerminalElevationAction;
218
+ subjectId: string;
219
+ /** Exact underlying request body; object keys are canonicalized, array order remains bound. */
220
+ body: Record<string, unknown>;
221
+ }
222
+ /** Attach the credential at the root of the exact approved money-out body. */
223
+ interface TerminalElevationAuthorization {
224
+ elevationToken?: string;
225
+ }
226
+ interface TerminalElevationResult {
227
+ /** Opaque single-use credential. Keep in memory; attach as root elevationToken to the approved body. */
228
+ elevationToken: string;
229
+ elevationId: string;
230
+ /** Unix ms, at most 90 seconds and never past the operator/activation expiry. */
231
+ expiresAt: number;
232
+ }
233
+ interface TerminalElevationResponse {
234
+ message: string;
235
+ data: TerminalElevationResult;
236
+ }
213
237
  /**
214
238
  * `POST /terminal/pin` (userToken) — an employee sets or
215
239
  * replaces their own PIN. The account password is re-verified on the same
@@ -293,4 +317,9 @@ export type TerminalSessionErrorCode = (typeof TERMINAL_SESSION_ERROR_CODES)[num
293
317
  /** The `sf_terminal` cookie's lifetime and the pairing code's, in seconds — the two numbers a client may display. */
294
318
  export declare const TERMINAL_ENROLMENT_TTL_SECONDS: number;
295
319
  export declare const TERMINAL_PAIRING_CODE_TTL_SECONDS: number;
296
- export {};
320
+ /** Money-out actions whose operator sessions require a different ADMIN-or-higher approver. */
321
+ export declare const TERMINAL_ELEVATION_ACTIONS: readonly ["order.deposit-refund", "mercadopago.refund", "shift.refund", "shift.cash-out", "cash.withdrawal", "account.cash-debit", "tip.cash-payout"];
322
+ export type TerminalElevationAction = (typeof TERMINAL_ELEVATION_ACTIONS)[number];
323
+ /** Existing PIN, validation and idempotency refusals retain their current codes/statuses. */
324
+ export declare const TERMINAL_ELEVATION_ERROR_CODES: readonly ["ELEVATION_FORBIDDEN", "ELEVATION_APPROVER_FORBIDDEN", "OPERATOR_SESSION_STALE", "ELEVATION_REQUIRED", "ELEVATION_INVALID"];
325
+ export type TerminalElevationErrorCode = (typeof TERMINAL_ELEVATION_ERROR_CODES)[number];
package/dist/terminal.js CHANGED
@@ -15,11 +15,11 @@
15
15
  // live activation. The PIN only re-selects WHO operates the till; it is
16
16
  // never a standalone authentication.
17
17
  // 4. The ELEVATION TOKEN — 90 seconds, single use, bound to one exact action.
18
- // Not described here yet; its shapes land with the slice that serves it.
18
+ // Its credential is opaque and grants no access-token privileges.
19
19
  //
20
20
  // ⚠️ Rollout is sliced. ENROLMENT (pairing codes, redeem, list, revoke),
21
21
  // ACTIVATION, the OPERATOR PIN, PIN ENROLMENT and the operator-session read are
22
- // served. ELEVATION is not, and has no shape here yet. "Served" means merged: a
22
+ // served, including single-action money-out ELEVATION. "Served" means merged: a
23
23
  // client must still verify the api's deployment on its own route before relying
24
24
  // on one.
25
25
  /**
@@ -112,3 +112,21 @@ export const TERMINAL_SESSION_ERROR_CODES = [
112
112
  /** The `sf_terminal` cookie's lifetime and the pairing code's, in seconds — the two numbers a client may display. */
113
113
  export const TERMINAL_ENROLMENT_TTL_SECONDS = 365 * 24 * 60 * 60;
114
114
  export const TERMINAL_PAIRING_CODE_TTL_SECONDS = 10 * 60;
115
+ /** Money-out actions whose operator sessions require a different ADMIN-or-higher approver. */
116
+ export const TERMINAL_ELEVATION_ACTIONS = [
117
+ 'order.deposit-refund',
118
+ 'mercadopago.refund',
119
+ 'shift.refund',
120
+ 'shift.cash-out',
121
+ 'cash.withdrawal',
122
+ 'account.cash-debit',
123
+ 'tip.cash-payout',
124
+ ];
125
+ /** Existing PIN, validation and idempotency refusals retain their current codes/statuses. */
126
+ export const TERMINAL_ELEVATION_ERROR_CODES = [
127
+ 'ELEVATION_FORBIDDEN',
128
+ 'ELEVATION_APPROVER_FORBIDDEN',
129
+ 'OPERATOR_SESSION_STALE',
130
+ 'ELEVATION_REQUIRED',
131
+ 'ELEVATION_INVALID',
132
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.10.521",
3
+ "version": "1.10.523",
4
4
  "description": "Shared wire and entity contracts for the SINFACTURA platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",