@sixtyninecommerce/admin 0.9.0 → 0.11.0
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/README.md +4598 -128
- package/dist/catalog/assets.d.ts +120 -8
- package/dist/catalog/assets.js +98 -12
- package/dist/catalog/collections.d.ts +279 -14
- package/dist/catalog/collections.js +246 -15
- package/dist/catalog/index.d.ts +9 -2
- package/dist/catalog/index.js +4 -0
- package/dist/catalog/products.d.ts +318 -17
- package/dist/catalog/products.js +182 -14
- package/dist/catalog/properties.d.ts +102 -14
- package/dist/catalog/properties.js +13 -0
- package/dist/catalog/recommendations.d.ts +261 -0
- package/dist/catalog/recommendations.js +145 -0
- package/dist/catalog/reviews.d.ts +368 -0
- package/dist/catalog/reviews.js +318 -0
- package/dist/catalog/types.d.ts +17 -1
- package/dist/catalog/types.js +10 -0
- package/dist/catalog/variant-find.d.ts +136 -0
- package/dist/catalog/variant-find.js +239 -0
- package/dist/catalog/variants.d.ts +282 -25
- package/dist/catalog/variants.js +173 -25
- package/dist/catalog/visibility.d.ts +20 -5
- package/dist/catalog/visibility.js +19 -1
- package/dist/client.d.ts +116 -9
- package/dist/client.js +41 -7
- package/dist/content/assets.d.ts +286 -0
- package/dist/content/assets.js +181 -0
- package/dist/content/items.d.ts +269 -0
- package/dist/content/items.js +170 -0
- package/dist/content/types.d.ts +282 -0
- package/dist/content/types.js +100 -0
- package/dist/customers/age-verification.d.ts +66 -0
- package/dist/customers/age-verification.js +79 -0
- package/dist/customers/credit.d.ts +263 -0
- package/dist/customers/credit.js +244 -0
- package/dist/customers/delivery-preferences.d.ts +120 -0
- package/dist/customers/delivery-preferences.js +97 -0
- package/dist/customers/groups.d.ts +207 -0
- package/dist/customers/groups.js +438 -0
- package/dist/customers/index.d.ts +447 -37
- package/dist/customers/index.js +313 -40
- package/dist/customers/invitation-status.d.ts +57 -0
- package/dist/customers/invitation-status.js +21 -0
- package/dist/customers/notes.d.ts +67 -0
- package/dist/customers/notes.js +51 -0
- package/dist/customers/notification-recipients.d.ts +97 -0
- package/dist/customers/notification-recipients.js +84 -0
- package/dist/customers/saved-lists.d.ts +42 -0
- package/dist/customers/saved-lists.js +61 -0
- package/dist/customers/vat.d.ts +83 -0
- package/dist/customers/vat.js +46 -0
- package/dist/customers/wire.d.ts +20 -0
- package/dist/customers/wire.js +35 -0
- package/dist/documents/ar.d.ts +307 -0
- package/dist/documents/ar.js +254 -0
- package/dist/documents/index.d.ts +731 -21
- package/dist/documents/index.js +436 -24
- package/dist/documents/pdf.d.ts +2 -0
- package/dist/documents/pdf.js +11 -0
- package/dist/fulfillments/create.d.ts +167 -0
- package/dist/fulfillments/create.js +216 -0
- package/dist/fulfillments/index.d.ts +121 -10
- package/dist/fulfillments/index.js +120 -2
- package/dist/fulfillments/payment-policy.d.ts +64 -0
- package/dist/fulfillments/payment-policy.js +140 -0
- package/dist/fulfillments/warehouse.d.ts +724 -0
- package/dist/fulfillments/warehouse.js +914 -0
- package/dist/geo/index.d.ts +119 -0
- package/dist/geo/index.js +107 -0
- package/dist/index.d.ts +129 -30
- package/dist/index.js +47 -9
- package/dist/integrations/afas-actions.d.ts +234 -0
- package/dist/integrations/afas-actions.js +310 -0
- package/dist/integrations/afas-types.d.ts +483 -0
- package/dist/integrations/afas-types.js +5 -0
- package/dist/integrations/afas.d.ts +234 -0
- package/dist/integrations/afas.js +290 -0
- package/dist/integrations/connections.d.ts +103 -0
- package/dist/integrations/connections.js +55 -0
- package/dist/integrations/esp.d.ts +313 -0
- package/dist/integrations/esp.js +169 -0
- package/dist/integrations/exact-online-types.d.ts +423 -0
- package/dist/integrations/exact-online-types.js +6 -0
- package/dist/integrations/exact-online.d.ts +248 -0
- package/dist/integrations/exact-online.js +376 -0
- package/dist/integrations/index.d.ts +40 -0
- package/dist/integrations/index.js +24 -0
- package/dist/integrations/pipeline-keys.d.ts +13 -0
- package/dist/integrations/pipeline-keys.js +22 -0
- package/dist/integrations/pipelines.d.ts +114 -0
- package/dist/integrations/pipelines.js +46 -0
- package/dist/integrations/types.d.ts +322 -0
- package/dist/integrations/types.js +8 -0
- package/dist/jobs/bulk-action-run.d.ts +11 -2
- package/dist/jobs/bulk-action-run.js +4 -5
- package/dist/locations/index.d.ts +66 -0
- package/dist/locations/index.js +31 -0
- package/dist/meta/index.d.ts +162 -0
- package/dist/orders/bulk.d.ts +75 -0
- package/dist/orders/bulk.js +150 -0
- package/dist/orders/cancel-with-money.d.ts +227 -0
- package/dist/orders/cancel-with-money.js +153 -0
- package/dist/orders/commit-edit.d.ts +7 -1
- package/dist/orders/commit-edit.js +5 -1
- package/dist/orders/deposit-policy.d.ts +103 -0
- package/dist/orders/deposit-policy.js +202 -0
- package/dist/orders/drafts.d.ts +800 -0
- package/dist/orders/drafts.js +771 -0
- package/dist/orders/fields.d.ts +245 -0
- package/dist/orders/fields.js +188 -0
- package/dist/orders/get.d.ts +29 -19
- package/dist/orders/get.js +17 -8
- package/dist/orders/index.d.ts +125 -5
- package/dist/orders/index.js +35 -2
- package/dist/orders/lifecycle.d.ts +128 -0
- package/dist/orders/lifecycle.js +158 -0
- package/dist/orders/line-price-preview.d.ts +7 -2
- package/dist/orders/list.d.ts +222 -0
- package/dist/orders/list.js +377 -0
- package/dist/orders/manual-discounts.d.ts +11 -2
- package/dist/orders/manual-discounts.js +2 -0
- package/dist/orders/manual-pricing.d.ts +5 -0
- package/dist/orders/order-entry.d.ts +20 -7
- package/dist/orders/plan-edit.d.ts +1 -1
- package/dist/orders/plan-edit.js +4 -1
- package/dist/orders/settings.d.ts +201 -0
- package/dist/orders/settings.js +325 -0
- package/dist/orders/status.d.ts +159 -13
- package/dist/orders/status.js +21 -0
- package/dist/orders/surcharges.d.ts +8 -1
- package/dist/orders/surcharges.js +3 -2
- package/dist/payments/account-credit.d.ts +30 -0
- package/dist/payments/account-credit.js +19 -0
- package/dist/payments/ar.d.ts +292 -0
- package/dist/payments/ar.js +223 -0
- package/dist/payments/connected-account.d.ts +47 -0
- package/dist/payments/connected-account.js +61 -0
- package/dist/payments/credit-noted-fields.d.ts +12 -0
- package/dist/payments/credit-noted-fields.js +37 -0
- package/dist/payments/index.d.ts +263 -10
- package/dist/payments/index.js +133 -1
- package/dist/payments/methods.d.ts +332 -0
- package/dist/payments/methods.js +363 -0
- package/dist/payments/mollie-methods.d.ts +159 -0
- package/dist/payments/mollie-methods.js +141 -0
- package/dist/payments/payment-links.d.ts +180 -0
- package/dist/payments/payment-links.js +97 -0
- package/dist/payments/provider-keys.d.ts +150 -0
- package/dist/payments/provider-keys.js +118 -0
- package/dist/payments/providers.d.ts +86 -11
- package/dist/payments/providers.js +29 -0
- package/dist/payments/requests.d.ts +144 -0
- package/dist/payments/requests.js +92 -0
- package/dist/payments/store-credit-fields.d.ts +15 -0
- package/dist/payments/store-credit-fields.js +51 -0
- package/dist/pickups/index.d.ts +104 -0
- package/dist/pickups/index.js +105 -0
- package/dist/platform/channels.d.ts +132 -0
- package/dist/platform/channels.js +128 -0
- package/dist/platform/geo.d.ts +123 -0
- package/dist/platform/geo.js +144 -0
- package/dist/platform/tax.d.ts +154 -0
- package/dist/platform/tax.js +139 -0
- package/dist/pos/anomalies.d.ts +158 -0
- package/dist/pos/anomalies.js +64 -0
- package/dist/pos/assisted-selling.d.ts +79 -0
- package/dist/pos/assisted-selling.js +38 -0
- package/dist/pos/exchanges.d.ts +103 -0
- package/dist/pos/exchanges.js +22 -0
- package/dist/pos/gift-cards.d.ts +135 -0
- package/dist/pos/gift-cards.js +47 -0
- package/dist/pos/index.d.ts +2125 -32
- package/dist/pos/index.js +742 -4
- package/dist/pos/no-receipt.d.ts +94 -0
- package/dist/pos/no-receipt.js +25 -0
- package/dist/pos/offline-sales.d.ts +187 -0
- package/dist/pos/offline-sales.js +116 -0
- package/dist/pos/pay-by-link.d.ts +143 -0
- package/dist/pos/pay-by-link.js +57 -0
- package/dist/pos/quick-keys.d.ts +103 -0
- package/dist/pos/quick-keys.js +45 -0
- package/dist/pos/reports.d.ts +360 -0
- package/dist/pos/reports.js +62 -0
- package/dist/pos/returns.d.ts +217 -0
- package/dist/pos/returns.js +53 -0
- package/dist/pricing/bulk-coupons.d.ts +139 -0
- package/dist/pricing/bulk-coupons.js +112 -0
- package/dist/pricing/index.d.ts +177 -4
- package/dist/pricing/index.js +176 -1
- package/dist/pricing/price-lists.d.ts +604 -0
- package/dist/pricing/price-lists.js +600 -0
- package/dist/pricing/vouchers.d.ts +103 -0
- package/dist/pricing/vouchers.js +69 -0
- package/dist/purchasing/alerts.d.ts +89 -0
- package/dist/purchasing/alerts.js +62 -0
- package/dist/purchasing/cost.d.ts +110 -0
- package/dist/purchasing/cost.js +86 -0
- package/dist/purchasing/index.d.ts +36 -0
- package/dist/purchasing/index.js +16 -0
- package/dist/purchasing/purchase-orders.d.ts +548 -0
- package/dist/purchasing/purchase-orders.js +491 -0
- package/dist/purchasing/replenishment.d.ts +281 -0
- package/dist/purchasing/replenishment.js +240 -0
- package/dist/purchasing/settings.d.ts +152 -0
- package/dist/purchasing/settings.js +181 -0
- package/dist/purchasing/suppliers.d.ts +476 -0
- package/dist/purchasing/suppliers.js +438 -0
- package/dist/quotes/index.d.ts +501 -0
- package/dist/quotes/index.js +439 -0
- package/dist/reports/index.d.ts +71 -8
- package/dist/reports/index.js +74 -11
- package/dist/returns/index.d.ts +818 -0
- package/dist/returns/index.js +844 -0
- package/dist/search/index.d.ts +174 -0
- package/dist/search/index.js +125 -0
- package/dist/shipping/definitions.d.ts +29 -0
- package/dist/shipping/definitions.js +47 -0
- package/dist/shipping/fulfillment-profiles.d.ts +174 -0
- package/dist/shipping/fulfillment-profiles.js +104 -0
- package/dist/shipping/hendriks.d.ts +97 -0
- package/dist/shipping/hendriks.js +50 -0
- package/dist/shipping/index.d.ts +48 -0
- package/dist/shipping/index.js +25 -0
- package/dist/shipping/methods.d.ts +198 -0
- package/dist/shipping/methods.js +240 -0
- package/dist/shipping/myparcel.d.ts +254 -0
- package/dist/shipping/myparcel.js +178 -0
- package/dist/shipping/parcel-count-suggestion.d.ts +2 -0
- package/dist/shipping/parcel-rule.d.ts +6 -5
- package/dist/shipping/parcel-rule.js +21 -23
- package/dist/shipping/rate-tables.d.ts +179 -0
- package/dist/shipping/rate-tables.js +184 -0
- package/dist/stock/index.d.ts +10 -3
- package/dist/stock/index.js +3 -0
- package/dist/stock/locations.d.ts +144 -0
- package/dist/stock/locations.js +168 -0
- package/dist/stock/transfers.d.ts +216 -43
- package/dist/stock/transfers.js +140 -13
- package/dist/stored-value/index.d.ts +214 -4
- package/dist/stored-value/index.js +152 -0
- package/dist/subscriptions/index.d.ts +682 -0
- package/dist/subscriptions/index.js +815 -0
- package/dist/tax/index.d.ts +76 -1
- package/dist/tax/index.js +50 -0
- package/dist/tenant/email-style.d.ts +102 -0
- package/dist/tenant/email-style.js +72 -0
- package/dist/tenant/email-templates.d.ts +66 -0
- package/dist/tenant/email-templates.js +54 -0
- package/dist/tenant/notifications.d.ts +23 -17
- package/dist/tenant/settings-sources.d.ts +1 -1
- package/dist/tenant/time-zone.d.ts +17 -0
- package/dist/tenant/time-zone.js +11 -0
- package/dist/types.d.ts +51 -4
- package/dist/users/index.d.ts +3 -0
- package/dist/users/index.js +2 -0
- package/dist/users/warehouses.d.ts +50 -0
- package/dist/users/warehouses.js +51 -0
- package/package.json +2 -2
|
@@ -0,0 +1,818 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `admin.returns`: the returns (RMA) plugin. The reads (one return, an order's
|
|
3
|
+
* returns, the list, the open count, what of an order can be returned) and the
|
|
4
|
+
* plan for settling one (headless W9-47); every non-money step of a return's life
|
|
5
|
+
* (create, approve, reject, cancel, record a receipt, add a note), the store's
|
|
6
|
+
* return policy and the RMA numbering (headless W10-27). Settling moves money and
|
|
7
|
+
* is its own keyed call (`settle`, headless W10-28). Money is in MINOR UNITS
|
|
8
|
+
* throughout, as everywhere in this SDK.
|
|
9
|
+
*
|
|
10
|
+
* Every value set below is the engine's own and grows over time, so each field
|
|
11
|
+
* that carries one also accepts a string this version does not name: treat an
|
|
12
|
+
* unknown value as "not available".
|
|
13
|
+
*/
|
|
14
|
+
import { type Transport } from '@sixtyninecommerce/core';
|
|
15
|
+
import type { Call } from '../types.js';
|
|
16
|
+
/** A return's state: the latest row of its status log. */
|
|
17
|
+
export declare const RETURN_STATES: readonly ["requested", "approved", "rejected", "cancelled", "items_received", "settlement_pending", "settlement_failed", "settled"];
|
|
18
|
+
export type ReturnState = (typeof RETURN_STATES)[number];
|
|
19
|
+
/**
|
|
20
|
+
* How a return is settled. `refund` gives money back to an original payment.
|
|
21
|
+
* `store_credit` issues a credit note: on a store with an accounts-receivable
|
|
22
|
+
* ledger it credits the customer's account, elsewhere it credits the order's
|
|
23
|
+
* invoice and moves no money. `account` puts the order's settled money on the
|
|
24
|
+
* customer's account as unapplied cash and makes no refund (an engine released
|
|
25
|
+
* before 2026-10-10 never answers it).
|
|
26
|
+
*/
|
|
27
|
+
export declare const RETURN_SETTLEMENT_METHODS: readonly ["refund", "store_credit", "account"];
|
|
28
|
+
export type ReturnSettlementMethod = (typeof RETURN_SETTLEMENT_METHODS)[number];
|
|
29
|
+
export interface OrderReturnLine {
|
|
30
|
+
id: string;
|
|
31
|
+
returnId: string;
|
|
32
|
+
orderLineId: string;
|
|
33
|
+
productVariantId: string;
|
|
34
|
+
productVariantName: string;
|
|
35
|
+
productVariantSku: string;
|
|
36
|
+
requestedQty: number;
|
|
37
|
+
/** Null until approval; 0 means the line was declined. */
|
|
38
|
+
approvedQty: number | null;
|
|
39
|
+
/** Units received back, across every receipt. */
|
|
40
|
+
receivedQty: number;
|
|
41
|
+
restockQty: number;
|
|
42
|
+
writeOffQty: number;
|
|
43
|
+
restockLocationId: string | null;
|
|
44
|
+
/** `damaged`, `defective`, `wrong_item`, `not_as_described`, `arrived_late`, `no_longer_needed`, `order_error`, `other`. */
|
|
45
|
+
reasonCode: string;
|
|
46
|
+
reasonNote: string | null;
|
|
47
|
+
/** The order line's prorated unit price incl. tax, rounded per unit. Display only. */
|
|
48
|
+
unitPriceWithTax: number;
|
|
49
|
+
/**
|
|
50
|
+
* The same price before per-unit rounding; null for returns requested before
|
|
51
|
+
* it was recorded. Multiply by a quantity and round ONCE to estimate a line.
|
|
52
|
+
*/
|
|
53
|
+
unitPriceWithTaxUnrounded: number | null;
|
|
54
|
+
/** What the line refunds; null until approved. */
|
|
55
|
+
refundAmount: number | null;
|
|
56
|
+
/**
|
|
57
|
+
* This line's part of {@link OrderReturnDetail.refundEstimate}: its `refundAmount` once
|
|
58
|
+
* approved, else the default for its approved (or requested) units. Only `get` and `list`
|
|
59
|
+
* select it; absent from an engine released before 2026-10-11.
|
|
60
|
+
*/
|
|
61
|
+
refundEstimate?: number;
|
|
62
|
+
createdAt: string;
|
|
63
|
+
updatedAt: string;
|
|
64
|
+
}
|
|
65
|
+
/** One row of a return's status log. */
|
|
66
|
+
export interface OrderReturnStatusLogEntry {
|
|
67
|
+
state: ReturnState | (string & {});
|
|
68
|
+
/** `customer`, `admin` or `system`. */
|
|
69
|
+
actor: string;
|
|
70
|
+
actorUserId: string | null;
|
|
71
|
+
reason: string | null;
|
|
72
|
+
createdAt: string;
|
|
73
|
+
}
|
|
74
|
+
export interface OrderReturn {
|
|
75
|
+
id: string;
|
|
76
|
+
/** The human-facing RMA code, e.g. `RMA-000042`. */
|
|
77
|
+
code: string;
|
|
78
|
+
channelId: string;
|
|
79
|
+
orderId: string;
|
|
80
|
+
orderCode: string;
|
|
81
|
+
customerId: string;
|
|
82
|
+
currencyCode: string;
|
|
83
|
+
state: ReturnState | (string & {});
|
|
84
|
+
/** `customer` or `admin`. */
|
|
85
|
+
initiator: string;
|
|
86
|
+
customerNote: string | null;
|
|
87
|
+
adminNote: string | null;
|
|
88
|
+
preferredSettlementMethod: ReturnSettlementMethod | (string & {}) | null;
|
|
89
|
+
/** The method it was settled with; null until settled. */
|
|
90
|
+
settlementMethod: ReturnSettlementMethod | (string & {}) | null;
|
|
91
|
+
/** Shipping refunded on top of the lines. */
|
|
92
|
+
shippingRefundAmount: number;
|
|
93
|
+
/** What was settled; null until settled. */
|
|
94
|
+
settledAmount: number | null;
|
|
95
|
+
refundId: string | null;
|
|
96
|
+
creditNoteId: string | null;
|
|
97
|
+
creditNoteNumber: string | null;
|
|
98
|
+
requestedAt: string;
|
|
99
|
+
resolvedAt: string | null;
|
|
100
|
+
lines: OrderReturnLine[];
|
|
101
|
+
createdAt: string;
|
|
102
|
+
updatedAt: string;
|
|
103
|
+
/**
|
|
104
|
+
* The invoice correction credit notes that already credited this return's goods, when it was
|
|
105
|
+
* closed without money ({@link ReturnsModule.closeAlreadyCredited}); null for any other return.
|
|
106
|
+
* Such a return reads `settled`, `settledAmount` 0, with no `settlementMethod`, refund or credit
|
|
107
|
+
* note of its own. Absent from an engine released before it.
|
|
108
|
+
*/
|
|
109
|
+
alreadyCreditedBy?: ReturnCoveringCreditNote[] | null;
|
|
110
|
+
}
|
|
111
|
+
/** An invoice correction credit note that already credited a return's goods. */
|
|
112
|
+
export interface ReturnCoveringCreditNote {
|
|
113
|
+
creditNoteId: string;
|
|
114
|
+
/** The credit note's number, e.g. `CN-00053`. */
|
|
115
|
+
creditNoteNumber: string;
|
|
116
|
+
/** `RETAIL`: a credit note on the order's invoice. `AR`: one on the accounts-receivable ledger. */
|
|
117
|
+
ledger: 'RETAIL' | 'AR' | (string & {});
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Why a return may not be closed as already credited: `NOT_SETTLEABLE` (it cannot be settled
|
|
121
|
+
* now, see `blockedBy`), `NOT_CREDITED` (no correction credit note names every approved line) or
|
|
122
|
+
* `MONEY_LEFT` (something is still left to settle the goods with: settle it).
|
|
123
|
+
*/
|
|
124
|
+
export type ReturnAlreadyCreditedUnavailableReason = 'NOT_SETTLEABLE' | 'NOT_CREDITED' | 'MONEY_LEFT';
|
|
125
|
+
/**
|
|
126
|
+
* A step of a return's life, as `allowedActions` names it. `CLOSE_CREDITED` is
|
|
127
|
+
* {@link ReturnsModule.closeAlreadyCredited}: closing a return invoice corrections already
|
|
128
|
+
* credited in full, moving no money.
|
|
129
|
+
*/
|
|
130
|
+
export declare const RETURN_ACTIONS: readonly ["APPROVE", "REJECT", "RECORD_RECEIPT", "CANCEL", "SETTLE", "CLOSE_CREDITED"];
|
|
131
|
+
export type ReturnAction = (typeof RETURN_ACTIONS)[number];
|
|
132
|
+
/** Whether one step of a return is open now. */
|
|
133
|
+
export interface ReturnActionAvailability {
|
|
134
|
+
/** Treat a step this version does not name as one to leave alone. */
|
|
135
|
+
action: ReturnAction | (string & {});
|
|
136
|
+
allowed: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Null exactly when `allowed`. `NOT_PERMITTED` (no `UpdateOrderReturn`), `STATE`,
|
|
139
|
+
* `RECEIPT_RECORDED` (cancel: goods already came back), `NOTHING_TO_RECEIVE` (receive: every
|
|
140
|
+
* approved unit is back), for `SETTLE` the settlement plan's `blockedBy`, for `CLOSE_CREDITED`
|
|
141
|
+
* the plan's `alreadyCredited.reasonCode`. The set grows:
|
|
142
|
+
* read an unknown value as "not offered".
|
|
143
|
+
*/
|
|
144
|
+
reasonCode: string | null;
|
|
145
|
+
}
|
|
146
|
+
/** The customer a return is for, as the store holds them (core's `Customer`, a selection of it). */
|
|
147
|
+
export interface OrderReturnCustomer {
|
|
148
|
+
id: string;
|
|
149
|
+
firstName: string;
|
|
150
|
+
lastName: string;
|
|
151
|
+
emailAddress: string;
|
|
152
|
+
/** Only what a display name reads: the company of the default addresses. */
|
|
153
|
+
addresses: Array<{
|
|
154
|
+
company: string | null;
|
|
155
|
+
defaultBillingAddress: boolean;
|
|
156
|
+
defaultShippingAddress: boolean;
|
|
157
|
+
}>;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* What `get` and `list` add to a return. Each is absent from an engine released before
|
|
161
|
+
* 2026-10-11 (the calls then retry once without them, and keep doing so for this client).
|
|
162
|
+
*/
|
|
163
|
+
export interface OrderReturnReadFields {
|
|
164
|
+
/**
|
|
165
|
+
* What the return refunds by default: each line's approved `refundAmount`, or before approval
|
|
166
|
+
* its unit price times the requested units, rounded once per line; shipping excluded. An
|
|
167
|
+
* ESTIMATE: approval holds a line an invoice correction credited to what is left of it, and a
|
|
168
|
+
* settlement may state an override and a shipping refund (`settlementOptions.defaultAmount` is
|
|
169
|
+
* what it settles by default).
|
|
170
|
+
*/
|
|
171
|
+
refundEstimate?: number;
|
|
172
|
+
/**
|
|
173
|
+
* The customer, from this store's own rows, read with the return (no second request). Null
|
|
174
|
+
* when the store no longer holds them, and for a caller holding neither `ReadCustomer` nor
|
|
175
|
+
* `ReadOrder`.
|
|
176
|
+
*/
|
|
177
|
+
customer?: OrderReturnCustomer | null;
|
|
178
|
+
}
|
|
179
|
+
/** {@link OrderReturn} with its status log, newest first: what `get` answers. */
|
|
180
|
+
export interface OrderReturnDetail extends OrderReturn, OrderReturnReadFields {
|
|
181
|
+
history: OrderReturnStatusLogEntry[];
|
|
182
|
+
/**
|
|
183
|
+
* Which steps the return offers now (one entry per step). The PLAN: every write judges again
|
|
184
|
+
* with the same rule, so a step offered here can still be refused when something changed in
|
|
185
|
+
* between (`RETURN_STATE_INVALID`). Absent from an engine released before 2026-10-11.
|
|
186
|
+
*/
|
|
187
|
+
allowedActions?: ReturnActionAvailability[];
|
|
188
|
+
}
|
|
189
|
+
/** One row of `list`. */
|
|
190
|
+
export interface OrderReturnListItem extends OrderReturn, OrderReturnReadFields {
|
|
191
|
+
}
|
|
192
|
+
/** A page of returns, newest first. */
|
|
193
|
+
export interface OrderReturnList {
|
|
194
|
+
items: OrderReturnListItem[];
|
|
195
|
+
/** Every return the filter matches, not only this page. */
|
|
196
|
+
totalItems: number;
|
|
197
|
+
}
|
|
198
|
+
/** Which returns `list` answers. Every field narrows; none is required. */
|
|
199
|
+
export interface ReturnListFilter {
|
|
200
|
+
/** At most 100; 25 when left out. */
|
|
201
|
+
take?: number;
|
|
202
|
+
skip?: number;
|
|
203
|
+
/** The CURRENT state. */
|
|
204
|
+
state?: ReturnState;
|
|
205
|
+
customerId?: string;
|
|
206
|
+
orderId?: string;
|
|
207
|
+
/** A case-insensitive part of the RMA code. */
|
|
208
|
+
code?: string;
|
|
209
|
+
}
|
|
210
|
+
/** `damaged`, `defective`, `wrong_item`, `not_as_described`, `arrived_late`, `no_longer_needed`, `order_error`, `other`. */
|
|
211
|
+
export type ReturnReasonCode = 'damaged' | 'defective' | 'wrong_item' | 'not_as_described' | 'arrived_late' | 'no_longer_needed' | 'order_error' | 'other';
|
|
212
|
+
export interface CreateReturnInput {
|
|
213
|
+
orderId: string;
|
|
214
|
+
lines: Array<{
|
|
215
|
+
orderLineId: string;
|
|
216
|
+
quantity: number;
|
|
217
|
+
reasonCode: ReturnReasonCode;
|
|
218
|
+
reasonNote?: string | null;
|
|
219
|
+
}>;
|
|
220
|
+
/** The customer's own words. Refused `CUSTOMER_ERASED` for a customer the platform erased. */
|
|
221
|
+
customerNote?: string | null;
|
|
222
|
+
preferredSettlementMethod?: ReturnSettlementMethod | null;
|
|
223
|
+
/** Create it after the store's return window ended. The quantity caps always apply. */
|
|
224
|
+
overrideWindow?: boolean;
|
|
225
|
+
}
|
|
226
|
+
export interface ApproveReturnInput {
|
|
227
|
+
/** One decision per line; a line left out is declined (0). */
|
|
228
|
+
lines: Array<{
|
|
229
|
+
returnLineId: string;
|
|
230
|
+
/** 0 declines the line; at most the requested quantity. */
|
|
231
|
+
approvedQty: number;
|
|
232
|
+
/** What the line refunds, minor units; the default arithmetic when left out. */
|
|
233
|
+
refundAmount?: number;
|
|
234
|
+
}>;
|
|
235
|
+
/** Appended to the merchant's internal note. */
|
|
236
|
+
adminNote?: string | null;
|
|
237
|
+
}
|
|
238
|
+
export interface RecordReturnReceiptInput {
|
|
239
|
+
lines: Array<{
|
|
240
|
+
returnLineId: string;
|
|
241
|
+
/** Units that came back in this receipt, 1 or more. */
|
|
242
|
+
quantity: number;
|
|
243
|
+
/** `restock` puts them back on stock at `stockLocationId`; `write_off` touches no stock. */
|
|
244
|
+
disposition: 'restock' | 'write_off';
|
|
245
|
+
/** For a restock: the store's default restock location when left out. */
|
|
246
|
+
stockLocationId?: string;
|
|
247
|
+
}>;
|
|
248
|
+
}
|
|
249
|
+
/** How {@link ReturnsModule.settle} settles a return. Money in minor units. */
|
|
250
|
+
export interface SettleReturnInput {
|
|
251
|
+
/**
|
|
252
|
+
* `refund` gives the money back to a settled payment of the order; `store_credit` issues a
|
|
253
|
+
* credit note (on a store that keeps customer accounts it credits the account, else it credits
|
|
254
|
+
* the order's invoice and moves no money); `account` puts the money on the customer's account
|
|
255
|
+
* (unapplied cash), making no refund.
|
|
256
|
+
*/
|
|
257
|
+
method: ReturnSettlementMethod;
|
|
258
|
+
/** `refund` only: the payment to refund. Left out, the engine picks a settled one that can carry it. */
|
|
259
|
+
paymentId?: string | null;
|
|
260
|
+
/**
|
|
261
|
+
* What the return settles instead of its approved line total (`settlementOptions.defaultAmount`),
|
|
262
|
+
* before shipping. Left out, the engine's own figure.
|
|
263
|
+
*/
|
|
264
|
+
amountOverride?: number | null;
|
|
265
|
+
/**
|
|
266
|
+
* Shipping refunded on top. Left out, the figure an earlier failed attempt stated (0 when none
|
|
267
|
+
* did); state it, 0 included, once a correction credited shipping (`settlementOptions.shippingCeiling`).
|
|
268
|
+
*/
|
|
269
|
+
shippingRefundAmount?: number | null;
|
|
270
|
+
/** Recorded on the refund and the return's history. */
|
|
271
|
+
reason?: string | null;
|
|
272
|
+
}
|
|
273
|
+
/** The store's RMA code format: `{prefix}{year}{number}{suffix}`, e.g. `RMA-000042`. */
|
|
274
|
+
export interface ReturnNumberingConfig {
|
|
275
|
+
prefix: string;
|
|
276
|
+
suffix: string;
|
|
277
|
+
/** How many digits the number is padded to, 3 to 8. */
|
|
278
|
+
digits: number;
|
|
279
|
+
/** `none`, `short` (`26`) or `full` (`2026`). */
|
|
280
|
+
yearFormat: string;
|
|
281
|
+
/** Restart the count each year (only with a year in the code). */
|
|
282
|
+
yearReset: boolean;
|
|
283
|
+
}
|
|
284
|
+
/** A PATCH: a field left out keeps its value. */
|
|
285
|
+
export interface UpdateReturnNumberingConfigInput {
|
|
286
|
+
prefix?: string;
|
|
287
|
+
suffix?: string;
|
|
288
|
+
/** Clamped to 3..8. */
|
|
289
|
+
digits?: number;
|
|
290
|
+
/** `none`, `short` or `full`; anything else is refused `NUMBERING_YEAR_FORMAT_INVALID`. */
|
|
291
|
+
yearFormat?: string;
|
|
292
|
+
yearReset?: boolean;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* The active store's OWN return policy (its channel's fields). A store that inherits
|
|
296
|
+
* `settings.returns` from its organization is governed by the organization's values instead;
|
|
297
|
+
* those are the settings resolver's (multi-region), not this read's.
|
|
298
|
+
*/
|
|
299
|
+
export interface ReturnsSettings {
|
|
300
|
+
/** The store these are the settings of (its channel id). */
|
|
301
|
+
channelId: string;
|
|
302
|
+
/** Customers may request returns on the storefront. Staff can always create them. */
|
|
303
|
+
returnsEnabled: boolean;
|
|
304
|
+
/** Days after delivery (else shipping, else placement) a customer may request a return. */
|
|
305
|
+
returnWindowDays: number;
|
|
306
|
+
/** A customer's request is approved on arrival, in full. */
|
|
307
|
+
returnsAutoApprove: boolean;
|
|
308
|
+
/** An approved return is settled only after its goods are received. */
|
|
309
|
+
returnsRequireReceiptBeforeSettle: boolean;
|
|
310
|
+
/** Where restocked goods go when a receipt names no location; null when none is set. */
|
|
311
|
+
returnsDefaultRestockLocationId: string | null;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* What an invoice correction's credit note already credited on an order line. A unit it
|
|
315
|
+
* credited whole is no longer returnable; a lower amount (a price correction on goods the
|
|
316
|
+
* customer keeps) lowers what each remaining unit refunds. A head can say "1 already credited
|
|
317
|
+
* on CN-00053" from it.
|
|
318
|
+
*/
|
|
319
|
+
export interface ReturnLineCorrectionCredit {
|
|
320
|
+
orderLineId: string;
|
|
321
|
+
creditNoteId: string;
|
|
322
|
+
/** The credit note's number, e.g. `CN-00053`. */
|
|
323
|
+
creditNoteNumber: string;
|
|
324
|
+
/** `RETAIL`: a credit note on the order's invoice. `AR`: one on the accounts-receivable ledger. */
|
|
325
|
+
ledger: 'RETAIL' | 'AR' | (string & {});
|
|
326
|
+
/** Units it credited whole on the line: no longer returnable. */
|
|
327
|
+
quantity: number;
|
|
328
|
+
/** What it credited on the line, minor units incl. tax: whole units and price corrections. */
|
|
329
|
+
amount: number;
|
|
330
|
+
}
|
|
331
|
+
/** One order line and what of it can still be returned. */
|
|
332
|
+
export interface ReturnableOrderLine {
|
|
333
|
+
orderLineId: string;
|
|
334
|
+
productVariantId: string;
|
|
335
|
+
productVariantName: string;
|
|
336
|
+
productVariantSku: string;
|
|
337
|
+
/** Units shipped or delivered. */
|
|
338
|
+
fulfilledQty: number;
|
|
339
|
+
/**
|
|
340
|
+
* `fulfilledQty` less the units other open returns already claim, and never more than the
|
|
341
|
+
* billed units an invoice correction did not credit whole (`creditedQty`).
|
|
342
|
+
*/
|
|
343
|
+
returnableQty: number;
|
|
344
|
+
/**
|
|
345
|
+
* Units an invoice correction credited whole on the line; 0 when none did. Absent from an
|
|
346
|
+
* engine released before 2026-10-09, which does not subtract them.
|
|
347
|
+
*/
|
|
348
|
+
creditedQty?: number;
|
|
349
|
+
/** Every invoice correction credit note that names the line; empty when none does. Absent as above. */
|
|
350
|
+
correctionCredits?: ReturnLineCorrectionCredit[];
|
|
351
|
+
/** What one returned unit refunds: the line's price, or what a price correction left of it. */
|
|
352
|
+
unitPriceWithTax: number;
|
|
353
|
+
unitPriceWithTaxUnrounded: number;
|
|
354
|
+
}
|
|
355
|
+
export interface ReturnEligibility {
|
|
356
|
+
orderId: string;
|
|
357
|
+
/** False only when nothing is returnable: an admin may return outside the window. */
|
|
358
|
+
eligible: boolean;
|
|
359
|
+
/** Why not, when not eligible. */
|
|
360
|
+
reason: string | null;
|
|
361
|
+
/** ISO-8601 with offset; null when the store sets no window. */
|
|
362
|
+
returnWindowEndsAt: string | null;
|
|
363
|
+
/** Lines with a fulfilled quantity only. */
|
|
364
|
+
lines: ReturnableOrderLine[];
|
|
365
|
+
}
|
|
366
|
+
/** Why a return cannot be settled now, in the order the engine checks them. */
|
|
367
|
+
export declare const RETURN_SETTLEMENT_BLOCKERS: readonly ["OUTCOME_UNKNOWN", "ALREADY_SETTLED", "IN_PROGRESS", "RECEIPT_REQUIRED", "STATE"];
|
|
368
|
+
/**
|
|
369
|
+
* - `OUTCOME_UNKNOWN`: the refund it waits on reached the provider and was never
|
|
370
|
+
* confirmed. Record the provider's answer first (`reconcileRefundOutcome`):
|
|
371
|
+
* made completes the return, not made lets it be settled again.
|
|
372
|
+
* - `ALREADY_SETTLED`: settled, or settled by a credit note.
|
|
373
|
+
* - `IN_PROGRESS`: a refund is on its way and settles the return when the
|
|
374
|
+
* provider confirms it.
|
|
375
|
+
* - `RECEIPT_REQUIRED`: approved, and the store requires the goods received first.
|
|
376
|
+
* - `STATE`: requested, rejected or cancelled.
|
|
377
|
+
*/
|
|
378
|
+
export type ReturnSettlementBlocker = (typeof RETURN_SETTLEMENT_BLOCKERS)[number];
|
|
379
|
+
/**
|
|
380
|
+
* - `NO_REFUNDABLE_PAYMENT`: no settled payment can still give money back (net
|
|
381
|
+
* terms, everything refunded, reserved by a refund of unknown outcome, or
|
|
382
|
+
* moved to the customer's account).
|
|
383
|
+
* - `REFUND_ORPHAN_EXISTS`: a refund of the invoiced order stands that no credit
|
|
384
|
+
* note names; another refund could pay the same money back twice.
|
|
385
|
+
*/
|
|
386
|
+
export type ReturnRefundUnavailableReason = 'NO_REFUNDABLE_PAYMENT' | 'REFUND_ORPHAN_EXISTS';
|
|
387
|
+
/**
|
|
388
|
+
* - `AR`: the store keeps an accounts-receivable ledger; the credit note credits
|
|
389
|
+
* the customer's account, which is money.
|
|
390
|
+
* - `RETAIL`: the credit note credits the order's invoice and moves no money.
|
|
391
|
+
*/
|
|
392
|
+
export type ReturnCreditNoteLedger = 'AR' | 'RETAIL';
|
|
393
|
+
/**
|
|
394
|
+
* - `ISSUER_UNAVAILABLE`: the server runs without the plugin that issues it.
|
|
395
|
+
* - `CURRENCY_MISMATCH` (`AR`): the order is not in the store's default currency.
|
|
396
|
+
* - `NO_CREDITABLE_INVOICE` (`RETAIL`): the order has no live invoice to credit.
|
|
397
|
+
* - `REFUND_ORPHAN_EXISTS` (`AR`): as for the refund.
|
|
398
|
+
*/
|
|
399
|
+
export type ReturnCreditNoteUnavailableReason = 'ISSUER_UNAVAILABLE' | 'CURRENCY_MISMATCH' | 'NO_CREDITABLE_INVOICE' | 'REFUND_ORPHAN_EXISTS';
|
|
400
|
+
/** A settled payment a refund may name, with what it can still give back. */
|
|
401
|
+
export interface ReturnSettlementPayment {
|
|
402
|
+
paymentId: string;
|
|
403
|
+
method: string;
|
|
404
|
+
/** As the platform's refund position counts it. */
|
|
405
|
+
refundable: number;
|
|
406
|
+
}
|
|
407
|
+
/** Putting the return's money on the customer's account (`account`). */
|
|
408
|
+
export interface ReturnSettlementAccountOption {
|
|
409
|
+
available: boolean;
|
|
410
|
+
/**
|
|
411
|
+
* Null exactly when `available`. The account's own answer (`AR_LEDGER_NOT_ENABLED`: the store
|
|
412
|
+
* keeps no accounts-receivable ledger; `AR_ACCOUNT_REQUIRED`: the customer has no credit
|
|
413
|
+
* account; `AR_ACCOUNT_IN_ERP`; `AR_ORDER_ALREADY_INVOICED`; `ACCOUNT_CREDIT_NO_CUSTOMER`), the
|
|
414
|
+
* store credit's (`STORE_CREDIT_INVOICE_FIRST`, `STORE_CREDIT_CUSTOMER_ANONYMOUS`,
|
|
415
|
+
* `STORED_VALUE_ACCOUNT_BLOCKED`, `STORED_VALUE_OWNER_REQUIRED`),
|
|
416
|
+
* `ACCOUNT_CREDIT_NOTHING_OVERPAID` (the settled payments hold nothing more) or
|
|
417
|
+
* `REFUND_ORPHAN_EXISTS`.
|
|
418
|
+
*/
|
|
419
|
+
reasonCode: string | null;
|
|
420
|
+
/** The engine's sentence for `reasonCode`; null when available. */
|
|
421
|
+
message: string | null;
|
|
422
|
+
/**
|
|
423
|
+
* What the order's settled payments still hold, minor units: the most a settlement to the
|
|
424
|
+
* account may state, shipping included (above it `RETURN_ACCOUNT_CREDIT_EXCEEDS_HELD`).
|
|
425
|
+
*/
|
|
426
|
+
held: number;
|
|
427
|
+
/**
|
|
428
|
+
* Where the money lands, the store's ONE book (incentives sprint 8): `AR` (the customer's
|
|
429
|
+
* account), `STORE_CREDIT` (the customer's store credit: on an invoiced order the return's credit
|
|
430
|
+
* note is issued first, and the wallet takes exactly what it credits) or `NONE`. In a
|
|
431
|
+
* store-credit store an order with no invoice yet, in a store that issues invoices, is refused
|
|
432
|
+
* `STORE_CREDIT_INVOICE_FIRST`. Absent from an engine before it (read it as the account's).
|
|
433
|
+
*/
|
|
434
|
+
book?: 'AR' | 'STORE_CREDIT' | 'NONE' | (string & {}) | null;
|
|
435
|
+
}
|
|
436
|
+
export interface ReturnSettlementOptions {
|
|
437
|
+
returnId: string;
|
|
438
|
+
currencyCode: string;
|
|
439
|
+
settleable: boolean;
|
|
440
|
+
/** Null exactly when `settleable`. */
|
|
441
|
+
blockedBy: ReturnSettlementBlocker | (string & {}) | null;
|
|
442
|
+
refund: {
|
|
443
|
+
available: boolean;
|
|
444
|
+
/** Null exactly when `available`. */
|
|
445
|
+
reasonCode: ReturnRefundUnavailableReason | (string & {}) | null;
|
|
446
|
+
/** Empty when not available. */
|
|
447
|
+
payments: ReturnSettlementPayment[];
|
|
448
|
+
};
|
|
449
|
+
creditNote: {
|
|
450
|
+
available: boolean;
|
|
451
|
+
ledger: ReturnCreditNoteLedger | (string & {});
|
|
452
|
+
/** Null exactly when `available`. */
|
|
453
|
+
reasonCode: ReturnCreditNoteUnavailableReason | (string & {}) | null;
|
|
454
|
+
/** `RETAIL` only: the invoice it would credit, when known. */
|
|
455
|
+
invoiceNumber: string | null;
|
|
456
|
+
};
|
|
457
|
+
/** The credit note when asked for or when no refund is possible, and it is available; else `refund`. */
|
|
458
|
+
initialMethod: ReturnSettlementMethod | (string & {});
|
|
459
|
+
/**
|
|
460
|
+
* The approved line total: what a settlement without an override settles, before shipping. A
|
|
461
|
+
* line an invoice correction already credited counts only what is left of it.
|
|
462
|
+
*/
|
|
463
|
+
defaultAmount: number;
|
|
464
|
+
/**
|
|
465
|
+
* The most `amountOverride` may state when an invoice correction already credited goods of
|
|
466
|
+
* this return (then equal to `defaultAmount`); null when none did. Above it the settlement is
|
|
467
|
+
* refused `RETURN_AMOUNT_ALREADY_CREDITED`. Absent from an engine released before 2026-10-09.
|
|
468
|
+
*/
|
|
469
|
+
amountCeiling?: number | null;
|
|
470
|
+
/** What invoice corrections already credited on the return's approved order lines. Absent as above. */
|
|
471
|
+
correctionCredits?: ReturnLineCorrectionCredit[];
|
|
472
|
+
/**
|
|
473
|
+
* The most `shippingRefundAmount` may state when an invoice correction already credited the
|
|
474
|
+
* order's shipping: what the order charged for shipping, less what corrections credited and
|
|
475
|
+
* other returns refunded of it. Null when no correction credited shipping. Above it the
|
|
476
|
+
* settlement is refused `RETURN_SHIPPING_ALREADY_CREDITED`. Absent from an engine released
|
|
477
|
+
* before this field.
|
|
478
|
+
*/
|
|
479
|
+
shippingCeiling?: number | null;
|
|
480
|
+
/**
|
|
481
|
+
* Whether "Close — already credited on CN-…" is open (ruling U15): invoice corrections already
|
|
482
|
+
* credited all of the return's goods, so nothing is left to settle them with, and
|
|
483
|
+
* {@link ReturnsModule.closeAlreadyCredited} closes it without money. Absent from an engine
|
|
484
|
+
* released before it (read it as not available).
|
|
485
|
+
*/
|
|
486
|
+
alreadyCredited?: {
|
|
487
|
+
available: boolean;
|
|
488
|
+
/** Null exactly when `available`. */
|
|
489
|
+
reasonCode: ReturnAlreadyCreditedUnavailableReason | (string & {}) | null;
|
|
490
|
+
/** The credit notes that covered the goods, by number. Empty when not available. */
|
|
491
|
+
creditNotes: ReturnCoveringCreditNote[];
|
|
492
|
+
};
|
|
493
|
+
/**
|
|
494
|
+
* Putting the money on the customer's account. Absent from an engine released before
|
|
495
|
+
* 2026-10-10 (the method does not exist there).
|
|
496
|
+
*/
|
|
497
|
+
account?: ReturnSettlementAccountOption;
|
|
498
|
+
}
|
|
499
|
+
export declare const RETURN_QUERY = "\n query SdkOrderReturn($id: ID!) {\n orderReturn(id: $id) {\n \n id\n code\n channelId\n orderId\n orderCode\n customerId\n currencyCode\n state\n initiator\n customerNote\n adminNote\n preferredSettlementMethod\n settlementMethod\n shippingRefundAmount\n settledAmount\n refundId\n creditNoteId\n creditNoteNumber\n requestedAt\n resolvedAt\n createdAt\n updatedAt\n lines {\n id\n returnId\n orderLineId\n productVariantId\n productVariantName\n productVariantSku\n requestedQty\n approvedQty\n receivedQty\n restockQty\n writeOffQty\n restockLocationId\n reasonCode\n reasonNote\n unitPriceWithTax\n unitPriceWithTaxUnrounded\n refundAmount\n createdAt\n updatedAt\n }\n\n alreadyCreditedBy {\n \n creditNoteId\n creditNoteNumber\n ledger\n\n }\n \n history {\n state\n actor\n actorUserId\n reason\n createdAt\n }\n\n \n refundEstimate\n customer {\n id\n firstName\n lastName\n emailAddress\n addresses {\n company\n defaultBillingAddress\n defaultShippingAddress\n }\n }\n lines {\n refundEstimate\n }\n\n allowedActions {\n action\n allowed\n reasonCode\n }\n }\n }\n";
|
|
500
|
+
/**
|
|
501
|
+
* {@link RETURN_QUERY} for an engine with `alreadyCreditedBy` (ruling U15) but released before
|
|
502
|
+
* `allowedActions`, `refundEstimate` and `customer` (2026-10-11).
|
|
503
|
+
*/
|
|
504
|
+
export declare const RETURN_QUERY_BEFORE_ACTIONS = "\n query SdkOrderReturnBeforeActions($id: ID!) {\n orderReturn(id: $id) {\n \n id\n code\n channelId\n orderId\n orderCode\n customerId\n currencyCode\n state\n initiator\n customerNote\n adminNote\n preferredSettlementMethod\n settlementMethod\n shippingRefundAmount\n settledAmount\n refundId\n creditNoteId\n creditNoteNumber\n requestedAt\n resolvedAt\n createdAt\n updatedAt\n lines {\n id\n returnId\n orderLineId\n productVariantId\n productVariantName\n productVariantSku\n requestedQty\n approvedQty\n receivedQty\n restockQty\n writeOffQty\n restockLocationId\n reasonCode\n reasonNote\n unitPriceWithTax\n unitPriceWithTaxUnrounded\n refundAmount\n createdAt\n updatedAt\n }\n\n alreadyCreditedBy {\n \n creditNoteId\n creditNoteNumber\n ledger\n\n }\n \n history {\n state\n actor\n actorUserId\n reason\n createdAt\n }\n\n }\n }\n";
|
|
505
|
+
/** {@link RETURN_QUERY} for an engine released before `alreadyCreditedBy` (ruling U15). */
|
|
506
|
+
export declare const RETURN_QUERY_LEGACY = "\n query SdkOrderReturnLegacy($id: ID!) {\n orderReturn(id: $id) {\n \n id\n code\n channelId\n orderId\n orderCode\n customerId\n currencyCode\n state\n initiator\n customerNote\n adminNote\n preferredSettlementMethod\n settlementMethod\n shippingRefundAmount\n settledAmount\n refundId\n creditNoteId\n creditNoteNumber\n requestedAt\n resolvedAt\n createdAt\n updatedAt\n lines {\n id\n returnId\n orderLineId\n productVariantId\n productVariantName\n productVariantSku\n requestedQty\n approvedQty\n receivedQty\n restockQty\n writeOffQty\n restockLocationId\n reasonCode\n reasonNote\n unitPriceWithTax\n unitPriceWithTaxUnrounded\n refundAmount\n createdAt\n updatedAt\n }\n\n \n history {\n state\n actor\n actorUserId\n reason\n createdAt\n }\n\n }\n }\n";
|
|
507
|
+
export declare const RETURNS_LIST_QUERY = "\n query SdkOrderReturns($options: OrderReturnListOptions) {\n orderReturns(options: $options) {\n items {\n \n id\n code\n channelId\n orderId\n orderCode\n customerId\n currencyCode\n state\n initiator\n customerNote\n adminNote\n preferredSettlementMethod\n settlementMethod\n shippingRefundAmount\n settledAmount\n refundId\n creditNoteId\n creditNoteNumber\n requestedAt\n resolvedAt\n createdAt\n updatedAt\n lines {\n id\n returnId\n orderLineId\n productVariantId\n productVariantName\n productVariantSku\n requestedQty\n approvedQty\n receivedQty\n restockQty\n writeOffQty\n restockLocationId\n reasonCode\n reasonNote\n unitPriceWithTax\n unitPriceWithTaxUnrounded\n refundAmount\n createdAt\n updatedAt\n }\n\n alreadyCreditedBy {\n \n creditNoteId\n creditNoteNumber\n ledger\n\n }\n \n refundEstimate\n customer {\n id\n firstName\n lastName\n emailAddress\n addresses {\n company\n defaultBillingAddress\n defaultShippingAddress\n }\n }\n lines {\n refundEstimate\n }\n\n }\n totalItems\n }\n }\n";
|
|
508
|
+
/** {@link RETURNS_LIST_QUERY} for an engine with `alreadyCreditedBy` but released before 2026-10-11. */
|
|
509
|
+
export declare const RETURNS_LIST_QUERY_BEFORE_ACTIONS = "\n query SdkOrderReturnsBeforeActions($options: OrderReturnListOptions) {\n orderReturns(options: $options) {\n items {\n \n id\n code\n channelId\n orderId\n orderCode\n customerId\n currencyCode\n state\n initiator\n customerNote\n adminNote\n preferredSettlementMethod\n settlementMethod\n shippingRefundAmount\n settledAmount\n refundId\n creditNoteId\n creditNoteNumber\n requestedAt\n resolvedAt\n createdAt\n updatedAt\n lines {\n id\n returnId\n orderLineId\n productVariantId\n productVariantName\n productVariantSku\n requestedQty\n approvedQty\n receivedQty\n restockQty\n writeOffQty\n restockLocationId\n reasonCode\n reasonNote\n unitPriceWithTax\n unitPriceWithTaxUnrounded\n refundAmount\n createdAt\n updatedAt\n }\n\n alreadyCreditedBy {\n \n creditNoteId\n creditNoteNumber\n ledger\n\n }\n }\n totalItems\n }\n }\n";
|
|
510
|
+
/** {@link RETURNS_LIST_QUERY} for an engine released before `alreadyCreditedBy`. */
|
|
511
|
+
export declare const RETURNS_LIST_QUERY_LEGACY = "\n query SdkOrderReturnsLegacy($options: OrderReturnListOptions) {\n orderReturns(options: $options) {\n items {\n \n id\n code\n channelId\n orderId\n orderCode\n customerId\n currencyCode\n state\n initiator\n customerNote\n adminNote\n preferredSettlementMethod\n settlementMethod\n shippingRefundAmount\n settledAmount\n refundId\n creditNoteId\n creditNoteNumber\n requestedAt\n resolvedAt\n createdAt\n updatedAt\n lines {\n id\n returnId\n orderLineId\n productVariantId\n productVariantName\n productVariantSku\n requestedQty\n approvedQty\n receivedQty\n restockQty\n writeOffQty\n restockLocationId\n reasonCode\n reasonNote\n unitPriceWithTax\n unitPriceWithTaxUnrounded\n refundAmount\n createdAt\n updatedAt\n }\n\n }\n totalItems\n }\n }\n";
|
|
512
|
+
export declare const OPEN_RETURNS_COUNT_QUERY = "\n query SdkOpenReturnsCount {\n orderReturns(options: { take: 1, state: requested }) {\n totalItems\n }\n }\n";
|
|
513
|
+
export declare const CREATE_RETURN_MUTATION = "\n mutation SdkCreateReturn($input: CreateReturnInput!) {\n createReturn(input: $input) {\n \n id\n code\n channelId\n orderId\n orderCode\n customerId\n currencyCode\n state\n initiator\n customerNote\n adminNote\n preferredSettlementMethod\n settlementMethod\n shippingRefundAmount\n settledAmount\n refundId\n creditNoteId\n creditNoteNumber\n requestedAt\n resolvedAt\n createdAt\n updatedAt\n lines {\n id\n returnId\n orderLineId\n productVariantId\n productVariantName\n productVariantSku\n requestedQty\n approvedQty\n receivedQty\n restockQty\n writeOffQty\n restockLocationId\n reasonCode\n reasonNote\n unitPriceWithTax\n unitPriceWithTaxUnrounded\n refundAmount\n createdAt\n updatedAt\n }\n\n }\n }\n";
|
|
514
|
+
export declare const APPROVE_RETURN_MUTATION = "\n mutation SdkApproveReturn($input: ApproveReturnInput!) {\n approveReturn(input: $input) {\n \n id\n code\n channelId\n orderId\n orderCode\n customerId\n currencyCode\n state\n initiator\n customerNote\n adminNote\n preferredSettlementMethod\n settlementMethod\n shippingRefundAmount\n settledAmount\n refundId\n creditNoteId\n creditNoteNumber\n requestedAt\n resolvedAt\n createdAt\n updatedAt\n lines {\n id\n returnId\n orderLineId\n productVariantId\n productVariantName\n productVariantSku\n requestedQty\n approvedQty\n receivedQty\n restockQty\n writeOffQty\n restockLocationId\n reasonCode\n reasonNote\n unitPriceWithTax\n unitPriceWithTaxUnrounded\n refundAmount\n createdAt\n updatedAt\n }\n\n }\n }\n";
|
|
515
|
+
export declare const REJECT_RETURN_MUTATION = "\n mutation SdkRejectReturn($id: ID!, $reason: String!) {\n rejectReturn(id: $id, reason: $reason) {\n \n id\n code\n channelId\n orderId\n orderCode\n customerId\n currencyCode\n state\n initiator\n customerNote\n adminNote\n preferredSettlementMethod\n settlementMethod\n shippingRefundAmount\n settledAmount\n refundId\n creditNoteId\n creditNoteNumber\n requestedAt\n resolvedAt\n createdAt\n updatedAt\n lines {\n id\n returnId\n orderLineId\n productVariantId\n productVariantName\n productVariantSku\n requestedQty\n approvedQty\n receivedQty\n restockQty\n writeOffQty\n restockLocationId\n reasonCode\n reasonNote\n unitPriceWithTax\n unitPriceWithTaxUnrounded\n refundAmount\n createdAt\n updatedAt\n }\n\n }\n }\n";
|
|
516
|
+
export declare const CANCEL_RETURN_MUTATION = "\n mutation SdkCancelReturn($id: ID!, $reason: String) {\n cancelReturn(id: $id, reason: $reason) {\n \n id\n code\n channelId\n orderId\n orderCode\n customerId\n currencyCode\n state\n initiator\n customerNote\n adminNote\n preferredSettlementMethod\n settlementMethod\n shippingRefundAmount\n settledAmount\n refundId\n creditNoteId\n creditNoteNumber\n requestedAt\n resolvedAt\n createdAt\n updatedAt\n lines {\n id\n returnId\n orderLineId\n productVariantId\n productVariantName\n productVariantSku\n requestedQty\n approvedQty\n receivedQty\n restockQty\n writeOffQty\n restockLocationId\n reasonCode\n reasonNote\n unitPriceWithTax\n unitPriceWithTaxUnrounded\n refundAmount\n createdAt\n updatedAt\n }\n\n }\n }\n";
|
|
517
|
+
export declare const RECORD_RETURN_RECEIPT_MUTATION = "\n mutation SdkRecordReturnReceipt($input: RecordReturnReceiptInput!) {\n recordReturnReceipt(input: $input) {\n \n id\n code\n channelId\n orderId\n orderCode\n customerId\n currencyCode\n state\n initiator\n customerNote\n adminNote\n preferredSettlementMethod\n settlementMethod\n shippingRefundAmount\n settledAmount\n refundId\n creditNoteId\n creditNoteNumber\n requestedAt\n resolvedAt\n createdAt\n updatedAt\n lines {\n id\n returnId\n orderLineId\n productVariantId\n productVariantName\n productVariantSku\n requestedQty\n approvedQty\n receivedQty\n restockQty\n writeOffQty\n restockLocationId\n reasonCode\n reasonNote\n unitPriceWithTax\n unitPriceWithTaxUnrounded\n refundAmount\n createdAt\n updatedAt\n }\n\n }\n }\n";
|
|
518
|
+
export declare const SETTLE_RETURN_MUTATION = "\n mutation SdkSettleReturn($input: SettleReturnInput!, $idempotencyKey: String) {\n settleReturn(input: $input, idempotencyKey: $idempotencyKey) {\n \n id\n code\n channelId\n orderId\n orderCode\n customerId\n currencyCode\n state\n initiator\n customerNote\n adminNote\n preferredSettlementMethod\n settlementMethod\n shippingRefundAmount\n settledAmount\n refundId\n creditNoteId\n creditNoteNumber\n requestedAt\n resolvedAt\n createdAt\n updatedAt\n lines {\n id\n returnId\n orderLineId\n productVariantId\n productVariantName\n productVariantSku\n requestedQty\n approvedQty\n receivedQty\n restockQty\n writeOffQty\n restockLocationId\n reasonCode\n reasonNote\n unitPriceWithTax\n unitPriceWithTaxUnrounded\n refundAmount\n createdAt\n updatedAt\n }\n\n \n history {\n state\n actor\n actorUserId\n reason\n createdAt\n }\n\n }\n }\n";
|
|
519
|
+
export declare const ADD_RETURN_NOTE_MUTATION = "\n mutation SdkAddReturnNote($id: ID!, $note: String!) {\n addReturnNote(id: $id, note: $note) {\n \n id\n code\n channelId\n orderId\n orderCode\n customerId\n currencyCode\n state\n initiator\n customerNote\n adminNote\n preferredSettlementMethod\n settlementMethod\n shippingRefundAmount\n settledAmount\n refundId\n creditNoteId\n creditNoteNumber\n requestedAt\n resolvedAt\n createdAt\n updatedAt\n lines {\n id\n returnId\n orderLineId\n productVariantId\n productVariantName\n productVariantSku\n requestedQty\n approvedQty\n receivedQty\n restockQty\n writeOffQty\n restockLocationId\n reasonCode\n reasonNote\n unitPriceWithTax\n unitPriceWithTaxUnrounded\n refundAmount\n createdAt\n updatedAt\n }\n\n }\n }\n";
|
|
520
|
+
export declare const RETURN_NUMBERING_QUERY = "\n query SdkReturnNumberingConfig {\n returnNumberingConfig {\n \n prefix\n suffix\n digits\n yearFormat\n yearReset\n\n }\n }\n";
|
|
521
|
+
export declare const UPDATE_RETURN_NUMBERING_MUTATION = "\n mutation SdkUpdateReturnNumberingConfig($input: UpdateReturnNumberingConfigInput!) {\n updateReturnNumberingConfig(input: $input) {\n \n prefix\n suffix\n digits\n yearFormat\n yearReset\n\n }\n }\n";
|
|
522
|
+
export declare const RETURNS_SETTINGS_QUERY = "\n query SdkReturnsSettings {\n activeChannel {\n id\n customFields {\n returnsEnabled\n returnWindowDays\n returnsAutoApprove\n returnsRequireReceiptBeforeSettle\n returnsDefaultRestockLocationId\n }\n }\n }\n";
|
|
523
|
+
export declare const RETURNS_FOR_ORDER_QUERY = "\n query SdkReturnsForOrder($orderId: ID!) {\n returnsForOrder(orderId: $orderId) {\n \n id\n code\n channelId\n orderId\n orderCode\n customerId\n currencyCode\n state\n initiator\n customerNote\n adminNote\n preferredSettlementMethod\n settlementMethod\n shippingRefundAmount\n settledAmount\n refundId\n creditNoteId\n creditNoteNumber\n requestedAt\n resolvedAt\n createdAt\n updatedAt\n lines {\n id\n returnId\n orderLineId\n productVariantId\n productVariantName\n productVariantSku\n requestedQty\n approvedQty\n receivedQty\n restockQty\n writeOffQty\n restockLocationId\n reasonCode\n reasonNote\n unitPriceWithTax\n unitPriceWithTaxUnrounded\n refundAmount\n createdAt\n updatedAt\n }\n\n alreadyCreditedBy {\n \n creditNoteId\n creditNoteNumber\n ledger\n\n }\n }\n }\n";
|
|
524
|
+
/** {@link RETURNS_FOR_ORDER_QUERY} for an engine released before `alreadyCreditedBy`. */
|
|
525
|
+
export declare const RETURNS_FOR_ORDER_QUERY_LEGACY = "\n query SdkReturnsForOrderLegacy($orderId: ID!) {\n returnsForOrder(orderId: $orderId) {\n \n id\n code\n channelId\n orderId\n orderCode\n customerId\n currencyCode\n state\n initiator\n customerNote\n adminNote\n preferredSettlementMethod\n settlementMethod\n shippingRefundAmount\n settledAmount\n refundId\n creditNoteId\n creditNoteNumber\n requestedAt\n resolvedAt\n createdAt\n updatedAt\n lines {\n id\n returnId\n orderLineId\n productVariantId\n productVariantName\n productVariantSku\n requestedQty\n approvedQty\n receivedQty\n restockQty\n writeOffQty\n restockLocationId\n reasonCode\n reasonNote\n unitPriceWithTax\n unitPriceWithTaxUnrounded\n refundAmount\n createdAt\n updatedAt\n }\n\n }\n }\n";
|
|
526
|
+
export declare const CLOSE_RETURN_ALREADY_CREDITED_MUTATION = "\n mutation SdkCloseReturnAlreadyCredited($input: CloseReturnAlreadyCreditedInput!) {\n closeReturnAlreadyCredited(input: $input) {\n \n id\n code\n channelId\n orderId\n orderCode\n customerId\n currencyCode\n state\n initiator\n customerNote\n adminNote\n preferredSettlementMethod\n settlementMethod\n shippingRefundAmount\n settledAmount\n refundId\n creditNoteId\n creditNoteNumber\n requestedAt\n resolvedAt\n createdAt\n updatedAt\n lines {\n id\n returnId\n orderLineId\n productVariantId\n productVariantName\n productVariantSku\n requestedQty\n approvedQty\n receivedQty\n restockQty\n writeOffQty\n restockLocationId\n reasonCode\n reasonNote\n unitPriceWithTax\n unitPriceWithTaxUnrounded\n refundAmount\n createdAt\n updatedAt\n }\n\n alreadyCreditedBy {\n \n creditNoteId\n creditNoteNumber\n ledger\n\n }\n \n history {\n state\n actor\n actorUserId\n reason\n createdAt\n }\n\n }\n }\n";
|
|
527
|
+
export declare const RETURN_ELIGIBILITY_QUERY = "\n query SdkReturnEligibility($orderId: ID!) {\n returnEligibilityForOrder(orderId: $orderId) {\n orderId\n eligible\n reason\n returnWindowEndsAt\n lines {\n orderLineId\n productVariantId\n productVariantName\n productVariantSku\n fulfilledQty\n returnableQty\n creditedQty\n correctionCredits {\n \n orderLineId\n creditNoteId\n creditNoteNumber\n ledger\n quantity\n amount\n\n }\n unitPriceWithTax\n unitPriceWithTaxUnrounded\n }\n }\n }\n";
|
|
528
|
+
/**
|
|
529
|
+
* {@link RETURN_ELIGIBILITY_QUERY} for an engine released before 2026-10-09, which has no
|
|
530
|
+
* `creditedQty`/`correctionCredits`: GraphQL refuses a whole document over one unknown field.
|
|
531
|
+
*/
|
|
532
|
+
export declare const RETURN_ELIGIBILITY_QUERY_LEGACY = "\n query SdkReturnEligibilityLegacy($orderId: ID!) {\n returnEligibilityForOrder(orderId: $orderId) {\n orderId\n eligible\n reason\n returnWindowEndsAt\n lines {\n orderLineId\n productVariantId\n productVariantName\n productVariantSku\n fulfilledQty\n returnableQty\n unitPriceWithTax\n unitPriceWithTaxUnrounded\n }\n }\n }\n";
|
|
533
|
+
export declare const RETURN_SETTLEMENT_OPTIONS_QUERY = "\n query SdkReturnSettlementOptions($returnId: ID!) {\n returnSettlementOptions(returnId: $returnId) {\n returnId\n currencyCode\n settleable\n blockedBy\n refund {\n available\n reasonCode\n payments {\n paymentId\n method\n refundable\n }\n }\n creditNote {\n available\n ledger\n reasonCode\n invoiceNumber\n }\n account {\n available\n reasonCode\n message\n held\n book\n }\n initialMethod\n defaultAmount\n amountCeiling\n correctionCredits {\n \n orderLineId\n creditNoteId\n creditNoteNumber\n ledger\n quantity\n amount\n\n }\n shippingCeiling\n alreadyCredited {\n available\n reasonCode\n creditNotes {\n \n creditNoteId\n creditNoteNumber\n ledger\n\n }\n }\n }\n }\n";
|
|
534
|
+
/**
|
|
535
|
+
* {@link RETURN_SETTLEMENT_OPTIONS_QUERY} for an engine with `alreadyCredited` but released before
|
|
536
|
+
* the account option named the store's book (incentives sprint 8 PR 4).
|
|
537
|
+
*/
|
|
538
|
+
export declare const RETURN_SETTLEMENT_OPTIONS_QUERY_BEFORE_BOOK = "\n query SdkReturnSettlementOptionsBeforeBook($returnId: ID!) {\n returnSettlementOptions(returnId: $returnId) {\n returnId\n currencyCode\n settleable\n blockedBy\n refund {\n available\n reasonCode\n payments {\n paymentId\n method\n refundable\n }\n }\n creditNote {\n available\n ledger\n reasonCode\n invoiceNumber\n }\n account {\n available\n reasonCode\n message\n held\n }\n initialMethod\n defaultAmount\n amountCeiling\n correctionCredits {\n \n orderLineId\n creditNoteId\n creditNoteNumber\n ledger\n quantity\n amount\n\n }\n shippingCeiling\n alreadyCredited {\n available\n reasonCode\n creditNotes {\n \n creditNoteId\n creditNoteNumber\n ledger\n\n }\n }\n }\n }\n";
|
|
539
|
+
/**
|
|
540
|
+
* {@link RETURN_SETTLEMENT_OPTIONS_QUERY} for an engine with the account settlement (2026-10-10)
|
|
541
|
+
* but released before `alreadyCredited` (ruling U15).
|
|
542
|
+
*/
|
|
543
|
+
export declare const RETURN_SETTLEMENT_OPTIONS_QUERY_BEFORE_CLOSE = "\n query SdkReturnSettlementOptionsBeforeClose($returnId: ID!) {\n returnSettlementOptions(returnId: $returnId) {\n returnId\n currencyCode\n settleable\n blockedBy\n refund {\n available\n reasonCode\n payments {\n paymentId\n method\n refundable\n }\n }\n creditNote {\n available\n ledger\n reasonCode\n invoiceNumber\n }\n account {\n available\n reasonCode\n message\n held\n }\n initialMethod\n defaultAmount\n amountCeiling\n correctionCredits {\n \n orderLineId\n creditNoteId\n creditNoteNumber\n ledger\n quantity\n amount\n\n }\n shippingCeiling\n }\n }\n";
|
|
544
|
+
/**
|
|
545
|
+
* {@link RETURN_SETTLEMENT_OPTIONS_QUERY} for an engine with `shippingCeiling` but released before
|
|
546
|
+
* the account settlement (2026-10-10).
|
|
547
|
+
*/
|
|
548
|
+
export declare const RETURN_SETTLEMENT_OPTIONS_QUERY_BEFORE_ACCOUNT = "\n query SdkReturnSettlementOptionsBeforeAccount($returnId: ID!) {\n returnSettlementOptions(returnId: $returnId) {\n returnId\n currencyCode\n settleable\n blockedBy\n refund {\n available\n reasonCode\n payments {\n paymentId\n method\n refundable\n }\n }\n creditNote {\n available\n ledger\n reasonCode\n invoiceNumber\n }\n initialMethod\n defaultAmount\n amountCeiling\n correctionCredits {\n \n orderLineId\n creditNoteId\n creditNoteNumber\n ledger\n quantity\n amount\n\n }\n shippingCeiling\n }\n }\n";
|
|
549
|
+
/**
|
|
550
|
+
* {@link RETURN_SETTLEMENT_OPTIONS_QUERY} for an engine with the correction credits (2026-10-09)
|
|
551
|
+
* but released before `shippingCeiling`.
|
|
552
|
+
*/
|
|
553
|
+
export declare const RETURN_SETTLEMENT_OPTIONS_QUERY_BEFORE_SHIPPING = "\n query SdkReturnSettlementOptionsBeforeShipping($returnId: ID!) {\n returnSettlementOptions(returnId: $returnId) {\n returnId\n currencyCode\n settleable\n blockedBy\n refund {\n available\n reasonCode\n payments {\n paymentId\n method\n refundable\n }\n }\n creditNote {\n available\n ledger\n reasonCode\n invoiceNumber\n }\n initialMethod\n defaultAmount\n amountCeiling\n correctionCredits {\n \n orderLineId\n creditNoteId\n creditNoteNumber\n ledger\n quantity\n amount\n\n }\n }\n }\n";
|
|
554
|
+
/**
|
|
555
|
+
* {@link RETURN_SETTLEMENT_OPTIONS_QUERY} for an engine with the plan (W9-47) but released before
|
|
556
|
+
* 2026-10-09, which has no `amountCeiling`/`correctionCredits`.
|
|
557
|
+
*/
|
|
558
|
+
export declare const RETURN_SETTLEMENT_OPTIONS_QUERY_LEGACY = "\n query SdkReturnSettlementOptionsLegacy($returnId: ID!) {\n returnSettlementOptions(returnId: $returnId) {\n returnId\n currencyCode\n settleable\n blockedBy\n refund {\n available\n reasonCode\n payments {\n paymentId\n method\n refundable\n }\n }\n creditNote {\n available\n ledger\n reasonCode\n invoiceNumber\n }\n initialMethod\n defaultAmount\n }\n }\n";
|
|
559
|
+
/** `admin.returns.numbering`: the store's RMA code format. */
|
|
560
|
+
export interface ReturnNumberingModule {
|
|
561
|
+
/**
|
|
562
|
+
* The format the store's next RMA code takes (the defaults until it is first set). Needs
|
|
563
|
+
* `ReadOrderReturn`.
|
|
564
|
+
*
|
|
565
|
+
* @effect read
|
|
566
|
+
*/
|
|
567
|
+
get(options?: Call): Promise<ReturnNumberingConfig>;
|
|
568
|
+
/**
|
|
569
|
+
* Change the format; a field left out keeps its value, `digits` clamps to 3..8. Codes already
|
|
570
|
+
* issued keep theirs. A year format other than `none`, `short` or `full` is refused
|
|
571
|
+
* `NUMBERING_YEAR_FORMAT_INVALID`, a `digits` that is not a whole number
|
|
572
|
+
* `RETURN_NUMBERING_CONFIG_INVALID`. Needs `UpdateOrderReturn`.
|
|
573
|
+
*
|
|
574
|
+
* @effect write
|
|
575
|
+
*/
|
|
576
|
+
set(input: UpdateReturnNumberingConfigInput, options?: Call): Promise<ReturnNumberingConfig>;
|
|
577
|
+
}
|
|
578
|
+
/** `admin.returns.settings`: the store's own return policy (G80: typed per domain). */
|
|
579
|
+
export interface ReturnsSettingsModule {
|
|
580
|
+
/**
|
|
581
|
+
* The active store's OWN return policy, as its channel stores it. Writing it is
|
|
582
|
+
* `tenant`/channel settings' (a later `.set()`).
|
|
583
|
+
*
|
|
584
|
+
* @effect read
|
|
585
|
+
*/
|
|
586
|
+
get(options?: Call): Promise<ReturnsSettings>;
|
|
587
|
+
}
|
|
588
|
+
export interface ReturnsModule {
|
|
589
|
+
/**
|
|
590
|
+
* One return with its lines and its status log (newest first), or `null`
|
|
591
|
+
* when this store holds no return with that id (another store's return answers the same).
|
|
592
|
+
* Needs `ReadOrderReturn`.
|
|
593
|
+
*
|
|
594
|
+
* It also says which steps the return offers now (`allowedActions`), what it refunds by
|
|
595
|
+
* default (`refundEstimate`, per line too) and who the customer is (`customer`, for a caller
|
|
596
|
+
* holding `ReadCustomer` or `ReadOrder`). `allowedActions` is a PLAN: every write judges again.
|
|
597
|
+
* Against an engine released before 2026-10-11 the call retries once without them (and keeps
|
|
598
|
+
* doing so for this client), and they are absent.
|
|
599
|
+
*
|
|
600
|
+
* @effect read
|
|
601
|
+
*/
|
|
602
|
+
get(id: string, options?: Call): Promise<OrderReturnDetail | null>;
|
|
603
|
+
/**
|
|
604
|
+
* Every return of one order, newest first. Needs `ReadOrderReturn`. Degrades
|
|
605
|
+
* like {@link ReturnsModule.get} against an older engine.
|
|
606
|
+
*
|
|
607
|
+
* @effect read
|
|
608
|
+
*/
|
|
609
|
+
forOrder(orderId: string, options?: Call): Promise<OrderReturn[]>;
|
|
610
|
+
/**
|
|
611
|
+
* What of an order can still be returned, line by line, and the return
|
|
612
|
+
* window. The window is reported, never enforced here: an admin may return
|
|
613
|
+
* outside it. Needs `ReadOrderReturn`.
|
|
614
|
+
*
|
|
615
|
+
* A unit an invoice correction credited whole is not returnable: each line
|
|
616
|
+
* says how many (`creditedQty`) and on which credit notes
|
|
617
|
+
* (`correctionCredits`), and a return asking for more is refused
|
|
618
|
+
* `RETURN_QUANTITY_ALREADY_CREDITED`. An engine released before 2026-10-09
|
|
619
|
+
* has none of these: the call then retries once without them (and keeps doing
|
|
620
|
+
* so for this client), and the fields are absent.
|
|
621
|
+
*
|
|
622
|
+
* @effect read
|
|
623
|
+
*/
|
|
624
|
+
eligibility(orderId: string, options?: Call): Promise<ReturnEligibility>;
|
|
625
|
+
/**
|
|
626
|
+
* How a return can be settled now: whether it is settleable (and why not),
|
|
627
|
+
* which methods are open (with the payments a refund may name and what each
|
|
628
|
+
* can still give back), and which method to preselect. Needs
|
|
629
|
+
* `ReadOrderReturn` AND `ReadOrder`: it names the order's payments.
|
|
630
|
+
*
|
|
631
|
+
* This is the PLAN. The write ({@link ReturnsModule.settle}) loads its own facts and judges
|
|
632
|
+
* again, so settling can still be refused when something changed in between,
|
|
633
|
+
* and an `amountOverride` above a payment's headroom is refused there. A
|
|
634
|
+
* return this store does not hold is a `NotFoundError` (`ENTITY_NOT_FOUND`).
|
|
635
|
+
*
|
|
636
|
+
* When an invoice correction already credited goods of the return,
|
|
637
|
+
* `defaultAmount` is what is left of them, `amountCeiling` the most an
|
|
638
|
+
* override may state (above it: `RETURN_AMOUNT_ALREADY_CREDITED`), and
|
|
639
|
+
* `correctionCredits` names the credit notes. When one credited the order's
|
|
640
|
+
* shipping, `shippingCeiling` is the most a shipping refund may state (above
|
|
641
|
+
* it: `RETURN_SHIPPING_ALREADY_CREDITED`). When corrections credited ALL of
|
|
642
|
+
* the goods, `alreadyCredited.available` opens
|
|
643
|
+
* {@link ReturnsModule.closeAlreadyCredited}.
|
|
644
|
+
*
|
|
645
|
+
* `account` says whether the money can go onto the customer's account instead
|
|
646
|
+
* ({@link ReturnsModule.settle} with method `account`): only where the store keeps the
|
|
647
|
+
* accounts-receivable ledger itself and the customer has a credit account,
|
|
648
|
+
* with what the order's settled payments still hold (`held`).
|
|
649
|
+
*
|
|
650
|
+
* Needs an engine that serves `returnSettlementOptions`; against an older one
|
|
651
|
+
* this call fails validation and nothing else does. Each newer field an older
|
|
652
|
+
* engine does not know (`alreadyCredited`, then `account`, `shippingCeiling`, then
|
|
653
|
+
* `amountCeiling`/`correctionCredits`) is dropped by retrying once with the next
|
|
654
|
+
* older document, and this client keeps asking that one.
|
|
655
|
+
*
|
|
656
|
+
* @effect read
|
|
657
|
+
*/
|
|
658
|
+
settlementOptions(returnId: string, options?: Call): Promise<ReturnSettlementOptions>;
|
|
659
|
+
/**
|
|
660
|
+
* Closes a return whose goods invoice corrections already credited in full:
|
|
661
|
+
* "Close — already credited on CN-…" (ruling U15). Such a return can never be
|
|
662
|
+
* settled (nothing is left) and, once received, never cancelled. The close
|
|
663
|
+
* moves NO money and touches no stock: the return reads `settled` with
|
|
664
|
+
* `settledAmount` 0, no `settlementMethod`, and `alreadyCreditedBy` naming
|
|
665
|
+
* the credit notes. `reason` goes on its status history (default: it names
|
|
666
|
+
* the credit notes). Needs `UpdateOrderReturn`.
|
|
667
|
+
*
|
|
668
|
+
* Open exactly when `settlementOptions(...).alreadyCredited.available`; the
|
|
669
|
+
* engine judges again under the order's money turn. Repeating it on a return
|
|
670
|
+
* it closed answers that return unchanged. Refusals, all coded:
|
|
671
|
+
* `RETURN_NOT_ALREADY_CREDITED` (money is still left: settle it; or no
|
|
672
|
+
* correction names its goods), `RETURN_CLOSE_STATE_CONFLICT` (it cannot be
|
|
673
|
+
* settled now: requested, settled, a refund in flight, a receipt required),
|
|
674
|
+
* `IDEMPOTENCY_OUTCOME_UNKNOWN` (a refund it waits on was never confirmed),
|
|
675
|
+
* `ORDER_MONEY_ACTION_IN_PROGRESS` (retryable: another money action on the
|
|
676
|
+
* order holds its turn) and `ENTITY_NOT_FOUND` (not this store's return).
|
|
677
|
+
*
|
|
678
|
+
* Needs an engine that serves `closeReturnAlreadyCredited`; against an older
|
|
679
|
+
* one the call fails validation.
|
|
680
|
+
*
|
|
681
|
+
* @effect irreversible
|
|
682
|
+
*/
|
|
683
|
+
closeAlreadyCredited(returnId: string, input?: {
|
|
684
|
+
reason?: string | null;
|
|
685
|
+
}, options?: Call): Promise<OrderReturnDetail>;
|
|
686
|
+
/**
|
|
687
|
+
* A page of the store's returns, newest first, each with `refundEstimate` and `customer` (no
|
|
688
|
+
* second request for names). Needs `ReadOrderReturn`. Retries without the two fields against an
|
|
689
|
+
* engine released before 2026-10-11, as `get` does.
|
|
690
|
+
*
|
|
691
|
+
* @effect read
|
|
692
|
+
*/
|
|
693
|
+
list(filter?: ReturnListFilter, options?: Call): Promise<OrderReturnList>;
|
|
694
|
+
/**
|
|
695
|
+
* How many returns wait for review (state `requested`): the count behind a "Returns" badge.
|
|
696
|
+
* Needs `ReadOrderReturn`.
|
|
697
|
+
*
|
|
698
|
+
* @effect read
|
|
699
|
+
*/
|
|
700
|
+
openCount(options?: Call): Promise<number>;
|
|
701
|
+
/**
|
|
702
|
+
* Create a return on the order's customer's behalf. Refused `RETURN_INPUT_INVALID` (a quantity
|
|
703
|
+
* above what is returnable, a line of another order), `RETURN_QUANTITY_ALREADY_CREDITED` (units
|
|
704
|
+
* an invoice correction credited), `RETURN_WINDOW_CLOSED` (after the window, unless
|
|
705
|
+
* `overrideWindow`), `CUSTOMER_ERASED` (the customer's words for an erased customer). Needs
|
|
706
|
+
* `CreateOrderReturn`.
|
|
707
|
+
*
|
|
708
|
+
* @effect write
|
|
709
|
+
*/
|
|
710
|
+
create(input: CreateReturnInput, options?: Call): Promise<OrderReturn>;
|
|
711
|
+
/**
|
|
712
|
+
* Approve a requested return, line by line. Refused `RETURN_STATE_INVALID` unless it is
|
|
713
|
+
* requested (`allowedActions` says `APPROVE`), `RETURN_INPUT_INVALID` for a decision the
|
|
714
|
+
* lines cannot take, `RETURN_QUANTITY_ALREADY_CREDITED` / `RETURN_AMOUNT_ALREADY_CREDITED` on a
|
|
715
|
+
* line an invoice correction credited since the request. Needs `UpdateOrderReturn`.
|
|
716
|
+
*
|
|
717
|
+
* @effect write
|
|
718
|
+
*/
|
|
719
|
+
approve(id: string, input: ApproveReturnInput, options?: Call): Promise<OrderReturn>;
|
|
720
|
+
/**
|
|
721
|
+
* Reject a requested return, for good: it cannot be reopened. The reason is recorded and shown
|
|
722
|
+
* to the customer. Refused `RETURN_STATE_INVALID` unless it is requested,
|
|
723
|
+
* `RETURN_INPUT_INVALID` without a reason. Needs `UpdateOrderReturn`.
|
|
724
|
+
*
|
|
725
|
+
* @effect destructive
|
|
726
|
+
*/
|
|
727
|
+
reject(id: string, reason: string, options?: Call): Promise<OrderReturn>;
|
|
728
|
+
/**
|
|
729
|
+
* Cancel a return, for good: it cannot be reopened, and its quantities become returnable
|
|
730
|
+
* again. Only while requested or approved and before any goods came back; otherwise
|
|
731
|
+
* `RETURN_STATE_INVALID` (`details[0].reasonCode` `STATE` or `RECEIPT_RECORDED`, as
|
|
732
|
+
* `allowedActions` reports it). Needs `UpdateOrderReturn`.
|
|
733
|
+
*
|
|
734
|
+
* @effect destructive
|
|
735
|
+
*/
|
|
736
|
+
cancel(id: string, input?: {
|
|
737
|
+
reason?: string | null;
|
|
738
|
+
}, options?: Call): Promise<OrderReturn>;
|
|
739
|
+
/**
|
|
740
|
+
* Record goods that came back, graded per line (restock to a location, or write off).
|
|
741
|
+
* Receipts add up; the first moves the return to `items_received`. Refused
|
|
742
|
+
* `RETURN_STATE_INVALID` outside approved/items_received or when nothing approved is still to
|
|
743
|
+
* come back (`NOTHING_TO_RECEIVE`), `RETURN_INPUT_INVALID` for a quantity above what is still
|
|
744
|
+
* to come back or a location the store does not hold. Restocked units raise stock at that
|
|
745
|
+
* location. Needs `UpdateOrderReturn`.
|
|
746
|
+
*
|
|
747
|
+
* @effect write
|
|
748
|
+
*/
|
|
749
|
+
recordReceipt(id: string, input: RecordReturnReceiptInput, options?: Call): Promise<OrderReturn>;
|
|
750
|
+
/**
|
|
751
|
+
* Append to the merchant's internal note (never shown to the customer). Refused
|
|
752
|
+
* `RETURN_INPUT_INVALID` for an empty note. Needs `UpdateOrderReturn`.
|
|
753
|
+
*
|
|
754
|
+
* @effect write
|
|
755
|
+
*/
|
|
756
|
+
addNote(id: string, note: string, options?: Call): Promise<OrderReturn>;
|
|
757
|
+
/**
|
|
758
|
+
* Settle a received return with money: `refund` (to a settled payment of the order),
|
|
759
|
+
* `store_credit` (a credit note) or `account` (the money goes on the customer's account,
|
|
760
|
+
* ruling U10). Read {@link ReturnsModule.settlementOptions} first: it says which methods are
|
|
761
|
+
* open, with the engine's reasons and figures. The engine judges again here and answers the
|
|
762
|
+
* settled return, with its history. Needs `UpdateOrderReturn`.
|
|
763
|
+
*
|
|
764
|
+
* A refund that a gateway settles later leaves the return `settlement_pending` (`refundId` names
|
|
765
|
+
* the refund) until the provider confirms it; an offline method settles it at once.
|
|
766
|
+
*
|
|
767
|
+
* **Pass `options.idempotencyKey`, one per settlement attempt, and reuse it for every send of
|
|
768
|
+
* that attempt.** A repeat under the same key answers the first one's outcome (the settled
|
|
769
|
+
* return, or the same coded refusal) and never moves money again; a repeat while the first is
|
|
770
|
+
* still running is `IDEMPOTENCY_IN_PROGRESS` (wait, then send it again under the same key); the
|
|
771
|
+
* same key with a different `input` is `IDEMPOTENCY_CONFLICT` (409). Without a key the return's
|
|
772
|
+
* own state still refuses a second settlement (`RETURN_SETTLE_STATE_INVALID`), but a resend
|
|
773
|
+
* cannot learn what the first send did. A refusal ends the attempt: a changed request goes
|
|
774
|
+
* under a new key.
|
|
775
|
+
*
|
|
776
|
+
* Refusals, all coded:
|
|
777
|
+
* - `REFUND_ORPHAN_EXISTS` (ruling G57): a refund of the invoiced order stands that no credit
|
|
778
|
+
* note names, so money (a refund, an accounts-receivable credit, the account) is withheld; a
|
|
779
|
+
* credit note on a retail invoice moves no money and stays open;
|
|
780
|
+
* - `RETURN_AMOUNT_ALREADY_CREDITED` / `RETURN_SHIPPING_ALREADY_CREDITED` (ruling G66): an
|
|
781
|
+
* invoice correction already credited these goods or the shipping (`amountCeiling`,
|
|
782
|
+
* `shippingCeiling` say what is left);
|
|
783
|
+
* - `ORDER_MONEY_ACTION_IN_PROGRESS` (409, ruling G72): another money action on the order (a
|
|
784
|
+
* correction, another settlement) held its turn past 30 seconds. Nothing ran: send it again
|
|
785
|
+
* (this SDK repeats no write on its own);
|
|
786
|
+
* - `IDEMPOTENCY_OUTCOME_UNKNOWN` (`error.outcomeUnknown`): the refund reached the payment
|
|
787
|
+
* provider and its answer never came, so the money may have moved. The return waits in
|
|
788
|
+
* `settlement_pending` and nothing settles it again until the provider's answer is recorded on
|
|
789
|
+
* the refund (`payments.reconcileRefund`): made completes the return, not made lets it be
|
|
790
|
+
* settled again;
|
|
791
|
+
* - `RETURN_SETTLE_STATE_INVALID` (422): already settled, a refund on its way, a receipt the
|
|
792
|
+
* store requires first, or requested/rejected/cancelled (`details[0].code` names which:
|
|
793
|
+
* `ALREADY_SETTLED`, `IN_PROGRESS`, `RECEIPT_REQUIRED`, `STATE`, as `settlementOptions.blockedBy`);
|
|
794
|
+
* - `RETURN_SETTLE_INPUT_INVALID` (400): an amount that is not a whole number of minor units of
|
|
795
|
+
* 0 or more, nothing to settle, a `paymentId` the order does not hold or that is not settled;
|
|
796
|
+
* - `RETURN_SETTLE_NO_REFUNDABLE_PAYMENT`: no settled payment can carry the refund;
|
|
797
|
+
* - `REFUND_EXCEEDS_SETTLED` / `REFUND_EXCEEDS_PAYMENT`: more than the order or the payment can
|
|
798
|
+
* give back now;
|
|
799
|
+
* - `RETURN_SETTLE_REFUND_REFUSED`: the refund was refused before the payment provider was
|
|
800
|
+
* asked, so nothing moved (`details[0].code` says why); a refund that fails after the
|
|
801
|
+
* provider was asked is `IDEMPOTENCY_OUTCOME_UNKNOWN` instead, the return parked on it;
|
|
802
|
+
* - `RETURN_SETTLE_CREDIT_NOTE_UNAVAILABLE`: this server cannot issue that credit note;
|
|
803
|
+
* - `RETURN_ACCOUNT_CREDIT_UNAVAILABLE` (`details[0].code` is the account's reason) /
|
|
804
|
+
* `RETURN_ACCOUNT_CREDIT_EXCEEDS_HELD`;
|
|
805
|
+
* - `RETURN_NOT_FOUND` (404): this store holds no such return (another store's answers the same).
|
|
806
|
+
*
|
|
807
|
+
* Needs an engine that takes `settleReturn(idempotencyKey)` (2026-10-10); an older one fails
|
|
808
|
+
* validation and settles nothing.
|
|
809
|
+
*
|
|
810
|
+
* @effect money
|
|
811
|
+
*/
|
|
812
|
+
settle(returnId: string, input: SettleReturnInput, options?: Call): Promise<OrderReturnDetail>;
|
|
813
|
+
/** The store's RMA code format. */
|
|
814
|
+
numbering: ReturnNumberingModule;
|
|
815
|
+
/** The store's own return policy. */
|
|
816
|
+
settings: ReturnsSettingsModule;
|
|
817
|
+
}
|
|
818
|
+
export declare function createReturnsModule(transport: Transport): ReturnsModule;
|