sinfactura-types 1.10.417 → 1.10.418
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/order.js +4 -0
- package/dist/customer.d.ts +52 -0
- package/dist/order.d.ts +4 -1
- package/dist/order.js +4 -0
- package/package.json +1 -1
package/dist/cjs/order.js
CHANGED
|
@@ -121,6 +121,9 @@ exports.isTerminalOrderFulfilmentStatus = isTerminalOrderFulfilmentStatus;
|
|
|
121
121
|
* client that is retrying the wrong transition.
|
|
122
122
|
* - `ORDER_ILLEGAL_TRANSITION` · 409 · `ORDER_VERSION_CONFLICT` · 409
|
|
123
123
|
* - `CUSTOMER_NOT_FOUND` · 404 · `ORDER_HAS_NO_CUSTOMER` · 409
|
|
124
|
+
* - `CUSTOMER_MERGED` · 409 — the order's customer was folded into another, so
|
|
125
|
+
* its balance can no longer move; `data.mergedInto` names the survivor
|
|
126
|
+
* (`CustomerMergedRefusalData`). Nothing was written.
|
|
124
127
|
* - `FX_CONVERSION_UNAVAILABLE` · 503 — no rate for the order's currency pair.
|
|
125
128
|
* - `ROLE_FORBIDDEN` · 403
|
|
126
129
|
*
|
|
@@ -148,6 +151,7 @@ exports.ORDER_ERROR_CODES = [
|
|
|
148
151
|
'ORDER_ILLEGAL_TRANSITION',
|
|
149
152
|
'ORDER_VERSION_CONFLICT',
|
|
150
153
|
'CUSTOMER_NOT_FOUND',
|
|
154
|
+
'CUSTOMER_MERGED',
|
|
151
155
|
'ORDER_HAS_NO_CUSTOMER',
|
|
152
156
|
'FX_CONVERSION_UNAVAILABLE',
|
|
153
157
|
'ROLE_FORBIDDEN',
|
package/dist/customer.d.ts
CHANGED
|
@@ -572,6 +572,58 @@ declare global {
|
|
|
572
572
|
* Nothing was written.
|
|
573
573
|
*/
|
|
574
574
|
| 'CUSTOMER_MERGE_SOURCE_HAS_PENDING_MERGE';
|
|
575
|
+
/**
|
|
576
|
+
* The refusal every operator write that MOVES `Customer.balance` answers when
|
|
577
|
+
* the customer it names was folded into another by a merge (the row carries
|
|
578
|
+
* `mergedInto`): `409`, nothing written, `data` is
|
|
579
|
+
* {@link CustomerMergedRefusalData}. Re-issue the movement against
|
|
580
|
+
* `data.mergedInto`, the survivor, which now holds the balance.
|
|
581
|
+
*
|
|
582
|
+
* Answered by `POST /account` (a movement), `DELETE /account`, `POST` and
|
|
583
|
+
* `DELETE /payments/{source}/{paymentId}/link` (link with credit, unlink),
|
|
584
|
+
* and `POST /orders` (create, `mode: 'delivery'`, `mode: 'return'`).
|
|
585
|
+
*
|
|
586
|
+
* HOW it is decided differs by writer, and only the first kind covers a merge
|
|
587
|
+
* that lands after the handler's read:
|
|
588
|
+
* - by the write's own condition — every balance Update, and on order CREATE
|
|
589
|
+
* the CUSTOMER `lastBuy` item of the checkout transaction (the create also
|
|
590
|
+
* refuses early, on a consistent read, before it allocates an order id);
|
|
591
|
+
* - by a PRE-WRITE read — the unlink's owner-mismatch refusals (merge in
|
|
592
|
+
* progress, a third owner, an erased merged row, an unacknowledged
|
|
593
|
+
* `customer-merged` refund flag), decided off the credit row's owner before
|
|
594
|
+
* any write; the ACCOUNT delete then pins that owner, so a later re-point
|
|
595
|
+
* answers `LINK_LOCKED` / `concurrent-account-mutation` rather than this code.
|
|
596
|
+
*
|
|
597
|
+
* An unlink of a payment linked BEFORE a finished merge is not refused — it
|
|
598
|
+
* reverses on the survivor, whose ledger row it now is.
|
|
599
|
+
*/
|
|
600
|
+
type CustomerBalanceWriteErrorCode = 'CUSTOMER_MERGED'
|
|
601
|
+
/**
|
|
602
|
+
* `DELETE /payments/{source}/{paymentId}/link` only: the credit row is a
|
|
603
|
+
* LEGACY row naming no customer, and the payment's customer was erased —
|
|
604
|
+
* so whether it had been merged first (and where its money went) is no
|
|
605
|
+
* longer provable. `409`, nothing written; `data` is absent.
|
|
606
|
+
*/
|
|
607
|
+
| 'CUSTOMER_ANONYMIZED';
|
|
608
|
+
/**
|
|
609
|
+
* `data` on a `409 CUSTOMER_MERGED`.
|
|
610
|
+
*
|
|
611
|
+
* What to do depends on how the refused write addressed its customer: a
|
|
612
|
+
* write addressed BY CUSTOMER (`POST /account`) is re-issued against
|
|
613
|
+
* `mergedInto`; one addressed by an order, a ledger row or a payment cannot
|
|
614
|
+
* be re-targeted, and needs the merge to finish (`mergeState`) or a
|
|
615
|
+
* compensating movement.
|
|
616
|
+
*/
|
|
617
|
+
interface CustomerMergedRefusalData {
|
|
618
|
+
/** The survivor — the customer the money belongs on now. */
|
|
619
|
+
mergedInto: string;
|
|
620
|
+
/**
|
|
621
|
+
* The merge as the merged row stands. ABSENT when an erasure has since
|
|
622
|
+
* removed the markers and `mergedInto` was recovered from the ledger row
|
|
623
|
+
* the merge re-pointed.
|
|
624
|
+
*/
|
|
625
|
+
mergeState?: 'in-progress' | 'done';
|
|
626
|
+
}
|
|
575
627
|
/**
|
|
576
628
|
* The outcome of one `POST /customers { mode: 'merge' }` run.
|
|
577
629
|
*
|
package/dist/order.d.ts
CHANGED
|
@@ -1524,6 +1524,9 @@ export declare const isTerminalOrderFulfilmentStatus: (status: OrderFulfilmentSt
|
|
|
1524
1524
|
* client that is retrying the wrong transition.
|
|
1525
1525
|
* - `ORDER_ILLEGAL_TRANSITION` · 409 · `ORDER_VERSION_CONFLICT` · 409
|
|
1526
1526
|
* - `CUSTOMER_NOT_FOUND` · 404 · `ORDER_HAS_NO_CUSTOMER` · 409
|
|
1527
|
+
* - `CUSTOMER_MERGED` · 409 — the order's customer was folded into another, so
|
|
1528
|
+
* its balance can no longer move; `data.mergedInto` names the survivor
|
|
1529
|
+
* (`CustomerMergedRefusalData`). Nothing was written.
|
|
1527
1530
|
* - `FX_CONVERSION_UNAVAILABLE` · 503 — no rate for the order's currency pair.
|
|
1528
1531
|
* - `ROLE_FORBIDDEN` · 403
|
|
1529
1532
|
*
|
|
@@ -1542,6 +1545,6 @@ export declare const isTerminalOrderFulfilmentStatus: (status: OrderFulfilmentSt
|
|
|
1542
1545
|
* `SUBSCRIPTION_READONLY`) sit on the order CREATE leg only: an edit is not a new
|
|
1543
1546
|
* order, so `bareOrderPostHandler` routes past `requireMetered` entirely.
|
|
1544
1547
|
*/
|
|
1545
|
-
export declare const ORDER_ERROR_CODES: readonly ["ORDER_NOT_FOUND", "ORDER_LOCKED", "ORDER_NOT_READY", "ORDER_DELIVERED_ANOTHER_DAY", "ORDER_DELIVERY_STATE_UNCHANGED", "ORDER_ILLEGAL_TRANSITION", "ORDER_VERSION_CONFLICT", "CUSTOMER_NOT_FOUND", "ORDER_HAS_NO_CUSTOMER", "FX_CONVERSION_UNAVAILABLE", "ROLE_FORBIDDEN", "INVALID_IDEMPOTENCY_KEY", "IDEMPOTENCY_KEY_REUSE", "IDEMPOTENCY_IN_PROGRESS", "IDEMPOTENCY_LOCK_CONTENTION", "IDEMPOTENCY_KEY_FAILED", "IDEMPOTENT_RESPONSE_NOT_CACHED"];
|
|
1548
|
+
export declare const ORDER_ERROR_CODES: readonly ["ORDER_NOT_FOUND", "ORDER_LOCKED", "ORDER_NOT_READY", "ORDER_DELIVERED_ANOTHER_DAY", "ORDER_DELIVERY_STATE_UNCHANGED", "ORDER_ILLEGAL_TRANSITION", "ORDER_VERSION_CONFLICT", "CUSTOMER_NOT_FOUND", "CUSTOMER_MERGED", "ORDER_HAS_NO_CUSTOMER", "FX_CONVERSION_UNAVAILABLE", "ROLE_FORBIDDEN", "INVALID_IDEMPOTENCY_KEY", "IDEMPOTENCY_KEY_REUSE", "IDEMPOTENCY_IN_PROGRESS", "IDEMPOTENCY_LOCK_CONTENTION", "IDEMPOTENCY_KEY_FAILED", "IDEMPOTENT_RESPONSE_NOT_CACHED"];
|
|
1546
1549
|
export type OrderErrorCode = (typeof ORDER_ERROR_CODES)[number];
|
|
1547
1550
|
export {};
|
package/dist/order.js
CHANGED
|
@@ -115,6 +115,9 @@ export const isTerminalOrderFulfilmentStatus = (status) => ORDER_FULFILMENT_TRAN
|
|
|
115
115
|
* client that is retrying the wrong transition.
|
|
116
116
|
* - `ORDER_ILLEGAL_TRANSITION` · 409 · `ORDER_VERSION_CONFLICT` · 409
|
|
117
117
|
* - `CUSTOMER_NOT_FOUND` · 404 · `ORDER_HAS_NO_CUSTOMER` · 409
|
|
118
|
+
* - `CUSTOMER_MERGED` · 409 — the order's customer was folded into another, so
|
|
119
|
+
* its balance can no longer move; `data.mergedInto` names the survivor
|
|
120
|
+
* (`CustomerMergedRefusalData`). Nothing was written.
|
|
118
121
|
* - `FX_CONVERSION_UNAVAILABLE` · 503 — no rate for the order's currency pair.
|
|
119
122
|
* - `ROLE_FORBIDDEN` · 403
|
|
120
123
|
*
|
|
@@ -142,6 +145,7 @@ export const ORDER_ERROR_CODES = [
|
|
|
142
145
|
'ORDER_ILLEGAL_TRANSITION',
|
|
143
146
|
'ORDER_VERSION_CONFLICT',
|
|
144
147
|
'CUSTOMER_NOT_FOUND',
|
|
148
|
+
'CUSTOMER_MERGED',
|
|
145
149
|
'ORDER_HAS_NO_CUSTOMER',
|
|
146
150
|
'FX_CONVERSION_UNAVAILABLE',
|
|
147
151
|
'ROLE_FORBIDDEN',
|