@sixtyninecommerce/admin 0.10.0 → 0.12.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.
Files changed (302) hide show
  1. package/README.md +5772 -118
  2. package/dist/auth/index.d.ts +7 -1
  3. package/dist/auth/index.js +8 -1
  4. package/dist/catalog/assets.d.ts +120 -8
  5. package/dist/catalog/assets.js +98 -12
  6. package/dist/catalog/collections.d.ts +279 -14
  7. package/dist/catalog/collections.js +246 -15
  8. package/dist/catalog/documents.d.ts +142 -0
  9. package/dist/catalog/documents.js +114 -0
  10. package/dist/catalog/index.d.ts +54 -6
  11. package/dist/catalog/index.js +10 -1
  12. package/dist/catalog/metadata.d.ts +244 -0
  13. package/dist/catalog/metadata.js +220 -0
  14. package/dist/catalog/products.d.ts +159 -19
  15. package/dist/catalog/products.js +88 -13
  16. package/dist/catalog/properties.d.ts +140 -14
  17. package/dist/catalog/properties.js +65 -1
  18. package/dist/catalog/recommendations.d.ts +288 -0
  19. package/dist/catalog/recommendations.js +237 -0
  20. package/dist/catalog/reviews.d.ts +381 -0
  21. package/dist/catalog/reviews.js +325 -0
  22. package/dist/catalog/types.d.ts +17 -1
  23. package/dist/catalog/types.js +10 -0
  24. package/dist/catalog/variant-find.d.ts +136 -0
  25. package/dist/catalog/variant-find.js +239 -0
  26. package/dist/catalog/variants.d.ts +293 -26
  27. package/dist/catalog/variants.js +164 -7
  28. package/dist/catalog/visibility.d.ts +38 -7
  29. package/dist/catalog/visibility.js +19 -1
  30. package/dist/client.d.ts +121 -9
  31. package/dist/client.js +53 -14
  32. package/dist/content/assets.d.ts +285 -0
  33. package/dist/content/assets.js +181 -0
  34. package/dist/content/forms.d.ts +332 -1
  35. package/dist/content/forms.js +140 -4
  36. package/dist/content/items.d.ts +292 -0
  37. package/dist/content/items.js +170 -0
  38. package/dist/content/menus.d.ts +254 -0
  39. package/dist/content/menus.js +70 -0
  40. package/dist/content/strings.d.ts +137 -0
  41. package/dist/content/strings.js +82 -0
  42. package/dist/content/types.d.ts +282 -0
  43. package/dist/content/types.js +100 -0
  44. package/dist/customers/age-verification.d.ts +66 -0
  45. package/dist/customers/age-verification.js +79 -0
  46. package/dist/customers/credit.d.ts +263 -0
  47. package/dist/customers/credit.js +244 -0
  48. package/dist/customers/delivery-preferences.d.ts +120 -0
  49. package/dist/customers/delivery-preferences.js +97 -0
  50. package/dist/customers/delivery-terms.d.ts +44 -0
  51. package/dist/customers/delivery-terms.js +32 -0
  52. package/dist/customers/groups.d.ts +207 -0
  53. package/dist/customers/groups.js +438 -0
  54. package/dist/customers/index.d.ts +462 -37
  55. package/dist/customers/index.js +317 -40
  56. package/dist/customers/invitation-status.d.ts +57 -0
  57. package/dist/customers/invitation-status.js +21 -0
  58. package/dist/customers/notes.d.ts +67 -0
  59. package/dist/customers/notes.js +51 -0
  60. package/dist/customers/notification-recipients.d.ts +97 -0
  61. package/dist/customers/notification-recipients.js +84 -0
  62. package/dist/customers/saved-lists.d.ts +42 -0
  63. package/dist/customers/saved-lists.js +61 -0
  64. package/dist/customers/vat.d.ts +83 -0
  65. package/dist/customers/vat.js +46 -0
  66. package/dist/customers/wire.d.ts +20 -0
  67. package/dist/customers/wire.js +35 -0
  68. package/dist/documents/ar.d.ts +307 -0
  69. package/dist/documents/ar.js +254 -0
  70. package/dist/documents/emails.d.ts +150 -0
  71. package/dist/documents/emails.js +220 -0
  72. package/dist/documents/index.d.ts +744 -21
  73. package/dist/documents/index.js +438 -24
  74. package/dist/documents/pdf.d.ts +2 -0
  75. package/dist/documents/pdf.js +11 -0
  76. package/dist/fulfillments/create.d.ts +167 -0
  77. package/dist/fulfillments/create.js +216 -0
  78. package/dist/fulfillments/index.d.ts +163 -11
  79. package/dist/fulfillments/index.js +135 -6
  80. package/dist/fulfillments/payment-policy.d.ts +64 -0
  81. package/dist/fulfillments/payment-policy.js +140 -0
  82. package/dist/fulfillments/warehouse.d.ts +724 -0
  83. package/dist/fulfillments/warehouse.js +914 -0
  84. package/dist/geo/index.d.ts +119 -0
  85. package/dist/geo/index.js +107 -0
  86. package/dist/index.d.ts +147 -39
  87. package/dist/index.js +51 -12
  88. package/dist/integrations/afas-actions.d.ts +234 -0
  89. package/dist/integrations/afas-actions.js +310 -0
  90. package/dist/integrations/afas-types.d.ts +483 -0
  91. package/dist/integrations/afas-types.js +5 -0
  92. package/dist/integrations/afas.d.ts +234 -0
  93. package/dist/integrations/afas.js +290 -0
  94. package/dist/integrations/connections.d.ts +103 -0
  95. package/dist/integrations/connections.js +55 -0
  96. package/dist/integrations/esp.d.ts +313 -0
  97. package/dist/integrations/esp.js +169 -0
  98. package/dist/integrations/exact-online-types.d.ts +965 -0
  99. package/dist/integrations/exact-online-types.js +6 -0
  100. package/dist/integrations/exact-online.d.ts +784 -0
  101. package/dist/integrations/exact-online.js +1089 -0
  102. package/dist/integrations/index.d.ts +44 -3
  103. package/dist/integrations/index.js +23 -3
  104. package/dist/integrations/pipeline-discoveries.d.ts +65 -0
  105. package/dist/integrations/pipeline-discoveries.js +65 -0
  106. package/dist/integrations/pipeline-keys.d.ts +13 -0
  107. package/dist/integrations/pipeline-keys.js +22 -0
  108. package/dist/integrations/pipeline-runs.d.ts +119 -0
  109. package/dist/integrations/pipeline-runs.js +87 -0
  110. package/dist/integrations/pipelines.d.ts +87 -15
  111. package/dist/integrations/pipelines.js +41 -22
  112. package/dist/integrations/price-import.d.ts +223 -0
  113. package/dist/integrations/price-import.js +124 -0
  114. package/dist/integrations/types.d.ts +367 -3
  115. package/dist/integrations/types.js +4 -3
  116. package/dist/locations/index.d.ts +66 -0
  117. package/dist/locations/index.js +31 -0
  118. package/dist/meta/index.d.ts +172 -0
  119. package/dist/metafields/index.d.ts +8 -1
  120. package/dist/metafields/index.js +10 -0
  121. package/dist/orders/cancel-with-money.d.ts +237 -0
  122. package/dist/orders/cancel-with-money.js +155 -0
  123. package/dist/orders/commit-edit.d.ts +23 -1
  124. package/dist/orders/commit-edit.js +19 -2
  125. package/dist/orders/deposit-policy.d.ts +3 -1
  126. package/dist/orders/drafts.d.ts +800 -0
  127. package/dist/orders/drafts.js +771 -0
  128. package/dist/orders/fields.d.ts +245 -0
  129. package/dist/orders/fields.js +188 -0
  130. package/dist/orders/get.d.ts +29 -19
  131. package/dist/orders/get.js +17 -8
  132. package/dist/orders/index.d.ts +66 -15
  133. package/dist/orders/index.js +25 -2
  134. package/dist/orders/lifecycle.d.ts +128 -0
  135. package/dist/orders/lifecycle.js +158 -0
  136. package/dist/orders/line-price-preview.d.ts +7 -2
  137. package/dist/orders/list.d.ts +243 -0
  138. package/dist/orders/list.js +487 -0
  139. package/dist/orders/manual-discounts.d.ts +13 -5
  140. package/dist/orders/manual-pricing.d.ts +5 -0
  141. package/dist/orders/money-view.d.ts +149 -0
  142. package/dist/orders/money-view.js +99 -0
  143. package/dist/orders/order-entry.d.ts +20 -7
  144. package/dist/orders/plan-edit.d.ts +34 -2
  145. package/dist/orders/plan-edit.js +112 -11
  146. package/dist/orders/settings.d.ts +201 -0
  147. package/dist/orders/settings.js +325 -0
  148. package/dist/orders/status.d.ts +159 -13
  149. package/dist/orders/status.js +21 -0
  150. package/dist/orders/surcharges.d.ts +20 -1
  151. package/dist/orders/surcharges.js +37 -11
  152. package/dist/payments/account-credit.d.ts +46 -0
  153. package/dist/payments/account-credit.js +42 -0
  154. package/dist/payments/ar.d.ts +292 -0
  155. package/dist/payments/ar.js +223 -0
  156. package/dist/payments/connected-account.d.ts +47 -0
  157. package/dist/payments/connected-account.js +61 -0
  158. package/dist/payments/credit-noted-fields.d.ts +19 -0
  159. package/dist/payments/credit-noted-fields.js +69 -0
  160. package/dist/payments/customer-consent.d.ts +30 -0
  161. package/dist/payments/customer-consent.js +49 -0
  162. package/dist/payments/index.d.ts +340 -19
  163. package/dist/payments/index.js +151 -1
  164. package/dist/payments/methods.d.ts +303 -8
  165. package/dist/payments/methods.js +337 -7
  166. package/dist/payments/mollie-methods.d.ts +159 -0
  167. package/dist/payments/mollie-methods.js +141 -0
  168. package/dist/payments/payment-links.d.ts +180 -0
  169. package/dist/payments/payment-links.js +97 -0
  170. package/dist/payments/provider-keys.d.ts +150 -0
  171. package/dist/payments/provider-keys.js +118 -0
  172. package/dist/payments/providers.d.ts +86 -11
  173. package/dist/payments/providers.js +29 -0
  174. package/dist/payments/requests.d.ts +147 -0
  175. package/dist/payments/requests.js +93 -0
  176. package/dist/payments/store-credit-fields.d.ts +15 -0
  177. package/dist/payments/store-credit-fields.js +51 -0
  178. package/dist/pickups/index.d.ts +106 -0
  179. package/dist/pickups/index.js +108 -0
  180. package/dist/platform/channels.d.ts +132 -0
  181. package/dist/platform/channels.js +128 -0
  182. package/dist/platform/email-gateways.d.ts +165 -0
  183. package/dist/platform/email-gateways.js +78 -0
  184. package/dist/platform/geo.d.ts +123 -0
  185. package/dist/platform/geo.js +144 -0
  186. package/dist/platform/tax.d.ts +162 -0
  187. package/dist/platform/tax.js +169 -0
  188. package/dist/pos/anomalies.d.ts +158 -0
  189. package/dist/pos/anomalies.js +64 -0
  190. package/dist/pos/assisted-selling.d.ts +79 -0
  191. package/dist/pos/assisted-selling.js +38 -0
  192. package/dist/pos/exchanges.d.ts +108 -0
  193. package/dist/pos/exchanges.js +22 -0
  194. package/dist/pos/gift-cards.d.ts +135 -0
  195. package/dist/pos/gift-cards.js +47 -0
  196. package/dist/pos/index.d.ts +2370 -58
  197. package/dist/pos/index.js +854 -7
  198. package/dist/pos/no-receipt.d.ts +94 -0
  199. package/dist/pos/no-receipt.js +25 -0
  200. package/dist/pos/offline-sales.d.ts +228 -0
  201. package/dist/pos/offline-sales.js +170 -0
  202. package/dist/pos/pay-by-link.d.ts +143 -0
  203. package/dist/pos/pay-by-link.js +57 -0
  204. package/dist/pos/quick-keys.d.ts +103 -0
  205. package/dist/pos/quick-keys.js +45 -0
  206. package/dist/pos/reports.d.ts +360 -0
  207. package/dist/pos/reports.js +62 -0
  208. package/dist/pos/returns.d.ts +244 -0
  209. package/dist/pos/returns.js +83 -0
  210. package/dist/pricing/bulk-coupons.d.ts +139 -0
  211. package/dist/pricing/bulk-coupons.js +112 -0
  212. package/dist/pricing/index.d.ts +174 -4
  213. package/dist/pricing/index.js +174 -1
  214. package/dist/pricing/price-lists.d.ts +606 -0
  215. package/dist/pricing/price-lists.js +600 -0
  216. package/dist/purchasing/alerts.d.ts +104 -0
  217. package/dist/purchasing/alerts.js +88 -0
  218. package/dist/purchasing/backorders.d.ts +61 -0
  219. package/dist/purchasing/backorders.js +92 -0
  220. package/dist/purchasing/cost.d.ts +110 -0
  221. package/dist/purchasing/cost.js +86 -0
  222. package/dist/purchasing/index.d.ts +54 -0
  223. package/dist/purchasing/index.js +24 -0
  224. package/dist/purchasing/links.d.ts +263 -0
  225. package/dist/purchasing/links.js +192 -0
  226. package/dist/purchasing/purchase-orders.d.ts +551 -0
  227. package/dist/purchasing/purchase-orders.js +491 -0
  228. package/dist/purchasing/receipts.d.ts +396 -0
  229. package/dist/purchasing/receipts.js +287 -0
  230. package/dist/purchasing/replenishment.d.ts +281 -0
  231. package/dist/purchasing/replenishment.js +240 -0
  232. package/dist/purchasing/returns.d.ts +273 -0
  233. package/dist/purchasing/returns.js +229 -0
  234. package/dist/purchasing/settings.d.ts +152 -0
  235. package/dist/purchasing/settings.js +181 -0
  236. package/dist/purchasing/suppliers.d.ts +476 -0
  237. package/dist/purchasing/suppliers.js +438 -0
  238. package/dist/quotes/index.d.ts +518 -0
  239. package/dist/quotes/index.js +439 -0
  240. package/dist/reports/index.d.ts +71 -8
  241. package/dist/reports/index.js +74 -11
  242. package/dist/returns/index.d.ts +675 -21
  243. package/dist/returns/index.js +756 -11
  244. package/dist/search/index.d.ts +76 -1
  245. package/dist/search/index.js +63 -0
  246. package/dist/seo/config.d.ts +128 -0
  247. package/dist/seo/config.js +95 -0
  248. package/dist/seo/redirects.d.ts +125 -0
  249. package/dist/seo/redirects.js +60 -1
  250. package/dist/seo/settings.d.ts +147 -0
  251. package/dist/seo/settings.js +209 -0
  252. package/dist/shipping/definitions.d.ts +29 -0
  253. package/dist/shipping/definitions.js +47 -0
  254. package/dist/shipping/fulfillment-profiles.d.ts +174 -0
  255. package/dist/shipping/fulfillment-profiles.js +104 -0
  256. package/dist/shipping/hendriks.d.ts +97 -0
  257. package/dist/shipping/hendriks.js +50 -0
  258. package/dist/shipping/index.d.ts +54 -0
  259. package/dist/shipping/index.js +27 -0
  260. package/dist/shipping/methods.d.ts +205 -0
  261. package/dist/shipping/methods.js +240 -0
  262. package/dist/shipping/myparcel.d.ts +668 -0
  263. package/dist/shipping/myparcel.js +466 -0
  264. package/dist/shipping/parcel-count-suggestion.d.ts +2 -0
  265. package/dist/shipping/parcel-rule.d.ts +6 -5
  266. package/dist/shipping/parcel-rule.js +21 -23
  267. package/dist/shipping/rate-tables.d.ts +324 -0
  268. package/dist/shipping/rate-tables.js +390 -0
  269. package/dist/shipping/ship-to-countries.d.ts +75 -0
  270. package/dist/shipping/ship-to-countries.js +47 -0
  271. package/dist/stock/by-location.d.ts +86 -0
  272. package/dist/stock/by-location.js +94 -0
  273. package/dist/stock/index.d.ts +18 -4
  274. package/dist/stock/index.js +7 -0
  275. package/dist/stock/locations.d.ts +144 -0
  276. package/dist/stock/locations.js +168 -0
  277. package/dist/stock/settings.d.ts +106 -0
  278. package/dist/stock/settings.js +103 -0
  279. package/dist/stock/transfers.d.ts +386 -52
  280. package/dist/stock/transfers.js +222 -17
  281. package/dist/stored-value/index.d.ts +312 -11
  282. package/dist/stored-value/index.js +223 -4
  283. package/dist/subscriptions/index.d.ts +682 -0
  284. package/dist/subscriptions/index.js +815 -0
  285. package/dist/tax/display-policy.d.ts +105 -0
  286. package/dist/tax/display-policy.js +84 -0
  287. package/dist/tax/index.d.ts +79 -1
  288. package/dist/tax/index.js +52 -0
  289. package/dist/tenant/email-style.d.ts +102 -0
  290. package/dist/tenant/email-style.js +72 -0
  291. package/dist/tenant/email-templates.d.ts +287 -0
  292. package/dist/tenant/email-templates.js +271 -0
  293. package/dist/tenant/notifications.d.ts +23 -17
  294. package/dist/tenant/settings-sources.d.ts +1 -1
  295. package/dist/tenant/time-zone.d.ts +17 -0
  296. package/dist/tenant/time-zone.js +11 -0
  297. package/dist/types.d.ts +50 -3
  298. package/dist/users/index.d.ts +3 -0
  299. package/dist/users/index.js +2 -0
  300. package/dist/users/warehouses.d.ts +50 -0
  301. package/dist/users/warehouses.js +51 -0
  302. package/package.json +2 -2
