@sixtyninecommerce/admin 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/README.md +4598 -128
  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 +318 -17
  9. package/dist/catalog/products.js +182 -14
  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 +282 -25
  21. package/dist/catalog/variants.js +173 -25
  22. package/dist/catalog/visibility.d.ts +20 -5
  23. package/dist/catalog/visibility.js +19 -1
  24. package/dist/client.d.ts +116 -9
  25. package/dist/client.js +41 -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 +121 -10
  63. package/dist/fulfillments/index.js +120 -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 +129 -30
  71. package/dist/index.js +47 -9
  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 +40 -0
  87. package/dist/integrations/index.js +24 -0
  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 +114 -0
  91. package/dist/integrations/pipelines.js +46 -0
  92. package/dist/integrations/types.d.ts +322 -0
  93. package/dist/integrations/types.js +8 -0
  94. package/dist/jobs/bulk-action-run.d.ts +11 -2
  95. package/dist/jobs/bulk-action-run.js +4 -5
  96. package/dist/locations/index.d.ts +66 -0
  97. package/dist/locations/index.js +31 -0
  98. package/dist/meta/index.d.ts +162 -0
  99. package/dist/orders/bulk.d.ts +75 -0
  100. package/dist/orders/bulk.js +150 -0
  101. package/dist/orders/cancel-with-money.d.ts +227 -0
  102. package/dist/orders/cancel-with-money.js +153 -0
  103. package/dist/orders/commit-edit.d.ts +7 -1
  104. package/dist/orders/commit-edit.js +5 -1
  105. package/dist/orders/deposit-policy.d.ts +103 -0
  106. package/dist/orders/deposit-policy.js +202 -0
  107. package/dist/orders/drafts.d.ts +800 -0
  108. package/dist/orders/drafts.js +771 -0
  109. package/dist/orders/fields.d.ts +245 -0
  110. package/dist/orders/fields.js +188 -0
  111. package/dist/orders/get.d.ts +29 -19
  112. package/dist/orders/get.js +17 -8
  113. package/dist/orders/index.d.ts +125 -5
  114. package/dist/orders/index.js +35 -2
  115. package/dist/orders/lifecycle.d.ts +128 -0
  116. package/dist/orders/lifecycle.js +158 -0
  117. package/dist/orders/line-price-preview.d.ts +7 -2
  118. package/dist/orders/list.d.ts +222 -0
  119. package/dist/orders/list.js +377 -0
  120. package/dist/orders/manual-discounts.d.ts +11 -2
  121. package/dist/orders/manual-discounts.js +2 -0
  122. package/dist/orders/manual-pricing.d.ts +5 -0
  123. package/dist/orders/order-entry.d.ts +20 -7
  124. package/dist/orders/plan-edit.d.ts +1 -1
  125. package/dist/orders/plan-edit.js +4 -1
  126. package/dist/orders/settings.d.ts +201 -0
  127. package/dist/orders/settings.js +325 -0
  128. package/dist/orders/status.d.ts +159 -13
  129. package/dist/orders/status.js +21 -0
  130. package/dist/orders/surcharges.d.ts +8 -1
  131. package/dist/orders/surcharges.js +3 -2
  132. package/dist/payments/account-credit.d.ts +30 -0
  133. package/dist/payments/account-credit.js +19 -0
  134. package/dist/payments/ar.d.ts +292 -0
  135. package/dist/payments/ar.js +223 -0
  136. package/dist/payments/connected-account.d.ts +47 -0
  137. package/dist/payments/connected-account.js +61 -0
  138. package/dist/payments/credit-noted-fields.d.ts +12 -0
  139. package/dist/payments/credit-noted-fields.js +37 -0
  140. package/dist/payments/index.d.ts +263 -10
  141. package/dist/payments/index.js +133 -1
  142. package/dist/payments/methods.d.ts +332 -0
  143. package/dist/payments/methods.js +363 -0
  144. package/dist/payments/mollie-methods.d.ts +159 -0
  145. package/dist/payments/mollie-methods.js +141 -0
  146. package/dist/payments/payment-links.d.ts +180 -0
  147. package/dist/payments/payment-links.js +97 -0
  148. package/dist/payments/provider-keys.d.ts +150 -0
  149. package/dist/payments/provider-keys.js +118 -0
  150. package/dist/payments/providers.d.ts +86 -11
  151. package/dist/payments/providers.js +29 -0
  152. package/dist/payments/requests.d.ts +144 -0
  153. package/dist/payments/requests.js +92 -0
  154. package/dist/payments/store-credit-fields.d.ts +15 -0
  155. package/dist/payments/store-credit-fields.js +51 -0
  156. package/dist/pickups/index.d.ts +104 -0
  157. package/dist/pickups/index.js +105 -0
  158. package/dist/platform/channels.d.ts +132 -0
  159. package/dist/platform/channels.js +128 -0
  160. package/dist/platform/geo.d.ts +123 -0
  161. package/dist/platform/geo.js +144 -0
  162. package/dist/platform/tax.d.ts +154 -0
  163. package/dist/platform/tax.js +139 -0
  164. package/dist/pos/anomalies.d.ts +158 -0
  165. package/dist/pos/anomalies.js +64 -0
  166. package/dist/pos/assisted-selling.d.ts +79 -0
  167. package/dist/pos/assisted-selling.js +38 -0
  168. package/dist/pos/exchanges.d.ts +103 -0
  169. package/dist/pos/exchanges.js +22 -0
  170. package/dist/pos/gift-cards.d.ts +135 -0
  171. package/dist/pos/gift-cards.js +47 -0
  172. package/dist/pos/index.d.ts +2125 -32
  173. package/dist/pos/index.js +742 -4
  174. package/dist/pos/no-receipt.d.ts +94 -0
  175. package/dist/pos/no-receipt.js +25 -0
  176. package/dist/pos/offline-sales.d.ts +187 -0
  177. package/dist/pos/offline-sales.js +116 -0
  178. package/dist/pos/pay-by-link.d.ts +143 -0
  179. package/dist/pos/pay-by-link.js +57 -0
  180. package/dist/pos/quick-keys.d.ts +103 -0
  181. package/dist/pos/quick-keys.js +45 -0
  182. package/dist/pos/reports.d.ts +360 -0
  183. package/dist/pos/reports.js +62 -0
  184. package/dist/pos/returns.d.ts +217 -0
  185. package/dist/pos/returns.js +53 -0
  186. package/dist/pricing/bulk-coupons.d.ts +139 -0
  187. package/dist/pricing/bulk-coupons.js +112 -0
  188. package/dist/pricing/index.d.ts +177 -4
  189. package/dist/pricing/index.js +176 -1
  190. package/dist/pricing/price-lists.d.ts +604 -0
  191. package/dist/pricing/price-lists.js +600 -0
  192. package/dist/pricing/vouchers.d.ts +103 -0
  193. package/dist/pricing/vouchers.js +69 -0
  194. package/dist/purchasing/alerts.d.ts +89 -0
  195. package/dist/purchasing/alerts.js +62 -0
  196. package/dist/purchasing/cost.d.ts +110 -0
  197. package/dist/purchasing/cost.js +86 -0
  198. package/dist/purchasing/index.d.ts +36 -0
  199. package/dist/purchasing/index.js +16 -0
  200. package/dist/purchasing/purchase-orders.d.ts +548 -0
  201. package/dist/purchasing/purchase-orders.js +491 -0
  202. package/dist/purchasing/replenishment.d.ts +281 -0
  203. package/dist/purchasing/replenishment.js +240 -0
  204. package/dist/purchasing/settings.d.ts +152 -0
  205. package/dist/purchasing/settings.js +181 -0
  206. package/dist/purchasing/suppliers.d.ts +476 -0
  207. package/dist/purchasing/suppliers.js +438 -0
  208. package/dist/quotes/index.d.ts +501 -0
  209. package/dist/quotes/index.js +439 -0
  210. package/dist/reports/index.d.ts +71 -8
  211. package/dist/reports/index.js +74 -11
  212. package/dist/returns/index.d.ts +818 -0
  213. package/dist/returns/index.js +844 -0
  214. package/dist/search/index.d.ts +174 -0
  215. package/dist/search/index.js +125 -0
  216. package/dist/shipping/definitions.d.ts +29 -0
  217. package/dist/shipping/definitions.js +47 -0
  218. package/dist/shipping/fulfillment-profiles.d.ts +174 -0
  219. package/dist/shipping/fulfillment-profiles.js +104 -0
  220. package/dist/shipping/hendriks.d.ts +97 -0
  221. package/dist/shipping/hendriks.js +50 -0
  222. package/dist/shipping/index.d.ts +48 -0
  223. package/dist/shipping/index.js +25 -0
  224. package/dist/shipping/methods.d.ts +198 -0
  225. package/dist/shipping/methods.js +240 -0
  226. package/dist/shipping/myparcel.d.ts +254 -0
  227. package/dist/shipping/myparcel.js +178 -0
  228. package/dist/shipping/parcel-count-suggestion.d.ts +2 -0
  229. package/dist/shipping/parcel-rule.d.ts +6 -5
  230. package/dist/shipping/parcel-rule.js +21 -23
  231. package/dist/shipping/rate-tables.d.ts +179 -0
  232. package/dist/shipping/rate-tables.js +184 -0
  233. package/dist/stock/index.d.ts +10 -3
  234. package/dist/stock/index.js +3 -0
  235. package/dist/stock/locations.d.ts +144 -0
  236. package/dist/stock/locations.js +168 -0
  237. package/dist/stock/transfers.d.ts +216 -43
  238. package/dist/stock/transfers.js +140 -13
  239. package/dist/stored-value/index.d.ts +214 -4
  240. package/dist/stored-value/index.js +152 -0
  241. package/dist/subscriptions/index.d.ts +682 -0
  242. package/dist/subscriptions/index.js +815 -0
  243. package/dist/tax/index.d.ts +76 -1
  244. package/dist/tax/index.js +50 -0
  245. package/dist/tenant/email-style.d.ts +102 -0
  246. package/dist/tenant/email-style.js +72 -0
  247. package/dist/tenant/email-templates.d.ts +66 -0
  248. package/dist/tenant/email-templates.js +54 -0
  249. package/dist/tenant/notifications.d.ts +23 -17
  250. package/dist/tenant/settings-sources.d.ts +1 -1
  251. package/dist/tenant/time-zone.d.ts +17 -0
  252. package/dist/tenant/time-zone.js +11 -0
  253. package/dist/types.d.ts +51 -4
  254. package/dist/users/index.d.ts +3 -0
  255. package/dist/users/index.js +2 -0
  256. package/dist/users/warehouses.d.ts +50 -0
  257. package/dist/users/warehouses.js +51 -0
  258. package/package.json +2 -2
