platform-types 1.10.758 → 1.10.760

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.
@@ -19,7 +19,7 @@
19
19
  * no operator write can carry it back onto the order.
20
20
  */
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.ORDER_NOT_PAYABLE_REASONS = exports.PAYMENT_ATTEMPT_ERROR_CODES = exports.PAYMENT_ATTEMPT_STATES = void 0;
22
+ exports.PAYMENT_ATTEMPT_RESOLUTION_CAUSES = exports.ORDER_NOT_PAYABLE_REASONS = exports.PAYMENT_ATTEMPT_ERROR_CODES = exports.PAYMENT_ATTEMPT_STATES = void 0;
23
23
  /** Every {@link PaymentAttemptState}, in lifecycle order. */
24
24
  exports.PAYMENT_ATTEMPT_STATES = [
25
25
  'created',
@@ -65,3 +65,24 @@ exports.PAYMENT_ATTEMPT_ERROR_CODES = [
65
65
  * `storefront: 'mp-checkout-pro'`.
66
66
  */
67
67
  exports.ORDER_NOT_PAYABLE_REASONS = ['cancelled', 'paid', 'not-online'];
68
+ /**
69
+ * Every reason an attempt lands in `resolution` — money that must not settle
70
+ * the order on its own:
71
+ *
72
+ * - `second-approval` — the checkout already took an approved payment.
73
+ * - `amount-mismatch` — the payment's amount or currency is not the order's.
74
+ * - `order-mismatch` — the payment names another order than the attempt's.
75
+ * - `order-already-paid` — the order was already paid by another route.
76
+ * - `not-settled` — the payment pipeline recorded the payment without settling
77
+ * the order.
78
+ * - `late-capture` — the payment arrived after the hold ended: the attempt had
79
+ * expired or been cancelled, or the order was already cancelled.
80
+ */
81
+ exports.PAYMENT_ATTEMPT_RESOLUTION_CAUSES = [
82
+ 'second-approval',
83
+ 'amount-mismatch',
84
+ 'order-mismatch',
85
+ 'order-already-paid',
86
+ 'not-settled',
87
+ 'late-capture',
88
+ ];
@@ -525,8 +525,7 @@ exports.SOCKET_ACTIONS = [
525
525
  * minimised `OrderPaymentAttemptView`, never the stored attempt.
526
526
  *
527
527
  * ⚠️ To the order's OWN customer only (`wsPostCustomer`), never a store-wide
528
- * customer broadcast. Published ahead of its producer: no api writer emits
529
- * it yet.
528
+ * customer broadcast. Sent once per committed state move of the attempt.
530
529
  */
531
530
  'orderPaymentAttempt',
532
531
  'stripe',
@@ -28,8 +28,11 @@ declare global {
28
28
  * - `rejected` — the last payment was rejected. ⚠️ NOT terminal: Checkout Pro
29
29
  * lets the shopper retry inside the same checkout until `expiresAt`, so a
30
30
  * later payment can move it to `pending` or `approved`.
31
- * - `expired` — `expiresAt` passed with nothing approved; the order is
32
- * cancelled (`Order.cancellationSource: 'system'`).
31
+ * - `expired` — `expiresAt` passed with nothing approved through this
32
+ * attempt. The order is cancelled (`Order.cancellationSource: 'system'`)
33
+ * unless money had already reached it by another route; then the order is
34
+ * left as it is and the attempt stays `expired` — not `resolution`, since
35
+ * that money is not this attempt's.
33
36
  * - `cancelled` — the order was cancelled while the attempt was live.
34
37
  * - `refunded` — the approved payment was refunded.
35
38
  * - `charged_back` — the approved payment was charged back.
@@ -44,6 +47,8 @@ declare global {
44
47
  type PaymentAttemptErrorCode = (typeof PAYMENT_ATTEMPT_ERROR_CODES)[number];
45
48
  /** One of {@link ORDER_NOT_PAYABLE_REASONS}. */
46
49
  type OrderNotPayableReason = (typeof ORDER_NOT_PAYABLE_REASONS)[number];
50
+ /** One of {@link PAYMENT_ATTEMPT_RESOLUTION_CAUSES}. */
51
+ type PaymentAttemptResolutionCause = (typeof PAYMENT_ATTEMPT_RESOLUTION_CAUSES)[number];
47
52
  /**
48
53
  * The body that starts (or returns the live) payment attempt for an order.
49
54
  * The caller must be the order's customer; the store is the token's. The
@@ -90,6 +95,43 @@ declare global {
90
95
  orderId: string;
91
96
  paymentAttempt: OrderPaymentAttemptView;
92
97
  }
98
+ /**
99
+ * One payment attempt as the store's operators see it — the operator fields
100
+ * of the stored record, never its Mercado Pago checkout URL or Preference id.
101
+ */
102
+ interface PaymentAttemptOperatorView {
103
+ attemptId: string;
104
+ orderId: string;
105
+ /** The order's owner, who started the attempt. */
106
+ customerId: string;
107
+ state: PaymentAttemptState;
108
+ /** Why the attempt is in `resolution` — set by the move into it. */
109
+ resolutionCause?: PaymentAttemptResolutionCause;
110
+ /** The Mercado Pago payments whose approval this attempt processed, oldest first. */
111
+ approvedPaymentIds: string[];
112
+ /** The Mercado Pago payment whose notification made the last move. */
113
+ lastPaymentId?: string;
114
+ /** Decimal pesos — the order's charged total when the attempt was started. */
115
+ amount: number;
116
+ currency: 'ARS';
117
+ /** ISO 8601 — when the checkout stopped taking a payment. */
118
+ expiresAt: string;
119
+ /** Unix ms. */
120
+ createdAt: number;
121
+ /** Unix ms. */
122
+ updatedAt: number;
123
+ }
124
+ /**
125
+ * `data` of `GET /payments/attempts?state=resolution` (App host, admin):
126
+ * the store's attempts in that state, newest activity first. Page on
127
+ * `nextCursor`'s presence, never on the page's length — the state is a
128
+ * filter, so a page can be short, even empty, with more to come.
129
+ */
130
+ interface PaymentAttemptResolutionListResponse {
131
+ attempts: PaymentAttemptOperatorView[];
132
+ /** Opaque. Absent on the last page. */
133
+ nextCursor?: string;
134
+ }
93
135
  }
94
136
  /** Every {@link PaymentAttemptState}, in lifecycle order. */
95
137
  export declare const PAYMENT_ATTEMPT_STATES: readonly ["created", "pending", "approved", "rejected", "expired", "cancelled", "refunded", "charged_back", "resolution"];
@@ -119,4 +161,18 @@ export declare const PAYMENT_ATTEMPT_ERROR_CODES: readonly ["PAYMENT_PROVIDER_NO
119
161
  * `storefront: 'mp-checkout-pro'`.
120
162
  */
121
163
  export declare const ORDER_NOT_PAYABLE_REASONS: readonly ["cancelled", "paid", "not-online"];
164
+ /**
165
+ * Every reason an attempt lands in `resolution` — money that must not settle
166
+ * the order on its own:
167
+ *
168
+ * - `second-approval` — the checkout already took an approved payment.
169
+ * - `amount-mismatch` — the payment's amount or currency is not the order's.
170
+ * - `order-mismatch` — the payment names another order than the attempt's.
171
+ * - `order-already-paid` — the order was already paid by another route.
172
+ * - `not-settled` — the payment pipeline recorded the payment without settling
173
+ * the order.
174
+ * - `late-capture` — the payment arrived after the hold ended: the attempt had
175
+ * expired or been cancelled, or the order was already cancelled.
176
+ */
177
+ export declare const PAYMENT_ATTEMPT_RESOLUTION_CAUSES: readonly ["second-approval", "amount-mismatch", "order-mismatch", "order-already-paid", "not-settled", "late-capture"];
122
178
  export {};
@@ -62,3 +62,24 @@ export const PAYMENT_ATTEMPT_ERROR_CODES = [
62
62
  * `storefront: 'mp-checkout-pro'`.
63
63
  */
64
64
  export const ORDER_NOT_PAYABLE_REASONS = ['cancelled', 'paid', 'not-online'];
65
+ /**
66
+ * Every reason an attempt lands in `resolution` — money that must not settle
67
+ * the order on its own:
68
+ *
69
+ * - `second-approval` — the checkout already took an approved payment.
70
+ * - `amount-mismatch` — the payment's amount or currency is not the order's.
71
+ * - `order-mismatch` — the payment names another order than the attempt's.
72
+ * - `order-already-paid` — the order was already paid by another route.
73
+ * - `not-settled` — the payment pipeline recorded the payment without settling
74
+ * the order.
75
+ * - `late-capture` — the payment arrived after the hold ended: the attempt had
76
+ * expired or been cancelled, or the order was already cancelled.
77
+ */
78
+ export const PAYMENT_ATTEMPT_RESOLUTION_CAUSES = [
79
+ 'second-approval',
80
+ 'amount-mismatch',
81
+ 'order-mismatch',
82
+ 'order-already-paid',
83
+ 'not-settled',
84
+ 'late-capture',
85
+ ];
package/dist/socket.js CHANGED
@@ -522,8 +522,7 @@ export const SOCKET_ACTIONS = [
522
522
  * minimised `OrderPaymentAttemptView`, never the stored attempt.
523
523
  *
524
524
  * ⚠️ To the order's OWN customer only (`wsPostCustomer`), never a store-wide
525
- * customer broadcast. Published ahead of its producer: no api writer emits
526
- * it yet.
525
+ * customer broadcast. Sent once per committed state move of the attempt.
527
526
  */
528
527
  'orderPaymentAttempt',
529
528
  'stripe',
package/dist/store.d.ts CHANGED
@@ -910,7 +910,8 @@ declare global {
910
910
  * Write rule, unlike `reviewed`: when SENT in a `config.onboarding`
911
911
  * block it REPLACES the stored list as one member (so `[]` clears it and
912
912
  * an item can be un-dismissed); when OMITTED from the block the stored
913
- * list is kept, as `reviewed` is.
913
+ * list is kept, as `reviewed` is. ADMIN-tier, unlike the rest of the
914
+ * block: a USER sending it is refused `403 STORE_CONFIG_FORBIDDEN`.
914
915
  */
915
916
  dismissedItems?: string[];
916
917
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "platform-types",
3
- "version": "1.10.758",
3
+ "version": "1.10.760",
4
4
  "description": "Shared wire and entity contracts for the platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",