platform-types 1.10.779 → 1.10.780
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 +13 -1
- package/dist/order.d.ts +36 -8
- package/dist/order.js +13 -1
- package/dist/store.d.ts +32 -0
- package/package.json +1 -1
package/dist/cjs/order.js
CHANGED
|
@@ -109,7 +109,8 @@ const positiveUnits = (value) => (typeof value === 'number' && value > 0 ? value
|
|
|
109
109
|
* The ONE reader of the per-line fulfilment ledger (`OrderLine.fulfilledQuantity`).
|
|
110
110
|
*
|
|
111
111
|
* - A missing `fulfilledQuantity` counts as 0; lines with no or zero `quantity`
|
|
112
|
-
* are ignored on both sides of the ratio
|
|
112
|
+
* are ignored on both sides of the ratio, and so is a freight line
|
|
113
|
+
* (`lineKind: 'freight'` with no `productId`), which is never shipped.
|
|
113
114
|
* - `deliveredAt > 0` with no `shipments` is `complete` — a whole-order delivery
|
|
114
115
|
* that never went through the shipment ledger.
|
|
115
116
|
* - A `disabled` or cancelled row is `none`, whatever timestamps it carries: a
|
|
@@ -120,6 +121,12 @@ const orderFulfilmentProgress = (order) => {
|
|
|
120
121
|
let orderedUnits = 0;
|
|
121
122
|
let fulfilledUnits = 0;
|
|
122
123
|
for (const line of order.items ?? []) {
|
|
124
|
+
// A freight line is a charge, never handed over, so it would hold a
|
|
125
|
+
// fully shipped order at `partial` forever. The same test as
|
|
126
|
+
// `isFreightLine` (`stacks/helpers/discountCalculations.ts`), inlined
|
|
127
|
+
// because contracts import nothing from `stacks/`.
|
|
128
|
+
if (line?.lineKind === 'freight' && line.productId === undefined)
|
|
129
|
+
continue;
|
|
123
130
|
const ordered = positiveUnits(line?.quantity);
|
|
124
131
|
if (ordered === 0)
|
|
125
132
|
continue;
|
|
@@ -279,6 +286,9 @@ exports.orderFulfilmentProgress = orderFulfilmentProgress;
|
|
|
279
286
|
* is refused after it, like every other refusal at commit.
|
|
280
287
|
* - `ORDER_HAS_KIT_LINES` · 409 — `mode: 'edit'` on an order holding a kit line
|
|
281
288
|
* (`CartLine.kit`). Cancel or return the order instead. Nothing was written.
|
|
289
|
+
* - `ORDER_HAS_FREIGHT_LINE` · 409 — `mode: 'edit'` on an order holding a
|
|
290
|
+
* freight line (`OrderLine.lineKind: 'freight'`). Cancel or return the order
|
|
291
|
+
* instead. Nothing was written.
|
|
282
292
|
* - `CART_PROMOTION_UNAVAILABLE` · 409 — the insert leg converting a STORED
|
|
283
293
|
* ticket whose promotion ended, was paused, deleted, has not started or is
|
|
284
294
|
* no longer cart-applicable; the `PromotionRefusal` rides `data.reason`. No
|
|
@@ -611,6 +621,8 @@ exports.ORDER_ERROR_CODES = [
|
|
|
611
621
|
'CART_PROMOTION_UNAVAILABLE',
|
|
612
622
|
// `mode: 'edit'` on an order holding a kit line; cancel or return it instead.
|
|
613
623
|
'ORDER_HAS_KIT_LINES',
|
|
624
|
+
// `mode: 'edit'` on an order holding a freight line; cancel or return it instead.
|
|
625
|
+
'ORDER_HAS_FREIGHT_LINE',
|
|
614
626
|
// Create-leg refusals about the sale's source, already answered on the wire.
|
|
615
627
|
'ORDER_TARGET_REQUIRED',
|
|
616
628
|
'ORDER_SOURCE_CONFLICT',
|
package/dist/order.d.ts
CHANGED
|
@@ -250,6 +250,25 @@ declare global {
|
|
|
250
250
|
productIds: string[];
|
|
251
251
|
}
|
|
252
252
|
interface OrderLine extends CartLine {
|
|
253
|
+
/**
|
|
254
|
+
* What kind of line this is. Absent means a goods (or service) line, which is
|
|
255
|
+
* every line written before freight existed: forward-only, never backfilled.
|
|
256
|
+
*
|
|
257
|
+
* `'freight'`: a server-owned, productless delivery charge. It carries no
|
|
258
|
+
* `productId` — a line naming one is goods whatever this says
|
|
259
|
+
* (`isFreightLine`); the order discount never applies to it, it moves no
|
|
260
|
+
* stock and writes no `SALE#` row, and it is never returnable or shippable.
|
|
261
|
+
* A return never credits it: the freight stays with the store.
|
|
262
|
+
*
|
|
263
|
+
* Fiscally the voucher reads the line's OWN stored `ivaType`, stamped from
|
|
264
|
+
* the store's `integrations.afip.freight` when the line is written, so a
|
|
265
|
+
* later config change never re-rates it. Only its Concepto is read live off
|
|
266
|
+
* that config, on a factura; a credit note restates its factura's.
|
|
267
|
+
*
|
|
268
|
+
* ⚠️ **Server-owned.** No order writer accepts it from a client;
|
|
269
|
+
* `stripServerOwnedLineFields` drops a caller-sent value.
|
|
270
|
+
*/
|
|
271
|
+
lineKind?: 'freight';
|
|
253
272
|
/** Base unit frozen from the product at sale; absent means unknown, never inferred on historical lines. */
|
|
254
273
|
unit?: ProductUnit;
|
|
255
274
|
/** Server-owned denomination of finite cost; absent means unknown. */
|
|
@@ -908,12 +927,17 @@ declare global {
|
|
|
908
927
|
* deduction skips a service line rather than moving inventory a second
|
|
909
928
|
* time.
|
|
910
929
|
*
|
|
911
|
-
* `Order.discount`
|
|
912
|
-
*
|
|
913
|
-
*
|
|
914
|
-
*
|
|
915
|
-
*
|
|
916
|
-
*
|
|
930
|
+
* ⚠️ `Order.discount` DOES reach those lines. The ticket's own absolute
|
|
931
|
+
* `discount` is already spent in them, and `POST /orders` refuses an
|
|
932
|
+
* operator percentage on an order carrying this pointer; but a same-visit
|
|
933
|
+
* handover whose counter basket carries a discount stores
|
|
934
|
+
* `goodsDiscountPercent` (`_deliverOrder.ts`, `buildDeliveryOrderRow`): the
|
|
935
|
+
* basket's discount over the FULL gross, basket plus service lines. Every
|
|
936
|
+
* per-line site (`chargedLineTotal`, `buildInvoiceEconomics`) then cuts
|
|
937
|
+
* EVERY line by it, service lines included, so the order's total discount
|
|
938
|
+
* equals the basket's while being spread across the repair too. With no
|
|
939
|
+
* basket discount it is `0` and the service lines are billed exactly as
|
|
940
|
+
* minted. Only a freight line (`lineKind`) is ever exempt.
|
|
917
941
|
*/
|
|
918
942
|
serviceOrderId?: string;
|
|
919
943
|
/**
|
|
@@ -2542,7 +2566,8 @@ type OrderFulfilmentProgressInput = Pick<Partial<Order>, 'items' | 'shipments' |
|
|
|
2542
2566
|
* The ONE reader of the per-line fulfilment ledger (`OrderLine.fulfilledQuantity`).
|
|
2543
2567
|
*
|
|
2544
2568
|
* - A missing `fulfilledQuantity` counts as 0; lines with no or zero `quantity`
|
|
2545
|
-
* are ignored on both sides of the ratio
|
|
2569
|
+
* are ignored on both sides of the ratio, and so is a freight line
|
|
2570
|
+
* (`lineKind: 'freight'` with no `productId`), which is never shipped.
|
|
2546
2571
|
* - `deliveredAt > 0` with no `shipments` is `complete` — a whole-order delivery
|
|
2547
2572
|
* that never went through the shipment ledger.
|
|
2548
2573
|
* - A `disabled` or cancelled row is `none`, whatever timestamps it carries: a
|
|
@@ -2692,6 +2717,9 @@ export declare const orderFulfilmentProgress: (order: OrderFulfilmentProgressInp
|
|
|
2692
2717
|
* is refused after it, like every other refusal at commit.
|
|
2693
2718
|
* - `ORDER_HAS_KIT_LINES` · 409 — `mode: 'edit'` on an order holding a kit line
|
|
2694
2719
|
* (`CartLine.kit`). Cancel or return the order instead. Nothing was written.
|
|
2720
|
+
* - `ORDER_HAS_FREIGHT_LINE` · 409 — `mode: 'edit'` on an order holding a
|
|
2721
|
+
* freight line (`OrderLine.lineKind: 'freight'`). Cancel or return the order
|
|
2722
|
+
* instead. Nothing was written.
|
|
2695
2723
|
* - `CART_PROMOTION_UNAVAILABLE` · 409 — the insert leg converting a STORED
|
|
2696
2724
|
* ticket whose promotion ended, was paused, deleted, has not started or is
|
|
2697
2725
|
* no longer cart-applicable; the `PromotionRefusal` rides `data.reason`. No
|
|
@@ -2942,6 +2970,6 @@ export declare const orderFulfilmentProgress: (order: OrderFulfilmentProgressInp
|
|
|
2942
2970
|
* `SUBSCRIPTION_READONLY`) sit on the order CREATE leg only: an edit is not a new
|
|
2943
2971
|
* order, so `bareOrderPostHandler` routes past `requireMetered` entirely.
|
|
2944
2972
|
*/
|
|
2945
|
-
export declare const ORDER_ERROR_CODES: readonly ["ORDER_COST_DENOMINATION_UNKNOWN", "SERVICE_ORDER_DELIVERY_MANAGED", "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", "CUSTOMER_ANONYMIZED", "FX_CONVERSION_UNAVAILABLE", "ROLE_FORBIDDEN", "ORDER_CANCELLED", "PAYMENT_SETTLED_ON_ANOTHER_ORDER", "ORDER_HAS_SHIPMENTS", "ORDER_HAS_RETURNS", "SHIPMENT_QUANTITY_EXCEEDED", "SHIPMENT_LINE_MISMATCH", "SHIPMENT_NOT_FOUND", "SHIPMENT_LIMIT_REACHED", "SHIPMENT_TOO_LARGE", "ORDER_FULFILMENT_EXTERNAL", "SHIPMENT_FAILED", "ADMIN_REQUIRED", "IDEMPOTENCY_KEY_REQUIRED", "INVALID_IDEMPOTENCY_KEY", "IDEMPOTENCY_KEY_REUSE", "IDEMPOTENCY_IN_PROGRESS", "IDEMPOTENCY_LOCK_CONTENTION", "IDEMPOTENCY_KEY_FAILED", "IDEMPOTENT_RESPONSE_NOT_CACHED", "ORDER_CANCELLATION_NOT_PROTECTED", "ORDER_CANCELLATION_COMMITTED", "ORDER_CANCELLATION_LOCKED", "ORDER_CANCELLATION_TOO_LARGE", "ORDER_CANCELLATION_FAILED", "SALE_LEDGER_RETRACTION_REFUSED", "SALE_LEDGER_ROW_NOT_OWNED", "PRODUCT_NOT_FOUND", "PRODUCT_SALE_LIMIT_EXCEEDED", "PRODUCT_SALE_LIMIT_INVALID", "DEPOSIT_SOURCE_NOT_ALLOWED", "DEPOSIT_CURRENCY_MISMATCH", "DEPOSIT_EXCEEDS_TOTAL", "DEPOSIT_FREEZE_REQUIRES_INVOICE", "DEPOSIT_FREEZE_INVOICE_PENDING", "DEPOSIT_CHARACTERIZATION_CONFLICT", "DEPOSIT_FREEZE_INVOICE_NOT_QUALIFYING", "DEPOSIT_INVOICED_ORDER_MUST_FREEZE", "DEPOSIT_FROZEN_ORDER_MUST_FREEZE", "DEPOSIT_REFERENCE_IS_LINKED_PAYMENT", "DEPOSIT_DUPLICATE_REFERENCE", "TILL_TENDER_REQUIRES_DEPOSIT", "PAYMENT_REFERENCED_BY_DEPOSIT", "ORDER_HAS_UNREFUNDED_DEPOSIT", "ORDER_PRICE_FROZEN", "DEPOSIT_NOT_FOUND", "DEPOSIT_ALREADY_REFUNDED", "UNIT_QUANTITY_NOT_WHOLE", "UNIT_REVISION_STALE", "UNIT_QUANTITY_UNREPRESENTABLE", "KIT_RECIPE_CHANGED", "CART_PROMOTION_UNAVAILABLE", "ORDER_HAS_KIT_LINES", "ORDER_TARGET_REQUIRED", "ORDER_SOURCE_CONFLICT", "ORDER_CUSTOMER_REQUIRED", "BASKET_EMPTY", "BASKET_CHANGED_DURING_CHECKOUT", "CART_VERSION_CREATE_ONLY", "CART_VERSION_REQUIRES_CART_ID", "CART_REVISION_STALE", "CART_CUSTOMER_MISMATCH", "COUNTER_SALE_CREATE_ONLY", "SOLD_AT_CREATE_ONLY", "SOLD_AT_IN_FUTURE", "ORDER_TENDER_CREATE_ONLY", "CREDIT_OVERRIDE_CREATE_ONLY", "ON_ACCOUNT_CREATE_ONLY", "ON_ACCOUNT_WITH_TENDERS", "TENDERS_REQUIRE_COUNTER_SALE", "LINES_REQUIRE_COUNTER_SALE", "PRODUCT_COST_UNKNOWN", "PRICE_CHANGE_DISABLED", "LINE_DISCOUNT_EXCEEDS_MAX", "CUSTOMER_DISABLED", "SHIFT_NOT_AVAILABLE", "SOLD_AT_OUTSIDE_SHIFT", "ORDER_CURRENCY_NOT_SUBSCRIBED", "PAYMENT_METHODS_NOT_CONFIGURED", "PAYMENT_METHOD_NOT_FOUND", "PAYMENT_METHOD_UNAVAILABLE", "CART_PRICES_CHANGED", "ORDER_ID_COLLISION", "DELIVERY_METHOD_NOT_FOUND", "ORDER_BELOW_MINIMUM_PURCHASE", "ORDER_INVALID_CART", "CART_CHANGED_SINCE_CONFIRM", "EMAIL_VERIFICATION_REQUIRED", "ACCOUNT_DISABLED", "CUSTOMER_ACCESS_PENDING", "CUSTOMER_ACCESS_REJECTED", "CURRENCY_MISMATCH", "SHIFT_NOT_OPEN", "ORDER_DISCOUNT_AFTER_INVOICE", "ORDER_DISCOUNT_ON_SERVICE_ORDER", "ORDER_DISCOUNT_ON_MARKETPLACE_ORDER", "ORDER_INVOICE_METHOD_OUTSTANDING_FACTURA", "ORDER_SERVICE_PERIOD_AFTER_INVOICE", "ORDER_ATTEMPT_COMMITTED", "ORDER_ATTEMPT_ABANDONED", "ORDER_ATTEMPT_KEY_EXPIRED", "ORDER_ATTEMPT_KEY_SCOPE_MISMATCH", "ORDER_COMPLETION_ATTEMPT_COMMITTED", "ORDER_COMPLETION_ATTEMPT_ABANDONED"];
|
|
2973
|
+
export declare const ORDER_ERROR_CODES: readonly ["ORDER_COST_DENOMINATION_UNKNOWN", "SERVICE_ORDER_DELIVERY_MANAGED", "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", "CUSTOMER_ANONYMIZED", "FX_CONVERSION_UNAVAILABLE", "ROLE_FORBIDDEN", "ORDER_CANCELLED", "PAYMENT_SETTLED_ON_ANOTHER_ORDER", "ORDER_HAS_SHIPMENTS", "ORDER_HAS_RETURNS", "SHIPMENT_QUANTITY_EXCEEDED", "SHIPMENT_LINE_MISMATCH", "SHIPMENT_NOT_FOUND", "SHIPMENT_LIMIT_REACHED", "SHIPMENT_TOO_LARGE", "ORDER_FULFILMENT_EXTERNAL", "SHIPMENT_FAILED", "ADMIN_REQUIRED", "IDEMPOTENCY_KEY_REQUIRED", "INVALID_IDEMPOTENCY_KEY", "IDEMPOTENCY_KEY_REUSE", "IDEMPOTENCY_IN_PROGRESS", "IDEMPOTENCY_LOCK_CONTENTION", "IDEMPOTENCY_KEY_FAILED", "IDEMPOTENT_RESPONSE_NOT_CACHED", "ORDER_CANCELLATION_NOT_PROTECTED", "ORDER_CANCELLATION_COMMITTED", "ORDER_CANCELLATION_LOCKED", "ORDER_CANCELLATION_TOO_LARGE", "ORDER_CANCELLATION_FAILED", "SALE_LEDGER_RETRACTION_REFUSED", "SALE_LEDGER_ROW_NOT_OWNED", "PRODUCT_NOT_FOUND", "PRODUCT_SALE_LIMIT_EXCEEDED", "PRODUCT_SALE_LIMIT_INVALID", "DEPOSIT_SOURCE_NOT_ALLOWED", "DEPOSIT_CURRENCY_MISMATCH", "DEPOSIT_EXCEEDS_TOTAL", "DEPOSIT_FREEZE_REQUIRES_INVOICE", "DEPOSIT_FREEZE_INVOICE_PENDING", "DEPOSIT_CHARACTERIZATION_CONFLICT", "DEPOSIT_FREEZE_INVOICE_NOT_QUALIFYING", "DEPOSIT_INVOICED_ORDER_MUST_FREEZE", "DEPOSIT_FROZEN_ORDER_MUST_FREEZE", "DEPOSIT_REFERENCE_IS_LINKED_PAYMENT", "DEPOSIT_DUPLICATE_REFERENCE", "TILL_TENDER_REQUIRES_DEPOSIT", "PAYMENT_REFERENCED_BY_DEPOSIT", "ORDER_HAS_UNREFUNDED_DEPOSIT", "ORDER_PRICE_FROZEN", "DEPOSIT_NOT_FOUND", "DEPOSIT_ALREADY_REFUNDED", "UNIT_QUANTITY_NOT_WHOLE", "UNIT_REVISION_STALE", "UNIT_QUANTITY_UNREPRESENTABLE", "KIT_RECIPE_CHANGED", "CART_PROMOTION_UNAVAILABLE", "ORDER_HAS_KIT_LINES", "ORDER_HAS_FREIGHT_LINE", "ORDER_TARGET_REQUIRED", "ORDER_SOURCE_CONFLICT", "ORDER_CUSTOMER_REQUIRED", "BASKET_EMPTY", "BASKET_CHANGED_DURING_CHECKOUT", "CART_VERSION_CREATE_ONLY", "CART_VERSION_REQUIRES_CART_ID", "CART_REVISION_STALE", "CART_CUSTOMER_MISMATCH", "COUNTER_SALE_CREATE_ONLY", "SOLD_AT_CREATE_ONLY", "SOLD_AT_IN_FUTURE", "ORDER_TENDER_CREATE_ONLY", "CREDIT_OVERRIDE_CREATE_ONLY", "ON_ACCOUNT_CREATE_ONLY", "ON_ACCOUNT_WITH_TENDERS", "TENDERS_REQUIRE_COUNTER_SALE", "LINES_REQUIRE_COUNTER_SALE", "PRODUCT_COST_UNKNOWN", "PRICE_CHANGE_DISABLED", "LINE_DISCOUNT_EXCEEDS_MAX", "CUSTOMER_DISABLED", "SHIFT_NOT_AVAILABLE", "SOLD_AT_OUTSIDE_SHIFT", "ORDER_CURRENCY_NOT_SUBSCRIBED", "PAYMENT_METHODS_NOT_CONFIGURED", "PAYMENT_METHOD_NOT_FOUND", "PAYMENT_METHOD_UNAVAILABLE", "CART_PRICES_CHANGED", "ORDER_ID_COLLISION", "DELIVERY_METHOD_NOT_FOUND", "ORDER_BELOW_MINIMUM_PURCHASE", "ORDER_INVALID_CART", "CART_CHANGED_SINCE_CONFIRM", "EMAIL_VERIFICATION_REQUIRED", "ACCOUNT_DISABLED", "CUSTOMER_ACCESS_PENDING", "CUSTOMER_ACCESS_REJECTED", "CURRENCY_MISMATCH", "SHIFT_NOT_OPEN", "ORDER_DISCOUNT_AFTER_INVOICE", "ORDER_DISCOUNT_ON_SERVICE_ORDER", "ORDER_DISCOUNT_ON_MARKETPLACE_ORDER", "ORDER_INVOICE_METHOD_OUTSTANDING_FACTURA", "ORDER_SERVICE_PERIOD_AFTER_INVOICE", "ORDER_ATTEMPT_COMMITTED", "ORDER_ATTEMPT_ABANDONED", "ORDER_ATTEMPT_KEY_EXPIRED", "ORDER_ATTEMPT_KEY_SCOPE_MISMATCH", "ORDER_COMPLETION_ATTEMPT_COMMITTED", "ORDER_COMPLETION_ATTEMPT_ABANDONED"];
|
|
2946
2974
|
export type OrderErrorCode = (typeof ORDER_ERROR_CODES)[number];
|
|
2947
2975
|
export {};
|
package/dist/order.js
CHANGED
|
@@ -103,7 +103,8 @@ const positiveUnits = (value) => (typeof value === 'number' && value > 0 ? value
|
|
|
103
103
|
* The ONE reader of the per-line fulfilment ledger (`OrderLine.fulfilledQuantity`).
|
|
104
104
|
*
|
|
105
105
|
* - A missing `fulfilledQuantity` counts as 0; lines with no or zero `quantity`
|
|
106
|
-
* are ignored on both sides of the ratio
|
|
106
|
+
* are ignored on both sides of the ratio, and so is a freight line
|
|
107
|
+
* (`lineKind: 'freight'` with no `productId`), which is never shipped.
|
|
107
108
|
* - `deliveredAt > 0` with no `shipments` is `complete` — a whole-order delivery
|
|
108
109
|
* that never went through the shipment ledger.
|
|
109
110
|
* - A `disabled` or cancelled row is `none`, whatever timestamps it carries: a
|
|
@@ -114,6 +115,12 @@ export const orderFulfilmentProgress = (order) => {
|
|
|
114
115
|
let orderedUnits = 0;
|
|
115
116
|
let fulfilledUnits = 0;
|
|
116
117
|
for (const line of order.items ?? []) {
|
|
118
|
+
// A freight line is a charge, never handed over, so it would hold a
|
|
119
|
+
// fully shipped order at `partial` forever. The same test as
|
|
120
|
+
// `isFreightLine` (`stacks/helpers/discountCalculations.ts`), inlined
|
|
121
|
+
// because contracts import nothing from `stacks/`.
|
|
122
|
+
if (line?.lineKind === 'freight' && line.productId === undefined)
|
|
123
|
+
continue;
|
|
117
124
|
const ordered = positiveUnits(line?.quantity);
|
|
118
125
|
if (ordered === 0)
|
|
119
126
|
continue;
|
|
@@ -272,6 +279,9 @@ export const orderFulfilmentProgress = (order) => {
|
|
|
272
279
|
* is refused after it, like every other refusal at commit.
|
|
273
280
|
* - `ORDER_HAS_KIT_LINES` · 409 — `mode: 'edit'` on an order holding a kit line
|
|
274
281
|
* (`CartLine.kit`). Cancel or return the order instead. Nothing was written.
|
|
282
|
+
* - `ORDER_HAS_FREIGHT_LINE` · 409 — `mode: 'edit'` on an order holding a
|
|
283
|
+
* freight line (`OrderLine.lineKind: 'freight'`). Cancel or return the order
|
|
284
|
+
* instead. Nothing was written.
|
|
275
285
|
* - `CART_PROMOTION_UNAVAILABLE` · 409 — the insert leg converting a STORED
|
|
276
286
|
* ticket whose promotion ended, was paused, deleted, has not started or is
|
|
277
287
|
* no longer cart-applicable; the `PromotionRefusal` rides `data.reason`. No
|
|
@@ -604,6 +614,8 @@ export const ORDER_ERROR_CODES = [
|
|
|
604
614
|
'CART_PROMOTION_UNAVAILABLE',
|
|
605
615
|
// `mode: 'edit'` on an order holding a kit line; cancel or return it instead.
|
|
606
616
|
'ORDER_HAS_KIT_LINES',
|
|
617
|
+
// `mode: 'edit'` on an order holding a freight line; cancel or return it instead.
|
|
618
|
+
'ORDER_HAS_FREIGHT_LINE',
|
|
607
619
|
// Create-leg refusals about the sale's source, already answered on the wire.
|
|
608
620
|
'ORDER_TARGET_REQUIRED',
|
|
609
621
|
'ORDER_SOURCE_CONFLICT',
|
package/dist/store.d.ts
CHANGED
|
@@ -1599,6 +1599,29 @@ declare global {
|
|
|
1599
1599
|
/** ISO date; stops applying on or after. Omitted => open-ended. */
|
|
1600
1600
|
expiresAt?: string;
|
|
1601
1601
|
}
|
|
1602
|
+
/**
|
|
1603
|
+
* An AFIP Iva Id — one of `IVA_TYPES` (`services/fiscalCatalogs.ts`): 3 (0 %),
|
|
1604
|
+
* 9 (2,5 %), 8 (5 %), 4 (10,5 %), 5 (21 %), 6 (27 %). `number`, like every
|
|
1605
|
+
* `ivaType` in this contract, so a line's stored rate and a configured one
|
|
1606
|
+
* compare without a cast; the catalog, not this type, is the authority.
|
|
1607
|
+
* ⚠️ Not every write path validates against it: `PATCH /store` does
|
|
1608
|
+
* (`afipPatchSchema`), but `POST /store` and `POST /tenants` take `afip`
|
|
1609
|
+
* unvalidated, so a reader falls back on an out-of-catalog value
|
|
1610
|
+
* (`resolveFreightFiscal`) rather than trusting the row.
|
|
1611
|
+
*/
|
|
1612
|
+
type IvaTypeId = number;
|
|
1613
|
+
/**
|
|
1614
|
+
* How the store's freight line (`OrderLine.lineKind: 'freight'`) is declared
|
|
1615
|
+
* to ARCA. Configuration the store's accountant decides, not a fact the code
|
|
1616
|
+
* can derive: whether delivery is a separate service or an accessory of the
|
|
1617
|
+
* sale, and at which rate, depends on how the store sells.
|
|
1618
|
+
*/
|
|
1619
|
+
interface AfipFreightFiscal {
|
|
1620
|
+
/** The alícuota stamped on the freight line, and so declared in `Iva[]`. */
|
|
1621
|
+
ivaType: IvaTypeId;
|
|
1622
|
+
/** Whether the freight line counts as goods or as a service for `Concepto`. */
|
|
1623
|
+
concepto: 'goods' | 'services';
|
|
1624
|
+
}
|
|
1602
1625
|
interface Afip {
|
|
1603
1626
|
production: boolean;
|
|
1604
1627
|
address?: string;
|
|
@@ -1669,6 +1692,14 @@ declare global {
|
|
|
1669
1692
|
fceEnabled?: boolean;
|
|
1670
1693
|
wscdcEnabled?: boolean;
|
|
1671
1694
|
fceReceivedCheckpoint?: number;
|
|
1695
|
+
/**
|
|
1696
|
+
* The freight line's IVA rate and Concepto. Absent means the platform
|
|
1697
|
+
* default, `ivaType` 5 (21 %) and `concepto` `'goods'`
|
|
1698
|
+
* (`DEFAULT_FREIGHT_FISCAL`); read it through `resolveFreightFiscal`, never
|
|
1699
|
+
* directly. ADMIN-tier on `PATCH /store` (`PRIVILEGED_AFIP_FIELDS`); `null`
|
|
1700
|
+
* clears it back to the default.
|
|
1701
|
+
*/
|
|
1702
|
+
freight?: AfipFreightFiscal;
|
|
1672
1703
|
}
|
|
1673
1704
|
/**
|
|
1674
1705
|
* Write shape for the `afip` key of `PATCH /store`'s body. The wire accepts an
|
|
@@ -1683,6 +1714,7 @@ declare global {
|
|
|
1683
1714
|
iibbTransparency?: Afip['iibbTransparency'] | null;
|
|
1684
1715
|
iibbJurisdictions?: IibbJurisdictionConfig[] | null;
|
|
1685
1716
|
actividades?: number[] | null;
|
|
1717
|
+
freight?: AfipFreightFiscal | null;
|
|
1686
1718
|
}
|
|
1687
1719
|
/**
|
|
1688
1720
|
* Write shape for the `config` key of `PATCH /store`'s body. Two things the
|