@sixtyninecommerce/admin 0.8.0 → 0.10.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.
- package/README.md +2739 -17
- package/dist/api-tokens/index.d.ts +15 -5
- package/dist/api-tokens/index.js +1 -0
- package/dist/apps/event-subscription.d.ts +59 -0
- package/dist/apps/event-subscription.js +32 -0
- package/dist/apps/hook-secret.d.ts +22 -0
- package/dist/apps/hook-secret.js +36 -0
- package/dist/apps/index.d.ts +54 -3
- package/dist/apps/index.js +17 -0
- package/dist/audit/index.d.ts +7 -0
- package/dist/auth/queries.d.ts +5 -1
- package/dist/auth/queries.js +6 -0
- package/dist/bulk/index.d.ts +323 -0
- package/dist/bulk/index.js +162 -0
- package/dist/catalog/assets.d.ts +147 -0
- package/dist/catalog/assets.js +164 -0
- package/dist/catalog/collections.d.ts +109 -0
- package/dist/catalog/collections.js +91 -0
- package/dist/catalog/facets.d.ts +103 -0
- package/dist/catalog/facets.js +100 -0
- package/dist/catalog/index.d.ts +115 -0
- package/dist/catalog/index.js +21 -0
- package/dist/catalog/options.d.ts +89 -0
- package/dist/catalog/options.js +88 -0
- package/dist/catalog/products-bulk.d.ts +21 -0
- package/dist/catalog/products-bulk.js +58 -0
- package/dist/catalog/products.d.ts +650 -0
- package/dist/catalog/products.js +458 -0
- package/dist/catalog/properties.d.ts +234 -0
- package/dist/catalog/properties.js +158 -0
- package/dist/catalog/types.d.ts +174 -0
- package/dist/catalog/types.js +141 -0
- package/dist/catalog/variants.d.ts +324 -0
- package/dist/catalog/variants.js +288 -0
- package/dist/catalog/visibility.d.ts +57 -0
- package/dist/catalog/visibility.js +59 -0
- package/dist/client.d.ts +192 -3
- package/dist/client.js +87 -12
- package/dist/compliance/index.d.ts +88 -0
- package/dist/compliance/index.js +88 -0
- package/dist/customer-data-redaction.d.ts +14 -0
- package/dist/customer-data-redaction.js +22 -0
- package/dist/customers/index.d.ts +428 -17
- package/dist/customers/index.js +322 -15
- package/dist/documents/index.d.ts +513 -16
- package/dist/documents/index.js +229 -3
- package/dist/events/index.d.ts +259 -0
- package/dist/events/index.js +147 -0
- package/dist/feeds/ai.d.ts +46 -0
- package/dist/feeds/ai.js +43 -0
- package/dist/feeds/categories.d.ts +50 -0
- package/dist/feeds/categories.js +56 -0
- package/dist/feeds/configs.d.ts +54 -0
- package/dist/feeds/configs.js +85 -0
- package/dist/feeds/identifier-fields.d.ts +25 -0
- package/dist/feeds/identifier-fields.js +29 -0
- package/dist/feeds/index.d.ts +54 -0
- package/dist/feeds/index.js +46 -0
- package/dist/feeds/preserve.d.ts +38 -0
- package/dist/feeds/preserve.js +74 -0
- package/dist/feeds/rules.d.ts +42 -0
- package/dist/feeds/rules.js +56 -0
- package/dist/feeds/types.d.ts +654 -0
- package/dist/feeds/types.js +135 -0
- package/dist/fulfillments/index.d.ts +437 -0
- package/dist/fulfillments/index.js +534 -0
- package/dist/heads/index.d.ts +60 -0
- package/dist/heads/index.js +45 -0
- package/dist/hooks/assignments.d.ts +90 -0
- package/dist/hooks/assignments.js +53 -0
- package/dist/hooks/index.d.ts +97 -0
- package/dist/hooks/index.js +76 -0
- package/dist/index.d.ts +95 -9
- package/dist/index.js +21 -1
- package/dist/integrations/index.d.ts +14 -0
- package/dist/integrations/index.js +9 -0
- package/dist/integrations/pipelines.d.ts +113 -0
- package/dist/integrations/pipelines.js +62 -0
- package/dist/integrations/types.d.ts +176 -0
- package/dist/integrations/types.js +8 -0
- package/dist/jobs/bulk-action-run.d.ts +74 -0
- package/dist/jobs/bulk-action-run.js +69 -0
- package/dist/locations/index.d.ts +6 -2
- package/dist/meta/index.d.ts +32 -0
- package/dist/orders/bulk.d.ts +75 -0
- package/dist/orders/bulk.js +150 -0
- package/dist/orders/commit-edit.d.ts +123 -0
- package/dist/orders/commit-edit.js +142 -0
- package/dist/orders/deposit-policy.d.ts +103 -0
- package/dist/orders/deposit-policy.js +202 -0
- package/dist/orders/get.d.ts +722 -0
- package/dist/orders/get.js +530 -0
- package/dist/orders/index.d.ts +186 -21
- package/dist/orders/index.js +57 -0
- package/dist/orders/line-price-preview.d.ts +297 -0
- package/dist/orders/line-price-preview.js +50 -0
- package/dist/orders/manual-discounts.d.ts +141 -0
- package/dist/orders/manual-discounts.js +97 -0
- package/dist/orders/manual-pricing.d.ts +192 -0
- package/dist/orders/manual-pricing.js +72 -0
- package/dist/orders/order-entry.d.ts +566 -0
- package/dist/orders/order-entry.js +129 -0
- package/dist/orders/parcel-charge.d.ts +45 -0
- package/dist/orders/parcel-charge.js +55 -0
- package/dist/orders/plan-edit.d.ts +489 -0
- package/dist/orders/plan-edit.js +93 -0
- package/dist/orders/status.d.ts +235 -0
- package/dist/orders/status.js +96 -0
- package/dist/orders/surcharges.d.ts +75 -2
- package/dist/orders/surcharges.js +110 -4
- package/dist/payments/account-credit.d.ts +171 -0
- package/dist/payments/account-credit.js +107 -0
- package/dist/payments/index.d.ts +241 -9
- package/dist/payments/index.js +92 -0
- package/dist/payments/methods.d.ts +37 -0
- package/dist/payments/methods.js +33 -0
- package/dist/platform/catalog.d.ts +148 -0
- package/dist/platform/catalog.js +74 -0
- package/dist/platform/entitlements.d.ts +111 -0
- package/dist/platform/entitlements.js +86 -0
- package/dist/platform/legal-entities.d.ts +139 -0
- package/dist/platform/legal-entities.js +126 -0
- package/dist/platform/legal-entity-numbering.d.ts +103 -0
- package/dist/platform/legal-entity-numbering.js +101 -0
- package/dist/platform/organization-membership.d.ts +80 -0
- package/dist/platform/organization-membership.js +71 -0
- package/dist/platform/organization-settings.d.ts +33 -0
- package/dist/platform/organization-settings.js +42 -0
- package/dist/platform/organization-sharing.d.ts +172 -0
- package/dist/platform/organization-sharing.js +120 -0
- package/dist/platform/organizations.d.ts +205 -0
- package/dist/platform/organizations.js +180 -0
- package/dist/platform/provision-store.d.ts +88 -8
- package/dist/platform/provision-store.js +12 -0
- package/dist/platform/reports.d.ts +46 -0
- package/dist/platform/reports.js +31 -0
- package/dist/platform/server-metrics.d.ts +58 -0
- package/dist/platform/server-metrics.js +11 -0
- package/dist/pos/index.d.ts +567 -0
- package/dist/pos/index.js +205 -0
- package/dist/pricing/index.d.ts +408 -0
- package/dist/pricing/index.js +353 -0
- package/dist/pricing/vouchers.d.ts +103 -0
- package/dist/pricing/vouchers.js +69 -0
- package/dist/provenance/index.d.ts +93 -0
- package/dist/provenance/index.js +53 -0
- package/dist/reports/index.d.ts +199 -0
- package/dist/reports/index.js +154 -0
- package/dist/returns/index.d.ts +225 -0
- package/dist/returns/index.js +160 -0
- package/dist/search/index.d.ts +99 -0
- package/dist/search/index.js +62 -0
- package/dist/shipping/parcel-count-suggestion.d.ts +52 -0
- package/dist/shipping/parcel-count-suggestion.js +73 -0
- package/dist/shipping/parcel-rule.d.ts +48 -0
- package/dist/shipping/parcel-rule.js +91 -0
- package/dist/stock/index.d.ts +166 -0
- package/dist/stock/index.js +115 -0
- package/dist/stock/transfers.d.ts +520 -0
- package/dist/stock/transfers.js +437 -0
- package/dist/stored-value/index.d.ts +154 -0
- package/dist/stored-value/index.js +130 -0
- package/dist/tenant/capabilities.d.ts +10 -0
- package/dist/tenant/entitlements.d.ts +35 -0
- package/dist/tenant/entitlements.js +15 -0
- package/dist/tenant/field-groups.d.ts +64 -0
- package/dist/tenant/field-groups.js +34 -0
- package/dist/tenant/legal-entity.d.ts +32 -0
- package/dist/tenant/legal-entity.js +41 -0
- package/dist/tenant/notifications.d.ts +148 -0
- package/dist/tenant/notifications.js +79 -0
- package/dist/tenant/retention.d.ts +10 -4
- package/dist/tenant/settings-sources.d.ts +103 -0
- package/dist/tenant/settings-sources.js +92 -0
- package/dist/types.d.ts +86 -11
- package/dist/uploads/index.d.ts +11 -7
- package/dist/users/index.d.ts +104 -0
- package/dist/users/index.js +80 -0
- package/package.json +3 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Page, type Transport } from '@sixtyninecommerce/core';
|
|
2
|
-
import type { Call } from '../types.js';
|
|
2
|
+
import type { Call, ListOptions } from '../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Which document a call is about. The platform issues three, and every method
|
|
5
5
|
* here that takes a type takes one of these.
|
|
@@ -13,14 +13,30 @@ export interface Invoice {
|
|
|
13
13
|
invoicedOn: string;
|
|
14
14
|
orderId: string;
|
|
15
15
|
languageCode: string;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated An object-storage key, not a link: documents are stored
|
|
18
|
+
* privately and no URL can be built from it. Use {@link DocumentsModule.downloadUrl}.
|
|
19
|
+
*/
|
|
16
20
|
storageKey: string;
|
|
17
21
|
totalWithTax: number;
|
|
18
22
|
currencyCode: string;
|
|
19
23
|
note: string | null;
|
|
20
24
|
/** Set once a void & reissue reversed it; null while the invoice is live. */
|
|
21
25
|
voidedOn: string | null;
|
|
26
|
+
/** The credit note that reversed it when it was voided; null while it is live. */
|
|
27
|
+
reversedByCreditNoteId: string | null;
|
|
28
|
+
/** The corrected invoice that replaces it (a reissue or a re-bill); null otherwise. */
|
|
29
|
+
supersededByInvoiceId: string | null;
|
|
30
|
+
/** On a replacement: the voided invoice it reissues; null otherwise. */
|
|
31
|
+
reissueOfInvoiceId: string | null;
|
|
22
32
|
/** `standard` for the order's invoice, `supplementary` for an under-charge billed on top. */
|
|
23
33
|
kind: string;
|
|
34
|
+
/** On a supplementary invoice: the live invoice it adds to; null otherwise. */
|
|
35
|
+
supplementsInvoiceId: string | null;
|
|
36
|
+
/** What it billed, frozen when it was issued; null on a standard invoice derived from the order. */
|
|
37
|
+
lines: DocumentLine[] | null;
|
|
38
|
+
/** Who numbered it: `platform`, or an ERP's code (`afas`). */
|
|
39
|
+
numberingProvider: string;
|
|
24
40
|
createdAt: string;
|
|
25
41
|
}
|
|
26
42
|
/** An issued credit note. `totalWithTax` is the POSITIVE value of the credit. */
|
|
@@ -34,7 +50,21 @@ export interface CreditNote {
|
|
|
34
50
|
invoiceId: string;
|
|
35
51
|
/** `correction` | `cancellation` | `return` | `adjustment`. */
|
|
36
52
|
kind: string;
|
|
37
|
-
/**
|
|
53
|
+
/** On a full reversal: the invoice it voids (`correction`, `cancellation`); null otherwise. */
|
|
54
|
+
reversalOfInvoiceId: string | null;
|
|
55
|
+
/** On a return's credit note: the return it settles; null otherwise. */
|
|
56
|
+
returnId: string | null;
|
|
57
|
+
/** What it credited, frozen when it was issued; null on a lump-sum credit note. */
|
|
58
|
+
lines: DocumentLine[] | null;
|
|
59
|
+
/** The refund that paid it back, when one did; null otherwise. */
|
|
60
|
+
refundId: string | null;
|
|
61
|
+
/** Who numbered it: `platform`, or an ERP's code (`afas`). */
|
|
62
|
+
numberingProvider: string;
|
|
63
|
+
/**
|
|
64
|
+
* Null until the PDF has been rendered and stored.
|
|
65
|
+
* @deprecated An object-storage key, not a link: documents are stored
|
|
66
|
+
* privately and no URL can be built from it. Use {@link DocumentsModule.downloadUrl}.
|
|
67
|
+
*/
|
|
38
68
|
storageKey: string | null;
|
|
39
69
|
createdAt: string;
|
|
40
70
|
}
|
|
@@ -43,9 +73,28 @@ export interface PackingSlip {
|
|
|
43
73
|
packingSlipNumber: string;
|
|
44
74
|
fulfillmentId: string;
|
|
45
75
|
languageCode: string;
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated An object-storage key, not a link: documents are stored
|
|
78
|
+
* privately and no URL can be built from it. Use {@link DocumentsModule.downloadUrl}.
|
|
79
|
+
*/
|
|
46
80
|
storageKey: string;
|
|
47
81
|
createdAt: string;
|
|
48
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* A short-lived link to one stored document PDF, from {@link DocumentsModule.downloadUrl}.
|
|
85
|
+
*/
|
|
86
|
+
export interface DocumentDownloadUrl {
|
|
87
|
+
/**
|
|
88
|
+
* A signed GET on private storage. A BEARER link: anyone holding it can
|
|
89
|
+
* fetch the PDF until {@link expiresAt}. Open it right away; never store it,
|
|
90
|
+
* log it or send it on.
|
|
91
|
+
*/
|
|
92
|
+
url: string;
|
|
93
|
+
/** When the link stops working — five minutes after it was minted. ISO-8601, UTC. */
|
|
94
|
+
expiresAt: string;
|
|
95
|
+
/** The PDF's file name, from the document number. */
|
|
96
|
+
filename: string;
|
|
97
|
+
}
|
|
49
98
|
/**
|
|
50
99
|
* One block as supplied at generation time.
|
|
51
100
|
*
|
|
@@ -164,17 +213,28 @@ export interface DocumentDataTotals {
|
|
|
164
213
|
totalWithTax: number;
|
|
165
214
|
}
|
|
166
215
|
/**
|
|
167
|
-
* Where a document's number came from.
|
|
216
|
+
* Where a document's number came from. Numbering itself stays platform-owned:
|
|
217
|
+
* there is no SDK method that allocates or reserves a number.
|
|
168
218
|
*
|
|
169
|
-
* `
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
219
|
+
* - `legal_entity`: an invoice or credit note numbered in its legal entity's
|
|
220
|
+
* series, which every store of that entity shares; `scopeId` is the entity
|
|
221
|
+
* (its Seller id) as frozen when the document was issued. The number is
|
|
222
|
+
* unique across the entity's stores.
|
|
223
|
+
* - `channel`: a store that numbers on its own (no legal entity, or a sandbox),
|
|
224
|
+
* every packing slip, and anything a server that predates legal-entity
|
|
225
|
+
* numbering reports; `scopeId` is the channel id.
|
|
226
|
+
*
|
|
227
|
+
* Handle a value you do not know as `channel`-like: the union may grow.
|
|
174
228
|
*/
|
|
175
229
|
export interface DocumentDataNumbering {
|
|
176
|
-
scope: 'channel';
|
|
230
|
+
scope: 'channel' | 'legal_entity';
|
|
177
231
|
scopeId: string;
|
|
232
|
+
/**
|
|
233
|
+
* Which invoicing provider assigned {@link number}: `platform`, or an ERP such
|
|
234
|
+
* as `afas` whose number the document carries verbatim. Absent from servers
|
|
235
|
+
* that predate invoicing providers — read that as `platform`.
|
|
236
|
+
*/
|
|
237
|
+
provider?: string;
|
|
178
238
|
/** The configured prefix of the series, when the store set one. */
|
|
179
239
|
series: string | null;
|
|
180
240
|
number: string;
|
|
@@ -200,7 +260,11 @@ export interface DocumentDataIssuer {
|
|
|
200
260
|
province?: string;
|
|
201
261
|
country?: string;
|
|
202
262
|
};
|
|
263
|
+
/** The legal entity's legal name; the {@link name} is its trading name. Absent on older engines. */
|
|
264
|
+
legalName?: string;
|
|
203
265
|
vatNumber?: string;
|
|
266
|
+
/** The UK VAT number, when the legal entity has one. Absent on older engines. */
|
|
267
|
+
vatNumberUk?: string;
|
|
204
268
|
registrationNumber?: string;
|
|
205
269
|
}
|
|
206
270
|
/**
|
|
@@ -271,6 +335,250 @@ export interface DocumentData {
|
|
|
271
335
|
orderCodes: string[];
|
|
272
336
|
};
|
|
273
337
|
}
|
|
338
|
+
/** Which book an invoice is in: the store's own invoices, or the accounts-receivable ledger. */
|
|
339
|
+
export type InvoiceCorrectionLedger = 'RETAIL' | 'AR';
|
|
340
|
+
/** What is wrong with an issued invoice. One outcome is one operation. */
|
|
341
|
+
export type InvoiceCorrectionOutcome =
|
|
342
|
+
/** We charged too much and the customer keeps the goods: a partial credit note. */
|
|
343
|
+
'OVER_CHARGE'
|
|
344
|
+
/** The details are wrong, the sale is fine: a full credit note and a corrected invoice. */
|
|
345
|
+
| 'DETAILS_WRONG'
|
|
346
|
+
/** The invoice should not exist: a full credit note, the invoice voided. */
|
|
347
|
+
| 'SHOULD_NOT_EXIST'
|
|
348
|
+
/** We charged too little: a supplementary invoice; both stay owed. */
|
|
349
|
+
| 'UNDER_CHARGE';
|
|
350
|
+
/** The billing or shipping fields a details correction changes; a field left out keeps its value. */
|
|
351
|
+
export interface InvoiceAddressCorrection {
|
|
352
|
+
fullName?: string;
|
|
353
|
+
company?: string;
|
|
354
|
+
streetLine1?: string;
|
|
355
|
+
streetLine2?: string;
|
|
356
|
+
city?: string;
|
|
357
|
+
province?: string;
|
|
358
|
+
postalCode?: string;
|
|
359
|
+
countryCode?: string;
|
|
360
|
+
country?: string;
|
|
361
|
+
phoneNumber?: string;
|
|
362
|
+
}
|
|
363
|
+
/** What {@link DocumentsModule.planCorrection} is asked. */
|
|
364
|
+
export interface InvoiceCorrectionInput {
|
|
365
|
+
ledger: InvoiceCorrectionLedger;
|
|
366
|
+
/** A store invoice's id (`RETAIL`) or an AR invoice's (`AR`). */
|
|
367
|
+
invoiceId: string;
|
|
368
|
+
/** Omitted: only which outcomes are available and the lines a correction starts from. */
|
|
369
|
+
outcome?: InvoiceCorrectionOutcome;
|
|
370
|
+
/** Printed on a credit note (required there); the note of a supplementary invoice. At most 500. */
|
|
371
|
+
reason?: string;
|
|
372
|
+
/**
|
|
373
|
+
* The lines, in the basis `prefill.basis` states. Omitted: the prefill for an outcome that
|
|
374
|
+
* starts from it, none for an under-charge. At most 200. A `prefill.lines` row is sent back as
|
|
375
|
+
* it came (its `sku` and `orderLineId` may be null).
|
|
376
|
+
*/
|
|
377
|
+
lines?: Array<DocumentLineInput | InvoiceCorrectionLine>;
|
|
378
|
+
/** Details wrong only. */
|
|
379
|
+
billingAddress?: InvoiceAddressCorrection;
|
|
380
|
+
/** Details wrong only. */
|
|
381
|
+
shippingAddress?: InvoiceAddressCorrection;
|
|
382
|
+
/** RETAIL only: refund the credited amount to this payment (one of `refund.options`). */
|
|
383
|
+
refundPaymentId?: string;
|
|
384
|
+
/** RETAIL only: move the credited amount to the customer's account instead (`accountCredit`). */
|
|
385
|
+
creditToAccount?: boolean;
|
|
386
|
+
}
|
|
387
|
+
/** One line a correction states, every key present. */
|
|
388
|
+
export interface InvoiceCorrectionLine {
|
|
389
|
+
description: string;
|
|
390
|
+
sku: string | null;
|
|
391
|
+
orderLineId: string | null;
|
|
392
|
+
quantity: number;
|
|
393
|
+
unitPrice: number;
|
|
394
|
+
unitPriceBasis: 'net' | 'gross';
|
|
395
|
+
taxRate: number;
|
|
396
|
+
}
|
|
397
|
+
/** One line of a document, as it would be frozen. Money in minor units. */
|
|
398
|
+
export interface DocumentLine {
|
|
399
|
+
description: string;
|
|
400
|
+
/** Empty for a free-form row. */
|
|
401
|
+
sku: string;
|
|
402
|
+
orderLineId: string | null;
|
|
403
|
+
quantity: number;
|
|
404
|
+
/** Display only on a gross-entered line. */
|
|
405
|
+
unitPriceNet: number;
|
|
406
|
+
/** Display only on a net-entered line. */
|
|
407
|
+
unitPriceWithTax: number;
|
|
408
|
+
taxRate: number;
|
|
409
|
+
lineTotalNet: number;
|
|
410
|
+
lineTotalWithTax: number;
|
|
411
|
+
unitPriceBasis: 'net' | 'gross';
|
|
412
|
+
}
|
|
413
|
+
/** Totals of a planned document, or of the lines being typed. */
|
|
414
|
+
export interface InvoiceCorrectionTotals {
|
|
415
|
+
/** Null when the document states its gross only (a reversal whose split cannot be derived). */
|
|
416
|
+
net: number | null;
|
|
417
|
+
tax: number | null;
|
|
418
|
+
gross: number;
|
|
419
|
+
taxSummary: Array<{
|
|
420
|
+
taxRate: number;
|
|
421
|
+
net: number;
|
|
422
|
+
tax: number;
|
|
423
|
+
gross: number;
|
|
424
|
+
}>;
|
|
425
|
+
}
|
|
426
|
+
/** A document a correction would issue. It carries no number: a plan never draws one. */
|
|
427
|
+
export interface InvoiceCorrectionDocument {
|
|
428
|
+
type: 'INVOICE' | 'CREDIT_NOTE';
|
|
429
|
+
/** `adjustment`, `correction`, `cancellation`, `standard` or `supplementary`. */
|
|
430
|
+
kind: string;
|
|
431
|
+
/** The date it would state: today in the store's numbering zone. */
|
|
432
|
+
documentDate: string;
|
|
433
|
+
currencyCode: string;
|
|
434
|
+
/** Null when it states a lump sum, or bills the order. */
|
|
435
|
+
lines: DocumentLine[] | null;
|
|
436
|
+
totals: InvoiceCorrectionTotals;
|
|
437
|
+
/** The issuer it would freeze, in `documentData`'s issuer shape. */
|
|
438
|
+
issuer: unknown;
|
|
439
|
+
numbering: {
|
|
440
|
+
/** Who would number it: `platform`, or an ERP's code (`afas`). */
|
|
441
|
+
provider: string;
|
|
442
|
+
providerLabel: string;
|
|
443
|
+
/**
|
|
444
|
+
* Booked in a system outside the platform: once issued, the document is corrected THERE,
|
|
445
|
+
* never undone from the platform.
|
|
446
|
+
*/
|
|
447
|
+
external: boolean;
|
|
448
|
+
/** It could be numbered now; when not, a blocker carries the provider's refusal. */
|
|
449
|
+
ready: boolean;
|
|
450
|
+
legalEntityId: string | null;
|
|
451
|
+
testStore: boolean;
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
/** What {@link DocumentsModule.planCorrection} answers. Money in minor units. */
|
|
455
|
+
export interface InvoiceCorrectionPlan {
|
|
456
|
+
/** Names this plan; it moves when the invoice, its order, the payments or the input move. */
|
|
457
|
+
planHash: string;
|
|
458
|
+
ledger: InvoiceCorrectionLedger;
|
|
459
|
+
invoice: {
|
|
460
|
+
id: string;
|
|
461
|
+
invoiceNumber: string;
|
|
462
|
+
kind: string;
|
|
463
|
+
totalWithTax: number;
|
|
464
|
+
/** What may still be credited against it. */
|
|
465
|
+
creditable: number;
|
|
466
|
+
currencyCode: string;
|
|
467
|
+
orderIds: string[];
|
|
468
|
+
voidedOn: string | null;
|
|
469
|
+
};
|
|
470
|
+
/** The four outcomes, in the order a wizard asks them. */
|
|
471
|
+
outcomes: Array<{
|
|
472
|
+
outcome: InvoiceCorrectionOutcome;
|
|
473
|
+
available: boolean;
|
|
474
|
+
/** The first reason it is not, as the operation would refuse it. */
|
|
475
|
+
unavailableCode: string | null;
|
|
476
|
+
unavailableMessage: string | null;
|
|
477
|
+
document: 'CREDIT_NOTE' | 'CREDIT_NOTE_AND_INVOICE' | 'INVOICE';
|
|
478
|
+
needsLines: boolean;
|
|
479
|
+
prefillsLines: boolean;
|
|
480
|
+
needsAddresses: boolean;
|
|
481
|
+
allowsRefund: boolean;
|
|
482
|
+
allowsNote: boolean;
|
|
483
|
+
}>;
|
|
484
|
+
/** The lines a correction starts from. `differs`: they do not add up to the invoice. */
|
|
485
|
+
prefill: {
|
|
486
|
+
source: 'snapshot' | 'order' | 'none';
|
|
487
|
+
basis: 'net' | 'gross';
|
|
488
|
+
lines: InvoiceCorrectionLine[];
|
|
489
|
+
seededGross: number;
|
|
490
|
+
billedGross: number;
|
|
491
|
+
differs: boolean;
|
|
492
|
+
};
|
|
493
|
+
outcome: InvoiceCorrectionOutcome | null;
|
|
494
|
+
operation: 'ISSUE_PARTIAL_CREDIT_NOTE' | 'VOID_AND_REBILL' | 'VOID_AND_REISSUE' | 'VOID' | 'ISSUE_SUPPLEMENTARY' | null;
|
|
495
|
+
/** The running total of the lines the input states: the issue's own figure. */
|
|
496
|
+
lineTotals: InvoiceCorrectionTotals;
|
|
497
|
+
documents: InvoiceCorrectionDocument[];
|
|
498
|
+
/** Null when the outcome gives nothing back. */
|
|
499
|
+
refund: {
|
|
500
|
+
amount: number;
|
|
501
|
+
available: boolean;
|
|
502
|
+
unavailableCode: string | null;
|
|
503
|
+
unavailableMessage: string | null;
|
|
504
|
+
/** The payments a refund can go to now, newest first (the order's refund position). */
|
|
505
|
+
options: Array<{
|
|
506
|
+
paymentId: string;
|
|
507
|
+
method: string | null;
|
|
508
|
+
amount: number;
|
|
509
|
+
refundable: number;
|
|
510
|
+
}>;
|
|
511
|
+
recommendedPaymentId: string | null;
|
|
512
|
+
} | null;
|
|
513
|
+
/** Null where the plan offers no choice (the AR ledger, an outcome that gives nothing back). */
|
|
514
|
+
accountCredit: {
|
|
515
|
+
available: boolean;
|
|
516
|
+
unavailableCode: string | null;
|
|
517
|
+
message: string | null;
|
|
518
|
+
} | null;
|
|
519
|
+
settlement: 'NONE' | 'REFUND' | 'ACCOUNT_CREDIT';
|
|
520
|
+
/** Everything that stops this correction. Empty: it can be committed. */
|
|
521
|
+
blockers: Array<{
|
|
522
|
+
code: string;
|
|
523
|
+
message: string;
|
|
524
|
+
path: string | null;
|
|
525
|
+
}>;
|
|
526
|
+
}
|
|
527
|
+
/** A document {@link DocumentsModule.commitCorrection} issued, on either ledger. */
|
|
528
|
+
export interface InvoiceCorrectionCommittedDocument {
|
|
529
|
+
/** `RETAIL`: an {@link Invoice} or {@link CreditNote} of the order; `AR`: the AR ledger's. */
|
|
530
|
+
ledger: InvoiceCorrectionLedger;
|
|
531
|
+
type: 'INVOICE' | 'CREDIT_NOTE';
|
|
532
|
+
id: string;
|
|
533
|
+
/** Its number, as printed. */
|
|
534
|
+
number: string;
|
|
535
|
+
/** `adjustment`, `correction`, `cancellation`, `standard` or `supplementary`. */
|
|
536
|
+
kind: string;
|
|
537
|
+
/** Minor units; a credit note's is the positive value of the credit. */
|
|
538
|
+
totalWithTax: number;
|
|
539
|
+
currencyCode: string;
|
|
540
|
+
/** The date it states, `YYYY-MM-DD`. */
|
|
541
|
+
issuedOn: string;
|
|
542
|
+
/** Who numbered it: `platform`, or an ERP's code (booked there, corrected there). */
|
|
543
|
+
numberingProvider: string;
|
|
544
|
+
}
|
|
545
|
+
/** What {@link DocumentsModule.commitCorrection} carried out. Money in minor units. */
|
|
546
|
+
export interface InvoiceCorrectionCommit {
|
|
547
|
+
/**
|
|
548
|
+
* The plan that was carried out, as {@link DocumentsModule.planCorrection} answered it. A repeat
|
|
549
|
+
* under the same `idempotencyKey` answers the plan as it was, and the documents and refund as
|
|
550
|
+
* they are now.
|
|
551
|
+
*/
|
|
552
|
+
plan: InvoiceCorrectionPlan;
|
|
553
|
+
/** What was issued, in issuing order (a reversal before its replacement). */
|
|
554
|
+
documents: InvoiceCorrectionCommittedDocument[];
|
|
555
|
+
/** The refund it made (`refundPaymentId`); null otherwise. */
|
|
556
|
+
refund: {
|
|
557
|
+
id: string;
|
|
558
|
+
/** `Pending` until a gateway confirms it, `Settled` for money returned by hand. */
|
|
559
|
+
state: string;
|
|
560
|
+
total: number;
|
|
561
|
+
paymentId: string;
|
|
562
|
+
} | null;
|
|
563
|
+
/** The account credit it made (`creditToAccount`); null otherwise. */
|
|
564
|
+
accountCredit: {
|
|
565
|
+
amount: number;
|
|
566
|
+
currencyCode: string;
|
|
567
|
+
/** The receipts on the customer's account, one per payment the money came from. */
|
|
568
|
+
unappliedCashIds: string[];
|
|
569
|
+
} | null;
|
|
570
|
+
}
|
|
571
|
+
export interface CommitInvoiceCorrectionCall extends Call {
|
|
572
|
+
/** The `planHash` of the plan the merchant saw ({@link DocumentsModule.planCorrection}). Required. */
|
|
573
|
+
expectedPlanHash: string;
|
|
574
|
+
/**
|
|
575
|
+
* One key per attempt to commit, re-sent unchanged on a retry of THAT attempt. Pass your own:
|
|
576
|
+
* left out, one is made up (a UUIDv7) and returned as `idempotencyKey` on the result, but on a
|
|
577
|
+
* thrown error only as an untyped own property of the error. Never reuse a key for another
|
|
578
|
+
* correction or a fresh attempt.
|
|
579
|
+
*/
|
|
580
|
+
idempotencyKey?: string;
|
|
581
|
+
}
|
|
274
582
|
/** What `generate` needs, per document type. */
|
|
275
583
|
export interface GenerateDocumentOptions extends Call {
|
|
276
584
|
/**
|
|
@@ -330,6 +638,40 @@ export interface SendInvoiceEmailInput {
|
|
|
330
638
|
recipientsTo: string[];
|
|
331
639
|
recipientsCc?: string[];
|
|
332
640
|
}
|
|
641
|
+
export interface SendCreditNoteEmailInput {
|
|
642
|
+
/** A credit note of this store (see {@link DocumentsModule.creditNotes}). */
|
|
643
|
+
creditNoteId: string;
|
|
644
|
+
/** At least one, at most 10. */
|
|
645
|
+
recipientsTo: string[];
|
|
646
|
+
/** At most 10; one already in `recipientsTo` is dropped. */
|
|
647
|
+
recipientsCc?: string[];
|
|
648
|
+
}
|
|
649
|
+
/** One "Email the credit note" send, as recorded once the email went out. */
|
|
650
|
+
export interface CreditNoteEmailSend {
|
|
651
|
+
id: string;
|
|
652
|
+
orderId: string;
|
|
653
|
+
creditNoteId: string;
|
|
654
|
+
/** Who it went to: a sandbox store's withheld customer is not listed. */
|
|
655
|
+
recipientsTo: string[];
|
|
656
|
+
recipientsCc: string[];
|
|
657
|
+
createdAt: string;
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* One of a customer's documents in this store, from {@link DocumentsModule.forCustomer}: a retail
|
|
661
|
+
* invoice or credit note, with the order it was issued for.
|
|
662
|
+
*/
|
|
663
|
+
export interface CustomerDocument {
|
|
664
|
+
/**
|
|
665
|
+
* `invoice` or `credit-note`; exactly one of {@link invoice} and {@link creditNote} is set, the
|
|
666
|
+
* one this names. Typed open, like the other document kinds here: a value this SDK does not know
|
|
667
|
+
* is passed through as the server spelled it.
|
|
668
|
+
*/
|
|
669
|
+
type: 'invoice' | 'credit-note' | (string & {});
|
|
670
|
+
invoice: Invoice | null;
|
|
671
|
+
creditNote: CreditNote | null;
|
|
672
|
+
orderId: string;
|
|
673
|
+
orderCode: string;
|
|
674
|
+
}
|
|
333
675
|
/** The store's extension-block registry. Reading needs `ReadSettings`, writing `UpdateSettings`. */
|
|
334
676
|
export interface DocumentExtensionsModule {
|
|
335
677
|
/**
|
|
@@ -396,10 +738,37 @@ export interface DocumentsModule {
|
|
|
396
738
|
generate(subjectId: string, type: 'packing-slip', options?: Omit<GenerateDocumentOptions, 'invoicedOn' | 'note'>): Promise<PackingSlip>;
|
|
397
739
|
/** The numbered facts a document was built from. Needs `ReadOrder`. */
|
|
398
740
|
data(documentId: string, type: DocumentType, options?: Call): Promise<DocumentData>;
|
|
741
|
+
/**
|
|
742
|
+
* A five-minute download link for one of this store's documents. Needs
|
|
743
|
+
* `ReadOrder`.
|
|
744
|
+
*
|
|
745
|
+
* Documents carry customer names and addresses and are stored privately:
|
|
746
|
+
* there is no permanent URL, and `storageKey` is not one. Mint a link when
|
|
747
|
+
* the user asks for the file and open it straight away — the link is a
|
|
748
|
+
* bearer capability until it expires, so never persist it. Each call is on
|
|
749
|
+
* the store's audit trail.
|
|
750
|
+
*
|
|
751
|
+
* `ENTITY_NOT_FOUND` (→ `NotFoundError`) for a document outside this store
|
|
752
|
+
* or of another type; `DOCUMENT_PDF_NOT_AVAILABLE` when no PDF is stored for
|
|
753
|
+
* it (a credit note whose render has not landed).
|
|
754
|
+
*/
|
|
755
|
+
downloadUrl(documentId: string, type: DocumentType, options?: Call): Promise<DocumentDownloadUrl>;
|
|
399
756
|
/** Every invoice of an order, including voided ones. */
|
|
400
757
|
invoices(orderId: string, options?: Call): Promise<Page<Invoice>>;
|
|
401
758
|
/** Every credit note of an order. */
|
|
402
759
|
creditNotes(orderId: string, options?: Call): Promise<Page<CreditNote>>;
|
|
760
|
+
/**
|
|
761
|
+
* The retail invoices and credit notes of a customer's orders in THIS store, newest first (the
|
|
762
|
+
* date each document states, then when it was issued). Voided invoices are listed, with
|
|
763
|
+
* `voidedOn` set; accounts-receivable documents are not. A customer row several stores hold
|
|
764
|
+
* answers only this store's documents. Needs `ReadOrder`.
|
|
765
|
+
*
|
|
766
|
+
* Paged: `limit` 1 to 100 (default 25), and `after` the previous page's cursor; the page says
|
|
767
|
+
* the `total`. `ENTITY_NOT_FOUND` (→ `NotFoundError`) for a customer this store does not hold;
|
|
768
|
+
* a `limit` outside 1 to 100 is refused `USER_INPUT_ERROR` (→ `ValidationError`). An engine
|
|
769
|
+
* older than this method fails the document's validation.
|
|
770
|
+
*/
|
|
771
|
+
forCustomer(customerId: string, options?: ListOptions): Promise<Page<CustomerDocument>>;
|
|
403
772
|
/**
|
|
404
773
|
* Render what an invoice WOULD look like, without numbering or storing one.
|
|
405
774
|
* Returns the PDF bytes (the wire carries base64; this decodes it).
|
|
@@ -411,21 +780,149 @@ export interface DocumentsModule {
|
|
|
411
780
|
} & Call): Promise<Uint8Array>;
|
|
412
781
|
/** Email an order's invoice. True when the dispatch was accepted. */
|
|
413
782
|
sendInvoiceEmail(input: SendInvoiceEmailInput, options?: Call): Promise<boolean>;
|
|
414
|
-
/**
|
|
783
|
+
/**
|
|
784
|
+
* Email one of this store's credit notes: the same email and PDF the
|
|
785
|
+
* customer gets when it is issued, to the recipients given, in the credited
|
|
786
|
+
* invoice's language. True once it went out; each send is recorded (see
|
|
787
|
+
* {@link creditNoteEmailSends}). Needs `UpdateOrder`.
|
|
788
|
+
*
|
|
789
|
+
* `ENTITY_NOT_FOUND` (→ `NotFoundError`) for a credit note outside this
|
|
790
|
+
* store; `CREDIT_NOTE_EMAIL_RECIPIENTS_INVALID` (→ `ValidationError`);
|
|
791
|
+
* `CREDIT_NOTE_PDF_NOT_AVAILABLE` (its PDF could not be rendered, nothing was
|
|
792
|
+
* sent), `CREDIT_NOTE_EMAIL_UNAVAILABLE` and `CREDIT_NOTE_EMAIL_SEND_FAILED`
|
|
793
|
+
* (the email provider's code when it gave one; its reason is in the email deliveries log) (→ `BusinessRuleError`).
|
|
794
|
+
*/
|
|
795
|
+
sendCreditNoteEmail(input: SendCreditNoteEmailInput, options?: Call): Promise<boolean>;
|
|
796
|
+
/** Every "Email the credit note" send of an order, newest first. Needs `ReadOrder`. */
|
|
797
|
+
creditNoteEmailSends(orderId: string, options?: Call): Promise<Page<CreditNoteEmailSend>>;
|
|
798
|
+
/**
|
|
799
|
+
* Credit PART of a still-valid invoice; the invoice keeps standing.
|
|
800
|
+
*
|
|
801
|
+
* With `refundPaymentId`, the credited amount is refunded first and the
|
|
802
|
+
* document follows. **`IDEMPOTENCY_OUTCOME_UNKNOWN` is neither success nor
|
|
803
|
+
* refusal**, exactly as on `payments.refund`: the refund reached the payment
|
|
804
|
+
* provider and was never confirmed, so the money may be on its way back. No
|
|
805
|
+
* credit note was issued, and the platform will not ask for that refund
|
|
806
|
+
* again — a retry with the same payment and amount answers the same code. Do
|
|
807
|
+
* NOT treat it as a refusal: reconcile the payment with the provider first.
|
|
808
|
+
* If the refund was made, issue the credit note without `refundPaymentId`;
|
|
809
|
+
* if it was not, refund the payment separately, then issue it without one.
|
|
810
|
+
* The GraphQL error carries the handles in `extensions.movement`
|
|
811
|
+
* (`refundId`, `paymentId`, `providerTransactionId`), which `PlatformError`
|
|
812
|
+
* does not surface — read them off the order's payments.
|
|
813
|
+
*
|
|
814
|
+
* **Coded refusals** (nothing is refunded or issued): `INVOICE_NOT_FOUND` and
|
|
815
|
+
* `INVOICE_PAYMENT_NOT_FOUND` (→ `NotFoundError`); `ORDER_NOT_INVOICED`,
|
|
816
|
+
* `INVOICE_ORDER_MISMATCH`, `INVOICE_ALREADY_VOIDED`,
|
|
817
|
+
* `INVOICE_CREDIT_EXCEEDS_INVOICE`, `REFUND_TARGET_NOT_REFUNDABLE`,
|
|
818
|
+
* `REFUND_WOULD_DOUBLE_CREDIT`, `REFUND_PAYMENT_UNCOLLECTED`,
|
|
819
|
+
* `REFUND_ORPHAN_EXISTS` (a refund on ANY payment of the order that no credit note names:
|
|
820
|
+
* issue the credit note without `refundPaymentId`) and `REFUND_EXCEEDS_PAYMENT`
|
|
821
|
+
* (→ `BusinessRuleError`).
|
|
822
|
+
* An engine before these codes answered each one as `USER_INPUT_ERROR`
|
|
823
|
+
* (`ValidationError`) with the same sentence. Field-shape refusals (an empty
|
|
824
|
+
* reason, an invalid line) stay `USER_INPUT_ERROR`.
|
|
825
|
+
*/
|
|
415
826
|
issuePartialCreditNote(input: IssuePartialCreditNoteInput, options?: Call): Promise<CreditNote>;
|
|
416
|
-
/**
|
|
827
|
+
/**
|
|
828
|
+
* What a correction of an issued invoice would issue, give back and refuse, before anything
|
|
829
|
+
* is written. Without an `outcome` it answers which outcomes the invoice can take and the
|
|
830
|
+
* lines a correction starts from (a wizard's first step); with one, the operation, every
|
|
831
|
+
* `blocker`, the documents (date, lines, totals, tax split, issuer, who would number them) and
|
|
832
|
+
* the refund and account-credit options.
|
|
833
|
+
*
|
|
834
|
+
* **It writes nothing and never shows or reserves a number.** A credit note follows its
|
|
835
|
+
* invoice's provider: on an ERP-numbered store (`documents[].numbering.external`), committing
|
|
836
|
+
* the correction BOOKS the documents in the ERP, and that cannot be undone from the platform.
|
|
837
|
+
* Refund options are the order's refund position (`payments.refundPosition`). While a refund
|
|
838
|
+
* of the order stands that no credit note names, on any payment, the money went back once
|
|
839
|
+
* already: `refund` and `accountCredit` are unavailable with `REFUND_ORPHAN_EXISTS` (a blocker
|
|
840
|
+
* when either is asked for), and the correction can still be issued on its own. `planHash`
|
|
841
|
+
* changes when the invoice, its order, the payments, the numbering or the input change.
|
|
842
|
+
*
|
|
843
|
+
* What would stop the correction is a `blocker`, not an error: `INVOICE_CORRECTION_*`, the
|
|
844
|
+
* issuing door's own codes (`INVOICE_HAS_PARTIAL_CREDITS`, `REFUND_EXCEEDS_PAYMENT`, …) and
|
|
845
|
+
* the numbering provider's (`INVOICING_PROVIDER_NOT_READY`, …). Refusals of the call:
|
|
846
|
+
* `INVOICE_CORRECTION_INVOICE_NOT_FOUND` (→ `NotFoundError`; another store's invoice too),
|
|
847
|
+
* `INVALID_INVOICE_CORRECTION_INPUT` (→ `ValidationError`, `details[].field` names the field)
|
|
848
|
+
* and `INVOICE_CORRECTION_LEDGER_NOT_ALLOWED` (→ `PermissionDeniedError`: AR on a store
|
|
849
|
+
* without the AR ledger). Needs `UpdateOrder`. An engine older than this method fails the
|
|
850
|
+
* document's validation.
|
|
851
|
+
*/
|
|
852
|
+
planCorrection(input: InvoiceCorrectionInput, options?: Call): Promise<InvoiceCorrectionPlan>;
|
|
853
|
+
/**
|
|
854
|
+
* Carry out a correction as its plan ({@link planCorrection}) states it, once: the documents it
|
|
855
|
+
* previewed, and the refund or the account credit it settled on. Needs `UpdateOrder`, and an
|
|
856
|
+
* engine that serves `commitInvoiceCorrection`.
|
|
857
|
+
*
|
|
858
|
+
* Hand it the SAME `input` you planned and the plan's `planHash` as `expectedPlanHash`. The
|
|
859
|
+
* engine plans again under the issuing services' locks and carries it out only when the hash
|
|
860
|
+
* is yours and nothing blocks; otherwise nothing is issued. Without a refund everything is ONE
|
|
861
|
+
* transaction. With `refundPaymentId` the refund comes first and the credit note follows: a
|
|
862
|
+
* refund the provider confirmed stays even when the credit note cannot follow.
|
|
863
|
+
*
|
|
864
|
+
* `idempotencyKey`: one per attempt. A retry of that attempt (a timeout, a dropped connection)
|
|
865
|
+
* re-sends it and gets the first answer back, with nothing issued or refunded twice. Left out,
|
|
866
|
+
* one is made up and returned as `idempotencyKey` on the result and on a thrown error.
|
|
867
|
+
*
|
|
868
|
+
* Refusals, with nothing issued:
|
|
869
|
+
* - `INVOICE_CORRECTION_PLAN_CONFLICT` (`ConflictError`, 409): the invoice, its order, the
|
|
870
|
+
* payments, the numbering or the date moved since the plan. Plan again, show the merchant
|
|
871
|
+
* the new plan, and commit under a NEW key.
|
|
872
|
+
* - `INVOICE_CORRECTION_BLOCKED` (`BusinessRuleError`, 422): the plan has blockers, or a
|
|
873
|
+
* document's numbering provider refused it before anything was numbered (an ERP's debtor,
|
|
874
|
+
* article or VAT checks); `error.details` lists them, `code` = the blocker's code.
|
|
875
|
+
* - `IDEMPOTENCY_CONFLICT` (409): the key was used for another request.
|
|
876
|
+
* - `REFUND_REFUSED` (`BusinessRuleError`, 422): the payment provider, or the engine before it
|
|
877
|
+
* asked the provider, refused the refund; nothing moved. A provider's refusal stays on the
|
|
878
|
+
* payment as a `Failed` refund, which moves the plan: once the payment can take the refund,
|
|
879
|
+
* plan again and commit the new plan under a NEW key.
|
|
880
|
+
* - {@link planCorrection}'s refusals of the call.
|
|
881
|
+
*
|
|
882
|
+
* `IDEMPOTENCY_OUTCOME_UNKNOWN` (`error.outcomeUnknown`) is neither success nor refusal. Either
|
|
883
|
+
* the refund reached the payment provider and its answer never came (no credit note was
|
|
884
|
+
* issued; record the provider's answer with `admin.payments.reconcileRefund`, which frees the
|
|
885
|
+
* key, then plan again), or the refund was made and the credit note could not follow (plan
|
|
886
|
+
* again: it is issued without a refund). Never retry blind under a new key.
|
|
887
|
+
*
|
|
888
|
+
* On an ERP-numbered store (`documents[].numberingProvider`), the documents are booked in the
|
|
889
|
+
* ERP and cannot be undone from the platform.
|
|
890
|
+
*/
|
|
891
|
+
commitCorrection(input: InvoiceCorrectionInput, options: CommitInvoiceCorrectionCall): Promise<InvoiceCorrectionCommit & {
|
|
892
|
+
idempotencyKey: string;
|
|
893
|
+
}>;
|
|
894
|
+
/**
|
|
895
|
+
* Bill an under-charge as a supplementary invoice; both invoices stay owed.
|
|
896
|
+
*
|
|
897
|
+
* **Coded refusals** (nothing is numbered or issued): `INVOICE_NOT_FOUND` (→ `NotFoundError`);
|
|
898
|
+
* `INVOICE_ORDER_MISMATCH`, `INVOICE_ALREADY_VOIDED`, `INVOICE_NOT_SUPPLEMENTABLE` (the target
|
|
899
|
+
* is itself a supplementary invoice), `INVOICE_ORDER_STATE_BLOCKS_SUPPLEMENT` and
|
|
900
|
+
* `INVOICE_GENERATION_DISABLED` (→ `BusinessRuleError`). An engine before these codes answered
|
|
901
|
+
* the first four as `USER_INPUT_ERROR` (`ValidationError`) with the same sentence, and the last
|
|
902
|
+
* two as an uncoded error. Field-shape refusals (an invalid line) stay `USER_INPUT_ERROR`.
|
|
903
|
+
*/
|
|
417
904
|
issueSupplementaryInvoice(input: IssueSupplementaryInvoiceInput, options?: Call): Promise<Invoice>;
|
|
418
905
|
extensions: DocumentExtensionsModule;
|
|
419
906
|
}
|
|
420
|
-
export declare const GENERATE_INVOICE_MUTATION = "\n mutation GenerateInvoice(\n $orderId: ID!\n $invoicedOn: String!\n $languageCode: String\n $note: String\n $extensions: [DocumentExtensionInput!]\n ) {\n generateInvoice(\n orderId: $orderId\n invoicedOn: $invoicedOn\n languageCode: $languageCode\n note: $note\n extensions: $extensions\n ) { \n id\n invoiceNumber\n invoicedOn\n orderId\n languageCode\n storageKey\n totalWithTax\n currencyCode\n note\n voidedOn\n kind\n createdAt\n }\n }\n";
|
|
907
|
+
export declare const GENERATE_INVOICE_MUTATION = "\n mutation GenerateInvoice(\n $orderId: ID!\n $invoicedOn: String!\n $languageCode: String\n $note: String\n $extensions: [DocumentExtensionInput!]\n ) {\n generateInvoice(\n orderId: $orderId\n invoicedOn: $invoicedOn\n languageCode: $languageCode\n note: $note\n extensions: $extensions\n ) { \n id\n invoiceNumber\n invoicedOn\n orderId\n languageCode\n storageKey\n totalWithTax\n currencyCode\n note\n voidedOn\n reversedByCreditNoteId\n supersededByInvoiceId\n reissueOfInvoiceId\n kind\n supplementsInvoiceId\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n numberingProvider\n createdAt\n }\n }\n";
|
|
421
908
|
export declare const GENERATE_PACKING_SLIP_MUTATION = "\n mutation GeneratePackingSlip(\n $fulfillmentId: ID!\n $languageCode: String\n $extensions: [DocumentExtensionInput!]\n ) {\n generatePackingSlip(\n fulfillmentId: $fulfillmentId\n languageCode: $languageCode\n extensions: $extensions\n ) { \n id\n packingSlipNumber\n fulfillmentId\n languageCode\n storageKey\n createdAt\n }\n }\n";
|
|
422
909
|
export declare const DOCUMENT_DATA_QUERY = "\n query DocumentData($documentId: ID!, $type: DocumentType!) {\n documentData(documentId: $documentId, type: $type)\n }\n";
|
|
423
|
-
export declare const
|
|
424
|
-
export declare const
|
|
910
|
+
export declare const CREATE_DOCUMENT_DOWNLOAD_URL_MUTATION = "\n mutation CreateDocumentDownloadUrl($documentId: ID!, $type: DocumentType!) {\n createDocumentDownloadUrl(documentId: $documentId, type: $type) {\n url\n expiresAt\n filename\n }\n }\n";
|
|
911
|
+
export declare const ORDER_INVOICES_QUERY = "\n query OrderInvoices($orderId: ID!) {\n orderInvoices(orderId: $orderId) { \n id\n invoiceNumber\n invoicedOn\n orderId\n languageCode\n storageKey\n totalWithTax\n currencyCode\n note\n voidedOn\n reversedByCreditNoteId\n supersededByInvoiceId\n reissueOfInvoiceId\n kind\n supplementsInvoiceId\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n numberingProvider\n createdAt\n }\n }\n";
|
|
912
|
+
export declare const ORDER_CREDIT_NOTES_QUERY = "\n query OrderCreditNotes($orderId: ID!) {\n orderCreditNotes(orderId: $orderId) { \n id\n creditNoteNumber\n issuedOn\n totalWithTax\n currencyCode\n reason\n invoiceId\n kind\n reversalOfInvoiceId\n returnId\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n refundId\n numberingProvider\n storageKey\n createdAt\n }\n }\n";
|
|
913
|
+
export declare const CUSTOMER_DOCUMENTS_QUERY = "\n query CustomerDocuments($customerId: ID!, $options: CustomerDocumentListOptions) {\n customerDocuments(customerId: $customerId, options: $options) {\n totalItems\n items {\n type\n orderId\n orderCode\n invoice { \n id\n invoiceNumber\n invoicedOn\n orderId\n languageCode\n storageKey\n totalWithTax\n currencyCode\n note\n voidedOn\n reversedByCreditNoteId\n supersededByInvoiceId\n reissueOfInvoiceId\n kind\n supplementsInvoiceId\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n numberingProvider\n createdAt\n }\n creditNote { \n id\n creditNoteNumber\n issuedOn\n totalWithTax\n currencyCode\n reason\n invoiceId\n kind\n reversalOfInvoiceId\n returnId\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n refundId\n numberingProvider\n storageKey\n createdAt\n }\n }\n }\n }\n";
|
|
425
914
|
export declare const PREVIEW_INVOICE_MUTATION = "\n mutation PreviewInvoice($orderId: ID!, $invoicedOn: String!, $languageCode: String, $note: String) {\n previewInvoice(orderId: $orderId, invoicedOn: $invoicedOn, languageCode: $languageCode, note: $note)\n }\n";
|
|
426
915
|
export declare const SEND_INVOICE_EMAIL_MUTATION = "\n mutation SendInvoiceEmail($input: SendInvoiceEmailInput!) {\n sendInvoiceEmail(input: $input)\n }\n";
|
|
427
|
-
export declare const
|
|
428
|
-
export declare const
|
|
916
|
+
export declare const SEND_CREDIT_NOTE_EMAIL_MUTATION = "\n mutation SendCreditNoteEmail($input: SendCreditNoteEmailInput!) {\n sendCreditNoteEmail(input: $input)\n }\n";
|
|
917
|
+
export declare const ORDER_CREDIT_NOTE_EMAIL_SENDS_QUERY = "\n query OrderCreditNoteEmailSends($orderId: ID!) {\n orderCreditNoteEmailSends(orderId: $orderId) {\n id\n orderId\n creditNoteId\n recipientsTo\n recipientsCc\n createdAt\n }\n }\n";
|
|
918
|
+
export declare const ISSUE_PARTIAL_CREDIT_NOTE_MUTATION = "\n mutation IssuePartialCreditNote($input: IssuePartialCreditNoteInput!) {\n issuePartialCreditNote(input: $input) { \n id\n creditNoteNumber\n issuedOn\n totalWithTax\n currencyCode\n reason\n invoiceId\n kind\n reversalOfInvoiceId\n returnId\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n refundId\n numberingProvider\n storageKey\n createdAt\n }\n }\n";
|
|
919
|
+
export declare const ISSUE_SUPPLEMENTARY_INVOICE_MUTATION = "\n mutation IssueSupplementaryInvoice($input: IssueSupplementaryInvoiceInput!) {\n issueSupplementaryInvoice(input: $input) { \n id\n invoiceNumber\n invoicedOn\n orderId\n languageCode\n storageKey\n totalWithTax\n currencyCode\n note\n voidedOn\n reversedByCreditNoteId\n supersededByInvoiceId\n reissueOfInvoiceId\n kind\n supplementsInvoiceId\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n numberingProvider\n createdAt\n }\n }\n";
|
|
920
|
+
export declare const PLAN_INVOICE_CORRECTION_QUERY = "\n query PlanInvoiceCorrection($input: InvoiceCorrectionInput!) {\n planInvoiceCorrection(input: $input) { \n planHash\n ledger\n invoice { id invoiceNumber kind totalWithTax creditable currencyCode orderIds voidedOn }\n outcomes {\n outcome\n available\n unavailableCode\n unavailableMessage\n document\n needsLines\n prefillsLines\n needsAddresses\n allowsRefund\n allowsNote\n }\n prefill {\n source\n basis\n lines { description sku orderLineId quantity unitPrice unitPriceBasis taxRate }\n seededGross\n billedGross\n differs\n }\n outcome\n operation\n lineTotals { \n net\n tax\n gross\n taxSummary { taxRate net tax gross }\n }\n documents {\n type\n kind\n documentDate\n currencyCode\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n totals { \n net\n tax\n gross\n taxSummary { taxRate net tax gross }\n }\n issuer\n numbering { provider providerLabel external ready legalEntityId testStore }\n }\n refund {\n amount\n available\n unavailableCode\n unavailableMessage\n options { paymentId method amount refundable }\n recommendedPaymentId\n }\n accountCredit { available unavailableCode message }\n settlement\n blockers { code message path }\n }\n }\n";
|
|
921
|
+
/**
|
|
922
|
+
* Its own document on purpose: `commitInvoiceCorrection` exists only on an engine with the
|
|
923
|
+
* correction commit, so on an older one this call alone fails validation.
|
|
924
|
+
*/
|
|
925
|
+
export declare const COMMIT_INVOICE_CORRECTION_MUTATION = "\n mutation CommitInvoiceCorrection(\n $input: InvoiceCorrectionInput!\n $expectedPlanHash: String!\n $idempotencyKey: String!\n ) {\n commitInvoiceCorrection(\n input: $input\n expectedPlanHash: $expectedPlanHash\n idempotencyKey: $idempotencyKey\n ) {\n plan { \n planHash\n ledger\n invoice { id invoiceNumber kind totalWithTax creditable currencyCode orderIds voidedOn }\n outcomes {\n outcome\n available\n unavailableCode\n unavailableMessage\n document\n needsLines\n prefillsLines\n needsAddresses\n allowsRefund\n allowsNote\n }\n prefill {\n source\n basis\n lines { description sku orderLineId quantity unitPrice unitPriceBasis taxRate }\n seededGross\n billedGross\n differs\n }\n outcome\n operation\n lineTotals { \n net\n tax\n gross\n taxSummary { taxRate net tax gross }\n }\n documents {\n type\n kind\n documentDate\n currencyCode\n lines { \n description\n sku\n orderLineId\n quantity\n unitPriceNet\n unitPriceWithTax\n taxRate\n lineTotalNet\n lineTotalWithTax\n unitPriceBasis\n }\n totals { \n net\n tax\n gross\n taxSummary { taxRate net tax gross }\n }\n issuer\n numbering { provider providerLabel external ready legalEntityId testStore }\n }\n refund {\n amount\n available\n unavailableCode\n unavailableMessage\n options { paymentId method amount refundable }\n recommendedPaymentId\n }\n accountCredit { available unavailableCode message }\n settlement\n blockers { code message path }\n }\n documents {\n ledger\n type\n id\n number\n kind\n totalWithTax\n currencyCode\n issuedOn\n numberingProvider\n }\n refund { id state total paymentId }\n accountCredit { amount currencyCode unappliedCashIds }\n }\n }\n";
|
|
429
926
|
export declare const DOCUMENT_EXTENSIONS_QUERY = "\n query DocumentExtensions {\n documentExtensions { \n key\n documentTypes\n schemaVersion\n jsonSchema\n templateFragment\n createdAt\n updatedAt\n }\n }\n";
|
|
430
927
|
export declare const REGISTER_DOCUMENT_EXTENSION_MUTATION = "\n mutation RegisterDocumentExtension($input: RegisterDocumentExtensionInput!) {\n registerDocumentExtension(input: $input) { \n key\n documentTypes\n schemaVersion\n jsonSchema\n templateFragment\n createdAt\n updatedAt\n }\n }\n";
|
|
431
928
|
export declare const DELETE_DOCUMENT_EXTENSION_MUTATION = "\n mutation DeleteDocumentExtension($key: String!) {\n deleteDocumentExtension(key: $key)\n }\n";
|