@endora-commerce/contracts 0.100.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 (327) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -0
  3. package/dist/actor.d.ts +79 -0
  4. package/dist/actor.d.ts.map +1 -0
  5. package/dist/actor.js +41 -0
  6. package/dist/actor.js.map +1 -0
  7. package/dist/addresses.d.ts +134 -0
  8. package/dist/addresses.d.ts.map +1 -0
  9. package/dist/addresses.js +16 -0
  10. package/dist/addresses.js.map +1 -0
  11. package/dist/admin-actions.d.ts +367 -0
  12. package/dist/admin-actions.d.ts.map +1 -0
  13. package/dist/admin-actions.js +287 -0
  14. package/dist/admin-actions.js.map +1 -0
  15. package/dist/admin-contributions.d.ts +518 -0
  16. package/dist/admin-contributions.d.ts.map +1 -0
  17. package/dist/admin-contributions.js +495 -0
  18. package/dist/admin-contributions.js.map +1 -0
  19. package/dist/admin-i18n.d.ts +135 -0
  20. package/dist/admin-i18n.d.ts.map +1 -0
  21. package/dist/admin-i18n.js +72 -0
  22. package/dist/admin-i18n.js.map +1 -0
  23. package/dist/admin-notifications.d.ts +55 -0
  24. package/dist/admin-notifications.d.ts.map +1 -0
  25. package/dist/admin-notifications.js +16 -0
  26. package/dist/admin-notifications.js.map +1 -0
  27. package/dist/admin-roles.d.ts +125 -0
  28. package/dist/admin-roles.d.ts.map +1 -0
  29. package/dist/admin-roles.js +2 -0
  30. package/dist/admin-roles.js.map +1 -0
  31. package/dist/admin-users.d.ts +178 -0
  32. package/dist/admin-users.d.ts.map +1 -0
  33. package/dist/admin-users.js +14 -0
  34. package/dist/admin-users.js.map +1 -0
  35. package/dist/admin.d.ts +243 -0
  36. package/dist/admin.d.ts.map +1 -0
  37. package/dist/admin.js +246 -0
  38. package/dist/admin.js.map +1 -0
  39. package/dist/analytics.d.ts +123 -0
  40. package/dist/analytics.d.ts.map +1 -0
  41. package/dist/analytics.js +68 -0
  42. package/dist/analytics.js.map +1 -0
  43. package/dist/api-keys.d.ts +97 -0
  44. package/dist/api-keys.d.ts.map +1 -0
  45. package/dist/api-keys.js +64 -0
  46. package/dist/api-keys.js.map +1 -0
  47. package/dist/assets-library.d.ts +684 -0
  48. package/dist/assets-library.d.ts.map +1 -0
  49. package/dist/assets-library.js +181 -0
  50. package/dist/assets-library.js.map +1 -0
  51. package/dist/audit-logs.d.ts +141 -0
  52. package/dist/audit-logs.d.ts.map +1 -0
  53. package/dist/audit-logs.js +31 -0
  54. package/dist/audit-logs.js.map +1 -0
  55. package/dist/auth.d.ts +174 -0
  56. package/dist/auth.d.ts.map +1 -0
  57. package/dist/auth.js +27 -0
  58. package/dist/auth.js.map +1 -0
  59. package/dist/blog.d.ts +669 -0
  60. package/dist/blog.d.ts.map +1 -0
  61. package/dist/blog.js +360 -0
  62. package/dist/blog.js.map +1 -0
  63. package/dist/capabilities.d.ts +40 -0
  64. package/dist/capabilities.d.ts.map +1 -0
  65. package/dist/capabilities.js +38 -0
  66. package/dist/capabilities.js.map +1 -0
  67. package/dist/carts.d.ts +1367 -0
  68. package/dist/carts.d.ts.map +1 -0
  69. package/dist/carts.js +405 -0
  70. package/dist/carts.js.map +1 -0
  71. package/dist/catalog.d.ts +2855 -0
  72. package/dist/catalog.d.ts.map +1 -0
  73. package/dist/catalog.js +1543 -0
  74. package/dist/catalog.js.map +1 -0
  75. package/dist/cms.d.ts +872 -0
  76. package/dist/cms.d.ts.map +1 -0
  77. package/dist/cms.js +468 -0
  78. package/dist/cms.js.map +1 -0
  79. package/dist/common.d.ts +82 -0
  80. package/dist/common.d.ts.map +1 -0
  81. package/dist/common.js +72 -0
  82. package/dist/common.js.map +1 -0
  83. package/dist/comparisons.d.ts +487 -0
  84. package/dist/comparisons.d.ts.map +1 -0
  85. package/dist/comparisons.js +221 -0
  86. package/dist/comparisons.js.map +1 -0
  87. package/dist/credentials.d.ts +292 -0
  88. package/dist/credentials.d.ts.map +1 -0
  89. package/dist/credentials.js +142 -0
  90. package/dist/credentials.js.map +1 -0
  91. package/dist/credit-limits.d.ts +111 -0
  92. package/dist/credit-limits.d.ts.map +1 -0
  93. package/dist/credit-limits.js +35 -0
  94. package/dist/credit-limits.js.map +1 -0
  95. package/dist/currencies.d.ts +127 -0
  96. package/dist/currencies.d.ts.map +1 -0
  97. package/dist/currencies.js +20 -0
  98. package/dist/currencies.js.map +1 -0
  99. package/dist/custom-fields.d.ts +345 -0
  100. package/dist/custom-fields.d.ts.map +1 -0
  101. package/dist/custom-fields.js +185 -0
  102. package/dist/custom-fields.js.map +1 -0
  103. package/dist/customer-accounts.d.ts +690 -0
  104. package/dist/customer-accounts.d.ts.map +1 -0
  105. package/dist/customer-accounts.js +41 -0
  106. package/dist/customer-accounts.js.map +1 -0
  107. package/dist/customers.d.ts +305 -0
  108. package/dist/customers.d.ts.map +1 -0
  109. package/dist/customers.js +158 -0
  110. package/dist/customers.js.map +1 -0
  111. package/dist/dictionary.d.ts +580 -0
  112. package/dist/dictionary.d.ts.map +1 -0
  113. package/dist/dictionary.js +297 -0
  114. package/dist/dictionary.js.map +1 -0
  115. package/dist/email-address.d.ts +62 -0
  116. package/dist/email-address.d.ts.map +1 -0
  117. package/dist/email-address.js +64 -0
  118. package/dist/email-address.js.map +1 -0
  119. package/dist/email.d.ts +175 -0
  120. package/dist/email.d.ts.map +1 -0
  121. package/dist/email.js +45 -0
  122. package/dist/email.js.map +1 -0
  123. package/dist/envelopes.d.ts +15 -0
  124. package/dist/envelopes.d.ts.map +1 -0
  125. package/dist/envelopes.js +16 -0
  126. package/dist/envelopes.js.map +1 -0
  127. package/dist/environment-inputs.d.ts +306 -0
  128. package/dist/environment-inputs.d.ts.map +1 -0
  129. package/dist/environment-inputs.js +277 -0
  130. package/dist/environment-inputs.js.map +1 -0
  131. package/dist/erp-connector.d.ts +52 -0
  132. package/dist/erp-connector.d.ts.map +1 -0
  133. package/dist/erp-connector.js +34 -0
  134. package/dist/erp-connector.js.map +1 -0
  135. package/dist/errors.d.ts +455 -0
  136. package/dist/errors.d.ts.map +1 -0
  137. package/dist/errors.js +532 -0
  138. package/dist/errors.js.map +1 -0
  139. package/dist/google-analytics.d.ts +181 -0
  140. package/dist/google-analytics.d.ts.map +1 -0
  141. package/dist/google-analytics.js +176 -0
  142. package/dist/google-analytics.js.map +1 -0
  143. package/dist/google-tag-manager.d.ts +111 -0
  144. package/dist/google-tag-manager.d.ts.map +1 -0
  145. package/dist/google-tag-manager.js +129 -0
  146. package/dist/google-tag-manager.js.map +1 -0
  147. package/dist/i18n.d.ts +69 -0
  148. package/dist/i18n.d.ts.map +1 -0
  149. package/dist/i18n.js +59 -0
  150. package/dist/i18n.js.map +1 -0
  151. package/dist/import-export.d.ts +63 -0
  152. package/dist/import-export.d.ts.map +1 -0
  153. package/dist/import-export.js +37 -0
  154. package/dist/import-export.js.map +1 -0
  155. package/dist/index.d.ts +82 -0
  156. package/dist/index.d.ts.map +1 -0
  157. package/dist/index.js +126 -0
  158. package/dist/index.js.map +1 -0
  159. package/dist/inventory.d.ts +673 -0
  160. package/dist/inventory.d.ts.map +1 -0
  161. package/dist/inventory.js +412 -0
  162. package/dist/inventory.js.map +1 -0
  163. package/dist/invoice-ledger.d.ts +366 -0
  164. package/dist/invoice-ledger.d.ts.map +1 -0
  165. package/dist/invoice-ledger.js +114 -0
  166. package/dist/invoice-ledger.js.map +1 -0
  167. package/dist/invoices.d.ts +845 -0
  168. package/dist/invoices.d.ts.map +1 -0
  169. package/dist/invoices.js +314 -0
  170. package/dist/invoices.js.map +1 -0
  171. package/dist/kernel.d.ts +49 -0
  172. package/dist/kernel.d.ts.map +1 -0
  173. package/dist/kernel.js +19 -0
  174. package/dist/kernel.js.map +1 -0
  175. package/dist/languages.d.ts +122 -0
  176. package/dist/languages.d.ts.map +1 -0
  177. package/dist/languages.js +24 -0
  178. package/dist/languages.js.map +1 -0
  179. package/dist/linkedin-ads.d.ts +167 -0
  180. package/dist/linkedin-ads.d.ts.map +1 -0
  181. package/dist/linkedin-ads.js +156 -0
  182. package/dist/linkedin-ads.js.map +1 -0
  183. package/dist/megamenu.d.ts +556 -0
  184. package/dist/megamenu.d.ts.map +1 -0
  185. package/dist/megamenu.js +186 -0
  186. package/dist/megamenu.js.map +1 -0
  187. package/dist/meta-ads.d.ts +126 -0
  188. package/dist/meta-ads.d.ts.map +1 -0
  189. package/dist/meta-ads.js +112 -0
  190. package/dist/meta-ads.js.map +1 -0
  191. package/dist/mfa.d.ts +274 -0
  192. package/dist/mfa.d.ts.map +1 -0
  193. package/dist/mfa.js +187 -0
  194. package/dist/mfa.js.map +1 -0
  195. package/dist/modules.d.ts +1706 -0
  196. package/dist/modules.d.ts.map +1 -0
  197. package/dist/modules.js +1390 -0
  198. package/dist/modules.js.map +1 -0
  199. package/dist/newsletter.d.ts +611 -0
  200. package/dist/newsletter.d.ts.map +1 -0
  201. package/dist/newsletter.js +345 -0
  202. package/dist/newsletter.js.map +1 -0
  203. package/dist/orders.d.ts +1175 -0
  204. package/dist/orders.d.ts.map +1 -0
  205. package/dist/orders.js +630 -0
  206. package/dist/orders.js.map +1 -0
  207. package/dist/organizations.d.ts +938 -0
  208. package/dist/organizations.d.ts.map +1 -0
  209. package/dist/organizations.js +418 -0
  210. package/dist/organizations.js.map +1 -0
  211. package/dist/pagination.d.ts +21 -0
  212. package/dist/pagination.d.ts.map +1 -0
  213. package/dist/pagination.js +22 -0
  214. package/dist/pagination.js.map +1 -0
  215. package/dist/payment-methods.d.ts +472 -0
  216. package/dist/payment-methods.d.ts.map +1 -0
  217. package/dist/payment-methods.js +175 -0
  218. package/dist/payment-methods.js.map +1 -0
  219. package/dist/payment-return-url.d.ts +53 -0
  220. package/dist/payment-return-url.d.ts.map +1 -0
  221. package/dist/payment-return-url.js +35 -0
  222. package/dist/payment-return-url.js.map +1 -0
  223. package/dist/payments.d.ts +386 -0
  224. package/dist/payments.d.ts.map +1 -0
  225. package/dist/payments.js +84 -0
  226. package/dist/payments.js.map +1 -0
  227. package/dist/pim-connector.d.ts +60 -0
  228. package/dist/pim-connector.d.ts.map +1 -0
  229. package/dist/pim-connector.js +43 -0
  230. package/dist/pim-connector.js.map +1 -0
  231. package/dist/pim-field-path.d.ts +6 -0
  232. package/dist/pim-field-path.d.ts.map +1 -0
  233. package/dist/pim-field-path.js +101 -0
  234. package/dist/pim-field-path.js.map +1 -0
  235. package/dist/platform-language.d.ts +20 -0
  236. package/dist/platform-language.d.ts.map +1 -0
  237. package/dist/platform-language.js +22 -0
  238. package/dist/platform-language.js.map +1 -0
  239. package/dist/price-lists.d.ts +685 -0
  240. package/dist/price-lists.d.ts.map +1 -0
  241. package/dist/price-lists.js +330 -0
  242. package/dist/price-lists.js.map +1 -0
  243. package/dist/product-feeds.d.ts +2837 -0
  244. package/dist/product-feeds.d.ts.map +1 -0
  245. package/dist/product-feeds.js +1504 -0
  246. package/dist/product-feeds.js.map +1 -0
  247. package/dist/product-scope-overrides.d.ts +134 -0
  248. package/dist/product-scope-overrides.d.ts.map +1 -0
  249. package/dist/product-scope-overrides.js +82 -0
  250. package/dist/product-scope-overrides.js.map +1 -0
  251. package/dist/product-value-resolver.d.ts +88 -0
  252. package/dist/product-value-resolver.d.ts.map +1 -0
  253. package/dist/product-value-resolver.js +128 -0
  254. package/dist/product-value-resolver.js.map +1 -0
  255. package/dist/promotions.d.ts +678 -0
  256. package/dist/promotions.d.ts.map +1 -0
  257. package/dist/promotions.js +479 -0
  258. package/dist/promotions.js.map +1 -0
  259. package/dist/prompt-actions.d.ts +582 -0
  260. package/dist/prompt-actions.d.ts.map +1 -0
  261. package/dist/prompt-actions.js +221 -0
  262. package/dist/prompt-actions.js.map +1 -0
  263. package/dist/pwa.d.ts +293 -0
  264. package/dist/pwa.d.ts.map +1 -0
  265. package/dist/pwa.js +204 -0
  266. package/dist/pwa.js.map +1 -0
  267. package/dist/quick-order.d.ts +340 -0
  268. package/dist/quick-order.d.ts.map +1 -0
  269. package/dist/quick-order.js +177 -0
  270. package/dist/quick-order.js.map +1 -0
  271. package/dist/quote-requests.d.ts +538 -0
  272. package/dist/quote-requests.d.ts.map +1 -0
  273. package/dist/quote-requests.js +308 -0
  274. package/dist/quote-requests.js.map +1 -0
  275. package/dist/returns.d.ts +774 -0
  276. package/dist/returns.d.ts.map +1 -0
  277. package/dist/returns.js +389 -0
  278. package/dist/returns.js.map +1 -0
  279. package/dist/sales-channels.d.ts +392 -0
  280. package/dist/sales-channels.d.ts.map +1 -0
  281. package/dist/sales-channels.js +285 -0
  282. package/dist/sales-channels.js.map +1 -0
  283. package/dist/scope-notice.d.ts +60 -0
  284. package/dist/scope-notice.d.ts.map +1 -0
  285. package/dist/scope-notice.js +56 -0
  286. package/dist/scope-notice.js.map +1 -0
  287. package/dist/search.d.ts +321 -0
  288. package/dist/search.d.ts.map +1 -0
  289. package/dist/search.js +160 -0
  290. package/dist/search.js.map +1 -0
  291. package/dist/seo.d.ts +113 -0
  292. package/dist/seo.d.ts.map +1 -0
  293. package/dist/seo.js +63 -0
  294. package/dist/seo.js.map +1 -0
  295. package/dist/settings.d.ts +453 -0
  296. package/dist/settings.d.ts.map +1 -0
  297. package/dist/settings.js +337 -0
  298. package/dist/settings.js.map +1 -0
  299. package/dist/shipments.d.ts +140 -0
  300. package/dist/shipments.d.ts.map +1 -0
  301. package/dist/shipments.js +14 -0
  302. package/dist/shipments.js.map +1 -0
  303. package/dist/shipping-methods.d.ts +350 -0
  304. package/dist/shipping-methods.d.ts.map +1 -0
  305. package/dist/shipping-methods.js +99 -0
  306. package/dist/shipping-methods.js.map +1 -0
  307. package/dist/shopping-lists.d.ts +122 -0
  308. package/dist/shopping-lists.d.ts.map +1 -0
  309. package/dist/shopping-lists.js +92 -0
  310. package/dist/shopping-lists.js.map +1 -0
  311. package/dist/taxes.d.ts +106 -0
  312. package/dist/taxes.d.ts.map +1 -0
  313. package/dist/taxes.js +80 -0
  314. package/dist/taxes.js.map +1 -0
  315. package/dist/text-normalization.d.ts +199 -0
  316. package/dist/text-normalization.d.ts.map +1 -0
  317. package/dist/text-normalization.js +205 -0
  318. package/dist/text-normalization.js.map +1 -0
  319. package/dist/transactional-emails.d.ts +459 -0
  320. package/dist/transactional-emails.d.ts.map +1 -0
  321. package/dist/transactional-emails.js +212 -0
  322. package/dist/transactional-emails.js.map +1 -0
  323. package/dist/webhooks.d.ts +69 -0
  324. package/dist/webhooks.d.ts.map +1 -0
  325. package/dist/webhooks.js +53 -0
  326. package/dist/webhooks.js.map +1 -0
  327. package/package.json +46 -0
