platform-types 1.10.818 → 1.10.820

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.
@@ -20,7 +20,7 @@
20
20
  * `status`, `revisedAt` replaces `updatedAt`, and there is no `dated`.
21
21
  */
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.PURCHASE_WITHDRAWAL_VERIFICATION_FAILED = exports.PURCHASE_WITHDRAWAL_GUEST_INTENTS = exports.PURCHASE_WITHDRAWAL_CODE_DUE_MS = exports.PURCHASE_WITHDRAWAL_CODE_DUE_SOURCE = exports.PURCHASE_WITHDRAWAL_WINDOW_SOURCE = exports.PURCHASE_WITHDRAWAL_WINDOW_DAYS = exports.PURCHASE_WITHDRAWAL_LINES_MAX = exports.PURCHASE_WITHDRAWAL_NOTE_MAX = exports.PURCHASE_WITHDRAWAL_INELIGIBLE_REASONS = exports.PURCHASE_WITHDRAWAL_ACTION_MODES = exports.PURCHASE_WITHDRAWAL_RELAY_CHANNELS = exports.PURCHASE_WITHDRAWAL_DECLINE_REASONS = exports.PURCHASE_WITHDRAWAL_SOURCES = exports.PURCHASE_WITHDRAWAL_LIST_FILTERS = exports.PURCHASE_WITHDRAWAL_STATES = void 0;
23
+ exports.PURCHASE_WITHDRAWAL_VERIFICATION_FAILED = exports.PURCHASE_WITHDRAWAL_GUEST_INTENTS = exports.PURCHASE_WITHDRAWAL_CODE_DUE_MS = exports.PURCHASE_WITHDRAWAL_CODE_DUE_SOURCE = exports.PURCHASE_WITHDRAWAL_WINDOW_SOURCE = exports.PURCHASE_WITHDRAWAL_WINDOW_DAYS = exports.PURCHASE_WITHDRAWAL_LINES_MAX = exports.PURCHASE_WITHDRAWAL_NOTE_MAX = exports.PURCHASE_WITHDRAWAL_FISCAL_IN_FLIGHT_CAUSES = exports.PURCHASE_WITHDRAWAL_INELIGIBLE_REASONS = exports.PURCHASE_WITHDRAWAL_ACTION_MODES = exports.PURCHASE_WITHDRAWAL_RELAY_CHANNELS = exports.PURCHASE_WITHDRAWAL_DECLINE_REASONS = exports.PURCHASE_WITHDRAWAL_SOURCES = exports.PURCHASE_WITHDRAWAL_LIST_FILTERS = exports.PURCHASE_WITHDRAWAL_STATES = void 0;
24
24
  /**
25
25
  * - `requested` — submitted, the code minted, the order's dispatch locked
26
26
  * (`purchase-withdrawal-pending`) until an operator decides.
@@ -29,9 +29,12 @@ exports.PURCHASE_WITHDRAWAL_VERIFICATION_FAILED = exports.PURCHASE_WITHDRAWAL_GU
29
29
  * - `accepted` — an operator accepted it. The order's cancellation (before
30
30
  * fulfilment) or its return authorisation (after it) follows from here.
31
31
  * - `awaiting-goods` — after fulfilment, the goods are on their way back.
32
- * - `refund-pending` — money is owed back (an open refund obligation).
32
+ * - `refund-pending` — money is owed back (an open refund obligation). Moves
33
+ * to `completed` with the closure of its last open obligation, never while
34
+ * another one is open.
33
35
  * - `completed` — nothing is owed any more. Not final while money can still
34
- * arrive: a late capture moves it back to `refund-pending`.
36
+ * arrive: a late capture (a new payment approval the order's payment
37
+ * attempt refused to settle) moves it back to `refund-pending`.
35
38
  */
