platform-types 1.10.819 → 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.
@@ -91,6 +91,20 @@ exports.PURCHASE_WITHDRAWAL_INELIGIBLE_REASONS = [
91
91
  'line-unavailable',
92
92
  'nothing-to-withdraw',
93
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'];
94
108
  /** The longest decline or relay `note`, in characters after trimming. */
95
109
  exports.PURCHASE_WITHDRAWAL_NOTE_MAX = 500;
96
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
@@ -66,6 +66,20 @@ export declare const PURCHASE_WITHDRAWAL_ACTION_MODES: readonly ["accept", "decl
66
66
  * - `nothing-to-withdraw` — every line is already withdrawn or returned.
67
67
  */
68
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"];
69
83
  /** The longest decline or relay `note`, in characters after trimming. */
70
84
  export declare const PURCHASE_WITHDRAWAL_NOTE_MAX = 500;
71
85
  /** The most lines one request may name. */
@@ -100,6 +114,7 @@ declare global {
100
114
  type PurchaseWithdrawalActionMode = (typeof PURCHASE_WITHDRAWAL_ACTION_MODES)[number];
101
115
  type PurchaseWithdrawalIneligibleReason = (typeof PURCHASE_WITHDRAWAL_INELIGIBLE_REASONS)[number];
102
116
  type PurchaseWithdrawalGuestIntent = (typeof PURCHASE_WITHDRAWAL_GUEST_INTENTS)[number];
117
+ type PurchaseWithdrawalFiscalInFlightCause = (typeof PURCHASE_WITHDRAWAL_FISCAL_IN_FLIGHT_CAUSES)[number];
103
118
  /** One withdrawn order line, by its index in `Order.items`. */
104
119
  interface PurchaseWithdrawalLine {
105
120
  orderItemIndex: number;
@@ -389,6 +404,13 @@ declare global {
389
404
  decision?: PurchaseWithdrawalDecision;
390
405
  declineReason?: PurchaseWithdrawalDeclineReason;
391
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
+ }
392
414
  /** `data` of `409 PURCHASE_WITHDRAWAL_CHANGED`: the withdrawal as it now stands — review it and resend. */
393
415
  interface PurchaseWithdrawalChangedData {
394
416
  purchaseWithdrawal: PurchaseWithdrawal;
@@ -88,6 +88,20 @@ export const PURCHASE_WITHDRAWAL_INELIGIBLE_REASONS = [
88
88
  'line-unavailable',
89
89
  'nothing-to-withdraw',
90
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'];
91
105
  /** The longest decline or relay `note`, in characters after trimming. */
92
106
  export const PURCHASE_WITHDRAWAL_NOTE_MAX = 500;
93
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.819",
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",