platform-types 1.10.755 → 1.10.757
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/cjs/index.js +1 -0
- package/dist/cjs/notification.js +18 -1
- package/dist/cjs/paymentAttempt.js +64 -0
- package/dist/cjs/socket.js +10 -0
- package/dist/cjs/store.js +6 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/notification.d.ts +33 -1
- package/dist/notification.js +18 -1
- package/dist/order.d.ts +51 -2
- package/dist/paymentAttempt.d.ts +120 -0
- package/dist/paymentAttempt.js +61 -0
- package/dist/socket.d.ts +1 -1
- package/dist/socket.js +10 -0
- package/dist/store.d.ts +28 -0
- package/dist/store.js +5 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -78,6 +78,7 @@ __exportStar(require("./orderCollectionAttempt.js"), exports);
|
|
|
78
78
|
__exportStar(require("./orderCompletionAttempt.js"), exports);
|
|
79
79
|
__exportStar(require("./orderCreateAttempt.js"), exports);
|
|
80
80
|
__exportStar(require("./payment.js"), exports);
|
|
81
|
+
__exportStar(require("./paymentAttempt.js"), exports);
|
|
81
82
|
__exportStar(require("./platform.js"), exports);
|
|
82
83
|
__exportStar(require("./presupuesto.js"), exports);
|
|
83
84
|
__exportStar(require("./pricing.js"), exports);
|
package/dist/cjs/notification.js
CHANGED
|
@@ -5,7 +5,8 @@ exports.NotificationTypeEnum = void 0;
|
|
|
5
5
|
// Indexed producers resolve candidates through `getNotificationSubscribers`:
|
|
6
6
|
// legacy opt-ins and explicit channel maps remain source data on USER rows.
|
|
7
7
|
// Addressed ERROR / ML_FACTURADOR_COLLISION / ML_SELLER_SWITCHED /
|
|
8
|
-
// ML_CONNECTION_BROKEN / MENTION do not select a
|
|
8
|
+
// ML_CONNECTION_BROKEN / MENTION / CUSTOMER_PENDING_APPROVAL do not select a
|
|
9
|
+
// producer subscriber audience;
|
|
9
10
|
// the consumer still reads the live USER row for each delivery channel.
|
|
10
11
|
// AFIP_CERT_EXPIRY is seeded on the founding user and uses the subscriber index.
|
|
11
12
|
// Exported as a real enum consumed by api and app; adding an indexed type
|
|
@@ -157,4 +158,20 @@ var NotificationTypeEnum;
|
|
|
157
158
|
* click-through targets.
|
|
158
159
|
*/
|
|
159
160
|
NotificationTypeEnum["EXPIRY_ALERT"] = "EXPIRY_ALERT";
|
|
161
|
+
/**
|
|
162
|
+
* A shopper registered on the storefront while the store's
|
|
163
|
+
* `ecommerce.config.registrationMode` is `'approval'`, and the account waits
|
|
164
|
+
* for an operator to approve or reject it. Names the registrant by name only.
|
|
165
|
+
*
|
|
166
|
+
* ⚠️ Additive, on the same grounds as `ABANDONED_CART`. The producer fans out
|
|
167
|
+
* to every non-disabled ADMIN-tier user with no legacy opt-in scan, as for
|
|
168
|
+
* `ML_SELLER_SWITCHED` (a new key is seeded nowhere). The consumer enforces
|
|
169
|
+
* explicit type/channel preferences, default-on when absent. No backfill or
|
|
170
|
+
* consumer migration is owed.
|
|
171
|
+
*
|
|
172
|
+
* ⚠️ Carries `pendingCustomerRef` and NEVER a top-level `customerId` (an
|
|
173
|
+
* audience — the operator bell would reach the pending registrant's own
|
|
174
|
+
* storefront socket), and never the registrant's email address.
|
|
175
|
+
*/
|
|
176
|
+
NotificationTypeEnum["CUSTOMER_PENDING_APPROVAL"] = "CUSTOMER_PENDING_APPROVAL";
|
|
160
177
|
})(NotificationTypeEnum || (exports.NotificationTypeEnum = NotificationTypeEnum = {}));
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Online payment attempts — a storefront order paid through Mercado Pago
|
|
4
|
+
* Checkout Pro on the store's connected account.
|
|
5
|
+
*
|
|
6
|
+
* An attempt is its own record, kept apart from the order: it never sets
|
|
7
|
+
* `Order.financialStatus`, `Order.linkedPayments` or fulfilment. The Mercado
|
|
8
|
+
* Pago webhook moves the attempt, and the existing payment pipeline settles the
|
|
9
|
+
* order.
|
|
10
|
+
*
|
|
11
|
+
* A shopper starts one for an order whose payment method row declares
|
|
12
|
+
* `storefront: 'mp-checkout-pro'` and is redirected to `redirectUrl`. While the
|
|
13
|
+
* attempt is live (until `expiresAt`), starting again answers the SAME attempt,
|
|
14
|
+
* whatever its state. A new attempt is minted only once the previous one is
|
|
15
|
+
* `expired` or `cancelled` and the order can still be paid.
|
|
16
|
+
*
|
|
17
|
+
* ⚠️ `paymentAttempt` is never a field of `Order`. The shopper's own order read
|
|
18
|
+
* answers a {@link StorefrontOrderView}, which carries it as a projection, so
|
|
19
|
+
* no operator write can carry it back onto the order.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.ORDER_NOT_PAYABLE_REASONS = exports.PAYMENT_ATTEMPT_ERROR_CODES = exports.PAYMENT_ATTEMPT_STATES = void 0;
|
|
23
|
+
/** Every {@link PaymentAttemptState}, in lifecycle order. */
|
|
24
|
+
exports.PAYMENT_ATTEMPT_STATES = [
|
|
25
|
+
'created',
|
|
26
|
+
'pending',
|
|
27
|
+
'approved',
|
|
28
|
+
'rejected',
|
|
29
|
+
'expired',
|
|
30
|
+
'cancelled',
|
|
31
|
+
'refunded',
|
|
32
|
+
'charged_back',
|
|
33
|
+
'resolution',
|
|
34
|
+
];
|
|
35
|
+
/**
|
|
36
|
+
* Every refusal code a payment-attempt start, or a checkout choosing an online
|
|
37
|
+
* method, answers:
|
|
38
|
+
*
|
|
39
|
+
* - `PAYMENT_PROVIDER_NOT_CONNECTED` · 412 — the store has no Mercado Pago
|
|
40
|
+
* account connected.
|
|
41
|
+
* - `PAYMENT_PROVIDER_TOKEN_EXPIRED` · 412 — the store's Mercado Pago
|
|
42
|
+
* connection was rejected by Mercado Pago and must be reconnected.
|
|
43
|
+
* - `ORDER_NOT_PAYABLE` · 409 — the order cannot be paid online; `data` is
|
|
44
|
+
* {@link OrderNotPayableData}.
|
|
45
|
+
* - `PAYMENT_ATTEMPT_EXPIRED` · 410 — the attempt's `expiresAt` passed.
|
|
46
|
+
* - `PAYMENT_METHOD_UNAVAILABLE` · 409 — the checkout chose an online payment
|
|
47
|
+
* method the store cannot take right now (its provider is not connected).
|
|
48
|
+
*/
|
|
49
|
+
exports.PAYMENT_ATTEMPT_ERROR_CODES = [
|
|
50
|
+
'PAYMENT_PROVIDER_NOT_CONNECTED',
|
|
51
|
+
'PAYMENT_PROVIDER_TOKEN_EXPIRED',
|
|
52
|
+
'ORDER_NOT_PAYABLE',
|
|
53
|
+
'PAYMENT_ATTEMPT_EXPIRED',
|
|
54
|
+
'PAYMENT_METHOD_UNAVAILABLE',
|
|
55
|
+
];
|
|
56
|
+
/**
|
|
57
|
+
* Every `data.reason` of `409 ORDER_NOT_PAYABLE`:
|
|
58
|
+
*
|
|
59
|
+
* - `cancelled` — the order is cancelled.
|
|
60
|
+
* - `paid` — the order is already paid.
|
|
61
|
+
* - `not-online` — the order's payment method row does not declare
|
|
62
|
+
* `storefront: 'mp-checkout-pro'`.
|
|
63
|
+
*/
|
|
64
|
+
exports.ORDER_NOT_PAYABLE_REASONS = ['cancelled', 'paid', 'not-online'];
|
package/dist/cjs/socket.js
CHANGED
|
@@ -519,6 +519,16 @@ exports.SOCKET_ACTIONS = [
|
|
|
519
519
|
'mercadopago_static_qr_created',
|
|
520
520
|
'mp_hook_log_appended',
|
|
521
521
|
'mp_ipn_log_appended',
|
|
522
|
+
/**
|
|
523
|
+
* A storefront order's online payment attempt changed state. `data` is
|
|
524
|
+
* `OrderPaymentAttemptFrameData` (`paymentAttempt.ts`) — the order id and the
|
|
525
|
+
* minimised `OrderPaymentAttemptView`, never the stored attempt.
|
|
526
|
+
*
|
|
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.
|
|
530
|
+
*/
|
|
531
|
+
'orderPaymentAttempt',
|
|
522
532
|
'stripe',
|
|
523
533
|
'subscription',
|
|
524
534
|
// Fiscal.
|
package/dist/cjs/store.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.STORE_PATCH_ERROR_CODES = exports.STORE_MODULE_ERROR_CODES = exports.isStoreModuleOn = exports.isStoreModuleKey = exports.STORE_MODULE_KEYS = exports.STORE_ONBOARDING_REVIEW_AREAS = exports.CUSTOM_DOMAIN_ROW_LIMIT = exports.CUSTOM_DOMAIN_SLOT_LIMIT = void 0;
|
|
3
|
+
exports.STORE_PATCH_ERROR_CODES = exports.STORE_MODULE_ERROR_CODES = exports.isStoreModuleOn = exports.isStoreModuleKey = exports.STORE_MODULE_KEYS = exports.STOREFRONT_METHOD_KINDS = exports.STORE_ONBOARDING_REVIEW_AREAS = exports.CUSTOM_DOMAIN_ROW_LIMIT = exports.CUSTOM_DOMAIN_SLOT_LIMIT = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* How many custom-domain rows a store may hold that count: one active domain
|
|
6
6
|
* and one spare, so a replacement can be verified and provisioned before the
|
|
@@ -24,6 +24,11 @@ exports.CUSTOM_DOMAIN_ROW_LIMIT = 10;
|
|
|
24
24
|
* area is added in one place.
|
|
25
25
|
*/
|
|
26
26
|
exports.STORE_ONBOARDING_REVIEW_AREAS = ['payments', 'delivery', 'pricing'];
|
|
27
|
+
/**
|
|
28
|
+
* Every `StorefrontMethodKind` — the ONE list `Method.storefront` is validated
|
|
29
|
+
* against on write (`POST /store`) and typed against on every read.
|
|
30
|
+
*/
|
|
31
|
+
exports.STOREFRONT_METHOD_KINDS = ['offline', 'mp-checkout-pro'];
|
|
27
32
|
/**
|
|
28
33
|
* Every `StoreModuleKey`, in catalogue order — the ONE list. The type is derived
|
|
29
34
|
* from it, so the `PATCH /store` validator and every client enumerate exactly
|
package/dist/index.d.ts
CHANGED
|
@@ -54,6 +54,7 @@ export * from './orderCollectionAttempt.ts';
|
|
|
54
54
|
export * from './orderCompletionAttempt.ts';
|
|
55
55
|
export * from './orderCreateAttempt.ts';
|
|
56
56
|
export * from './payment.ts';
|
|
57
|
+
export * from './paymentAttempt.ts';
|
|
57
58
|
export * from './platform.ts';
|
|
58
59
|
export * from './presupuesto.ts';
|
|
59
60
|
export * from './pricing.ts';
|
package/dist/index.js
CHANGED
|
@@ -62,6 +62,7 @@ export * from "./orderCollectionAttempt.js";
|
|
|
62
62
|
export * from "./orderCompletionAttempt.js";
|
|
63
63
|
export * from "./orderCreateAttempt.js";
|
|
64
64
|
export * from "./payment.js";
|
|
65
|
+
export * from "./paymentAttempt.js";
|
|
65
66
|
export * from "./platform.js";
|
|
66
67
|
export * from "./presupuesto.js";
|
|
67
68
|
export * from "./pricing.js";
|
package/dist/notification.d.ts
CHANGED
|
@@ -136,7 +136,23 @@ export declare enum NotificationTypeEnum {
|
|
|
136
136
|
* on a store until a user turns it on. Carries `productId` and `lotId` as its
|
|
137
137
|
* click-through targets.
|
|
138
138
|
*/
|
|
139
|
-
EXPIRY_ALERT = "EXPIRY_ALERT"
|
|
139
|
+
EXPIRY_ALERT = "EXPIRY_ALERT",
|
|
140
|
+
/**
|
|
141
|
+
* A shopper registered on the storefront while the store's
|
|
142
|
+
* `ecommerce.config.registrationMode` is `'approval'`, and the account waits
|
|
143
|
+
* for an operator to approve or reject it. Names the registrant by name only.
|
|
144
|
+
*
|
|
145
|
+
* ⚠️ Additive, on the same grounds as `ABANDONED_CART`. The producer fans out
|
|
146
|
+
* to every non-disabled ADMIN-tier user with no legacy opt-in scan, as for
|
|
147
|
+
* `ML_SELLER_SWITCHED` (a new key is seeded nowhere). The consumer enforces
|
|
148
|
+
* explicit type/channel preferences, default-on when absent. No backfill or
|
|
149
|
+
* consumer migration is owed.
|
|
150
|
+
*
|
|
151
|
+
* ⚠️ Carries `pendingCustomerRef` and NEVER a top-level `customerId` (an
|
|
152
|
+
* audience — the operator bell would reach the pending registrant's own
|
|
153
|
+
* storefront socket), and never the registrant's email address.
|
|
154
|
+
*/
|
|
155
|
+
CUSTOMER_PENDING_APPROVAL = "CUSTOMER_PENDING_APPROVAL"
|
|
140
156
|
}
|
|
141
157
|
declare global {
|
|
142
158
|
type CustomerNotificationPreferences = Partial<Record<'reminder-scheduled' | 'appointment-reminder', {
|
|
@@ -183,6 +199,17 @@ declare global {
|
|
|
183
199
|
*/
|
|
184
200
|
cartId?: string;
|
|
185
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* Which registration a `CUSTOMER_PENDING_APPROVAL` operator bell is about. A
|
|
204
|
+
* POINTER, never an audience — the same reason as {@link AbandonedCartRef}:
|
|
205
|
+
* the top-level `customerId` would deliver the bell to the registrant.
|
|
206
|
+
* Operator surfaces only.
|
|
207
|
+
*/
|
|
208
|
+
interface PendingCustomerRef {
|
|
209
|
+
customerId: string;
|
|
210
|
+
/** The row's `emailVerified` at registration — `false` when the address is still unproven. */
|
|
211
|
+
emailVerified: boolean;
|
|
212
|
+
}
|
|
186
213
|
interface NotificationInterface {
|
|
187
214
|
storeId: string;
|
|
188
215
|
notificationId: string;
|
|
@@ -224,6 +251,11 @@ declare global {
|
|
|
224
251
|
* on bells written before it existed.
|
|
225
252
|
*/
|
|
226
253
|
cartRef?: AbandonedCartRef;
|
|
254
|
+
/**
|
|
255
|
+
* `CUSTOMER_PENDING_APPROVAL` only: which pending registration to open. A
|
|
256
|
+
* POINTER, not an audience — see {@link PendingCustomerRef}.
|
|
257
|
+
*/
|
|
258
|
+
pendingCustomerRef?: PendingCustomerRef;
|
|
227
259
|
/** `MENTION` only: the colleague who wrote the mention (a snapshot). */
|
|
228
260
|
actor?: NotificationActor;
|
|
229
261
|
userId?: string;
|
package/dist/notification.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Indexed producers resolve candidates through `getNotificationSubscribers`:
|
|
3
3
|
// legacy opt-ins and explicit channel maps remain source data on USER rows.
|
|
4
4
|
// Addressed ERROR / ML_FACTURADOR_COLLISION / ML_SELLER_SWITCHED /
|
|
5
|
-
// ML_CONNECTION_BROKEN / MENTION do not select a
|
|
5
|
+
// ML_CONNECTION_BROKEN / MENTION / CUSTOMER_PENDING_APPROVAL do not select a
|
|
6
|
+
// producer subscriber audience;
|
|
6
7
|
// the consumer still reads the live USER row for each delivery channel.
|
|
7
8
|
// AFIP_CERT_EXPIRY is seeded on the founding user and uses the subscriber index.
|
|
8
9
|
// Exported as a real enum consumed by api and app; adding an indexed type
|
|
@@ -154,4 +155,20 @@ export var NotificationTypeEnum;
|
|
|
154
155
|
* click-through targets.
|
|
155
156
|
*/
|
|
156
157
|
NotificationTypeEnum["EXPIRY_ALERT"] = "EXPIRY_ALERT";
|
|
158
|
+
/**
|
|
159
|
+
* A shopper registered on the storefront while the store's
|
|
160
|
+
* `ecommerce.config.registrationMode` is `'approval'`, and the account waits
|
|
161
|
+
* for an operator to approve or reject it. Names the registrant by name only.
|
|
162
|
+
*
|
|
163
|
+
* ⚠️ Additive, on the same grounds as `ABANDONED_CART`. The producer fans out
|
|
164
|
+
* to every non-disabled ADMIN-tier user with no legacy opt-in scan, as for
|
|
165
|
+
* `ML_SELLER_SWITCHED` (a new key is seeded nowhere). The consumer enforces
|
|
166
|
+
* explicit type/channel preferences, default-on when absent. No backfill or
|
|
167
|
+
* consumer migration is owed.
|
|
168
|
+
*
|
|
169
|
+
* ⚠️ Carries `pendingCustomerRef` and NEVER a top-level `customerId` (an
|
|
170
|
+
* audience — the operator bell would reach the pending registrant's own
|
|
171
|
+
* storefront socket), and never the registrant's email address.
|
|
172
|
+
*/
|
|
173
|
+
NotificationTypeEnum["CUSTOMER_PENDING_APPROVAL"] = "CUSTOMER_PENDING_APPROVAL";
|
|
157
174
|
})(NotificationTypeEnum || (NotificationTypeEnum = {}));
|
package/dist/order.d.ts
CHANGED
|
@@ -1282,10 +1282,14 @@ declare global {
|
|
|
1282
1282
|
/**
|
|
1283
1283
|
* Who initiated a cancellation. `customer` is the storefront self-service
|
|
1284
1284
|
* path (`DELETE` on the web `/orders`); `operator` is
|
|
1285
|
-
* `POST /orders { mode: 'cancel' }`, by ADMIN, SUPERVISOR or MANAGER.
|
|
1285
|
+
* `POST /orders { mode: 'cancel' }`, by ADMIN, SUPERVISOR or MANAGER. All
|
|
1286
1286
|
* are distinct from a bare `disabled`, which records no cancellation.
|
|
1287
|
+
*
|
|
1288
|
+
* `system` is written only by the payment-hold expiry, which cancels an
|
|
1289
|
+
* order whose online payment attempt lapsed unpaid. No writer emits it yet;
|
|
1290
|
+
* it is published first so a client can render it before one does.
|
|
1287
1291
|
*/
|
|
1288
|
-
type OrderCancellationSource = 'customer' | 'operator';
|
|
1292
|
+
type OrderCancellationSource = 'customer' | 'operator' | 'system';
|
|
1289
1293
|
/**
|
|
1290
1294
|
* Machine-readable reason an order is locked against a mutation — the
|
|
1291
1295
|
* payload of `409 ORDER_LOCKED` (on the customer cancellation's `409 ORDER_CANCELLATION_LOCKED` it rides in `message` as `reason: <r>` and that body has no `reason` key; the operator cancellation's carries both), and the
|
|
@@ -2309,6 +2313,51 @@ declare global {
|
|
|
2309
2313
|
*/
|
|
2310
2314
|
warehouseId?: string;
|
|
2311
2315
|
}
|
|
2316
|
+
/**
|
|
2317
|
+
* The storefront `POST /orders` body (Web host, customer token) — the shape
|
|
2318
|
+
* `ordersPostSchema` (`stacks/helpers/storefrontCheckout.ts`) accepts, tied to
|
|
2319
|
+
* it there by `AssertStorefrontOrderCreateRequestMatchesSchema`. Not
|
|
2320
|
+
* `CreateOrderRequest`, which is the operator (POS) body.
|
|
2321
|
+
*
|
|
2322
|
+
* The lines are never sent: the order is built from the shopper's server-side
|
|
2323
|
+
* cart, and the customer and store come from the token. An undeclared key at
|
|
2324
|
+
* any level is dropped, not refused.
|
|
2325
|
+
*/
|
|
2326
|
+
interface StorefrontOrderCreateRequest {
|
|
2327
|
+
/** A `Store.paymentMethods` row `id`; a value naming no row is refused. */
|
|
2328
|
+
paymentMethod: number;
|
|
2329
|
+
/** A `Store.deliveryMethods` row `id`. */
|
|
2330
|
+
deliveryMethod: number;
|
|
2331
|
+
/**
|
|
2332
|
+
* The billing identity the invoice is issued against. Every key is
|
|
2333
|
+
* optional; `docType` and `docNumber` are checked together as the ARCA
|
|
2334
|
+
* receptor identity.
|
|
2335
|
+
*/
|
|
2336
|
+
invoiceMethod?: {
|
|
2337
|
+
condFiscal?: number;
|
|
2338
|
+
condFiscalName?: string;
|
|
2339
|
+
cuit?: string;
|
|
2340
|
+
razonSocial?: string;
|
|
2341
|
+
docType?: number;
|
|
2342
|
+
docNumber?: string;
|
|
2343
|
+
};
|
|
2344
|
+
comments?: string;
|
|
2345
|
+
/**
|
|
2346
|
+
* The delivery address. ⚠️ Every key is OPTIONAL here, unlike the stored
|
|
2347
|
+
* `Order.deliveryAddress`: a partial address is accepted, as it always has
|
|
2348
|
+
* been.
|
|
2349
|
+
*/
|
|
2350
|
+
deliveryAddress?: {
|
|
2351
|
+
fullName?: string;
|
|
2352
|
+
address?: string;
|
|
2353
|
+
phone?: string;
|
|
2354
|
+
city?: string;
|
|
2355
|
+
province?: string;
|
|
2356
|
+
postalCode?: string;
|
|
2357
|
+
};
|
|
2358
|
+
/** Persist `deliveryAddress` as the customer's default. Directive only, never stored. */
|
|
2359
|
+
saveAsDefault?: boolean;
|
|
2360
|
+
}
|
|
2312
2361
|
interface ZebraTag {
|
|
2313
2362
|
orderId: string;
|
|
2314
2363
|
fullName: string;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Online payment attempts — a storefront order paid through Mercado Pago
|
|
3
|
+
* Checkout Pro on the store's connected account.
|
|
4
|
+
*
|
|
5
|
+
* An attempt is its own record, kept apart from the order: it never sets
|
|
6
|
+
* `Order.financialStatus`, `Order.linkedPayments` or fulfilment. The Mercado
|
|
7
|
+
* Pago webhook moves the attempt, and the existing payment pipeline settles the
|
|
8
|
+
* order.
|
|
9
|
+
*
|
|
10
|
+
* A shopper starts one for an order whose payment method row declares
|
|
11
|
+
* `storefront: 'mp-checkout-pro'` and is redirected to `redirectUrl`. While the
|
|
12
|
+
* attempt is live (until `expiresAt`), starting again answers the SAME attempt,
|
|
13
|
+
* whatever its state. A new attempt is minted only once the previous one is
|
|
14
|
+
* `expired` or `cancelled` and the order can still be paid.
|
|
15
|
+
*
|
|
16
|
+
* ⚠️ `paymentAttempt` is never a field of `Order`. The shopper's own order read
|
|
17
|
+
* answers a {@link StorefrontOrderView}, which carries it as a projection, so
|
|
18
|
+
* no operator write can carry it back onto the order.
|
|
19
|
+
*/
|
|
20
|
+
declare global {
|
|
21
|
+
/**
|
|
22
|
+
* One of {@link PAYMENT_ATTEMPT_STATES}.
|
|
23
|
+
*
|
|
24
|
+
* - `created` — the Mercado Pago checkout exists; nothing paid yet.
|
|
25
|
+
* - `pending` — a payment was made and Mercado Pago has not decided it.
|
|
26
|
+
* - `approved` — a payment equal to the order total was approved, and the
|
|
27
|
+
* order is settled by the payment pipeline.
|
|
28
|
+
* - `rejected` — the last payment was rejected. ⚠️ NOT terminal: Checkout Pro
|
|
29
|
+
* lets the shopper retry inside the same checkout until `expiresAt`, so a
|
|
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'`).
|
|
33
|
+
* - `cancelled` — the order was cancelled while the attempt was live.
|
|
34
|
+
* - `refunded` — the approved payment was refunded.
|
|
35
|
+
* - `charged_back` — the approved payment was charged back.
|
|
36
|
+
* - `resolution` — money landed that must NOT settle the order: an approval
|
|
37
|
+
* on an order already paid, on an expired or cancelled order, or for an
|
|
38
|
+
* amount other than the order total. The payment is recorded and an
|
|
39
|
+
* operator decides; the order is neither settled nor re-opened. Show it to
|
|
40
|
+
* the shopper as under review.
|
|
41
|
+
*/
|
|
42
|
+
type PaymentAttemptState = (typeof PAYMENT_ATTEMPT_STATES)[number];
|
|
43
|
+
/** One of {@link PAYMENT_ATTEMPT_ERROR_CODES}. */
|
|
44
|
+
type PaymentAttemptErrorCode = (typeof PAYMENT_ATTEMPT_ERROR_CODES)[number];
|
|
45
|
+
/** One of {@link ORDER_NOT_PAYABLE_REASONS}. */
|
|
46
|
+
type OrderNotPayableReason = (typeof ORDER_NOT_PAYABLE_REASONS)[number];
|
|
47
|
+
/**
|
|
48
|
+
* The body that starts (or returns the live) payment attempt for an order.
|
|
49
|
+
* The caller must be the order's customer; the store is the token's. The
|
|
50
|
+
* amount is never sent: it is the order's total, read server-side.
|
|
51
|
+
*/
|
|
52
|
+
interface StartPaymentAttemptRequest {
|
|
53
|
+
orderId: string;
|
|
54
|
+
}
|
|
55
|
+
/** `data` of a successful start. A repeat start while the attempt is live answers the same `attemptId`. */
|
|
56
|
+
interface StartPaymentAttemptResponse {
|
|
57
|
+
attemptId: string;
|
|
58
|
+
/** The Mercado Pago checkout URL to send the shopper to. */
|
|
59
|
+
redirectUrl: string;
|
|
60
|
+
/** ISO 8601. After it the checkout no longer takes a payment. */
|
|
61
|
+
expiresAt: string;
|
|
62
|
+
}
|
|
63
|
+
/** `data` of `409 ORDER_NOT_PAYABLE`. */
|
|
64
|
+
interface OrderNotPayableData {
|
|
65
|
+
reason: OrderNotPayableReason;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The minimised attempt the shopper sees on their own order — never the
|
|
69
|
+
* stored record.
|
|
70
|
+
*/
|
|
71
|
+
interface OrderPaymentAttemptView {
|
|
72
|
+
attemptId: string;
|
|
73
|
+
state: PaymentAttemptState;
|
|
74
|
+
/** ISO 8601. */
|
|
75
|
+
expiresAt: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The shopper's own order read: the order plus its payment attempt, when it
|
|
79
|
+
* has one. `paymentAttempt` is attached on read and is never stored on the
|
|
80
|
+
* order.
|
|
81
|
+
*/
|
|
82
|
+
type StorefrontOrderView = Order & {
|
|
83
|
+
paymentAttempt?: OrderPaymentAttemptView;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* `data` of an `orderPaymentAttempt` socket frame, sent to the order's own
|
|
87
|
+
* customer only when the attempt changes.
|
|
88
|
+
*/
|
|
89
|
+
interface OrderPaymentAttemptFrameData {
|
|
90
|
+
orderId: string;
|
|
91
|
+
paymentAttempt: OrderPaymentAttemptView;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/** Every {@link PaymentAttemptState}, in lifecycle order. */
|
|
95
|
+
export declare const PAYMENT_ATTEMPT_STATES: readonly ["created", "pending", "approved", "rejected", "expired", "cancelled", "refunded", "charged_back", "resolution"];
|
|
96
|
+
/**
|
|
97
|
+
* Every refusal code a payment-attempt start, or a checkout choosing an online
|
|
98
|
+
* method, answers:
|
|
99
|
+
*
|
|
100
|
+
* - `PAYMENT_PROVIDER_NOT_CONNECTED` · 412 — the store has no Mercado Pago
|
|
101
|
+
* account connected.
|
|
102
|
+
* - `PAYMENT_PROVIDER_TOKEN_EXPIRED` · 412 — the store's Mercado Pago
|
|
103
|
+
* connection was rejected by Mercado Pago and must be reconnected.
|
|
104
|
+
* - `ORDER_NOT_PAYABLE` · 409 — the order cannot be paid online; `data` is
|
|
105
|
+
* {@link OrderNotPayableData}.
|
|
106
|
+
* - `PAYMENT_ATTEMPT_EXPIRED` · 410 — the attempt's `expiresAt` passed.
|
|
107
|
+
* - `PAYMENT_METHOD_UNAVAILABLE` · 409 — the checkout chose an online payment
|
|
108
|
+
* method the store cannot take right now (its provider is not connected).
|
|
109
|
+
*/
|
|
110
|
+
export declare const PAYMENT_ATTEMPT_ERROR_CODES: readonly ["PAYMENT_PROVIDER_NOT_CONNECTED", "PAYMENT_PROVIDER_TOKEN_EXPIRED", "ORDER_NOT_PAYABLE", "PAYMENT_ATTEMPT_EXPIRED", "PAYMENT_METHOD_UNAVAILABLE"];
|
|
111
|
+
/**
|
|
112
|
+
* Every `data.reason` of `409 ORDER_NOT_PAYABLE`:
|
|
113
|
+
*
|
|
114
|
+
* - `cancelled` — the order is cancelled.
|
|
115
|
+
* - `paid` — the order is already paid.
|
|
116
|
+
* - `not-online` — the order's payment method row does not declare
|
|
117
|
+
* `storefront: 'mp-checkout-pro'`.
|
|
118
|
+
*/
|
|
119
|
+
export declare const ORDER_NOT_PAYABLE_REASONS: readonly ["cancelled", "paid", "not-online"];
|
|
120
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Online payment attempts — a storefront order paid through Mercado Pago
|
|
3
|
+
* Checkout Pro on the store's connected account.
|
|
4
|
+
*
|
|
5
|
+
* An attempt is its own record, kept apart from the order: it never sets
|
|
6
|
+
* `Order.financialStatus`, `Order.linkedPayments` or fulfilment. The Mercado
|
|
7
|
+
* Pago webhook moves the attempt, and the existing payment pipeline settles the
|
|
8
|
+
* order.
|
|
9
|
+
*
|
|
10
|
+
* A shopper starts one for an order whose payment method row declares
|
|
11
|
+
* `storefront: 'mp-checkout-pro'` and is redirected to `redirectUrl`. While the
|
|
12
|
+
* attempt is live (until `expiresAt`), starting again answers the SAME attempt,
|
|
13
|
+
* whatever its state. A new attempt is minted only once the previous one is
|
|
14
|
+
* `expired` or `cancelled` and the order can still be paid.
|
|
15
|
+
*
|
|
16
|
+
* ⚠️ `paymentAttempt` is never a field of `Order`. The shopper's own order read
|
|
17
|
+
* answers a {@link StorefrontOrderView}, which carries it as a projection, so
|
|
18
|
+
* no operator write can carry it back onto the order.
|
|
19
|
+
*/
|
|
20
|
+
/** Every {@link PaymentAttemptState}, in lifecycle order. */
|
|
21
|
+
export const PAYMENT_ATTEMPT_STATES = [
|
|
22
|
+
'created',
|
|
23
|
+
'pending',
|
|
24
|
+
'approved',
|
|
25
|
+
'rejected',
|
|
26
|
+
'expired',
|
|
27
|
+
'cancelled',
|
|
28
|
+
'refunded',
|
|
29
|
+
'charged_back',
|
|
30
|
+
'resolution',
|
|
31
|
+
];
|
|
32
|
+
/**
|
|
33
|
+
* Every refusal code a payment-attempt start, or a checkout choosing an online
|
|
34
|
+
* method, answers:
|
|
35
|
+
*
|
|
36
|
+
* - `PAYMENT_PROVIDER_NOT_CONNECTED` · 412 — the store has no Mercado Pago
|
|
37
|
+
* account connected.
|
|
38
|
+
* - `PAYMENT_PROVIDER_TOKEN_EXPIRED` · 412 — the store's Mercado Pago
|
|
39
|
+
* connection was rejected by Mercado Pago and must be reconnected.
|
|
40
|
+
* - `ORDER_NOT_PAYABLE` · 409 — the order cannot be paid online; `data` is
|
|
41
|
+
* {@link OrderNotPayableData}.
|
|
42
|
+
* - `PAYMENT_ATTEMPT_EXPIRED` · 410 — the attempt's `expiresAt` passed.
|
|
43
|
+
* - `PAYMENT_METHOD_UNAVAILABLE` · 409 — the checkout chose an online payment
|
|
44
|
+
* method the store cannot take right now (its provider is not connected).
|
|
45
|
+
*/
|
|
46
|
+
export const PAYMENT_ATTEMPT_ERROR_CODES = [
|
|
47
|
+
'PAYMENT_PROVIDER_NOT_CONNECTED',
|
|
48
|
+
'PAYMENT_PROVIDER_TOKEN_EXPIRED',
|
|
49
|
+
'ORDER_NOT_PAYABLE',
|
|
50
|
+
'PAYMENT_ATTEMPT_EXPIRED',
|
|
51
|
+
'PAYMENT_METHOD_UNAVAILABLE',
|
|
52
|
+
];
|
|
53
|
+
/**
|
|
54
|
+
* Every `data.reason` of `409 ORDER_NOT_PAYABLE`:
|
|
55
|
+
*
|
|
56
|
+
* - `cancelled` — the order is cancelled.
|
|
57
|
+
* - `paid` — the order is already paid.
|
|
58
|
+
* - `not-online` — the order's payment method row does not declare
|
|
59
|
+
* `storefront: 'mp-checkout-pro'`.
|
|
60
|
+
*/
|
|
61
|
+
export const ORDER_NOT_PAYABLE_REASONS = ['cancelled', 'paid', 'not-online'];
|
package/dist/socket.d.ts
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* A client must ignore actions it does not own rather than assume it
|
|
27
27
|
* receives all of them.
|
|
28
28
|
*/
|
|
29
|
-
export declare const SOCKET_ACTIONS: readonly ["account", "appointments", "appointmentWaitlist", "attendance", "attributes", "automation-rules", "baskets", "cart", "brands", "cash", "catalogOperation", "categories", "campaigns", "customers", "customerNote", "customerAddress", "customerContact", "deliveries", "globals", "inventory", "invoices", "literals", "loyalty", "orders", "presupuestos", "products", "promotions", "segments", "returns", "rma", "templates", "services", "service-templates", "shifts", "stores", "suppliers", "supplier-invoice", "support", "surveys", "users", "warehouses", "zones", "favorites", "webhooks", "account-delete", "baskets-delete", "cart-delete", "log-delete", "notifications", "support-message", "whatsapp-order-draft", "whatsapp-order-confirmation", "payment_received", "mp_payment_status_changed", "payment_linked", "payment_unlinked", "mercadopago", "mercadopago_dynamic_qr_created", "mercadopago_static_qr_created", "mp_hook_log_appended", "mp_ipn_log_appended", "stripe", "subscription", "caea", "print", "print-order", "print-invoice", "print-product", "print-tag", "print_job_failed", "request_printers", "printers_changed", "agent_status_changed", "print_rules_changed", "printers_active", "agent_command", "maintenance", "currency_auto_updated", "drain_progress", "integration_event_appended", "userActivityRecorded", "mercadolibre_settlement_period", "customDomain", "purchaseOrders", "cycleCounts", "stockTransfers", "workItems"];
|
|
29
|
+
export declare const SOCKET_ACTIONS: readonly ["account", "appointments", "appointmentWaitlist", "attendance", "attributes", "automation-rules", "baskets", "cart", "brands", "cash", "catalogOperation", "categories", "campaigns", "customers", "customerNote", "customerAddress", "customerContact", "deliveries", "globals", "inventory", "invoices", "literals", "loyalty", "orders", "presupuestos", "products", "promotions", "segments", "returns", "rma", "templates", "services", "service-templates", "shifts", "stores", "suppliers", "supplier-invoice", "support", "surveys", "users", "warehouses", "zones", "favorites", "webhooks", "account-delete", "baskets-delete", "cart-delete", "log-delete", "notifications", "support-message", "whatsapp-order-draft", "whatsapp-order-confirmation", "payment_received", "mp_payment_status_changed", "payment_linked", "payment_unlinked", "mercadopago", "mercadopago_dynamic_qr_created", "mercadopago_static_qr_created", "mp_hook_log_appended", "mp_ipn_log_appended", "orderPaymentAttempt", "stripe", "subscription", "caea", "print", "print-order", "print-invoice", "print-product", "print-tag", "print_job_failed", "request_printers", "printers_changed", "agent_status_changed", "print_rules_changed", "printers_active", "agent_command", "maintenance", "currency_auto_updated", "drain_progress", "integration_event_appended", "userActivityRecorded", "mercadolibre_settlement_period", "customDomain", "purchaseOrders", "cycleCounts", "stockTransfers", "workItems"];
|
|
30
30
|
/** Union of every server→client data-frame action. */
|
|
31
31
|
export type SocketAction = (typeof SOCKET_ACTIONS)[number];
|
|
32
32
|
/**
|
package/dist/socket.js
CHANGED
|
@@ -516,6 +516,16 @@ export const SOCKET_ACTIONS = [
|
|
|
516
516
|
'mercadopago_static_qr_created',
|
|
517
517
|
'mp_hook_log_appended',
|
|
518
518
|
'mp_ipn_log_appended',
|
|
519
|
+
/**
|
|
520
|
+
* A storefront order's online payment attempt changed state. `data` is
|
|
521
|
+
* `OrderPaymentAttemptFrameData` (`paymentAttempt.ts`) — the order id and the
|
|
522
|
+
* minimised `OrderPaymentAttemptView`, never the stored attempt.
|
|
523
|
+
*
|
|
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.
|
|
527
|
+
*/
|
|
528
|
+
'orderPaymentAttempt',
|
|
519
529
|
'stripe',
|
|
520
530
|
'subscription',
|
|
521
531
|
// Fiscal.
|
package/dist/store.d.ts
CHANGED
|
@@ -1734,12 +1734,35 @@ declare global {
|
|
|
1734
1734
|
*/
|
|
1735
1735
|
onboardingReviewAdd?: StoreOnboardingReviewArea[];
|
|
1736
1736
|
}
|
|
1737
|
+
/**
|
|
1738
|
+
* How the storefront offers a `paymentMethods` row — one of
|
|
1739
|
+
* `STOREFRONT_METHOD_KINDS`.
|
|
1740
|
+
*
|
|
1741
|
+
* - `'offline'` — offered, paid on delivery or pickup.
|
|
1742
|
+
* - `'mp-checkout-pro'` — offered, paid online through a payment attempt
|
|
1743
|
+
* (`StartPaymentAttemptRequest`) on the store's connected Mercado Pago
|
|
1744
|
+
* account.
|
|
1745
|
+
*/
|
|
1746
|
+
type StorefrontMethodKind = (typeof STOREFRONT_METHOD_KINDS)[number];
|
|
1737
1747
|
interface Method {
|
|
1738
1748
|
id: number;
|
|
1739
1749
|
name: string;
|
|
1740
1750
|
value?: number;
|
|
1741
1751
|
removable?: boolean;
|
|
1742
1752
|
editable?: boolean;
|
|
1753
|
+
/**
|
|
1754
|
+
* How the storefront offers this row. Written by `POST /store` (a value
|
|
1755
|
+
* outside `STOREFRONT_METHOD_KINDS` is `400 VALIDATION_FAILED`) and carried
|
|
1756
|
+
* by every read of the row, the storefront `GET /store` and the CUSTOMER
|
|
1757
|
+
* STORE frame included.
|
|
1758
|
+
*
|
|
1759
|
+
* ⚠️ ABSENT means "not declared", never "not offered": the storefront
|
|
1760
|
+
* keeps its legacy filter until the store declares `storefront` on any
|
|
1761
|
+
* row. A stored value outside the tuple is dropped on read, never coerced.
|
|
1762
|
+
* `deliveryMethods` rows share the row schema, so the key is accepted
|
|
1763
|
+
* there too.
|
|
1764
|
+
*/
|
|
1765
|
+
storefront?: StorefrontMethodKind;
|
|
1743
1766
|
}
|
|
1744
1767
|
interface FiscalCondition {
|
|
1745
1768
|
CbteTipo: {
|
|
@@ -2168,6 +2191,11 @@ export declare const CUSTOM_DOMAIN_ROW_LIMIT = 10;
|
|
|
2168
2191
|
* area is added in one place.
|
|
2169
2192
|
*/
|
|
2170
2193
|
export declare const STORE_ONBOARDING_REVIEW_AREAS: readonly ["payments", "delivery", "pricing"];
|
|
2194
|
+
/**
|
|
2195
|
+
* Every `StorefrontMethodKind` — the ONE list `Method.storefront` is validated
|
|
2196
|
+
* against on write (`POST /store`) and typed against on every read.
|
|
2197
|
+
*/
|
|
2198
|
+
export declare const STOREFRONT_METHOD_KINDS: readonly ["offline", "mp-checkout-pro"];
|
|
2171
2199
|
/**
|
|
2172
2200
|
* Every `StoreModuleKey`, in catalogue order — the ONE list. The type is derived
|
|
2173
2201
|
* from it, so the `PATCH /store` validator and every client enumerate exactly
|
package/dist/store.js
CHANGED
|
@@ -21,6 +21,11 @@ export const CUSTOM_DOMAIN_ROW_LIMIT = 10;
|
|
|
21
21
|
* area is added in one place.
|
|
22
22
|
*/
|
|
23
23
|
export const STORE_ONBOARDING_REVIEW_AREAS = ['payments', 'delivery', 'pricing'];
|
|
24
|
+
/**
|
|
25
|
+
* Every `StorefrontMethodKind` — the ONE list `Method.storefront` is validated
|
|
26
|
+
* against on write (`POST /store`) and typed against on every read.
|
|
27
|
+
*/
|
|
28
|
+
export const STOREFRONT_METHOD_KINDS = ['offline', 'mp-checkout-pro'];
|
|
24
29
|
/**
|
|
25
30
|
* Every `StoreModuleKey`, in catalogue order — the ONE list. The type is derived
|
|
26
31
|
* from it, so the `PATCH /store` validator and every client enumerate exactly
|