36
39
  exports.PURCHASE_WITHDRAWAL_STATES = [
37
40
  'requested',
@@ -88,6 +91,20 @@ exports.PURCHASE_WITHDRAWAL_INELIGIBLE_REASONS = [
88
91
  'line-unavailable',
89
92
  'nothing-to-withdraw',
90
93
  ];
94
+ /**
95
+ * Why accepting a withdrawal before fulfilment is refused
96
+ * `409 PURCHASE_WITHDRAWAL_FISCAL_IN_FLIGHT` (`data.cause`) — a factura is in
97
+ * flight on the order, so cancelling it now could leave a voucher on a
98
+ * withdrawn order:
99
+ *
100
+ * - `in-progress` — a factura issuance holds the order's fence right now.
101
+ * Retry once it ends.
102
+ * - `uncertain` — an earlier factura issuance was interrupted and its outcome
103
+ * at ARCA is not confirmed. Retryable only after support reconciles it.
104
+ * - `stranded` — a voucher ARCA authorised could not be recorded on the order.
105
+ * Retryable only after support records it.
106
+ */
107
+ exports.PURCHASE_WITHDRAWAL_FISCAL_IN_FLIGHT_CAUSES = ['in-progress', 'uncertain', 'stranded'];
91
108
  /** The longest decline or relay `note`, in characters after trimming. */
92
109
  exports.PURCHASE_WITHDRAWAL_NOTE_MAX = 500;
93
110
  /** The most lines one request may name. */
package/dist/order.d.ts CHANGED
@@ -1269,7 +1269,11 @@ declare global {
1269
1269
  * All four fields are absent on a non-cancelled order.
1270
1270
  */
1271
1271
  cancelledAt?: number;
1272
- /** Who cancelled: the customerId for a self-cancellation, the operator's userId for an operator cancellation. */
1272
+ /**
1273
+ * Who cancelled: the customerId for a self-cancellation, the operator's
1274
+ * userId for an operator cancellation and for a purchase-withdrawal one
1275
+ * (the operator who accepted it), `'system'` for the payment-hold expiry.
1276
+ */
1273
1277
  cancelledBy?: string;
1274
1278
  cancellationSource?: OrderCancellationSource;
1275
1279
  /**
@@ -1380,8 +1384,14 @@ declare global {
1380
1384
  * (`services/orderSystemCancellation.ts`, run by the payment-attempt sweep),
1381
1385
  * which cancels an order whose online payment attempt lapsed unpaid; its
1382
1386
  * `cancelledBy` is `'system'`, never a user id.
1387
+ *
1388
+ * `purchase-withdrawal` is written only by the purchase-withdrawal door
1389
+ * (`lambdas/orders/_purchaseWithdrawalCancel.ts`): the order cancelled
1390
+ * because an operator accepted the shopper's purchase withdrawal before
1391
+ * fulfilment. Its `cancelledBy` is the accepting operator's userId (the
1392
+ * commit is the operator's act), and it carries no `cancellationReason`.
1383
1393
  */
1384
- type OrderCancellationSource = 'customer' | 'operator' | 'system';
1394
+ type OrderCancellationSource = 'customer' | 'operator' | 'system' | 'purchase-withdrawal';
1385
1395
  /**
1386
1396
  * Machine-readable reason an order is locked against a mutation — the
1387
1397
  * 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
@@ -26,9 +26,12 @@
26
26
  * - `accepted` — an operator accepted it. The order's cancellation (before
27
27
  * fulfilment) or its return authorisation (after it) follows from here.
28
28
  * - `awaiting-goods` — after fulfilment, the goods are on their way back.
29
- * - `refund-pending` — money is owed back (an open refund obligation).
29
+ * - `refund-pending` — money is owed back (an open refund obligation). Moves
30
+ * to `completed` with the closure of its last open obligation, never while
31
+ * another one is open.
30
32
  * - `completed` — nothing is owed any more. Not final while money can still
31
- * arrive: a late capture moves it back to `refund-pending`.
33
+ * arrive: a late capture (a new payment approval the order's payment
34
+ * attempt refused to settle) moves it back to `refund-pending`.
32
35
  */
33
36
  export declare const PURCHASE_WITHDRAWAL_STATES: readonly ["requested", "declined", "accepted", "awaiting-goods", "refund-pending", "completed"];
34
37
  /**
@@ -63,6 +66,20 @@ export declare const PURCHASE_WITHDRAWAL_ACTION_MODES: readonly ["accept", "decl
63
66
  * - `nothing-to-withdraw` — every line is already withdrawn or returned.
64
67
  */
65
68
  export declare const PURCHASE_WITHDRAWAL_INELIGIBLE_REASONS: readonly ["order-cancelled", "no-customer", "partial-before-fulfilment", "line-not-on-order", "line-unavailable", "nothing-to-withdraw"];
69
+ /**
70
+ * Why accepting a withdrawal before fulfilment is refused
71
+ * `409 PURCHASE_WITHDRAWAL_FISCAL_IN_FLIGHT` (`data.cause`) — a factura is in
72
+ * flight on the order, so cancelling it now could leave a voucher on a
73
+ * withdrawn order:
74
+ *
75
+ * - `in-progress` — a factura issuance holds the order's fence right now.
76
+ * Retry once it ends.
77
+ * - `uncertain` — an earlier factura issuance was interrupted and its outcome
78
+ * at ARCA is not confirmed. Retryable only after support reconciles it.
79
+ * - `stranded` — a voucher ARCA authorised could not be recorded on the order.
80
+ * Retryable only after support records it.
81
+ */
82
+ export declare const PURCHASE_WITHDRAWAL_FISCAL_IN_FLIGHT_CAUSES: readonly ["in-progress", "uncertain", "stranded"];
66
83
  /** The longest decline or relay `note`, in characters after trimming. */
67
84
  export declare const PURCHASE_WITHDRAWAL_NOTE_MAX = 500;
68
85
  /** The most lines one request may name. */
@@ -97,6 +114,7 @@ declare global {
97
114
  type PurchaseWithdrawalActionMode = (typeof PURCHASE_WITHDRAWAL_ACTION_MODES)[number];
98
115
  type PurchaseWithdrawalIneligibleReason = (typeof PURCHASE_WITHDRAWAL_INELIGIBLE_REASONS)[number];
99
116
  type PurchaseWithdrawalGuestIntent = (typeof PURCHASE_WITHDRAWAL_GUEST_INTENTS)[number];
117
+ type PurchaseWithdrawalFiscalInFlightCause = (typeof PURCHASE_WITHDRAWAL_FISCAL_IN_FLIGHT_CAUSES)[number];
100
118
  /** One withdrawn order line, by its index in `Order.items`. */
101
119
  interface PurchaseWithdrawalLine {
102
120
  orderItemIndex: number;
@@ -386,6 +404,13 @@ declare global {
386
404
  decision?: PurchaseWithdrawalDecision;
387
405
  declineReason?: PurchaseWithdrawalDeclineReason;
388
406
  }
407
+ /**
408
+ * `data` of `409 PURCHASE_WITHDRAWAL_FISCAL_IN_FLIGHT`: why the order's
409
+ * cancellation must wait on its fiscal state. Nothing was written.
410
+ */
411
+ interface PurchaseWithdrawalFiscalInFlightData {
412
+ cause: PurchaseWithdrawalFiscalInFlightCause;
413
+ }
389
414
  /** `data` of `409 PURCHASE_WITHDRAWAL_CHANGED`: the withdrawal as it now stands — review it and resend. */
390
415
  interface PurchaseWithdrawalChangedData {
391
416
  purchaseWithdrawal: PurchaseWithdrawal;
@@ -26,9 +26,12 @@
26
26
  * - `accepted` — an operator accepted it. The order's cancellation (before
27
27
  * fulfilment) or its return authorisation (after it) follows from here.
28
28
  * - `awaiting-goods` — after fulfilment, the goods are on their way back.
29
- * - `refund-pending` — money is owed back (an open refund obligation).
29
+ * - `refund-pending` — money is owed back (an open refund obligation). Moves
30
+ * to `completed` with the closure of its last open obligation, never while
31
+ * another one is open.
30
32
  * - `completed` — nothing is owed any more. Not final while money can still
31
- * arrive: a late capture moves it back to `refund-pending`.
33
+ * arrive: a late capture (a new payment approval the order's payment
34
+ * attempt refused to settle) moves it back to `refund-pending`.
32
35
  */
33
36
  export const PURCHASE_WITHDRAWAL_STATES = [
34
37
  'requested',
@@ -85,6 +88,20 @@ export const PURCHASE_WITHDRAWAL_INELIGIBLE_REASONS = [
85
88
  'line-unavailable',
86
89
  'nothing-to-withdraw',
87
90
  ];
91
+ /**
92
+ * Why accepting a withdrawal before fulfilment is refused
93
+ * `409 PURCHASE_WITHDRAWAL_FISCAL_IN_FLIGHT` (`data.cause`) — a factura is in
94
+ * flight on the order, so cancelling it now could leave a voucher on a
95
+ * withdrawn order:
96
+ *
97
+ * - `in-progress` — a factura issuance holds the order's fence right now.
98
+ * Retry once it ends.
99
+ * - `uncertain` — an earlier factura issuance was interrupted and its outcome
100
+ * at ARCA is not confirmed. Retryable only after support reconciles it.
101
+ * - `stranded` — a voucher ARCA authorised could not be recorded on the order.
102
+ * Retryable only after support records it.
103
+ */
104
+ export const PURCHASE_WITHDRAWAL_FISCAL_IN_FLIGHT_CAUSES = ['in-progress', 'uncertain', 'stranded'];
88
105
  /** The longest decline or relay `note`, in characters after trimming. */
89
106
  export const PURCHASE_WITHDRAWAL_NOTE_MAX = 500;
90
107
  /** The most lines one request may name. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "platform-types",
3
- "version": "1.10.818",
3
+ "version": "1.10.820",
4
4
  "description": "Shared wire and entity contracts for the platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",