@invowerk-dev/sdk 1.0.6 → 1.0.8
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/dist/index.d.ts +1 -1
- package/dist/sdk.gen.d.ts +10 -7
- package/dist/sdk.gen.js +10 -7
- package/dist/types.gen.d.ts +133 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { client, type CreateClientConfig } from './client.gen.js';
|
|
2
2
|
export { convertInvoice, explainCodes, generateInvoice, getMe, type Options, parseInvoice, renderInvoice, validateInvoice } from './sdk.gen.js';
|
|
3
|
-
export type { BodyRenderInvoice, Buyer, ClientOptions, ContentClass, ConvertInvoiceData, ConvertInvoiceError, ConvertInvoiceErrors, ConvertInvoiceResponse, ConvertInvoiceResponses, ConvertResponse, ConvertSelfValidation, CreditsInfo, DocumentTotals, ERechnungDe, ErrorClasses, Evidence, ExplainCodesData, ExplainCodesError, ExplainCodesErrors, ExplainCodesResponse, ExplainCodesResponses, ExplainResponse, Finding, Flavor, GenerateInvoiceData, GenerateInvoiceError, GenerateInvoiceErrors, GenerateInvoiceResponse, GenerateInvoiceResponses, GenerateRequest, GenerateResponse, GetMeData, GetMeResponse, GetMeResponses, HintInfo, InvoiceLine, MeResponse, ParseDetection, ParseInvoiceData, ParseInvoiceResponse, ParseInvoiceResponses, ParseResponse, PostalAddress, Problem, RateLimitInfo, RenderInvoiceData, RenderInvoiceError, RenderInvoiceErrors, RenderInvoiceResponse, RenderInvoiceResponses, RenderResponse, RuleExplanation, ScenarioInfo, SelfValidation, Seller, Syntax, TaxBreakdown, ValidateInvoiceData, ValidateInvoiceError, ValidateInvoiceErrors, ValidateInvoiceResponse, ValidateInvoiceResponses, ValidationResponse, ValidatorVersions } from './types.gen.js';
|
|
3
|
+
export type { BodyRenderInvoice, Buyer, ClientOptions, ContentClass, ConvertInvoiceData, ConvertInvoiceError, ConvertInvoiceErrors, ConvertInvoiceResponse, ConvertInvoiceResponses, ConvertResponse, ConvertSelfValidation, CreditsInfo, DocumentTotals, ERechnungDe, ErrorClasses, Evidence, ExplainCodesData, ExplainCodesError, ExplainCodesErrors, ExplainCodesResponse, ExplainCodesResponses, ExplainResponse, Finding, Flavor, GenerateInvoiceData, GenerateInvoiceError, GenerateInvoiceErrors, GenerateInvoiceResponse, GenerateInvoiceResponses, GenerateRequest, GenerateResponse, GetMeData, GetMeResponse, GetMeResponses, HintInfo, InvoiceLine, MeResponse, ParseDetection, ParseInvoiceData, ParseInvoiceResponse, ParseInvoiceResponses, ParseResponse, PostalAddress, PrecedingInvoice, Problem, RateLimitInfo, RenderInvoiceData, RenderInvoiceError, RenderInvoiceErrors, RenderInvoiceResponse, RenderInvoiceResponses, RenderResponse, RuleExplanation, ScenarioInfo, SelfValidation, Seller, Syntax, TaxBreakdown, ValidateInvoiceData, ValidateInvoiceError, ValidateInvoiceErrors, ValidateInvoiceResponse, ValidateInvoiceResponses, ValidationResponse, ValidatorVersions } from './types.gen.js';
|
package/dist/sdk.gen.d.ts
CHANGED
|
@@ -59,10 +59,11 @@ export declare const parseInvoice: <ThrowOnError extends boolean = false>(option
|
|
|
59
59
|
* the flavor of the source is kept. invowerk checks the converted XML before
|
|
60
60
|
* answering and never returns an invalid document. The answer is
|
|
61
61
|
* `application/xml`; `?format=json` returns `{xml, syntax, flavor,
|
|
62
|
-
* self_validation}`. Errors: 422 when the input cannot be read
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* credits
|
|
62
|
+
* self_validation}`. Errors: 422 when the input cannot be read or cannot be
|
|
63
|
+
* written in the target form (e.g. XRechnung paid by direct debit: invowerk writes
|
|
64
|
+
* only SEPA credit transfer), with an error code at the start of `detail`; 500
|
|
65
|
+
* when the converted XML fails the check (the credits are refunded); 413, 429
|
|
66
|
+
* and 504 as for `POST /v1/parse`. Costs 3 credits.
|
|
66
67
|
*
|
|
67
68
|
* **Credits:** 3 per call.
|
|
68
69
|
*/
|
|
@@ -74,13 +75,15 @@ export declare const convertInvoice: <ThrowOnError extends boolean = false>(opti
|
|
|
74
75
|
*
|
|
75
76
|
* The JSON body is keyed on EN 16931 Business Terms (BT-*). `syntax` selects UBL
|
|
76
77
|
* (default) or CII. `flavor` selects plain EN 16931 (default) or XRechnung, which
|
|
77
|
-
* requires `buyer_reference` (BT-10, the Leitweg-ID)
|
|
78
|
+
* requires `buyer_reference` (BT-10, the Leitweg-ID) and `payment_iban` (BT-84).
|
|
79
|
+
* A credit note (381) needs CII. The seller needs `identifier` (BT-29),
|
|
80
|
+
* `legal_registration_id` (BT-30) or `vat_id` (BT-31). invowerk writes your
|
|
78
81
|
* amounts as given. It does not compute or correct them. Before answering,
|
|
79
82
|
* invowerk checks the generated XML and never returns an invalid document. The
|
|
80
83
|
* answer is `application/xml`; `?format=json` returns
|
|
81
84
|
* `{xml, syntax, flavor, self_validation}`. Errors: 422 for invalid input, with
|
|
82
|
-
* details per field; 500 when the generated XML fails the
|
|
83
|
-
* refunded); 429 when every slot is busy (callers without an API key share
|
|
85
|
+
* details per field or the rule it breaks; 500 when the generated XML fails the
|
|
86
|
+
* check (the credits are refunded); 429 when every slot is busy (callers without an API key share
|
|
84
87
|
* one); 504 when it took longer than 20 s. Costs 5 credits.
|
|
85
88
|
*
|
|
86
89
|
* **Credits:** 5 per call.
|
package/dist/sdk.gen.js
CHANGED
|
@@ -60,10 +60,11 @@ export const parseInvoice = (options) => (options.client ?? client).post({
|
|
|
60
60
|
* the flavor of the source is kept. invowerk checks the converted XML before
|
|
61
61
|
* answering and never returns an invalid document. The answer is
|
|
62
62
|
* `application/xml`; `?format=json` returns `{xml, syntax, flavor,
|
|
63
|
-
* self_validation}`. Errors: 422 when the input cannot be read
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* credits
|
|
63
|
+
* self_validation}`. Errors: 422 when the input cannot be read or cannot be
|
|
64
|
+
* written in the target form (e.g. XRechnung paid by direct debit: invowerk writes
|
|
65
|
+
* only SEPA credit transfer), with an error code at the start of `detail`; 500
|
|
66
|
+
* when the converted XML fails the check (the credits are refunded); 413, 429
|
|
67
|
+
* and 504 as for `POST /v1/parse`. Costs 3 credits.
|
|
67
68
|
*
|
|
68
69
|
* **Credits:** 3 per call.
|
|
69
70
|
*/
|
|
@@ -84,13 +85,15 @@ export const convertInvoice = (options) => (options.client ?? client).post({
|
|
|
84
85
|
*
|
|
85
86
|
* The JSON body is keyed on EN 16931 Business Terms (BT-*). `syntax` selects UBL
|
|
86
87
|
* (default) or CII. `flavor` selects plain EN 16931 (default) or XRechnung, which
|
|
87
|
-
* requires `buyer_reference` (BT-10, the Leitweg-ID)
|
|
88
|
+
* requires `buyer_reference` (BT-10, the Leitweg-ID) and `payment_iban` (BT-84).
|
|
89
|
+
* A credit note (381) needs CII. The seller needs `identifier` (BT-29),
|
|
90
|
+
* `legal_registration_id` (BT-30) or `vat_id` (BT-31). invowerk writes your
|
|
88
91
|
* amounts as given. It does not compute or correct them. Before answering,
|
|
89
92
|
* invowerk checks the generated XML and never returns an invalid document. The
|
|
90
93
|
* answer is `application/xml`; `?format=json` returns
|
|
91
94
|
* `{xml, syntax, flavor, self_validation}`. Errors: 422 for invalid input, with
|
|
92
|
-
* details per field; 500 when the generated XML fails the
|
|
93
|
-
* refunded); 429 when every slot is busy (callers without an API key share
|
|
95
|
+
* details per field or the rule it breaks; 500 when the generated XML fails the
|
|
96
|
+
* check (the credits are refunded); 429 when every slot is busy (callers without an API key share
|
|
94
97
|
* one); 504 when it took longer than 20 s. Costs 5 credits.
|
|
95
98
|
*
|
|
96
99
|
* **Credits:** 5 per call.
|
package/dist/types.gen.d.ts
CHANGED
|
@@ -28,6 +28,12 @@ export type Buyer = {
|
|
|
28
28
|
* Buyer postal address (BG-8).
|
|
29
29
|
*/
|
|
30
30
|
address: PostalAddress;
|
|
31
|
+
/**
|
|
32
|
+
* Vat Id
|
|
33
|
+
*
|
|
34
|
+
* Buyer VAT ID, e.g. 'ATU12345678' (BT-48). Needed on lines with VAT category 'AE' (BR-AE-02) or 'K' (BR-IC-02).
|
|
35
|
+
*/
|
|
36
|
+
vat_id?: string | null;
|
|
31
37
|
/**
|
|
32
38
|
* Electronic Address
|
|
33
39
|
*
|
|
@@ -155,10 +161,16 @@ export type DocumentTotals = {
|
|
|
155
161
|
* Invoice total with VAT (BT-112).
|
|
156
162
|
*/
|
|
157
163
|
tax_inclusive: number | string;
|
|
164
|
+
/**
|
|
165
|
+
* Prepaid
|
|
166
|
+
*
|
|
167
|
+
* Amount already paid, e.g. the sum of earlier partial invoices on a final invoice (BT-113).
|
|
168
|
+
*/
|
|
169
|
+
prepaid?: number | string | null;
|
|
158
170
|
/**
|
|
159
171
|
* Payable
|
|
160
172
|
*
|
|
161
|
-
* Amount due for payment (BT-115). Defaults to the total with VAT.
|
|
173
|
+
* Amount due for payment (BT-115). Defaults to the total with VAT minus the paid amount (BT-112 − BT-113).
|
|
162
174
|
*/
|
|
163
175
|
payable?: number | string | null;
|
|
164
176
|
};
|
|
@@ -289,7 +301,9 @@ export type ExplainResponse = {
|
|
|
289
301
|
* (``format``), in a rule of the applied rule set (``business_rules``) or in
|
|
290
302
|
* the PDF around the invoice data (``carrier``). ``explain_url`` links the
|
|
291
303
|
* explanation page for the code, in ``lang``. ``explain`` holds the explanation
|
|
292
|
-
* itself when you call with ``?explain=true``.
|
|
304
|
+
* itself when you call with ``?explain=true``. ``printed_by`` names the
|
|
305
|
+
* browser or printer when a ``no_embedded_xml`` PDF was saved through a print
|
|
306
|
+
* function.
|
|
293
307
|
*/
|
|
294
308
|
export type Finding = {
|
|
295
309
|
/**
|
|
@@ -336,6 +350,12 @@ export type Finding = {
|
|
|
336
350
|
explain?: {
|
|
337
351
|
[key: string]: unknown;
|
|
338
352
|
} | null;
|
|
353
|
+
/**
|
|
354
|
+
* Printed By
|
|
355
|
+
*
|
|
356
|
+
* Set only on 'no_embedded_xml': the browser or printer that saved the PDF through a print function, for example 'Firefox', 'Chrome' or 'Microsoft Print to PDF'. Printing drops the embedded invoice XML, so the original file may still be an e-invoice.
|
|
357
|
+
*/
|
|
358
|
+
printed_by?: string | null;
|
|
339
359
|
};
|
|
340
360
|
/**
|
|
341
361
|
* Flavor
|
|
@@ -383,7 +403,7 @@ export type GenerateRequest = {
|
|
|
383
403
|
/**
|
|
384
404
|
* Invoice Type Code
|
|
385
405
|
*
|
|
386
|
-
* Invoice type code from UNTDID 1001
|
|
406
|
+
* Invoice type code from UNTDID 1001 (BT-3): '380' commercial invoice, '326' partial invoice, '381' credit note (syntax 'cii' only), '384' corrected invoice, '389' self-billed invoice, '875'/'876'/'877' partial, partial final and final construction invoice.
|
|
387
407
|
*/
|
|
388
408
|
invoice_type_code?: string;
|
|
389
409
|
/**
|
|
@@ -401,9 +421,49 @@ export type GenerateRequest = {
|
|
|
401
421
|
/**
|
|
402
422
|
* Payment Iban
|
|
403
423
|
*
|
|
404
|
-
* IBAN of the payee account for a bank transfer (BT-84).
|
|
424
|
+
* IBAN of the payee account for a bank transfer (BT-84). Without it the invoice carries no payment instructions (BG-16). Required for flavor 'xrechnung' (BR-DE-1).
|
|
405
425
|
*/
|
|
406
426
|
payment_iban?: string | null;
|
|
427
|
+
/**
|
|
428
|
+
* Payment Terms
|
|
429
|
+
*
|
|
430
|
+
* Payment terms as free text (BT-20).
|
|
431
|
+
*/
|
|
432
|
+
payment_terms?: string | null;
|
|
433
|
+
/**
|
|
434
|
+
* Notes
|
|
435
|
+
*
|
|
436
|
+
* Free-text notes on the invoice as a whole, one entry per note (BT-22).
|
|
437
|
+
*/
|
|
438
|
+
notes?: Array<string>;
|
|
439
|
+
/**
|
|
440
|
+
* Delivery Date
|
|
441
|
+
*
|
|
442
|
+
* Actual delivery date, 'YYYY-MM-DD' (BT-72). Defaults to the issue date unless a delivery period is given.
|
|
443
|
+
*/
|
|
444
|
+
delivery_date?: string | null;
|
|
445
|
+
/**
|
|
446
|
+
* Delivery Period Start
|
|
447
|
+
*
|
|
448
|
+
* Start of the invoicing period, 'YYYY-MM-DD' (BT-73, BG-14), e.g. the period a service covers.
|
|
449
|
+
*/
|
|
450
|
+
delivery_period_start?: string | null;
|
|
451
|
+
/**
|
|
452
|
+
* Delivery Period End
|
|
453
|
+
*
|
|
454
|
+
* End of the invoicing period, 'YYYY-MM-DD' (BT-74, BG-14). Not before the start (BR-29).
|
|
455
|
+
*/
|
|
456
|
+
delivery_period_end?: string | null;
|
|
457
|
+
/**
|
|
458
|
+
* Deliver-to address (BG-15): where the goods go or the service is performed. Needed for VAT category 'K', intra-community supply (BT-80, BR-IC-12).
|
|
459
|
+
*/
|
|
460
|
+
deliver_to?: PostalAddress | null;
|
|
461
|
+
/**
|
|
462
|
+
* Preceding Invoices
|
|
463
|
+
*
|
|
464
|
+
* Earlier invoices this invoice refers to (BG-3), e.g. the invoice a corrected invoice (384) replaces. Syntax 'cii' carries at most one.
|
|
465
|
+
*/
|
|
466
|
+
preceding_invoices?: Array<PrecedingInvoice>;
|
|
407
467
|
seller: Seller;
|
|
408
468
|
buyer: Buyer;
|
|
409
469
|
/**
|
|
@@ -620,12 +680,18 @@ export type ParseResponse = {
|
|
|
620
680
|
/**
|
|
621
681
|
* PostalAddress
|
|
622
682
|
*
|
|
623
|
-
* A postal address (BG-5 seller, BG-8 buyer).
|
|
683
|
+
* A postal address (BG-5 seller, BG-8 buyer, BG-15 deliver-to).
|
|
624
684
|
*
|
|
625
685
|
* EN 16931 requires only the country. XRechnung also requires city and post
|
|
626
686
|
* code for the seller. invowerk does not check that the address exists.
|
|
627
687
|
*/
|
|
628
688
|
export type PostalAddress = {
|
|
689
|
+
/**
|
|
690
|
+
* Line One
|
|
691
|
+
*
|
|
692
|
+
* Address line 1, usually street and house number (BT-35 seller, BT-50 buyer, BT-75 deliver-to).
|
|
693
|
+
*/
|
|
694
|
+
line_one?: string | null;
|
|
629
695
|
/**
|
|
630
696
|
* City
|
|
631
697
|
*
|
|
@@ -645,6 +711,26 @@ export type PostalAddress = {
|
|
|
645
711
|
*/
|
|
646
712
|
country_code: string;
|
|
647
713
|
};
|
|
714
|
+
/**
|
|
715
|
+
* PrecedingInvoice
|
|
716
|
+
*
|
|
717
|
+
* A reference to an earlier invoice (BG-3), e.g. the invoice a corrected invoice
|
|
718
|
+
* (384) replaces, or a partial invoice a final invoice (877) settles.
|
|
719
|
+
*/
|
|
720
|
+
export type PrecedingInvoice = {
|
|
721
|
+
/**
|
|
722
|
+
* Number
|
|
723
|
+
*
|
|
724
|
+
* Number of the earlier invoice (BT-25).
|
|
725
|
+
*/
|
|
726
|
+
number: string;
|
|
727
|
+
/**
|
|
728
|
+
* Issue Date
|
|
729
|
+
*
|
|
730
|
+
* Issue date of the earlier invoice, 'YYYY-MM-DD' (BT-26).
|
|
731
|
+
*/
|
|
732
|
+
issue_date?: string | null;
|
|
733
|
+
};
|
|
648
734
|
/**
|
|
649
735
|
* RateLimitInfo
|
|
650
736
|
*
|
|
@@ -844,6 +930,36 @@ export type Seller = {
|
|
|
844
930
|
* Seller VAT ID, e.g. 'DE123456789' (BT-31). Needed when a line has VAT category 'S' (BR-S-02).
|
|
845
931
|
*/
|
|
846
932
|
vat_id?: string | null;
|
|
933
|
+
/**
|
|
934
|
+
* Tax Number
|
|
935
|
+
*
|
|
936
|
+
* Seller tax registration identifier, e.g. a German Steuernummer '123/456/78901' (BT-32). Written with scheme 'FC'.
|
|
937
|
+
*/
|
|
938
|
+
tax_number?: string | null;
|
|
939
|
+
/**
|
|
940
|
+
* Identifier
|
|
941
|
+
*
|
|
942
|
+
* Seller identifier, e.g. a GLN or an ID the buyer knows the seller by (BT-29). An invoice needs BT-29, BT-30 or BT-31 (BR-CO-26).
|
|
943
|
+
*/
|
|
944
|
+
identifier?: string | null;
|
|
945
|
+
/**
|
|
946
|
+
* Identifier Scheme
|
|
947
|
+
*
|
|
948
|
+
* Scheme of the seller identifier, an ISO/IEC 6523 ICD code, e.g. '0088' for a GLN (BT-29-1). Leave empty for an identifier without a scheme.
|
|
949
|
+
*/
|
|
950
|
+
identifier_scheme?: string | null;
|
|
951
|
+
/**
|
|
952
|
+
* Legal Registration Id
|
|
953
|
+
*
|
|
954
|
+
* Seller legal registration identifier, e.g. a Handelsregisternummer 'HRB 12345' (BT-30). An invoice needs BT-29, BT-30 or BT-31 (BR-CO-26).
|
|
955
|
+
*/
|
|
956
|
+
legal_registration_id?: string | null;
|
|
957
|
+
/**
|
|
958
|
+
* Legal Registration Scheme
|
|
959
|
+
*
|
|
960
|
+
* Scheme of the legal registration identifier, an ISO/IEC 6523 ICD code (BT-30-1). Leave empty for an identifier without a scheme.
|
|
961
|
+
*/
|
|
962
|
+
legal_registration_scheme?: string | null;
|
|
847
963
|
/**
|
|
848
964
|
* Contact Name
|
|
849
965
|
*
|
|
@@ -905,6 +1021,18 @@ export type TaxBreakdown = {
|
|
|
905
1021
|
* VAT rate of the category in percent (BT-119).
|
|
906
1022
|
*/
|
|
907
1023
|
rate?: number | string;
|
|
1024
|
+
/**
|
|
1025
|
+
* Exemption Reason
|
|
1026
|
+
*
|
|
1027
|
+
* VAT exemption reason as text (BT-120). The rules require it or its code for categories such as 'E', 'AE', 'K', 'G' (e.g. BR-E-10).
|
|
1028
|
+
*/
|
|
1029
|
+
exemption_reason?: string | null;
|
|
1030
|
+
/**
|
|
1031
|
+
* Exemption Reason Code
|
|
1032
|
+
*
|
|
1033
|
+
* VAT exemption reason code from the VATEX code list, e.g. 'VATEX-EU-AE' (BT-121).
|
|
1034
|
+
*/
|
|
1035
|
+
exemption_reason_code?: string | null;
|
|
908
1036
|
};
|
|
909
1037
|
/**
|
|
910
1038
|
* ValidationResponse
|
package/package.json
CHANGED