platform-types 1.10.699 → 1.10.700

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/cash.d.ts CHANGED
@@ -104,13 +104,8 @@ declare global {
104
104
  * replays gross in and gross out. ⚠️ It is NOT `'refund'`, which is money
105
105
  * given BACK — a refund movement recorded on the shift, or the cash of a seña
106
106
  * refund (`POST /orders { mode: 'deposit-refund' }`, the net the seña kept).
107
- *
108
- * `'tip-payout'` is cash handed to a worker against their tip balance
109
- * (`POST /shifts/tips` `mode=payout`, `method=cash`) — an outcome, written in
110
- * the same transaction as the `TipBalance` debit. It is NOT a negative
111
- * `'tip'`, and a plain `'cash-out'` never debits a tip balance.
112
107
  */
113
- type CashEventType = 'apertura' | 'cash-in' | 'cash-out' | 'sale' | 'change' | 'refund' | 'tip' | 'tip-payout' | 'cierre' | 'reconcile';
108
+ type CashEventType = 'apertura' | 'cash-in' | 'cash-out' | 'sale' | 'change' | 'refund' | 'cierre' | 'reconcile';
114
109
  /**
115
110
  * A cashier's drawer shift — one per cashier per day. PK `STORE#{storeId}`,
116
111
  * SK `SHIFT#{shiftId}` where `shiftId = ${date}-${userId}`. State machine:
@@ -199,19 +194,6 @@ declare global {
199
194
  variance?: number;
200
195
  reconcileDecision?: 'approved' | 'rejected';
201
196
  reconcileNote?: string;
202
- /**
203
- * The net tips this shift received, per `CashEvent.recipientUserId`, in the
204
- * shift's currency: Σ income − Σ outcome over its `tip` events that name a
205
- * recipient. Stamped once, at close, and only when some recipient nets to a
206
- * non-zero amount.
207
- *
208
- * ⚠️ A summary, not a record: the tip ledger (`TipBalance`, `TipOperation`,
209
- * `TipEntry`) is the source of truth for what a worker is owed. `tip` events
210
- * with no recipient are excluded. Absent on every shift closed before the
211
- * ledger existed. It is not a compliance report: DNU 731/2024 creates no
212
- * AFIP/ARCA report for tips.
213
- */
214
- tipDistribution?: Record<string, number>;
215
197
  /**
216
198
  * The drawer's declared currency buckets, keyed by canonical currency
217
199
  * catalog id — one entry per currency the cashier declared at apertura.
@@ -219,8 +201,7 @@ declare global {
219
201
  *
220
202
  * ⚠️ THE PRIMARY-MIRROR RULE. `currency` names the primary (first-declared)
221
203
  * bucket, and the scalars `float`, `declaredCount`, `declaredDenominations`,
222
- * `expectedBalance`, `variance` and `tipDistribution` are the PRIMARY
223
- * bucket's figures. So a scalar reader keeps reading the primary bucket
204
+ * `expectedBalance` and `variance` are the PRIMARY bucket's figures. So a scalar reader keeps reading the primary bucket
224
205
  * correctly, and never a cross-currency total — no figure on this row ever
225
206
  * sums two buckets.
226
207
  *
@@ -228,8 +209,8 @@ declare global {
228
209
  * bucket through the api's responses (or its tolerant reader,
229
210
  * `shiftBuckets`), never by assuming `buckets[currency]` repeats them:
230
211
  * - A shift with ONE bucket stores `expectedBalance` and `variance` in the
231
- * scalars ONLY. Its bucket carries `float`, `declaredCount`,
232
- * `declaredDenominations` and `tipDistribution`. The blind target of a
212
+ * scalars ONLY. Its bucket carries `float`, `declaredCount` and
213
+ * `declaredDenominations`. The blind target of a
233
214
  * single-currency shift therefore has one home, the scalar every reader
234
215
  * already masks.
235
216
  * - A shift with two or more buckets stores every figure in every bucket,
@@ -277,8 +258,6 @@ declare global {
277
258
  * one-bucket shift.
278
259
  */
279
260
  variance?: number;
280
- /** Net tips per recipient over this currency's `tip` events — see `CashShift.tipDistribution`. */
281
- tipDistribution?: Record<string, number>;
282
261
  }
283
262
  /**
284
263
  * A `CashShiftBucket` as `GET /shifts` returns it — masked by the same rules
@@ -304,22 +283,6 @@ declare global {
304
283
  amount: number;
305
284
  direction?: 'income' | 'outcome';
306
285
  concept?: string;
307
- /**
308
- * On a `tip` event, the worker the tip belongs to — the caller by default,
309
- * or the active store user the movement named. Present exactly on the
310
- * ledger-backed tips: a `tip` event without it was recorded before the tip
311
- * ledger existed, stays in the drawer sum as before, and never becomes a
312
- * `TipBalance` or a `tipDistribution` entry. On a `tip-payout` event, the
313
- * worker who was paid.
314
- */
315
- recipientUserId?: string;
316
- /**
317
- * The `TipOperation.operationId` written in the same transaction as this
318
- * event. For a cash tip recorded as a drawer movement it equals `eventId`;
319
- * on a cash payout, or the compensation of a reversed cash tip or payout,
320
- * it is that act's client `operationId`.
321
- */
322
- tipOperationId?: string;
323
286
  currency: string;
324
287
  /**
325
288
  * The shift's own `CashShift.warehouseId`, copied onto every event so a
@@ -356,19 +319,14 @@ declare global {
356
319
  * `DELETE /account` of a cash movement whose mirror is a projection writes
357
320
  * one `'reversal'` with no rebook: the mirror's amount, copied, in the
358
321
  * opposite direction.
359
- *
360
- * A reversed cash tip or cash tip payout (`POST /shifts/tips`
361
- * `mode=reverse`) also writes one `'reversal'` event: a `tip` with direction
362
- * `outcome`, or a `tip-payout` with direction `income`. Its `direction` is
363
- * set explicitly — read it, never re-derive it from `type`.
364
322
  */
365
323
  compensation?: 'reversal' | 'rebook';
366
324
  }
367
325
  /**
368
326
  * `POST /shifts/{id}/movements` — a mid-shift drawer movement into the
369
327
  * caller's own OPEN drawer `{id}`. Mirrors the request side of the movement
370
- * schema in `stacks/lambdas/shifts/_postMovement.ts`; the schema strips unknown
371
- * keys, so the root `elevationToken` is read off the raw body.
328
+ * schema in `stacks/lambdas/shifts/_postMovement.ts`, which is strict: an unknown
329
+ * key is 400 VALIDATION_FAILED, and the root `elevationToken` is declared.
372
330
  *
373
331
  * From a PIN operator session, `type: 'refund'` is the `'shift.refund'`
374
332
  * elevated action and `type: 'cash-out'` is `'shift.cash-out'`; both bind the
@@ -377,19 +335,13 @@ declare global {
377
335
  * Held to its schema by `AssertShiftMovementRequestMatchesSchema`.
378
336
  */
379
337
  interface ShiftMovementRequest extends TerminalElevationAuthorization {
380
- type: 'cash-in' | 'cash-out' | 'refund' | 'tip';
338
+ type: 'cash-in' | 'cash-out' | 'refund';
381
339
  /** Above zero, at most the platform money-input cap. */
382
340
  amount: number;
383
341
  /** At most 500 characters. */
384
342
  concept?: string;
385
343
  /** A platform catalog id or ISO code the drawer declared. */
386
344
  currency?: string;
387
- /**
388
- * On a `tip` only — any other `type` carrying it is refused `400`, never
389
- * ignored. The worker the tip is owed to; defaults to the caller. Trimmed,
390
- * 1–64 characters.
391
- */
392
- recipientUserId?: string;
393
345
  }
394
346
  /**
395
347
  * A store's configurable bill/coin denomination catalog, used to validate a
@@ -513,131 +465,6 @@ declare global {
513
465
  /** Present and `true` only when the fold hit its page bound. */
514
466
  truncated?: boolean;
515
467
  }
