platform-types 1.10.803 → 1.10.805

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/account.d.ts CHANGED
@@ -183,6 +183,11 @@ declare global {
183
183
  */
184
184
  paymentRefSource?: PaymentReceivedSource;
185
185
  paymentRefId?: string;
186
+ /**
187
+ * On a refund obligation's in-transit debit (SK `RIT#{obligationId}`, `paymentRef*` naming the linked
188
+ * payment): the obligation whose refund the debit books. Absent on every other row.
189
+ */
190
+ refundObligationId?: string;
186
191
  }
187
192
  /**
188
193
  * `POST /account` — a new customer-ledger movement. Mirrors the request side of
package/dist/audit.d.ts CHANGED
@@ -164,6 +164,19 @@ declare global {
164
164
  * words stay on the attempt row.
165
165
  */
166
166
  | 'payment_attempt_resolved'
167
+ /**
168
+ * An operator closed one of the order's refund obligations (`POST /refund-obligations { mode: 'close' }`).
169
+ * `before`: `obligationId`, `state`, `holdReason?`. `after`: `obligationId`, `state` (`'closed'`), `by`
170
+ * (`'operator'`), `payout` (`'drawer'` | `'none'`) and the operator's reason as `'[present]'` |
171
+ * `'[absent]'` — presence only, the words stay on the obligation's `closure`.
172
+ */
173
+ | 'refund_obligation_closed'
174
+ /**
175
+ * An operator reopened one of the order's refund obligations held behind a `reimbursed` chargeback
176
+ * (`POST /refund-obligations { mode: 'reopen' }`). `before`: `obligationId`, `state` (`'held'`),
177
+ * `holdReason`. `after`: `obligationId`, `state`, `refundDueAt?` and the reason by presence only.
178
+ */
179
+ | 'refund_obligation_reopened'
167
180
  /** HISTORICAL: written only by the removed outbound MercadoPago refund; kept so old timeline rows still parse. */
168
181
  | 'payment_refunded'
169
182
  /** At least one till tender leg was appended (an absorbed replay writes none). */
package/dist/cart.d.ts CHANGED
@@ -193,6 +193,24 @@ declare global {
193
193
  */
194
194
  cost?: number;
195
195
  price: number;
196
+ /**
197
+ * The net of `price`, per unit, in the same currency as the line
198
+ * (`calculateItemNeto(price, 1, rate, 1, 'decimal')`): equal to the
199
+ * `neto` a new IVA-declaring invoice prints for one undiscounted unit
200
+ * when the line currency is the voucher currency. A Factura C does not
201
+ * discriminate IVA (its `ImpNeto` is the gross), and a voucher in another
202
+ * currency converts first. Absent when the
203
+ * line has no declarable `ivaType` — never a 0 % fallback.
204
+ *
205
+ * ⚠️ READ-TIME and DISPLAY ONLY. Derived at the customer exits (web
206
+ * `GET /basket`, the customer basket write echo and its 409 rebase, the
207
+ * guest cart, the checkout cart-conflict body, the storefront re-priced
208
+ * cart and the customer `baskets` socket frame); never stored, never
209
+ * accepted on a write, never on an operator copy. Never charge, quote or
210
+ * total it — `CartTotals` carries no net. Shown by the storefront only
211
+ * while `ecommerce.config.showNetPlusIva` is on.
212
+ */
213
+ netOfIva?: number;
196
214
  listId?: number;
197
215
  currency?: string;
198
216
  currencyValue?: number;
@@ -8,15 +8,16 @@
8
8
  * order) and closes on its own when Mercado Pago reports the refund, when an
9
9
  * operator closes a payment attempt's resolution as `refunded`, or when a
10
10
  * chargeback settled the money back. An open dispute holds it; a lifted dispute
11
- * reopens it. Nothing here moves money or writes a ledger row: closure records a
12
- * fact.
11
+ * reopens it. Closure moves no money and writes no ledger row: it records a fact.
12
+ * The one ledger write is the creator's in-transit debit of a linked payment's
13
+ * credit ({@link RefundObligationLedgerCredit}), at creation.
13
14
  *