@@ -34,7 +34,7 @@ export type OrderAllocationBadge = (typeof ORDER_ALLOCATION_BADGES)[number];
34
34
  export declare const ORDER_EDIT_BLOCK_CODES: readonly ["INVOICE_LOCKED", "COMPLETED", "CANCELLED"];
35
35
  export type OrderEditBlockCode = (typeof ORDER_EDIT_BLOCK_CODES)[number];
36
36
  /** The actions the engine answers for, in the order it lists them. */
37
- export declare const ORDER_STATUS_ACTIONS: readonly ["MODIFY", "DELETE", "RELEASE_ALLOCATION", "CORRECT_FULFILLMENT", "CANCEL", "TRANSITION", "MARK_COMPLETED", "REOPEN"];
37
+ export declare const ORDER_STATUS_ACTIONS: readonly ["MODIFY", "DELETE", "RELEASE_ALLOCATION", "CORRECT_FULFILLMENT", "CANCEL", "TRANSITION", "MARK_COMPLETED", "REOPEN", "SET_PAYMENT_NOT_REQUIRED", "SET_FULFILLMENT_HOLD", "SET_GOODWILL_ROUNDING", "SET_BILLING_FIELDS", "APPLY_GOODWILL_ROUNDING", "SET_PRICING_FIELDS"];
38
38
  /**
39
39
  * One thing that can be done to an order, with the engine write behind it and
40
40
  * what `allowed` asks of the caller:
@@ -56,14 +56,76 @@ export declare const ORDER_STATUS_ACTIONS: readonly ["MODIFY", "DELETE", "RELEAS
56
56
  * locations (an API token or app installation with `locationIds`) must also
57
57
  * hold every location the order's reservation sits at; otherwise the release
58
58
  * answers `LOCATION_NOT_ALLOWED` and this action `PERMISSION`.
59
- * - `CANCEL`: `cancelOrder` for the whole order. Needs `UpdateOrder`.
59
+ * - `CANCEL`: `cancelOrder` for the whole order. Needs `UpdateOrder`. A credential
60
+ * restricted to stock locations must also hold every location the order's
61
+ * reservation sits at (a cancel releases it there); otherwise the cancel answers
62
+ * `LOCATION_OUT_OF_SCOPE` and this action `PERMISSION`.
60
63
  * - `TRANSITION`: `transitionOrderToState` into one of `nextStates`. Needs
61
64
  * `UpdateOrder`.
62
- * - `MARK_COMPLETED`: `markOrderCompleted`. Needs `UpdateOrder`.
63
- * - `REOPEN`: `reopenOrder`. Needs `UpdateOrder`.
65
+ * - `MARK_COMPLETED`: `orders.markCompleted`. Needs `UpdateOrder`.
66
+ * - `REOPEN`: `orders.reopen`. Needs `UpdateOrder`.
67
+ * - `SET_PAYMENT_NOT_REQUIRED`: `orders.setPaymentNotRequired`, in the direction it would go
68
+ * next: lifting the waiver while the order carries one (`lifecycle.payment` then reads
69
+ * `not_required`), waiving it otherwise. A cancelled order changes neither way (`CANCELLED`);
70
+ * an order whose payment reads `not_required` without a waiver (a total of 0) has nothing to
71
+ * waive or lift (`STATE`); a waiver waits while an invoice still bills the order
72
+ * (`CREDIT_NOTE_REQUIRED`). The write refuses the `CANCELLED` and `CREDIT_NOTE_REQUIRED`
73
+ * cases, `ORDER_PAYMENT_WAIVER_REFUSED`; it takes a waiver on a zero-total order, which this
74
+ * action does not offer. Needs `UpdateOrder`.
75
+ * - `SET_FULFILLMENT_HOLD`: `orders.setFulfillmentHold`, in the direction it would go next: a
76
+ * release while `lifecycle.fulfillment` is `on_hold` (any order but a live cart), a new hold
77
+ * only on an open order (`STATE` otherwise). Needs `UpdateOrder`.
78
+ * - `SET_GOODWILL_ROUNDING`: `orders.setGoodwillRounding`, either way (apply or clear). Closed
79
+ * once the order's total no longer moves: an invoice bills it (`INVOICE_LOCKED`), it is
80
+ * completed or cancelled (`COMPLETED`, `CANCELLED`), or it is settled or invoiced in the
81
+ * store's ERP (`ERP_LOCKED`); the write then refuses `GOODWILL_ROUNDING_LOCKED`. Whether
82
+ * there is anything to round (one VAT rate, a total that is not whole) is not answered here:
83
+ * applying to such an order is refused `GOODWILL_ROUNDING_NOT_APPLICABLE`. Needs
84
+ * `UpdateOrder`. Whether APPLYING one is open is `APPLY_GOODWILL_ROUNDING`.
85
+ * - `APPLY_GOODWILL_ROUNDING`: `orders.setGoodwillRounding` with `apply: true`. The same lock as
86
+ * `SET_GOODWILL_ROUNDING` first, then `LEAVES_MONEY_OVER`: the order is paid, and its payments
87
+ * would hold more than the rounded total; the write then refuses
88
+ * `GOODWILL_ROUNDING_LEAVES_MONEY_OVER`, because the rounding refunds nothing. Clearing a
89
+ * rounding stays `SET_GOODWILL_ROUNDING` alone. Needs `UpdateOrder`.
90
+ * - `SET_BILLING_FIELDS`: a change of `customFields.removeTax`, `paymentTermsDays` or
91
+ * `paymentConditionCode`, the order's fields that decide what it BILLS, through the engine's
92
+ * `setOrderCustomFields` or `setOrderRemoveTax`. Closed while a live invoice bills the order
93
+ * (`INVOICE_LOCKED`): its standard invoice not voided, or an accounts-receivable invoice
94
+ * neither voided nor superseded. The write then refuses `ORDER_INVOICE_LOCKED` (422), with
95
+ * the field in `details[].field` (a pointer into the arguments) and a sentence naming the
96
+ * invoice and its ledger in `details[].message`; what the order bills is changed through that
97
+ * invoice's correction (`documents.commitCorrection`). A value equal to the stored one is
98
+ * never refused, and notes and the order's reference (`orders.setPurchaseOrderNumber`) are
99
+ * not part of it. It answers those two writes only, and they store the value without
100
+ * recalculating the order. Applying it to the order's amounts (the order edit:
101
+ * `orders.planEdit`, `orders.commitEdit`), and changing a line's `unitPriceOverride` or
102
+ * `unitPriceImported`, which this lock refuses too, are also closed while `MODIFY` answers
103
+ * `INVOICE_LOCKED`, and that outlives the void of a retail invoice. The void opens the payment
104
+ * terms again, not `removeTax`: `SET_PRICING_FIELDS` answers that. Needs `UpdateOrder`.
105
+ * - `SET_PRICING_FIELDS`: a change of `customFields.removeTax`, or of a line's
106
+ * `unitPriceOverride` or `unitPriceImported`, the fields that decide the order's AMOUNTS, at
107
+ * the engine's custom-field writes (`setOrderCustomFields`, `setOrderRemoveTax`,
108
+ * `modifyOrder`, the draft line writes). Closed (`INVOICE_LOCKED`) while a live invoice bills
109
+ * the order, and while its content stays locked with none: after its retail invoice was
110
+ * voided, and on an order the platform it was imported from invoiced. Nothing recalculates
111
+ * such an order, so its tax and prices stay as invoiced. The write refuses
112
+ * `ORDER_INVOICE_LOCKED` (422) with the field in `details[].field` and the reason in
113
+ * `details[].message`. A value equal to the stored one is never refused; the payment terms
114
+ * are not part of it. Needs `UpdateOrder`.
115
+ *
116
+ * The two toggles are answered by engines from W10-25 on, the rounding from W10-26 on, and
117
+ * `SET_BILLING_FIELDS` and `SET_PRICING_FIELDS` from the engines that enforce them on; an older
118
+ * engine leaves them out of `actions`. For the first three that reads as "not available"; an
119
+ * engine that does not answer `SET_BILLING_FIELDS` does not lock those fields either, and one
120
+ * that does not answer `SET_PRICING_FIELDS` locks them only as `SET_BILLING_FIELDS` says. `APPLY_GOODWILL_ROUNDING` is answered
121
+ * by the engine that refuses a rounding on a paid order; an older one leaves it out and does not
122
+ * refuse it, so read a missing answer as "not available" (never offer the rounding on a guess).
64
123
  * - `CORRECT_FULFILLMENT`: one of TWO writes, with different gates.
65
- * - `updateFulfillmentLineQuantities` needs `UpdateOrder`, and corrects any
66
- * fulfillment of the order on any store.
124
+ * - `updateFulfillmentLineQuantities` (`orders.correctFulfillmentQuantities`) needs
125
+ * `UpdateOrder`, and corrects any fulfillment of the order on any store. A credential
126
+ * restricted to stock locations (an API token or app installation with `locationIds`)
127
+ * corrects only a fulfillment that ships from one of them (`LOCATION_OUT_OF_SCOPE`
128
+ * otherwise).
67
129
  * - `correctFulfillmentQuantities` needs `UpdateFulfillment` or
68
130
  * `UpdateOrder`, and works only on a store with the warehouse workspace
69
131
  * (`WAREHOUSE_NOT_ENABLED` otherwise). For a caller without `UpdateOrder`
@@ -73,7 +135,8 @@ export declare const ORDER_STATUS_ACTIONS: readonly ["MODIFY", "DELETE", "RELEAS
73
135
  * quantity (`OFFICE_ONLY`).
74
136
  *
75
137
  * So `allowed` is true for a caller with `UpdateOrder` whenever the order is
76
- * eligible. For a caller holding `UpdateFulfillment` without `UpdateOrder`
138
+ * eligible, except a credential restricted to stock locations, for which it is true only
139
+ * while one of THIS order's fulfillments ships from one of its locations. For a caller holding `UpdateFulfillment` without `UpdateOrder`
77
140
  * it is true only on a store with the warehouse workspace, and only while
78
141
  * at least one of THIS order's fulfillments ships from one of the caller's
79
142
  * warehouses. That caller must call `correctFulfillmentQuantities`: the
@@ -86,7 +149,7 @@ export declare const ORDER_STATUS_ACTIONS: readonly ["MODIFY", "DELETE", "RELEAS
86
149
  */