@@ -1,17 +1,17 @@
1
1
  /**
2
- * `admin.returns`: the single-return reads of the returns (RMA) plugin, and the
3
- * plan for settling one (headless plan W9-47).
4
- *
5
- * A first, minimal module: the reads the order and return pages need. The list
6
- * (`orderReturns`) and the writes (create, approve, reject, cancel, receipt,
7
- * settle, notes, numbering) are phase 7. Money is in MINOR UNITS throughout,
8
- * as everywhere in this SDK.
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
9
  *
10
10
  * Every value set below is the engine's own and grows over time, so each field
11
11
  * that carries one also accepts a string this version does not name: treat an
12
12
  * unknown value as "not available".
13
13
  */
14
- import type { Transport } from '@sixtyninecommerce/core';
14
+ import { type Transport } from '@sixtyninecommerce/core';
15
15
  import type { Call } from '../types.js';
16
16
  /** A return's state: the latest row of its status log. */
17
17
  export declare const RETURN_STATES: readonly ["requested", "approved", "rejected", "cancelled", "items_received", "settlement_pending", "settlement_failed", "settled"];
@@ -20,9 +20,11 @@ export type ReturnState = (typeof RETURN_STATES)[number];
20
20
  * How a return is settled. `refund` gives money back to an original payment.