516
- /**
517
- * What the store owes one worker in tips, in one currency. PK
518
- * `STORE#{storeId}`, SK `TIPBAL#{userId}#{currency}`.
519
- *
520
- * A tip is a LIABILITY the store holds for a named worker, never store
521
- * revenue (DNU 731/2024 art. 1 and 3). This row never enters the drawer sum:
522
- * the cash side of a tip is its `CashEvent`, and this is the worker's side.
523
- * Balances are per currency and are never converted.
524
- */
525
- interface TipBalance {
526
- storeId: string;
527
- userId: string;
528
- currency: string;
529
- /** Quantized to the currency's ledger scale. */
530
- owed: number;
531
- /**
532
- * When the balance was first credited after it was last zero (ms epoch).
533
- * DNU 731/2024 art. 7 gives the store 24 hours to make a tip available.
534
- * A debit that brings `owed` to exactly zero removes it; a partial debit
535
- * keeps the oldest credit's clock, so `overdue` errs early, never late.
536
- * The credit-back of a reversed payout is not new money: it restores the
537
- * clock to the payout's own `createdAt` unless an older clock is running.
538
- */
539
- owedSince?: number;
540
- updatedAt: number;
541
- }
542
- /**
543
- * A `TipBalance` as `GET /shifts/tips?mode=balances` answers it: `overdue` is
544
- * computed on read — true when some amount has been owed for more than 24
545
- * hours (`owedSince`). No cron and no notification stand behind it.
546
- */
547
- interface TipBalanceView extends TipBalance {
548
- overdue: boolean;
549
- }
550
- /** The acts the tip ledger records. */
551
- type TipOperationKind = 'receive' | 'allocate' | 'payout' | 'reverse';
552
- /**
553
- * One immutable tip act. PK `STORE#{storeId}`, SK `TIPOP#{operationId}`,
554
- * written under `attribute_not_exists(SK)` in the same transaction as every
555
- * balance it moves, so it is both the audit row and the idempotency anchor.
556
- */
557
- interface TipOperation {
558
- storeId: string;
559
- operationId: string;
560
- kind: TipOperationKind;
561
- /** How a `receive` arrived: through the drawer, or already in the store's account. */
562
- channel?: 'cash' | 'electronic';
563
- /** Approved provider payment backing this electronic receipt. */
564
- provider?: 'mercadopago' | 'stripe';
565
- providerPaymentId?: string;
566
- /** How a `payout` left (copied onto the `reverse` that undoes it). */
567
- method?: 'cash' | 'transfer';
568
- currency: string;
569
- amount: number;
570
- /** Who recorded the act. Provider-backed receipts may credit this same worker. */
571
- actorUserId: string;
572
- /** One signed delta per affected worker. */
573
- legs: {
574
- userId: string;
575
- delta: number;
576
- }[];
577
- /**
578
- * The drawer the act's `CashEvent` was written in — a cash `receive`, a cash
579
- * `payout`, or the compensation of a reversed cash act. Absent on a
580
- * ledger-only act.
581
- */
582
- shiftId?: string;
583
- /** The `CashEvent` the act wrote, under `shiftId`. */
584
- eventId?: string;
585
- /** An opaque client reference. Never read or written as an order. */
586
- orderId?: string;
587
- /** A `Store.paymentMethods` id, as an opaque reference. */
588
- paymentMethod?: number;
589
- note?: string;
590
- /** On a `reverse`: the `receive` or `payout` it undoes. */
591
- reversesOperationId?: string;
592
- /**
593
- * On a reversed `receive` or `payout`: the `reverse` that undid it. The ONE
594
- * attribute ever written onto a stored operation, set once under
595
- * `attribute_not_exists`, so an act is reversed at most once.
596
- */
597
- reversedBy?: string;
598
- createdAt: number;
599
- }
600
- /**
601
- * One signed movement of one worker's balance. PK `STORE#{storeId}`, SK
602
- * `TIPENTRY#{userId}#{createdAt}#{operationId}` — a worker's history reads
603
- * back in time order from one prefix.
604
- */
605
- interface TipEntry {
606
- storeId: string;
607
- userId: string;
608
- currency: string;
609
- operationId: string;
610
- kind: TipOperationKind;
611
- delta: number;
612
- createdAt: number;
613
- }
614
- /**
615
- * `POST /shifts/tips` `mode: 'payout'` — settle a worker's tip balance. Mirrors
616
- * the request side of `tipPayoutSchema` (`stacks/lambdas/shifts/_tips.ts`); the
617
- * schema strips unknown keys, so the root `elevationToken` is read off the raw
618
- * body.
619
- *
620
- * From a PIN operator session, `method: 'cash'` is the `'tip.cash-payout'`
621
- * elevated action: mint it with no `subjectId` (see
622
- * {@link TerminalElevationRequest.subjectId}) and attach the token here.
623
- * `method: 'transfer'` is ledger-only and needs no elevation.
624
- *
625
- * Held to its schema by `AssertTipPayoutRequestMatchesSchema`.
626
- */
627
- interface TipPayoutRequest extends TerminalElevationAuthorization {
628
- mode: 'payout';
629
- /** A client-minted UUID — the act's idempotency anchor (`TipOperation.operationId`). */
630
- operationId: string;
631
- /** Trimmed, 1–64 characters. Never the caller. */
632
- payeeUserId: string;
633
- /** Above zero, at most the platform money-input cap. */
634
- amount: number;
635
- /** A platform catalog id or ISO code. */
636
- currency: string;
637
- method: 'cash' | 'transfer';
638
- /** Trimmed, 1–500 characters. */
639
- note?: string;
640
- }
641
468
  }
642
469
  /**
643
470
  * Refusals from the cash-shift surface — `stacks/lambdas/shifts/*.ts`
@@ -672,32 +499,6 @@ declare global {
672
499
  */
673
500
  export declare const SHIFT_ERROR_CODES: readonly ["INVALID_SHIFT_ID", "SHIFT_NOT_FOUND", "SHIFT_ALREADY_OPEN", "SHIFT_NOT_OPEN", "SHIFT_NOT_CLOSED", "SHIFT_OWNER_MISMATCH", "CURRENCY_MISMATCH", "BUCKET_COUNTS_INVALID", "BUCKET_REVIEW_INVALID", "BUCKET_COUNT_MISSING", "SHIFT_CHANGED", "SHIFT_EVENTS_TRUNCATED", "SELF_APPROVAL_FORBIDDEN", "INVALID_DENOMINATION", "INVALID_CURSOR", "ROLE_FORBIDDEN", "VALIDATION_FAILED"];
674
501
  export type ShiftErrorCode = (typeof SHIFT_ERROR_CODES)[number];
