@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,14 @@
1
1
  import { type Page, type Transport } from '@sixtyninecommerce/core';
2
2
  import type { Call } from '../types.js';
3
+ import { type ConnectedAccountModule } from './connected-account.js';
3
4
  /**
4
- * Which credential a store is actually paying through.
5
+ * Which credential a store's payments actually take.
5
6
  *
6
- * `connect` — an account the store onboarded through the platform.
7
- * `legacy` — the channel's own per-provider API key, as it has always worked.
7
+ * `connect` — an account the store's seller onboarded through the platform: a
8
+ * payment method pays through it, or the seller is connected and no method
9
+ * holds a key.
10
+ * `legacy` — the payment methods' own per-provider API key, as it has always
11
+ * worked, even when the seller is also connected (for card terminals).
8
12
  * Supported indefinitely: a store moves when it chooses to, and both paths
9
13
  * can be fully ready.
10
14
  * `none` — neither, so nothing can be charged.
@@ -76,9 +80,9 @@ export interface ProviderOnboardingStart {
76
80
  */
77
81
  export interface ProviderReadiness {
78
82
  provider: string;
79
- /** Which credential this verdict is about. Both `connect` and `legacy` can be ready. */
83
+ /** Which credential the store's payments take. Both `connect` and `legacy` can be ready. */
80
84
  path: ProviderCredentialPath;
81
- /** `test` or `live` when there is a connection; null on the legacy path. */
85
+ /** `test` or `live` when the seller holds a live connection, on either path; null without one. */
82
86
  mode: string | null;
83
87
  connected: boolean;
84
88
  /**
@@ -97,14 +101,17 @@ export interface ProviderReadiness {
97
101
  * False means the call did not come back — an outage, a timeout — so nothing
98
102
  * else here about the credential was verified and `blockers` holds that one
99
103
  * sentence. Retry; do NOT send the merchant to reconnect on it. Always true
100
- * on the `legacy` path and with no credential, where there is no probe.
104
+ * where no connection is in use: no connection, or the `legacy` path with a
105
+ * connection that drives no card terminal.
101
106
  */
102
107
  providerReachable: boolean;
103
108
  /**
104
109
  * On the `connect` path: the provider itself accepts the stored credential
105
- * RIGHT NOW. On the `legacy` path it means only that the store holds a key on
106
- * an enabled method — the server never reads that key here, so a legacy key
107
- * the provider has since revoked still reads `true`.
110
+ * RIGHT NOW. On the `legacy` path it means that the store holds a key on an
111
+ * enabled method — the server never reads that key here, so a legacy key the
112
+ * provider has since revoked still reads `true` — and, when the seller's
113
+ * connection drives card terminals, that the provider accepts that
114
+ * connection too.
108
115
  */
109
116
  credentialUsable: boolean;
110
117
  methodActive: boolean;
@@ -137,6 +144,50 @@ export interface ProviderReadiness {
137
144
  */
138
145
  blockers: string[];
139
146
  }
147
+ /**
148
+ * What a provider account can do, and what the merchant must still do for it — the dashboard's
149
+ * Connect panel reads this. Asked of the provider live where it can be (its onboarding), so
150
+ * `providerReachable: false` means the onboarding fields are unknown right now, not false.
151
+ */
152
+ export interface PaymentProviderAccount {
153
+ provider: string;
154
+ /** A live connection exists for this store's legal entity. */
155
+ connected: boolean;
156
+ /** `pending`, `connected` or `disconnected`; null when the legal entity never connected. */
157
+ status: string | null;
158
+ /** The account's PUBLIC id at the provider (a Mollie organization id). */
159
+ externalId: string | null;
160
+ /** `test` or `live`, when there is a connection. */
161
+ mode: string | null;
162
+ /** What the provider granted the connection. */
163
+ grantedScopes: string[];
164
+ /**
165
+ * What the platform's consent asks for and the grant lacks. Non-empty after a scope wave
166
+ * (Mollie Connect, 2026-10-08: refunds, onboarding, customers and mandates).
167
+ */
168
+ missingScopes: string[];
169
+ /**
170
+ * The merchant must consent again: a scope is missing, or the provider refused the grant
171
+ * (revoked in its dashboard). {@link ProvidersModule.startOnboarding} starts the re-consent
172
+ * WITHOUT disconnecting; the connection keeps working for what it can still do meanwhile.
173
+ */
174
+ reconnectRequired: boolean;
175
+ /** Since when an operation found the grant unable to do it (ISO-8601); null while none has. */
176
+ reconnectRequiredAt: string | null;
177
+ /** The grant covers online payments (hosted checkout, refunds, capture). */
178
+ onlinePayments: boolean;
179
+ /** The provider's own onboarding of the account (`needs-data`, `in-review`, `completed`). */
180
+ onboardingStatus: string | null;
181
+ /** Whether the provider lets the account take payments; null when unknown. */
182
+ canReceivePayments: boolean | null;
183
+ canReceiveSettlements: boolean | null;
184
+ /** Where the merchant finishes the provider's onboarding — a public link, never a credential. */
185
+ dashboardUrl: string | null;
186
+ /** The provider was asked about its onboarding and answered. */
187
+ providerReachable: boolean;
188
+ /** The provider profile (website) online payments are taken on, when it has one. */
189
+ profileId: string | null;
190
+ }
140
191
  export interface ProvisionTerminalInput {
141
192
  /** What the merchant calls it — "Counter 1". At most 120 characters. */
142
193
  label: string;
@@ -219,7 +270,14 @@ export interface ProviderTerminalsModule {
219
270
  * `PROVIDER_ALREADY_CONNECTED` (→ `ConflictError`; disconnect first rather than
220
271
  * silently re-pointing a store's money), `ONBOARDING_STATE_INVALID`,
221
272
  * `PROVIDER_CREDENTIAL_REJECTED`, `TERMINAL_NOT_FOUND` (→ `NotFoundError`),
222
- * `TERMINAL_REJECTED`, `LIVE_CONNECTION_REFUSED`, and the `INVALID_*` input
273
+ * `TERMINAL_REJECTED`, `LIVE_CONNECTION_REFUSED`, `RECONNECT_REQUIRED` (the
274
+ * grant lacks a scope or was revoked: each missing scope arrives as a
275
+ * `details[].code` of the thrown `PlatformError`, none for a revoked grant;
276
+ * start the re-consent with {@link ProvidersModule.startOnboarding}),
277
+ * `PAYMENTS_NOT_ENABLED` (the provider's own onboarding is open:
278
+ * {@link ProvidersModule.account} answers its `dashboardUrl`),
279
+ * `PROVIDER_ACCOUNT_MISMATCH`,
280
+ * `PROVIDER_PAYMENT_REJECTED`, and the `INVALID_*` input
223
281
  * refusals (→ `ValidationError`). Assigning a terminal to a location of another
224
282
  * channel answers `LOCATION_NOT_IN_CHANNEL`, the same code the rest of the
225
283
  * platform uses for that one rule.
@@ -237,7 +295,11 @@ export interface ProvidersModule {
237
295
  * Begin connecting this seller's account. Send the merchant to the `url`, and
238
296
  * hand the `state` back to {@link completeOnboarding} when they return.
239
297
  *
240
- * Refused with `PROVIDER_ALREADY_CONNECTED` while a live connection exists.
298
+ * Refused with `PROVIDER_ALREADY_CONNECTED` while a live connection exists,
299
+ * UNLESS {@link account} reports `reconnectRequired`: then this starts a
300
+ * re-consent of the same account and the connection stays live meanwhile. A
301
+ * re-consent that comes back from ANOTHER account is refused
302
+ * `PROVIDER_ACCOUNT_MISMATCH` and changes nothing.
241
303
  *
242
304
  * This is the one call here that takes NO `idempotencyKey`, and it needs
243
305
  * none: a repeat replaces the pending attempt rather than creating a second
@@ -261,15 +323,28 @@ export interface ProvidersModule {
261
323
  activateMethod(provider: string, method: string, options?: Call): Promise<ProviderConnection>;
262
324
  /** Can this store be paid through this provider, and if not, what is missing? */
263
325
  readiness(provider: string, options?: ReadinessOptions): Promise<ProviderReadiness>;
326
+ /**
327
+ * What the legal entity's account can do and what the merchant must still do: the grant's
328
+ * scopes against the platform's consent, whether a reconnect is required (and since when),
329
+ * whether online payments are covered, and the provider's own onboarding. Never refused for a
330
+ * revoked grant — that is `reconnectRequired: true`. Needs `ReadPaymentMethod`.
331
+ */
332
+ account(provider: string, options?: Call): Promise<PaymentProviderAccount>;
264
333
  /**
265
334
  * End the connection at the provider. False when there was nothing to
266
335
  * disconnect. The row stays, marked disconnected.
267
336
  */
268
337
  disconnect(provider: string, options?: Call): Promise<boolean>;
269
338
  terminals: ProviderTerminalsModule;
339
+ /**
340
+ * The Stripe Connect account id saved on the store's legal entity (saved, not yet used for
341
+ * charges). See {@link ConnectedAccountModule}.
342
+ */
343
+ connectedAccount: ConnectedAccountModule;
270
344
  }
271
345
  export declare const PROVIDER_CONNECTIONS_QUERY = "\n query ProviderConnections {\n providerConnections { \n id\n sellerId\n provider\n status\n externalId\n scopes\n activeMethods\n mode\n connectedAt\n disconnectedAt\n createdAt\n updatedAt\n }\n }\n";
272
346
  export declare const PROVIDER_READINESS_QUERY = "\n query PaymentProviderReadiness($provider: String!, $orderId: ID, $locationId: ID) {\n paymentProviderReadiness(provider: $provider, orderId: $orderId, locationId: $locationId) {\n \n provider\n path\n mode\n connected\n adapterAvailable\n providerReachable\n credentialUsable\n methodActive\n terminalProvisioned\n terminalUsableForLocation\n partialSupported\n orderPayable\n overall\n blockers\n\n }\n }\n";
347
+ export declare const PAYMENT_PROVIDER_ACCOUNT_QUERY = "\n query PaymentProviderAccount($provider: String!) {\n paymentProviderAccount(provider: $provider) { \n provider\n connected\n status\n externalId\n mode\n grantedScopes\n missingScopes\n reconnectRequired\n reconnectRequiredAt\n onlinePayments\n onboardingStatus\n canReceivePayments\n canReceiveSettlements\n dashboardUrl\n providerReachable\n profileId\n }\n }\n";
273
348
  export declare const PROVIDER_TERMINALS_QUERY = "\n query ProviderTerminals($provider: String!) {\n providerTerminals(provider: $provider) { \n id\n externalId\n label\n stockLocationId\n status\n lastSeenAt\n createdAt\n updatedAt\n }\n }\n";
274
349
  export declare const START_ONBOARDING_MUTATION = "\n mutation StartPaymentProviderOnboarding($provider: String!, $returnUrl: String!) {\n startPaymentProviderOnboarding(provider: $provider, returnUrl: $returnUrl) {\n url\n state\n mode\n }\n }\n";
275
350
  export declare const COMPLETE_ONBOARDING_MUTATION = "\n mutation CompletePaymentProviderOnboarding($provider: String!, $state: String!, $code: String!, $idempotencyKey: String) {\n completePaymentProviderOnboarding(provider: $provider, state: $state, code: $code, idempotencyKey: $idempotencyKey) {\n \n id\n sellerId\n provider\n status\n externalId\n scopes\n activeMethods\n mode\n connectedAt\n disconnectedAt\n createdAt\n updatedAt\n\n }\n }\n";
@@ -1,4 +1,5 @@
1
1
  import { createPage } from '@sixtyninecommerce/core';
2
+ import { createConnectedAccountModule } from './connected-account.js';
2
3
  const CONNECTION_FIELDS = /* GraphQL */ `
3
4
  id
4
5
  sellerId
@@ -51,6 +52,29 @@ export const PROVIDER_READINESS_QUERY = /* GraphQL */ `
51
52
  }
52
53
  }
53
54
  `;
55
+ const ACCOUNT_FIELDS = /* GraphQL */ `
56
+ provider
57
+ connected
58
+ status
59
+ externalId
60
+ mode
61
+ grantedScopes
62
+ missingScopes
63
+ reconnectRequired
64
+ reconnectRequiredAt
65
+ onlinePayments
66
+ onboardingStatus
67
+ canReceivePayments
68
+ canReceiveSettlements
69
+ dashboardUrl
70
+ providerReachable
71
+ profileId
72
+ `;
73
+ export const PAYMENT_PROVIDER_ACCOUNT_QUERY = /* GraphQL */ `
74
+ query PaymentProviderAccount($provider: String!) {
75
+ paymentProviderAccount(provider: $provider) { ${ACCOUNT_FIELDS} }
76
+ }
77
+ `;
54
78
  export const PROVIDER_TERMINALS_QUERY = /* GraphQL */ `
55
79
  query ProviderTerminals($provider: String!) {
56
80
  providerTerminals(provider: $provider) { ${TERMINAL_FIELDS} }
@@ -159,10 +183,15 @@ export function createProvidersModule(transport) {
159
183
  }, options);
160
184
  return data.paymentProviderReadiness;
161
185
  },
186
+ async account(provider, options) {
187
+ const data = await transport.graphql({ api: 'admin', query: PAYMENT_PROVIDER_ACCOUNT_QUERY, variables: { provider } }, options);
188
+ return data.paymentProviderAccount;
189
+ },
162
190
  async disconnect(provider, options) {
163
191
  const data = await transport.graphql({ api: 'admin', query: DISCONNECT_PROVIDER_MUTATION, variables: { provider } }, options);
164
192
  return data.disconnectPaymentProvider;
165
193
  },
194
+ connectedAccount: createConnectedAccountModule(transport),
166
195
  terminals: {
167
196
  async list(provider, options) {
168
197
  const data = await transport.graphql({ api: 'admin', query: PROVIDER_TERMINALS_QUERY, variables: { provider } }, options);
@@ -0,0 +1,144 @@
1
+ import type { Transport } from '@sixtyninecommerce/core';
2
+ import type { Call } from '../types.js';
3
+ /**
4
+ * A payment request's states, in the engine's order (`OrderPaymentRequestStatus`): `OPEN`, then
5
+ * exactly one of the other three, for good.
6
+ */
7
+ export declare const PAYMENT_REQUEST_STATUSES: readonly ["OPEN", "PAID", "EXPIRED", "CANCELLED"];
8
+ /** A payment request's state: OPEN, then exactly one of the other three, for good. */
9
+ export type PaymentRequestStatus = (typeof PAYMENT_REQUEST_STATUSES)[number];
10
+ /**
11
+ * Why a payment request closed: `PAID` (its payment landed), `EXPIRED`,
12
+ * `CANCELLED` (by staff, `requests.cancel`), `ORDER_SETTLED` (the order's
13
+ * balance reached zero through another payment), `ORDER_CANCELLED`, or
14
+ * `ORDER_CURRENCY_CHANGED` (the order is now billed in another currency than
15
+ * the request asked in: send a new one).
16
+ */
17
+ export type PaymentRequestCloseReason = (typeof PAYMENT_REQUEST_CLOSE_REASONS)[number];
18
+ /** Every close reason, in the engine's order (`OrderPaymentRequestCloseReason`). */
19
+ export declare const PAYMENT_REQUEST_CLOSE_REASONS: readonly ["PAID", "EXPIRED", "CANCELLED", "ORDER_SETTLED", "ORDER_CANCELLED", "ORDER_CURRENCY_CHANGED"];
20
+ /**
21
+ * How long a request's link works when `create` names no `expiresAt`: this many days from the
22
+ * moment the engine creates it. The engine's own default, pinned to it by this package's spec.
23
+ */
24
+ export declare const PAYMENT_REQUEST_DEFAULT_EXPIRY_DAYS = 14;
25
+ /**
26
+ * The furthest ahead `create`'s `expiresAt` may be: this many days from the moment the engine
27
+ * judges it. Later, or not in the future at all, is refused `PAYMENT_REQUEST_EXPIRY_INVALID`.
28
+ * Pinned to the engine by this package's spec.
29
+ */
30
+ export declare const PAYMENT_REQUEST_MAX_EXPIRY_DAYS = 90;
31
+ /**
32
+ * A hosted payment request: the store asks the customer to pay `amount` of an
33
+ * order through `url`, a stable link that opens the payment provider's
34
+ * checkout. It moves no money by itself: when the customer pays, the money
35
+ * lands on the order as one of its payments (`payments.position`), and the
36
+ * request turns `PAID` naming it.
37
+ */
38
+ export interface PaymentRequest {
39
+ id: string;
40
+ /** ISO-8601. */
41
+ createdAt: string;
42
+ orderId: string;
43
+ orderCode: string;
44
+ /** Minor units of `currencyCode` the customer is asked for. */
45
+ amount: number;
46
+ currencyCode: string;
47
+ /** The payment method code the customer pays with. */
48
+ method: string;
49
+ status: PaymentRequestStatus;
50
+ /** ISO-8601: when it reached `status` (its expiry, for one EXPIRED and not yet swept). */
51
+ statusChangedAt: string;
52
+ /** Null while `OPEN`. */
53
+ closeReason: PaymentRequestCloseReason | null;
54
+ /** ISO-8601: after this the link opens no checkout. */
55
+ expiresAt: string;
56
+ /**
57
+ * The link to send the customer (`<host>/pay/<token>`): by email, as a QR
58
+ * code, in your own app. A capability to PAY this request and nothing else;
59
+ * it works until the request closes or expires.
60
+ */
61
+ url: string;
62
+ /** Where the provider sends the customer after paying. */
63
+ redirectUrl: string;
64
+ /** The order's payment that paid it; null unless `PAID`. */
65
+ paymentId: string | null;
66
+ /** How many provider checkouts the link has opened. */
67
+ attemptCount: number;
68
+ }
69
+ export interface CreatePaymentRequestInput {
70
+ /** A held (`Parked`) order, or a committed draft, of this store. */
71
+ orderId: string;
72
+ /** A payment method code of this store that opens a hosted checkout (Mollie). */
73
+ method: string;
74
+ /**
75
+ * Minor units. Omit it to ask for what the order still owes. Less than that
76
+ * is a deposit, refused `DEPOSITS_NOT_ENABLED` on a store without deposits.
77
+ */
78
+ amount?: number;
79
+ /**
80
+ * Where the customer lands after paying: an absolute URL on one of this
81
+ * store's own sites (`REDIRECT_URL_NOT_ALLOWED` otherwise). Omit it for the
82
+ * store's storefront.
83
+ */
84
+ redirectUrl?: string;
85
+ /**
86
+ * ISO-8601. Omit it for {@link PAYMENT_REQUEST_DEFAULT_EXPIRY_DAYS} days from now; at most
87
+ * {@link PAYMENT_REQUEST_MAX_EXPIRY_DAYS} days ahead.
88
+ */
89
+ expiresAt?: string;
90
+ }
91
+ /**
92
+ * Hosted payment requests (`admin.payments.requests`): ask a customer to pay a
93
+ * chosen amount of an order through a stable link, without recording the
94
+ * payment yourself.
95
+ *
96
+ * Needs `RequestOrderPayment` (the `order-payments` token template) or
97
+ * `UpdateOrder` to create and cancel, and `ReadOrder` or `RequestOrderPayment`
98
+ * to list. Creating one asks the payment method's provider, so the store must
99
+ * hold that provider's plugin (Mollie).
100
+ *
101
+ * Several requests may be open on one order at once, and together they may
102
+ * ask for more than it owes: each is checked against what the order owes
103
+ * again when the customer opens the link, so a request the order no longer
104
+ * owes enough for is refused at the link, never charged. When the order's
105
+ * balance reaches zero, its other open requests close (`ORDER_SETTLED`).
106
+ *
107
+ * Events: `payment.request.created` and `payment.request.closed`
108
+ * (`status`, `reason_code`, and the payment once `paid`); the money itself is
109
+ * announced as `payment.partial_recorded` like every payment.
110
+ */
111
+ export interface PaymentRequestsModule {
112
+ /**
113
+ * Ask the customer to pay `input.amount` (default: the balance) of a held
114
+ * order or a committed draft. Answers the request with its `url`.
115
+ *
116
+ * `options.idempotencyKey` is honoured: a repeat under the same key returns
117
+ * the same request instead of opening a second link.
118
+ *
119
+ * Refusals: `PAYMENT_REQUEST_ORDER_NOT_ELIGIBLE` (not a parked order or a
120
+ * committed draft: `extensions.orderState`), `PAYMENT_REQUEST_NOTHING_OUTSTANDING`,
121
+ * `AMOUNT_NOT_POSITIVE`, `AMOUNT_EXCEEDS_OUTSTANDING` (`extensions.outstanding`),
122
+ * `DEPOSITS_NOT_ENABLED`, `PAYMENT_METHOD_NOT_FOUND`,
123
+ * `PAYMENT_METHOD_UNUSABLE_HERE` (a method that opens no hosted checkout),
124
+ * `REDIRECT_URL_NOT_ALLOWED`, `PAYMENT_REQUEST_REDIRECT_URL_REQUIRED`,
125
+ * `PAYMENT_REQUEST_EXPIRY_INVALID` (`extensions.latestExpiresAt`),
126
+ * `PAYMENT_REQUEST_STORE_REQUIRED` (asked from the platform root or an
127
+ * organization workspace), `ORDER_NOT_FOUND`.
128
+ */
129
+ create(input: CreatePaymentRequestInput, options?: Call): Promise<PaymentRequest>;
130
+ /**
131
+ * Cancel an `OPEN` request: its link stops opening a checkout. A payment the
132
+ * customer already started can still complete; it is then recorded on the
133
+ * order like any other, and staff decide whether the order keeps it.
134
+ * `options.idempotencyKey` is honoured. Refusals: `PAYMENT_REQUEST_NOT_OPEN`
135
+ * (`extensions.status`), `PAYMENT_REQUEST_NOT_FOUND`.
136
+ */
137
+ cancel(id: string, options?: Call): Promise<PaymentRequest>;
138
+ /** Every request of one order, newest first. Refused `ORDER_NOT_FOUND` for another store's order. */
139
+ list(orderId: string, options?: Call): Promise<PaymentRequest[]>;
140
+ }
141
+ export declare const CREATE_ORDER_PAYMENT_REQUEST_MUTATION = "\n mutation CreateOrderPaymentRequest(\n $input: CreateOrderPaymentRequestInput!\n $idempotencyKey: String\n ) {\n createOrderPaymentRequest(input: $input, idempotencyKey: $idempotencyKey) {\n \n id\n createdAt\n orderId\n orderCode\n amount\n currencyCode\n method\n status\n statusChangedAt\n closeReason\n expiresAt\n url\n redirectUrl\n paymentId\n attemptCount\n\n }\n }\n";
142
+ export declare const CANCEL_ORDER_PAYMENT_REQUEST_MUTATION = "\n mutation CancelOrderPaymentRequest($id: ID!, $idempotencyKey: String) {\n cancelOrderPaymentRequest(id: $id, idempotencyKey: $idempotencyKey) {\n \n id\n createdAt\n orderId\n orderCode\n amount\n currencyCode\n method\n status\n statusChangedAt\n closeReason\n expiresAt\n url\n redirectUrl\n paymentId\n attemptCount\n\n }\n }\n";
143
+ export declare const ORDER_PAYMENT_REQUESTS_QUERY = "\n query OrderPaymentRequests($orderId: ID!) {\n orderPaymentRequests(orderId: $orderId) {\n \n id\n createdAt\n orderId\n orderCode\n amount\n currencyCode\n method\n status\n statusChangedAt\n closeReason\n expiresAt\n url\n redirectUrl\n paymentId\n attemptCount\n\n }\n }\n";
144
+ export declare function createPaymentRequestsModule(transport: Transport): PaymentRequestsModule;
@@ -0,0 +1,92 @@
1
+ /**
2
+ * A payment request's states, in the engine's order (`OrderPaymentRequestStatus`): `OPEN`, then
3
+ * exactly one of the other three, for good.
4
+ */
5
+ export const PAYMENT_REQUEST_STATUSES = ['OPEN', 'PAID', 'EXPIRED', 'CANCELLED'];
6
+ /** Every close reason, in the engine's order (`OrderPaymentRequestCloseReason`). */
7
+ export const PAYMENT_REQUEST_CLOSE_REASONS = [
8
+ 'PAID',
9
+ 'EXPIRED',
10
+ 'CANCELLED',
11
+ 'ORDER_SETTLED',
12
+ 'ORDER_CANCELLED',
13
+ 'ORDER_CURRENCY_CHANGED',
14
+ ];
15
+ /**
16
+ * How long a request's link works when `create` names no `expiresAt`: this many days from the
17
+ * moment the engine creates it. The engine's own default, pinned to it by this package's spec.
18
+ */
19
+ export const PAYMENT_REQUEST_DEFAULT_EXPIRY_DAYS = 14;
20
+ /**
21
+ * The furthest ahead `create`'s `expiresAt` may be: this many days from the moment the engine
22
+ * judges it. Later, or not in the future at all, is refused `PAYMENT_REQUEST_EXPIRY_INVALID`.
23
+ * Pinned to the engine by this package's spec.
24
+ */
25
+ export const PAYMENT_REQUEST_MAX_EXPIRY_DAYS = 90;
26
+ const PAYMENT_REQUEST_FIELDS = /* GraphQL */ `
27
+ id
28
+ createdAt
29
+ orderId
30
+ orderCode
31
+ amount
32
+ currencyCode
33
+ method
34
+ status
35
+ statusChangedAt
36
+ closeReason
37
+ expiresAt
38
+ url
39
+ redirectUrl
40
+ paymentId
41
+ attemptCount
42
+ `;
43
+ export const CREATE_ORDER_PAYMENT_REQUEST_MUTATION = /* GraphQL */ `
44
+ mutation CreateOrderPaymentRequest(
45
+ $input: CreateOrderPaymentRequestInput!
46
+ $idempotencyKey: String
47
+ ) {
48
+ createOrderPaymentRequest(input: $input, idempotencyKey: $idempotencyKey) {
49
+ ${PAYMENT_REQUEST_FIELDS}
50
+ }
51
+ }
52
+ `;
53
+ export const CANCEL_ORDER_PAYMENT_REQUEST_MUTATION = /* GraphQL */ `
54
+ mutation CancelOrderPaymentRequest($id: ID!, $idempotencyKey: String) {
55
+ cancelOrderPaymentRequest(id: $id, idempotencyKey: $idempotencyKey) {
56
+ ${PAYMENT_REQUEST_FIELDS}
57
+ }
58
+ }
59
+ `;
60
+ export const ORDER_PAYMENT_REQUESTS_QUERY = /* GraphQL */ `
61
+ query OrderPaymentRequests($orderId: ID!) {
62
+ orderPaymentRequests(orderId: $orderId) {
63
+ ${PAYMENT_REQUEST_FIELDS}
64
+ }
65
+ }
66
+ `;
67
+ export function createPaymentRequestsModule(transport) {
68
+ return {
69
+ async create(input, options) {
70
+ const data = await transport.graphql({
71
+ api: 'admin',
72
+ query: CREATE_ORDER_PAYMENT_REQUEST_MUTATION,
73
+ // A variable, not a header: the Admin API takes the key as an argument.
74
+ // `undefined`, never null: an omitted key stays off the wire.
75
+ variables: { input, idempotencyKey: options?.idempotencyKey },
76
+ }, options);
77
+ return data.createOrderPaymentRequest;
78
+ },
79
+ async cancel(id, options) {
80
+ const data = await transport.graphql({
81
+ api: 'admin',
82
+ query: CANCEL_ORDER_PAYMENT_REQUEST_MUTATION,
83
+ variables: { id, idempotencyKey: options?.idempotencyKey },
84
+ }, options);
85
+ return data.cancelOrderPaymentRequest;
86
+ },
87
+ async list(orderId, options) {
88
+ const data = await transport.graphql({ api: 'admin', query: ORDER_PAYMENT_REQUESTS_QUERY, variables: { orderId } }, options);
89
+ return data.orderPaymentRequests;
90
+ },
91
+ };
92
+ }
@@ -0,0 +1,15 @@
1
+ import { type Transport } from '@sixtyninecommerce/core';
2
+ /** The selection of a `StoreCreditMove`. */
3
+ export declare const STORE_CREDIT_MOVE_FIELDS = "accountId amount currencyCode entryIds";
4
+ /** `document` without the fields above: what an engine before them accepts. */
5
+ export declare function withoutStoreCreditFields(document: string): string;
6
+ /**
7
+ * "This engine does not know that field yet": refused before it ran, never at execution. Shared
8
+ * with `credit-noted-fields.ts`, the same fallback for the payment position's credit fields.
9
+ */
10
+ export declare function isUnknownFieldRejection(error: unknown): boolean;
11
+ /**
12
+ * The transport, sending a document that names the store-credit fields once more without them
13
+ * when the engine refused it as unknown. Safe for a mutation too: a refused document never ran.
14
+ */
15
+ export declare function storeCreditAware(transport: Pick<Transport, 'graphql'>): Pick<Transport, 'graphql'>;
@@ -0,0 +1,51 @@
1
+ import { ValidationError } from '@sixtyninecommerce/core';
2
+ /**
3
+ * The fields incentives sprint 8 PR 3 added to the "credit the customer" answers: the store's
4
+ * customer-credit `book` on an overpayment option and a fulfilment cancel's settlement, the
5
+ * cancel's `creditedToStoreCredit`, and the `storeCredit` move; and PR 4's on the invoice
6
+ * correction's account credit (`book`, `storeCreditEntryIds`). An engine before them refuses a
7
+ * document naming one of them as a whole, before it runs; the same document without them reads
8
+ * as it did then (`book`, `storeCredit` and the entries absent, the figure 0).
9
+ */
10
+ const STORE_CREDIT_FIELDS = [
11
+ /\bstoreCredit\s*\{[^{}]*\}/g,
12
+ /\bcreditedToStoreCredit\b/g,
13
+ /\bstoreCreditEntryIds\b/g,
14
+ /\bbook\b/g,
15
+ ];
16
+ /** The selection of a `StoreCreditMove`. */
17
+ export const STORE_CREDIT_MOVE_FIELDS = 'accountId amount currencyCode entryIds';
18
+ /** `document` without the fields above: what an engine before them accepts. */
19
+ export function withoutStoreCreditFields(document) {
20
+ return STORE_CREDIT_FIELDS.reduce((text, field) => text.replace(field, ''), document);
21
+ }
22
+ /**
23
+ * "This engine does not know that field yet": refused before it ran, never at execution. Shared
24
+ * with `credit-noted-fields.ts`, the same fallback for the payment position's credit fields.
25
+ */
26
+ export function isUnknownFieldRejection(error) {
27
+ if (!(error instanceof ValidationError) || error.service !== 'vendure')
28
+ return false;
29
+ return (error.code === 'BAD_REQUEST' ||
30
+ error.code === 'GRAPHQL_VALIDATION_FAILED' ||
31
+ /Cannot query field/i.test(error.message));
32
+ }
33
+ /**
34
+ * The transport, sending a document that names the store-credit fields once more without them
35
+ * when the engine refused it as unknown. Safe for a mutation too: a refused document never ran.
36
+ */
37
+ export function storeCreditAware(transport) {
38
+ return {
39
+ async graphql(call, options) {
40
+ try {
41
+ return await transport.graphql(call, options);
42
+ }
43
+ catch (error) {
44
+ const legacy = withoutStoreCreditFields(call.query);
45
+ if (legacy === call.query || !isUnknownFieldRejection(error))
46
+ throw error;
47
+ return transport.graphql({ ...call, query: legacy }, options);
48
+ }
49
+ },
50
+ };
51
+ }
@@ -0,0 +1,104 @@
1
+ import type { Transport } from '@sixtyninecommerce/core';
2
+ import type { Call } from '../types.js';
3
+ /**
4
+ * Store pickup (click & collect, POS C1/33): webshop orders a shopper collects at one of the
5
+ * store's shops. Placing such an order writes its pickup (`preparing`); "ready" starts the hold
6
+ * and emails the customer once; the shop's till hands it over (`collected`); a ready pickup not
7
+ * collected within the location's hold days goes back to stock (`expired`), and the pickup of a
8
+ * cancelled order is `cancelled`. A location's settings are `admin.locations.pickup/setPickup`.
9
+ */
10
+ /** The statuses a pickup has today. More may come: read any other value as itself. */
11
+ export declare const STORE_PICKUP_STATUSES: readonly ["preparing", "ready", "collected", "expired", "cancelled"];
12
+ export type StorePickupStatus = (typeof STORE_PICKUP_STATUSES)[number];
13
+ /**
14
+ * Why the release at expiry moved nothing (D23): `invoice_locked`, the order is invoiced and
15
+ * locked; `order_state`, the order is past the states a reservation is released from. More may
16
+ * come.
17
+ */
18
+ export declare const STORE_PICKUP_RELEASE_BLOCKED: readonly ["invoice_locked", "order_state"];
19
+ export type StorePickupReleaseBlocked = (typeof STORE_PICKUP_RELEASE_BLOCKED)[number];
20
+ /** A webshop order collected at a shop. Instants are ISO-8601 UTC. */
21
+ export interface StorePickup {
22
+ id: string;
23
+ orderId: string;
24
+ orderCode: string;
25
+ stockLocationId: string;
26
+ stockLocationName: string;
27
+ /** {@link STORE_PICKUP_STATUSES}, or a newer status this SDK does not know yet. */
28
+ status: StorePickupStatus | (string & {});
29
+ /** The order's customer, for the hand-over's ID check. Customer data: see `redacted`. */
30
+ customerName: string | null;
31
+ totalQuantity: number;
32
+ /** The shop could not hold every item when the order was placed: check stock before "ready". */
33
+ stockShort: boolean;
34
+ placedAt: string | null;
35
+ readyAt: string | null;
36
+ /** When an uncollected ready pickup goes back to stock. */
37
+ holdUntil: string | null;
38
+ collectedAt: string | null;
39
+ /** When the expiry ran (the stock went back unless `releaseBlocked` says otherwise). */
40
+ expiredAt: string | null;
41
+ /** Null unless the release at expiry was refused and nothing moved. */
42
+ releaseBlocked: StorePickupReleaseBlocked | (string & {}) | null;
43
+ createdAt: string;
44
+ /**
45
+ * Present (`true`) when the caller's customer-data level blanked a field of this answer: an
46
+ * app installation below `customerData: full` reads `customerName` as null, which is then not
47
+ * "no name".
48
+ */
49
+ redacted?: true;
50
+ }
51
+ /** Which pickups `list` answers. Every field narrows; none is required. */
52
+ export interface StorePickupListFilter {
53
+ /** One of the store's stock locations. A credential restricted to locations must hold it. */
54
+ stockLocationId?: string;
55
+ /** Any of these statuses; all when left out or empty. */
56
+ statuses?: ReadonlyArray<StorePickupStatus | (string & {})>;
57
+ /** At most 100; 50 when left out. */
58
+ take?: number;
59
+ skip?: number;
60
+ }
61
+ /** A page of pickups, newest first. */
62
+ export interface StorePickupList {
63
+ items: StorePickup[];
64
+ /** Every pickup the filter matches, not only this page. */
65
+ totalItems: number;
66
+ }
67
+ /**
68
+ * The store's pickups (C1/33). Reading needs `ReadOrder`, "ready" `UpdateOrder`. There is no
69
+ * hand-over here: that is the till's act, with the order code checked at the counter (D22).
70
+ *
71
+ * **Coded refusals**, delivered as GraphQL errors with `extensions.code`:
72
+ * `STORE_PICKUP_NOT_FOUND` (→ `NotFoundError`) for a pickup that is not this store's;
73
+ * `STORE_PICKUP_STATE` (→ `BusinessRuleError`) when the pickup's status does not allow the move
74
+ * (collected, expired, cancelled); and, on a location filter, `LOCATION_NOT_IN_CHANNEL`
75
+ * (→ `ValidationError`) for another store's location or `LOCATION_NOT_ALLOWED`
76
+ * (→ `PermissionDeniedError`) for one a restricted credential does not hold.
77
+ */
78
+ export interface PickupsModule {
79
+ /**
80
+ * A page of the store's pickups, newest first. A credential restricted to some locations
81
+ * sees only theirs.
82
+ *
83
+ * @effect read
84
+ */
85
+ list(filter?: StorePickupListFilter, options?: Call): Promise<StorePickupList>;
86
+ /**
87
+ * The order's pickup, or null when the order is not collected at a shop (or not this
88
+ * store's).
89
+ *
90
+ * @effect read
91
+ */
92
+ forOrder(orderId: string, options?: Call): Promise<StorePickup | null>;
93
+ /**
94
+ * Mark a pickup ready: the hold starts (the location's hold days) and the customer gets the
95
+ * ready email, once. Ready again answers the pickup unchanged and sends nothing.
96
+ *
97
+ * @effect write
98
+ */
99
+ markReady(id: string, options?: Call): Promise<StorePickup>;
100
+ }
101
+ export declare const STORE_PICKUPS_QUERY = "\n query StorePickups($input: StorePickupListInput) {\n storePickups(input: $input) {\n items { \n id\n orderId\n orderCode\n stockLocationId\n stockLocationName\n status\n customerName\n totalQuantity\n stockShort\n placedAt\n readyAt\n holdUntil\n collectedAt\n expiredAt\n releaseBlocked\n createdAt\n }\n totalItems\n }\n }\n";
102
+ export declare const STORE_PICKUP_FOR_ORDER_QUERY = "\n query StorePickupForOrder($orderId: ID!) {\n storePickupForOrder(orderId: $orderId) { \n id\n orderId\n orderCode\n stockLocationId\n stockLocationName\n status\n customerName\n totalQuantity\n stockShort\n placedAt\n readyAt\n holdUntil\n collectedAt\n expiredAt\n releaseBlocked\n createdAt\n }\n }\n";
103
+ export declare const MARK_STORE_PICKUP_READY_MUTATION = "\n mutation MarkStorePickupReady($id: ID!) {\n markStorePickupReady(id: $id) { \n id\n orderId\n orderCode\n stockLocationId\n stockLocationName\n status\n customerName\n totalQuantity\n stockShort\n placedAt\n readyAt\n holdUntil\n collectedAt\n expiredAt\n releaseBlocked\n createdAt\n }\n }\n";
104
+ export declare function createPickupsModule(transport: Transport): PickupsModule;