@sixtyninecommerce/admin 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/README.md +4347 -171
  2. package/dist/catalog/assets.d.ts +120 -8
  3. package/dist/catalog/assets.js +98 -12
  4. package/dist/catalog/collections.d.ts +279 -14
  5. package/dist/catalog/collections.js +246 -15
  6. package/dist/catalog/index.d.ts +9 -2
  7. package/dist/catalog/index.js +4 -0
  8. package/dist/catalog/products.d.ts +159 -19
  9. package/dist/catalog/products.js +88 -13
  10. package/dist/catalog/properties.d.ts +102 -14
  11. package/dist/catalog/properties.js +13 -0
  12. package/dist/catalog/recommendations.d.ts +261 -0
  13. package/dist/catalog/recommendations.js +145 -0
  14. package/dist/catalog/reviews.d.ts +368 -0
  15. package/dist/catalog/reviews.js +318 -0
  16. package/dist/catalog/types.d.ts +17 -1
  17. package/dist/catalog/types.js +10 -0
  18. package/dist/catalog/variant-find.d.ts +136 -0
  19. package/dist/catalog/variant-find.js +239 -0
  20. package/dist/catalog/variants.d.ts +233 -26
  21. package/dist/catalog/variants.js +125 -7
  22. package/dist/catalog/visibility.d.ts +20 -5
  23. package/dist/catalog/visibility.js +19 -1
  24. package/dist/client.d.ts +95 -9
  25. package/dist/client.js +35 -7
  26. package/dist/content/assets.d.ts +286 -0
  27. package/dist/content/assets.js +181 -0
  28. package/dist/content/items.d.ts +269 -0
  29. package/dist/content/items.js +170 -0
  30. package/dist/content/types.d.ts +282 -0
  31. package/dist/content/types.js +100 -0
  32. package/dist/customers/age-verification.d.ts +66 -0
  33. package/dist/customers/age-verification.js +79 -0
  34. package/dist/customers/credit.d.ts +263 -0
  35. package/dist/customers/credit.js +244 -0
  36. package/dist/customers/delivery-preferences.d.ts +120 -0
  37. package/dist/customers/delivery-preferences.js +97 -0
  38. package/dist/customers/groups.d.ts +207 -0
  39. package/dist/customers/groups.js +438 -0
  40. package/dist/customers/index.d.ts +447 -37
  41. package/dist/customers/index.js +313 -40
  42. package/dist/customers/invitation-status.d.ts +57 -0
  43. package/dist/customers/invitation-status.js +21 -0
  44. package/dist/customers/notes.d.ts +67 -0
  45. package/dist/customers/notes.js +51 -0
  46. package/dist/customers/notification-recipients.d.ts +97 -0
  47. package/dist/customers/notification-recipients.js +84 -0
  48. package/dist/customers/saved-lists.d.ts +42 -0
  49. package/dist/customers/saved-lists.js +61 -0
  50. package/dist/customers/vat.d.ts +83 -0
  51. package/dist/customers/vat.js +46 -0
  52. package/dist/customers/wire.d.ts +20 -0
  53. package/dist/customers/wire.js +35 -0
  54. package/dist/documents/ar.d.ts +307 -0
  55. package/dist/documents/ar.js +254 -0
  56. package/dist/documents/index.d.ts +731 -21
  57. package/dist/documents/index.js +436 -24
  58. package/dist/documents/pdf.d.ts +2 -0
  59. package/dist/documents/pdf.js +11 -0
  60. package/dist/fulfillments/create.d.ts +167 -0
  61. package/dist/fulfillments/create.js +216 -0
  62. package/dist/fulfillments/index.d.ts +44 -10
  63. package/dist/fulfillments/index.js +11 -2
  64. package/dist/fulfillments/payment-policy.d.ts +64 -0
  65. package/dist/fulfillments/payment-policy.js +140 -0
  66. package/dist/fulfillments/warehouse.d.ts +724 -0
  67. package/dist/fulfillments/warehouse.js +914 -0
  68. package/dist/geo/index.d.ts +119 -0
  69. package/dist/geo/index.js +107 -0
  70. package/dist/index.d.ts +123 -35
  71. package/dist/index.js +45 -12
  72. package/dist/integrations/afas-actions.d.ts +234 -0
  73. package/dist/integrations/afas-actions.js +310 -0
  74. package/dist/integrations/afas-types.d.ts +483 -0
  75. package/dist/integrations/afas-types.js +5 -0
  76. package/dist/integrations/afas.d.ts +234 -0
  77. package/dist/integrations/afas.js +290 -0
  78. package/dist/integrations/connections.d.ts +103 -0
  79. package/dist/integrations/connections.js +55 -0
  80. package/dist/integrations/esp.d.ts +313 -0
  81. package/dist/integrations/esp.js +169 -0
  82. package/dist/integrations/exact-online-types.d.ts +423 -0
  83. package/dist/integrations/exact-online-types.js +6 -0
  84. package/dist/integrations/exact-online.d.ts +248 -0
  85. package/dist/integrations/exact-online.js +376 -0
  86. package/dist/integrations/index.d.ts +29 -3
  87. package/dist/integrations/index.js +18 -3
  88. package/dist/integrations/pipeline-keys.d.ts +13 -0
  89. package/dist/integrations/pipeline-keys.js +22 -0
  90. package/dist/integrations/pipelines.d.ts +15 -14
  91. package/dist/integrations/pipelines.js +6 -22
  92. package/dist/integrations/types.d.ts +146 -0
  93. package/dist/locations/index.d.ts +66 -0
  94. package/dist/locations/index.js +31 -0
  95. package/dist/meta/index.d.ts +162 -0
  96. package/dist/orders/cancel-with-money.d.ts +227 -0
  97. package/dist/orders/cancel-with-money.js +153 -0
  98. package/dist/orders/commit-edit.d.ts +7 -1
  99. package/dist/orders/commit-edit.js +5 -1
  100. package/dist/orders/drafts.d.ts +800 -0
  101. package/dist/orders/drafts.js +771 -0
  102. package/dist/orders/fields.d.ts +245 -0
  103. package/dist/orders/fields.js +188 -0
  104. package/dist/orders/get.d.ts +29 -19
  105. package/dist/orders/get.js +17 -8
  106. package/dist/orders/index.d.ts +49 -9
  107. package/dist/orders/index.js +22 -2
  108. package/dist/orders/lifecycle.d.ts +128 -0
  109. package/dist/orders/lifecycle.js +158 -0
  110. package/dist/orders/line-price-preview.d.ts +7 -2
  111. package/dist/orders/list.d.ts +222 -0
  112. package/dist/orders/list.js +377 -0
  113. package/dist/orders/manual-pricing.d.ts +5 -0
  114. package/dist/orders/order-entry.d.ts +20 -7
  115. package/dist/orders/plan-edit.d.ts +1 -1
  116. package/dist/orders/plan-edit.js +4 -1
  117. package/dist/orders/settings.d.ts +201 -0
  118. package/dist/orders/settings.js +325 -0
  119. package/dist/orders/status.d.ts +159 -13
  120. package/dist/orders/status.js +21 -0
  121. package/dist/orders/surcharges.d.ts +8 -1
  122. package/dist/orders/surcharges.js +3 -2
  123. package/dist/payments/account-credit.d.ts +30 -0
  124. package/dist/payments/account-credit.js +19 -0
  125. package/dist/payments/ar.d.ts +292 -0
  126. package/dist/payments/ar.js +223 -0
  127. package/dist/payments/connected-account.d.ts +47 -0
  128. package/dist/payments/connected-account.js +61 -0
  129. package/dist/payments/credit-noted-fields.d.ts +12 -0
  130. package/dist/payments/credit-noted-fields.js +37 -0
  131. package/dist/payments/index.d.ts +257 -11
  132. package/dist/payments/index.js +131 -1
  133. package/dist/payments/methods.d.ts +303 -8
  134. package/dist/payments/methods.js +337 -7
  135. package/dist/payments/mollie-methods.d.ts +159 -0
  136. package/dist/payments/mollie-methods.js +141 -0
  137. package/dist/payments/payment-links.d.ts +180 -0
  138. package/dist/payments/payment-links.js +97 -0
  139. package/dist/payments/provider-keys.d.ts +150 -0
  140. package/dist/payments/provider-keys.js +118 -0
  141. package/dist/payments/providers.d.ts +86 -11
  142. package/dist/payments/providers.js +29 -0
  143. package/dist/payments/requests.d.ts +144 -0
  144. package/dist/payments/requests.js +92 -0
  145. package/dist/payments/store-credit-fields.d.ts +15 -0
  146. package/dist/payments/store-credit-fields.js +51 -0
  147. package/dist/pickups/index.d.ts +104 -0
  148. package/dist/pickups/index.js +105 -0
  149. package/dist/platform/channels.d.ts +132 -0
  150. package/dist/platform/channels.js +128 -0
  151. package/dist/platform/geo.d.ts +123 -0
  152. package/dist/platform/geo.js +144 -0
  153. package/dist/platform/tax.d.ts +154 -0
  154. package/dist/platform/tax.js +139 -0
  155. package/dist/pos/anomalies.d.ts +158 -0
  156. package/dist/pos/anomalies.js +64 -0
  157. package/dist/pos/assisted-selling.d.ts +79 -0
  158. package/dist/pos/assisted-selling.js +38 -0
  159. package/dist/pos/exchanges.d.ts +103 -0
  160. package/dist/pos/exchanges.js +22 -0
  161. package/dist/pos/gift-cards.d.ts +135 -0
  162. package/dist/pos/gift-cards.js +47 -0
  163. package/dist/pos/index.d.ts +2125 -32
  164. package/dist/pos/index.js +742 -4
  165. package/dist/pos/no-receipt.d.ts +94 -0
  166. package/dist/pos/no-receipt.js +25 -0
  167. package/dist/pos/offline-sales.d.ts +187 -0
  168. package/dist/pos/offline-sales.js +116 -0
  169. package/dist/pos/pay-by-link.d.ts +143 -0
  170. package/dist/pos/pay-by-link.js +57 -0
  171. package/dist/pos/quick-keys.d.ts +103 -0
  172. package/dist/pos/quick-keys.js +45 -0
  173. package/dist/pos/reports.d.ts +360 -0
  174. package/dist/pos/reports.js +62 -0
  175. package/dist/pos/returns.d.ts +217 -0
  176. package/dist/pos/returns.js +53 -0
  177. package/dist/pricing/bulk-coupons.d.ts +139 -0
  178. package/dist/pricing/bulk-coupons.js +112 -0
  179. package/dist/pricing/index.d.ts +174 -4
  180. package/dist/pricing/index.js +174 -1
  181. package/dist/pricing/price-lists.d.ts +604 -0
  182. package/dist/pricing/price-lists.js +600 -0
  183. package/dist/purchasing/alerts.d.ts +89 -0
  184. package/dist/purchasing/alerts.js +62 -0
  185. package/dist/purchasing/cost.d.ts +110 -0
  186. package/dist/purchasing/cost.js +86 -0
  187. package/dist/purchasing/index.d.ts +36 -0
  188. package/dist/purchasing/index.js +16 -0
  189. package/dist/purchasing/purchase-orders.d.ts +548 -0
  190. package/dist/purchasing/purchase-orders.js +491 -0
  191. package/dist/purchasing/replenishment.d.ts +281 -0
  192. package/dist/purchasing/replenishment.js +240 -0
  193. package/dist/purchasing/settings.d.ts +152 -0
  194. package/dist/purchasing/settings.js +181 -0
  195. package/dist/purchasing/suppliers.d.ts +476 -0
  196. package/dist/purchasing/suppliers.js +438 -0
  197. package/dist/quotes/index.d.ts +501 -0
  198. package/dist/quotes/index.js +439 -0
  199. package/dist/reports/index.d.ts +71 -8
  200. package/dist/reports/index.js +74 -11
  201. package/dist/returns/index.d.ts +614 -21
  202. package/dist/returns/index.js +695 -11
  203. package/dist/search/index.d.ts +76 -1
  204. package/dist/search/index.js +63 -0
  205. package/dist/shipping/definitions.d.ts +29 -0
  206. package/dist/shipping/definitions.js +47 -0
  207. package/dist/shipping/fulfillment-profiles.d.ts +174 -0
  208. package/dist/shipping/fulfillment-profiles.js +104 -0
  209. package/dist/shipping/hendriks.d.ts +97 -0
  210. package/dist/shipping/hendriks.js +50 -0
  211. package/dist/shipping/index.d.ts +48 -0
  212. package/dist/shipping/index.js +25 -0
  213. package/dist/shipping/methods.d.ts +198 -0
  214. package/dist/shipping/methods.js +240 -0
  215. package/dist/shipping/myparcel.d.ts +254 -0
  216. package/dist/shipping/myparcel.js +178 -0
  217. package/dist/shipping/parcel-count-suggestion.d.ts +2 -0
  218. package/dist/shipping/parcel-rule.d.ts +6 -5
  219. package/dist/shipping/parcel-rule.js +21 -23
  220. package/dist/shipping/rate-tables.d.ts +179 -0
  221. package/dist/shipping/rate-tables.js +184 -0
  222. package/dist/stock/index.d.ts +10 -3
  223. package/dist/stock/index.js +3 -0
  224. package/dist/stock/locations.d.ts +144 -0
  225. package/dist/stock/locations.js +168 -0
  226. package/dist/stock/transfers.d.ts +216 -43
  227. package/dist/stock/transfers.js +140 -13
  228. package/dist/stored-value/index.d.ts +214 -4
  229. package/dist/stored-value/index.js +152 -0
  230. package/dist/subscriptions/index.d.ts +682 -0
  231. package/dist/subscriptions/index.js +815 -0
  232. package/dist/tax/index.d.ts +76 -1
  233. package/dist/tax/index.js +50 -0
  234. package/dist/tenant/email-style.d.ts +102 -0
  235. package/dist/tenant/email-style.js +72 -0
  236. package/dist/tenant/email-templates.d.ts +66 -0
  237. package/dist/tenant/email-templates.js +54 -0
  238. package/dist/tenant/notifications.d.ts +23 -17
  239. package/dist/tenant/settings-sources.d.ts +1 -1
  240. package/dist/tenant/time-zone.d.ts +17 -0
  241. package/dist/tenant/time-zone.js +11 -0
  242. package/dist/types.d.ts +50 -3
  243. package/dist/users/index.d.ts +3 -0
  244. package/dist/users/index.js +2 -0
  245. package/dist/users/warehouses.d.ts +50 -0
  246. package/dist/users/warehouses.js +51 -0
  247. package/package.json +2 -2