675
- /**
676
- * Refusals from the tip ledger — `POST /shifts/{id}/movements` with `type: 'tip'`
677
- * and `/shifts/tips`.
678
- *
679
- * - `TIP_RECIPIENT_NOT_FOUND` · 404 — the named worker is missing, disabled or
680
- * removed, or is a print agent or an accountant login (neither can be paid).
681
- * - `TIP_SELF_ACTION_FORBIDDEN` · 403 — an employer act whose actor is also the
682
- * recipient or payee.
683
- * - `TIP_OPERATION_CONFLICT` · 409 — an `operationId` already used for a
684
- * different act.
685
- * - `TIP_BALANCE_CHANGED` · 409 — the tip's transaction collided with another
686
- * write on the same tip-ledger row (`TransactionConflict`), or a balance moved
687
- * between the debit's read and its write; nothing was written, retry with the
688
- * same `operationId`.
689
- * - `TIP_INSUFFICIENT_BALANCE` · 409 — a debit (`allocate`, `payout`, or the
690
- * `reverse` of a `receive`) larger than what the worker is owed.
691
- * - `TIP_ALREADY_REVERSED` · 409 — the target operation was already reversed.
692
- * - `TIP_NOT_REVERSIBLE` · 400 — only a `receive` or a `payout` can be
693
- * reversed; an `allocate` is corrected by the recipient re-allocating.
694
- * - `TIP_OPERATION_NOT_FOUND` · 404 — `targetOperationId` names no operation.
695
- *
696
- * ⚠️ Cross-cutting refusals (`CAPABILITY_REQUIRED`, `VALIDATION_FAILED`, the
697
- * drawer's own codes) are NOT repeated here.
698
- */
699
- export declare const TIP_ERROR_CODES: readonly ["TIP_INSUFFICIENT_BALANCE", "TIP_BALANCE_CHANGED", "TIP_OPERATION_CONFLICT", "TIP_RECIPIENT_NOT_FOUND", "TIP_SELF_ACTION_FORBIDDEN", "TIP_ALREADY_REVERSED", "TIP_NOT_REVERSIBLE", "TIP_OPERATION_NOT_FOUND"];
700
- export type TipErrorCode = (typeof TIP_ERROR_CODES)[number];
701
502
  /**
702
503
  * Where a {@link ShiftMethodTotal}'s `label` came from.
703
504
  *
package/dist/cash.js CHANGED
@@ -48,40 +48,6 @@ export const SHIFT_ERROR_CODES = [
48
48
  'ROLE_FORBIDDEN',
49
49
  'VALIDATION_FAILED',
50
50
  ];
51
- /**
52
- * Refusals from the tip ledger — `POST /shifts/{id}/movements` with `type: 'tip'`
53
- * and `/shifts/tips`.
54
- *
55
- * - `TIP_RECIPIENT_NOT_FOUND` · 404 — the named worker is missing, disabled or
56
- * removed, or is a print agent or an accountant login (neither can be paid).
57
- * - `TIP_SELF_ACTION_FORBIDDEN` · 403 — an employer act whose actor is also the
58
- * recipient or payee.
59
- * - `TIP_OPERATION_CONFLICT` · 409 — an `operationId` already used for a
60
- * different act.
61
- * - `TIP_BALANCE_CHANGED` · 409 — the tip's transaction collided with another
62
- * write on the same tip-ledger row (`TransactionConflict`), or a balance moved
63
- * between the debit's read and its write; nothing was written, retry with the
64
- * same `operationId`.
65
- * - `TIP_INSUFFICIENT_BALANCE` · 409 — a debit (`allocate`, `payout`, or the
66
- * `reverse` of a `receive`) larger than what the worker is owed.
67
- * - `TIP_ALREADY_REVERSED` · 409 — the target operation was already reversed.
68
- * - `TIP_NOT_REVERSIBLE` · 400 — only a `receive` or a `payout` can be
69
- * reversed; an `allocate` is corrected by the recipient re-allocating.
70
- * - `TIP_OPERATION_NOT_FOUND` · 404 — `targetOperationId` names no operation.
71
- *
72
- * ⚠️ Cross-cutting refusals (`CAPABILITY_REQUIRED`, `VALIDATION_FAILED`, the
73
- * drawer's own codes) are NOT repeated here.
74
- */
75
- export const TIP_ERROR_CODES = [
76
- 'TIP_INSUFFICIENT_BALANCE',
77
- 'TIP_BALANCE_CHANGED',
78
- 'TIP_OPERATION_CONFLICT',
79
- 'TIP_RECIPIENT_NOT_FOUND',
80
- 'TIP_SELF_ACTION_FORBIDDEN',
81
- 'TIP_ALREADY_REVERSED',
82
- 'TIP_NOT_REVERSIBLE',
83
- 'TIP_OPERATION_NOT_FOUND',
84
- ];
85
51
  /**
86
52
  * Where a {@link ShiftMethodTotal}'s `label` came from.
87
53
  *
package/dist/cjs/cash.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.METHOD_LABEL_SOURCES = exports.TIP_ERROR_CODES = exports.SHIFT_ERROR_CODES = void 0;
3
+ exports.METHOD_LABEL_SOURCES = exports.SHIFT_ERROR_CODES = void 0;
4
4
  /**
5
5
  * Refusals from the cash-shift surface — `stacks/lambdas/shifts/*.ts`
6
6
  * (`_get`, `_post`, `_patchClose`, `_postMovement`, `_patchReconcile`).
@@ -51,40 +51,6 @@ exports.SHIFT_ERROR_CODES = [
51
51
  'ROLE_FORBIDDEN',
52
52
  'VALIDATION_FAILED',
53
53
  ];
54
- /**
55
- * Refusals from the tip ledger — `POST /shifts/{id}/movements` with `type: 'tip'`
56
- * and `/shifts/tips`.
57
- *
58
- * - `TIP_RECIPIENT_NOT_FOUND` · 404 — the named worker is missing, disabled or
59
- * removed, or is a print agent or an accountant login (neither can be paid).
60
- * - `TIP_SELF_ACTION_FORBIDDEN` · 403 — an employer act whose actor is also the
61
- * recipient or payee.
62
- * - `TIP_OPERATION_CONFLICT` · 409 — an `operationId` already used for a
63
- * different act.
64
- * - `TIP_BALANCE_CHANGED` · 409 — the tip's transaction collided with another
65
- * write on the same tip-ledger row (`TransactionConflict`), or a balance moved
66
- * between the debit's read and its write; nothing was written, retry with the
67
- * same `operationId`.
68
- * - `TIP_INSUFFICIENT_BALANCE` · 409 — a debit (`allocate`, `payout`, or the
69
- * `reverse` of a `receive`) larger than what the worker is owed.
70
- * - `TIP_ALREADY_REVERSED` · 409 — the target operation was already reversed.
71
- * - `TIP_NOT_REVERSIBLE` · 400 — only a `receive` or a `payout` can be
72
- * reversed; an `allocate` is corrected by the recipient re-allocating.
73
- * - `TIP_OPERATION_NOT_FOUND` · 404 — `targetOperationId` names no operation.
74
- *
75
- * ⚠️ Cross-cutting refusals (`CAPABILITY_REQUIRED`, `VALIDATION_FAILED`, the
76
- * drawer's own codes) are NOT repeated here.
77
- */
78
- exports.TIP_ERROR_CODES = [
79
- 'TIP_INSUFFICIENT_BALANCE',
80
- 'TIP_BALANCE_CHANGED',
81
- 'TIP_OPERATION_CONFLICT',
82
- 'TIP_RECIPIENT_NOT_FOUND',
83
- 'TIP_SELF_ACTION_FORBIDDEN',
84
- 'TIP_ALREADY_REVERSED',
85
- 'TIP_NOT_REVERSIBLE',
86
- 'TIP_OPERATION_NOT_FOUND',
87
- ];
88
54
  /**
89
55
  * Where a {@link ShiftMethodTotal}'s `label` came from.
90
56
  *
@@ -18,9 +18,8 @@ exports.GATING_ERROR_CODES = void 0;
18
18
  * `message`) — its lifecycle leaving `active`, a sales channel dropped,
19
19
  * hidden from the storefront, or its price left with nothing to derive from —
20
20
  * as the product-group write does an archive or a draft of an active group,
21
- * the kit save a product it would make a kit, `POST /stripe` a payment
22
- * carrying a tip, `POST /warehouses` a depósito taken out of service or re-pointed to
23
- * another punto de venta,
21
+ * the kit save a product it would make a kit, `POST /warehouses` a depósito
22
+ * taken out of service or re-pointed to another punto de venta,
24
23
  * `POST /transfers` a dispatched transfer cancelled or closed short,
25
24
  * `PATCH /store` a change to the stock a sales channel is fed from, the
26
25
  * customer, brand, attribute and category writes a disable of a row not
@@ -1,15 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MP_REFUND_RECOVERY_ERROR_CODES = exports.MP_POINT_TIP_ERROR_CODES = exports.MP_DYNAMIC_QR_ERROR_CODES = void 0;
3
+ exports.MP_DYNAMIC_QR_ERROR_CODES = void 0;
4
4
  /**
5
5
  * Dynamic QR initiation refusals, by status:
6
- * - 400 malformed request (`VALIDATION_FAILED`, `TIP_EXCEEDS_ORDER`, `TIP_ORDER_REQUIRED`), or an
7
- * order whose paid sum cannot be converted for want of a usable rate (`FX_CONVERSION_UNAVAILABLE`);
8
- * - 403 permission, plan or support session (`CAPABILITY_REQUIRED`, `ROLE_FORBIDDEN`,
9
- * `PLAN_UPGRADE_REQUIRED`, `IMPERSONATION_READONLY`);
10
- * - 404 missing order or worker (`TIP_ORDER_NOT_FOUND`, `TIP_RECIPIENT_NOT_FOUND`; the POST never
11
- * answers `ORDER_NOT_FOUND`, only the re-sync read below does);
12
- * - 409 order state, account, attempt or allocation conflicts (every other order/tip/attempt code);
6
+ * - 400 malformed request (`VALIDATION_FAILED`, an unknown body key included);
7
+ * - 403 permission or plan (`CAPABILITY_REQUIRED`, `ROLE_FORBIDDEN`,
8
+ * `PLAN_UPGRADE_REQUIRED`);
9
+ * - 409 order state or a held order fence (`ORDER_CANCELLED`, `MP_DYN_QR_IN_PROGRESS`); the POST
10
+ * never answers `ORDER_NOT_FOUND`, only the re-sync read below does;
13
11
  * - 412 connection or configuration (`MP_NOT_CONNECTED`, `MP_TOKEN_EXPIRED`, `MP_USER_ID_MISSING`,
14
12
  * `MP_NO_STORE_ON_ACCOUNT`);
15
13
  * - 502 a definite POS or QR rejection (`MP_DYN_POS_CREATE_FAILED`, `MP_POS_INVALID`,
@@ -19,23 +17,13 @@ exports.MP_REFUND_RECOVERY_ERROR_CODES = exports.MP_POINT_TIP_ERROR_CODES = expo
19
17
  * (`GET /mercadopago/qr/dynamic?orderId=`) uses `VALIDATION_FAILED`, `PLAN_UPGRADE_REQUIRED`,
20
18
  * `CAPABILITY_REQUIRED`, `ORDER_NOT_FOUND` and `ORDER_CANCELLED` from this list.
21
19
  *
22
- * Per Idempotency-Key on the tipped path: `MP_DYN_QR_IN_PROGRESS` = in flight
23
- * (keep the key, poll); `MP_DYN_QR_REJECTED` = ended with no live charge (a
24
- * fresh key is safe); `MP_DYN_QR_EXPIRED` = its QR expired (permanent for that
25
- * key). A `contacting` attempt (MercadoPago may have been called) stays blocked
26
- * indefinitely; a `reserved` one (provably never contacted) is released once it
27
- * outlives the Lambda timeout. A fresh tipped reservation on an order already
28
- * fully paid (till tenders plus linked payments cover its total, as its
29
- * `financialStatus` derives) answers `PAYMENT_ALREADY_RECEIVED`; a part-paid
30
- * order (a split) still mints the remainder. When a till tender or linked payment
31
- * is in a currency the store holds no usable rate for, the paid sum is unknown, not
32
- * paid: it answers `400 FX_CONVERSION_UNAVAILABLE` (configure the rate in Monedas,
33
- * then retry with the same key).
34
- * `MP_DYN_QR_INVALID` is untipped-only: on the tipped path a malformed 2xx is
35
- * `MP_DYN_QR_UNCONFIRMED`. The retired `{ orderId }`-only body answers
36
- * `VALIDATION_FAILED`. `INVALID_ORDER_STATE`, `ORDER_FX_RATE_UNAVAILABLE` and
37
- * `ORDER_FX_AMOUNT_TOO_SMALL` were that body's alone and are no longer emitted;
38
- * they stay listed so an existing client switch still compiles.
20
+ * An order-bound charge holds the order's QR fence while it mints, and another charge for the
21
+ * same order meanwhile answers `MP_DYN_QR_IN_PROGRESS`. A `contacting` attempt (MercadoPago may
22
+ * have been called) stays blocked indefinitely; a `reserved` one (provably never contacted) is
23
+ * released once it outlives the Lambda timeout. A QR MercadoPago returned whose attempt could not
24
+ * be recorded answers `MP_DYN_QR_UNCONFIRMED`; a malformed 2xx answers `MP_DYN_QR_INVALID`.
25
+ * The retired `{ orderId }`-only body answers `VALIDATION_FAILED`. `INVALID_ORDER_STATE`,
26
+ * `ORDER_FX_RATE_UNAVAILABLE` and `ORDER_FX_AMOUNT_TOO_SMALL` were that body's alone.
39
27
  */
