@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
@@ -1,7 +1,12 @@
1
- import type { Transport } from '@sixtyninecommerce/core';
1
+ import { type Transport } from '@sixtyninecommerce/core';
2
+ import type { InvoiceCorrectionLedger } from '../documents/index.js';
2
3
  import type { Call } from '../types.js';
3
4
  import { type AccountCreditModule } from './account-credit.js';
5
+ import { type ArPaymentsModule } from './ar.js';
6
+ import { type PaymentMethodsModule } from './methods.js';
7
+ import { type PaymentLinksModule } from './payment-links.js';
4
8
  import { type ProvidersModule } from './providers.js';
9
+ import { type PaymentRequestsModule } from './requests.js';
5
10
  /**
6
11
  * What an order has actually been paid, in minor units of its own currency.
7
12
  *
@@ -9,7 +14,11 @@ import { type ProvidersModule } from './providers.js';
9
14
  * is a second source of truth that drifts the first time a refund lands.
10
15
  */
11
16
  export interface OrderPaymentPosition {
12
- /** The order's own gross total, carrying the order's rounding rule. */
17
+ /**
18
+ * The order's own gross total, carrying the order's rounding rule. 0 for a `Cancelled` order:
19
+ * a cancelled order bills nothing. A credit note does not change it: see `creditNoted` and
20
+ * `owed`.
21
+ */
13
22
  total: number;
14
23
  /** Settled plus authorized, less refunds: what is accounted for. */
15
24
  covered: number;
@@ -23,13 +32,38 @@ export interface OrderPaymentPosition {
23
32
  * counted here, though it is taken off `settled` like one.
24
33
  */
25
34
  refunded: number;
26
- /** `total - covered`, floored at zero. */
35
+ /**
36
+ * What the order's credit notes took off what it bills: `total` less what its invoices bill net
37
+ * of their credit notes (a part credited, an invoice voided with no replacement), never more
38
+ * than `total`; 0 for an order with no invoice. A correction never restates the order, so
39
+ * `total` keeps reading what it first billed. Taken off `owed` only.
40
+ *
41
+ * Read by {@link PaymentsModule.position}, `orders.paymentPosition` and the cancel-with-money
42
+ * preview and answer. Against an engine that does not serve it those calls resend their document
43
+ * without it (`creditNotedAware`), so it is absent and reads as zero; absent from a settlement's
44
+ * position too.
45
+ */
46
+ creditNoted?: number;
47
+ /**
48
+ * What the customer still owes once the credit notes are counted: `total - creditNoted -
49
+ * covered`, floored at zero. A refund that went back with a credit note is owed by nobody.
50
+ * Equals `outstanding` when nothing was credited. Read by the same calls as `creditNoted`; where
51
+ * it is absent, the customer owes `outstanding`.
52
+ */
53
+ owed?: number;
54
+ /**
55
+ * `total - covered`, floored at zero: what the payments are short of the order's total, and
56
+ * what `record` caps a payment at. On an order whose credit notes took part of its bill off,
57
+ * `owed` is what the customer still owes.
58
+ */
27
59
  outstanding: number;
28
60
  /**
29
61
  * `covered - total`, floored at zero. Over-payment is refused at the door, so
30
62
  * this is non-zero only for imported history, rows predating the guard, a
31
- * refund that landed after a second payment, or an edit that lowered the
32
- * total of a paid order. Money moved to the customer's account
63
+ * refund that landed after a second payment, an edit that lowered the
64
+ * total of a paid order, or money kept on a cancelled order (a cancelled
65
+ * order bills nothing; `orders.cancelWithMoney` with `retain`), which can
66
+ * still be credited to the account. Money moved to the customer's account
33
67
  * (`payments.accountCredit.creditOverpayment`) no longer counts here.
34
68
  */
35
69
  overpaid: number;
@@ -80,7 +114,10 @@ export interface RefundablePayment {
80
114
  /**
81
115
  * `amount - refunded`, less what of this payment is on the customer's account
82
116
  * (`payments.accountCredit.onOrder`), when this payment took money; floored
83
- * at zero, else zero.
117
+ * at zero, else zero. Less, too, this payment's share of what the gift cards
118
+ * sold on the order hold: a live card's value, and a voided card's spent (or
119
+ * expired) value, which stays held for good. How much, and on which payment:
120
+ * {@link PaymentsModule.refundGiftCardHold}.
84
121
  */
85
122
  refundable: number;
86
123
  /**
@@ -117,11 +154,43 @@ export interface OrderRefundPosition {
117
154
  * Money moved to the customer's account as unapplied cash IS deducted: it is
118
155
  * paid back from the account (`payments.accountCredit.refund`), never from
119
156
  * the order a second time.
157
+ *
158
+ * What the gift cards sold on the order hold is deducted too: a live card's
159
+ * value, and a voided card's spent (or expired) value, which stays held for
160
+ * good. A refund of it is refused `REFUND_HELD_BY_GIFT_CARD`;
161
+ * {@link PaymentsModule.refundGiftCardHold} says how much, and on which payment.
120
162
  */
121
163
  refundable: number;
122
164
  /** Every payment on the order, NEWEST FIRST, with its own headroom. */
123
165
  perPayment: RefundablePayment[];
124
166
  }
167
+ /**
168
+ * What the gift cards sold on an order hold of its money: why its refund position's `refundable`
169
+ * is lower than what its payments took ({@link PaymentsModule.refundGiftCardHold}).
170
+ */
171
+ export interface RefundGiftCardHold {
172
+ /** The order's currency. Every amount here is in its minor units. */
173
+ currencyCode: string;
174
+ /**
175
+ * What the cards hold: each card its face value less what a void released, and a void releases
176
+ * at most what the card had not spent, so a card's spent (or expired) value stays held for good.
177
+ * Already counted out of `refundable`, so `refundable` plus this is what the payments would hand
178
+ * back with no card. A refund of it is refused `REFUND_HELD_BY_GIFT_CARD`. 0 when no card holds
179
+ * any.
180
+ */
181
+ giftCardHold: number;
182
+ /**
183
+ * How many of the cards sold on the order are still live (not voided); null while
184
+ * `giftCardHold` is 0. Above 0, voiding a card releases what it has not spent; 0 means every
185
+ * card is voided, and what they hold is spent value that stays with the store.
186
+ */
187
+ liveGiftCards: number | null;
188
+ /** Each payment's share of the hold, NEWEST FIRST, as `refundPosition` lists them. */
189
+ perPayment: Array<{
190
+ paymentId: string;
191
+ giftCardHold: number;
192
+ }>;
193
+ }
125
194
  /**
126
195
  * A refund whose outcome is unknown: it reached its payment provider and was
127
196
  * never confirmed (a timeout, a dropped connection, a server error), so the
@@ -138,6 +207,30 @@ export interface UnreconciledRefund {
138
207
  /** ISO-8601 with offset. */
139
208
  createdAt: string | null;
140
209
  }
210
+ /**
211
+ * The invoice a refund of an order must go through, so a credit note says what the money was for
212
+ * (see {@link PaymentsModule.refundCreditNoteRequirement}).
213
+ */
214
+ export interface RefundCreditNoteRequirement {
215
+ /** The live invoice billing the order: plan and commit the correction on it. */
216
+ invoiceId: string;
217
+ /** As printed on the invoice. */
218
+ invoiceNumber: string;
219
+ /**
220
+ * The ledger to plan the correction on (`documents.planCorrection({ ledger, invoiceId })`).
221
+ * `RETAIL` is named first when the order has both: its correction can carry the refund.
222
+ */
223
+ ledger: InvoiceCorrectionLedger;
224
+ /**
225
+ * Minor units of the order's currency: what its payments hold over what it bills (a duplicate
226
+ * payment, say), net of every refund. "What it bills" is the larger of the order's total and
227
+ * what its live invoices bill. {@link PaymentsModule.refund} gives back up to this much
228
+ * without a credit note, recorded as an overpayment refund (the invoice never billed it); a
229
+ * larger refund goes through the correction. `0` when the order is not overpaid. Only payments
230
+ * that took money count, and a refund of unknown outcome stays reserved.
231
+ */
232
+ refundableOverpayment: number;
233
+ }
141
234
  /** What the payment provider says happened to a refund whose outcome was unknown. */
142
235
  export type RefundProviderOutcome = 'MADE' | 'NOT_MADE';
143
236
  /** The provider's answer for a refund whose outcome is unknown. */
@@ -201,6 +294,18 @@ export interface PaidOrder {
201
294
  total: number;
202
295
  totalWithTax: number;
203
296
  }
297
+ /** A payment, as {@link PaymentsModule.settle} and {@link PaymentsModule.cancel} answer it. */
298
+ export interface OrderPaymentRecord {
299
+ id: string;
300
+ /** Vendure's payment state: `Settled` after a capture, `Cancelled` after a void. */
301
+ state: string;
302
+ /** The payment method code. */
303
+ method: string;
304
+ /** Minor units of the order's currency. */
305
+ amount: number;
306
+ /** The provider's reference for the payment, when it gave one. */
307
+ transactionId: string | null;
308
+ }
204
309
  /** What a payment app reports happened to a payment it took (`reportAppPayment`). */
205
310
  export type AppPaymentReportState = 'Authorized' | 'Settled' | 'Declined' | 'Cancelled';
206
311
  /** An app's report on one of its payments. */
@@ -284,6 +389,27 @@ export interface PaymentsModule {
284
389
  * to an invoice, pay it back.
285
390
  */
286
391
  accountCredit: AccountCreditModule;
392
+ /**
393
+ * Money on the accounts-receivable ledger: customer payments against AR invoices, the ledger,
394
+ * prepaid drawdowns and SEPA direct debit collection.
395
+ */
396
+ ar: ArPaymentsModule;
397
+ /**
398
+ * The store's payment methods, as staff choose one: the `method` code
399
+ * {@link PaymentsModule.record} takes, and the codes a deposit policy names.
400
+ */
401
+ methods: PaymentMethodsModule;
402
+ /**
403
+ * Hosted payment requests: ask the customer to pay a chosen amount of a held
404
+ * order or a committed draft through a stable link that opens the payment
405
+ * provider's checkout. See {@link PaymentRequestsModule}.
406
+ */
407
+ requests: PaymentRequestsModule;
408
+ /**
409
+ * The store's payment links (Tikkie): the connection's settings and checks, and the links an
410
+ * order was sent by invoice e-mail. See {@link PaymentLinksModule}.
411
+ */
412
+ paymentLinks: PaymentLinksModule;
287
413
  /**
288
414
  * Record part (or all) of what an order owes, and return the order.
289
415
  *
@@ -297,9 +423,16 @@ export interface PaymentsModule {
297
423
  * store that has not turned deposits on; paying the whole outstanding balance
298
424
  * is not a deposit and always works — `METADATA_KEY_RESERVED`,
299
425
  * `PAYMENT_METHOD_NOT_FOUND`, `ORDER_NOT_FOUND`.
426
+ *
427
+ * @effect money
300
428
  */
301
429
  record(orderId: string, input: RecordPaymentInput, options?: Call): Promise<PaidOrder>;
302
- /** Read an order's payment position. */
430
+ /**
431
+ * Read an order's payment position: what it bills, what was paid and refunded, what its credit
432
+ * notes took off (`creditNoted`) and what the customer still owes after them (`owed`).
433
+ *
434
+ * @effect read
435
+ */
303
436
  position(orderId: string, options?: Call): Promise<OrderPaymentPosition>;
304
437
  /**
305
438
  * Hand money back to a customer, never more than the order took.
@@ -373,10 +506,118 @@ export interface PaymentsModule {
373
506
  * order has been read carries that order's position in
374
507
  * `extensions.refundPosition`, so a till can correct itself without a second
375
508
  * round trip.
509
+ *
510
+ * **An invoiced order is refunded through its invoice, not here.** While the
511
+ * order has a live invoice, this refuses `REFUND_REQUIRES_CREDIT_NOTE` (a
512
+ * `ConflictError`, 409) before anything else: a refund made here issues no
513
+ * document, and the invoice would stand with no credit note for the money.
514
+ * Ask {@link refundCreditNoteRequirement} first; it names the invoice, and
515
+ * `documents.commitCorrection` on it issues the credit note and then refunds.
516
+ * Not refused: an amount within the order's overpayment
517
+ * (`refundableOverpayment`, money the invoice never billed), refunded here
518
+ * and recorded as an overpayment refund; and a customer with a credit
519
+ * account on a store that keeps the accounts-receivable ledger, whose refund
520
+ * is documented when it settles: by an AR credit note for what an invoice
521
+ * billed, and by none for money no invoice billed (a duplicate payment given
522
+ * back), which is recorded as an overpayment refund. The refusal's `details`
523
+ * name the invoice and the overpayment still refundable. Needs an engine that knows
524
+ * the rule (vendure-server deployed first); an older one refunds as before.
525
+ *
526
+ * @effect money
376
527
  */
377
528
  refund(input: RefundPaymentInput, options?: Call): Promise<IssuedRefund>;
529
+ /**
530
+ * Capture an authorized payment at its provider ("mark as paid"), and return the payment.
531
+ *
532
+ * At most once per payment, whoever asks and however often: the engine keys every capture of a
533
+ * payment under ONE key of its own (`payment:<id>:capture`), so this method takes no
534
+ * `idempotencyKey`. A repeat while the payment is `Settled` captures nothing and is refused
535
+ * `PAYMENT_STATE_TRANSITION_ERROR` ("already settled"); a repeat while the first capture is
536
+ * still running is refused `IDEMPOTENCY_IN_PROGRESS`. A capture whose answer was lost after it
537
+ * reached the provider is refused `IDEMPOTENCY_OUTCOME_UNKNOWN` (`error.outcomeUnknown`) on
538
+ * that call and on every capture for the key's retention (24 hours): check the payment with the
539
+ * provider before doing anything else with it, and never retry this blind. Once the key is
540
+ * swept a capture asks the provider again, so an automatic retry after a day can capture a
541
+ * second time; the provider's own report (`reportAppPayment`) still settles it meanwhile.
542
+ *
543
+ * Refusals, as coded errors (the Admin API answers some as a result union; this method throws
544
+ * every one):
545
+ * - `PAYMENT_SETTLE_DECLINED` (`BusinessRuleError`, 422): the provider declined the capture.
546
+ * The message is the provider's reason. Nothing was captured, and a later capture may be
547
+ * tried.
548
+ * - `PAYMENT_STATE_TRANSITION_ERROR` (422): the payment is not `Authorized` (settled, cancelled
549
+ * or declined already). The message says which.
550
+ * - `ORDER_STATE_TRANSITION_ERROR` (422): the capture went through the provider's gate but the
551
+ * order could not move on as it stands.
552
+ * - `ORDER_CANCELLED_PAYMENT_CONFLICT` (409): the payment's order is cancelled, and a cancelled
553
+ * order is never paid. Cancel the payment instead to release it.
554
+ * - `PAYMENT_SETTLE_CONFLICT` (409): the payment moved while it was being captured. Read it
555
+ * again.
556
+ * - `ENTITY_NOT_FOUND` (404): no payment of an order of this store has that id.
557
+ *
558
+ * Needs `UpdateOrder`.
559
+ *
560
+ * @effect money
561
+ */
562
+ settle(paymentId: string, options?: Call): Promise<OrderPaymentRecord>;
563
+ /**
564
+ * Void an authorized payment (release the hold), and return the payment.
565
+ *
566
+ * A cancel takes turns with the payment's capture: one that reaches a payment that is no
567
+ * longer authorized, or one whose capture may have reached its provider with no answer, is
568
+ * refused `PAYMENT_CANCEL_CONFLICT` (409) and nothing is asked of the provider. A `Settled`
569
+ * payment is never voided: its money was taken, so it is refunded ({@link refund}).
570
+ *
571
+ * Other refusals, as coded errors:
572
+ * - `PAYMENT_CANCEL_DECLINED` (`BusinessRuleError`, 422): the provider refused the void. The
573
+ * message is the provider's reason; the hold may still stand at the provider.
574
+ * - `PAYMENT_STATE_TRANSITION_ERROR` (422): the payment cannot move to `Cancelled` from where
575
+ * it is.
576
+ * - `ENTITY_NOT_FOUND` (404): no payment of an order of this store has that id.
577
+ *
578
+ * Needs `UpdateOrder`.
579
+ *
580
+ * @effect money
581
+ */
582
+ cancel(paymentId: string, options?: Call): Promise<OrderPaymentRecord>;
583
+ /**
584
+ * Whether {@link refund} (and core's `refundOrder`, and the till's refund) is
585
+ * refused for this order with `REFUND_REQUIRES_CREDIT_NOTE`, and which invoice
586
+ * the refund goes through instead; `null` when a plain refund may go ahead.
587
+ *
588
+ * The order has a live invoice in this store, so a refund needs a credit note
589
+ * saying what it is for, beyond `refundableOverpayment` (what the order was
590
+ * paid over what it bills, which {@link refund} still gives back). Plan the
591
+ * correction with
592
+ * `documents.planCorrection({ ledger, invoiceId, outcome, refundPaymentId })` and
593
+ * issue it with `documents.commitCorrection`: the credit note is issued, then
594
+ * the money refunded. `null` for an order with no live invoice, and for a
595
+ * customer with a credit account on a store that keeps the
596
+ * accounts-receivable ledger (their refunds are documented when they settle:
597
+ * by an AR credit note, except the part no invoice billed, which gets none).
598
+ * Needs `ReadOrder`.
599
+ *
600
+ * Its own query rather than a field of {@link refundPosition}, so a release of
601
+ * this SDK reading an older engine fails only this call. The answer is read
602
+ * without a lock: the refund doors judge again when they run.
603
+ *
604
+ * @effect read
605
+ */
606
+ refundCreditNoteRequirement(orderId: string, options?: Call): Promise<RefundCreditNoteRequirement | null>;
378
607
  /** Read what an order may still hand back. */
379
608
  refundPosition(orderId: string, options?: Call): Promise<OrderRefundPosition>;
609
+ /**
610
+ * What the gift cards sold on an order hold of its money, on the order and per payment, and
611
+ * how many of them are still live: why {@link refundPosition}'s `refundable` is lower than the
612
+ * money taken. Needs `ReadOrder`.
613
+ *
614
+ * Its own query rather than fields of {@link refundPosition}, so a release of this SDK reading
615
+ * an older engine fails only this call. Needs an engine that serves
616
+ * `OrderRefundPosition.giftCardHold`.
617
+ *
618
+ * @effect read
619
+ */
620
+ refundGiftCardHold(orderId: string, options?: Call): Promise<RefundGiftCardHold>;
380
621
  /**
381
622
  * The order's refunds whose outcome is unknown, oldest first — the ones
382
623
  * {@link reconcileRefund} resolves. Each one's amount is already reserved in
@@ -412,6 +653,8 @@ export interface PaymentsModule {
412
653
  *
413
654
  * `options.idempotencyKey` is honoured: a repeat under the same key returns
414
655
  * the first call's refund.
656
+ *
657
+ * @effect money
415
658
  */
416
659
  reconcileRefund(input: ReconcileRefundInput, options?: Call): Promise<IssuedRefund>;
417
660
  /**
@@ -457,13 +700,23 @@ export interface PaymentsModule {
457
700
  appPayments(orderId: string, options?: Call): Promise<AppPayment[]>;
458
701
  }
459
702
  export declare const RECORD_ORDER_PAYMENT_MUTATION = "\n mutation RecordOrderPayment($orderId: ID!, $input: RecordPaymentInput!, $idempotencyKey: String) {\n recordOrderPayment(orderId: $orderId, input: $input, idempotencyKey: $idempotencyKey) {\n \n id\n code\n state\n currencyCode\n total\n totalWithTax\n\n }\n }\n";
460
- export declare const ORDER_PAYMENT_POSITION_QUERY = "\n query OrderPaymentPosition($orderId: ID!) {\n orderPaymentPosition(orderId: $orderId) {\n \n total\n covered\n settled\n authorized\n refunded\n outstanding\n overpaid\n availableToCharge\n\n }\n }\n";
703
+ export declare const ORDER_PAYMENT_POSITION_QUERY = "\n query OrderPaymentPosition($orderId: ID!) {\n orderPaymentPosition(orderId: $orderId) {\n \n total\n covered\n settled\n authorized\n refunded\n creditNoted\n owed\n outstanding\n overpaid\n availableToCharge\n\n }\n }\n";
461
704
  export declare const ORDER_REFUND_POSITION_QUERY = "\n query OrderRefundPosition($orderId: ID!) {\n orderRefundPosition(orderId: $orderId) {\n \n currencyCode\n refunded\n refundable\n perPayment {\n paymentId\n state\n method\n amount\n refunded\n refundable\n tookMoney\n }\n\n }\n }\n";
462
705
  export declare const REFUND_ORDER_PAYMENT_MUTATION = "\n mutation RefundOrderPayment($input: RefundPaymentInput!, $idempotencyKey: String) {\n refundOrderPayment(input: $input, idempotencyKey: $idempotencyKey) {\n id\n total\n state\n method\n transactionId\n reason\n }\n }\n";
463
706
  export declare const UNRECONCILED_REFUNDS_QUERY = "\n query UnreconciledRefunds($orderId: ID!) {\n orderRefundPosition(orderId: $orderId) {\n unreconciled {\n refundId\n paymentId\n amount\n createdAt\n }\n }\n }\n";
707
+ export declare const REFUND_GIFT_CARD_HOLD_QUERY = "\n query RefundGiftCardHold($orderId: ID!) {\n orderRefundPosition(orderId: $orderId) {\n currencyCode\n giftCardHold\n liveGiftCards\n perPayment {\n paymentId\n giftCardHold\n }\n }\n }\n";
708
+ export declare const REFUND_CREDIT_NOTE_REQUIREMENT_QUERY = "\n query RefundCreditNoteRequirement($orderId: ID!) {\n orderRefundPosition(orderId: $orderId) {\n creditNoteRequired {\n invoiceId\n invoiceNumber\n ledger\n refundableOverpayment\n }\n }\n }\n";
464
709
  export declare const RECONCILE_REFUND_OUTCOME_MUTATION = "\n mutation ReconcileRefundOutcome($input: ReconcileRefundOutcomeInput!, $idempotencyKey: String) {\n reconcileRefundOutcome(input: $input, idempotencyKey: $idempotencyKey) {\n id\n total\n state\n method\n transactionId\n reason\n }\n }\n";
710
+ export declare const SETTLE_PAYMENT_MUTATION = "\n mutation SettlePayment($id: ID!) {\n settlePayment(id: $id) {\n __typename\n ... on Payment {\n \n id\n state\n method\n amount\n transactionId\n\n }\n ... on SettlePaymentError {\n paymentErrorMessage\n }\n ... on PaymentStateTransitionError {\n transitionError\n }\n ... on OrderStateTransitionError {\n transitionError\n }\n ... on ErrorResult {\n errorCode\n message\n }\n }\n }\n";
711
+ export declare const CANCEL_PAYMENT_MUTATION = "\n mutation CancelPayment($id: ID!) {\n cancelPayment(id: $id) {\n __typename\n ... on Payment {\n \n id\n state\n method\n amount\n transactionId\n\n }\n ... on CancelPaymentError {\n paymentErrorMessage\n }\n ... on PaymentStateTransitionError {\n transitionError\n }\n ... on ErrorResult {\n errorCode\n message\n }\n }\n }\n";
465
712
  export declare const REPORT_APP_PAYMENT_MUTATION = "\n mutation ReportAppPayment(\n $paymentId: ID!\n $input: ReportAppPaymentInput!\n $idempotencyKey: String!\n ) {\n reportAppPayment(paymentId: $paymentId, input: $input, idempotencyKey: $idempotencyKey) {\n id\n state\n amount\n method\n transactionId\n }\n }\n";
466
713
  export declare const APP_PAYMENTS_QUERY = "\n query AppPayments($orderId: ID!) {\n appPayments(orderId: $orderId) {\n id\n orderId\n orderCode\n state\n amount\n currencyCode\n providerReference\n methodCode\n outcomeUnknown\n createdAt\n }\n }\n";
467
714
  export declare function createPaymentsModule(transport: Transport): PaymentsModule;
468
- export type { AccountCreditModule, ApplyUnappliedCashInput, CreditOverpaymentInput, OrderMoneyOnAccount, RefundUnappliedCashInput, UnappliedCash, UnappliedCashRefund, } from './account-credit.js';
469
- export type { ProviderConnection, ProviderCredentialPath, ProviderOnboardingStart, ProviderReadiness, ProvidersModule, ProviderTerminal, ProviderTerminalsModule, ProvisionTerminalInput, ReadinessOptions, } from './providers.js';
715
+ export type { AccountCreditModule, ApplyUnappliedCashInput, CreditOverpaymentInput, OrderMoneyOnAccount, RefundUnappliedCashInput, StoreCreditMove, UnappliedCash, UnappliedCashRefund, } from './account-credit.js';
716
+ export type { ConnectedAccountModule, StripeConnectedAccount, } from './connected-account.js';
717
+ export type { CreatePaymentMethodInput, PaymentMethod, PaymentMethodCredential, PaymentMethodCredentialPath, PaymentMethodsModule, PaymentMethodTranslation, PaymentMethodTranslationInput, UpdatePaymentMethodInput, } from './methods.js';
718
+ export type { MollieDiagnosis, MollieDiagnosisMethod, MollieDiagnosisVerdict, MollieDirectDebitDiagnosis, MollieMethod, MollieMethodList, MollieMethodsModule, MollieProbeError, MollieProbeErrorKind, SetMollieMethodsInput, } from './mollie-methods.js';
719
+ export type { PaymentProviderKey, ProviderKeyProvider, ProviderKeysModule, ProviderKeyTest, SetProviderKeyInput, } from './provider-keys.js';
720
+ export type { PaymentProviderAccount, ProviderConnection, ProviderCredentialPath, ProviderOnboardingStart, ProviderReadiness, ProvidersModule, ProviderTerminal, ProviderTerminalsModule, ProvisionTerminalInput, ReadinessOptions, } from './providers.js';
721
+ export type { CreatePaymentRequestInput, PaymentRequest, PaymentRequestCloseReason, PaymentRequestStatus, PaymentRequestsModule, } from './requests.js';
722
+ export { PAYMENT_REQUEST_CLOSE_REASONS, PAYMENT_REQUEST_DEFAULT_EXPIRY_DAYS, PAYMENT_REQUEST_MAX_EXPIRY_DAYS, PAYMENT_REQUEST_STATUSES, } from './requests.js';
@@ -1,5 +1,11 @@
1
+ import { BusinessRuleError, errorFromErrorResult, isErrorResult, } from '@sixtyninecommerce/core';
1
2
  import { createAccountCreditModule } from './account-credit.js';
3
+ import { createArPaymentsModule } from './ar.js';
4
+ import { creditNotedAware } from './credit-noted-fields.js';
5
+ import { createPaymentMethodsModule } from './methods.js';
6
+ import { createPaymentLinksModule } from './payment-links.js';
2
7
  import { createProvidersModule } from './providers.js';
8
+ import { createPaymentRequestsModule } from './requests.js';
3
9
  const PAID_ORDER_FIELDS = /* GraphQL */ `
4
10
  id
5
11
  code
@@ -14,6 +20,8 @@ const POSITION_FIELDS = /* GraphQL */ `
14
20
  settled
15
21
  authorized
16
22
  refunded
23
+ creditNoted
24
+ owed
17
25
  outstanding
18
26
  overpaid
19
27
  availableToCharge
@@ -77,6 +85,31 @@ export const UNRECONCILED_REFUNDS_QUERY = /* GraphQL */ `
77
85
  }
78
86
  }
79
87
  `;
88
+ export const REFUND_GIFT_CARD_HOLD_QUERY = /* GraphQL */ `
89
+ query RefundGiftCardHold($orderId: ID!) {
90
+ orderRefundPosition(orderId: $orderId) {
91
+ currencyCode
92
+ giftCardHold
93
+ liveGiftCards
94
+ perPayment {
95
+ paymentId
96
+ giftCardHold
97
+ }
98
+ }
99
+ }
100
+ `;
101
+ export const REFUND_CREDIT_NOTE_REQUIREMENT_QUERY = /* GraphQL */ `
102
+ query RefundCreditNoteRequirement($orderId: ID!) {
103
+ orderRefundPosition(orderId: $orderId) {
104
+ creditNoteRequired {
105
+ invoiceId
106
+ invoiceNumber
107
+ ledger
108
+ refundableOverpayment
109
+ }
110
+ }
111
+ }
112
+ `;
80
113
  export const RECONCILE_REFUND_OUTCOME_MUTATION = /* GraphQL */ `
81
114
  mutation ReconcileRefundOutcome($input: ReconcileRefundOutcomeInput!, $idempotencyKey: String) {
82
115
  reconcileRefundOutcome(input: $input, idempotencyKey: $idempotencyKey) {
@@ -89,6 +122,81 @@ export const RECONCILE_REFUND_OUTCOME_MUTATION = /* GraphQL */ `
89
122
  }
90
123
  }