87
150
  export type OrderStatusActionName = (typeof ORDER_STATUS_ACTIONS)[number];
88
151
  /** Why an action is not allowed, in the order the engine lists them. */
89
- export declare const ORDER_STATUS_REASON_CODES: readonly ["INVOICE_LOCKED", "COMPLETED", "CANCELLED", "STATE", "NOTHING_ALLOCATED", "HAS_RECORDS", "NOTHING_TO_CANCEL", "SHOPPER_CART", "UNITS_SHIPPED", "ACTIVE_FULFILLMENT", "PERMISSION"];
152
+ export declare const ORDER_STATUS_REASON_CODES: readonly ["INVOICE_LOCKED", "COMPLETED", "CANCELLED", "STATE", "NOTHING_ALLOCATED", "HAS_RECORDS", "NOTHING_TO_CANCEL", "SHOPPER_CART", "UNITS_SHIPPED", "ACTIVE_FULFILLMENT", "CREDIT_NOTE_REQUIRED", "HOLDS_MONEY", "ERP_LOCKED", "LEAVES_MONEY_OVER", "PERMISSION"];
90
153
  /**
91
154
  * - `INVOICE_LOCKED`, `COMPLETED`, `CANCELLED`: the edit block.
92
155
  * - `STATE`: the order's state does not allow it.
@@ -104,6 +167,31 @@ export declare const ORDER_STATUS_REASON_CODES: readonly ["INVOICE_LOCKED", "COM
104
167
  * units come back through a return.
105
168
  * - `ACTIVE_FULFILLMENT`: a fulfillment not yet shipped holds a line. Detach
106
169
  * the order from it or correct its quantities first.
170
+ * - `CREDIT_NOTE_REQUIRED` (`CANCEL` and `SET_PAYMENT_NOT_REQUIRED`): an invoice
171
+ * still bills the order, paid or not. For `SET_PAYMENT_NOT_REQUIRED`, correct
172
+ * the invoice first. For `CANCEL`, cancelling (whole or by lines) would leave
173
+ * the invoice standing. Do what {@link OrderStatusView.cancelCreditNote}'s `remedy`
174
+ * says first, then cancel: `CORRECT_INVOICE`, correct the invoice it names
175
+ * (`documents.commitCorrection` on its ledger: credit it in full, with a
176
+ * refund on a retail invoice); `REFUND_PAYMENT`, refund the order's settled
177
+ * payment (`payments.refund`), whose AR credit note corrects the invoice,
178
+ * and do NOT correct it as well (that credits the customer twice). Both cancel
179
+ * doors (`cancelOrder` and `orders.cancelWithMoney`) refuse
180
+ * `ORDER_CANCEL_CREDIT_NOTE_CONFLICT` (409) meanwhile. Named before
181
+ * `HOLDS_MONEY`.
182
+ * - `HOLDS_MONEY`: `CANCEL` only. The order has been placed or parked and
183
+ * still holds money, which a plain cancel would leave on it (the Admin
184
+ * `cancelOrder` refuses it `ORDER_HOLDS_MONEY`). Cancel it with
185
+ * `orders.cancelWithMoney`, or give its money back first: refund settled
186
+ * payments, cancel card holds (a hold released at the payment provider
187
+ * first where its payment method cannot). The value of spent gift cards
188
+ * sold on it is never given back: only `orders.cancelWithMoney`'s
189
+ * `retain` keeps it.
190
+ * - `ERP_LOCKED`: `SET_GOODWILL_ROUNDING` and `APPLY_GOODWILL_ROUNDING` only. The order is
191
+ * settled or invoiced in the store's ERP, which holds its total: correct it there.
192
+ * - `LEAVES_MONEY_OVER`: `APPLY_GOODWILL_ROUNDING` only. The order is paid: rounding its total
193
+ * down would leave the customer's money over the rounded total, which nothing pays back.
194
+ * Refund the customer instead.
107
195
  * - `PERMISSION`: the order allows it and this caller may not. The only
108
196
  * reason about the caller.
109
197
  */