40
28
  exports.MP_DYNAMIC_QR_ERROR_CODES = [
41
29
  'VALIDATION_FAILED',
@@ -51,49 +39,11 @@ exports.MP_DYNAMIC_QR_ERROR_CODES = [
51
39
  'PLAN_UPGRADE_REQUIRED',
52
40
  'ORDER_CANCELLED',
53
41
  'INVALID_ORDER_STATE',
54
- 'PAYMENT_ALREADY_RECEIVED',
55
42
  'ORDER_NOT_FOUND',
56
43
  'ORDER_FX_RATE_UNAVAILABLE',
57
44
  'ORDER_FX_AMOUNT_TOO_SMALL',
58
45
  'CAPABILITY_REQUIRED',
59
46
  'ROLE_FORBIDDEN',
60
- 'IMPERSONATION_READONLY',
61
- 'TIP_EXCEEDS_ORDER',
62
- 'TIP_RECIPIENT_NOT_FOUND',
63
- 'TIP_ACCOUNT_UNVERIFIED',
64
- 'TIP_SHARED_ACCOUNT_FORBIDDEN',
65
- 'TIP_ORDER_REQUIRED',
66
- 'TIP_ORDER_NOT_FOUND',
67
- 'TIP_OPERATION_CONFLICT',
68
- 'TIP_PAYMENT_NOT_FOUND',
69
47
  'MP_DYN_QR_IN_PROGRESS',
70
- 'MP_DYN_QR_EXPIRED',
71
48
  'MP_DYN_QR_UNCONFIRMED',
72
- 'MP_DYN_QR_REJECTED',
73
- 'FX_CONVERSION_UNAVAILABLE',
74
- ];
75
- exports.MP_POINT_TIP_ERROR_CODES = [
76
- 'TIP_EXCEEDS_ORDER',
77
- 'VALIDATION_FAILED',
78
- 'CAPABILITY_REQUIRED',
79
- 'ROLE_FORBIDDEN',
80
- 'PLAN_UPGRADE_REQUIRED',
81
- 'TIP_RECIPIENT_NOT_FOUND',
82
- 'TIP_ACCOUNT_UNVERIFIED',
83
- 'TIP_SHARED_ACCOUNT_FORBIDDEN',
84
- 'TIP_ORDER_REQUIRED',
85
- 'TIP_ORDER_NOT_FOUND',
86
- 'TIP_OPERATION_CONFLICT',
87
- 'TIP_PAYMENT_MISMATCH',
88
- 'TIP_PAYMENT_NOT_FOUND',
89
- 'TIP_REFUND_EXCEEDS_ORDER',
90
- ];
91
- exports.MP_REFUND_RECOVERY_ERROR_CODES = [
92
- 'VALIDATION_FAILED',
93
- 'MISSING_PAYMENT_ID',
94
- 'MP_REFUND_RECOVERY_NOT_FOUND',
95
- 'MP_REFUND_RECOVERY_MISMATCH',
96
- 'MP_REFUND_IN_PROGRESS',
97
- 'MP_NOT_CONNECTED',
98
- 'MP_REFUND_PROVIDER_UNAVAILABLE',
99
49
  ];
@@ -23,9 +23,6 @@ exports.REPORT_WAREHOUSE_NONE = 'none';
23
23
  * - `change` — a `change` event: cash handed back while settling a sale.
24
24
  * - `refund` — a `refund` event: a refund movement recorded on a drawer, or the
25
25
  * cash a sales seña refund or a customer order return gives back.
26
- * - `tip` — a `tip` event, and the reversal of one.
27
- * - `tip-payout` — a `tip-payout` event (cash paid to a worker against their
28
- * tip balance), and the reversal of one.
29
26
  * - `account` — a `cash-in`/`cash-out` carrying `accountId`: the cash side of a
30
27
  * customer-account payment, and its reversal.
31
28
  * - `cash-book` — a `cash-in`/`cash-out` carrying `cashId` and no `accountId`:
@@ -48,8 +45,6 @@ exports.CASH_FLOW_SOURCES = [
48
45
  'sales',
49
46
  'change',
50
47
  'refund',
51
- 'tip',
52
- 'tip-payout',
53
48
  'account',
54
49
  'cash-book',
55
50
  'service-order-deposit',
@@ -185,7 +185,6 @@ exports.TERMINAL_ELEVATION_ACTIONS = [
185
185
  'shift.cash-out',
186
186
  'cash.withdrawal',
187
187
  'account.cash-debit',
188
- 'tip.cash-payout',
189
188
  ];
190
189
  /**
191
190
  * Existing PIN, validation and idempotency refusals retain their current
package/dist/gating.d.ts CHANGED
@@ -15,9 +15,8 @@
15
15
  * `message`) — its lifecycle leaving `active`, a sales channel dropped,
16
16
  * hidden from the storefront, or its price left with nothing to derive from —
17
17
  * as the product-group write does an archive or a draft of an active group,
18
- * the kit save a product it would make a kit, `POST /stripe` a payment
19
- * carrying a tip, `POST /warehouses` a depósito taken out of service or re-pointed to
20
- * another punto de venta,
18
+ * the kit save a product it would make a kit, `POST /warehouses` a depósito
19
+ * taken out of service or re-pointed to another punto de venta,
21
20
  * `POST /transfers` a dispatched transfer cancelled or closed short,
22
21
  * `PATCH /store` a change to the stock a sales channel is fed from, the
23
22
  * customer, brand, attribute and category writes a disable of a row not
package/dist/gating.js CHANGED
@@ -15,9 +15,8 @@
15
15
  * `message`) — its lifecycle leaving `active`, a sales channel dropped,
16
16
  * hidden from the storefront, or its price left with nothing to derive from —
17
17
  * as the product-group write does an archive or a draft of an active group,
18
- * the kit save a product it would make a kit, `POST /stripe` a payment
19
- * carrying a tip, `POST /warehouses` a depósito taken out of service or re-pointed to
20
- * another punto de venta,
18
+ * the kit save a product it would make a kit, `POST /warehouses` a depósito
19
+ * taken out of service or re-pointed to another punto de venta,
21
20
  * `POST /transfers` a dispatched transfer cancelled or closed short,
22
21
  * `PATCH /store` a change to the stock a sales channel is fed from, the
23
22
  * customer, brand, attribute and category writes a disable of a row not
@@ -1,40 +1,8 @@
1
1
  declare global {
2
- type MpRefundRequest = ({
2
+ type MpRefundRequest = {
3
3
  amount?: number;
4
4
  reason?: string;
5
- mode?: never;
6
- } | {
7
- mode: 'resume';
8
- amount?: never;
9
- reason?: never;
10
- }) & TerminalElevationAuthorization;
11
- /** Exact provider outcome without a local monetary refund stamp. */
12
- type MpRefundProviderOutcomeResponse = {
13
- message: string;
14
- data: {
15
- paymentId: string;
16
- refundId: string;
17
- amount: number;
18
- status: 'in_process' | 'rejected';
19
- recordedLocally: false;
20
- /** False for initial POST; true for history-only recovery. */
21
- recovered: boolean;
22
- };
23
- };
24
- type MpRefundResumeResponse = {
25
- message: string;
26
- data: {
27
- paymentId: string;
28
- refundId: string;
29
- amount: number | null;
30
- status: string;
31
- type: 'partial';
32
- reconciled: boolean;
33
- reconcileReason?: string;
34
- recordedLocally: true;
35
- recovered: true;
36
- };
37
- } | MpRefundProviderOutcomeResponse;
5
+ } & TerminalElevationAuthorization;
38
6
  /**
39
7
  * Device fetched from `GET /point/integration-api/devices` (BE → FE so the
40
8
  * admin can pick which physical device receives a payment intent).
@@ -78,49 +46,33 @@ declare global {
78
46
  }
79
47
  interface MpPointIntentRequest {
80
48
  deviceId: string;
81
- /** Order portion in ARS major units; tip is charged in addition. */
49
+ /** Charge in ARS major units. */
82
50
  amount: number;
83
51
  currency: 'ARS';
84
52
  externalReference: string;
85
53
  ticketNumber?: string;
86
54
  printOnTerminal?: boolean;
87
- /** Positive, cent-exact ARS major units, no greater than amount. Recipient defaults to cashier. */
88
- tip?: {
89
- amount: number;
90
- recipientUserId?: string;
91
- };
92
55
  }
