platform-types 1.10.759 → 1.10.761
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/paymentAttempt.js +31 -1
- package/dist/cjs/socket.js +1 -2
- package/dist/payment.d.ts +12 -0
- package/dist/paymentAttempt.d.ts +70 -3
- package/dist/paymentAttempt.js +30 -0
- package/dist/socket.js +1 -2
- package/dist/store.d.ts +13 -1
- package/package.json +1 -1
|
@@ -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_HOLD_MINUTES_DEFAULT = exports.PAYMENT_HOLD_MINUTES_MAX = exports.PAYMENT_HOLD_MINUTES_MIN = 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,33 @@ 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
|
+
];
|
|
89
|
+
/**
|
|
90
|
+
* The bounds of the store's payment hold, `ecommerce.config.paymentHoldMinutes`
|
|
91
|
+
* — how long a new attempt stays payable, in whole minutes. Both writers refuse
|
|
92
|
+
* a value outside `[MIN, MAX]` (`400 VALIDATION_FAILED`); the start reads an
|
|
93
|
+
* absent or out-of-range stored value as `DEFAULT`.
|
|
94
|
+
*/
|
|
95
|
+
exports.PAYMENT_HOLD_MINUTES_MIN = 15;
|
|
96
|
+
exports.PAYMENT_HOLD_MINUTES_MAX = 1440;
|
|
97
|
+
exports.PAYMENT_HOLD_MINUTES_DEFAULT = 60;
|
package/dist/cjs/socket.js
CHANGED
|
@@ -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.
|
|
529
|
-
* it yet.
|
|
528
|
+
* customer broadcast. Sent once per committed state move of the attempt.
|
|
530
529
|
*/
|
|
531
530
|
'orderPaymentAttempt',
|
|
532
531
|
'stripe',
|
package/dist/payment.d.ts
CHANGED
|
@@ -136,6 +136,18 @@ declare global {
|
|
|
136
136
|
externalReference?: string;
|
|
137
137
|
reconciled?: boolean;
|
|
138
138
|
reconcileReason?: string;
|
|
139
|
+
/**
|
|
140
|
+
* MercadoPago's own money breakdown, in major units of `currency`: `gross` is
|
|
141
|
+
* `transaction_amount`, `net` is `transaction_details.net_received_amount`
|
|
142
|
+
* (what the store received), and `fee` is what MercadoPago kept
|
|
143
|
+
* (`gross − net`; the collector-paid `fee_details` when MercadoPago states no
|
|
144
|
+
* net). Each is present only when MercadoPago reported it, on MercadoPago
|
|
145
|
+
* payments recorded since these fields existed. Absent means "not recorded",
|
|
146
|
+
* never zero; a `fee` of `0` is a fee-free payment.
|
|
147
|
+
*/
|
|
148
|
+
gross?: number;
|
|
149
|
+
fee?: number;
|
|
150
|
+
net?: number;
|
|
139
151
|
}
|
|
140
152
|
/**
|
|
141
153
|
* Confidence tier for a link suggestion.
|
package/dist/paymentAttempt.d.ts
CHANGED
|
@@ -28,10 +28,15 @@ 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
|
|
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
|
-
* - `refunded` — the approved payment was refunded.
|
|
37
|
+
* - `refunded` — the approved payment was refunded. Only from `approved`: a
|
|
38
|
+
* refund on a `resolution` attempt is the operator's resolution work and
|
|
39
|
+
* leaves it `resolution`.
|
|
35
40
|
* - `charged_back` — the approved payment was charged back.
|
|
36
41
|
* - `resolution` — money landed that must NOT settle the order: an approval
|
|
37
42
|
* on an order already paid, on an expired or cancelled order, or for an
|
|
@@ -44,6 +49,8 @@ declare global {
|
|
|
44
49
|
type PaymentAttemptErrorCode = (typeof PAYMENT_ATTEMPT_ERROR_CODES)[number];
|
|
45
50
|
/** One of {@link ORDER_NOT_PAYABLE_REASONS}. */
|
|
46
51
|
type OrderNotPayableReason = (typeof ORDER_NOT_PAYABLE_REASONS)[number];
|
|
52
|
+
/** One of {@link PAYMENT_ATTEMPT_RESOLUTION_CAUSES}. */
|
|
53
|
+
type PaymentAttemptResolutionCause = (typeof PAYMENT_ATTEMPT_RESOLUTION_CAUSES)[number];
|
|
47
54
|
/**
|
|
48
55
|
* The body that starts (or returns the live) payment attempt for an order.
|
|
49
56
|
* The caller must be the order's customer; the store is the token's. The
|
|
@@ -90,6 +97,43 @@ declare global {
|
|
|
90
97
|
orderId: string;
|
|
91
98
|
paymentAttempt: OrderPaymentAttemptView;
|
|
92
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* One payment attempt as the store's operators see it — the operator fields
|
|
102
|
+
* of the stored record, never its Mercado Pago checkout URL or Preference id.
|
|
103
|
+
*/
|
|
104
|
+
interface PaymentAttemptOperatorView {
|
|
105
|
+
attemptId: string;
|
|
106
|
+
orderId: string;
|
|
107
|
+
/** The order's owner, who started the attempt. */
|
|
108
|
+
customerId: string;
|
|
109
|
+
state: PaymentAttemptState;
|
|
110
|
+
/** Why the attempt is in `resolution` — set by the move into it. */
|
|
111
|
+
resolutionCause?: PaymentAttemptResolutionCause;
|
|
112
|
+
/** The Mercado Pago payments whose approval this attempt processed, oldest first. */
|
|
113
|
+
approvedPaymentIds: string[];
|
|
114
|
+
/** The Mercado Pago payment whose notification made the last move. */
|
|
115
|
+
lastPaymentId?: string;
|
|
116
|
+
/** Decimal pesos — the order's charged total when the attempt was started. */
|
|
117
|
+
amount: number;
|
|
118
|
+
currency: 'ARS';
|
|
119
|
+
/** ISO 8601 — when the checkout stopped taking a payment. */
|
|
120
|
+
expiresAt: string;
|
|
121
|
+
/** Unix ms. */
|
|
122
|
+
createdAt: number;
|
|
123
|
+
/** Unix ms. */
|
|
124
|
+
updatedAt: number;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* `data` of `GET /payments/attempts?state=resolution` (App host, admin):
|
|
128
|
+
* the store's attempts in that state, newest activity first. Page on
|
|
129
|
+
* `nextCursor`'s presence, never on the page's length — the state is a
|
|
130
|
+
* filter, so a page can be short, even empty, with more to come.
|
|
131
|
+
*/
|
|
132
|
+
interface PaymentAttemptResolutionListResponse {
|
|
133
|
+
attempts: PaymentAttemptOperatorView[];
|
|
134
|
+
/** Opaque. Absent on the last page. */
|
|
135
|
+
nextCursor?: string;
|
|
136
|
+
}
|
|
93
137
|
}
|
|
94
138
|
/** Every {@link PaymentAttemptState}, in lifecycle order. */
|
|
95
139
|
export declare const PAYMENT_ATTEMPT_STATES: readonly ["created", "pending", "approved", "rejected", "expired", "cancelled", "refunded", "charged_back", "resolution"];
|
|
@@ -119,4 +163,27 @@ export declare const PAYMENT_ATTEMPT_ERROR_CODES: readonly ["PAYMENT_PROVIDER_NO
|
|
|
119
163
|
* `storefront: 'mp-checkout-pro'`.
|
|
120
164
|
*/
|
|
121
165
|
export declare const ORDER_NOT_PAYABLE_REASONS: readonly ["cancelled", "paid", "not-online"];
|
|
166
|
+
/**
|
|
167
|
+
* Every reason an attempt lands in `resolution` — money that must not settle
|
|
168
|
+
* the order on its own:
|
|
169
|
+
*
|
|
170
|
+
* - `second-approval` — the checkout already took an approved payment.
|
|
171
|
+
* - `amount-mismatch` — the payment's amount or currency is not the order's.
|
|
172
|
+
* - `order-mismatch` — the payment names another order than the attempt's.
|
|
173
|
+
* - `order-already-paid` — the order was already paid by another route.
|
|
174
|
+
* - `not-settled` — the payment pipeline recorded the payment without settling
|
|
175
|
+
* the order.
|
|
176
|
+
* - `late-capture` — the payment arrived after the hold ended: the attempt had
|
|
177
|
+
* expired or been cancelled, or the order was already cancelled.
|
|
178
|
+
*/
|
|
179
|
+
export declare const PAYMENT_ATTEMPT_RESOLUTION_CAUSES: readonly ["second-approval", "amount-mismatch", "order-mismatch", "order-already-paid", "not-settled", "late-capture"];
|
|
180
|
+
/**
|
|
181
|
+
* The bounds of the store's payment hold, `ecommerce.config.paymentHoldMinutes`
|
|
182
|
+
* — how long a new attempt stays payable, in whole minutes. Both writers refuse
|
|
183
|
+
* a value outside `[MIN, MAX]` (`400 VALIDATION_FAILED`); the start reads an
|
|
184
|
+
* absent or out-of-range stored value as `DEFAULT`.
|
|
185
|
+
*/
|
|
186
|
+
export declare const PAYMENT_HOLD_MINUTES_MIN = 15;
|
|
187
|
+
export declare const PAYMENT_HOLD_MINUTES_MAX = 1440;
|
|
188
|
+
export declare const PAYMENT_HOLD_MINUTES_DEFAULT = 60;
|
|
122
189
|
export {};
|
package/dist/paymentAttempt.js
CHANGED
|
@@ -62,3 +62,33 @@ 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
|
+
];
|
|
86
|
+
/**
|
|
87
|
+
* The bounds of the store's payment hold, `ecommerce.config.paymentHoldMinutes`
|
|
88
|
+
* — how long a new attempt stays payable, in whole minutes. Both writers refuse
|
|
89
|
+
* a value outside `[MIN, MAX]` (`400 VALIDATION_FAILED`); the start reads an
|
|
90
|
+
* absent or out-of-range stored value as `DEFAULT`.
|
|
91
|
+
*/
|
|
92
|
+
export const PAYMENT_HOLD_MINUTES_MIN = 15;
|
|
93
|
+
export const PAYMENT_HOLD_MINUTES_MAX = 1440;
|
|
94
|
+
export const PAYMENT_HOLD_MINUTES_DEFAULT = 60;
|
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.
|
|
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
|
@@ -146,6 +146,18 @@ declare global {
|
|
|
146
146
|
* frame), so the storefront can say the account needs approval.
|
|
147
147
|
*/
|
|
148
148
|
registrationMode?: 'open' | 'approval';
|
|
149
|
+
/**
|
|
150
|
+
* How long a storefront online payment holds the order, in whole
|
|
151
|
+
* minutes: the payment attempt's `expiresAt` and its Checkout Pro
|
|
152
|
+
* Preference's `expiration_date_to` are this far from the start.
|
|
153
|
+
* An integer from `PAYMENT_HOLD_MINUTES_MIN` (15) to
|
|
154
|
+
* `PAYMENT_HOLD_MINUTES_MAX` (1440); absent means
|
|
155
|
+
* `PAYMENT_HOLD_MINUTES_DEFAULT` (60), and so does a stored value
|
|
156
|
+
* outside that range. Written by `PATCH /store` (ADMIN) and
|
|
157
|
+
* `PUT /platform/stores/{storeId}` (MANAGER). Never sent to shoppers:
|
|
158
|
+
* they see the attempt's `expiresAt` instead.
|
|
159
|
+
*/
|
|
160
|
+
paymentHoldMinutes?: number;
|
|
149
161
|
showStocks?: boolean;
|
|
150
162
|
};
|
|
151
163
|
sidebar?: {
|
|
@@ -188,7 +200,7 @@ declare global {
|
|
|
188
200
|
* data: { field: 'ecommerce.config.newCustomerPriceList', value: number }; nothing written.
|
|
189
201
|
*/
|
|
190
202
|
interface EcommercePatchInput {
|
|
191
|
-
config?: Pick<NonNullable<Ecommerce['config']>, 'showDefaultPriceList' | 'newCustomerPriceList' | 'registrationMode'> & StorefrontLiveSettingsPatch;
|
|
203
|
+
config?: Pick<NonNullable<Ecommerce['config']>, 'showDefaultPriceList' | 'newCustomerPriceList' | 'registrationMode' | 'paymentHoldMinutes'> & StorefrontLiveSettingsPatch;
|
|
192
204
|
sidebar?: Ecommerce['sidebar'];
|
|
193
205
|
home?: Omit<NonNullable<Ecommerce['home']>, 'displayOrders' | 'displayProfile'>;
|
|
194
206
|
themeColors?: Ecommerce['themeColors'];
|