@@ -147,13 +235,18 @@ export interface OrderStatusView {
147
235
  locked: boolean;
148
236
  reason: OrderLockReason | (string & {});
149
237
  /**
150
- * Set only when the reason is `INVOICE`: the live standard invoice, else a
151
- * voided standard one (voiding does not unlock the order).
238
+ * Set only when the reason is `INVOICE`: the live standard retail invoice,
239
+ * else the live accounts-receivable invoice billing the order, else a voided
240
+ * standard retail one (voiding a retail invoice does not unlock the order;
241
+ * an AR invoice locks only while it is live, so it is never voided here).
242
+ * `ledger` is `RETAIL` or `AR`: the ledger to correct it on
243
+ * (`documents.planCorrection`).
152
244
  */
153
245
  lockingInvoice: {
154
246
  id: string;
155
247
  number: string;
156
248
  voided: boolean;
249
+ ledger: 'RETAIL' | 'AR' | (string & {});
157
250
  } | null;
158
251
  };
159
252
  /** Null when the order's content may change; the message is the one every edit is refused with. */
@@ -192,6 +285,12 @@ export interface OrderStatusView {
192
285
  * fulfillment provider, and the store blocks shipping it again.
193
286
  */
194
287
  sourceFulfilled: boolean;
288
+ /**
289
+ * Why `sourceFulfilled` is true, in words for staff (the source platform and its order
290
+ * number), the same sentence the warehouse demand carries; null when it is false. Show it as
291
+ * sent rather than composing one.
292
+ */
293
+ sourceFulfilledReason: string | null;
195
294
  /** Set while the order is parked. */
196
295
  park: {
197
296
  reason: string | null;
@@ -207,6 +306,13 @@ export interface OrderStatusView {
207
306
  } | null;
208
307
  /** Empty when the order runs on every provider the store assigned. */
209
308
  providerFallbacks: OrderStatusProviderFallback[];
309
+ /**
310
+ * Set while a cancel (whole or by lines) waits for a credit note (`CANCEL` answers
311
+ * `CREDIT_NOTE_REQUIRED`, unless a more fundamental reason comes first).
312
+ * This SDK's document selects it, so against an engine older than the field
313
+ * `status` fails validation: deploy the engine first.
314
+ */
315
+ cancelCreditNote: OrderStatusCancelCreditNote | null;
210
316
  /**
211
317
  * The states a change-status menu lists, in the engine's order: without
212
318
  * `Cancelled` and `Modifying` (their own actions), without the cart phase,
@@ -216,7 +322,41 @@ export interface OrderStatusView {
216
322
  nextStates: string[];
217
323
  actions: OrderStatusAction[];
218
324
  }
219
- export declare const ORDER_STATUS_QUERY = "\n query OrderStatus($orderId: ID!) {\n orderStatus(orderId: $orderId) {\n orderId\n state\n lifecycle {\n status\n payment\n fulfillment\n return\n }\n lock {\n locked\n reason\n lockingInvoice {\n id\n number\n voided\n }\n }\n editBlock {\n code\n message\n }\n modifiable\n deletable\n releasableUnits\n releaseAllowed\n allocationBadge\n fulfillmentCorrection {\n blocked\n code\n }\n sourceFulfilled\n park {\n reason\n }\n hold {\n forReview\n byApp\n }\n providerFallbacks {\n kind\n installationId\n reason\n since\n }\n nextStates\n actions {\n action\n eligible\n allowed\n reasonCode\n }\n }\n }\n";
325
+ /**
326
+ * Why a cancel (whole or by lines) waits for a credit note: an invoice still
327
+ * bills the order, paid or not (cancelling would leave the invoice
328
+ * standing for revenue the order no longer has).
329
+ */
330
+ export interface OrderStatusCancelCreditNote {
331
+ /** The `InvoiceCorrectionLedger` to correct the invoice on: `RETAIL` or `AR`. */
332
+ ledger: 'RETAIL' | 'AR' | (string & {});
333
+ /**
334
+ * What to do first. `CORRECT_INVOICE`: correct this invoice (credited in
335
+ * full; a `RETAIL` correction refunds along). `REFUND_PAYMENT`: refund the
336
+ * order's settled payment first (`payments.refund`): on an AR-invoiced
337
+ * order the refund issues the AR credit note that corrects the invoice, and
338
+ * correcting the invoice as well would credit the customer twice.
339
+ */
340
+ remedy: 'CORRECT_INVOICE' | 'REFUND_PAYMENT' | (string & {});
341
+ invoiceId: string;
342
+ invoiceNumber: string;
343
+ /**
344
+ * What the invoice still bills the order for, in minor units of
345
+ * `currencyCode`: its total (on `AR`, the order's share) less its credit
346
+ * notes.
347
+ */
348
+ uncredited: number;
349
+ /**
350
+ * What the order still holds, in minor units of `currencyCode`: its settled
351
+ * payments less what went back, or the receipts on its live
352
+ * accounts-receivable invoices, whichever is larger (a collected direct
353
+ * debit records the same money on both).
354
+ */
355
+ held: number;
356
+ /** The order's currency. */
357
+ currencyCode: string;
358
+ }
359
+ export declare const ORDER_STATUS_QUERY = "\n query OrderStatus($orderId: ID!) {\n orderStatus(orderId: $orderId) {\n orderId\n state\n lifecycle {\n status\n payment\n fulfillment\n return\n }\n lock {\n locked\n reason\n lockingInvoice {\n id\n number\n voided\n ledger\n }\n }\n editBlock {\n code\n message\n }\n modifiable\n deletable\n releasableUnits\n releaseAllowed\n allocationBadge\n fulfillmentCorrection {\n blocked\n code\n }\n sourceFulfilled\n sourceFulfilledReason\n park {\n reason\n }\n hold {\n forReview\n byApp\n }\n providerFallbacks {\n kind\n installationId\n reason\n since\n }\n cancelCreditNote {\n ledger\n remedy\n invoiceId\n invoiceNumber\n uncredited\n held\n currencyCode\n }\n nextStates\n actions {\n action\n eligible\n allowed\n reasonCode\n }\n }\n }\n";
220
360
  export interface OrderStatusModule {
221
361
  /**
222
362
  * Why the order is the way it is, and the actions open to this caller.
@@ -227,8 +367,14 @@ export interface OrderStatusModule {
227
367
  * the ORDER allows it (`eligible`) and whether THIS caller may take it now
228
368
  * (`allowed`), so a head can show an action greyed out with its reason.
229
369
  *
230
- * Needs an engine that serves `orderStatus`; against an older one this call
231
- * fails validation and nothing else does.
370
+ * An order a live accounts-receivable invoice bills is invoice-locked like a
371
+ * retail-invoiced one (`INVOICE_LOCKED`, `lock.lockingInvoice.ledger: 'AR'`).
372
+ *
373
+ * Needs an engine that serves `orderStatus` with `cancelCreditNote`,
374
+ * `lock.lockingInvoice.ledger` and `sourceFulfilledReason`; against an older
375
+ * one this call fails validation and nothing else does.
376
+ *
377
+ * @effect read
232
378
  */
233
379
  status(orderId: string, options?: Call): Promise<OrderStatusView>;
234
380
  }
@@ -14,6 +14,12 @@ export const ORDER_STATUS_ACTIONS = [
14
14
  'TRANSITION',
15
15
  'MARK_COMPLETED',
16
16
  'REOPEN',
17
+ 'SET_PAYMENT_NOT_REQUIRED',
18
+ 'SET_FULFILLMENT_HOLD',
19
+ 'SET_GOODWILL_ROUNDING',
20
+ 'SET_BILLING_FIELDS',
21
+ 'APPLY_GOODWILL_ROUNDING',
22
+ 'SET_PRICING_FIELDS',
17
23
  ];
18
24
  /** Why an action is not allowed, in the order the engine lists them. */
19
25
  export const ORDER_STATUS_REASON_CODES = [
@@ -27,6 +33,10 @@ export const ORDER_STATUS_REASON_CODES = [
27
33
  'SHOPPER_CART',
28
34
  'UNITS_SHIPPED',
29
35
  'ACTIVE_FULFILLMENT',
36
+ 'CREDIT_NOTE_REQUIRED',
37
+ 'HOLDS_MONEY',
38
+ 'ERP_LOCKED',
39
+ 'LEAVES_MONEY_OVER',
30
40
  'PERMISSION',
31
41
  ];
32
42
  export const ORDER_STATUS_QUERY = /* GraphQL */ `
@@ -47,6 +57,7 @@ export const ORDER_STATUS_QUERY = /* GraphQL */ `
47
57
  id
48
58
  number
49
59
  voided
60
+ ledger
50
61
  }
51
62
  }
52
63
  editBlock {
@@ -63,6 +74,7 @@ export const ORDER_STATUS_QUERY = /* GraphQL */ `
63
74
  code
64
75
  }
65
76
  sourceFulfilled
77
+ sourceFulfilledReason
66
78
  park {
67
79
  reason
68
80
  }
@@ -76,6 +88,15 @@ export const ORDER_STATUS_QUERY = /* GraphQL */ `
76
88
  reason
77
89
  since
78
90
  }
91
+ cancelCreditNote {
92
+ ledger
93
+ remedy
94
+ invoiceId
95
+ invoiceNumber
96
+ uncredited
97
+ held
98
+ currencyCode
99
+ }
79
100
  nextStates
80
101
  actions {
81
102
  action
@@ -133,6 +133,13 @@ export interface OverpaymentOption {
133
133
  available: boolean;
134
134
  code: string | null;
135
135
  message: string | null;
136
+ /**
137
+ * On an `accountCredit` option: where "credit the customer" lands in this store, its ONE
138
+ * customer-credit book. `AR` (unapplied cash on the AR ledger), `STORE_CREDIT` (the customer's
139
+ * store-credit wallet) or `NONE` (neither: the option is closed). Null on the other options and
140
+ * from an engine before it.
141
+ */
142
+ book?: string | null;
136
143
  }
137
144
  /** What a surcharge change would do to an order's money. Nothing was saved. */
138
145
  export interface SurchargeChangePreview {
@@ -190,5 +197,5 @@ export declare const UPDATE_ORDER_SURCHARGE_MUTATION = "\n mutation UpdateOrder
190
197
  export declare const UPDATE_ORDER_SURCHARGE_WITH_OVERPAYMENT_MUTATION = "\n mutation UpdateOrderSurchargeWithOverpayment(\n $orderId: ID!\n $surchargeId: ID!\n $input: SurchargeInput!\n $taxClass: String\n $idempotencyKey: String\n $overpayment: OrderOverpaymentChoice\n ) {\n updateOrderSurcharge(\n orderId: $orderId\n surchargeId: $surchargeId\n input: $input\n taxClass: $taxClass\n idempotencyKey: $idempotencyKey\n overpayment: $overpayment\n ) {\n \n id\n code\n currencyCode\n total\n totalWithTax\n surcharges {\n id\n description\n sku\n price\n priceWithTax\n taxRate\n }\n\n }\n }\n";
191
198
  export declare const REMOVE_ORDER_SURCHARGE_MUTATION = "\n mutation RemoveOrderSurcharge($orderId: ID!, $surchargeId: ID!, $idempotencyKey: String) {\n removeOrderSurcharge(\n orderId: $orderId\n surchargeId: $surchargeId\n idempotencyKey: $idempotencyKey\n ) {\n \n id\n code\n currencyCode\n total\n totalWithTax\n surcharges {\n id\n description\n sku\n price\n priceWithTax\n taxRate\n }\n\n }\n }\n";
192
199
  export declare const REMOVE_ORDER_SURCHARGE_WITH_OVERPAYMENT_MUTATION = "\n mutation RemoveOrderSurchargeWithOverpayment(\n $orderId: ID!\n $surchargeId: ID!\n $idempotencyKey: String\n $overpayment: OrderOverpaymentChoice\n ) {\n removeOrderSurcharge(\n orderId: $orderId\n surchargeId: $surchargeId\n idempotencyKey: $idempotencyKey\n overpayment: $overpayment\n ) {\n \n id\n code\n currencyCode\n total\n totalWithTax\n surcharges {\n id\n description\n sku\n price\n priceWithTax\n taxRate\n }\n\n }\n }\n";
193
- export declare const PREVIEW_ORDER_SURCHARGE_CHANGE_QUERY = "\n query PreviewOrderSurchargeChange($orderId: ID!, $change: OrderSurchargeChangeInput!) {\n previewOrderSurchargeChange(orderId: $orderId, change: $change) {\n currencyCode\n totalBefore\n totalAfter\n overpayment {\n amount\n currencyCode\n refund { available code message }\n accountCredit { available code message }\n }\n }\n }\n";
200
+ export declare const PREVIEW_ORDER_SURCHARGE_CHANGE_QUERY = "\n query PreviewOrderSurchargeChange($orderId: ID!, $change: OrderSurchargeChangeInput!) {\n previewOrderSurchargeChange(orderId: $orderId, change: $change) {\n currencyCode\n totalBefore\n totalAfter\n overpayment {\n amount\n currencyCode\n refund { available code message book }\n accountCredit { available code message book }\n }\n }\n }\n";
194
201
  export declare function createSurchargesModule(transport: Transport): SurchargesModule;
@@ -1,3 +1,4 @@
1
+ import { storeCreditAware } from '../payments/store-credit-fields.js';
1
2
  const SURCHARGED_ORDER_FIELDS = /* GraphQL */ `
2
3
  id
3
4
  code
@@ -120,7 +121,7 @@ export const REMOVE_ORDER_SURCHARGE_WITH_OVERPAYMENT_MUTATION = /* GraphQL */ `
120
121
  }
121
122
  }
122
123
  `;
123
- const OVERPAYMENT_OPTION_FIELDS = 'available code message';
124
+ const OVERPAYMENT_OPTION_FIELDS = 'available code message book';
124
125
  export const PREVIEW_ORDER_SURCHARGE_CHANGE_QUERY = /* GraphQL */ `
125
126
  query PreviewOrderSurchargeChange($orderId: ID!, $change: OrderSurchargeChangeInput!) {
126
127
  previewOrderSurchargeChange(orderId: $orderId, change: $change) {
@@ -202,7 +203,7 @@ export function createSurchargesModule(transport) {
202
203
  },
203
204
  async preview(orderId, change, options) {
204
205
  const taxClass = taxClassVariable(options);
205
- const data = await transport.graphql({
206
+ const data = await storeCreditAware(transport).graphql({
206
207
  api: 'admin',
207
208
  query: PREVIEW_ORDER_SURCHARGE_CHANGE_QUERY,
208
209
  variables: {
@@ -33,6 +33,19 @@ export interface UnappliedCash {
33
33
  /** ISO-8601 with offset. */
34
34
  createdAt: string;
35
35
  }
36
+ /**
37
+ * Money of an order's settled payments moved to the customer's store-credit wallet instead of a
38
+ * refund: one never-expiring ledger entry per payment it came from. Minor units of
39
+ * `currencyCode`, the order's own currency.
40
+ */
41
+ export interface StoreCreditMove {
42
+ /** The customer's store-credit wallet (a stored-value account of kind `store_credit`). */
43
+ accountId: string;
44
+ amount: number;
45
+ currencyCode: string;
46
+ /** The ledger entries, one per payment the money came from. */
47
+ entryIds: string[];
48
+ }
36
49
  export interface CreditOverpaymentInput {
37
50
  orderId: string;
38
51
  /**
@@ -123,6 +136,22 @@ export interface AccountCreditModule {
123
136
  * account refusals above.
124
137
  */
125
138
  creditOverpayment(input: CreditOverpaymentInput, options?: Call): Promise<UnappliedCash[]>;
139
+ /**
140
+ * The store-credit sibling of {@link creditOverpayment}, for a store whose customer-credit book
141
+ * is store credit (`storedValue.storeCreditSettings`): what the order holds over its bill moves
142
+ * to the customer's store-credit wallet, in the order's currency, one ledger entry per payment
143
+ * it came from. Same bounds and `ACCOUNT_CREDIT_*` refusals; an AR store is refused
144
+ * `STORE_CREDIT_STORE_KEEPS_ACCOUNTS` (use {@link creditOverpayment} there), a store without
145
+ * store credit `STORE_CREDIT_NOT_ENABLED` / `_NOT_GRANTED` / `_METHOD_REQUIRED`. A gift card's or
146
+ * store credit's payment is never moved (`STORE_CREDIT_STORED_VALUE_REFUND_INSTEAD`: refund it),
147
+ * and the customer must be reachable (`STORE_CREDIT_CUSTOMER_ANONYMOUS`,
148
+ * `STORED_VALUE_ACCOUNT_BLOCKED`). The overpayment is what the order's payments hold over what
149
+ * it BILLS, the larger of its total and its live invoices', as a plain refund of an invoiced order
150
+ * measures it. From then on that money is no longer the order's: `payments.refundPosition` takes
151
+ * it off `refundable` and `payments.position` no longer reports it as `overpaid`. Needs an
152
+ * engine with incentives sprint 8 PR 3.
153
+ */
154
+ creditOverpaymentToStoreCredit(input: CreditOverpaymentInput, options?: Call): Promise<StoreCreditMove>;
126
155
  /** A customer's unapplied cash in this store, oldest first. */
127
156
  list(customerId: string, options?: Call): Promise<UnappliedCash[]>;
128
157
  /**
@@ -159,6 +188,7 @@ export interface AccountCreditModule {
159
188
  onOrder(orderId: string, options?: Call): Promise<OrderMoneyOnAccount>;
160
189
  }
161
190
  export declare const CREDIT_ORDER_OVERPAYMENT_MUTATION = "\n mutation CreditOrderOverpaymentToAccount(\n $input: CreditOrderOverpaymentInput!\n $idempotencyKey: String\n ) {\n creditOrderOverpaymentToAccount(input: $input, idempotencyKey: $idempotencyKey) {\n \n id\n customerId\n currencyCode\n amount\n applied\n refunded\n remaining\n orderId\n paymentId\n receivedOn\n reference\n notes\n createdAt\n\n }\n }\n";
191
+ export declare const CREDIT_ORDER_OVERPAYMENT_TO_STORE_CREDIT_MUTATION = "\n mutation CreditOrderOverpaymentToStoreCredit(\n $input: CreditOrderOverpaymentInput!\n $idempotencyKey: String\n ) {\n creditOrderOverpaymentToStoreCredit(input: $input, idempotencyKey: $idempotencyKey) {\n accountId amount currencyCode entryIds\n }\n }\n";
162
192
  export declare const UNAPPLIED_CASH_QUERY = "\n query ArUnappliedCash($customerId: ID!) {\n arUnappliedCash(customerId: $customerId) {\n \n id\n customerId\n currencyCode\n amount\n applied\n refunded\n remaining\n orderId\n paymentId\n receivedOn\n reference\n notes\n createdAt\n\n }\n }\n";
163
193
  export declare const APPLY_UNAPPLIED_CASH_MUTATION = "\n mutation ApplyArUnappliedCash($input: ApplyArUnappliedCashInput!, $idempotencyKey: String) {\n applyArUnappliedCash(input: $input, idempotencyKey: $idempotencyKey) {\n \n id\n customerId\n currencyCode\n amount\n applied\n refunded\n remaining\n orderId\n paymentId\n receivedOn\n reference\n notes\n createdAt\n\n }\n }\n";
164
194
  export declare const REFUND_UNAPPLIED_CASH_MUTATION = "\n mutation RefundArUnappliedCash($input: RefundArUnappliedCashInput!, $idempotencyKey: String) {\n refundArUnappliedCash(input: $input, idempotencyKey: $idempotencyKey) {\n id\n total\n state\n method\n transactionId\n reason\n }\n }\n";
@@ -1,3 +1,4 @@
1
+ import { STORE_CREDIT_MOVE_FIELDS } from './store-credit-fields.js';
1
2
  const UNAPPLIED_CASH_FIELDS = /* GraphQL */ `
2
3
  id
3
4
  customerId
@@ -23,6 +24,16 @@ export const CREDIT_ORDER_OVERPAYMENT_MUTATION = /* GraphQL */ `
23
24
  }
24
25
  }
25
26
  `;
27
+ export const CREDIT_ORDER_OVERPAYMENT_TO_STORE_CREDIT_MUTATION = /* GraphQL */ `
28
+ mutation CreditOrderOverpaymentToStoreCredit(
29
+ $input: CreditOrderOverpaymentInput!
30
+ $idempotencyKey: String
31
+ ) {
32
+ creditOrderOverpaymentToStoreCredit(input: $input, idempotencyKey: $idempotencyKey) {
33
+ ${STORE_CREDIT_MOVE_FIELDS}
34
+ }
35
+ }
36
+ `;
26
37
  export const UNAPPLIED_CASH_QUERY = /* GraphQL */ `
27
38
  query ArUnappliedCash($customerId: ID!) {
28
39
  arUnappliedCash(customerId: $customerId) {
@@ -79,6 +90,14 @@ export function createAccountCreditModule(transport) {
79
90
  }, options);
80
91
  return data.creditOrderOverpaymentToAccount;
81
92
  },
93
+ async creditOverpaymentToStoreCredit(input, options) {
94
+ const data = await transport.graphql({
95
+ api: 'admin',
96
+ query: CREDIT_ORDER_OVERPAYMENT_TO_STORE_CREDIT_MUTATION,
97
+ variables: { input, idempotencyKey: options?.idempotencyKey },
98
+ }, options);
99
+ return data.creditOrderOverpaymentToStoreCredit;
100
+ },
82
101
  async list(customerId, options) {
83
102
  const data = await transport.graphql({ api: 'admin', query: UNAPPLIED_CASH_QUERY, variables: { customerId } }, options);
84
103
  return data.arUnappliedCash;