93
56
  interface MpPointIntentResponse {
94
57
  message: string;
95
58
  data: {
96
59
  intentId: string | null;
97
60
  deviceId: string;
98
- /** Gross provider charge in ARS major units. */
61
+ /** Charge in ARS major units. */
99
62
  amount: number;
100
63
  currency: 'ARS';
101
- /** Resolved caller reference, before the server-owned tip carrier. */
64
+ /** Resolved caller reference. */
102
65
  externalReference: string;
103
66
  isNew: boolean;
104
- /** Present only when the charge includes a tip. */
105
- orderAmount?: number;
106
- tip?: {
107
- amount: number;
108
- recipientUserId: string;
109
- };
110
67
  };
111
68
  }
112
69
  interface MpDynamicQrRequest {
113
- /** Order portion in ARS major units; tip is charged in addition. */
70
+ /** Charge in ARS major units. */
114
71
  amount: number;
115
72
  currency: 'ARS';
116
73
  externalReference?: string;
117
74
  customerId?: string;
118
75
  expirationMinutes?: number;
119
- /** Positive, cent-exact ARS major units, no greater than amount. Requires an ORD reference. */
120
- tip?: {
121
- amount: number;
122
- recipientUserId?: string;
123
- };
124
76
  }
125
77
  interface MpDynamicQrResponse {
126
78
  qrData: string;
@@ -129,57 +81,30 @@ declare global {
129
81
  externalReference: string;
130
82
  customerId?: string;
131
83
  amount: number;
132
- /** Present only when the charge includes a tip; no recipient identity. */
133
- orderAmount?: number;
134
- tipAmount?: number;
135
84
  currency: string;
136
85
  expiresAt: number;
137
86
  createdAt: number;
138
87
  isNew: boolean;
139
- /**
140
- * Server clock (Unix ms) when this response was built. Present on the tipped
141
- * create and replay; never persisted, so a replay carries the replay's instant.
142
- * Estimate the client clock offset from this, not from `createdAt` (the
143
- * reservation instant, taken before the POS lookup and the provider call).
144
- */
145
- serverNow?: number;
146
88
  }
147
89
  /**
148
- * `data` of `409 MP_DYN_QR_IN_PROGRESS`. `scope: 'attempt'` = this
149
- * Idempotency-Key's own attempt is in flight; `'order'` = another identity
150
- * holds the order's QR fence. `since` = the blocking attempt's reservation
151
- * instant (absent only on a fence written before it was stamped). `expiresAt`
152
- * only on `state: 'ready'` (an unexpired tipped QR), the instant the fence
153
- * frees; `reserved`/`contacting` carry none.
90
+ * `data` of `409 MP_DYN_QR_IN_PROGRESS`: another attempt holds the order's QR
91
+ * fence. `serverNow` = the refusal's own instant; `since` = the blocking
92
+ * attempt's reservation instant (absent only on a fence written before it was
93
+ * stamped).
154
94
  */
155
95
  interface MpDynamicQrInProgressDetails {
156
96
  serverNow: number;
157
- scope: 'attempt' | 'order';
158
- state: 'reserved' | 'contacting' | 'ready';
97
+ scope: 'order';
98
+ state: 'reserved' | 'contacting';
159
99
  since?: number;
160
- expiresAt?: number;
161
- }
162
- /** `data` of `409 MP_DYN_QR_EXPIRED`: the same key's saved QR expired at `expiresAt`. */
163
- interface MpDynamicQrExpiredDetails {
164
- serverNow: number;
165
- expiresAt: number;
166
- }
167
- /** `data` of `409 MP_DYN_QR_REJECTED`: the same key's attempt ended with no live charge. */
168
- interface MpDynamicQrRejectedDetails {
169
- serverNow: number;
170
100
  }
171
101
  /**
172
102
  * `data` of `GET /mercadopago/qr/dynamic?orderId=` — the re-sync read of the order's
173
- * dynamic QR. Never carries the Idempotency-Key, owner, fingerprint or tip recipient.
174
- * `ready` = an unexpired tipped QR (`qr.isNew` is always false); `pending` = an attempt
103
+ * dynamic QR. Never carries the attempt's key or owner. `pending` = an attempt
175
104
  * holds the order's fence (`since` = its reservation instant; no `qrData`); `none` =
176
105
  * nothing blocks the order.
177
106
  */
178
107
  type MpDynamicQrStateResponse = {
179
- state: 'ready';
180
- qr: MpDynamicQrResponse;
181
- serverNow: number;
182
- } | {
183
108
  state: 'pending';
184
109
  phase: 'reserved' | 'contacting';
185
110
  since?: number;
@@ -254,13 +179,11 @@ declare global {
254
179
  }
255
180
  /**
256
181
  * Dynamic QR initiation refusals, by status:
257
- * - 400 malformed request (`VALIDATION_FAILED`, `TIP_EXCEEDS_ORDER`, `TIP_ORDER_REQUIRED`), or an
258
- * order whose paid sum cannot be converted for want of a usable rate (`FX_CONVERSION_UNAVAILABLE`);
259
- * - 403 permission, plan or support session (`CAPABILITY_REQUIRED`, `ROLE_FORBIDDEN`,
260
- * `PLAN_UPGRADE_REQUIRED`, `IMPERSONATION_READONLY`);
261
- * - 404 missing order or worker (`TIP_ORDER_NOT_FOUND`, `TIP_RECIPIENT_NOT_FOUND`; the POST never
262
- * answers `ORDER_NOT_FOUND`, only the re-sync read below does);
263
- * - 409 order state, account, attempt or allocation conflicts (every other order/tip/attempt code);
182
+ * - 400 malformed request (`VALIDATION_FAILED`, an unknown body key included);
183
+ * - 403 permission or plan (`CAPABILITY_REQUIRED`, `ROLE_FORBIDDEN`,
184
+ * `PLAN_UPGRADE_REQUIRED`);
185
+ * - 409 order state or a held order fence (`ORDER_CANCELLED`, `MP_DYN_QR_IN_PROGRESS`); the POST
186
+ * never answers `ORDER_NOT_FOUND`, only the re-sync read below does;
264
187
  * - 412 connection or configuration (`MP_NOT_CONNECTED`, `MP_TOKEN_EXPIRED`, `MP_USER_ID_MISSING`,
265
188
  * `MP_NO_STORE_ON_ACCOUNT`);
266
189
  * - 502 a definite POS or QR rejection (`MP_DYN_POS_CREATE_FAILED`, `MP_POS_INVALID`,
@@ -270,28 +193,14 @@ declare global {
270
193
  * (`GET /mercadopago/qr/dynamic?orderId=`) uses `VALIDATION_FAILED`, `PLAN_UPGRADE_REQUIRED`,
271
194
  * `CAPABILITY_REQUIRED`, `ORDER_NOT_FOUND` and `ORDER_CANCELLED` from this list.
272
195
  *
273
- * Per Idempotency-Key on the tipped path: `MP_DYN_QR_IN_PROGRESS` = in flight
274
- * (keep the key, poll); `MP_DYN_QR_REJECTED` = ended with no live charge (a
275
- * fresh key is safe); `MP_DYN_QR_EXPIRED` = its QR expired (permanent for that
276
- * key). A `contacting` attempt (MercadoPago may have been called) stays blocked
277
- * indefinitely; a `reserved` one (provably never contacted) is released once it
278
- * outlives the Lambda timeout. A fresh tipped reservation on an order already
279
- * fully paid (till tenders plus linked payments cover its total, as its
280
- * `financialStatus` derives) answers `PAYMENT_ALREADY_RECEIVED`; a part-paid
281
- * order (a split) still mints the remainder. When a till tender or linked payment
282
- * is in a currency the store holds no usable rate for, the paid sum is unknown, not
283
- * paid: it answers `400 FX_CONVERSION_UNAVAILABLE` (configure the rate in Monedas,
284
- * then retry with the same key).
285
- * `MP_DYN_QR_INVALID` is untipped-only: on the tipped path a malformed 2xx is
286
- * `MP_DYN_QR_UNCONFIRMED`. The retired `{ orderId }`-only body answers
287
- * `VALIDATION_FAILED`. `INVALID_ORDER_STATE`, `ORDER_FX_RATE_UNAVAILABLE` and
288
- * `ORDER_FX_AMOUNT_TOO_SMALL` were that body's alone and are no longer emitted;
289
- * they stay listed so an existing client switch still compiles.
196
+ * An order-bound charge holds the order's QR fence while it mints, and another charge for the
197
+ * same order meanwhile answers `MP_DYN_QR_IN_PROGRESS`. A `contacting` attempt (MercadoPago may
198
+ * have been called) stays blocked indefinitely; a `reserved` one (provably never contacted) is
199
+ * released once it outlives the Lambda timeout. A QR MercadoPago returned whose attempt could not
200
+ * be recorded answers `MP_DYN_QR_UNCONFIRMED`; a malformed 2xx answers `MP_DYN_QR_INVALID`.
201
+ * The retired `{ orderId }`-only body answers `VALIDATION_FAILED`. `INVALID_ORDER_STATE`,
202
+ * `ORDER_FX_RATE_UNAVAILABLE` and `ORDER_FX_AMOUNT_TOO_SMALL` were that body's alone.
290
203
  */
291
- export declare const MP_DYNAMIC_QR_ERROR_CODES: readonly ["VALIDATION_FAILED", "MP_NOT_CONNECTED", "MP_TOKEN_EXPIRED", "MP_USER_ID_MISSING", "MP_NO_STORE_ON_ACCOUNT", "MP_DYN_POS_CREATE_FAILED", "MP_POS_INVALID", "MP_DYN_QR_CREATE_FAILED", "MP_DYN_QR_INVALID", "PLATFORM_INTEGRATION_DISABLED", "PLAN_UPGRADE_REQUIRED", "ORDER_CANCELLED", "INVALID_ORDER_STATE", "PAYMENT_ALREADY_RECEIVED", "ORDER_NOT_FOUND", "ORDER_FX_RATE_UNAVAILABLE", "ORDER_FX_AMOUNT_TOO_SMALL", "CAPABILITY_REQUIRED", "ROLE_FORBIDDEN", "IMPERSONATION_READONLY", "TIP_EXCEEDS_ORDER", "TIP_RECIPIENT_NOT_FOUND", "TIP_ACCOUNT_UNVERIFIED", "TIP_SHARED_ACCOUNT_FORBIDDEN", "TIP_ORDER_REQUIRED", "TIP_ORDER_NOT_FOUND", "TIP_OPERATION_CONFLICT", "TIP_PAYMENT_NOT_FOUND", "MP_DYN_QR_IN_PROGRESS", "MP_DYN_QR_EXPIRED", "MP_DYN_QR_UNCONFIRMED", "MP_DYN_QR_REJECTED", "FX_CONVERSION_UNAVAILABLE"];
204
+ export declare const MP_DYNAMIC_QR_ERROR_CODES: readonly ["VALIDATION_FAILED", "MP_NOT_CONNECTED", "MP_TOKEN_EXPIRED", "MP_USER_ID_MISSING", "MP_NO_STORE_ON_ACCOUNT", "MP_DYN_POS_CREATE_FAILED", "MP_POS_INVALID", "MP_DYN_QR_CREATE_FAILED", "MP_DYN_QR_INVALID", "PLATFORM_INTEGRATION_DISABLED", "PLAN_UPGRADE_REQUIRED", "ORDER_CANCELLED", "INVALID_ORDER_STATE", "ORDER_NOT_FOUND", "ORDER_FX_RATE_UNAVAILABLE", "ORDER_FX_AMOUNT_TOO_SMALL", "CAPABILITY_REQUIRED", "ROLE_FORBIDDEN", "MP_DYN_QR_IN_PROGRESS", "MP_DYN_QR_UNCONFIRMED"];
292
205
  export type MpDynamicQrErrorCode = (typeof MP_DYNAMIC_QR_ERROR_CODES)[number];
293
- export declare const MP_POINT_TIP_ERROR_CODES: readonly ["TIP_EXCEEDS_ORDER", "VALIDATION_FAILED", "CAPABILITY_REQUIRED", "ROLE_FORBIDDEN", "PLAN_UPGRADE_REQUIRED", "TIP_RECIPIENT_NOT_FOUND", "TIP_ACCOUNT_UNVERIFIED", "TIP_SHARED_ACCOUNT_FORBIDDEN", "TIP_ORDER_REQUIRED", "TIP_ORDER_NOT_FOUND", "TIP_OPERATION_CONFLICT", "TIP_PAYMENT_MISMATCH", "TIP_PAYMENT_NOT_FOUND", "TIP_REFUND_EXCEEDS_ORDER"];
294
- export type MpPointTipErrorCode = (typeof MP_POINT_TIP_ERROR_CODES)[number];
295
- export declare const MP_REFUND_RECOVERY_ERROR_CODES: readonly ["VALIDATION_FAILED", "MISSING_PAYMENT_ID", "MP_REFUND_RECOVERY_NOT_FOUND", "MP_REFUND_RECOVERY_MISMATCH", "MP_REFUND_IN_PROGRESS", "MP_NOT_CONNECTED", "MP_REFUND_PROVIDER_UNAVAILABLE"];
296
- export type MpRefundRecoveryErrorCode = (typeof MP_REFUND_RECOVERY_ERROR_CODES)[number];
297
206
  export {};
@@ -1,12 +1,10 @@
1
1
  /**
2
2
  * Dynamic QR initiation refusals, by status:
3
- * - 400 malformed request (`VALIDATION_FAILED`, `TIP_EXCEEDS_ORDER`, `TIP_ORDER_REQUIRED`), or an
4
- * order whose paid sum cannot be converted for want of a usable rate (`FX_CONVERSION_UNAVAILABLE`);
5
- * - 403 permission, plan or support session (`CAPABILITY_REQUIRED`, `ROLE_FORBIDDEN`,
6
- * `PLAN_UPGRADE_REQUIRED`, `IMPERSONATION_READONLY`);
7
- * - 404 missing order or worker (`TIP_ORDER_NOT_FOUND`, `TIP_RECIPIENT_NOT_FOUND`; the POST never
8
- * answers `ORDER_NOT_FOUND`, only the re-sync read below does);
9
- * - 409 order state, account, attempt or allocation conflicts (every other order/tip/attempt code);
3
+ * - 400 malformed request (`VALIDATION_FAILED`, an unknown body key included);
4
+ * - 403 permission or plan (`CAPABILITY_REQUIRED`, `ROLE_FORBIDDEN`,
5
+ * `PLAN_UPGRADE_REQUIRED`);
6
+ * - 409 order state or a held order fence (`ORDER_CANCELLED`, `MP_DYN_QR_IN_PROGRESS`); the POST
7
+ * never answers `ORDER_NOT_FOUND`, only the re-sync read below does;
10
8
  * - 412 connection or configuration (`MP_NOT_CONNECTED`, `MP_TOKEN_EXPIRED`, `MP_USER_ID_MISSING`,
11
9
  * `MP_NO_STORE_ON_ACCOUNT`);
12
10
  * - 502 a definite POS or QR rejection (`MP_DYN_POS_CREATE_FAILED`, `MP_POS_INVALID`,
@@ -16,23 +14,13 @@
16
14
  * (`GET /mercadopago/qr/dynamic?orderId=`) uses `VALIDATION_FAILED`, `PLAN_UPGRADE_REQUIRED`,
17
15
  * `CAPABILITY_REQUIRED`, `ORDER_NOT_FOUND` and `ORDER_CANCELLED` from this list.
18
16
  *
19
- * Per Idempotency-Key on the tipped path: `MP_DYN_QR_IN_PROGRESS` = in flight
20
- * (keep the key, poll); `MP_DYN_QR_REJECTED` = ended with no live charge (a
21
- * fresh key is safe); `MP_DYN_QR_EXPIRED` = its QR expired (permanent for that
22
- * key). A `contacting` attempt (MercadoPago may have been called) stays blocked
23
- * indefinitely; a `reserved` one (provably never contacted) is released once it
24
- * outlives the Lambda timeout. A fresh tipped reservation on an order already
25
- * fully paid (till tenders plus linked payments cover its total, as its
26
- * `financialStatus` derives) answers `PAYMENT_ALREADY_RECEIVED`; a part-paid
27
- * order (a split) still mints the remainder. When a till tender or linked payment
28
- * is in a currency the store holds no usable rate for, the paid sum is unknown, not
29
- * paid: it answers `400 FX_CONVERSION_UNAVAILABLE` (configure the rate in Monedas,
30
- * then retry with the same key).
31
- * `MP_DYN_QR_INVALID` is untipped-only: on the tipped path a malformed 2xx is
32
- * `MP_DYN_QR_UNCONFIRMED`. The retired `{ orderId }`-only body answers
33
- * `VALIDATION_FAILED`. `INVALID_ORDER_STATE`, `ORDER_FX_RATE_UNAVAILABLE` and
34
- * `ORDER_FX_AMOUNT_TOO_SMALL` were that body's alone and are no longer emitted;
35
- * they stay listed so an existing client switch still compiles.
17
+ * An order-bound charge holds the order's QR fence while it mints, and another charge for the
18
+ * same order meanwhile answers `MP_DYN_QR_IN_PROGRESS`. A `contacting` attempt (MercadoPago may
19
+ * have been called) stays blocked indefinitely; a `reserved` one (provably never contacted) is
20
+ * released once it outlives the Lambda timeout. A QR MercadoPago returned whose attempt could not
21
+ * be recorded answers `MP_DYN_QR_UNCONFIRMED`; a malformed 2xx answers `MP_DYN_QR_INVALID`.
22
+ * The retired `{ orderId }`-only body answers `VALIDATION_FAILED`. `INVALID_ORDER_STATE`,
23
+ * `ORDER_FX_RATE_UNAVAILABLE` and `ORDER_FX_AMOUNT_TOO_SMALL` were that body's alone.
36
24
  */
37
25
  export const MP_DYNAMIC_QR_ERROR_CODES = [
38
26
  'VALIDATION_FAILED',
@@ -48,49 +36,11 @@ export const MP_DYNAMIC_QR_ERROR_CODES = [
48
36
  'PLAN_UPGRADE_REQUIRED',
49
37
  'ORDER_CANCELLED',
50
38
  'INVALID_ORDER_STATE',
51
- 'PAYMENT_ALREADY_RECEIVED',
52
39
  'ORDER_NOT_FOUND',
53
40
  'ORDER_FX_RATE_UNAVAILABLE',
54
41
  'ORDER_FX_AMOUNT_TOO_SMALL',
55
42
  'CAPABILITY_REQUIRED',
56
43
  'ROLE_FORBIDDEN',
57
- 'IMPERSONATION_READONLY',
58
- 'TIP_EXCEEDS_ORDER',
59
- 'TIP_RECIPIENT_NOT_FOUND',
60
- 'TIP_ACCOUNT_UNVERIFIED',
61
- 'TIP_SHARED_ACCOUNT_FORBIDDEN',
62
- 'TIP_ORDER_REQUIRED',
63
- 'TIP_ORDER_NOT_FOUND',
64
- 'TIP_OPERATION_CONFLICT',
65
- 'TIP_PAYMENT_NOT_FOUND',
66
44
  'MP_DYN_QR_IN_PROGRESS',
67
- 'MP_DYN_QR_EXPIRED',
68
45
  'MP_DYN_QR_UNCONFIRMED',
69
- 'MP_DYN_QR_REJECTED',
70
- 'FX_CONVERSION_UNAVAILABLE',
71
- ];
72
- export const MP_POINT_TIP_ERROR_CODES = [
73
- 'TIP_EXCEEDS_ORDER',
74
- 'VALIDATION_FAILED',
75
- 'CAPABILITY_REQUIRED',
76
- 'ROLE_FORBIDDEN',
77
- 'PLAN_UPGRADE_REQUIRED',
78
- 'TIP_RECIPIENT_NOT_FOUND',
79
- 'TIP_ACCOUNT_UNVERIFIED',
80
- 'TIP_SHARED_ACCOUNT_FORBIDDEN',
81
- 'TIP_ORDER_REQUIRED',
82
- 'TIP_ORDER_NOT_FOUND',
83
- 'TIP_OPERATION_CONFLICT',
84
- 'TIP_PAYMENT_MISMATCH',
85
- 'TIP_PAYMENT_NOT_FOUND',
86
- 'TIP_REFUND_EXCEEDS_ORDER',
87
- ];
88
- export const MP_REFUND_RECOVERY_ERROR_CODES = [
89
- 'VALIDATION_FAILED',
90
- 'MISSING_PAYMENT_ID',
91
- 'MP_REFUND_RECOVERY_NOT_FOUND',
92
- 'MP_REFUND_RECOVERY_MISMATCH',
93
- 'MP_REFUND_IN_PROGRESS',
94
- 'MP_NOT_CONNECTED',
95
- 'MP_REFUND_PROVIDER_UNAVAILABLE',
96
46
  ];
package/dist/payment.d.ts CHANGED
@@ -1,12 +1,8 @@
1
1
  declare global {
2
- /** POST /stripe: goods and tip use integer cents in the same currency. */
2
+ /** POST /stripe: `amount` is integer cents in `currency`. */
3
3
  interface StripeCreatePaymentIntentRequest {
4
4
  currency?: 'USD' | 'EUR';
5
5
  amount: number;
6
- tip?: {
7
- amount: number;
8
- recipientUserId?: string;
9
- };
10
6
  email?: string;
11
7
  orderId?: string;
12
8
  invoiceId?: string;
@@ -16,12 +12,8 @@ declare global {
16
12
  message: string;
17
13
  clientSecret: string | null;
18
14
  }
19
- /**
20
- * POST /stripe 4xx `error` codes from the request validation and the tip path.
21
- * `STRIPE_TIP_ALREADY_PAID` (409) answers a replayed tipped create whose PaymentIntent
22
- * already succeeded — no client secret is returned.
23
- */
24
- type StripeCreatePaymentIntentErrorCode = 'VALIDATION_FAILED' | 'IMPERSONATION_READONLY' | 'CAPABILITY_REQUIRED' | 'PLAN_UPGRADE_REQUIRED' | 'ORDER_CANCELLED' | 'TIP_EXCEEDS_ORDER' | 'TIP_RECIPIENT_NOT_FOUND' | 'TIP_ORDER_REQUIRED' | 'TIP_ORDER_NOT_FOUND' | 'TIP_OPERATION_CONFLICT' | 'TIP_PAYMENT_MISMATCH' | 'TIP_PAYMENT_NOT_FOUND' | 'STRIPE_TIP_IN_PROGRESS' | 'STRIPE_TIP_ALREADY_PAID';
15
+ /** POST /stripe 4xx `error` codes. */
16
+ type StripeCreatePaymentIntentErrorCode = 'VALIDATION_FAILED' | 'ORDER_CANCELLED';
25
17
  /** Informational provider state; never a received-money row or settlement. */
26
18
  interface MpPaymentObservation {
27
19
  paymentId: string;
@@ -55,12 +47,6 @@ declare global {
55
47
  paymentId: string;
56
48
  orderId?: string;
57
49
  }
58
- /** Server-owned split of a provider payment; amounts share its currency. */
59
- interface PaymentTipMetadata {
60
- orderAmount: number;
61
- tipAmount: number;
62
- tipOperationId: string;
63
- }
64
50
  /**
65
51
  * WebSocket broadcast payload for the `payment_received` action, fired when a
66
52
  * "money received" event is persisted (MP webhook, Stripe webhook, or MP
@@ -69,8 +55,6 @@ declare global {
69
55
  */
70
56
  type PaymentReceivedSource = 'mp' | 'stripe' | 'mp_movement';
71
57
  interface PaymentReceivedWsPayload {
72
- /** Safe allocation figures; worker identity remains private to the tip ledger. */
73
- paymentTip?: PaymentTipMetadata;
74
58
  source: PaymentReceivedSource;
75
59
  paymentId: string;
76
60
  total: number;
@@ -89,7 +73,6 @@ declare global {
89
73
  * server-side so the FE doesn't N+1 fetch.
90
74
  */
91
75
  interface PaymentReceived {
92
- paymentTip?: PaymentTipMetadata;
93
76
  paymentId: string;
94
77
  source: PaymentReceivedSource;
95
78
  total: number;
@@ -115,12 +115,8 @@ export interface ResetCashOpResult {
115
115
  shiftsDeleted: number;
116
116
  shiftEventsDeleted: number;
117
117
  openDrawersReleased: number;
118
- /** The tip ledger under the same store: balances, replay anchors and entries. */
119
- tipBalancesDeleted: number;
120
- tipOperationsDeleted: number;
121
- tipEntriesDeleted: number;
122
- /** Immutable provider tip allocations removed before the ledger. Absent on older responses. */
123
- tipAllocationsDeleted?: number;
118
+ /** The store's MercadoPago dynamic-QR fence and attempt rows. */
119
+ qrAttemptsDeleted: number;
124
120
  /** `false` → the time budget ran out; re-send the body with `cursor`. */
125
121
  complete: boolean;
126
122
  /** Present only when `complete` is `false`. */
package/dist/report.d.ts CHANGED
@@ -1073,9 +1073,6 @@ export declare const REPORT_WAREHOUSE_NONE = "none";
1073
1073
  * - `change` — a `change` event: cash handed back while settling a sale.
1074
1074
  * - `refund` — a `refund` event: a refund movement recorded on a drawer, or the
1075
1075
  * cash a sales seña refund or a customer order return gives back.
1076
- * - `tip` — a `tip` event, and the reversal of one.
1077
- * - `tip-payout` — a `tip-payout` event (cash paid to a worker against their
1078
- * tip balance), and the reversal of one.
1079
1076
  * - `account` — a `cash-in`/`cash-out` carrying `accountId`: the cash side of a
1080
1077
  * customer-account payment, and its reversal.
1081
1078
  * - `cash-book` — a `cash-in`/`cash-out` carrying `cashId` and no `accountId`:
@@ -1094,7 +1091,7 @@ export declare const REPORT_WAREHOUSE_NONE = "none";
1094
1091
  * A compensation event (`compensation` set) falls in its original's source by
1095
1092
  * the same rule, so a reversal nets its original inside one source.
1096
1093
  */
1097
- export declare const CASH_FLOW_SOURCES: readonly ["sales", "change", "refund", "tip", "tip-payout", "account", "cash-book", "service-order-deposit", "manual", "other", "legacy-cash-book"];
1094
+ export declare const CASH_FLOW_SOURCES: readonly ["sales", "change", "refund", "account", "cash-book", "service-order-deposit", "manual", "other", "legacy-cash-book"];
1098
1095
  /**
1099
1096
  * Why a cash-flow day is not ledger-complete:
1100
1097
  *
package/dist/report.js CHANGED
@@ -20,9 +20,6 @@ export const REPORT_WAREHOUSE_NONE = 'none';
20
20
  * - `change` — a `change` event: cash handed back while settling a sale.
21
21
  * - `refund` — a `refund` event: a refund movement recorded on a drawer, or the
22
22
  * cash a sales seña refund or a customer order return gives back.
23
- * - `tip` — a `tip` event, and the reversal of one.
24
- * - `tip-payout` — a `tip-payout` event (cash paid to a worker against their
25
- * tip balance), and the reversal of one.
26
23
  * - `account` — a `cash-in`/`cash-out` carrying `accountId`: the cash side of a
27
24
  * customer-account payment, and its reversal.
28
25
  * - `cash-book` — a `cash-in`/`cash-out` carrying `cashId` and no `accountId`:
@@ -45,8 +42,6 @@ export const CASH_FLOW_SOURCES = [
45
42
  'sales',
46
43
  'change',
47
44
  'refund',
48
- 'tip',
49
- 'tip-payout',
50
45
  'account',
51
46
  'cash-book',
52
47
  'service-order-deposit',
@@ -452,8 +452,7 @@ declare global {
452
452
  * - `'mercadopago.refund'` — the MercadoPago `paymentId` being refunded. Required.
453
453
  * - `'shift.refund'` / `'shift.cash-out'` — the path `{id}` (the `shiftId`) of
454
454
  * `POST /shifts/{id}/movements` ({@link ShiftMovementRequest}). Required.
455
- * - `'cash.withdrawal'` ({@link CashPostRequest}), `'tip.cash-payout'`
456
- * ({@link TipPayoutRequest}) and `'account.cash-debit'`
455
+ * - `'cash.withdrawal'` ({@link CashPostRequest}) and `'account.cash-debit'`
457
456
  * ({@link AccountPostRequest}) — the drawer (`shiftId`) the write itself
458
457
  * resolves. **Omit it**: the API computes it at mint from the same `body`,
459
458
  * READ-ONLY, with the derivation the write uses — the operator's own OPEN
@@ -464,7 +463,7 @@ declare global {
464
463
  * A client never computes a drawer id.
465
464
  *
466
465
  * The four required subjects are refused by the mint's validation when
467
- * missing (`400`). For the three drawer-bound actions the mint checks, before
466
+ * missing (`400`). For the two drawer-bound actions the mint checks, before
468
467
  * any PIN work, only the body fields it reads (`400 VALIDATION_FAILED`, paths
469
468
  * under `body`): `currency`, a cash edit's `cashId`, an account debit's
470
469
  * `customerId`. A `subjectId` naming any drawer other than the computed one
@@ -495,11 +494,11 @@ declare global {
495
494
  * fingerprint of the cash, account, shift-movement and deposit-refund
496
495
  * writes, so a retry carrying a FRESH token with the same key replays the
497
496
  * committed response instead of answering `422 IDEMPOTENCY_KEY_REUSE`. A
498
- * body without a token fingerprints exactly as before. A tip payout replays
499
- * by its `operationId`. A MercadoPago refund has no stored-response replay:
500
- * its elevation is consumed before the refund claim, so a retry with the
501
- * same token answers `403 ELEVATION_INVALID`, and a retry with a fresh one
502
- * spends that approval and then meets the refund's own state (`409
497
+ * body without a token fingerprints exactly as before. A MercadoPago refund
498
+ * has no stored-response replay: its elevation is consumed before the refund
499
+ * claim, so a retry with the same token answers `403 ELEVATION_INVALID`, and
500
+ * a retry with a fresh one spends that approval and then meets the refund's
501
+ * own state (`409
503
502
  * MP_ALREADY_REFUNDED` once the payment is exhausted, `409
504
503
  * MP_REFUND_IN_PROGRESS` while another attempt holds the claim).
505
504
  */
@@ -647,7 +646,7 @@ export declare const PRINT_AGENT_SESSION_TTL_SECONDS: number;
647
646
  export declare const TERMINAL_ENROLMENT_TTL_SECONDS: number;
648
647
  export declare const TERMINAL_PAIRING_CODE_TTL_SECONDS: number;
649
648
  /** Money-out actions whose operator sessions require a different ADMIN-or-higher approver. */
650
- 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"];
649
+ export declare const TERMINAL_ELEVATION_ACTIONS: readonly ["order.deposit-refund", "mercadopago.refund", "shift.refund", "shift.cash-out", "cash.withdrawal", "account.cash-debit"];
651
650
  export type TerminalElevationAction = (typeof TERMINAL_ELEVATION_ACTIONS)[number];
652
651
  /**
653
652
  * Existing PIN, validation and idempotency refusals retain their current
package/dist/terminal.js CHANGED
@@ -182,7 +182,6 @@ export const TERMINAL_ELEVATION_ACTIONS = [
182
182
  'shift.cash-out',
183
183
  'cash.withdrawal',
184
184
  'account.cash-debit',
185
- 'tip.cash-payout',
186
185
  ];
187
186
  /**
188
187
  * Existing PIN, validation and idempotency refusals retain their current
package/dist/webhook.d.ts CHANGED
@@ -281,11 +281,6 @@ export interface PaymentReceivedWebhookPayload {
281
281
  invoiceId?: string;
282
282
  /** MP/Stripe-side `external_reference`, when the provider carried one. */
283
283
  externalReference?: string;
284
- /** Goods and tip split, without worker or ledger operation identity. */
285
- paymentTip?: {
286
- orderAmount: number;
287
- tipAmount: number;
288
- };
289
284
  }
290
285
  /**
291
286
  * Payload for `product.stock_low` — a sale CROSSED `Product.minStock`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "platform-types",
3
- "version": "1.10.699",
3
+ "version": "1.10.700",
4
4
  "description": "Shared wire and entity contracts for the platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",