21
21
  * `store_credit` issues a credit note: on a store with an accounts-receivable
22
22
  * ledger it credits the customer's account, elsewhere it credits the order's
23
- * invoice and moves no money.
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).
24
26
  */
25
- export declare const RETURN_SETTLEMENT_METHODS: readonly ["refund", "store_credit"];
27
+ export declare const RETURN_SETTLEMENT_METHODS: readonly ["refund", "store_credit", "account"];
26
28
  export type ReturnSettlementMethod = (typeof RETURN_SETTLEMENT_METHODS)[number];
27
29
  export interface OrderReturnLine {
28
30
  id: string;
@@ -51,6 +53,12 @@ export interface OrderReturnLine {
51
53
  unitPriceWithTaxUnrounded: number | null;
52
54
  /** What the line refunds; null until approved. */
53
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;
54
62
  createdAt: string;
55
63
  updatedAt: string;
56
64
  }
@@ -92,10 +100,253 @@ export interface OrderReturn {
92
100
  lines: OrderReturnLine[];
93
101
  createdAt: string;
94
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;
95
178
  }
96
179
  /** {@link OrderReturn} with its status log, newest first: what `get` answers. */
97
- export interface OrderReturnDetail extends OrderReturn {
180
+ export interface OrderReturnDetail extends OrderReturn, OrderReturnReadFields {
98
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
+ * `account` in a store whose book is store credit (`settlementOptions`' `account.book`
274
+ * `STORE_CREDIT`): whether the customer expressly agreed to store credit instead of a refund to
275
+ * their payment (EU consumer law, CRD art. 13(1)), as staff recorded it. The move records it on
276
+ * its ledger entries (`StoredValueEntry.customerAgreed`); never a condition, nothing is refused
277
+ * for it. Part of the request: a repeat under the same key sends the same answer. Sent only when
278
+ * given; an engine before the field (incentives sprint 8 PR 6a) refuses a call that gives it.
279
+ */
280
+ customerAgreed?: boolean | null;
281
+ /**
282
+ * The VAT rate, a percentage from 0 to 100, that the return's invoice credit note states: the
283
+ * note splits its lump sum at that rate (USER PD11). {@link ReturnSettlementOptions.creditNoteTaxRate}
284
+ * suggests one and lists the rates to pick. Used only where the settlement issues an invoice
285
+ * credit note (the methods `creditNoteTaxRate.methods` names). Left out, the note splits as the
286
+ * order allows. Outside 0 to 100:
287
+ * `RETURN_SETTLE_INPUT_INVALID` (`details[0].code` `NOT_A_RATE`) before anything moves. Part of
288
+ * the request: a repeat under the same key sends the same rate. Sent only when given; an engine
289
+ * before the field (whose plan has no `creditNoteTaxRate`) refuses a call that gives it.
290
+ */
291
+ taxRate?: number | null;
292
+ }
293
+ /** The store's RMA code format: `{prefix}{year}{number}{suffix}`, e.g. `RMA-000042`. */
294
+ export interface ReturnNumberingConfig {
295
+ prefix: string;
296
+ suffix: string;
297
+ /** How many digits the number is padded to, 3 to 8. */
298
+ digits: number;
299
+ /** `none`, `short` (`26`) or `full` (`2026`). */
300
+ yearFormat: string;
301
+ /** Restart the count each year (only with a year in the code). */
302
+ yearReset: boolean;
303
+ }
304
+ /** A PATCH: a field left out keeps its value. */
305
+ export interface UpdateReturnNumberingConfigInput {
306
+ prefix?: string;
307
+ suffix?: string;
308
+ /** Clamped to 3..8. */
309
+ digits?: number;
310
+ /** `none`, `short` or `full`; anything else is refused `NUMBERING_YEAR_FORMAT_INVALID`. */
311
+ yearFormat?: string;
312
+ yearReset?: boolean;
313
+ }
314
+ /**
315
+ * The active store's OWN return policy (its channel's fields). A store that inherits
316
+ * `settings.returns` from its organization is governed by the organization's values instead;
317
+ * those are the settings resolver's (multi-region), not this read's.
318
+ */
319
+ export interface ReturnsSettings {
320
+ /** The store these are the settings of (its channel id). */
321
+ channelId: string;
322
+ /** Customers may request returns on the storefront. Staff can always create them. */
323
+ returnsEnabled: boolean;
324
+ /** Days after delivery (else shipping, else placement) a customer may request a return. */
325
+ returnWindowDays: number;
326
+ /** A customer's request is approved on arrival, in full. */
327
+ returnsAutoApprove: boolean;
328
+ /** An approved return is settled only after its goods are received. */
329
+ returnsRequireReceiptBeforeSettle: boolean;
330
+ /** Where restocked goods go when a receipt names no location; null when none is set. */
331
+ returnsDefaultRestockLocationId: string | null;
332
+ }
333
+ /**
334
+ * What an invoice correction's credit note already credited on an order line. A unit it
335
+ * credited whole is no longer returnable; a lower amount (a price correction on goods the
336
+ * customer keeps) lowers what each remaining unit refunds. A head can say "1 already credited
337
+ * on CN-00053" from it.
338
+ */
339
+ export interface ReturnLineCorrectionCredit {
340
+ orderLineId: string;
341
+ creditNoteId: string;
342
+ /** The credit note's number, e.g. `CN-00053`. */
343
+ creditNoteNumber: string;
344
+ /** `RETAIL`: a credit note on the order's invoice. `AR`: one on the accounts-receivable ledger. */
345
+ ledger: 'RETAIL' | 'AR' | (string & {});
346
+ /** Units it credited whole on the line: no longer returnable. */
347
+ quantity: number;
348
+ /** What it credited on the line, minor units incl. tax: whole units and price corrections. */
349
+ amount: number;
99
350
  }
100
351
  /** One order line and what of it can still be returned. */
101
352
  export interface ReturnableOrderLine {
@@ -105,8 +356,19 @@ export interface ReturnableOrderLine {
105
356
  productVariantSku: string;
106
357
  /** Units shipped or delivered. */
107
358
  fulfilledQty: number;
108
- /** `fulfilledQty` less the units other open returns already claim. */
359
+ /**
360
+ * `fulfilledQty` less the units other open returns already claim, and never more than the
361
+ * billed units an invoice correction did not credit whole (`creditedQty`).
362
+ */
109
363
  returnableQty: number;
364
+ /**
365
+ * Units an invoice correction credited whole on the line; 0 when none did. Absent from an
366
+ * engine released before 2026-10-09, which does not subtract them.
367
+ */
368
+ creditedQty?: number;
369
+ /** Every invoice correction credit note that names the line; empty when none does. Absent as above. */
370
+ correctionCredits?: ReturnLineCorrectionCredit[];
371
+ /** What one returned unit refunds: the line's price, or what a price correction left of it. */
110
372
  unitPriceWithTax: number;
111
373
  unitPriceWithTaxUnrounded: number;
112
374
  }
@@ -162,6 +424,63 @@ export interface ReturnSettlementPayment {
162
424
  /** As the platform's refund position counts it. */
163
425
  refundable: number;
164
426
  }
427
+ /** Putting the return's money on the customer's account (`account`). */
428
+ export interface ReturnSettlementAccountOption {
429
+ available: boolean;
430
+ /**
431
+ * Null exactly when `available`. The account's own answer (`AR_LEDGER_NOT_ENABLED`: the store
432
+ * keeps no accounts-receivable ledger; `AR_ACCOUNT_REQUIRED`: the customer has no credit
433
+ * account; `AR_ACCOUNT_IN_ERP`; `AR_ORDER_ALREADY_INVOICED`; `ACCOUNT_CREDIT_NO_CUSTOMER`), the
434
+ * store credit's (`STORE_CREDIT_INVOICE_FIRST`, `STORE_CREDIT_CUSTOMER_ANONYMOUS`,
435
+ * `STORED_VALUE_ACCOUNT_BLOCKED`, `STORED_VALUE_OWNER_REQUIRED`),
436
+ * `ACCOUNT_CREDIT_NOTHING_OVERPAID` (the settled payments hold nothing more) or
437
+ * `REFUND_ORPHAN_EXISTS`.
438
+ */
439
+ reasonCode: string | null;
440
+ /** The engine's sentence for `reasonCode`; null when available. */
441
+ message: string | null;
442
+ /**
443
+ * What the order's settled payments still hold, minor units: the most a settlement to the
444
+ * account may state, shipping included (above it `RETURN_ACCOUNT_CREDIT_EXCEEDS_HELD`).
445
+ */
446
+ held: number;
447
+ /**
448
+ * Where the money lands, the store's ONE book (incentives sprint 8): `AR` (the customer's
449
+ * account), `STORE_CREDIT` (the customer's store credit: on an invoiced order the return's credit
450
+ * note is issued first, and the wallet takes exactly what it credits) or `NONE`. In a
451
+ * store-credit store an order with no invoice yet, in a store that issues invoices, is refused
452
+ * `STORE_CREDIT_INVOICE_FIRST`. Absent from an engine before it (read it as the account's).
453
+ */
454
+ book?: 'AR' | 'STORE_CREDIT' | 'NONE' | (string & {}) | null;
455
+ }
456
+ /** Why the plan suggests the credit note's VAT rate it does. */
457
+ export type ReturnCreditNoteTaxRateBasis = 'RETURNED_GOODS' | 'ORDER_MAIN_RATE';
458
+ /** The VAT rate a return's invoice credit note states, which staff pick (USER PD11). */
459
+ export interface ReturnCreditNoteTaxRateOption {
460
+ /** The rate to preselect, a percentage. */
461
+ suggested: number;
462
+ /**
463
+ * `RETURNED_GOODS`: every returned item carries this rate. `ORDER_MAIN_RATE`: the rate carrying
464
+ * most of the order's money, shipping included.
465
+ */
466
+ basis: ReturnCreditNoteTaxRateBasis | (string & {});
467
+ /** The rates to pick from, ascending, each once: the store's own, the order's and the suggestion. */
468
+ rates: number[];
469
+ /**
470
+ * The methods whose settlement issues the invoice credit note that takes the rate: ask for the
471
+ * rate on these only (a refund the accounts ledger documents, or an accounts store's own credit
472
+ * note, takes none).
473
+ */
474
+ methods: Array<ReturnSettlementMethod | (string & {})>;
475
+ /**
476
+ * The gross (minor units) of the invoice the note credits, when a settlement can still credit
477
+ * ALL of it; null once an earlier credit note took part of it, or when the engine does not
478
+ * know. A settlement reaching it credits the whole invoice: leave `taxRate` out and the note
479
+ * states the invoice's own VAT rows per rate, which no single rate can. Absent from an engine
480
+ * before it.
481
+ */
482
+ invoiceTotal?: number | null;
483
+ }
165
484
  export interface ReturnSettlementOptions {
166
485
  returnId: string;
167
486
  currencyCode: string;
@@ -185,25 +504,183 @@ export interface ReturnSettlementOptions {
185
504
  };
186
505
  /** The credit note when asked for or when no refund is possible, and it is available; else `refund`. */
187
506
  initialMethod: ReturnSettlementMethod | (string & {});
188
- /** The approved line total: what a settlement without an override settles, before shipping. */
507
+ /**
508
+ * The approved line total: what a settlement without an override settles, before shipping. A
509
+ * line an invoice correction already credited counts only what is left of it.
510
+ */
189
511
  defaultAmount: number;
512
+ /**
513
+ * The most `amountOverride` may state when an invoice correction already credited goods of
514
+ * this return (then equal to `defaultAmount`); null when none did. Above it the settlement is
515
+ * refused `RETURN_AMOUNT_ALREADY_CREDITED`. Absent from an engine released before 2026-10-09.
516
+ */
517
+ amountCeiling?: number | null;
518
+ /** What invoice corrections already credited on the return's approved order lines. Absent as above. */
519
+ correctionCredits?: ReturnLineCorrectionCredit[];
520
+ /**
521
+ * The most `shippingRefundAmount` may state when an invoice correction already credited the
522
+ * order's shipping: what the order charged for shipping, less what corrections credited and
523
+ * other returns refunded of it. Null when no correction credited shipping. Above it the
524
+ * settlement is refused `RETURN_SHIPPING_ALREADY_CREDITED`. Absent from an engine released
525
+ * before this field.
526
+ */
527
+ shippingCeiling?: number | null;
528
+ /**
529
+ * Whether "Close — already credited on CN-…" is open (ruling U15): invoice corrections already
530
+ * credited all of the return's goods, so nothing is left to settle them with, and
531
+ * {@link ReturnsModule.closeAlreadyCredited} closes it without money. Absent from an engine
532
+ * released before it (read it as not available).
533
+ */
534
+ alreadyCredited?: {
535
+ available: boolean;
536
+ /** Null exactly when `available`. */
537
+ reasonCode: ReturnAlreadyCreditedUnavailableReason | (string & {}) | null;
538
+ /** The credit notes that covered the goods, by number. Empty when not available. */
539
+ creditNotes: ReturnCoveringCreditNote[];
540
+ };
541
+ /**
542
+ * Putting the money on the customer's account. Absent from an engine released before
543
+ * 2026-10-10 (the method does not exist there).
544
+ */
545
+ account?: ReturnSettlementAccountOption;
546
+ /**
547
+ * The VAT rate for the invoice credit note a settlement issues: the suggestion, the rates to
548
+ * pick and the methods that issue the note (send the pick as {@link SettleReturnInput.taxRate}).
549
+ * Null when no settlement of it issues an invoice credit note (the order has no invoice) or
550
+ * nothing can be suggested. Absent from an engine before it: that engine refuses
551
+ * `taxRate`, so leave it out.
552
+ */
553
+ creditNoteTaxRate?: ReturnCreditNoteTaxRateOption | null;
554
+ }
555
+ 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";
556
+ /**
557
+ * {@link RETURN_QUERY} for an engine with `alreadyCreditedBy` (ruling U15) but released before
558
+ * `allowedActions`, `refundEstimate` and `customer` (2026-10-11).
559
+ */
560
+ 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";
561
+ /** {@link RETURN_QUERY} for an engine released before `alreadyCreditedBy` (ruling U15). */
562
+ 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";
563
+ 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";
564
+ /** {@link RETURNS_LIST_QUERY} for an engine with `alreadyCreditedBy` but released before 2026-10-11. */
565
+ 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";
566
+ /** {@link RETURNS_LIST_QUERY} for an engine released before `alreadyCreditedBy`. */
567
+ 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";
568
+ export declare const OPEN_RETURNS_COUNT_QUERY = "\n query SdkOpenReturnsCount {\n orderReturns(options: { take: 1, state: requested }) {\n totalItems\n }\n }\n";
569
+ 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";
570
+ 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";
571
+ 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";
572
+ 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";
573
+ 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";
574
+ 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";
575
+ 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";
576
+ 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";
577
+ 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";
578
+ 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";
579
+ 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";
580
+ /** {@link RETURNS_FOR_ORDER_QUERY} for an engine released before `alreadyCreditedBy`. */
581
+ 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";
582
+ 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";
583
+ 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";
584
+ /**
585
+ * {@link RETURN_ELIGIBILITY_QUERY} for an engine released before 2026-10-09, which has no
586
+ * `creditedQty`/`correctionCredits`: GraphQL refuses a whole document over one unknown field.
587
+ */
588
+ 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";
589
+ 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 creditNoteTaxRate {\n suggested\n basis\n rates\n methods\n invoiceTotal\n }\n }\n }\n";
590
+ /**
591
+ * {@link RETURN_SETTLEMENT_OPTIONS_QUERY} for an engine with the account's book but released before
592
+ * the credit note's VAT rate (USER PD11, B6b).
593
+ */
594
+ export declare const RETURN_SETTLEMENT_OPTIONS_QUERY_BEFORE_TAX_RATE = "\n query SdkReturnSettlementOptionsBeforeTaxRate($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";
595
+ /**
596
+ * {@link RETURN_SETTLEMENT_OPTIONS_QUERY} for an engine with `alreadyCredited` but released before
597
+ * the account option named the store's book (incentives sprint 8 PR 4).
598
+ */
599
+ 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";
600
+ /**
601
+ * {@link RETURN_SETTLEMENT_OPTIONS_QUERY} for an engine with the account settlement (2026-10-10)
602
+ * but released before `alreadyCredited` (ruling U15).
603
+ */
604
+ 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";
605
+ /**
606
+ * {@link RETURN_SETTLEMENT_OPTIONS_QUERY} for an engine with `shippingCeiling` but released before
607
+ * the account settlement (2026-10-10).
608
+ */
609
+ 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";
610
+ /**
611
+ * {@link RETURN_SETTLEMENT_OPTIONS_QUERY} for an engine with the correction credits (2026-10-09)
612
+ * but released before `shippingCeiling`.
613
+ */
614
+ 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";
615
+ /**
616
+ * {@link RETURN_SETTLEMENT_OPTIONS_QUERY} for an engine with the plan (W9-47) but released before
617
+ * 2026-10-09, which has no `amountCeiling`/`correctionCredits`.
618
+ */
619
+ 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";
620
+ /** `admin.returns.numbering`: the store's RMA code format. */
621
+ export interface ReturnNumberingModule {
622
+ /**
623
+ * The format the store's next RMA code takes (the defaults until it is first set). Needs
624
+ * `ReadOrderReturn`.
625
+ *
626
+ * @effect read
627
+ */
628
+ get(options?: Call): Promise<ReturnNumberingConfig>;
629
+ /**
630
+ * Change the format; a field left out keeps its value, `digits` clamps to 3..8. Codes already
631
+ * issued keep theirs. A year format other than `none`, `short` or `full` is refused
632
+ * `NUMBERING_YEAR_FORMAT_INVALID`, a `digits` that is not a whole number
633
+ * `RETURN_NUMBERING_CONFIG_INVALID`. Needs `UpdateOrderReturn`.
634
+ *
635
+ * @effect write
636
+ */
637
+ set(input: UpdateReturnNumberingConfigInput, options?: Call): Promise<ReturnNumberingConfig>;
638
+ }
639
+ /** `admin.returns.settings`: the store's own return policy (G80: typed per domain). */
640
+ export interface ReturnsSettingsModule {
641
+ /**
642
+ * The active store's OWN return policy, as its channel stores it. Writing it is
643
+ * `tenant`/channel settings' (a later `.set()`).
644
+ *
645
+ * @effect read
646
+ */
647
+ get(options?: Call): Promise<ReturnsSettings>;
190
648
  }
191
- 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 history {\n state\n actor\n actorUserId\n reason\n createdAt\n }\n }\n }\n";
192
- 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 }\n }\n";
193
- 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 unitPriceWithTax\n unitPriceWithTaxUnrounded\n }\n }\n }\n";
194
- 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 initialMethod\n defaultAmount\n }\n }\n";
195
649
  export interface ReturnsModule {
196
650
  /**
197
651
  * One return with its lines and its status log (newest first), or `null`
198
- * when this store holds no return with that id. Needs `ReadOrderReturn`.
652
+ * when this store holds no return with that id (another store's return answers the same).
653
+ * Needs `ReadOrderReturn`.
654
+ *
655
+ * It also says which steps the return offers now (`allowedActions`), what it refunds by
656
+ * default (`refundEstimate`, per line too) and who the customer is (`customer`, for a caller
657
+ * holding `ReadCustomer` or `ReadOrder`). `allowedActions` is a PLAN: every write judges again.
658
+ * Against an engine released before 2026-10-11 the call retries once without them (and keeps
659
+ * doing so for this client), and they are absent.
660
+ *
661
+ * @effect read
199
662
  */
200
663
  get(id: string, options?: Call): Promise<OrderReturnDetail | null>;
201
- /** Every return of one order, newest first. Needs `ReadOrderReturn`. */
664
+ /**
665
+ * Every return of one order, newest first. Needs `ReadOrderReturn`. Degrades
666
+ * like {@link ReturnsModule.get} against an older engine.
667
+ *
668
+ * @effect read
669
+ */
202
670
  forOrder(orderId: string, options?: Call): Promise<OrderReturn[]>;
203
671
  /**
204
672
  * What of an order can still be returned, line by line, and the return
205
673
  * window. The window is reported, never enforced here: an admin may return
206
674
  * outside it. Needs `ReadOrderReturn`.
675
+ *
676
+ * A unit an invoice correction credited whole is not returnable: each line
677
+ * says how many (`creditedQty`) and on which credit notes
678
+ * (`correctionCredits`), and a return asking for more is refused
679
+ * `RETURN_QUANTITY_ALREADY_CREDITED`. An engine released before 2026-10-09
680
+ * has none of these: the call then retries once without them (and keeps doing
681
+ * so for this client), and the fields are absent.
682
+ *
683
+ * @effect read
207
684
  */
208
685
  eligibility(orderId: string, options?: Call): Promise<ReturnEligibility>;
209
686
  /**
@@ -212,14 +689,191 @@ export interface ReturnsModule {
212
689
  * can still give back), and which method to preselect. Needs
213
690
  * `ReadOrderReturn` AND `ReadOrder`: it names the order's payments.
214
691
  *
215
- * This is the PLAN. The write (`settleReturn`) loads its own facts and judges
692
+ * This is the PLAN. The write ({@link ReturnsModule.settle}) loads its own facts and judges
216
693
  * again, so settling can still be refused when something changed in between,
217
694
  * and an `amountOverride` above a payment's headroom is refused there. A
218
695
  * return this store does not hold is a `NotFoundError` (`ENTITY_NOT_FOUND`).
219
696
  *
697
+ * When an invoice correction already credited goods of the return,
698
+ * `defaultAmount` is what is left of them, `amountCeiling` the most an
699
+ * override may state (above it: `RETURN_AMOUNT_ALREADY_CREDITED`), and
700
+ * `correctionCredits` names the credit notes. When one credited the order's
701
+ * shipping, `shippingCeiling` is the most a shipping refund may state (above
702
+ * it: `RETURN_SHIPPING_ALREADY_CREDITED`). When corrections credited ALL of
703
+ * the goods, `alreadyCredited.available` opens
704
+ * {@link ReturnsModule.closeAlreadyCredited}.
705
+ *
706
+ * `account` says whether the money can go onto the customer's account instead
707
+ * ({@link ReturnsModule.settle} with method `account`): only where the store keeps the
708
+ * accounts-receivable ledger itself and the customer has a credit account,
709
+ * with what the order's settled payments still hold (`held`).
710
+ *
220
711
  * Needs an engine that serves `returnSettlementOptions`; against an older one
221
- * this call fails validation and nothing else does.
712
+ * this call fails validation and nothing else does. Each newer field an older
713
+ * engine does not know (`alreadyCredited`, then `account`, `shippingCeiling`, then
714
+ * `amountCeiling`/`correctionCredits`) is dropped by retrying once with the next
715
+ * older document, and this client keeps asking that one.
716
+ *
717
+ * @effect read
222
718
  */
223
719
  settlementOptions(returnId: string, options?: Call): Promise<ReturnSettlementOptions>;
720
+ /**
721
+ * Closes a return whose goods invoice corrections already credited in full:
722
+ * "Close — already credited on CN-…" (ruling U15). Such a return can never be
723
+ * settled (nothing is left) and, once received, never cancelled. The close
724
+ * moves NO money and touches no stock: the return reads `settled` with
725
+ * `settledAmount` 0, no `settlementMethod`, and `alreadyCreditedBy` naming
726
+ * the credit notes. `reason` goes on its status history (default: it names
727
+ * the credit notes). Needs `UpdateOrderReturn`.
728
+ *
729
+ * Open exactly when `settlementOptions(...).alreadyCredited.available`; the
730
+ * engine judges again under the order's money turn. Repeating it on a return
731
+ * it closed answers that return unchanged. Refusals, all coded:
732
+ * `RETURN_NOT_ALREADY_CREDITED` (money is still left: settle it; or no
733
+ * correction names its goods), `RETURN_CLOSE_STATE_CONFLICT` (it cannot be
734
+ * settled now: requested, settled, a refund in flight, a receipt required),
735
+ * `IDEMPOTENCY_OUTCOME_UNKNOWN` (a refund it waits on was never confirmed),
736
+ * `ORDER_MONEY_ACTION_IN_PROGRESS` (retryable: another money action on the
737
+ * order holds its turn) and `ENTITY_NOT_FOUND` (not this store's return).
738
+ *
739
+ * Needs an engine that serves `closeReturnAlreadyCredited`; against an older
740
+ * one the call fails validation.
741
+ *
742
+ * @effect irreversible
743
+ */
744
+ closeAlreadyCredited(returnId: string, input?: {
745
+ reason?: string | null;
746
+ }, options?: Call): Promise<OrderReturnDetail>;
747
+ /**
748
+ * A page of the store's returns, newest first, each with `refundEstimate` and `customer` (no
749
+ * second request for names). Needs `ReadOrderReturn`. Retries without the two fields against an
750
+ * engine released before 2026-10-11, as `get` does.
751
+ *
752
+ * @effect read
753
+ */
754
+ list(filter?: ReturnListFilter, options?: Call): Promise<OrderReturnList>;
755
+ /**
756
+ * How many returns wait for review (state `requested`): the count behind a "Returns" badge.
757
+ * Needs `ReadOrderReturn`.
758
+ *
759
+ * @effect read
760
+ */
761
+ openCount(options?: Call): Promise<number>;
762
+ /**
763
+ * Create a return on the order's customer's behalf. Refused `RETURN_INPUT_INVALID` (a quantity
764
+ * above what is returnable, a line of another order), `RETURN_QUANTITY_ALREADY_CREDITED` (units
765
+ * an invoice correction credited), `RETURN_WINDOW_CLOSED` (after the window, unless
766
+ * `overrideWindow`), `CUSTOMER_ERASED` (the customer's words for an erased customer). Needs
767
+ * `CreateOrderReturn`.
768
+ *
769
+ * @effect write
770
+ */
771
+ create(input: CreateReturnInput, options?: Call): Promise<OrderReturn>;
772
+ /**
773
+ * Approve a requested return, line by line. Refused `RETURN_STATE_INVALID` unless it is
774
+ * requested (`allowedActions` says `APPROVE`), `RETURN_INPUT_INVALID` for a decision the
775
+ * lines cannot take, `RETURN_QUANTITY_ALREADY_CREDITED` / `RETURN_AMOUNT_ALREADY_CREDITED` on a
776
+ * line an invoice correction credited since the request. Needs `UpdateOrderReturn`.
777
+ *
778
+ * @effect write
779
+ */
780
+ approve(id: string, input: ApproveReturnInput, options?: Call): Promise<OrderReturn>;
781
+ /**
782
+ * Reject a requested return, for good: it cannot be reopened. The reason is recorded and shown
783
+ * to the customer. Refused `RETURN_STATE_INVALID` unless it is requested,
784
+ * `RETURN_INPUT_INVALID` without a reason. Needs `UpdateOrderReturn`.
785
+ *
786
+ * @effect destructive
787
+ */
788
+ reject(id: string, reason: string, options?: Call): Promise<OrderReturn>;
789
+ /**
790
+ * Cancel a return, for good: it cannot be reopened, and its quantities become returnable
791
+ * again. Only while requested or approved and before any goods came back; otherwise
792
+ * `RETURN_STATE_INVALID` (`details[0].reasonCode` `STATE` or `RECEIPT_RECORDED`, as
793
+ * `allowedActions` reports it). Needs `UpdateOrderReturn`.
794
+ *
795
+ * @effect destructive
796
+ */
797
+ cancel(id: string, input?: {
798
+ reason?: string | null;
799
+ }, options?: Call): Promise<OrderReturn>;
800
+ /**
801
+ * Record goods that came back, graded per line (restock to a location, or write off).
802
+ * Receipts add up; the first moves the return to `items_received`. Refused
803
+ * `RETURN_STATE_INVALID` outside approved/items_received or when nothing approved is still to
804
+ * come back (`NOTHING_TO_RECEIVE`), `RETURN_INPUT_INVALID` for a quantity above what is still
805
+ * to come back or a location the store does not hold. Restocked units raise stock at that
806
+ * location. Needs `UpdateOrderReturn`.
807
+ *
808
+ * @effect write
809
+ */
810
+ recordReceipt(id: string, input: RecordReturnReceiptInput, options?: Call): Promise<OrderReturn>;
811
+ /**
812
+ * Append to the merchant's internal note (never shown to the customer). Refused
813
+ * `RETURN_INPUT_INVALID` for an empty note. Needs `UpdateOrderReturn`.
814
+ *
815
+ * @effect write
816
+ */
817
+ addNote(id: string, note: string, options?: Call): Promise<OrderReturn>;
818
+ /**
819
+ * Settle a received return with money: `refund` (to a settled payment of the order),
820
+ * `store_credit` (a credit note) or `account` (the money goes on the customer's account,
821
+ * ruling U10). Read {@link ReturnsModule.settlementOptions} first: it says which methods are
822
+ * open, with the engine's reasons and figures. The engine judges again here and answers the
823
+ * settled return, with its history. Needs `UpdateOrderReturn`.
824
+ *
825
+ * A refund that a gateway settles later leaves the return `settlement_pending` (`refundId` names
826
+ * the refund) until the provider confirms it; an offline method settles it at once.
827
+ *
828
+ * **Pass `options.idempotencyKey`, one per settlement attempt, and reuse it for every send of
829
+ * that attempt.** A repeat under the same key answers the first one's outcome (the settled
830
+ * return, or the same coded refusal) and never moves money again; a repeat while the first is
831
+ * still running is `IDEMPOTENCY_IN_PROGRESS` (wait, then send it again under the same key); the
832
+ * same key with a different `input` is `IDEMPOTENCY_CONFLICT` (409). Without a key the return's
833
+ * own state still refuses a second settlement (`RETURN_SETTLE_STATE_INVALID`), but a resend
834
+ * cannot learn what the first send did. A refusal ends the attempt: a changed request goes
835
+ * under a new key.
836
+ *
837
+ * Refusals, all coded:
838
+ * - `REFUND_ORPHAN_EXISTS` (ruling G57): a refund of the invoiced order stands that no credit
839
+ * note names, so money (a refund, an accounts-receivable credit, the account) is withheld; a
840
+ * credit note on a retail invoice moves no money and stays open;
841
+ * - `RETURN_AMOUNT_ALREADY_CREDITED` / `RETURN_SHIPPING_ALREADY_CREDITED` (ruling G66): an
842
+ * invoice correction already credited these goods or the shipping (`amountCeiling`,
843
+ * `shippingCeiling` say what is left);
844
+ * - `ORDER_MONEY_ACTION_IN_PROGRESS` (409, ruling G72): another money action on the order (a
845
+ * correction, another settlement) held its turn past 30 seconds. Nothing ran: send it again
846
+ * (this SDK repeats no write on its own);
847
+ * - `IDEMPOTENCY_OUTCOME_UNKNOWN` (`error.outcomeUnknown`): the refund reached the payment
848
+ * provider and its answer never came, so the money may have moved. The return waits in
849
+ * `settlement_pending` and nothing settles it again until the provider's answer is recorded on
850
+ * the refund (`payments.reconcileRefund`): made completes the return, not made lets it be
851
+ * settled again;
852
+ * - `RETURN_SETTLE_STATE_INVALID` (422): already settled, a refund on its way, a receipt the
853
+ * store requires first, or requested/rejected/cancelled (`details[0].code` names which:
854
+ * `ALREADY_SETTLED`, `IN_PROGRESS`, `RECEIPT_REQUIRED`, `STATE`, as `settlementOptions.blockedBy`);
855
+ * - `RETURN_SETTLE_INPUT_INVALID` (400): an amount that is not a whole number of minor units of
856
+ * 0 or more, nothing to settle, a `paymentId` the order does not hold or that is not settled;
857
+ * - `RETURN_SETTLE_NO_REFUNDABLE_PAYMENT`: no settled payment can carry the refund;
858
+ * - `REFUND_EXCEEDS_SETTLED` / `REFUND_EXCEEDS_PAYMENT`: more than the order or the payment can
859
+ * give back now;
860
+ * - `RETURN_SETTLE_REFUND_REFUSED`: the refund was refused before the payment provider was
861
+ * asked, so nothing moved (`details[0].code` says why); a refund that fails after the
862
+ * provider was asked is `IDEMPOTENCY_OUTCOME_UNKNOWN` instead, the return parked on it;
863
+ * - `RETURN_SETTLE_CREDIT_NOTE_UNAVAILABLE`: this server cannot issue that credit note;
864
+ * - `RETURN_ACCOUNT_CREDIT_UNAVAILABLE` (`details[0].code` is the account's reason) /
865
+ * `RETURN_ACCOUNT_CREDIT_EXCEEDS_HELD`;
866
+ * - `RETURN_NOT_FOUND` (404): this store holds no such return (another store's answers the same).
867
+ *
868
+ * Needs an engine that takes `settleReturn(idempotencyKey)` (2026-10-10); an older one fails
869
+ * validation and settles nothing.
870
+ *
871
+ * @effect money
872
+ */
873
+ settle(returnId: string, input: SettleReturnInput, options?: Call): Promise<OrderReturnDetail>;
874
+ /** The store's RMA code format. */
875
+ numbering: ReturnNumberingModule;
876
+ /** The store's own return policy. */
877
+ settings: ReturnsSettingsModule;
224
878
  }
225
879
  export declare function createReturnsModule(transport: Transport): ReturnsModule;