@fin.cx/einvoice 5.0.3 → 5.1.3
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_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/einvoice.d.ts +4 -8
- package/dist_ts/einvoice.js +46 -7
- package/dist_ts/formats/converters/xml-to-einvoice.converter.d.ts +21 -0
- package/dist_ts/formats/converters/xml-to-einvoice.converter.js +127 -0
- package/dist_ts/formats/semantic/bt-bg.model.d.ts +445 -0
- package/dist_ts/formats/semantic/bt-bg.model.js +12 -0
- package/dist_ts/formats/semantic/semantic.adapter.d.ts +87 -0
- package/dist_ts/formats/semantic/semantic.adapter.js +538 -0
- package/dist_ts/formats/semantic/semantic.validator.d.ts +48 -0
- package/dist_ts/formats/semantic/semantic.validator.js +596 -0
- package/dist_ts/formats/utils/currency.calculator.decimal.d.ts +98 -0
- package/dist_ts/formats/utils/currency.calculator.decimal.js +212 -0
- package/dist_ts/formats/utils/currency.utils.d.ts +99 -0
- package/dist_ts/formats/utils/currency.utils.js +250 -0
- package/dist_ts/formats/utils/decimal.d.ts +151 -0
- package/dist_ts/formats/utils/decimal.js +435 -0
- package/dist_ts/formats/validation/codelist.validator.d.ts +49 -0
- package/dist_ts/formats/validation/codelist.validator.js +188 -0
- package/dist_ts/formats/validation/conformance.harness.d.ts +99 -0
- package/dist_ts/formats/validation/conformance.harness.js +471 -0
- package/dist_ts/formats/validation/en16931.business-rules.validator.d.ts +58 -0
- package/dist_ts/formats/validation/en16931.business-rules.validator.js +459 -0
- package/dist_ts/formats/validation/facturx.validator.d.ts +75 -0
- package/dist_ts/formats/validation/facturx.validator.js +522 -0
- package/dist_ts/formats/validation/integrated.validator.d.ts +82 -0
- package/dist_ts/formats/validation/integrated.validator.js +311 -0
- package/dist_ts/formats/validation/peppol.validator.d.ts +77 -0
- package/dist_ts/formats/validation/peppol.validator.js +529 -0
- package/dist_ts/formats/validation/schematron.downloader.d.ts +71 -0
- package/dist_ts/formats/validation/schematron.downloader.js +254 -0
- package/dist_ts/formats/validation/schematron.integration.d.ts +60 -0
- package/dist_ts/formats/validation/schematron.integration.js +230 -0
- package/dist_ts/formats/validation/schematron.validator.d.ts +79 -0
- package/dist_ts/formats/validation/schematron.validator.js +288 -0
- package/dist_ts/formats/validation/schematron.worker.d.ts +50 -0
- package/dist_ts/formats/validation/schematron.worker.js +185 -0
- package/dist_ts/formats/validation/validation.types.d.ts +163 -0
- package/dist_ts/formats/validation/validation.types.js +181 -0
- package/dist_ts/formats/validation/vat-categories.validator.d.ts +87 -0
- package/dist_ts/formats/validation/vat-categories.validator.js +497 -0
- package/dist_ts/formats/validation/xrechnung.validator.d.ts +92 -0
- package/dist_ts/formats/validation/xrechnung.validator.js +417 -0
- package/dist_ts/interfaces/common.d.ts +1 -0
- package/dist_ts/interfaces/en16931-metadata.d.ts +83 -0
- package/dist_ts/interfaces/en16931-metadata.js +6 -0
- package/dist_ts/plugins.d.ts +3 -1
- package/dist_ts/plugins.js +7 -2
- package/dist_ts_install/download-schematron.d.ts +6 -0
- package/dist_ts_install/download-schematron.js +62 -0
- package/dist_ts_install/download-test-samples.d.ts +19 -0
- package/dist_ts_install/download-test-samples.js +169 -0
- package/dist_ts_install/download-xrechnung-rules.d.ts +7 -0
- package/dist_ts_install/download-xrechnung-rules.js +146 -0
- package/dist_ts_install/index.d.ts +8 -0
- package/dist_ts_install/index.js +246 -0
- package/npmextra.json +1 -1
- package/package.json +12 -6
- package/readme.md +255 -810
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/einvoice.ts +63 -14
- package/ts/formats/converters/xml-to-einvoice.converter.ts +142 -0
- package/ts/formats/semantic/bt-bg.model.ts +524 -0
- package/ts/formats/semantic/semantic.adapter.ts +600 -0
- package/ts/formats/semantic/semantic.validator.ts +654 -0
- package/ts/formats/utils/currency.calculator.decimal.ts +323 -0
- package/ts/formats/utils/currency.utils.ts +299 -0
- package/ts/formats/utils/decimal.ts +509 -0
- package/ts/formats/validation/codelist.validator.ts +317 -0
- package/ts/formats/validation/conformance.harness.ts +591 -0
- package/ts/formats/validation/en16931.business-rules.validator.ts +694 -0
- package/ts/formats/validation/facturx.validator.ts +579 -0
- package/ts/formats/validation/integrated.validator.ts +405 -0
- package/ts/formats/validation/peppol.validator.ts +589 -0
- package/ts/formats/validation/schematron.downloader.ts +304 -0
- package/ts/formats/validation/schematron.integration.ts +285 -0
- package/ts/formats/validation/schematron.validator.ts +348 -0
- package/ts/formats/validation/schematron.worker.ts +221 -0
- package/ts/formats/validation/validation.types.ts +274 -0
- package/ts/formats/validation/vat-categories.validator.ts +845 -0
- package/ts/formats/validation/xrechnung.validator.ts +494 -0
- package/ts/interfaces/common.ts +1 -0
- package/ts/interfaces/en16931-metadata.ts +104 -0
- package/ts/plugins.ts +8 -0
- package/ts/tspublish.json +3 -0
- package/dist_ts/classes.decoder.d.ts +0 -40
- package/dist_ts/classes.decoder.js +0 -320
- package/dist_ts/classes.encoder.d.ts +0 -51
- package/dist_ts/classes.encoder.js +0 -293
- package/dist_ts/classes.xinvoice.d.ts +0 -136
- package/dist_ts/classes.xinvoice.js +0 -352
- package/dist_ts/formats/base.decoder.d.ts +0 -19
- package/dist_ts/formats/base.decoder.js +0 -130
- package/dist_ts/formats/base.validator.d.ts +0 -44
- package/dist_ts/formats/base.validator.js +0 -39
- package/dist_ts/formats/decoder.factory.d.ts +0 -15
- package/dist_ts/formats/decoder.factory.js +0 -46
- package/dist_ts/formats/factorx.decoder.d.ts +0 -18
- package/dist_ts/formats/factorx.decoder.js +0 -178
- package/dist_ts/formats/factorx.encoder.d.ts +0 -51
- package/dist_ts/formats/factorx.encoder.js +0 -293
- package/dist_ts/formats/facturx.decoder.d.ts +0 -18
- package/dist_ts/formats/facturx.decoder.js +0 -210
- package/dist_ts/formats/facturx.encoder.d.ts +0 -51
- package/dist_ts/formats/facturx.encoder.js +0 -293
- package/dist_ts/formats/facturx.validator.d.ts +0 -67
- package/dist_ts/formats/facturx.validator.js +0 -266
- package/dist_ts/formats/pdf/robust-pdf.extractor.d.ts +0 -40
- package/dist_ts/formats/pdf/robust-pdf.extractor.js +0 -324
- package/dist_ts/formats/ubl.validator.d.ts +0 -82
- package/dist_ts/formats/ubl.validator.js +0 -306
- package/dist_ts/formats/validator.factory.d.ts +0 -18
- package/dist_ts/formats/validator.factory.js +0 -78
- package/dist_ts/formats/xinvoice.decoder.d.ts +0 -28
- package/dist_ts/formats/xinvoice.decoder.js +0 -332
- package/dist_ts/formats/xinvoice.encoder.d.ts +0 -19
- package/dist_ts/formats/xinvoice.encoder.js +0 -282
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EN16931 Canonical Semantic Model
|
|
3
|
+
* Defines all Business Terms (BT) and Business Groups (BG) from the standard
|
|
4
|
+
* This provides a format-agnostic representation of invoice data
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Business Term (BT) definitions from EN16931
|
|
9
|
+
* Each BT represents a specific data element in an invoice
|
|
10
|
+
*/
|
|
11
|
+
export interface BusinessTerms {
|
|
12
|
+
// Document level information (BT-1 to BT-22)
|
|
13
|
+
BT1_InvoiceNumber: string;
|
|
14
|
+
BT2_InvoiceIssueDate: Date;
|
|
15
|
+
BT3_InvoiceTypeCode: string;
|
|
16
|
+
BT4_InvoiceNote?: string;
|
|
17
|
+
BT5_InvoiceCurrencyCode: string;
|
|
18
|
+
BT6_VATAccountingCurrencyCode?: string;
|
|
19
|
+
BT7_ValueDateForVATCalculation?: Date;
|
|
20
|
+
BT8_InvoicePeriodDescriptionCode?: string;
|
|
21
|
+
BT9_DueDate?: Date;
|
|
22
|
+
BT10_BuyerReference?: string;
|
|
23
|
+
BT11_ProjectReference?: string;
|
|
24
|
+
BT12_ContractReference?: string;
|
|
25
|
+
BT13_PurchaseOrderReference?: string;
|
|
26
|
+
BT14_SalesOrderReference?: string;
|
|
27
|
+
BT15_ReceivingAdviceReference?: string;
|
|
28
|
+
BT16_DespatchAdviceReference?: string;
|
|
29
|
+
BT17_TenderOrLotReference?: string;
|
|
30
|
+
BT18_InvoicedObjectIdentifier?: string;
|
|
31
|
+
BT19_BuyerAccountingReference?: string;
|
|
32
|
+
BT20_PaymentTerms?: string;
|
|
33
|
+
BT21_InvoiceNote?: string[];
|
|
34
|
+
BT22_ProcessSpecificNote?: string;
|
|
35
|
+
|
|
36
|
+
// Seller information (BT-23 to BT-40)
|
|
37
|
+
BT23_BusinessProcessType?: string;
|
|
38
|
+
BT24_SpecificationIdentifier?: string;
|
|
39
|
+
BT25_InvoiceAttachment?: Attachment[];
|
|
40
|
+
BT26_InvoiceDocumentReference?: string;
|
|
41
|
+
BT27_SellerName: string;
|
|
42
|
+
BT28_SellerTradingName?: string;
|
|
43
|
+
BT29_SellerIdentifier?: string;
|
|
44
|
+
BT30_SellerLegalRegistrationIdentifier?: string;
|
|
45
|
+
BT31_SellerVATIdentifier?: string;
|
|
46
|
+
BT32_SellerTaxRegistrationIdentifier?: string;
|
|
47
|
+
BT33_SellerAdditionalLegalInfo?: string;
|
|
48
|
+
BT34_SellerElectronicAddress?: string;
|
|
49
|
+
BT35_SellerAddressLine1?: string;
|
|
50
|
+
BT36_SellerAddressLine2?: string;
|
|
51
|
+
BT37_SellerAddressLine3?: string;
|
|
52
|
+
BT38_SellerCity?: string;
|
|
53
|
+
BT39_SellerPostCode?: string;
|
|
54
|
+
BT40_SellerCountryCode: string;
|
|
55
|
+
|
|
56
|
+
// Seller contact (BT-41 to BT-43)
|
|
57
|
+
BT41_SellerContactPoint?: string;
|
|
58
|
+
BT42_SellerContactTelephoneNumber?: string;
|
|
59
|
+
BT43_SellerContactEmailAddress?: string;
|
|
60
|
+
|
|
61
|
+
// Buyer information (BT-44 to BT-58)
|
|
62
|
+
BT44_BuyerName: string;
|
|
63
|
+
BT45_BuyerTradingName?: string;
|
|
64
|
+
BT46_BuyerIdentifier?: string;
|
|
65
|
+
BT47_BuyerLegalRegistrationIdentifier?: string;
|
|
66
|
+
BT48_BuyerVATIdentifier?: string;
|
|
67
|
+
BT49_BuyerElectronicAddress?: string;
|
|
68
|
+
BT50_BuyerAddressLine1?: string;
|
|
69
|
+
BT51_BuyerAddressLine2?: string;
|
|
70
|
+
BT52_BuyerAddressLine3?: string;
|
|
71
|
+
BT53_BuyerCity?: string;
|
|
72
|
+
BT54_BuyerPostCode?: string;
|
|
73
|
+
BT55_BuyerCountryCode: string;
|
|
74
|
+
BT56_BuyerContactPoint?: string;
|
|
75
|
+
BT57_BuyerContactTelephoneNumber?: string;
|
|
76
|
+
BT58_BuyerContactEmailAddress?: string;
|
|
77
|
+
|
|
78
|
+
// Payee information (BT-59 to BT-62)
|
|
79
|
+
BT59_PayeeName?: string;
|
|
80
|
+
BT60_PayeeIdentifier?: string;
|
|
81
|
+
BT61_PayeeLegalRegistrationIdentifier?: string;
|
|
82
|
+
BT62_PayeeLegalRegistrationIdentifierSchemeID?: string;
|
|
83
|
+
|
|
84
|
+
// Tax representative (BT-62 to BT-69)
|
|
85
|
+
BT63_SellerTaxRepresentativeName?: string;
|
|
86
|
+
BT64_SellerTaxRepresentativeVATIdentifier?: string;
|
|
87
|
+
BT65_SellerTaxRepresentativeAddressLine1?: string;
|
|
88
|
+
BT66_SellerTaxRepresentativeAddressLine2?: string;
|
|
89
|
+
BT67_SellerTaxRepresentativeCity?: string;
|
|
90
|
+
BT68_SellerTaxRepresentativePostCode?: string;
|
|
91
|
+
BT69_SellerTaxRepresentativeCountryCode?: string;
|
|
92
|
+
|
|
93
|
+
// Delivery information (BT-70 to BT-80)
|
|
94
|
+
BT70_DeliveryName?: string;
|
|
95
|
+
BT71_DeliveryLocationIdentifier?: string;
|
|
96
|
+
BT72_ActualDeliveryDate?: Date;
|
|
97
|
+
BT73_InvoicingPeriodStartDate?: Date;
|
|
98
|
+
BT74_InvoicingPeriodEndDate?: Date;
|
|
99
|
+
BT75_DeliveryAddressLine1?: string;
|
|
100
|
+
BT76_DeliveryAddressLine2?: string;
|
|
101
|
+
BT77_DeliveryAddressLine3?: string;
|
|
102
|
+
BT78_DeliveryCity?: string;
|
|
103
|
+
BT79_DeliveryPostCode?: string;
|
|
104
|
+
BT80_DeliveryCountryCode?: string;
|
|
105
|
+
|
|
106
|
+
// Payment instructions (BT-81 to BT-91)
|
|
107
|
+
BT81_PaymentMeansTypeCode: string;
|
|
108
|
+
BT82_PaymentMeansText?: string;
|
|
109
|
+
BT83_RemittanceInformation?: string;
|
|
110
|
+
BT84_PaymentAccountIdentifier?: string;
|
|
111
|
+
BT85_PaymentAccountName?: string;
|
|
112
|
+
BT86_PaymentServiceProviderIdentifier?: string;
|
|
113
|
+
BT87_PaymentCardAccountPrimaryNumber?: string;
|
|
114
|
+
BT88_PaymentCardAccountHolderName?: string;
|
|
115
|
+
BT89_MandateReferenceIdentifier?: string;
|
|
116
|
+
BT90_BankAssignedCreditorIdentifier?: string;
|
|
117
|
+
BT91_DebitedAccountIdentifier?: string;
|
|
118
|
+
|
|
119
|
+
// Document level allowances (BT-92 to BT-96)
|
|
120
|
+
BT92_DocumentLevelAllowanceAmount?: number;
|
|
121
|
+
BT93_DocumentLevelAllowanceBaseAmount?: number;
|
|
122
|
+
BT94_DocumentLevelAllowancePercentage?: number;
|
|
123
|
+
BT95_DocumentLevelAllowanceVATCategoryCode?: string;
|
|
124
|
+
BT96_DocumentLevelAllowanceVATRate?: number;
|
|
125
|
+
BT97_DocumentLevelAllowanceReason?: string;
|
|
126
|
+
BT98_DocumentLevelAllowanceReasonCode?: string;
|
|
127
|
+
|
|
128
|
+
// Document level charges (BT-99 to BT-105)
|
|
129
|
+
BT99_DocumentLevelChargeAmount?: number;
|
|
130
|
+
BT100_DocumentLevelChargeBaseAmount?: number;
|
|
131
|
+
BT101_DocumentLevelChargePercentage?: number;
|
|
132
|
+
BT102_DocumentLevelChargeVATCategoryCode?: string;
|
|
133
|
+
BT103_DocumentLevelChargeVATRate?: number;
|
|
134
|
+
BT104_DocumentLevelChargeReason?: string;
|
|
135
|
+
BT105_DocumentLevelChargeReasonCode?: string;
|
|
136
|
+
|
|
137
|
+
// Document totals (BT-106 to BT-115)
|
|
138
|
+
BT106_SumOfInvoiceLineNetAmount: number;
|
|
139
|
+
BT107_SumOfAllowancesOnDocumentLevel?: number;
|
|
140
|
+
BT108_SumOfChargesOnDocumentLevel?: number;
|
|
141
|
+
BT109_InvoiceTotalAmountWithoutVAT: number;
|
|
142
|
+
BT110_InvoiceTotalVATAmount?: number;
|
|
143
|
+
BT111_InvoiceTotalVATAmountInAccountingCurrency?: number;
|
|
144
|
+
BT112_InvoiceTotalAmountWithVAT: number;
|
|
145
|
+
BT113_PaidAmount?: number;
|
|
146
|
+
BT114_RoundingAmount?: number;
|
|
147
|
+
BT115_AmountDueForPayment: number;
|
|
148
|
+
|
|
149
|
+
// VAT breakdown (BT-116 to BT-121)
|
|
150
|
+
BT116_VATCategoryTaxableAmount?: number;
|
|
151
|
+
BT117_VATCategoryTaxAmount?: number;
|
|
152
|
+
BT118_VATCategoryCode?: string;
|
|
153
|
+
BT119_VATCategoryRate?: number;
|
|
154
|
+
BT120_VATExemptionReasonText?: string;
|
|
155
|
+
BT121_VATExemptionReasonCode?: string;
|
|
156
|
+
|
|
157
|
+
// Additional document references (BT-122 to BT-125)
|
|
158
|
+
BT122_SupportingDocumentReference?: string;
|
|
159
|
+
BT123_SupportingDocumentDescription?: string;
|
|
160
|
+
BT124_ExternalDocumentLocation?: string;
|
|
161
|
+
BT125_AttachedDocumentEmbedded?: string;
|
|
162
|
+
|
|
163
|
+
// Line level information (BT-126 to BT-162)
|
|
164
|
+
BT126_InvoiceLineIdentifier?: string;
|
|
165
|
+
BT127_InvoiceLineNote?: string;
|
|
166
|
+
BT128_InvoiceLineObjectIdentifier?: string;
|
|
167
|
+
BT129_InvoicedQuantity?: number;
|
|
168
|
+
BT130_InvoicedQuantityUnitOfMeasureCode?: string;
|
|
169
|
+
BT131_InvoiceLineNetAmount?: number;
|
|
170
|
+
BT132_ReferencedPurchaseOrderLineReference?: string;
|
|
171
|
+
BT133_InvoiceLineBuyerAccountingReference?: string;
|
|
172
|
+
BT134_InvoiceLinePeriodStartDate?: Date;
|
|
173
|
+
BT135_InvoiceLinePeriodEndDate?: Date;
|
|
174
|
+
BT136_InvoiceLineAllowanceAmount?: number;
|
|
175
|
+
BT137_InvoiceLineAllowanceBaseAmount?: number;
|
|
176
|
+
BT138_InvoiceLineAllowancePercentage?: number;
|
|
177
|
+
BT139_InvoiceLineAllowanceReason?: string;
|
|
178
|
+
BT140_InvoiceLineAllowanceReasonCode?: string;
|
|
179
|
+
BT141_InvoiceLineChargeAmount?: number;
|
|
180
|
+
BT142_InvoiceLineChargeBaseAmount?: number;
|
|
181
|
+
BT143_InvoiceLineChargePercentage?: number;
|
|
182
|
+
BT144_InvoiceLineChargeReason?: string;
|
|
183
|
+
BT145_InvoiceLineChargeReasonCode?: string;
|
|
184
|
+
BT146_ItemNetPrice?: number;
|
|
185
|
+
BT147_ItemPriceDiscount?: number;
|
|
186
|
+
BT148_ItemGrossPrice?: number;
|
|
187
|
+
BT149_ItemPriceBaseQuantity?: number;
|
|
188
|
+
BT150_ItemPriceBaseQuantityUnitOfMeasureCode?: string;
|
|
189
|
+
BT151_ItemVATCategoryCode?: string;
|
|
190
|
+
BT152_ItemVATRate?: number;
|
|
191
|
+
BT153_ItemName?: string;
|
|
192
|
+
BT154_ItemDescription?: string;
|
|
193
|
+
BT155_ItemSellersIdentifier?: string;
|
|
194
|
+
BT156_ItemBuyersIdentifier?: string;
|
|
195
|
+
BT157_ItemStandardIdentifier?: string;
|
|
196
|
+
BT158_ItemClassificationIdentifier?: string;
|
|
197
|
+
BT159_ItemClassificationListIdentifier?: string;
|
|
198
|
+
BT160_ItemOriginCountryCode?: string;
|
|
199
|
+
BT161_ItemAttributeName?: string;
|
|
200
|
+
BT162_ItemAttributeValue?: string;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Business Groups (BG) from EN16931
|
|
205
|
+
* Groups related business terms together
|
|
206
|
+
*/
|
|
207
|
+
export interface BusinessGroups {
|
|
208
|
+
BG1_InvoiceNote?: InvoiceNote;
|
|
209
|
+
BG2_ProcessControl?: ProcessControl;
|
|
210
|
+
BG3_PrecedingInvoiceReference?: PrecedingInvoiceReference[];
|
|
211
|
+
BG4_Seller: Seller;
|
|
212
|
+
BG5_SellerPostalAddress: PostalAddress;
|
|
213
|
+
BG6_SellerContact?: Contact;
|
|
214
|
+
BG7_Buyer: Buyer;
|
|
215
|
+
BG8_BuyerPostalAddress: PostalAddress;
|
|
216
|
+
BG9_BuyerContact?: Contact;
|
|
217
|
+
BG10_Payee?: Payee;
|
|
218
|
+
BG11_SellerTaxRepresentative?: TaxRepresentative;
|
|
219
|
+
BG12_PayerParty?: PayerParty;
|
|
220
|
+
BG13_DeliveryInformation?: DeliveryInformation;
|
|
221
|
+
BG14_InvoicingPeriod?: Period;
|
|
222
|
+
BG15_DeliverToAddress?: PostalAddress;
|
|
223
|
+
BG16_PaymentInstructions: PaymentInstructions;
|
|
224
|
+
BG17_PaymentCardInformation?: PaymentCardInformation;
|
|
225
|
+
BG18_DirectDebit?: DirectDebit;
|
|
226
|
+
BG19_PaymentTerms?: PaymentTerms;
|
|
227
|
+
BG20_DocumentLevelAllowances?: Allowance[];
|
|
228
|
+
BG21_DocumentLevelCharges?: Charge[];
|
|
229
|
+
BG22_DocumentTotals: DocumentTotals;
|
|
230
|
+
BG23_VATBreakdown?: VATBreakdown[];
|
|
231
|
+
BG24_AdditionalSupportingDocuments?: SupportingDocument[];
|
|
232
|
+
BG25_InvoiceLine: InvoiceLine[];
|
|
233
|
+
BG26_InvoiceLinePeriod?: Period;
|
|
234
|
+
BG27_InvoiceLineAllowances?: Allowance[];
|
|
235
|
+
BG28_InvoiceLineCharges?: Charge[];
|
|
236
|
+
BG29_PriceDetails?: PriceDetails;
|
|
237
|
+
BG30_LineVATInformation: VATInformation;
|
|
238
|
+
BG31_ItemInformation: ItemInformation;
|
|
239
|
+
BG32_ItemAttributes?: ItemAttribute[];
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Supporting types for Business Groups
|
|
244
|
+
*/
|
|
245
|
+
export interface InvoiceNote {
|
|
246
|
+
subjectCode?: string;
|
|
247
|
+
noteContent: string;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export interface ProcessControl {
|
|
251
|
+
businessProcessType?: string;
|
|
252
|
+
specificationIdentifier: string;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export interface PrecedingInvoiceReference {
|
|
256
|
+
referenceNumber: string;
|
|
257
|
+
issueDate?: Date;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export interface Seller {
|
|
261
|
+
name: string;
|
|
262
|
+
tradingName?: string;
|
|
263
|
+
identifier?: string;
|
|
264
|
+
legalRegistrationIdentifier?: string;
|
|
265
|
+
vatIdentifier?: string;
|
|
266
|
+
taxRegistrationIdentifier?: string;
|
|
267
|
+
additionalLegalInfo?: string;
|
|
268
|
+
electronicAddress?: string;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export interface Buyer {
|
|
272
|
+
name: string;
|
|
273
|
+
tradingName?: string;
|
|
274
|
+
identifier?: string;
|
|
275
|
+
legalRegistrationIdentifier?: string;
|
|
276
|
+
vatIdentifier?: string;
|
|
277
|
+
electronicAddress?: string;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export interface PostalAddress {
|
|
281
|
+
addressLine1?: string;
|
|
282
|
+
addressLine2?: string;
|
|
283
|
+
addressLine3?: string;
|
|
284
|
+
city?: string;
|
|
285
|
+
postCode?: string;
|
|
286
|
+
countrySubdivision?: string;
|
|
287
|
+
countryCode: string;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export interface Contact {
|
|
291
|
+
contactPoint?: string;
|
|
292
|
+
telephoneNumber?: string;
|
|
293
|
+
emailAddress?: string;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export interface Payee {
|
|
297
|
+
name: string;
|
|
298
|
+
identifier?: string;
|
|
299
|
+
legalRegistrationIdentifier?: string;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export interface TaxRepresentative {
|
|
303
|
+
name: string;
|
|
304
|
+
vatIdentifier: string;
|
|
305
|
+
postalAddress: PostalAddress;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export interface PayerParty {
|
|
309
|
+
name: string;
|
|
310
|
+
identifier?: string;
|
|
311
|
+
legalRegistrationIdentifier?: string;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export interface DeliveryInformation {
|
|
315
|
+
name?: string;
|
|
316
|
+
locationIdentifier?: string;
|
|
317
|
+
actualDeliveryDate?: Date;
|
|
318
|
+
deliveryAddress?: PostalAddress;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export interface Period {
|
|
322
|
+
startDate?: Date;
|
|
323
|
+
endDate?: Date;
|
|
324
|
+
descriptionCode?: string;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export interface PaymentInstructions {
|
|
328
|
+
paymentMeansTypeCode: string;
|
|
329
|
+
paymentMeansText?: string;
|
|
330
|
+
remittanceInformation?: string;
|
|
331
|
+
paymentAccountIdentifier?: string;
|
|
332
|
+
paymentAccountName?: string;
|
|
333
|
+
paymentServiceProviderIdentifier?: string;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export interface PaymentCardInformation {
|
|
337
|
+
primaryAccountNumber: string;
|
|
338
|
+
holderName?: string;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export interface DirectDebit {
|
|
342
|
+
mandateReferenceIdentifier?: string;
|
|
343
|
+
bankAssignedCreditorIdentifier?: string;
|
|
344
|
+
debitedAccountIdentifier?: string;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export interface PaymentTerms {
|
|
348
|
+
note?: string;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export interface Allowance {
|
|
352
|
+
amount: number;
|
|
353
|
+
baseAmount?: number;
|
|
354
|
+
percentage?: number;
|
|
355
|
+
vatCategoryCode?: string;
|
|
356
|
+
vatRate?: number;
|
|
357
|
+
reason?: string;
|
|
358
|
+
reasonCode?: string;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export interface Charge {
|
|
362
|
+
amount: number;
|
|
363
|
+
baseAmount?: number;
|
|
364
|
+
percentage?: number;
|
|
365
|
+
vatCategoryCode?: string;
|
|
366
|
+
vatRate?: number;
|
|
367
|
+
reason?: string;
|
|
368
|
+
reasonCode?: string;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
export interface DocumentTotals {
|
|
372
|
+
lineExtensionAmount: number;
|
|
373
|
+
taxExclusiveAmount: number;
|
|
374
|
+
taxInclusiveAmount: number;
|
|
375
|
+
allowanceTotalAmount?: number;
|
|
376
|
+
chargeTotalAmount?: number;
|
|
377
|
+
prepaidAmount?: number;
|
|
378
|
+
roundingAmount?: number;
|
|
379
|
+
payableAmount: number;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export interface VATBreakdown {
|
|
383
|
+
vatCategoryTaxableAmount: number;
|
|
384
|
+
vatCategoryTaxAmount: number;
|
|
385
|
+
vatCategoryCode: string;
|
|
386
|
+
vatCategoryRate?: number;
|
|
387
|
+
vatExemptionReasonText?: string;
|
|
388
|
+
vatExemptionReasonCode?: string;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
export interface SupportingDocument {
|
|
392
|
+
documentReference: string;
|
|
393
|
+
documentDescription?: string;
|
|
394
|
+
externalDocumentLocation?: string;
|
|
395
|
+
attachedDocument?: Attachment;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
export interface Attachment {
|
|
399
|
+
filename?: string;
|
|
400
|
+
mimeType?: string;
|
|
401
|
+
description?: string;
|
|
402
|
+
embeddedDocumentBinaryObject?: string;
|
|
403
|
+
externalDocumentURI?: string;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
export interface InvoiceLine {
|
|
407
|
+
identifier: string;
|
|
408
|
+
note?: string;
|
|
409
|
+
objectIdentifier?: string;
|
|
410
|
+
invoicedQuantity: number;
|
|
411
|
+
invoicedQuantityUnitOfMeasureCode: string;
|
|
412
|
+
lineExtensionAmount: number;
|
|
413
|
+
purchaseOrderLineReference?: string;
|
|
414
|
+
buyerAccountingReference?: string;
|
|
415
|
+
period?: Period;
|
|
416
|
+
allowances?: Allowance[];
|
|
417
|
+
charges?: Charge[];
|
|
418
|
+
priceDetails: PriceDetails;
|
|
419
|
+
vatInformation: VATInformation;
|
|
420
|
+
itemInformation: ItemInformation;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
export interface PriceDetails {
|
|
424
|
+
itemNetPrice: number;
|
|
425
|
+
itemPriceDiscount?: number;
|
|
426
|
+
itemGrossPrice?: number;
|
|
427
|
+
itemPriceBaseQuantity?: number;
|
|
428
|
+
itemPriceBaseQuantityUnitOfMeasureCode?: string;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
export interface VATInformation {
|
|
432
|
+
categoryCode: string;
|
|
433
|
+
rate?: number;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
export interface ItemInformation {
|
|
437
|
+
name: string;
|
|
438
|
+
description?: string;
|
|
439
|
+
sellersIdentifier?: string;
|
|
440
|
+
buyersIdentifier?: string;
|
|
441
|
+
standardIdentifier?: string;
|
|
442
|
+
classificationIdentifier?: string;
|
|
443
|
+
classificationListIdentifier?: string;
|
|
444
|
+
originCountryCode?: string;
|
|
445
|
+
attributes?: ItemAttribute[];
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
export interface ItemAttribute {
|
|
449
|
+
name: string;
|
|
450
|
+
value: string;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Complete EN16931 Semantic Model
|
|
455
|
+
* Combines all Business Terms and Business Groups
|
|
456
|
+
*/
|
|
457
|
+
export interface EN16931SemanticModel {
|
|
458
|
+
// Core document information
|
|
459
|
+
documentInformation: {
|
|
460
|
+
invoiceNumber: string; // BT-1
|
|
461
|
+
issueDate: Date; // BT-2
|
|
462
|
+
typeCode: string; // BT-3
|
|
463
|
+
currencyCode: string; // BT-5
|
|
464
|
+
notes?: InvoiceNote[]; // BG-1
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
// Process metadata
|
|
468
|
+
processControl?: ProcessControl; // BG-2
|
|
469
|
+
|
|
470
|
+
// References
|
|
471
|
+
references?: {
|
|
472
|
+
buyerReference?: string; // BT-10
|
|
473
|
+
projectReference?: string; // BT-11
|
|
474
|
+
contractReference?: string; // BT-12
|
|
475
|
+
purchaseOrderReference?: string; // BT-13
|
|
476
|
+
salesOrderReference?: string; // BT-14
|
|
477
|
+
precedingInvoices?: PrecedingInvoiceReference[]; // BG-3
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
// Parties
|
|
481
|
+
seller: Seller & { // BG-4
|
|
482
|
+
postalAddress: PostalAddress; // BG-5
|
|
483
|
+
contact?: Contact; // BG-6
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
buyer: Buyer & { // BG-7
|
|
487
|
+
postalAddress: PostalAddress; // BG-8
|
|
488
|
+
contact?: Contact; // BG-9
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
payee?: Payee; // BG-10
|
|
492
|
+
taxRepresentative?: TaxRepresentative; // BG-11
|
|
493
|
+
|
|
494
|
+
// Delivery
|
|
495
|
+
delivery?: DeliveryInformation; // BG-13
|
|
496
|
+
invoicingPeriod?: Period; // BG-14
|
|
497
|
+
|
|
498
|
+
// Payment
|
|
499
|
+
paymentInstructions: PaymentInstructions; // BG-16
|
|
500
|
+
paymentCardInfo?: PaymentCardInformation; // BG-17
|
|
501
|
+
directDebit?: DirectDebit; // BG-18
|
|
502
|
+
paymentTerms?: PaymentTerms; // BG-19
|
|
503
|
+
|
|
504
|
+
// Allowances and charges
|
|
505
|
+
documentLevelAllowances?: Allowance[]; // BG-20
|
|
506
|
+
documentLevelCharges?: Charge[]; // BG-21
|
|
507
|
+
|
|
508
|
+
// Totals
|
|
509
|
+
documentTotals: DocumentTotals; // BG-22
|
|
510
|
+
vatBreakdown?: VATBreakdown[]; // BG-23
|
|
511
|
+
|
|
512
|
+
// Supporting documents
|
|
513
|
+
additionalDocuments?: SupportingDocument[]; // BG-24
|
|
514
|
+
|
|
515
|
+
// Invoice lines
|
|
516
|
+
invoiceLines: InvoiceLine[]; // BG-25
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Semantic model version and metadata
|
|
521
|
+
*/
|
|
522
|
+
export const SEMANTIC_MODEL_VERSION = '1.3.0';
|
|
523
|
+
export const EN16931_VERSION = '1.3.14';
|
|
524
|
+
export const SUPPORTED_SYNTAXES = ['UBL', 'CII', 'EDIFACT'];
|