@@ -0,0 +1,774 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Returns & Complaints (Refunds, RMA) — feature 046.
4
+ *
5
+ * Source-of-truth Zod schemas for the returns module boundary (admin + customer
6
+ * APIs and the configurable workflow). Mirrors the orders module's contract
7
+ * organization. TS types are inferred (`z.infer`), never hand-maintained.
8
+ */
9
+ /** A case is either a withdrawal-style Return or a warranty Complaint. */
10
+ export declare const returnKindSchema: z.ZodEnum<{
11
+ return: "return";
12
+ complaint: "complaint";
13
+ }>;
14
+ export type ReturnKind = z.infer<typeof returnKindSchema>;
15
+ /** Settlement resolution chosen by the admin. */
16
+ export declare const resolutionTypeSchema: z.ZodEnum<{
17
+ refund: "refund";
18
+ credit: "credit";
19
+ replacement: "replacement";
20
+ repair: "repair";
21
+ }>;
22
+ export type ResolutionType = z.infer<typeof resolutionTypeSchema>;
23
+ /** State of a recorded refund's money movement. */
24
+ export declare const settlementStateSchema: z.ZodEnum<{
25
+ failed: "failed";
26
+ issued: "issued";
27
+ pending_manual: "pending_manual";
28
+ }>;
29
+ export type SettlementState = z.infer<typeof settlementStateSchema>;
30
+ /** Who bears the return shipping cost. */
31
+ export declare const returnCostBearerSchema: z.ZodEnum<{
32
+ customer: "customer";
33
+ shop: "shop";
34
+ }>;
35
+ export type ReturnCostBearer = z.infer<typeof returnCostBearerSchema>;
36
+ /** Inspection outcome for a received line. */
37
+ export declare const inspectionOutcomeSchema: z.ZodEnum<{
38
+ pending: "pending";
39
+ failed: "failed";
40
+ passed: "passed";
41
+ }>;
42
+ export type InspectionOutcome = z.infer<typeof inspectionOutcomeSchema>;
43
+ /** Status code is a free-form machine identifier (the workflow is configurable). */
44
+ export declare const returnStatusCodeSchema: z.ZodString;
45
+ export declare const returnStatusSchema: z.ZodObject<{
46
+ code: z.ZodString;
47
+ name: z.ZodRecord<z.ZodString, z.ZodString>;
48
+ defaultName: z.ZodString;
49
+ isInitial: z.ZodBoolean;
50
+ isTerminal: z.ZodBoolean;
51
+ isSystem: z.ZodBoolean;
52
+ weight: z.ZodNumber;
53
+ color: z.ZodString;
54
+ }, z.core.$strip>;
55
+ export type ReturnStatusDto = z.infer<typeof returnStatusSchema>;
56
+ export declare const returnTransitionSchema: z.ZodObject<{
57
+ fromStatusCode: z.ZodString;
58
+ toStatusCode: z.ZodString;
59
+ isSystem: z.ZodBoolean;
60
+ }, z.core.$strip>;
61
+ export type ReturnTransitionDto = z.infer<typeof returnTransitionSchema>;
62
+ export declare const returnStatusGraphResponseSchema: z.ZodObject<{
63
+ statuses: z.ZodArray<z.ZodObject<{
64
+ code: z.ZodString;
65
+ name: z.ZodRecord<z.ZodString, z.ZodString>;
66
+ defaultName: z.ZodString;
67
+ isInitial: z.ZodBoolean;
68
+ isTerminal: z.ZodBoolean;
69
+ isSystem: z.ZodBoolean;
70
+ weight: z.ZodNumber;
71
+ color: z.ZodString;
72
+ inUseCount: z.ZodNumber;
73
+ }, z.core.$strip>>;
74
+ transitions: z.ZodArray<z.ZodObject<{
75
+ fromStatusCode: z.ZodString;
76
+ toStatusCode: z.ZodString;
77
+ isSystem: z.ZodBoolean;
78
+ }, z.core.$strip>>;
79
+ }, z.core.$strip>;
80
+ export type ReturnStatusGraphResponse = z.infer<typeof returnStatusGraphResponseSchema>;
81
+ export declare const returnStatusCreateSchema: z.ZodObject<{
82
+ code: z.ZodString;
83
+ name: z.ZodRecord<z.ZodString, z.ZodString>;
84
+ defaultName: z.ZodString;
85
+ isTerminal: z.ZodOptional<z.ZodBoolean>;
86
+ weight: z.ZodOptional<z.ZodNumber>;
87
+ color: z.ZodOptional<z.ZodString>;
88
+ }, z.core.$strip>;
89
+ export declare const returnStatusUpdateSchema: z.ZodObject<{
90
+ name: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
91
+ defaultName: z.ZodOptional<z.ZodString>;
92
+ isTerminal: z.ZodOptional<z.ZodBoolean>;
93
+ weight: z.ZodOptional<z.ZodNumber>;
94
+ color: z.ZodOptional<z.ZodString>;
95
+ }, z.core.$strip>;
96
+ export declare const returnTransitionsSetSchema: z.ZodObject<{
97
+ transitions: z.ZodArray<z.ZodObject<{
98
+ fromStatusCode: z.ZodString;
99
+ toStatusCode: z.ZodString;
100
+ }, z.core.$strip>>;
101
+ }, z.core.$strip>;
102
+ export declare const returnCaseItemSchema: z.ZodObject<{
103
+ id: z.ZodString;
104
+ orderItemId: z.ZodString;
105
+ productId: z.ZodString;
106
+ productName: z.ZodString;
107
+ quantity: z.ZodNumber;
108
+ reasonId: z.ZodNullable<z.ZodString>;
109
+ description: z.ZodNullable<z.ZodString>;
110
+ inspectionOutcome: z.ZodNullable<z.ZodEnum<{
111
+ pending: "pending";
112
+ failed: "failed";
113
+ passed: "passed";
114
+ }>>;
115
+ defaultRefundAmount: z.ZodNumber;
116
+ approvedRefundAmount: z.ZodNumber;
117
+ }, z.core.$strip>;
118
+ export type ReturnCaseItemDto = z.infer<typeof returnCaseItemSchema>;
119
+ export declare const returnCaseCommentSchema: z.ZodObject<{
120
+ id: z.ZodString;
121
+ authorKind: z.ZodEnum<{
122
+ customer: "customer";
123
+ admin: "admin";
124
+ }>;
125
+ body: z.ZodString;
126
+ isCustomerVisible: z.ZodBoolean;
127
+ createdAt: z.ZodString;
128
+ }, z.core.$strip>;
129
+ export type ReturnCaseCommentDto = z.infer<typeof returnCaseCommentSchema>;
130
+ export declare const returnCaseSummarySchema: z.ZodObject<{
131
+ id: z.ZodString;
132
+ rmaNumber: z.ZodNullable<z.ZodString>;
133
+ kind: z.ZodEnum<{
134
+ return: "return";
135
+ complaint: "complaint";
136
+ }>;
137
+ orderId: z.ZodString;
138
+ statusCode: z.ZodString;
139
+ statusLabel: z.ZodString;
140
+ totalRefundAmount: z.ZodNumber;
141
+ currency: z.ZodString;
142
+ submittedAt: z.ZodString;
143
+ }, z.core.$strip>;
144
+ export type ReturnCaseSummary = z.infer<typeof returnCaseSummarySchema>;
145
+ /**
146
+ * What became of the corrective invoice for a settled case (D-92, issue #156).
147
+ *
148
+ * Three values, because `correctiveInvoiceId: null` is a two-way answer to a
149
+ * three-way question: it stands for "no correction was due", "none was asked
150
+ * for" and "one was asked for and we do not know" at once. `not_due` carries
151
+ * its own reason in the enum — `order_not_invoiced` is the only one there is,
152
+ * and a second reason becomes a fourth value rather than a free-text column.
153
+ *
154
+ * `issued` is exactly the case where the settlement holds an invoice id.
155
+ */
156
+ export declare const correctiveInvoiceOutcomeSchema: z.ZodEnum<{
157
+ not_requested: "not_requested";
158
+ issued: "issued";
159
+ not_due: "not_due";
160
+ }>;
161
+ export type CorrectiveInvoiceOutcome = z.infer<typeof correctiveInvoiceOutcomeSchema>;
162
+ /**
163
+ * The persisted corrective-invoice answer, as the case detail reports it.
164
+ *
165
+ * The settlement *response* (`settlementResultSchema` below) says the same
166
+ * thing with the document's number attached, and only at the moment of
167
+ * settling. This is the copy a reloaded screen reads, so it names what the
168
+ * `Refund` row holds and nothing else: resolving the number would mean reading
169
+ * `invoices` from `returns` on a screen that must keep answering while that
170
+ * module is off.
171
+ */
172
+ export declare const returnCaseCorrectiveInvoiceSchema: z.ZodObject<{
173
+ outcome: z.ZodEnum<{
174
+ not_requested: "not_requested";
175
+ issued: "issued";
176
+ not_due: "not_due";
177
+ }>;
178
+ invoiceId: z.ZodNullable<z.ZodString>;
179
+ }, z.core.$strip>;
180
+ export type ReturnCaseCorrectiveInvoice = z.infer<typeof returnCaseCorrectiveInvoiceSchema>;
181
+ export declare const returnCaseDetailSchema: z.ZodObject<{
182
+ id: z.ZodString;
183
+ rmaNumber: z.ZodNullable<z.ZodString>;
184
+ kind: z.ZodEnum<{
185
+ return: "return";
186
+ complaint: "complaint";
187
+ }>;
188
+ orderId: z.ZodString;
189
+ statusCode: z.ZodString;
190
+ statusLabel: z.ZodString;
191
+ totalRefundAmount: z.ZodNumber;
192
+ currency: z.ZodString;
193
+ submittedAt: z.ZodString;
194
+ salesChannelId: z.ZodString;
195
+ customerAccountId: z.ZodString;
196
+ organizationId: z.ZodNullable<z.ZodString>;
197
+ returnDeliveryMethodId: z.ZodNullable<z.ZodString>;
198
+ appliedReturnCost: z.ZodNumber;
199
+ returnCostBearer: z.ZodEnum<{
200
+ customer: "customer";
201
+ shop: "shop";
202
+ }>;
203
+ freeReturnEligible: z.ZodBoolean;
204
+ resolutionType: z.ZodNullable<z.ZodEnum<{
205
+ refund: "refund";
206
+ credit: "credit";
207
+ replacement: "replacement";
208
+ repair: "repair";
209
+ }>>;
210
+ rejectionReason: z.ZodNullable<z.ZodString>;
211
+ items: z.ZodArray<z.ZodObject<{
212
+ id: z.ZodString;
213
+ orderItemId: z.ZodString;
214
+ productId: z.ZodString;
215
+ productName: z.ZodString;
216
+ quantity: z.ZodNumber;
217
+ reasonId: z.ZodNullable<z.ZodString>;
218
+ description: z.ZodNullable<z.ZodString>;
219
+ inspectionOutcome: z.ZodNullable<z.ZodEnum<{
220
+ pending: "pending";
221
+ failed: "failed";
222
+ passed: "passed";
223
+ }>>;
224
+ defaultRefundAmount: z.ZodNumber;
225
+ approvedRefundAmount: z.ZodNumber;
226
+ }, z.core.$strip>>;
227
+ comments: z.ZodArray<z.ZodObject<{
228
+ id: z.ZodString;
229
+ authorKind: z.ZodEnum<{
230
+ customer: "customer";
231
+ admin: "admin";
232
+ }>;
233
+ body: z.ZodString;
234
+ isCustomerVisible: z.ZodBoolean;
235
+ createdAt: z.ZodString;
236
+ }, z.core.$strip>>;
237
+ correctiveInvoice: z.ZodNullable<z.ZodObject<{
238
+ outcome: z.ZodEnum<{
239
+ not_requested: "not_requested";
240
+ issued: "issued";
241
+ not_due: "not_due";
242
+ }>;
243
+ invoiceId: z.ZodNullable<z.ZodString>;
244
+ }, z.core.$strip>>;
245
+ }, z.core.$strip>;
246
+ export type ReturnCaseDetail = z.infer<typeof returnCaseDetailSchema>;
247
+ export declare const returnableLineSchema: z.ZodObject<{
248
+ orderItemId: z.ZodString;
249
+ productId: z.ZodString;
250
+ name: z.ZodString;
251
+ purchasedQty: z.ZodNumber;
252
+ remainingReturnableQty: z.ZodNumber;
253
+ paidUnitAmount: z.ZodNumber;
254
+ currency: z.ZodString;
255
+ }, z.core.$strip>;
256
+ export declare const returnableResponseSchema: z.ZodObject<{
257
+ eligible: z.ZodBoolean;
258
+ reason: z.ZodOptional<z.ZodEnum<{
259
+ order_not_completing: "order_not_completing";
260
+ window_passed: "window_passed";
261
+ fully_returned: "fully_returned";
262
+ }>>;
263
+ freeReturnEligible: z.ZodBoolean;
264
+ lines: z.ZodArray<z.ZodObject<{
265
+ orderItemId: z.ZodString;
266
+ productId: z.ZodString;
267
+ name: z.ZodString;
268
+ purchasedQty: z.ZodNumber;
269
+ remainingReturnableQty: z.ZodNumber;
270
+ paidUnitAmount: z.ZodNumber;
271
+ currency: z.ZodString;
272
+ }, z.core.$strip>>;
273
+ }, z.core.$strip>;
274
+ export type ReturnableResponse = z.infer<typeof returnableResponseSchema>;
275
+ export declare const createReturnCaseRequestSchema: z.ZodObject<{
276
+ orderId: z.ZodString;
277
+ kind: z.ZodEnum<{
278
+ return: "return";
279
+ complaint: "complaint";
280
+ }>;
281
+ lines: z.ZodArray<z.ZodObject<{
282
+ orderItemId: z.ZodString;
283
+ quantity: z.ZodNumber;
284
+ reasonId: z.ZodString;
285
+ description: z.ZodOptional<z.ZodString>;
286
+ }, z.core.$strip>>;
287
+ attachmentAssetIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
288
+ comment: z.ZodOptional<z.ZodString>;
289
+ }, z.core.$strip>;
290
+ export type CreateReturnCaseRequest = z.infer<typeof createReturnCaseRequestSchema>;
291
+ export declare const customerAddCommentRequestSchema: z.ZodObject<{
292
+ body: z.ZodString;
293
+ }, z.core.$strip>;
294
+ export declare const addReturnAttachmentRequestSchema: z.ZodObject<{
295
+ assetId: z.ZodString;
296
+ returnCaseItemId: z.ZodOptional<z.ZodString>;
297
+ }, z.core.$strip>;
298
+ export declare const returnAttachmentSchema: z.ZodObject<{
299
+ id: z.ZodString;
300
+ returnCaseId: z.ZodString;
301
+ returnCaseItemId: z.ZodNullable<z.ZodString>;
302
+ assetId: z.ZodString;
303
+ createdAt: z.ZodString;
304
+ }, z.core.$strip>;
305
+ export type ReturnAttachmentDto = z.infer<typeof returnAttachmentSchema>;
306
+ export declare const adminTransitionRequestSchema: z.ZodObject<{
307
+ to: z.ZodString;
308
+ reason: z.ZodOptional<z.ZodString>;
309
+ }, z.core.$strip>;
310
+ export declare const adminRejectRequestSchema: z.ZodObject<{
311
+ reason: z.ZodString;
312
+ }, z.core.$strip>;
313
+ export declare const adminAddCommentRequestSchema: z.ZodObject<{
314
+ body: z.ZodString;
315
+ isCustomerVisible: z.ZodBoolean;
316
+ notifyCustomer: z.ZodBoolean;
317
+ }, z.core.$strip>;
318
+ export declare const adminReturnRowSchema: z.ZodObject<{
319
+ id: z.ZodString;
320
+ rmaNumber: z.ZodNullable<z.ZodString>;
321
+ kind: z.ZodEnum<{
322
+ return: "return";
323
+ complaint: "complaint";
324
+ }>;
325
+ orderId: z.ZodString;
326
+ statusCode: z.ZodString;
327
+ statusLabel: z.ZodString;
328
+ totalRefundAmount: z.ZodNumber;
329
+ currency: z.ZodString;
330
+ submittedAt: z.ZodString;
331
+ customerName: z.ZodNullable<z.ZodString>;
332
+ organizationName: z.ZodNullable<z.ZodString>;
333
+ }, z.core.$strip>;
334
+ export type AdminReturnRow = z.infer<typeof adminReturnRowSchema>;
335
+ export declare const settlementPrefillSchema: z.ZodObject<{
336
+ currency: z.ZodString;
337
+ resolutionOptions: z.ZodArray<z.ZodEnum<{
338
+ refund: "refund";
339
+ credit: "credit";
340
+ replacement: "replacement";
341
+ repair: "repair";
342
+ }>>;
343
+ items: z.ZodArray<z.ZodObject<{
344
+ returnCaseItemId: z.ZodString;
345
+ productName: z.ZodString;
346
+ quantity: z.ZodNumber;
347
+ defaultRefundAmount: z.ZodNumber;
348
+ approvedRefundAmount: z.ZodNumber;
349
+ }, z.core.$strip>>;
350
+ }, z.core.$strip>;
351
+ export type SettlementPrefill = z.infer<typeof settlementPrefillSchema>;
352
+ export declare const settlementRequestSchema: z.ZodObject<{
353
+ resolutionType: z.ZodEnum<{
354
+ refund: "refund";
355
+ credit: "credit";
356
+ replacement: "replacement";
357
+ repair: "repair";
358
+ }>;
359
+ lines: z.ZodDefault<z.ZodArray<z.ZodObject<{
360
+ returnCaseItemId: z.ZodString;
361
+ approvedRefundAmount: z.ZodNumber;
362
+ }, z.core.$strip>>>;
363
+ refundPaymentMethodId: z.ZodOptional<z.ZodString>;
364
+ createCorrectiveInvoice: z.ZodOptional<z.ZodBoolean>;
365
+ }, z.core.$strip>;
366
+ export type SettlementRequest = z.infer<typeof settlementRequestSchema>;
367
+ /**
368
+ * What became of the corrective invoice a settlement asked for (#135).
369
+ *
370
+ * Both outcomes are stated. A settled return on an order that was never
371
+ * invoiced corrects no VAT document, and this says so with a reason instead of
372
+ * leaving the caller to read it out of a missing id — reading absence is how
373
+ * the never-invoiced path came to emit a document that corrected nothing.
374
+ */
375
+ export declare const settlementCorrectiveInvoiceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
376
+ issued: z.ZodLiteral<true>;
377
+ invoiceId: z.ZodString;
378
+ number: z.ZodString;
379
+ }, z.core.$strip>, z.ZodObject<{
380
+ issued: z.ZodLiteral<false>;
381
+ reason: z.ZodEnum<{
382
+ order_not_invoiced: "order_not_invoiced";
383
+ }>;
384
+ }, z.core.$strip>], "issued">;
385
+ export type SettlementCorrectiveInvoice = z.infer<typeof settlementCorrectiveInvoiceSchema>;
386
+ export declare const settlementResultSchema: z.ZodObject<{
387
+ totalRefundAmount: z.ZodNumber;
388
+ refund: z.ZodOptional<z.ZodObject<{
389
+ settlementState: z.ZodEnum<{
390
+ failed: "failed";
391
+ issued: "issued";
392
+ pending_manual: "pending_manual";
393
+ }>;
394
+ externalReference: z.ZodOptional<z.ZodNullable<z.ZodString>>;
395
+ failureReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
396
+ }, z.core.$strip>>;
397
+ correctiveInvoiceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
398
+ correctiveInvoice: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
399
+ issued: z.ZodLiteral<true>;
400
+ invoiceId: z.ZodString;
401
+ number: z.ZodString;
402
+ }, z.core.$strip>, z.ZodObject<{
403
+ issued: z.ZodLiteral<false>;
404
+ reason: z.ZodEnum<{
405
+ order_not_invoiced: "order_not_invoiced";
406
+ }>;
407
+ }, z.core.$strip>], "issued">>;
408
+ creditLimitTopupApplied: z.ZodOptional<z.ZodBoolean>;
409
+ }, z.core.$strip>;
410
+ export type SettlementResult = z.infer<typeof settlementResultSchema>;
411
+ export declare const returnDeliveryMethodSchema: z.ZodObject<{
412
+ id: z.ZodString;
413
+ deliveryMethodId: z.ZodString;
414
+ returnCost: z.ZodNumber;
415
+ currency: z.ZodString;
416
+ isActive: z.ZodBoolean;
417
+ }, z.core.$strip>;
418
+ export type ReturnDeliveryMethodDto = z.infer<typeof returnDeliveryMethodSchema>;
419
+ export declare const returnDeliveryMethodCreateSchema: z.ZodObject<{
420
+ deliveryMethodId: z.ZodString;
421
+ returnCost: z.ZodNumber;
422
+ currency: z.ZodString;
423
+ isActive: z.ZodOptional<z.ZodBoolean>;
424
+ }, z.core.$strip>;
425
+ export declare const returnDeliveryMethodUpdateSchema: z.ZodObject<{
426
+ returnCost: z.ZodOptional<z.ZodNumber>;
427
+ currency: z.ZodOptional<z.ZodString>;
428
+ isActive: z.ZodOptional<z.ZodBoolean>;
429
+ }, z.core.$strip>;
430
+ export declare const selectReturnDeliveryMethodRequestSchema: z.ZodObject<{
431
+ returnDeliveryMethodId: z.ZodString;
432
+ }, z.core.$strip>;
433
+ export declare const selectReturnDeliveryMethodResultSchema: z.ZodObject<{
434
+ appliedReturnCost: z.ZodNumber;
435
+ returnCostBearer: z.ZodEnum<{
436
+ customer: "customer";
437
+ shop: "shop";
438
+ }>;
439
+ currency: z.ZodString;
440
+ }, z.core.$strip>;
441
+ export declare const returnShipmentDirectionSchema: z.ZodEnum<{
442
+ replacement: "replacement";
443
+ inbound: "inbound";
444
+ }>;
445
+ export declare const returnShipmentSchema: z.ZodObject<{
446
+ id: z.ZodString;
447
+ direction: z.ZodEnum<{
448
+ replacement: "replacement";
449
+ inbound: "inbound";
450
+ }>;
451
+ deliveryMethodId: z.ZodNullable<z.ZodString>;
452
+ externalReference: z.ZodNullable<z.ZodString>;
453
+ status: z.ZodEnum<{
454
+ pending: "pending";
455
+ failed: "failed";
456
+ received: "received";
457
+ }>;
458
+ createdAt: z.ZodString;
459
+ }, z.core.$strip>;
460
+ export type ReturnShipmentDto = z.infer<typeof returnShipmentSchema>;
461
+ export declare const createReturnShipmentRequestSchema: z.ZodObject<{
462
+ direction: z.ZodEnum<{
463
+ replacement: "replacement";
464
+ inbound: "inbound";
465
+ }>;
466
+ deliveryMethodId: z.ZodOptional<z.ZodString>;
467
+ externalReference: z.ZodOptional<z.ZodString>;
468
+ }, z.core.$strip>;
469
+ export declare const reasonAppliesToSchema: z.ZodEnum<{
470
+ return: "return";
471
+ complaint: "complaint";
472
+ both: "both";
473
+ }>;
474
+ export declare const returnReasonSchema: z.ZodObject<{
475
+ id: z.ZodString;
476
+ label: z.ZodRecord<z.ZodString, z.ZodString>;
477
+ appliesTo: z.ZodEnum<{
478
+ return: "return";
479
+ complaint: "complaint";
480
+ both: "both";
481
+ }>;
482
+ isActive: z.ZodBoolean;
483
+ weight: z.ZodNumber;
484
+ }, z.core.$strip>;
485
+ export type ReturnReasonDto = z.infer<typeof returnReasonSchema>;
486
+ export declare const returnReasonCreateSchema: z.ZodObject<{
487
+ label: z.ZodRecord<z.ZodString, z.ZodString>;
488
+ appliesTo: z.ZodEnum<{
489
+ return: "return";
490
+ complaint: "complaint";
491
+ both: "both";
492
+ }>;
493
+ isActive: z.ZodOptional<z.ZodBoolean>;
494
+ weight: z.ZodOptional<z.ZodNumber>;
495
+ }, z.core.$strip>;
496
+ export declare const returnReasonUpdateSchema: z.ZodObject<{
497
+ label: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
498
+ appliesTo: z.ZodOptional<z.ZodEnum<{
499
+ return: "return";
500
+ complaint: "complaint";
501
+ both: "both";
502
+ }>>;
503
+ isActive: z.ZodOptional<z.ZodBoolean>;
504
+ weight: z.ZodOptional<z.ZodNumber>;
505
+ }, z.core.$strip>;
506
+ export declare const adminReturnsSortSchema: z.ZodEnum<{
507
+ "submittedAt:asc": "submittedAt:asc";
508
+ "submittedAt:desc": "submittedAt:desc";
509
+ "rmaNumber:asc": "rmaNumber:asc";
510
+ "rmaNumber:desc": "rmaNumber:desc";
511
+ }>;
512
+ export declare const adminReturnsListQuerySchema: z.ZodObject<{
513
+ status: z.ZodOptional<z.ZodString>;
514
+ kind: z.ZodOptional<z.ZodEnum<{
515
+ return: "return";
516
+ complaint: "complaint";
517
+ }>>;
518
+ rmaNumber: z.ZodOptional<z.ZodString>;
519
+ q: z.ZodOptional<z.ZodString>;
520
+ sort: z.ZodOptional<z.ZodEnum<{
521
+ "submittedAt:asc": "submittedAt:asc";
522
+ "submittedAt:desc": "submittedAt:desc";
523
+ "rmaNumber:asc": "rmaNumber:asc";
524
+ "rmaNumber:desc": "rmaNumber:desc";
525
+ }>>;
526
+ page: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
527
+ pageSize: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
528
+ }, z.core.$strip>;
529
+ export type AdminReturnsListQuery = z.infer<typeof adminReturnsListQuerySchema>;
530
+ export declare const adminReturnsListResponseSchema: z.ZodObject<{
531
+ rows: z.ZodArray<z.ZodObject<{
532
+ id: z.ZodString;
533
+ rmaNumber: z.ZodNullable<z.ZodString>;
534
+ kind: z.ZodEnum<{
535
+ return: "return";
536
+ complaint: "complaint";
537
+ }>;
538
+ orderId: z.ZodString;
539
+ statusCode: z.ZodString;
540
+ statusLabel: z.ZodString;
541
+ totalRefundAmount: z.ZodNumber;
542
+ currency: z.ZodString;
543
+ submittedAt: z.ZodString;
544
+ customerName: z.ZodNullable<z.ZodString>;
545
+ organizationName: z.ZodNullable<z.ZodString>;
546
+ }, z.core.$strip>>;
547
+ total: z.ZodNumber;
548
+ counts: z.ZodRecord<z.ZodString, z.ZodNumber>;
549
+ }, z.core.$strip>;
550
+ export type AdminReturnsListResponse = z.infer<typeof adminReturnsListResponseSchema>;
551
+ export declare const bulkTransitionRequestSchema: z.ZodObject<{
552
+ ids: z.ZodArray<z.ZodString>;
553
+ to: z.ZodString;
554
+ reason: z.ZodOptional<z.ZodString>;
555
+ }, z.core.$strip>;
556
+ export declare const bulkTransitionResultSchema: z.ZodObject<{
557
+ moved: z.ZodArray<z.ZodString>;
558
+ skipped: z.ZodArray<z.ZodObject<{
559
+ id: z.ZodString;
560
+ reason: z.ZodString;
561
+ }, z.core.$strip>>;
562
+ }, z.core.$strip>;
563
+ export type BulkTransitionResult = z.infer<typeof bulkTransitionResultSchema>;
564
+ export declare const returnSavedViewSortSchema: z.ZodObject<{
565
+ field: z.ZodString;
566
+ dir: z.ZodEnum<{
567
+ asc: "asc";
568
+ desc: "desc";
569
+ }>;
570
+ }, z.core.$strip>;
571
+ export declare const returnSavedViewSchema: z.ZodObject<{
572
+ id: z.ZodString;
573
+ name: z.ZodString;
574
+ shared: z.ZodBoolean;
575
+ filters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
576
+ sort: z.ZodObject<{
577
+ field: z.ZodString;
578
+ dir: z.ZodEnum<{
579
+ asc: "asc";
580
+ desc: "desc";
581
+ }>;
582
+ }, z.core.$strip>;
583
+ visibleColumns: z.ZodNullable<z.ZodArray<z.ZodString>>;
584
+ }, z.core.$strip>;
585
+ export type ReturnSavedViewDto = z.infer<typeof returnSavedViewSchema>;
586
+ export declare const returnSavedViewCreateSchema: z.ZodObject<{
587
+ name: z.ZodString;
588
+ shared: z.ZodOptional<z.ZodBoolean>;
589
+ filters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
590
+ sort: z.ZodObject<{
591
+ field: z.ZodString;
592
+ dir: z.ZodEnum<{
593
+ asc: "asc";
594
+ desc: "desc";
595
+ }>;
596
+ }, z.core.$strip>;
597
+ visibleColumns: z.ZodOptional<z.ZodArray<z.ZodString>>;
598
+ }, z.core.$strip>;
599
+ export declare const returnSavedViewUpdateSchema: z.ZodObject<{
600
+ name: z.ZodOptional<z.ZodString>;
601
+ shared: z.ZodOptional<z.ZodBoolean>;
602
+ filters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
603
+ sort: z.ZodOptional<z.ZodObject<{
604
+ field: z.ZodString;
605
+ dir: z.ZodEnum<{
606
+ asc: "asc";
607
+ desc: "desc";
608
+ }>;
609
+ }, z.core.$strip>>;
610
+ visibleColumns: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
611
+ }, z.core.$strip>;
612
+ export interface PaymentRefundInput {
613
+ orderId: string;
614
+ amount: number;
615
+ currency: string;
616
+ paymentMethodId?: string;
617
+ /** Idempotency key (the return case id) so retries do not double-refund. */
618
+ idempotencyKey: string;
619
+ }
620
+ export interface PaymentRefundResult {
621
+ state: 'issued' | 'pending_manual' | 'failed';
622
+ externalReference?: string | null;
623
+ providerDetails?: Record<string, unknown>;
624
+ failureReason?: string;
625
+ }
626
+ /**
627
+ * Container name: `paymentRefundPort`. Owner: `payments`.
628
+ *
629
+ * The interface through which `returns` asks the payments domain to return
630
+ * funds. The implementation resolves the order's payment and, where the method
631
+ * supports an automatic refund, issues it; otherwise it reports
632
+ * `pending_manual` so an operator settles it out of band (feature 046 FR-035).
633
+ *
634
+ * `pending_manual` is the degrade, and it is in the return type rather than in
635
+ * a caller's `catch` — which is what makes an absent or switched-off gateway
636
+ * leave the obligation on the platform's books, named, instead of dropping it.
637
+ */
638
+ export interface PaymentRefundPort {
639
+ refund(input: PaymentRefundInput): Promise<PaymentRefundResult>;
640
+ }
641
+ /**
642
+ * A "credit toward future orders" resolution credits the customer's
643
+ * organisation credit limit, which `credit_limits` already grants and the
644
+ * checkout credit-check already redeems.
645
+ *
646
+ * `applied: false` when the organisation has no credit-limit grant — a
647
+ * declared outcome, not a failure, so the settlement records the answer rather
648
+ * than a caller inventing one from a caught error.
649
+ */
650
+ export interface CreditTopupInput {
651
+ organizationId: string;
652
+ amount: number;
653
+ currency: string;
654
+ returnCaseId: string;
655
+ }
656
+ export interface CreditTopupResult {
657
+ applied: boolean;
658
+ availableAmountAfter?: number;
659
+ }
660
+ /**
661
+ * Container name: `creditTopupPort`. Owner: `credit_limits`.
662
+ *
663
+ * **Owner off:** the seam fails closed — resolving this port throws
664
+ * `ModuleDisabledError` and the call answers 503 `MODULE_DISABLED`, so nothing
665
+ * half-executes. Whether `credit_limits` has an off state at all is its manifest's
666
+ * `activation` to say, not this line's: a module declaring
667
+ * `nonDeactivatable` never enters one.
668
+ */
669
+ export interface CreditTopupPort {
670
+ creditFromReturn(input: CreditTopupInput): Promise<CreditTopupResult>;
671
+ }
672
+ export interface OrderReturnContextLine {
673
+ orderItemId: string;
674
+ productId: string;
675
+ name: string;
676
+ purchasedQty: number;
677
+ /** Amount paid per unit, including its proportional tax. */
678
+ paidUnitAmount: number;
679
+ /** Amount paid for the whole purchased line, including tax. */
680
+ paidLineAmount: number;
681
+ }
682
+ export interface OrderReturnContext {
683
+ salesChannelId: string;
684
+ customerAccountId: string;
685
+ organizationId: string | null;
686
+ currency: string;
687
+ /** When the order entered its fulfilment-completing status; null if it has not. */
688
+ completingStatusEnteredAt: Date | null;
689
+ lines: OrderReturnContextLine[];
690
+ }
691
+ /**
692
+ * Container name: `orderReturnContextPort`. Owner: `orders`.
693
+ *
694
+ * The order facts a return needs — paid-per-line amounts, the
695
+ * fulfilment-completing timestamp, channel, customer, organisation — without
696
+ * `returns` reading the orders tables (Principle I).
697
+ *
698
+ * **Owner off:** the seam fails closed — resolving this port throws
699
+ * `ModuleDisabledError` and the call answers 503 `MODULE_DISABLED`, so nothing
700
+ * half-executes. Whether `orders` has an off state at all is its manifest's
701
+ * `activation` to say, not this line's: a module declaring
702
+ * `nonDeactivatable` never enters one.
703
+ */
704
+ export interface OrderReturnContextPort {
705
+ getReturnContext(orderId: string): Promise<OrderReturnContext | null>;
706
+ }
707
+ export interface CorrectiveInvoiceLine {
708
+ /**
709
+ * The order item this line credits. It is the link back to the line of the
710
+ * original invoice being corrected: issuance snapshots `orderItemId` on every
711
+ * product line, and a return-case item carries the same order item, so the
712
+ * corrected line's VAT rate can be mirrored rather than assumed (issue #131).
713
+ */
714
+ orderItemId: string;
715
+ productName: string;
716
+ quantity: number;
717
+ /** Credited amount for this line, gross (as paid, including its tax). */
718
+ amount: number;
719
+ }
720
+ export interface CorrectiveInvoiceInput {
721
+ orderId: string;
722
+ lines: CorrectiveInvoiceLine[];
723
+ /** Credited total, gross. */
724
+ total: number;
725
+ currency: string;
726
+ /**
727
+ * The caller's key for this correction — the return case id (D-91).
728
+ *
729
+ * A settlement attempts every external effect **before** it writes any state,
730
+ * so a refusal from a later step leaves a retryable case behind and the retry
731
+ * asks for the same correction again. With a key, the second call returns the
732
+ * document the first one issued; without it, the order carries two corrections
733
+ * for one return.
734
+ *
735
+ * It keys the **return case**, not the order: a second partial return against
736
+ * the same order is a different case and legitimately gets its own correction.
737
+ * Omitted, no deduplication is attempted and every call issues a document.
738
+ */
739
+ idempotencyKey?: string;
740
+ }
741
+ /** A correction was issued: the document that credits the original invoice. */
742
+ export interface CorrectiveInvoiceIssued {
743
+ issued: true;
744
+ invoiceId: string;
745
+ number: string;
746
+ status: 'pending' | 'ready' | 'cancelled';
747
+ }
748
+ /**
749
+ * No correction was due, with the reason (issue #135).
750
+ *
751
+ * The settlement caller cannot know whether the order was ever invoiced — the
752
+ * invoices module can, and answers here. `order_not_invoiced` is the only
753
+ * reason today: with no original there is no VAT document to correct, so a
754
+ * correction would be a number, a zero rate and an empty seller/buyer snapshot
755
+ * standing in for a document that never existed.
756
+ */
757
+ export interface CorrectiveInvoiceNotDue {
758
+ issued: false;
759
+ reason: 'order_not_invoiced';
760
+ }
761
+ export type CorrectiveInvoiceResult = CorrectiveInvoiceIssued | CorrectiveInvoiceNotDue;
762
+ /**
763
+ * Container name: `correctiveInvoicePort`. Owner: `invoices`.
764
+ *
765
+ * **Owner off:** the seam fails closed — resolving this port throws
766
+ * `ModuleDisabledError` and the call answers 503 `MODULE_DISABLED`, so nothing
767
+ * half-executes. Whether `invoices` has an off state at all is its manifest's
768
+ * `activation` to say, not this line's: a module declaring
769
+ * `nonDeactivatable` never enters one.
770
+ */
771
+ export interface CorrectiveInvoicePort {
772
+ createCorrection(input: CorrectiveInvoiceInput): Promise<CorrectiveInvoiceResult>;
773
+ }
774
+ //# sourceMappingURL=returns.d.ts.map