91
124
  `;
125
+ const PAYMENT_RECORD_FIELDS = /* GraphQL */ `
126
+ id
127
+ state
128
+ method
129
+ amount
130
+ transactionId
131
+ `;
132
+ // The concrete members are selected for their sentences: the `ErrorResult` interface carries
133
+ // only a generic per-code `message`, and the provider's reason and the refusing gate's live on
134
+ // the concrete type alone.
135
+ export const SETTLE_PAYMENT_MUTATION = /* GraphQL */ `
136
+ mutation SettlePayment($id: ID!) {
137
+ settlePayment(id: $id) {
138
+ __typename
139
+ ... on Payment {
140
+ ${PAYMENT_RECORD_FIELDS}
141
+ }
142
+ ... on SettlePaymentError {
143
+ paymentErrorMessage
144
+ }
145
+ ... on PaymentStateTransitionError {
146
+ transitionError
147
+ }
148
+ ... on OrderStateTransitionError {
149
+ transitionError
150
+ }
151
+ ... on ErrorResult {
152
+ errorCode
153
+ message
154
+ }
155
+ }
156
+ }
157
+ `;
158
+ export const CANCEL_PAYMENT_MUTATION = /* GraphQL */ `
159
+ mutation CancelPayment($id: ID!) {
160
+ cancelPayment(id: $id) {
161
+ __typename
162
+ ... on Payment {
163
+ ${PAYMENT_RECORD_FIELDS}
164
+ }
165
+ ... on CancelPaymentError {
166
+ paymentErrorMessage
167
+ }
168
+ ... on PaymentStateTransitionError {
169
+ transitionError
170
+ }
171
+ ... on ErrorResult {
172
+ errorCode
173
+ message
174
+ }
175
+ }
176
+ }
177
+ `;
178
+ /** The union members that mean "the provider said no", renamed so a caller branches on intent. */
179
+ const DECLINE_CODES = {
180
+ SETTLE_PAYMENT_ERROR: 'PAYMENT_SETTLE_DECLINED',
181
+ CANCEL_PAYMENT_ERROR: 'PAYMENT_CANCEL_DECLINED',
182
+ };
183
+ /**
184
+ * Throw a refusal member as a coded error, carrying the concrete type's sentence (the provider's
185
+ * reason, the gate's reason) rather than Vendure's per-code template.
186
+ */
187
+ function paymentOrThrow(result) {
188
+ if (!isErrorResult(result)) {
189
+ const { __typename: _typename, ...payment } = result;
190
+ return payment;
191
+ }
192
+ const reason = result.paymentErrorMessage ?? result.transitionError;
193
+ const message = typeof reason === 'string' && reason.trim() !== '' ? reason : result.message;
194
+ const declined = DECLINE_CODES[result.errorCode];
195
+ if (declined) {
196
+ throw new BusinessRuleError({ code: declined, message, status: 422, service: 'vendure' });
197
+ }
198
+ throw errorFromErrorResult({ ...result, message });
199
+ }
92
200
  export const REPORT_APP_PAYMENT_MUTATION = /* GraphQL */ `