14
15
  * ⚠️ The stored row carries none of the main table's index-key attributes
15
16
  * (`status`, `customerId`, `dated`, `updatedAt`, `terminalId`, `inboxKey`), so it
16
17
  * joins no GSI: `state` replaces `status`, `revisedAt` replaces `updatedAt`.
17
18
  */
18
19
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.REFUND_OBLIGATION_DUE_SOURCE = exports.REFUND_OBLIGATION_CLOSED_BY = exports.REFUND_OBLIGATION_HOLD_REASONS = exports.REFUND_OBLIGATION_STATES = exports.REFUND_OBLIGATION_KINDS = void 0;
20
+ exports.REFUND_OBLIGATION_PAYOUTS = exports.REFUND_OBLIGATION_ACTION_MODES = exports.REFUND_OBLIGATION_LIST_FILTERS = exports.REFUND_OBLIGATION_REASON_MAX = exports.REFUND_OBLIGATION_DUE_SOURCE = exports.REFUND_OBLIGATION_CLOSED_BY = exports.REFUND_OBLIGATION_HOLD_REASONS = exports.REFUND_OBLIGATION_STATES = exports.REFUND_OBLIGATION_KINDS = void 0;
20
21
  /**
21
22
  * - `provider` — paid through Mercado Pago; closes when the provider reports the
22
23
  * refund (`paymentId` is set).
@@ -40,7 +41,8 @@ exports.REFUND_OBLIGATION_STATES = ['awaiting-goods', 'open', 'overdue', 'held',
40
41
  * Why an obligation is `held`. `dispute-open` reopens on its own once the
41
42
  * dispute is lifted; `reimbursed` (Mercado Pago covered the seller) never does —
42
43
  * only an operator's decision moves it. A stored row with no `holdReason` reads
43
- * as `dispute-open`.
44
+ * as `dispute-open`. Once the operator reopened a `reimbursed` hold
45
+ * (`reimbursedDecision`), that chargeback no longer holds the obligation.
44
46
  */
45
47
  exports.REFUND_OBLIGATION_HOLD_REASONS = ['dispute-open', 'reimbursed'];
46
48
  /**
@@ -63,3 +65,14 @@ exports.REFUND_OBLIGATION_CLOSED_BY = [
63
65
  ];
64
66
  /** Where a {@link StatutoryInstant} came from: the platform global it was computed with. */
65
67
  exports.REFUND_OBLIGATION_DUE_SOURCE = 'global:refundObligationDueDays';
68
+ /** The longest operator `reason` `POST /refund-obligations` accepts, in characters after trimming. */
69
+ exports.REFUND_OBLIGATION_REASON_MAX = 500;
70
+ /**
71
+ * The `state` filter of `GET /refund-obligations`: one {@link RefundObligationState}, or `pending` — every
72
+ * state but `closed`, the operator's working queue.
73
+ */
74
+ exports.REFUND_OBLIGATION_LIST_FILTERS = [...exports.REFUND_OBLIGATION_STATES, 'pending'];
75
+ /** The modes of `POST /refund-obligations`. */
76
+ exports.REFUND_OBLIGATION_ACTION_MODES = ['close', 'reopen'];
77
+ /** The one payout `POST /refund-obligations { mode: 'close' }` can record: cash from the operator's till. */
78
+ exports.REFUND_OBLIGATION_PAYOUTS = ['drawer'];
@@ -7,8 +7,9 @@
7
7
  * order) and closes on its own when Mercado Pago reports the refund, when an
8
8
  * operator closes a payment attempt's resolution as `refunded`, or when a
9
9
  * chargeback settled the money back. An open dispute holds it; a lifted dispute
10
- * reopens it. Nothing here moves money or writes a ledger row: closure records a
11
- * fact.
10
+ * reopens it. Closure moves no money and writes no ledger row: it records a fact.
11
+ * The one ledger write is the creator's in-transit debit of a linked payment's
12
+ * credit ({@link RefundObligationLedgerCredit}), at creation.
12
13
  *
13
14
  * ⚠️ The stored row carries none of the main table's index-key attributes