@@ -1,10 +1,19 @@
1
1
  import { type Page, type Transport } from '@sixtyninecommerce/core';
2
2
  import type { Call, ListOptions } from '../types.js';
3
+ import { type ArDocumentsModule } from './ar.js';
4
+ import { decodePdf } from './pdf.js';
5
+ export { decodePdf };
3
6
  /**
4
7
  * Which document a call is about. The platform issues three, and every method
5
8
  * here that takes a type takes one of these.
6
9
  */
7
10
  export type DocumentType = 'invoice' | 'credit-note' | 'packing-slip';
11
+ /**
12
+ * What an extension block may be registered for: the three order documents, and a merchant's
13
+ * purchase order to a supplier (purchase-orders spec §8.4.2, D80), whose PDF is read through
14
+ * `admin.purchasing.purchaseOrders.document`, never `data` or `downloadUrl`.
15
+ */
16
+ export type ExtensionDocumentType = DocumentType | 'purchase-order';
8
17
  /** An issued invoice. Money is in MINOR UNITS, as everywhere in this SDK. */
9
18
  export interface Invoice {
10
19
  id: string;
@@ -37,6 +46,16 @@ export interface Invoice {
37
46
  lines: DocumentLine[] | null;
38
47
  /** Who numbered it: `platform`, or an ERP's code (`afas`). */
39
48
  numberingProvider: string;
49
+ /**
50
+ * What had been paid towards it when it was issued, in minor units: money collected (taken,
51
+ * or held by a payment provider to capture), less refunds and money moved to the customer's
52
+ * account; a promise to pay (bank transfer, invoice, on account) is not paid. Frozen at issue,
53
+ * as the PDF printed it. Null on an invoice issued before this was recorded, and on a
54
+ * supplementary invoice.
55
+ */
56
+ amountPaid: number | null;
57
+ /** What remained due when it was issued: `totalWithTax` less `amountPaid`, never below zero. Null when `amountPaid` is. */
58
+ amountDue: number | null;
40
59
  createdAt: string;
41
60
  }
42
61
  /** An issued credit note. `totalWithTax` is the POSITIVE value of the credit. */
@@ -183,7 +202,7 @@ export interface DocumentExtensionSchema {
183
202
  export interface RegisterDocumentExtensionInput {
184
203
  /** Lower-case kebab handle, at most 64 characters. */
185
204
  key: string;
186
- documentTypes: DocumentType[];
205
+ documentTypes: ExtensionDocumentType[];
187
206
  /** See {@link DocumentExtensionSchema} for the fifteen keywords this platform accepts. */
188
207
  jsonSchema: unknown;
189
208
  /** See {@link DocumentExtensionSchema} for the allow-listed fragment nodes. */
@@ -383,6 +402,47 @@ export interface InvoiceCorrectionInput {
383
402
  refundPaymentId?: string;
384
403
  /** RETAIL only: move the credited amount to the customer's account instead (`accountCredit`). */
385
404
  creditToAccount?: boolean;
405
+ /**
406
+ * Details wrong only: the order's payment term in days. The corrected invoice is reissued
407
+ * under it and the order keeps it (its `paymentTermsDays`; its payment condition is cleared).
408
+ * For a customer whose terms the store keeps (`paymentTerms.accepts` `DAYS`). 0 to 365. Left
409
+ * out together with `paymentConditionCode`, the terms are not changed. The due date is the
410
+ * corrected invoice's date (today in the store's numbering zone) plus the days.
411
+ */
412
+ paymentTermsDays?: number;
413
+ /**
414
+ * Details wrong only: the ERP payment condition the corrected invoice is reissued under and the
415
+ * order keeps (its `paymentConditionCode`; its days are cleared). For a customer whose terms an
416
+ * ERP governs (`paymentTerms.accepts` `CONDITION_CODE`). At most 64 characters. Never together
417
+ * with `paymentTermsDays`.
418
+ */
419
+ paymentConditionCode?: string;
420
+ }
421
+ /** Payment terms as a document prints them, with the due date it states. */
422
+ export interface InvoiceCorrectionTermsView {
423
+ summary: string;
424
+ paymentDays: number | null;
425
+ conditionCode: string | null;
426
+ /** `YYYY-MM-DD`: the document's date plus the terms; null when it states none. */
427
+ dueOn: string | null;
428
+ }
429
+ /** An invoice's payment terms and its corrected invoice's ({@link InvoiceCorrectionPlan.paymentTerms}). */
430
+ export interface InvoiceCorrectionPaymentTerms {
431
+ /** What the invoice printed, with its due date; null when it printed none. */
432
+ invoiced: InvoiceCorrectionTermsView | null;
433
+ /**
434
+ * What the corrected invoice of a details correction would print (the stated terms, when the
435
+ * input states them), with the due date it would state; null for another outcome, none, or
436
+ * terms that cannot be read (a blocker says why).
437
+ */
438
+ replacement: InvoiceCorrectionTermsView | null;
439
+ /**
440
+ * Which input member states the order's terms: `DAYS` (`paymentTermsDays`), `CONDITION_CODE`
441
+ * (`paymentConditionCode`), or null where none can (`unavailableMessage` says why). The other
442
+ * member is a blocker, `INVOICE_CORRECTION_PAYMENT_TERMS_NOT_ACCEPTED`.
443
+ */
444
+ accepts: 'DAYS' | 'CONDITION_CODE' | null;
445
+ unavailableMessage: string | null;
386
446
  }
387
447
  /** One line a correction states, every key present. */
388
448
  export interface InvoiceCorrectionLine {
@@ -515,6 +575,12 @@ export interface InvoiceCorrectionPlan {
515
575
  available: boolean;
516
576
  unavailableCode: string | null;
517
577
  message: string | null;
578
+ /**
579
+ * Where the money would land, the store's ONE book (incentives sprint 8): `AR` (the customer's
580
+ * account), `STORE_CREDIT` (the customer's store credit: the credit note is issued first and
581
+ * the wallet takes exactly what it credits) or `NONE`. Absent from an engine before it.
582
+ */
583
+ book?: 'AR' | 'STORE_CREDIT' | 'NONE' | (string & {}) | null;
518
584
  } | null;
519
585
  settlement: 'NONE' | 'REFUND' | 'ACCOUNT_CREDIT';
520
586
  /** Everything that stops this correction. Empty: it can be committed. */
@@ -523,6 +589,98 @@ export interface InvoiceCorrectionPlan {
523
589
  message: string;
524
590
  path: string | null;
525
591
  }>;
592
+ /**
593
+ * What returns whose money moved (settled, or a refund in flight) already gave back of the
594
+ * invoice's orders, which a partial credit never credits again; null when none did. Answers
595
+ * returns only: read {@link givenBack} for what earlier corrections credited too. An engine
596
+ * older than this field fails the document's validation.
597
+ */
598
+ returnedGoods: InvoiceCorrectionReturnedGoods | null;
599
+ /**
600
+ * What returns whose money moved AND earlier live correction credit notes already gave back of
601
+ * the invoice's orders, per order line and for shipping, naming the RMAs and the credit notes;
602
+ * null when nothing was. A partial credit never credits it again. An engine older than this
603
+ * field fails the document's validation.
604
+ */
605
+ givenBack: InvoiceCorrectionGivenBack | null;
606
+ /**
607
+ * The invoice's payment terms and its corrected invoice's (a details correction may state new
608
+ * ones); null for an invoice with no single order (an AR statement or supplement). An engine
609
+ * older than this field fails the document's validation.
610
+ */
611
+ paymentTerms: InvoiceCorrectionPaymentTerms | null;
612
+ }
613
+ /**
614
+ * What returns and earlier corrections already gave back of an invoice's orders
615
+ * ({@link InvoiceCorrectionPlan.givenBack}). Above it the plan blocks
616
+ * `INVOICE_CORRECTION_QUANTITY_ALREADY_RETURNED` / `_AMOUNT_ALREADY_RETURNED` /
617
+ * `_SHIPPING_ALREADY_REFUNDED` where a return gave some back, else
618
+ * `INVOICE_CORRECTION_QUANTITY_ALREADY_CREDITED` / `_AMOUNT_ALREADY_CREDITED` /
619
+ * `_SHIPPING_ALREADY_CREDITED` (path `lines/<i>/<field>`).
620
+ */
621
+ export interface InvoiceCorrectionGivenBack {
622
+ /** The order lines a return touched or an earlier live correction names. */
623
+ lines: Array<{
624
+ orderLineId: string;
625
+ /** The line's product name. */
626
+ description: string;
627
+ /** Units the line bills. */
628
+ quantity: number;
629
+ /** Units returns refunded. */
630
+ returnedQuantity: number;
631
+ /** Units earlier corrections credited whole. */
632
+ creditedQuantity: number;
633
+ /** What earlier corrections credited on the line below its price (gross, minor units). */
634
+ priceCredited: number;
635
+ /** Units a correction may still name. */
636
+ creditableQuantity: number;
637
+ /** What a correction may still credit on the line (minor units). */
638
+ creditableAmount: number;
639
+ /** The returns, by RMA code. */
640
+ returnCodes: string[];
641
+ /** The earlier live correction credit notes that name the line, by number. */
642
+ creditNoteNumbers: string[];
643
+ }>;
644
+ /** Null unless a return refunded, or an earlier correction credited, some of the shipping. */
645
+ shipping: {
646
+ charged: number;
647
+ refunded: number;
648
+ credited: number;
649
+ /** What a correction may still credit of it. */
650
+ creditable: number;
651
+ returnCodes: string[];
652
+ creditNoteNumbers: string[];
653
+ } | null;
654
+ }
655
+ /** What returns already gave back of an invoice's orders ({@link InvoiceCorrectionPlan}). */
656
+ export interface InvoiceCorrectionReturnedGoods {
657
+ /** The order lines a return touched. */
658
+ lines: Array<{
659
+ orderLineId: string;
660
+ /** The line's product name. */
661
+ description: string;
662
+ /** Units the line bills. */
663
+ quantity: number;
664
+ /** Units returns refunded. */
665
+ returnedQuantity: number;
666
+ /** Units earlier corrections credited whole. */
667
+ creditedQuantity: number;
668
+ /** Units a correction may still name; above it the plan blocks `INVOICE_CORRECTION_QUANTITY_ALREADY_RETURNED`. */
669
+ creditableQuantity: number;
670
+ /** What a correction may still credit on the line; above it `INVOICE_CORRECTION_AMOUNT_ALREADY_RETURNED`. */
671
+ creditableAmount: number;
672
+ /** The returns, by RMA code. */
673
+ returnCodes: string[];
674
+ }>;
675
+ /** Null unless a return refunded shipping. */
676
+ shipping: {
677
+ charged: number;
678
+ refunded: number;
679
+ credited: number;
680
+ /** What a correction may still credit of it; above it `INVOICE_CORRECTION_SHIPPING_ALREADY_REFUNDED`. */
681
+ creditable: number;
682
+ returnCodes: string[];
683
+ } | null;
526
684
  }
527
685
  /** A document {@link DocumentsModule.commitCorrection} issued, on either ledger. */
528
686
  export interface InvoiceCorrectionCommittedDocument {
@@ -566,6 +724,14 @@ export interface InvoiceCorrectionCommit {
566
724
  currencyCode: string;
567
725
  /** The receipts on the customer's account, one per payment the money came from. */
568
726
  unappliedCashIds: string[];
727
+ /** The store's book it landed in (`AR` or `STORE_CREDIT`). Absent from an engine before it. */
728
+ book?: 'AR' | 'STORE_CREDIT' | (string & {}) | null;
729
+ /**
730
+ * The customer's store-credit entries, one per payment the money came from, on the
731
+ * `STORE_CREDIT` book (empty on `AR`): read them with `storedValue.statement`. Absent from an
732
+ * engine before it.
733
+ */
734
+ storeCreditEntryIds?: string[];
569
735
  } | null;
570
736
  }
571
737
  export interface CommitInvoiceCorrectionCall extends Call {
@@ -605,7 +771,13 @@ export interface IssuePartialCreditNoteInput {
605
771
  lines: DocumentLineInput[];
606
772
  /** The invoice to credit; defaults to the order's newest live one. */
607
773
  invoiceId?: string;
608
- /** Also refund the credited amount against this payment. Omit for a document-only credit. */
774
+ /**
775
+ * Also refund the credited amount against this payment. Omit for a document-only credit.
776
+ *
777
+ * @deprecated Refund through {@link DocumentsModule.commitCorrection} instead: it plans the
778
+ * correction, refuses a plan that moved since the merchant saw it, and keys the refund. This
779
+ * form stays for existing callers; send it with an `idempotencyKey` (one per attempt).
780
+ */
609
781
  refundPaymentId?: string;
610
782
  /** Blocks for the credit note. An invalid one refuses the issue BEFORE the refund moves. */
611
783
  extensions?: DocumentExtensionInput[];
@@ -681,20 +853,353 @@ export interface DocumentExtensionsModule {
681
853
  * document issued against it froze its own copy and still redraws — but
682
854
  * nothing new can be written against it, so offering it as a choice would
683
855
  * only invite a `DOCUMENT_EXTENSION_VERSION_MISMATCH`.
856
+ *
857
+ * @effect read
684
858
  */
685
859
  list(options?: Call): Promise<Page<DocumentExtensionSchema>>;
686
860
  /**
687
861
  * Register a block, or a NEW VERSION of one. A key is never edited in place,
688
862
  * so documents already issued keep the schema and fragment they carry.
863
+ *
864
+ * @effect write
689
865
  */
690
866
  register(input: RegisterDocumentExtensionInput, options?: Call): Promise<DocumentExtensionSchema>;
691
867
  /**
692
868
  * Stop a key being usable on new documents. True when something was removed,
693
869
  * false when there was nothing — so a repeated delete is not an error.
694
870
  * Documents already issued with it are untouched.
871
+ *
872
+ * @effect destructive
695
873
  */
696
874
  delete(key: string, options?: Call): Promise<boolean>;
697
875
  }
876
+ /**
877
+ * The store's invoice and credit-note settings: numbering format, the document's columns and
878
+ * footer. `nextNumber` and `creditNoteNextNumber` are the series' next values, read only here.
879
+ */
880
+ export interface InvoiceConfig {
881
+ id: string;
882
+ enabled: boolean;
883
+ prefix: string;
884
+ suffix: string;
885
+ nextNumber: number;
886
+ digits: number;
887
+ /** `none`, `short` or `full`; a String on the wire, never an enum. */
888
+ yearFormat: string;
889
+ yearReset: boolean;
890
+ creditNoteNextNumber: number;
891
+ creditNotePrefix: string;
892
+ creditNoteSuffix: string;
893
+ creditNoteDigits: number;
894
+ creditNoteYearFormat: string;
895
+ creditNoteYearReset: boolean;
896
+ columnProduct: boolean;
897
+ columnSku: boolean;
898
+ columnQuantity: boolean;
899
+ columnUnitPriceExcl: boolean;
900
+ columnUnitPriceDiscount: boolean;
901
+ columnUnitPriceIncl: boolean;
902
+ /**
903
+ * The unit price after a manual override and the price list, in the document's tax basis.
904
+ * Absent on an engine released before 2026-10-10, which does not know the column: the read
905
+ * then retries once without it (and keeps doing so for this client). Send it in an update only
906
+ * when the read carried it, or that engine refuses the update.
907
+ */
908
+ columnUnitPriceAfterDiscount?: boolean;
909
+ columnLineTotal: boolean;
910
+ columnLineDiscount: boolean;
911
+ columnTaxRate: boolean;
912
+ columnTaxAmount: boolean;
913
+ columnTotal: boolean;
914
+ showLogo: boolean;
915
+ /** Print the legal entity's legal name, registration and VAT numbers under the supplier. */
916
+ legalIdentityBlock: boolean;
917
+ footerText: string | null;
918
+ defaultLanguage: string | null;
919
+ /** Deprecated: ignored once an external provider numbers the store. Clear it with `null`. */
920
+ externalNumberOrderField: string | null;
921
+ /** Who numbers this store's invoices and credit notes: `platform`, or an ERP's code. */
922
+ invoicingProvider: string;
923
+ }
924
+ /** What {@link DocumentsModule.invoiceConfig}`.update` changes; a field left out keeps its value. */
925
+ export interface UpdateInvoiceConfigInput {
926
+ enabled?: boolean;
927
+ prefix?: string;
928
+ suffix?: string;
929
+ digits?: number;
930
+ yearFormat?: string;
931
+ yearReset?: boolean;
932
+ creditNotePrefix?: string;
933
+ creditNoteSuffix?: string;
934
+ creditNoteDigits?: number;
935
+ creditNoteYearFormat?: string;
936
+ creditNoteYearReset?: boolean;
937
+ columnProduct?: boolean;
938
+ columnSku?: boolean;
939
+ columnQuantity?: boolean;
940
+ columnUnitPriceExcl?: boolean;
941
+ columnUnitPriceDiscount?: boolean;
942
+ columnUnitPriceIncl?: boolean;
943
+ columnUnitPriceAfterDiscount?: boolean;
944
+ columnLineTotal?: boolean;
945
+ columnLineDiscount?: boolean;
946
+ columnTaxRate?: boolean;
947
+ columnTaxAmount?: boolean;
948
+ columnTotal?: boolean;
949
+ showLogo?: boolean;
950
+ legalIdentityBlock?: boolean;
951
+ footerText?: string | null;
952
+ defaultLanguage?: string | null;
953
+ /** Deprecated adoption field: only `null` (clear it) is meaningful now. */
954
+ externalNumberOrderField?: null;
955
+ }
956
+ /** An invoicing provider installed on this platform, and whether this store could switch to it. */
957
+ export interface InvoicingProvider {
958
+ code: string;
959
+ label: string;
960
+ /** Books documents in a system outside the platform (an ERP). */
961
+ external: boolean;
962
+ /** The documents it numbers, as `<ledger>:<type>` (`retail:invoice`, `ar:credit_note`). */
963
+ documents: string[];
964
+ ready: boolean;
965
+ /** Why not, when it is not ready: what to set up first. */
966
+ notReadyReason: string | null;
967
+ }
968
+ /**
969
+ * One attempt to book a financial document in an external invoicing provider. `status`:
970
+ * `reserved` (the call's outcome is unknown), `booked` (`externalNumber` null while the number is
971
+ * pending), `failed` (refused, nothing booked), `abandoned` (an unknown outcome an admin closed),
972
+ * `resolved` (a booking the store never recorded, handled in the ERP by an admin).
973
+ */
974
+ export interface FinancialDocumentIssue {
975
+ id: string;
976
+ provider: string;
977
+ operationKey: string;
978
+ /** `invoice` or `credit_note`. */
979
+ documentType: string;
980
+ /** `retail` or `ar`. */
981
+ ledger: string;
982
+ orderId: string | null;
983
+ status: string;
984
+ externalRef: string | null;
985
+ externalNumber: string | null;
986
+ documentDate: string | null;
987
+ attempts: number;
988
+ lastError: string | null;
989
+ reservedAt: string;
990
+ bookedAt: string | null;
991
+ /** When the local document carrying the number committed; null while it has not. */
992
+ recordedAt: string | null;
993
+ abandonReason: string | null;
994
+ }
995
+ /** What {@link DocumentsModule.issues}`.list` is asked. */
996
+ export interface FinancialDocumentIssueListOptions extends ListOptions {
997
+ /** Only the attempts that still need someone: reserved, or booked and never recorded. */
998
+ unresolvedOnly?: boolean;
999
+ }
1000
+ /** What {@link DocumentsModule.sendProforma} sends. */
1001
+ export interface SendProformaInput {
1002
+ /** `YYYY-MM-DD`: the date the proforma states. Within 30 days either side of today. */
1003
+ invoicedOn: string;
1004
+ /** At least one, at most 10; each one an address the email door takes. */
1005
+ recipients: string[];
1006
+ /** The email's cover text, also printed on the PDF. At most 500 characters. */
1007
+ message?: string;
1008
+ languageCode?: string;
1009
+ }
1010
+ /** One proforma send, as recorded once the email went out. */
1011
+ export interface ProformaSend {
1012
+ id: string;
1013
+ orderId: string;
1014
+ /** The addresses it reached. */
1015
+ recipients: string[];
1016
+ message: string | null;
1017
+ /** `YYYY-MM-DD`. */
1018
+ invoicedOn: string;
1019
+ createdAt: string;
1020
+ }
1021
+ /** One "Email the invoice" send, as recorded once the email went out. */
1022
+ export interface InvoiceEmailSend {
1023
+ id: string;
1024
+ orderId: string;
1025
+ recipientsTo: string[];
1026
+ recipientsCc: string[];
1027
+ createdAt: string;
1028
+ }
1029
+ /** The store's packing-slip settings: numbering format, columns, the fulfillment fields shown. */
1030
+ export interface PackingSlipConfig {
1031
+ id: string;
1032
+ enabled: boolean;
1033
+ prefix: string;
1034
+ suffix: string;
1035
+ nextNumber: number;
1036
+ digits: number;
1037
+ yearFormat: string;
1038
+ yearReset: boolean;
1039
+ columnRowNumber: boolean;
1040
+ columnProduct: boolean;
1041
+ columnSku: boolean;
1042
+ columnQuantity: boolean;
1043
+ showLogo: boolean;
1044
+ showInvoiceNumber: boolean;
1045
+ /** JSON-encoded `{ [handlerCode]: { [fieldKey]: boolean } }`. */
1046
+ fulfillmentFieldVisibility: string | null;
1047
+ footerText: string | null;
1048
+ defaultLanguage: string | null;
1049
+ }
1050
+ /** What {@link DocumentsModule.packingSlipConfig}`.update` changes; a field left out keeps its value. */
1051
+ export interface UpdatePackingSlipConfigInput {
1052
+ enabled?: boolean;
1053
+ prefix?: string;
1054
+ suffix?: string;
1055
+ digits?: number;
1056
+ yearFormat?: string;
1057
+ yearReset?: boolean;
1058
+ columnRowNumber?: boolean;
1059
+ columnSku?: boolean;
1060
+ showLogo?: boolean;
1061
+ showInvoiceNumber?: boolean;
1062
+ /** JSON-encoded `{ [handlerCode]: { [fieldKey]: boolean } }`. */
1063
+ fulfillmentFieldVisibility?: string;
1064
+ footerText?: string | null;
1065
+ defaultLanguage?: string | null;
1066
+ }
1067
+ /** A fulfillment field a packing slip can show. */
1068
+ export interface PackingSlipField {
1069
+ /** `core:*`, `arg:<name>` or `cf:<name>`. */
1070
+ key: string;
1071
+ label: string;
1072
+ /** `string`, `number`, `boolean` or `datetime`. */
1073
+ type: string;
1074
+ defaultVisible: boolean;
1075
+ }
1076
+ /** The fields one fulfillment handler offers a packing slip. */
1077
+ export interface PackingSlipHandlerFields {
1078
+ handlerCode: string;
1079
+ handlerName: string;
1080
+ fields: PackingSlipField[];
1081
+ }
1082
+ /**
1083
+ * Which document email {@link DocumentsModule.emailRecipients} answers for. `proforma` is
1084
+ * addressed like the invoice email.
1085
+ */
1086
+ export type DocumentEmailEvent = 'invoice_generated' | 'credit_note_issued' | 'proforma';
1087
+ /** Every {@link DocumentEmailEvent}, in the order the server's enum declares them. */
1088
+ export declare const DOCUMENT_EMAIL_EVENTS: readonly DocumentEmailEvent[];
1089
+ /** Who a document email goes to. */
1090
+ export interface DocumentEmailRecipients {
1091
+ to: string[];
1092
+ cc: string[];
1093
+ }
1094
+ /** The store's invoice settings, `admin.documents.invoiceConfig`. */
1095
+ export interface InvoiceConfigModule {
1096
+ /**
1097
+ * The store's invoice and credit-note settings (created with the defaults on first read).
1098
+ * Needs `ReadSettings`.
1099
+ *
1100
+ * @effect read
1101
+ * @permission ReadSettings
1102
+ */
1103
+ get(options?: Call): Promise<InvoiceConfig>;
1104
+ /**
1105
+ * Change the store's invoice settings. A store that is its legal entity's only numbering
1106
+ * store writes its numbering format (prefix, suffix, digits, year format and restart, for
1107
+ * invoices and credit notes) through to the legal entity's series (`legal_entity_numbering`);
1108
+ * one of several stores of a legal entity cannot change a format they share
1109
+ * (`LEGAL_ENTITY_NUMBERING_SHARED`, change it on the legal entity). The counters are never
1110
+ * set here. Needs `UpdateSettings`.
1111
+ *
1112
+ * Refusals: `NUMBERING_YEAR_FORMAT_INVALID`, `NUMBERING_AFFIX_INVALID`,
1113
+ * `NUMBERING_DIGITS_INVALID` (→ `ValidationError`), `NUMBER_PREFIX_RESERVED`,
1114
+ * `NUMBERING_RESTART_WOULD_REPEAT` and `LEGAL_ENTITY_NUMBERING_SHARED`
1115
+ * (→ `BusinessRuleError`). Against an engine without `columnUnitPriceAfterDiscount` the call
1116
+ * retries once without it in the answer; an input naming it is then refused.
1117
+ *
1118
+ * @effect write
1119
+ * @permission UpdateSettings
1120
+ */
1121
+ update(input: UpdateInvoiceConfigInput, options?: Call): Promise<InvoiceConfig>;
1122
+ }
1123
+ /** The invoicing providers, `admin.documents.invoicingProviders`. */
1124
+ export interface InvoicingProvidersModule {
1125
+ /**
1126
+ * Every invoicing provider installed, with whether this store could switch to it. A complete
1127
+ * list. Needs `ReadSettings`.
1128
+ *
1129
+ * @effect read
1130
+ * @permission ReadSettings
1131
+ */
1132
+ list(options?: Call): Promise<Page<InvoicingProvider>>;
1133
+ /**
1134
+ * Hand the numbering of this store's invoices and credit notes to another provider (`platform`,
1135
+ * or an ERP's code): from then on its documents are numbered and booked there. Written through
1136
+ * to the legal entity's series. Answers the store's invoice settings. Needs `UpdateSettings`.
1137
+ *
1138
+ * Refusals: `INVOICING_PROVIDER_NOT_READY`, `INVOICING_PROVIDER_SWITCH_BLOCKED` and
1139
+ * `LEGAL_ENTITY_NUMBERING_SHARED` (→ `BusinessRuleError`); a code no installed plugin
1140
+ * registered is `INVOICING_PROVIDER_UNAVAILABLE`.
1141
+ *
1142
+ * @effect money
1143
+ * @permission UpdateSettings
1144
+ */
1145
+ set(provider: string, options?: Call): Promise<InvoiceConfig>;
1146
+ }
1147
+ /** The store's external booking attempts, `admin.documents.issues`. */
1148
+ export interface FinancialDocumentIssuesModule {
1149
+ /**
1150
+ * This store's attempts to book documents in an external invoicing provider, newest first.
1151
+ * Paged: `limit` 1 to 200 (default 50), `after` the previous page's cursor. Needs `ReadSettings`.
1152
+ *
1153
+ * @effect read
1154
+ * @permission ReadSettings
1155
+ */
1156
+ list(options?: FinancialDocumentIssueListOptions): Promise<Page<FinancialDocumentIssue>>;
1157
+ /**
1158
+ * Close an attempt whose outcome could not be established, after checking the ERP by hand:
1159
+ * the ERP does not have the document. Issuing it again books it afresh. `reason` is required.
1160
+ * Needs `UpdateSettings`.
1161
+ *
1162
+ * Refusals: `INVOICING_ISSUE_NOT_FOUND` (→ `NotFoundError`; another store's too),
1163
+ * `INVOICING_ISSUE_CONFLICT` (→ `ConflictError`: no reason, or the attempt is not one an admin
1164
+ * may close) and `INVOICING_ISSUE_IN_PROGRESS` (another call is still talking to the provider).
1165
+ *
1166
+ * @effect destructive
1167
+ * @permission UpdateSettings
1168
+ */
1169
+ abandon(id: string, reason: string, options?: Call): Promise<FinancialDocumentIssue>;
1170
+ /**
1171
+ * Close a document the ERP booked but this store never recorded, after an admin handled it in
1172
+ * the ERP (reversed it, or found it deleted). Nothing is booked again. `reason` is required.
1173
+ * Needs `UpdateSettings`. Refusals as {@link abandon}.
1174
+ *
1175
+ * @effect write
1176
+ * @permission UpdateSettings
1177
+ */
1178
+ resolve(id: string, reason: string, options?: Call): Promise<FinancialDocumentIssue>;
1179
+ }
1180
+ /** The store's packing-slip settings, `admin.documents.packingSlipConfig`. */
1181
+ export interface PackingSlipConfigModule {
1182
+ /**
1183
+ * The store's packing-slip settings as it applies them: its own row (created with the
1184
+ * defaults on first read), with the numbering format of the organization when the store
1185
+ * inherits it. Needs `ReadSettings`.
1186
+ *
1187
+ * @effect read
1188
+ * @permission ReadSettings
1189
+ */
1190
+ get(options?: Call): Promise<PackingSlipConfig>;
1191
+ /**
1192
+ * Change the store's packing-slip settings. A store inheriting its organization's numbering
1193
+ * format (`settings.numbering_formats`) cannot change it here: a changed format field is refused
1194
+ * `ORGANIZATION_SETTINGS_INHERITED`, while one equal to the inherited value is an echo and is
1195
+ * dropped. Refusals: `NUMBERING_YEAR_FORMAT_INVALID` (→ `ValidationError`). Needs
1196
+ * `UpdateSettings`.
1197
+ *
1198
+ * @effect write
1199
+ * @permission UpdateSettings
1200
+ */
1201
+ update(input: UpdatePackingSlipConfigInput, options?: Call): Promise<PackingSlipConfig>;
1202
+ }
698
1203
  /**
699
1204
  * The store's documents: issuing them, reading the facts they were built from,
700
1205
  * and the tenant-registered blocks that extend them (headless spec §8.5).
@@ -713,10 +1218,12 @@ export interface DocumentExtensionsModule {
713
1218
  * `code` the schema keyword that refused — so a form marks each offending field
714
1219
  * rather than showing one joined sentence.
715
1220
  *
716
- * `idempotencyKey` on these calls is recorded on the wire and acts on nothing:
717
- * the Admin API is GraphQL and has no header for it (see {@link Call}). A
718
- * repeated `generate` is a second attempt, which for an invoice the platform
719
- * refuses on its own — an order carries at most one live standard invoice.
1221
+ * `idempotencyKey` acts on `issuePartialCreditNote` and `commitCorrection`, which
1222
+ * send it as an argument. On the other calls it is recorded on the wire and acts
1223
+ * on nothing: the Admin API is GraphQL and has no header for it (see
1224
+ * {@link Call}). A repeated `generate` is a second attempt, which for an invoice
1225
+ * the platform refuses on its own — an order carries at most one live standard
1226
+ * invoice.
720
1227
  */
721
1228
  export interface DocumentsModule {
722
1229
  /**
@@ -731,12 +1238,36 @@ export interface DocumentsModule {
731
1238
  * the money books into, and the caller's clock is not the store's. The
732
1239
  * overloads put that in the type system, and refuse an invoice-only option on
733
1240
  * a packing slip the same way.
1241
+ *
1242
+ * Both draw a number from the store's series. Issuing an invoice also documents each refund
1243
+ * made before it with a credit note, in the same run (ruling U13), and locks the order.
1244
+ *
1245
+ * **Coded refusals** (nothing is numbered): an invoice for an order that already has a live
1246
+ * standard invoice is `INVOICE_ISSUE_CONFLICT` (→ `ConflictError`); for an order in a state no
1247
+ * invoice is issued in, `INVOICE_ORDER_STATE_BLOCKS_ISSUE`; in a store with invoicing switched
1248
+ * off, `INVOICE_GENERATION_DISABLED`; for an order a live accounts-receivable invoice bills,
1249
+ * `INVOICE_LEDGER_CONFLICT` (→ `ConflictError`: an order is billed by one ledger; `details`
1250
+ * names the AR invoice; an engine before this refusal ISSUED the store invoice, billing the
1251
+ * order twice). A packing slip for a cancelled fulfillment is
1252
+ * `PACKING_SLIP_FULFILLMENT_CANCELLED`; in a store with packing slips off,
1253
+ * `PACKING_SLIP_GENERATION_DISABLED` (all → `BusinessRuleError`). An engine before these codes
1254
+ * answered them uncoded, with the same sentence. A packing slip that already exists is answered
1255
+ * as it is (see {@link regeneratePackingSlip}). A credential restricted to stock locations (an
1256
+ * API token or app installation with `locationIds`) is refused a packing slip first, with
1257
+ * `LOCATION_OUT_OF_SCOPE` (→ `BusinessRuleError`), for a fulfillment that does not ship from one
1258
+ * of them, another store's and a missing one included.
1259
+ *
1260
+ * @effect money
734
1261
  */
735
1262
  generate(subjectId: string, type: 'invoice', options: GenerateDocumentOptions & {
736
1263
  invoicedOn: string;
737
1264
  }): Promise<Invoice>;
738
1265
  generate(subjectId: string, type: 'packing-slip', options?: Omit<GenerateDocumentOptions, 'invoicedOn' | 'note'>): Promise<PackingSlip>;
739
- /** The numbered facts a document was built from. Needs `ReadOrder`. */
1266
+ /**
1267
+ * The numbered facts a document was built from. Needs `ReadOrder`.
1268
+ *
1269
+ * @effect read
1270
+ */
740
1271
  data(documentId: string, type: DocumentType, options?: Call): Promise<DocumentData>;
741
1272
  /**
742
1273
  * A five-minute download link for one of this store's documents. Needs
@@ -751,11 +1282,21 @@ export interface DocumentsModule {
751
1282
  * `ENTITY_NOT_FOUND` (→ `NotFoundError`) for a document outside this store
752
1283
  * or of another type; `DOCUMENT_PDF_NOT_AVAILABLE` when no PDF is stored for
753
1284
  * it (a credit note whose render has not landed).
1285
+ *
1286
+ * @effect read
754
1287
  */
755
1288
  downloadUrl(documentId: string, type: DocumentType, options?: Call): Promise<DocumentDownloadUrl>;
756
- /** Every invoice of an order, including voided ones. */
1289
+ /**
1290
+ * Every invoice of an order, including voided ones.
1291
+ *
1292
+ * @effect read
1293
+ */
757
1294
  invoices(orderId: string, options?: Call): Promise<Page<Invoice>>;
758
- /** Every credit note of an order. */
1295
+ /**
1296
+ * Every credit note of an order.
1297
+ *
1298
+ * @effect read
1299
+ */
759
1300
  creditNotes(orderId: string, options?: Call): Promise<Page<CreditNote>>;
760
1301
  /**
761
1302
  * The retail invoices and credit notes of a customer's orders in THIS store, newest first (the
@@ -767,18 +1308,29 @@ export interface DocumentsModule {
767
1308
  * the `total`. `ENTITY_NOT_FOUND` (→ `NotFoundError`) for a customer this store does not hold;
768
1309
  * a `limit` outside 1 to 100 is refused `USER_INPUT_ERROR` (→ `ValidationError`). An engine
769
1310
  * older than this method fails the document's validation.
1311
+ *
1312
+ * @effect read
770
1313
  */
771
1314
  forCustomer(customerId: string, options?: ListOptions): Promise<Page<CustomerDocument>>;
772
1315
  /**
773
1316
  * Render what an invoice WOULD look like, without numbering or storing one.
774
- * Returns the PDF bytes (the wire carries base64; this decodes it).
1317
+ * Returns the PDF bytes (the wire carries base64; this decodes it). Needs `UpdateOrder`.
1318
+ * Refused like {@link generate}'s invoice: `INVOICE_ORDER_STATE_BLOCKS_ISSUE` (an order whose
1319
+ * payment is still being arranged included; {@link sendProforma} still sends its proforma),
1320
+ * `INVOICE_GENERATION_DISABLED`.
1321
+ *
1322
+ * @effect read
775
1323
  */
776
1324
  previewInvoice(orderId: string, options: {
777
1325
  invoicedOn: string;
778
1326
  languageCode?: string;
779
1327
  note?: string;
780
1328
  } & Call): Promise<Uint8Array>;
781
- /** Email an order's invoice. True when the dispatch was accepted. */
1329
+ /**
1330
+ * Email an order's invoice. True when the dispatch was accepted.
1331
+ *
1332
+ * @effect write
1333
+ */
782
1334
  sendInvoiceEmail(input: SendInvoiceEmailInput, options?: Call): Promise<boolean>;
783
1335
  /**
784
1336
  * Email one of this store's credit notes: the same email and PDF the
@@ -791,9 +1343,15 @@ export interface DocumentsModule {
791
1343
  * `CREDIT_NOTE_PDF_NOT_AVAILABLE` (its PDF could not be rendered, nothing was
792
1344
  * sent), `CREDIT_NOTE_EMAIL_UNAVAILABLE` and `CREDIT_NOTE_EMAIL_SEND_FAILED`
793
1345
  * (the email provider's code when it gave one; its reason is in the email deliveries log) (→ `BusinessRuleError`).
1346
+ *
1347
+ * @effect write
794
1348
  */
795
1349
  sendCreditNoteEmail(input: SendCreditNoteEmailInput, options?: Call): Promise<boolean>;
796
- /** Every "Email the credit note" send of an order, newest first. Needs `ReadOrder`. */
1350
+ /**
1351
+ * Every "Email the credit note" send of an order, newest first. Needs `ReadOrder`.
1352
+ *
1353
+ * @effect read
1354
+ */
797
1355
  creditNoteEmailSends(orderId: string, options?: Call): Promise<Page<CreditNoteEmailSend>>;
798
1356
  /**
799
1357
  * Credit PART of a still-valid invoice; the invoice keeps standing.
@@ -822,8 +1380,32 @@ export interface DocumentsModule {
822
1380
  * An engine before these codes answered each one as `USER_INPUT_ERROR`
823
1381
  * (`ValidationError`) with the same sentence. Field-shape refusals (an empty
824
1382
  * reason, an invalid line) stay `USER_INPUT_ERROR`.
1383
+ *
1384
+ * **`options.idempotencyKey`: one per attempt.** A retry of that attempt (a
1385
+ * timeout, a dropped connection, a double click) re-sends it and gets the
1386
+ * first answer back: the same credit note, or the same refusal, with nothing
1387
+ * issued or refunded twice. Left out, one is made up and returned as
1388
+ * `idempotencyKey` on the result and on a thrown error. The SAME key with a
1389
+ * different input is `IDEMPOTENCY_CONFLICT` (`ConflictError`, 409); a repeat
1390
+ * while the first call still runs is `IDEMPOTENCY_IN_PROGRESS`. A new attempt
1391
+ * (after a refusal, or after the provider declined the refund) takes a new
1392
+ * key. A repeat answers `IDEMPOTENCY_OUTCOME_UNKNOWN` in two cases. Either the
1393
+ * refund's answer never came: record the provider's answer
1394
+ * (`admin.payments.reconcileRefund`), which frees the key. Or the refund was
1395
+ * made and the credit note could not follow: the key stays spent (there is
1396
+ * nothing to reconcile), so issue the credit note without `refundPaymentId`
1397
+ * under a new key. An engine before the key refuses the call (GraphQL
1398
+ * validation): deploy the engine first.
1399
+ *
1400
+ * **The refund form (`refundPaymentId`) is deprecated** in favour of
1401
+ * {@link commitCorrection}, which plans the correction first and refuses one
1402
+ * that moved since the merchant saw it. A document-only credit stays.
1403
+ *
1404
+ * @effect money
825
1405
  */
826
- issuePartialCreditNote(input: IssuePartialCreditNoteInput, options?: Call): Promise<CreditNote>;
1406
+ issuePartialCreditNote(input: IssuePartialCreditNoteInput, options?: Call): Promise<CreditNote & {
1407
+ idempotencyKey: string;
1408
+ }>;
827
1409
  /**
828
1410
  * What a correction of an issued invoice would issue, give back and refuse, before anything
829
1411
  * is written. Without an `outcome` it answers which outcomes the invoice can take and the
@@ -842,12 +1424,29 @@ export interface DocumentsModule {
842
1424
  *
843
1425
  * What would stop the correction is a `blocker`, not an error: `INVOICE_CORRECTION_*`, the
844
1426
  * issuing door's own codes (`INVOICE_HAS_PARTIAL_CREDITS`, `REFUND_EXCEEDS_PAYMENT`, …) and
845
- * the numbering provider's (`INVOICING_PROVIDER_NOT_READY`, …). Refusals of the call:
1427
+ * the numbering provider's (`INVOICING_PROVIDER_NOT_READY`, …). A partial credit never
1428
+ * credits what a return whose money moved already refunded, nor what an earlier live
1429
+ * correction already credited: `givenBack` says what that is, and lines above it block
1430
+ * `INVOICE_CORRECTION_QUANTITY_ALREADY_RETURNED`, `INVOICE_CORRECTION_AMOUNT_ALREADY_RETURNED`
1431
+ * or `INVOICE_CORRECTION_SHIPPING_ALREADY_REFUNDED` where a return gave some back, else
1432
+ * `INVOICE_CORRECTION_QUANTITY_ALREADY_CREDITED`, `INVOICE_CORRECTION_AMOUNT_ALREADY_CREDITED`
1433
+ * or `INVOICE_CORRECTION_SHIPPING_ALREADY_CREDITED` naming the credit notes (path
1434
+ * `lines/<i>/<field>`). Refusals of the call:
846
1435
  * `INVOICE_CORRECTION_INVOICE_NOT_FOUND` (→ `NotFoundError`; another store's invoice too),
847
1436
  * `INVALID_INVOICE_CORRECTION_INPUT` (→ `ValidationError`, `details[].field` names the field)
848
1437
  * and `INVOICE_CORRECTION_LEDGER_NOT_ALLOWED` (→ `PermissionDeniedError`: AR on a store
849
1438
  * without the AR ledger). Needs `UpdateOrder`. An engine older than this method fails the
850
1439
  * document's validation.
1440
+ *
1441
+ * Wrong payment terms are a details correction (`DETAILS_WRONG`): state `paymentTermsDays` or
1442
+ * `paymentConditionCode`, whichever `paymentTerms.accepts` names, and `paymentTerms.replacement`
1443
+ * answers what the corrected invoice prints and its due date. Blockers of those:
1444
+ * `INVOICE_CORRECTION_PAYMENT_TERMS_NOT_ACCEPTED` (the other member, or terms where none can be
1445
+ * stated), `PAYMENT_CONDITION_UNKNOWN`, `PAYMENT_CONDITION_UNUSABLE`,
1446
+ * `PAYMENT_TERMS_UNREADABLE`, `INVOICE_PAYMENT_TERMS_UNREPRESENTABLE` (no single due date), and
1447
+ * `INVOICE_CORRECTION_NOTHING_CHANGED` for the terms the invoice already states.
1448
+ *
1449
+ * @effect read
851
1450
  */
852
1451
  planCorrection(input: InvoiceCorrectionInput, options?: Call): Promise<InvoiceCorrectionPlan>;
853
1452
  /**
@@ -887,6 +1486,13 @@ export interface DocumentsModule {
887
1486
  *
888
1487
  * On an ERP-numbered store (`documents[].numberingProvider`), the documents are booked in the
889
1488
  * ERP and cannot be undone from the platform.
1489
+ *
1490
+ * A details correction that states payment terms also writes them to the order, in the same
1491
+ * transaction: the order's `paymentTermsDays` / `paymentConditionCode` (the other one cleared)
1492
+ * and its terms snapshot (`Order.paymentTerms`). It is the one way to change an invoiced
1493
+ * order's terms; the order's own doors refuse them (`ORDER_INVOICE_LOCKED`). No amount changes.
1494
+ *
1495
+ * @effect money
890
1496
  */
891
1497
  commitCorrection(input: InvoiceCorrectionInput, options: CommitInvoiceCorrectionCall): Promise<InvoiceCorrectionCommit & {
892
1498
  idempotencyKey: string;
@@ -900,30 +1506,134 @@ export interface DocumentsModule {
900
1506
  * `INVOICE_GENERATION_DISABLED` (→ `BusinessRuleError`). An engine before these codes answered
901
1507
  * the first four as `USER_INPUT_ERROR` (`ValidationError`) with the same sentence, and the last
902
1508
  * two as an uncoded error. Field-shape refusals (an invalid line) stay `USER_INPUT_ERROR`.
1509
+ *
1510
+ * @effect money
903
1511
  */
904
1512
  issueSupplementaryInvoice(input: IssueSupplementaryInvoiceInput, options?: Call): Promise<Invoice>;
1513
+ /**
1514
+ * Email the order's proforma: the invoice it WOULD issue on `invoicedOn`, marked proforma, to
1515
+ * each recipient. Nothing is numbered, stored or locked; each send is recorded (see
1516
+ * {@link proformaSends}) with the addresses it reached. True once it went out to at least one.
1517
+ * Needs `UpdateOrder`.
1518
+ *
1519
+ * Refusals, nothing sent: `INVOICE_ORDER_STATE_BLOCKS_ISSUE` (a cart, `Draft`, a cancelled
1520
+ * order or a state the store keeps uninvoiced; an order whose payment is still being arranged,
1521
+ * `ArrangingPayment`, IS sent its proforma though no invoice is issued there) and
1522
+ * `INVOICE_GENERATION_DISABLED`; `PROFORMA_SEND_REFUSED` (this server has no email delivery);
1523
+ * `PROFORMA_SEND_FAILED` (the email provider failed the send to every recipient); an empty,
1524
+ * over-long (more than 10) or unmailable recipient list, or a message over 500 characters, is
1525
+ * `USER_INPUT_ERROR` (→ `ValidationError`). Recipients come from the caller; the platform's
1526
+ * proposal is {@link emailRecipients} with `proforma`.
1527
+ *
1528
+ * @effect write
1529
+ * @permission UpdateOrder
1530
+ */
1531
+ sendProforma(orderId: string, input: SendProformaInput, options?: Call): Promise<boolean>;
1532
+ /**
1533
+ * Every proforma send of an order, newest first. A complete list. Needs `ReadOrder`.
1534
+ *
1535
+ * @effect read
1536
+ * @permission ReadOrder
1537
+ */
1538
+ proformaSends(orderId: string, options?: Call): Promise<Page<ProformaSend>>;
1539
+ /**
1540
+ * Every "Email the invoice" send of an order ({@link sendInvoiceEmail}), newest first. A
1541
+ * complete list. Needs `ReadOrder`.
1542
+ *
1543
+ * @effect read
1544
+ * @permission ReadOrder
1545
+ */
1546
+ invoiceEmailSends(orderId: string, options?: Call): Promise<Page<InvoiceEmailSend>>;
1547
+ /**
1548
+ * Who the order's document email goes to unless the caller names its own list: the customer
1549
+ * in `to`, unless one of their notification recipients subscribed to the email is set to
1550
+ * receive it instead (then those, in the order they were added); their other subscribed
1551
+ * recipients in `cc`. De-duplicated without regard to case, and an address the send doors
1552
+ * would refuse is left out. `proforma` is addressed like the invoice email. The dialogs that
1553
+ * send {@link sendInvoiceEmail}, {@link sendProforma} and {@link sendCreditNoteEmail} pre-fill
1554
+ * from it. Needs `ReadOrder`.
1555
+ *
1556
+ * `ENTITY_NOT_FOUND` (→ `NotFoundError`) for an order outside this store. An engine older than
1557
+ * this method fails the document's validation.
1558
+ *
1559
+ * @effect read
1560
+ * @permission ReadOrder
1561
+ */
1562
+ emailRecipients(orderId: string, event: DocumentEmailEvent, options?: Call): Promise<DocumentEmailRecipients>;
1563
+ /**
1564
+ * Redraw a fulfillment's packing slip under its OWN number, from the extension blocks it was
1565
+ * issued with (it takes no new ones), and store the new PDF in place of the old. Every refusal
1566
+ * comes before the slip is touched, so a refused redraw leaves the slip as it was:
1567
+ * `PACKING_SLIP_FULFILLMENT_CANCELLED` and `PACKING_SLIP_GENERATION_DISABLED`
1568
+ * (→ `BusinessRuleError`). A fulfillment with no slip yet gets a new one, which draws a
1569
+ * number: the method takes that, its strongest effect. Needs `UpdateOrder`. A credential
1570
+ * restricted to stock locations is refused first, `LOCATION_OUT_OF_SCOPE`, for a fulfillment
1571
+ * that does not ship from one of them, as {@link generate} is.
1572
+ *
1573
+ * @effect money
1574
+ * @permission UpdateOrder
1575
+ */
1576
+ regeneratePackingSlip(fulfillmentId: string, options?: {
1577
+ languageCode?: string;
1578
+ } & Call): Promise<PackingSlip>;
1579
+ /**
1580
+ * The fulfillment fields each fulfillment handler offers a packing slip. A complete list.
1581
+ * Needs `ReadSettings`.
1582
+ *
1583
+ * @effect read
1584
+ * @permission ReadSettings
1585
+ */
1586
+ packingSlipFields(options?: Call): Promise<Page<PackingSlipHandlerFields>>;
1587
+ invoiceConfig: InvoiceConfigModule;
1588
+ invoicingProviders: InvoicingProvidersModule;
1589
+ issues: FinancialDocumentIssuesModule;
1590
+ packingSlipConfig: PackingSlipConfigModule;
905
1591
  extensions: DocumentExtensionsModule;
1592
+ /** The accounts-receivable ledger's documents: AR invoices, statements and credit notes. */
1593
+ ar: ArDocumentsModule;
906
1594
  }
907
- export declare const GENERATE_INVOICE_MUTATION = "\n mutation GenerateInvoice(\n $orderId: ID!\n $invoicedOn: String!\n $languageCode: String\n $note: String\n $extensions: [DocumentExtensionInput!]\n ) {\n generateInvoice(\n orderId: $orderId\n invoicedOn: $invoicedOn\n languageCode: $languageCode\n note: $note\n extensions: $extensions\n ) { \n id\n invoiceNumber\n invoicedOn\n orderId\n languageCode\n storageKey\n totalWithTax\n currencyCode\n note\n voidedOn\n reversedByCreditNoteId\n supersededByInvoiceId\n reissueOfInvoiceId\n kind\n supplementsInvoiceId\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n numberingProvider\n createdAt\n }\n }\n";
1595
+ export declare const GENERATE_INVOICE_MUTATION = "\n mutation GenerateInvoice(\n $orderId: ID!\n $invoicedOn: String!\n $languageCode: String\n $note: String\n $extensions: [DocumentExtensionInput!]\n ) {\n generateInvoice(\n orderId: $orderId\n invoicedOn: $invoicedOn\n languageCode: $languageCode\n note: $note\n extensions: $extensions\n ) { \n id\n invoiceNumber\n invoicedOn\n orderId\n languageCode\n storageKey\n totalWithTax\n currencyCode\n note\n voidedOn\n reversedByCreditNoteId\n supersededByInvoiceId\n reissueOfInvoiceId\n kind\n supplementsInvoiceId\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n numberingProvider\n amountPaid\n amountDue\n createdAt\n }\n }\n";
908
1596
  export declare const GENERATE_PACKING_SLIP_MUTATION = "\n mutation GeneratePackingSlip(\n $fulfillmentId: ID!\n $languageCode: String\n $extensions: [DocumentExtensionInput!]\n ) {\n generatePackingSlip(\n fulfillmentId: $fulfillmentId\n languageCode: $languageCode\n extensions: $extensions\n ) { \n id\n packingSlipNumber\n fulfillmentId\n languageCode\n storageKey\n createdAt\n }\n }\n";
909
1597
  export declare const DOCUMENT_DATA_QUERY = "\n query DocumentData($documentId: ID!, $type: DocumentType!) {\n documentData(documentId: $documentId, type: $type)\n }\n";
910
1598
  export declare const CREATE_DOCUMENT_DOWNLOAD_URL_MUTATION = "\n mutation CreateDocumentDownloadUrl($documentId: ID!, $type: DocumentType!) {\n createDocumentDownloadUrl(documentId: $documentId, type: $type) {\n url\n expiresAt\n filename\n }\n }\n";
911
- export declare const ORDER_INVOICES_QUERY = "\n query OrderInvoices($orderId: ID!) {\n orderInvoices(orderId: $orderId) { \n id\n invoiceNumber\n invoicedOn\n orderId\n languageCode\n storageKey\n totalWithTax\n currencyCode\n note\n voidedOn\n reversedByCreditNoteId\n supersededByInvoiceId\n reissueOfInvoiceId\n kind\n supplementsInvoiceId\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n numberingProvider\n createdAt\n }\n }\n";
1599
+ export declare const ORDER_INVOICES_QUERY = "\n query OrderInvoices($orderId: ID!) {\n orderInvoices(orderId: $orderId) { \n id\n invoiceNumber\n invoicedOn\n orderId\n languageCode\n storageKey\n totalWithTax\n currencyCode\n note\n voidedOn\n reversedByCreditNoteId\n supersededByInvoiceId\n reissueOfInvoiceId\n kind\n supplementsInvoiceId\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n numberingProvider\n amountPaid\n amountDue\n createdAt\n }\n }\n";
912
1600
  export declare const ORDER_CREDIT_NOTES_QUERY = "\n query OrderCreditNotes($orderId: ID!) {\n orderCreditNotes(orderId: $orderId) { \n id\n creditNoteNumber\n issuedOn\n totalWithTax\n currencyCode\n reason\n invoiceId\n kind\n reversalOfInvoiceId\n returnId\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n refundId\n numberingProvider\n storageKey\n createdAt\n }\n }\n";
913
- export declare const CUSTOMER_DOCUMENTS_QUERY = "\n query CustomerDocuments($customerId: ID!, $options: CustomerDocumentListOptions) {\n customerDocuments(customerId: $customerId, options: $options) {\n totalItems\n items {\n type\n orderId\n orderCode\n invoice { \n id\n invoiceNumber\n invoicedOn\n orderId\n languageCode\n storageKey\n totalWithTax\n currencyCode\n note\n voidedOn\n reversedByCreditNoteId\n supersededByInvoiceId\n reissueOfInvoiceId\n kind\n supplementsInvoiceId\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n numberingProvider\n createdAt\n }\n creditNote { \n id\n creditNoteNumber\n issuedOn\n totalWithTax\n currencyCode\n reason\n invoiceId\n kind\n reversalOfInvoiceId\n returnId\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n refundId\n numberingProvider\n storageKey\n createdAt\n }\n }\n }\n }\n";
1601
+ export declare const CUSTOMER_DOCUMENTS_QUERY = "\n query CustomerDocuments($customerId: ID!, $options: CustomerDocumentListOptions) {\n customerDocuments(customerId: $customerId, options: $options) {\n totalItems\n items {\n type\n orderId\n orderCode\n invoice { \n id\n invoiceNumber\n invoicedOn\n orderId\n languageCode\n storageKey\n totalWithTax\n currencyCode\n note\n voidedOn\n reversedByCreditNoteId\n supersededByInvoiceId\n reissueOfInvoiceId\n kind\n supplementsInvoiceId\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n numberingProvider\n amountPaid\n amountDue\n createdAt\n }\n creditNote { \n id\n creditNoteNumber\n issuedOn\n totalWithTax\n currencyCode\n reason\n invoiceId\n kind\n reversalOfInvoiceId\n returnId\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n refundId\n numberingProvider\n storageKey\n createdAt\n }\n }\n }\n }\n";
914
1602
  export declare const PREVIEW_INVOICE_MUTATION = "\n mutation PreviewInvoice($orderId: ID!, $invoicedOn: String!, $languageCode: String, $note: String) {\n previewInvoice(orderId: $orderId, invoicedOn: $invoicedOn, languageCode: $languageCode, note: $note)\n }\n";
915
1603
  export declare const SEND_INVOICE_EMAIL_MUTATION = "\n mutation SendInvoiceEmail($input: SendInvoiceEmailInput!) {\n sendInvoiceEmail(input: $input)\n }\n";
916
1604
  export declare const SEND_CREDIT_NOTE_EMAIL_MUTATION = "\n mutation SendCreditNoteEmail($input: SendCreditNoteEmailInput!) {\n sendCreditNoteEmail(input: $input)\n }\n";
917
1605
  export declare const ORDER_CREDIT_NOTE_EMAIL_SENDS_QUERY = "\n query OrderCreditNoteEmailSends($orderId: ID!) {\n orderCreditNoteEmailSends(orderId: $orderId) {\n id\n orderId\n creditNoteId\n recipientsTo\n recipientsCc\n createdAt\n }\n }\n";
918
- export declare const ISSUE_PARTIAL_CREDIT_NOTE_MUTATION = "\n mutation IssuePartialCreditNote($input: IssuePartialCreditNoteInput!) {\n issuePartialCreditNote(input: $input) { \n id\n creditNoteNumber\n issuedOn\n totalWithTax\n currencyCode\n reason\n invoiceId\n kind\n reversalOfInvoiceId\n returnId\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n refundId\n numberingProvider\n storageKey\n createdAt\n }\n }\n";
919
- export declare const ISSUE_SUPPLEMENTARY_INVOICE_MUTATION = "\n mutation IssueSupplementaryInvoice($input: IssueSupplementaryInvoiceInput!) {\n issueSupplementaryInvoice(input: $input) { \n id\n invoiceNumber\n invoicedOn\n orderId\n languageCode\n storageKey\n totalWithTax\n currencyCode\n note\n voidedOn\n reversedByCreditNoteId\n supersededByInvoiceId\n reissueOfInvoiceId\n kind\n supplementsInvoiceId\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n numberingProvider\n createdAt\n }\n }\n";
920
- export declare const PLAN_INVOICE_CORRECTION_QUERY = "\n query PlanInvoiceCorrection($input: InvoiceCorrectionInput!) {\n planInvoiceCorrection(input: $input) { \n planHash\n ledger\n invoice { id invoiceNumber kind totalWithTax creditable currencyCode orderIds voidedOn }\n outcomes {\n outcome\n available\n unavailableCode\n unavailableMessage\n document\n needsLines\n prefillsLines\n needsAddresses\n allowsRefund\n allowsNote\n }\n prefill {\n source\n basis\n lines { description sku orderLineId quantity unitPrice unitPriceBasis taxRate }\n seededGross\n billedGross\n differs\n }\n outcome\n operation\n lineTotals { \n net\n tax\n gross\n taxSummary { taxRate net tax gross }\n }\n documents {\n type\n kind\n documentDate\n currencyCode\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n totals { \n net\n tax\n gross\n taxSummary { taxRate net tax gross }\n }\n issuer\n numbering { provider providerLabel external ready legalEntityId testStore }\n }\n refund {\n amount\n available\n unavailableCode\n unavailableMessage\n options { paymentId method amount refundable }\n recommendedPaymentId\n }\n accountCredit { available unavailableCode message }\n settlement\n blockers { code message path }\n }\n }\n";
1606
+ export declare const ISSUE_PARTIAL_CREDIT_NOTE_MUTATION = "\n mutation IssuePartialCreditNote($input: IssuePartialCreditNoteInput!, $idempotencyKey: String) {\n issuePartialCreditNote(input: $input, idempotencyKey: $idempotencyKey) { \n id\n creditNoteNumber\n issuedOn\n totalWithTax\n currencyCode\n reason\n invoiceId\n kind\n reversalOfInvoiceId\n returnId\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n refundId\n numberingProvider\n storageKey\n createdAt\n }\n }\n";
1607
+ export declare const ISSUE_SUPPLEMENTARY_INVOICE_MUTATION = "\n mutation IssueSupplementaryInvoice($input: IssueSupplementaryInvoiceInput!) {\n issueSupplementaryInvoice(input: $input) { \n id\n invoiceNumber\n invoicedOn\n orderId\n languageCode\n storageKey\n totalWithTax\n currencyCode\n note\n voidedOn\n reversedByCreditNoteId\n supersededByInvoiceId\n reissueOfInvoiceId\n kind\n supplementsInvoiceId\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n numberingProvider\n amountPaid\n amountDue\n createdAt\n }\n }\n";
1608
+ export declare const PLAN_INVOICE_CORRECTION_QUERY = "\n query PlanInvoiceCorrection($input: InvoiceCorrectionInput!) {\n planInvoiceCorrection(input: $input) { \n planHash\n ledger\n invoice { id invoiceNumber kind totalWithTax creditable currencyCode orderIds voidedOn }\n outcomes {\n outcome\n available\n unavailableCode\n unavailableMessage\n document\n needsLines\n prefillsLines\n needsAddresses\n allowsRefund\n allowsNote\n }\n prefill {\n source\n basis\n lines { description sku orderLineId quantity unitPrice unitPriceBasis taxRate }\n seededGross\n billedGross\n differs\n }\n outcome\n operation\n lineTotals { \n net\n tax\n gross\n taxSummary { taxRate net tax gross }\n }\n documents {\n type\n kind\n documentDate\n currencyCode\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n totals { \n net\n tax\n gross\n taxSummary { taxRate net tax gross }\n }\n issuer\n numbering { provider providerLabel external ready legalEntityId testStore }\n }\n refund {\n amount\n available\n unavailableCode\n unavailableMessage\n options { paymentId method amount refundable }\n recommendedPaymentId\n }\n accountCredit { available unavailableCode message book }\n settlement\n blockers { code message path }\n returnedGoods {\n lines {\n orderLineId\n description\n quantity\n returnedQuantity\n creditedQuantity\n creditableQuantity\n creditableAmount\n returnCodes\n }\n shipping { charged refunded credited creditable returnCodes }\n }\n givenBack {\n lines {\n orderLineId\n description\n quantity\n returnedQuantity\n creditedQuantity\n priceCredited\n creditableQuantity\n creditableAmount\n returnCodes\n creditNoteNumbers\n }\n shipping { charged refunded credited creditable returnCodes creditNoteNumbers }\n }\n paymentTerms {\n invoiced { summary paymentDays conditionCode dueOn }\n replacement { summary paymentDays conditionCode dueOn }\n accepts\n unavailableMessage\n }\n }\n }\n";
921
1609
  /**
922
1610
  * Its own document on purpose: `commitInvoiceCorrection` exists only on an engine with the
923
1611
  * correction commit, so on an older one this call alone fails validation.
924
1612
  */
925
- export declare const COMMIT_INVOICE_CORRECTION_MUTATION = "\n mutation CommitInvoiceCorrection(\n $input: InvoiceCorrectionInput!\n $expectedPlanHash: String!\n $idempotencyKey: String!\n ) {\n commitInvoiceCorrection(\n input: $input\n expectedPlanHash: $expectedPlanHash\n idempotencyKey: $idempotencyKey\n ) {\n plan { \n planHash\n ledger\n invoice { id invoiceNumber kind totalWithTax creditable currencyCode orderIds voidedOn }\n outcomes {\n outcome\n available\n unavailableCode\n unavailableMessage\n document\n needsLines\n prefillsLines\n needsAddresses\n allowsRefund\n allowsNote\n }\n prefill {\n source\n basis\n lines { description sku orderLineId quantity unitPrice unitPriceBasis taxRate }\n seededGross\n billedGross\n differs\n }\n outcome\n operation\n lineTotals { \n net\n tax\n gross\n taxSummary { taxRate net tax gross }\n }\n documents {\n type\n kind\n documentDate\n currencyCode\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n totals { \n net\n tax\n gross\n taxSummary { taxRate net tax gross }\n }\n issuer\n numbering { provider providerLabel external ready legalEntityId testStore }\n }\n refund {\n amount\n available\n unavailableCode\n unavailableMessage\n options { paymentId method amount refundable }\n recommendedPaymentId\n }\n accountCredit { available unavailableCode message }\n settlement\n blockers { code message path }\n }\n documents {\n ledger\n type\n id\n number\n kind\n totalWithTax\n currencyCode\n issuedOn\n numberingProvider\n }\n refund { id state total paymentId }\n accountCredit { amount currencyCode unappliedCashIds }\n }\n }\n";
1613
+ export declare const COMMIT_INVOICE_CORRECTION_MUTATION = "\n mutation CommitInvoiceCorrection(\n $input: InvoiceCorrectionInput!\n $expectedPlanHash: String!\n $idempotencyKey: String!\n ) {\n commitInvoiceCorrection(\n input: $input\n expectedPlanHash: $expectedPlanHash\n idempotencyKey: $idempotencyKey\n ) {\n plan { \n planHash\n ledger\n invoice { id invoiceNumber kind totalWithTax creditable currencyCode orderIds voidedOn }\n outcomes {\n outcome\n available\n unavailableCode\n unavailableMessage\n document\n needsLines\n prefillsLines\n needsAddresses\n allowsRefund\n allowsNote\n }\n prefill {\n source\n basis\n lines { description sku orderLineId quantity unitPrice unitPriceBasis taxRate }\n seededGross\n billedGross\n differs\n }\n outcome\n operation\n lineTotals { \n net\n tax\n gross\n taxSummary { taxRate net tax gross }\n }\n documents {\n type\n kind\n documentDate\n currencyCode\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n totals { \n net\n tax\n gross\n taxSummary { taxRate net tax gross }\n }\n issuer\n numbering { provider providerLabel external ready legalEntityId testStore }\n }\n refund {\n amount\n available\n unavailableCode\n unavailableMessage\n options { paymentId method amount refundable }\n recommendedPaymentId\n }\n accountCredit { available unavailableCode message book }\n settlement\n blockers { code message path }\n returnedGoods {\n lines {\n orderLineId\n description\n quantity\n returnedQuantity\n creditedQuantity\n creditableQuantity\n creditableAmount\n returnCodes\n }\n shipping { charged refunded credited creditable returnCodes }\n }\n givenBack {\n lines {\n orderLineId\n description\n quantity\n returnedQuantity\n creditedQuantity\n priceCredited\n creditableQuantity\n creditableAmount\n returnCodes\n creditNoteNumbers\n }\n shipping { charged refunded credited creditable returnCodes creditNoteNumbers }\n }\n paymentTerms {\n invoiced { summary paymentDays conditionCode dueOn }\n replacement { summary paymentDays conditionCode dueOn }\n accepts\n unavailableMessage\n }\n }\n documents {\n ledger\n type\n id\n number\n kind\n totalWithTax\n currencyCode\n issuedOn\n numberingProvider\n }\n refund { id state total paymentId }\n accountCredit { amount currencyCode unappliedCashIds book storeCreditEntryIds }\n }\n }\n";
926
1614
  export declare const DOCUMENT_EXTENSIONS_QUERY = "\n query DocumentExtensions {\n documentExtensions { \n key\n documentTypes\n schemaVersion\n jsonSchema\n templateFragment\n createdAt\n updatedAt\n }\n }\n";
927
1615
  export declare const REGISTER_DOCUMENT_EXTENSION_MUTATION = "\n mutation RegisterDocumentExtension($input: RegisterDocumentExtensionInput!) {\n registerDocumentExtension(input: $input) { \n key\n documentTypes\n schemaVersion\n jsonSchema\n templateFragment\n createdAt\n updatedAt\n }\n }\n";
928
1616
  export declare const DELETE_DOCUMENT_EXTENSION_MUTATION = "\n mutation DeleteDocumentExtension($key: String!) {\n deleteDocumentExtension(key: $key)\n }\n";
1617
+ export declare const INVOICE_CONFIG_QUERY = "\n query InvoiceConfig {\n invoiceConfig { \n \n id\n enabled\n prefix\n suffix\n nextNumber\n digits\n yearFormat\n yearReset\n creditNoteNextNumber\n creditNotePrefix\n creditNoteSuffix\n creditNoteDigits\n creditNoteYearFormat\n creditNoteYearReset\n columnProduct\n columnSku\n columnQuantity\n columnUnitPriceExcl\n columnUnitPriceDiscount\n columnUnitPriceIncl\n columnLineTotal\n columnLineDiscount\n columnTaxRate\n columnTaxAmount\n columnTotal\n showLogo\n legalIdentityBlock\n footerText\n defaultLanguage\n externalNumberOrderField\n invoicingProvider\n\n columnUnitPriceAfterDiscount\n }\n }\n";
1618
+ export declare const UPDATE_INVOICE_CONFIG_MUTATION = "\n mutation UpdateInvoiceConfig($input: UpdateInvoiceConfigInput!) {\n updateInvoiceConfig(input: $input) { \n \n id\n enabled\n prefix\n suffix\n nextNumber\n digits\n yearFormat\n yearReset\n creditNoteNextNumber\n creditNotePrefix\n creditNoteSuffix\n creditNoteDigits\n creditNoteYearFormat\n creditNoteYearReset\n columnProduct\n columnSku\n columnQuantity\n columnUnitPriceExcl\n columnUnitPriceDiscount\n columnUnitPriceIncl\n columnLineTotal\n columnLineDiscount\n columnTaxRate\n columnTaxAmount\n columnTotal\n showLogo\n legalIdentityBlock\n footerText\n defaultLanguage\n externalNumberOrderField\n invoicingProvider\n\n columnUnitPriceAfterDiscount\n }\n }\n";
1619
+ /** {@link INVOICE_CONFIG_QUERY} for an engine without `columnUnitPriceAfterDiscount`. */
1620
+ export declare const INVOICE_CONFIG_QUERY_LEGACY = "\n query InvoiceConfig {\n invoiceConfig { \n id\n enabled\n prefix\n suffix\n nextNumber\n digits\n yearFormat\n yearReset\n creditNoteNextNumber\n creditNotePrefix\n creditNoteSuffix\n creditNoteDigits\n creditNoteYearFormat\n creditNoteYearReset\n columnProduct\n columnSku\n columnQuantity\n columnUnitPriceExcl\n columnUnitPriceDiscount\n columnUnitPriceIncl\n columnLineTotal\n columnLineDiscount\n columnTaxRate\n columnTaxAmount\n columnTotal\n showLogo\n legalIdentityBlock\n footerText\n defaultLanguage\n externalNumberOrderField\n invoicingProvider\n }\n }\n";
1621
+ /** {@link UPDATE_INVOICE_CONFIG_MUTATION} for an engine without `columnUnitPriceAfterDiscount`. */
1622
+ export declare const UPDATE_INVOICE_CONFIG_MUTATION_LEGACY = "\n mutation UpdateInvoiceConfig($input: UpdateInvoiceConfigInput!) {\n updateInvoiceConfig(input: $input) { \n id\n enabled\n prefix\n suffix\n nextNumber\n digits\n yearFormat\n yearReset\n creditNoteNextNumber\n creditNotePrefix\n creditNoteSuffix\n creditNoteDigits\n creditNoteYearFormat\n creditNoteYearReset\n columnProduct\n columnSku\n columnQuantity\n columnUnitPriceExcl\n columnUnitPriceDiscount\n columnUnitPriceIncl\n columnLineTotal\n columnLineDiscount\n columnTaxRate\n columnTaxAmount\n columnTotal\n showLogo\n legalIdentityBlock\n footerText\n defaultLanguage\n externalNumberOrderField\n invoicingProvider\n }\n }\n";
1623
+ /** {@link SET_INVOICING_PROVIDER_MUTATION} for an engine without `columnUnitPriceAfterDiscount`. */
1624
+ export declare const SET_INVOICING_PROVIDER_MUTATION_LEGACY = "\n mutation SetInvoicingProvider($code: String!) {\n setInvoicingProvider(code: $code) { \n id\n enabled\n prefix\n suffix\n nextNumber\n digits\n yearFormat\n yearReset\n creditNoteNextNumber\n creditNotePrefix\n creditNoteSuffix\n creditNoteDigits\n creditNoteYearFormat\n creditNoteYearReset\n columnProduct\n columnSku\n columnQuantity\n columnUnitPriceExcl\n columnUnitPriceDiscount\n columnUnitPriceIncl\n columnLineTotal\n columnLineDiscount\n columnTaxRate\n columnTaxAmount\n columnTotal\n showLogo\n legalIdentityBlock\n footerText\n defaultLanguage\n externalNumberOrderField\n invoicingProvider\n }\n }\n";
1625
+ export declare const INVOICING_PROVIDERS_QUERY = "\n query InvoicingProviders {\n invoicingProviders {\n code\n label\n external\n documents\n ready\n notReadyReason\n }\n }\n";
1626
+ export declare const SET_INVOICING_PROVIDER_MUTATION = "\n mutation SetInvoicingProvider($code: String!) {\n setInvoicingProvider(code: $code) { \n \n id\n enabled\n prefix\n suffix\n nextNumber\n digits\n yearFormat\n yearReset\n creditNoteNextNumber\n creditNotePrefix\n creditNoteSuffix\n creditNoteDigits\n creditNoteYearFormat\n creditNoteYearReset\n columnProduct\n columnSku\n columnQuantity\n columnUnitPriceExcl\n columnUnitPriceDiscount\n columnUnitPriceIncl\n columnLineTotal\n columnLineDiscount\n columnTaxRate\n columnTaxAmount\n columnTotal\n showLogo\n legalIdentityBlock\n footerText\n defaultLanguage\n externalNumberOrderField\n invoicingProvider\n\n columnUnitPriceAfterDiscount\n }\n }\n";
1627
+ export declare const FINANCIAL_DOCUMENT_ISSUES_QUERY = "\n query FinancialDocumentIssues($unresolvedOnly: Boolean, $take: Int, $skip: Int) {\n financialDocumentIssues(unresolvedOnly: $unresolvedOnly, take: $take, skip: $skip) {\n totalItems\n items { \n id\n provider\n operationKey\n documentType\n ledger\n orderId\n status\n externalRef\n externalNumber\n documentDate\n attempts\n lastError\n reservedAt\n bookedAt\n recordedAt\n abandonReason\n }\n }\n }\n";
1628
+ export declare const ABANDON_FINANCIAL_DOCUMENT_ISSUE_MUTATION = "\n mutation AbandonFinancialDocumentIssue($id: ID!, $reason: String!) {\n abandonFinancialDocumentIssue(id: $id, reason: $reason) { \n id\n provider\n operationKey\n documentType\n ledger\n orderId\n status\n externalRef\n externalNumber\n documentDate\n attempts\n lastError\n reservedAt\n bookedAt\n recordedAt\n abandonReason\n }\n }\n";
1629
+ export declare const RESOLVE_FINANCIAL_DOCUMENT_ISSUE_MUTATION = "\n mutation ResolveFinancialDocumentIssue($id: ID!, $reason: String!) {\n resolveFinancialDocumentIssue(id: $id, reason: $reason) { \n id\n provider\n operationKey\n documentType\n ledger\n orderId\n status\n externalRef\n externalNumber\n documentDate\n attempts\n lastError\n reservedAt\n bookedAt\n recordedAt\n abandonReason\n }\n }\n";
1630
+ export declare const SEND_PROFORMA_INVOICE_MUTATION = "\n mutation SendProformaInvoice($input: SendProformaInvoiceInput!) {\n sendProformaInvoice(input: $input)\n }\n";
1631
+ export declare const ORDER_PROFORMA_SENDS_QUERY = "\n query OrderProformaSends($orderId: ID!) {\n orderProformaSends(orderId: $orderId) {\n id\n orderId\n recipients\n message\n invoicedOn\n createdAt\n }\n }\n";
1632
+ export declare const ORDER_INVOICE_EMAIL_SENDS_QUERY = "\n query OrderInvoiceEmailSends($orderId: ID!) {\n orderInvoiceEmailSends(orderId: $orderId) {\n id\n orderId\n recipientsTo\n recipientsCc\n createdAt\n }\n }\n";
1633
+ /** Its own document: `documentEmailRecipients` is new, so on an older engine this call alone fails. */
1634
+ export declare const DOCUMENT_EMAIL_RECIPIENTS_QUERY = "\n query DocumentEmailRecipients($orderId: ID!, $event: DocumentEmailEvent!) {\n documentEmailRecipients(orderId: $orderId, event: $event) {\n to\n cc\n }\n }\n";
1635
+ export declare const REGENERATE_PACKING_SLIP_MUTATION = "\n mutation RegeneratePackingSlip($fulfillmentId: ID!, $languageCode: String) {\n regeneratePackingSlip(fulfillmentId: $fulfillmentId, languageCode: $languageCode) {\n \n id\n packingSlipNumber\n fulfillmentId\n languageCode\n storageKey\n createdAt\n\n }\n }\n";
1636
+ export declare const PACKING_SLIP_FIELDS_QUERY = "\n query PackingSlipFulfillmentFields {\n packingSlipFulfillmentFields {\n handlerCode\n handlerName\n fields {\n key\n label\n type\n defaultVisible\n }\n }\n }\n";
1637
+ export declare const PACKING_SLIP_CONFIG_QUERY = "\n query PackingSlipConfig {\n packingSlipConfig { \n id\n enabled\n prefix\n suffix\n nextNumber\n digits\n yearFormat\n yearReset\n columnRowNumber\n columnProduct\n columnSku\n columnQuantity\n showLogo\n showInvoiceNumber\n fulfillmentFieldVisibility\n footerText\n defaultLanguage\n }\n }\n";
1638
+ export declare const UPDATE_PACKING_SLIP_CONFIG_MUTATION = "\n mutation UpdatePackingSlipConfig($input: UpdatePackingSlipConfigInput!) {\n updatePackingSlipConfig(input: $input) { \n id\n enabled\n prefix\n suffix\n nextNumber\n digits\n yearFormat\n yearReset\n columnRowNumber\n columnProduct\n columnSku\n columnQuantity\n showLogo\n showInvoiceNumber\n fulfillmentFieldVisibility\n footerText\n defaultLanguage\n }\n }\n";
929
1639
  export declare function createDocumentsModule(transport: Transport): DocumentsModule;