93
201
  mutation ReportAppPayment(
94
202
  $paymentId: ID!
@@ -124,6 +232,10 @@ export function createPaymentsModule(transport) {
124
232
  return {
125
233
  providers: createProvidersModule(transport),
126
234
  accountCredit: createAccountCreditModule(transport),
235
+ ar: createArPaymentsModule(transport),
236
+ methods: createPaymentMethodsModule(transport),
237
+ requests: createPaymentRequestsModule(transport),
238
+ paymentLinks: createPaymentLinksModule(transport),
127
239
  async record(orderId, input, options) {
128
240
  const data = await transport.graphql({
129
241
  api: 'admin',
@@ -138,7 +250,8 @@ export function createPaymentsModule(transport) {
138
250
  return data.recordOrderPayment;
139
251
  },
140
252
  async position(orderId, options) {
141
- const data = await transport.graphql({ api: 'admin', query: ORDER_PAYMENT_POSITION_QUERY, variables: { orderId } }, options);
253
+ // The credit fields fall away on an engine before them: the position itself still reads.
254
+ const data = await creditNotedAware(transport).graphql({ api: 'admin', query: ORDER_PAYMENT_POSITION_QUERY, variables: { orderId } }, options);
142
255
  return data.orderPaymentPosition;
143
256
  },
144
257
  async refund(input, options) {
@@ -152,10 +265,28 @@ export function createPaymentsModule(transport) {
152
265
  }, options);
153
266
  return data.refundOrderPayment;
154
267
  },
268
+ async settle(paymentId, options) {
269
+ const data = await transport.graphql({ api: 'admin', query: SETTLE_PAYMENT_MUTATION, variables: { id: paymentId } }, options);
270
+ return paymentOrThrow(data.settlePayment);
271
+ },
272
+ async cancel(paymentId, options) {
273
+ const data = await transport.graphql({ api: 'admin', query: CANCEL_PAYMENT_MUTATION, variables: { id: paymentId } }, options);
274
+ return paymentOrThrow(data.cancelPayment);
275
+ },
155
276
  async refundPosition(orderId, options) {
156
277
  const data = await transport.graphql({ api: 'admin', query: ORDER_REFUND_POSITION_QUERY, variables: { orderId } }, options);
157
278
  return data.orderRefundPosition;
158
279
  },
280
+ // Its own query rather than fields on `refundPosition`'s: an SDK released ahead of an engine
281
+ // without them must not break that read.
282
+ async refundGiftCardHold(orderId, options) {
283
+ const data = await transport.graphql({ api: 'admin', query: REFUND_GIFT_CARD_HOLD_QUERY, variables: { orderId } }, options);
284
+ return data.orderRefundPosition;
285
+ },
286
+ async refundCreditNoteRequirement(orderId, options) {
287
+ const data = await transport.graphql({ api: 'admin', query: REFUND_CREDIT_NOTE_REQUIREMENT_QUERY, variables: { orderId } }, options);
288
+ return data.orderRefundPosition.creditNoteRequired;
289
+ },
159
290
  // Its own query rather than a field on `refundPosition`'s: an SDK released
160
291
  // ahead of a server without `unreconciled` must not break that read.
161
292
  async unreconciledRefunds(orderId, options) {
@@ -191,3 +322,4 @@ export function createPaymentsModule(transport) {
191
322
  },
192
323
  };
193
324
  }
325
+ export { PAYMENT_REQUEST_CLOSE_REASONS, PAYMENT_REQUEST_DEFAULT_EXPIRY_DAYS, PAYMENT_REQUEST_MAX_EXPIRY_DAYS, PAYMENT_REQUEST_STATUSES, } from './requests.js';