14
15
  * (`status`, `customerId`, `dated`, `updatedAt`, `terminalId`, `inboxKey`), so it
@@ -37,7 +38,8 @@ export declare const REFUND_OBLIGATION_STATES: readonly ["awaiting-goods", "open
37
38
  * Why an obligation is `held`. `dispute-open` reopens on its own once the
38
39
  * dispute is lifted; `reimbursed` (Mercado Pago covered the seller) never does —
39
40
  * only an operator's decision moves it. A stored row with no `holdReason` reads
40
- * as `dispute-open`.
41
+ * as `dispute-open`. Once the operator reopened a `reimbursed` hold
42
+ * (`reimbursedDecision`), that chargeback no longer holds the obligation.
41
43
  */
42
44
  export declare const REFUND_OBLIGATION_HOLD_REASONS: readonly ["dispute-open", "reimbursed"];
43
45
  /**
@@ -54,6 +56,17 @@ export declare const REFUND_OBLIGATION_HOLD_REASONS: readonly ["dispute-open", "
54
56
  export declare const REFUND_OBLIGATION_CLOSED_BY: readonly ["detected-refund", "resolution-refunded", "operator", "chargeback", "api-refund"];
55
57
  /** Where a {@link StatutoryInstant} came from: the platform global it was computed with. */
56
58
  export declare const REFUND_OBLIGATION_DUE_SOURCE = "global:refundObligationDueDays";
59
+ /** The longest operator `reason` `POST /refund-obligations` accepts, in characters after trimming. */
60
+ export declare const REFUND_OBLIGATION_REASON_MAX = 500;
61
+ /**
62
+ * The `state` filter of `GET /refund-obligations`: one {@link RefundObligationState}, or `pending` — every
63
+ * state but `closed`, the operator's working queue.
64
+ */
65
+ export declare const REFUND_OBLIGATION_LIST_FILTERS: readonly ["awaiting-goods", "open", "overdue", "held", "closed", "pending"];
66
+ /** The modes of `POST /refund-obligations`. */
67
+ export declare const REFUND_OBLIGATION_ACTION_MODES: readonly ["close", "reopen"];
68
+ /** The one payout `POST /refund-obligations { mode: 'close' }` can record: cash from the operator's till. */
69
+ export declare const REFUND_OBLIGATION_PAYOUTS: readonly ["drawer"];
57
70
  declare global {
58
71
  type RefundObligationKind = (typeof REFUND_OBLIGATION_KINDS)[number];
59
72
  type RefundObligationState = (typeof REFUND_OBLIGATION_STATES)[number];
@@ -66,12 +79,32 @@ declare global {
66
79
  /** The rule it was computed from, e.g. `global:refundObligationDueDays`. */
67
80
  source: string;
68
81
  }
69
- /** The link credit an obligation's money was booked to, when there is one. */
82
+ /**
83
+ * The payment-link credit an obligation's money was booked to, when there is one: the customer's ledger
84
+ * still holds it as a credit, so the creator debits the share being refunded ("in transit") in its own
85
+ * transaction, one `ACCOUNT#` row per obligation.
86
+ */
70
87
  interface RefundObligationLedgerCredit {
71
- /** The `ACCOUNT#{storeId}` row's SK. */
88
+ /** The `ACCOUNT#{storeId}` credit row's SK — the per-source payment row's `accountId`. */
72
89
  accountId: string;
73
90
  /** The customer whose balance the credit moved. */
74
91
  customerId: string;
92
+ /** The partition of the payment the credit came from. */
93
+ source: PaymentReceivedSource;
94
+ /** The payment the credit came from: the per-source row's SK. */
95
+ paymentId: string;
96
+ }
97
+ /**
98
+ * The operator's decision that a `reimbursed` chargeback does not discharge the obligation (`POST
99
+ * /refund-obligations { mode: 'reopen' }`). While it stands, the payment's `reimbursed` chargeback no
100
+ * longer holds the obligation; a later hold (a new dispute) removes it.
101
+ */
102
+ interface RefundObligationReimbursedDecision {
103
+ by: 'operator';
104
+ /** Unix ms. */
105
+ at: number;
106
+ /** The store user who decided. */
107
+ actor?: string;
75
108
  }
76
109
  /** How an obligation was closed. */
77
110
  interface RefundObligationClosure {
@@ -111,6 +144,8 @@ declare global {
111
144
  holdReason?: RefundObligationHoldReason;
112
145
  /** The state a hold came from; a reopen returns to it (`overdue` returns to `open`). */
113
146
  heldFrom?: Exclude<RefundObligationState, 'held' | 'closed'>;
147
+ /** Set by the operator's reopen of a `reimbursed` hold; removed by any later hold. */
148
+ reimbursedDecision?: RefundObligationReimbursedDecision;
114
149
  /** Bumped by every move, for a compare-and-set. */
115
150
  revision: number;
116
151
  /** When the refund is due. Set by the move to `open`; removed by a hold. */
@@ -123,5 +158,75 @@ declare global {
123
158
  /** Unix ms of the last move. */
124
159
  revisedAt: number;
125
160
  }
161
+ type RefundObligationListFilter = (typeof REFUND_OBLIGATION_LIST_FILTERS)[number];
162
+ /**
163
+ * The query of `GET /refund-obligations` (App host, `staffToken`, the `payments` capability). Reads the
164
+ * token's store only, in obligation-id order (`orderId` first).
165
+ */
166
+ interface RefundObligationListQuery {
167
+ state?: RefundObligationListFilter;
168
+ /** Only this order's obligations (`ORD` plus 6–10 digits). */
169
+ orderId?: string;
170
+ /** Rows EVALUATED per page, 1–100 (default 25): a page can be short or empty with `nextCursor` present. */
171
+ limit?: number;
172
+ /** The previous page's `nextCursor`, bound to the store and to `state` + `orderId`. */
173
+ cursor?: string;
174
+ }
175
+ /**
176
+ * `data` of `GET /refund-obligations`. Page on `nextCursor`'s presence, never on the page's length. A
177
+ * `held` row always carries `holdReason` (a stored row with none reads as `dispute-open`): an open dispute
178
+ * offers no action; a `reimbursed` one awaits the operator's close or reopen.
179
+ */
180
+ interface RefundObligationListResponse {
181
+ obligations: RefundObligation[];
182
+ /** Opaque. Absent on the last page. */
183
+ nextCursor?: string;
184
+ }
185
+ /**
186
+ * `POST /refund-obligations` (App host, `adminToken`, the `payments` capability). Strict body.
187
+ *
188
+ * - `close` — the operator settled it: `closure.by: 'operator'`. From `open`, `overdue`, `awaiting-goods`
189
+ * or a `reimbursed` hold; never from a `dispute-open` hold. `reason` is required for an `offline` one
190
+ * and stored on `closure`. `payout: 'drawer'` (an `offline` one only) records the cash leaving the
191
+ * operator's till as one drawer `refund` event in the same transaction.
192
+ * - `reopen` — a `reimbursed` hold the operator decides is still owed: back to the state it was held
193
+ * from, with a fresh `refundDueAt` when that is `open`, and `reimbursedDecision` recorded so the same
194
+ * `reimbursed` chargeback never holds it again.
195
+ *
196
+ * `expectedRevision` is the `revision` of the row the operator acted on.
197
+ */
198
+ type RefundObligationActionRequest = {
199
+ mode: 'close';
200
+ /** The obligation's `obligationId`: `{orderId}#{parentId}#{kind}#{paymentId | 'till'}`, else 400. */
201
+ obligationId: string;
202
+ expectedRevision: number;
203
+ /** 1–{@link REFUND_OBLIGATION_REASON_MAX} characters after trimming. Required for `offline`. */
204
+ reason?: string;
205
+ payout?: (typeof REFUND_OBLIGATION_PAYOUTS)[number];
206
+ } | {
207
+ mode: 'reopen';
208
+ /** The obligation's `obligationId`: `{orderId}#{parentId}#{kind}#{paymentId | 'till'}`, else 400. */
209
+ obligationId: string;
210
+ expectedRevision: number;
211
+ /** 1–{@link REFUND_OBLIGATION_REASON_MAX} characters after trimming. Recorded by presence only. */
212
+ reason?: string;
213
+ };
214
+ /** `data` of a successful `POST /refund-obligations`: the obligation as it now stands. */
215
+ interface RefundObligationActionResponse {
216
+ obligation: RefundObligation;
217
+ }
218
+ /** `data` of `409 REFUND_OBLIGATION_CHANGED`: the obligation as it now stands — review it and resend. */
219
+ interface RefundObligationChangedData {
220
+ obligation: RefundObligation;
221
+ }
222
+ /**
223
+ * `data` of `409 REFUND_OBLIGATION_NOT_ACTIONABLE`: the state that refuses the mode — `closed` (with its
224
+ * `closure`, so a replay after success reads what it did), or `held` with its `holdReason`.
225
+ */
226
+ interface RefundObligationNotActionableData {
227
+ state: RefundObligationState;
228
+ holdReason?: RefundObligationHoldReason;
229
+ closure?: RefundObligationClosure;
230
+ }
126
231
  }
127
232
  export {};
@@ -7,8 +7,9 @@
7
7
  * order) and closes on its own when Mercado Pago reports the refund, when an
8
8
  * operator closes a payment attempt's resolution as `refunded`, or when a
9
9
  * chargeback settled the money back. An open dispute holds it; a lifted dispute
10
- * reopens it. Nothing here moves money or writes a ledger row: closure records a
11
- * fact.
10
+ * reopens it. Closure moves no money and writes no ledger row: it records a fact.
11
+ * The one ledger write is the creator's in-transit debit of a linked payment's
12
+ * credit ({@link RefundObligationLedgerCredit}), at creation.
12
13
  *
13
14
  * ⚠️ The stored row carries none of the main table's index-key attributes
14
15
  * (`status`, `customerId`, `dated`, `updatedAt`, `terminalId`, `inboxKey`), so it
@@ -37,7 +38,8 @@ export const REFUND_OBLIGATION_STATES = ['awaiting-goods', 'open', 'overdue', 'h
37
38
  * Why an obligation is `held`. `dispute-open` reopens on its own once the
38
39
  * dispute is lifted; `reimbursed` (Mercado Pago covered the seller) never does —
39
40
  * only an operator's decision moves it. A stored row with no `holdReason` reads
40
- * as `dispute-open`.
41
+ * as `dispute-open`. Once the operator reopened a `reimbursed` hold
42
+ * (`reimbursedDecision`), that chargeback no longer holds the obligation.
41
43
  */
42
44
  export const REFUND_OBLIGATION_HOLD_REASONS = ['dispute-open', 'reimbursed'];
43
45
  /**
@@ -60,3 +62,14 @@ export const REFUND_OBLIGATION_CLOSED_BY = [
60
62
  ];
61
63
  /** Where a {@link StatutoryInstant} came from: the platform global it was computed with. */
62
64
  export const REFUND_OBLIGATION_DUE_SOURCE = 'global:refundObligationDueDays';
65
+ /** The longest operator `reason` `POST /refund-obligations` accepts, in characters after trimming. */
66
+ export const REFUND_OBLIGATION_REASON_MAX = 500;
67
+ /**
68
+ * The `state` filter of `GET /refund-obligations`: one {@link RefundObligationState}, or `pending` — every
69
+ * state but `closed`, the operator's working queue.
70
+ */
71
+ export const REFUND_OBLIGATION_LIST_FILTERS = [...REFUND_OBLIGATION_STATES, 'pending'];
72
+ /** The modes of `POST /refund-obligations`. */
73
+ export const REFUND_OBLIGATION_ACTION_MODES = ['close', 'reopen'];
74
+ /** The one payout `POST /refund-obligations { mode: 'close' }` can record: cash from the operator's till. */
75
+ export const REFUND_OBLIGATION_PAYOUTS = ['drawer'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "platform-types",
3
- "version": "1.10.803",
3
+ "version": "1.10.805",
4
4
  "description": "Shared wire and entity contracts for the platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",