@fin.cx/einvoice 5.0.2 → 5.1.2
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/package.json +13 -8
- 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,445 @@
|
|
|
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
|
+
* Business Term (BT) definitions from EN16931
|
|
8
|
+
* Each BT represents a specific data element in an invoice
|
|
9
|
+
*/
|
|
10
|
+
export interface BusinessTerms {
|
|
11
|
+
BT1_InvoiceNumber: string;
|
|
12
|
+
BT2_InvoiceIssueDate: Date;
|
|
13
|
+
BT3_InvoiceTypeCode: string;
|
|
14
|
+
BT4_InvoiceNote?: string;
|
|
15
|
+
BT5_InvoiceCurrencyCode: string;
|
|
16
|
+
BT6_VATAccountingCurrencyCode?: string;
|
|
17
|
+
BT7_ValueDateForVATCalculation?: Date;
|
|
18
|
+
BT8_InvoicePeriodDescriptionCode?: string;
|
|
19
|
+
BT9_DueDate?: Date;
|
|
20
|
+
BT10_BuyerReference?: string;
|
|
21
|
+
BT11_ProjectReference?: string;
|
|
22
|
+
BT12_ContractReference?: string;
|
|
23
|
+
BT13_PurchaseOrderReference?: string;
|
|
24
|
+
BT14_SalesOrderReference?: string;
|
|
25
|
+
BT15_ReceivingAdviceReference?: string;
|
|
26
|
+
BT16_DespatchAdviceReference?: string;
|
|
27
|
+
BT17_TenderOrLotReference?: string;
|
|
28
|
+
BT18_InvoicedObjectIdentifier?: string;
|
|
29
|
+
BT19_BuyerAccountingReference?: string;
|
|
30
|
+
BT20_PaymentTerms?: string;
|
|
31
|
+
BT21_InvoiceNote?: string[];
|
|
32
|
+
BT22_ProcessSpecificNote?: string;
|
|
33
|
+
BT23_BusinessProcessType?: string;
|
|
34
|
+
BT24_SpecificationIdentifier?: string;
|
|
35
|
+
BT25_InvoiceAttachment?: Attachment[];
|
|
36
|
+
BT26_InvoiceDocumentReference?: string;
|
|
37
|
+
BT27_SellerName: string;
|
|
38
|
+
BT28_SellerTradingName?: string;
|
|
39
|
+
BT29_SellerIdentifier?: string;
|
|
40
|
+
BT30_SellerLegalRegistrationIdentifier?: string;
|
|
41
|
+
BT31_SellerVATIdentifier?: string;
|
|
42
|
+
BT32_SellerTaxRegistrationIdentifier?: string;
|
|
43
|
+
BT33_SellerAdditionalLegalInfo?: string;
|
|
44
|
+
BT34_SellerElectronicAddress?: string;
|
|
45
|
+
BT35_SellerAddressLine1?: string;
|
|
46
|
+
BT36_SellerAddressLine2?: string;
|
|
47
|
+
BT37_SellerAddressLine3?: string;
|
|
48
|
+
BT38_SellerCity?: string;
|
|
49
|
+
BT39_SellerPostCode?: string;
|
|
50
|
+
BT40_SellerCountryCode: string;
|
|
51
|
+
BT41_SellerContactPoint?: string;
|
|
52
|
+
BT42_SellerContactTelephoneNumber?: string;
|
|
53
|
+
BT43_SellerContactEmailAddress?: string;
|
|
54
|
+
BT44_BuyerName: string;
|
|
55
|
+
BT45_BuyerTradingName?: string;
|
|
56
|
+
BT46_BuyerIdentifier?: string;
|
|
57
|
+
BT47_BuyerLegalRegistrationIdentifier?: string;
|
|
58
|
+
BT48_BuyerVATIdentifier?: string;
|
|
59
|
+
BT49_BuyerElectronicAddress?: string;
|
|
60
|
+
BT50_BuyerAddressLine1?: string;
|
|
61
|
+
BT51_BuyerAddressLine2?: string;
|
|
62
|
+
BT52_BuyerAddressLine3?: string;
|
|
63
|
+
BT53_BuyerCity?: string;
|
|
64
|
+
BT54_BuyerPostCode?: string;
|
|
65
|
+
BT55_BuyerCountryCode: string;
|
|
66
|
+
BT56_BuyerContactPoint?: string;
|
|
67
|
+
BT57_BuyerContactTelephoneNumber?: string;
|
|
68
|
+
BT58_BuyerContactEmailAddress?: string;
|
|
69
|
+
BT59_PayeeName?: string;
|
|
70
|
+
BT60_PayeeIdentifier?: string;
|
|
71
|
+
BT61_PayeeLegalRegistrationIdentifier?: string;
|
|
72
|
+
BT62_PayeeLegalRegistrationIdentifierSchemeID?: string;
|
|
73
|
+
BT63_SellerTaxRepresentativeName?: string;
|
|
74
|
+
BT64_SellerTaxRepresentativeVATIdentifier?: string;
|
|
75
|
+
BT65_SellerTaxRepresentativeAddressLine1?: string;
|
|
76
|
+
BT66_SellerTaxRepresentativeAddressLine2?: string;
|
|
77
|
+
BT67_SellerTaxRepresentativeCity?: string;
|
|
78
|
+
BT68_SellerTaxRepresentativePostCode?: string;
|
|
79
|
+
BT69_SellerTaxRepresentativeCountryCode?: string;
|
|
80
|
+
BT70_DeliveryName?: string;
|
|
81
|
+
BT71_DeliveryLocationIdentifier?: string;
|
|
82
|
+
BT72_ActualDeliveryDate?: Date;
|
|
83
|
+
BT73_InvoicingPeriodStartDate?: Date;
|
|
84
|
+
BT74_InvoicingPeriodEndDate?: Date;
|
|
85
|
+
BT75_DeliveryAddressLine1?: string;
|
|
86
|
+
BT76_DeliveryAddressLine2?: string;
|
|
87
|
+
BT77_DeliveryAddressLine3?: string;
|
|
88
|
+
BT78_DeliveryCity?: string;
|
|
89
|
+
BT79_DeliveryPostCode?: string;
|
|
90
|
+
BT80_DeliveryCountryCode?: string;
|
|
91
|
+
BT81_PaymentMeansTypeCode: string;
|
|
92
|
+
BT82_PaymentMeansText?: string;
|
|
93
|
+
BT83_RemittanceInformation?: string;
|
|
94
|
+
BT84_PaymentAccountIdentifier?: string;
|
|
95
|
+
BT85_PaymentAccountName?: string;
|
|
96
|
+
BT86_PaymentServiceProviderIdentifier?: string;
|
|
97
|
+
BT87_PaymentCardAccountPrimaryNumber?: string;
|
|
98
|
+
BT88_PaymentCardAccountHolderName?: string;
|
|
99
|
+
BT89_MandateReferenceIdentifier?: string;
|
|
100
|
+
BT90_BankAssignedCreditorIdentifier?: string;
|
|
101
|
+
BT91_DebitedAccountIdentifier?: string;
|
|
102
|
+
BT92_DocumentLevelAllowanceAmount?: number;
|
|
103
|
+
BT93_DocumentLevelAllowanceBaseAmount?: number;
|
|
104
|
+
BT94_DocumentLevelAllowancePercentage?: number;
|
|
105
|
+
BT95_DocumentLevelAllowanceVATCategoryCode?: string;
|
|
106
|
+
BT96_DocumentLevelAllowanceVATRate?: number;
|
|
107
|
+
BT97_DocumentLevelAllowanceReason?: string;
|
|
108
|
+
BT98_DocumentLevelAllowanceReasonCode?: string;
|
|
109
|
+
BT99_DocumentLevelChargeAmount?: number;
|
|
110
|
+
BT100_DocumentLevelChargeBaseAmount?: number;
|
|
111
|
+
BT101_DocumentLevelChargePercentage?: number;
|
|
112
|
+
BT102_DocumentLevelChargeVATCategoryCode?: string;
|
|
113
|
+
BT103_DocumentLevelChargeVATRate?: number;
|
|
114
|
+
BT104_DocumentLevelChargeReason?: string;
|
|
115
|
+
BT105_DocumentLevelChargeReasonCode?: string;
|
|
116
|
+
BT106_SumOfInvoiceLineNetAmount: number;
|
|
117
|
+
BT107_SumOfAllowancesOnDocumentLevel?: number;
|
|
118
|
+
BT108_SumOfChargesOnDocumentLevel?: number;
|
|
119
|
+
BT109_InvoiceTotalAmountWithoutVAT: number;
|
|
120
|
+
BT110_InvoiceTotalVATAmount?: number;
|
|
121
|
+
BT111_InvoiceTotalVATAmountInAccountingCurrency?: number;
|
|
122
|
+
BT112_InvoiceTotalAmountWithVAT: number;
|
|
123
|
+
BT113_PaidAmount?: number;
|
|
124
|
+
BT114_RoundingAmount?: number;
|
|
125
|
+
BT115_AmountDueForPayment: number;
|
|
126
|
+
BT116_VATCategoryTaxableAmount?: number;
|
|
127
|
+
BT117_VATCategoryTaxAmount?: number;
|
|
128
|
+
BT118_VATCategoryCode?: string;
|
|
129
|
+
BT119_VATCategoryRate?: number;
|
|
130
|
+
BT120_VATExemptionReasonText?: string;
|
|
131
|
+
BT121_VATExemptionReasonCode?: string;
|
|
132
|
+
BT122_SupportingDocumentReference?: string;
|
|
133
|
+
BT123_SupportingDocumentDescription?: string;
|
|
134
|
+
BT124_ExternalDocumentLocation?: string;
|
|
135
|
+
BT125_AttachedDocumentEmbedded?: string;
|
|
136
|
+
BT126_InvoiceLineIdentifier?: string;
|
|
137
|
+
BT127_InvoiceLineNote?: string;
|
|
138
|
+
BT128_InvoiceLineObjectIdentifier?: string;
|
|
139
|
+
BT129_InvoicedQuantity?: number;
|
|
140
|
+
BT130_InvoicedQuantityUnitOfMeasureCode?: string;
|
|
141
|
+
BT131_InvoiceLineNetAmount?: number;
|
|
142
|
+
BT132_ReferencedPurchaseOrderLineReference?: string;
|
|
143
|
+
BT133_InvoiceLineBuyerAccountingReference?: string;
|
|
144
|
+
BT134_InvoiceLinePeriodStartDate?: Date;
|
|
145
|
+
BT135_InvoiceLinePeriodEndDate?: Date;
|
|
146
|
+
BT136_InvoiceLineAllowanceAmount?: number;
|
|
147
|
+
BT137_InvoiceLineAllowanceBaseAmount?: number;
|
|
148
|
+
BT138_InvoiceLineAllowancePercentage?: number;
|
|
149
|
+
BT139_InvoiceLineAllowanceReason?: string;
|
|
150
|
+
BT140_InvoiceLineAllowanceReasonCode?: string;
|
|
151
|
+
BT141_InvoiceLineChargeAmount?: number;
|
|
152
|
+
BT142_InvoiceLineChargeBaseAmount?: number;
|
|
153
|
+
BT143_InvoiceLineChargePercentage?: number;
|
|
154
|
+
BT144_InvoiceLineChargeReason?: string;
|
|
155
|
+
BT145_InvoiceLineChargeReasonCode?: string;
|
|
156
|
+
BT146_ItemNetPrice?: number;
|
|
157
|
+
BT147_ItemPriceDiscount?: number;
|
|
158
|
+
BT148_ItemGrossPrice?: number;
|
|
159
|
+
BT149_ItemPriceBaseQuantity?: number;
|
|
160
|
+
BT150_ItemPriceBaseQuantityUnitOfMeasureCode?: string;
|
|
161
|
+
BT151_ItemVATCategoryCode?: string;
|
|
162
|
+
BT152_ItemVATRate?: number;
|
|
163
|
+
BT153_ItemName?: string;
|
|
164
|
+
BT154_ItemDescription?: string;
|
|
165
|
+
BT155_ItemSellersIdentifier?: string;
|
|
166
|
+
BT156_ItemBuyersIdentifier?: string;
|
|
167
|
+
BT157_ItemStandardIdentifier?: string;
|
|
168
|
+
BT158_ItemClassificationIdentifier?: string;
|
|
169
|
+
BT159_ItemClassificationListIdentifier?: string;
|
|
170
|
+
BT160_ItemOriginCountryCode?: string;
|
|
171
|
+
BT161_ItemAttributeName?: string;
|
|
172
|
+
BT162_ItemAttributeValue?: string;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Business Groups (BG) from EN16931
|
|
176
|
+
* Groups related business terms together
|
|
177
|
+
*/
|
|
178
|
+
export interface BusinessGroups {
|
|
179
|
+
BG1_InvoiceNote?: InvoiceNote;
|
|
180
|
+
BG2_ProcessControl?: ProcessControl;
|
|
181
|
+
BG3_PrecedingInvoiceReference?: PrecedingInvoiceReference[];
|
|
182
|
+
BG4_Seller: Seller;
|
|
183
|
+
BG5_SellerPostalAddress: PostalAddress;
|
|
184
|
+
BG6_SellerContact?: Contact;
|
|
185
|
+
BG7_Buyer: Buyer;
|
|
186
|
+
BG8_BuyerPostalAddress: PostalAddress;
|
|
187
|
+
BG9_BuyerContact?: Contact;
|
|
188
|
+
BG10_Payee?: Payee;
|
|
189
|
+
BG11_SellerTaxRepresentative?: TaxRepresentative;
|
|
190
|
+
BG12_PayerParty?: PayerParty;
|
|
191
|
+
BG13_DeliveryInformation?: DeliveryInformation;
|
|
192
|
+
BG14_InvoicingPeriod?: Period;
|
|
193
|
+
BG15_DeliverToAddress?: PostalAddress;
|
|
194
|
+
BG16_PaymentInstructions: PaymentInstructions;
|
|
195
|
+
BG17_PaymentCardInformation?: PaymentCardInformation;
|
|
196
|
+
BG18_DirectDebit?: DirectDebit;
|
|
197
|
+
BG19_PaymentTerms?: PaymentTerms;
|
|
198
|
+
BG20_DocumentLevelAllowances?: Allowance[];
|
|
199
|
+
BG21_DocumentLevelCharges?: Charge[];
|
|
200
|
+
BG22_DocumentTotals: DocumentTotals;
|
|
201
|
+
BG23_VATBreakdown?: VATBreakdown[];
|
|
202
|
+
BG24_AdditionalSupportingDocuments?: SupportingDocument[];
|
|
203
|
+
BG25_InvoiceLine: InvoiceLine[];
|
|
204
|
+
BG26_InvoiceLinePeriod?: Period;
|
|
205
|
+
BG27_InvoiceLineAllowances?: Allowance[];
|
|
206
|
+
BG28_InvoiceLineCharges?: Charge[];
|
|
207
|
+
BG29_PriceDetails?: PriceDetails;
|
|
208
|
+
BG30_LineVATInformation: VATInformation;
|
|
209
|
+
BG31_ItemInformation: ItemInformation;
|
|
210
|
+
BG32_ItemAttributes?: ItemAttribute[];
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Supporting types for Business Groups
|
|
214
|
+
*/
|
|
215
|
+
export interface InvoiceNote {
|
|
216
|
+
subjectCode?: string;
|
|
217
|
+
noteContent: string;
|
|
218
|
+
}
|
|
219
|
+
export interface ProcessControl {
|
|
220
|
+
businessProcessType?: string;
|
|
221
|
+
specificationIdentifier: string;
|
|
222
|
+
}
|
|
223
|
+
export interface PrecedingInvoiceReference {
|
|
224
|
+
referenceNumber: string;
|
|
225
|
+
issueDate?: Date;
|
|
226
|
+
}
|
|
227
|
+
export interface Seller {
|
|
228
|
+
name: string;
|
|
229
|
+
tradingName?: string;
|
|
230
|
+
identifier?: string;
|
|
231
|
+
legalRegistrationIdentifier?: string;
|
|
232
|
+
vatIdentifier?: string;
|
|
233
|
+
taxRegistrationIdentifier?: string;
|
|
234
|
+
additionalLegalInfo?: string;
|
|
235
|
+
electronicAddress?: string;
|
|
236
|
+
}
|
|
237
|
+
export interface Buyer {
|
|
238
|
+
name: string;
|
|
239
|
+
tradingName?: string;
|
|
240
|
+
identifier?: string;
|
|
241
|
+
legalRegistrationIdentifier?: string;
|
|
242
|
+
vatIdentifier?: string;
|
|
243
|
+
electronicAddress?: string;
|
|
244
|
+
}
|
|
245
|
+
export interface PostalAddress {
|
|
246
|
+
addressLine1?: string;
|
|
247
|
+
addressLine2?: string;
|
|
248
|
+
addressLine3?: string;
|
|
249
|
+
city?: string;
|
|
250
|
+
postCode?: string;
|
|
251
|
+
countrySubdivision?: string;
|
|
252
|
+
countryCode: string;
|
|
253
|
+
}
|
|
254
|
+
export interface Contact {
|
|
255
|
+
contactPoint?: string;
|
|
256
|
+
telephoneNumber?: string;
|
|
257
|
+
emailAddress?: string;
|
|
258
|
+
}
|
|
259
|
+
export interface Payee {
|
|
260
|
+
name: string;
|
|
261
|
+
identifier?: string;
|
|
262
|
+
legalRegistrationIdentifier?: string;
|
|
263
|
+
}
|
|
264
|
+
export interface TaxRepresentative {
|
|
265
|
+
name: string;
|
|
266
|
+
vatIdentifier: string;
|
|
267
|
+
postalAddress: PostalAddress;
|
|
268
|
+
}
|
|
269
|
+
export interface PayerParty {
|
|
270
|
+
name: string;
|
|
271
|
+
identifier?: string;
|
|
272
|
+
legalRegistrationIdentifier?: string;
|
|
273
|
+
}
|
|
274
|
+
export interface DeliveryInformation {
|
|
275
|
+
name?: string;
|
|
276
|
+
locationIdentifier?: string;
|
|
277
|
+
actualDeliveryDate?: Date;
|
|
278
|
+
deliveryAddress?: PostalAddress;
|
|
279
|
+
}
|
|
280
|
+
export interface Period {
|
|
281
|
+
startDate?: Date;
|
|
282
|
+
endDate?: Date;
|
|
283
|
+
descriptionCode?: string;
|
|
284
|
+
}
|
|
285
|
+
export interface PaymentInstructions {
|
|
286
|
+
paymentMeansTypeCode: string;
|
|
287
|
+
paymentMeansText?: string;
|
|
288
|
+
remittanceInformation?: string;
|
|
289
|
+
paymentAccountIdentifier?: string;
|
|
290
|
+
paymentAccountName?: string;
|
|
291
|
+
paymentServiceProviderIdentifier?: string;
|
|
292
|
+
}
|
|
293
|
+
export interface PaymentCardInformation {
|
|
294
|
+
primaryAccountNumber: string;
|
|
295
|
+
holderName?: string;
|
|
296
|
+
}
|
|
297
|
+
export interface DirectDebit {
|
|
298
|
+
mandateReferenceIdentifier?: string;
|
|
299
|
+
bankAssignedCreditorIdentifier?: string;
|
|
300
|
+
debitedAccountIdentifier?: string;
|
|
301
|
+
}
|
|
302
|
+
export interface PaymentTerms {
|
|
303
|
+
note?: string;
|
|
304
|
+
}
|
|
305
|
+
export interface Allowance {
|
|
306
|
+
amount: number;
|
|
307
|
+
baseAmount?: number;
|
|
308
|
+
percentage?: number;
|
|
309
|
+
vatCategoryCode?: string;
|
|
310
|
+
vatRate?: number;
|
|
311
|
+
reason?: string;
|
|
312
|
+
reasonCode?: string;
|
|
313
|
+
}
|
|
314
|
+
export interface Charge {
|
|
315
|
+
amount: number;
|
|
316
|
+
baseAmount?: number;
|
|
317
|
+
percentage?: number;
|
|
318
|
+
vatCategoryCode?: string;
|
|
319
|
+
vatRate?: number;
|
|
320
|
+
reason?: string;
|
|
321
|
+
reasonCode?: string;
|
|
322
|
+
}
|
|
323
|
+
export interface DocumentTotals {
|
|
324
|
+
lineExtensionAmount: number;
|
|
325
|
+
taxExclusiveAmount: number;
|
|
326
|
+
taxInclusiveAmount: number;
|
|
327
|
+
allowanceTotalAmount?: number;
|
|
328
|
+
chargeTotalAmount?: number;
|
|
329
|
+
prepaidAmount?: number;
|
|
330
|
+
roundingAmount?: number;
|
|
331
|
+
payableAmount: number;
|
|
332
|
+
}
|
|
333
|
+
export interface VATBreakdown {
|
|
334
|
+
vatCategoryTaxableAmount: number;
|
|
335
|
+
vatCategoryTaxAmount: number;
|
|
336
|
+
vatCategoryCode: string;
|
|
337
|
+
vatCategoryRate?: number;
|
|
338
|
+
vatExemptionReasonText?: string;
|
|
339
|
+
vatExemptionReasonCode?: string;
|
|
340
|
+
}
|
|
341
|
+
export interface SupportingDocument {
|
|
342
|
+
documentReference: string;
|
|
343
|
+
documentDescription?: string;
|
|
344
|
+
externalDocumentLocation?: string;
|
|
345
|
+
attachedDocument?: Attachment;
|
|
346
|
+
}
|
|
347
|
+
export interface Attachment {
|
|
348
|
+
filename?: string;
|
|
349
|
+
mimeType?: string;
|
|
350
|
+
description?: string;
|
|
351
|
+
embeddedDocumentBinaryObject?: string;
|
|
352
|
+
externalDocumentURI?: string;
|
|
353
|
+
}
|
|
354
|
+
export interface InvoiceLine {
|
|
355
|
+
identifier: string;
|
|
356
|
+
note?: string;
|
|
357
|
+
objectIdentifier?: string;
|
|
358
|
+
invoicedQuantity: number;
|
|
359
|
+
invoicedQuantityUnitOfMeasureCode: string;
|
|
360
|
+
lineExtensionAmount: number;
|
|
361
|
+
purchaseOrderLineReference?: string;
|
|
362
|
+
buyerAccountingReference?: string;
|
|
363
|
+
period?: Period;
|
|
364
|
+
allowances?: Allowance[];
|
|
365
|
+
charges?: Charge[];
|
|
366
|
+
priceDetails: PriceDetails;
|
|
367
|
+
vatInformation: VATInformation;
|
|
368
|
+
itemInformation: ItemInformation;
|
|
369
|
+
}
|
|
370
|
+
export interface PriceDetails {
|
|
371
|
+
itemNetPrice: number;
|
|
372
|
+
itemPriceDiscount?: number;
|
|
373
|
+
itemGrossPrice?: number;
|
|
374
|
+
itemPriceBaseQuantity?: number;
|
|
375
|
+
itemPriceBaseQuantityUnitOfMeasureCode?: string;
|
|
376
|
+
}
|
|
377
|
+
export interface VATInformation {
|
|
378
|
+
categoryCode: string;
|
|
379
|
+
rate?: number;
|
|
380
|
+
}
|
|
381
|
+
export interface ItemInformation {
|
|
382
|
+
name: string;
|
|
383
|
+
description?: string;
|
|
384
|
+
sellersIdentifier?: string;
|
|
385
|
+
buyersIdentifier?: string;
|
|
386
|
+
standardIdentifier?: string;
|
|
387
|
+
classificationIdentifier?: string;
|
|
388
|
+
classificationListIdentifier?: string;
|
|
389
|
+
originCountryCode?: string;
|
|
390
|
+
attributes?: ItemAttribute[];
|
|
391
|
+
}
|
|
392
|
+
export interface ItemAttribute {
|
|
393
|
+
name: string;
|
|
394
|
+
value: string;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Complete EN16931 Semantic Model
|
|
398
|
+
* Combines all Business Terms and Business Groups
|
|
399
|
+
*/
|
|
400
|
+
export interface EN16931SemanticModel {
|
|
401
|
+
documentInformation: {
|
|
402
|
+
invoiceNumber: string;
|
|
403
|
+
issueDate: Date;
|
|
404
|
+
typeCode: string;
|
|
405
|
+
currencyCode: string;
|
|
406
|
+
notes?: InvoiceNote[];
|
|
407
|
+
};
|
|
408
|
+
processControl?: ProcessControl;
|
|
409
|
+
references?: {
|
|
410
|
+
buyerReference?: string;
|
|
411
|
+
projectReference?: string;
|
|
412
|
+
contractReference?: string;
|
|
413
|
+
purchaseOrderReference?: string;
|
|
414
|
+
salesOrderReference?: string;
|
|
415
|
+
precedingInvoices?: PrecedingInvoiceReference[];
|
|
416
|
+
};
|
|
417
|
+
seller: Seller & {
|
|
418
|
+
postalAddress: PostalAddress;
|
|
419
|
+
contact?: Contact;
|
|
420
|
+
};
|
|
421
|
+
buyer: Buyer & {
|
|
422
|
+
postalAddress: PostalAddress;
|
|
423
|
+
contact?: Contact;
|
|
424
|
+
};
|
|
425
|
+
payee?: Payee;
|
|
426
|
+
taxRepresentative?: TaxRepresentative;
|
|
427
|
+
delivery?: DeliveryInformation;
|
|
428
|
+
invoicingPeriod?: Period;
|
|
429
|
+
paymentInstructions: PaymentInstructions;
|
|
430
|
+
paymentCardInfo?: PaymentCardInformation;
|
|
431
|
+
directDebit?: DirectDebit;
|
|
432
|
+
paymentTerms?: PaymentTerms;
|
|
433
|
+
documentLevelAllowances?: Allowance[];
|
|
434
|
+
documentLevelCharges?: Charge[];
|
|
435
|
+
documentTotals: DocumentTotals;
|
|
436
|
+
vatBreakdown?: VATBreakdown[];
|
|
437
|
+
additionalDocuments?: SupportingDocument[];
|
|
438
|
+
invoiceLines: InvoiceLine[];
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Semantic model version and metadata
|
|
442
|
+
*/
|
|
443
|
+
export declare const SEMANTIC_MODEL_VERSION = "1.3.0";
|
|
444
|
+
export declare const EN16931_VERSION = "1.3.14";
|
|
445
|
+
export declare const SUPPORTED_SYNTAXES: string[];
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
* Semantic model version and metadata
|
|
8
|
+
*/
|
|
9
|
+
export const SEMANTIC_MODEL_VERSION = '1.3.0';
|
|
10
|
+
export const EN16931_VERSION = '1.3.14';
|
|
11
|
+
export const SUPPORTED_SYNTAXES = ['UBL', 'CII', 'EDIFACT'];
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnQtYmcubW9kZWwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi90cy9mb3JtYXRzL3NlbWFudGljL2J0LWJnLm1vZGVsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7O0dBSUc7QUFrZ0JIOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sc0JBQXNCLEdBQUcsT0FBTyxDQUFDO0FBQzlDLE1BQU0sQ0FBQyxNQUFNLGVBQWUsR0FBRyxRQUFRLENBQUM7QUFDeEMsTUFBTSxDQUFDLE1BQU0sa0JBQWtCLEdBQUcsQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFLFNBQVMsQ0FBQyxDQUFDIn0=
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter for converting between EInvoice and EN16931 Semantic Model
|
|
3
|
+
* Provides bidirectional conversion capabilities
|
|
4
|
+
*/
|
|
5
|
+
import { EInvoice } from '../../einvoice.js';
|
|
6
|
+
import type { EN16931SemanticModel } from './bt-bg.model.js';
|
|
7
|
+
/**
|
|
8
|
+
* Adapter for converting between EInvoice and EN16931 Semantic Model
|
|
9
|
+
*/
|
|
10
|
+
export declare class SemanticModelAdapter {
|
|
11
|
+
/**
|
|
12
|
+
* Convert EInvoice to EN16931 Semantic Model
|
|
13
|
+
*/
|
|
14
|
+
toSemanticModel(invoice: EInvoice): EN16931SemanticModel;
|
|
15
|
+
/**
|
|
16
|
+
* Convert EN16931 Semantic Model to EInvoice
|
|
17
|
+
*/
|
|
18
|
+
fromSemanticModel(model: EN16931SemanticModel): EInvoice;
|
|
19
|
+
/**
|
|
20
|
+
* Map invoice type code
|
|
21
|
+
*/
|
|
22
|
+
private mapInvoiceType;
|
|
23
|
+
/**
|
|
24
|
+
* Reverse map invoice type code
|
|
25
|
+
*/
|
|
26
|
+
private reverseMapInvoiceType;
|
|
27
|
+
/**
|
|
28
|
+
* Map notes
|
|
29
|
+
*/
|
|
30
|
+
private mapNotes;
|
|
31
|
+
/**
|
|
32
|
+
* Map seller information
|
|
33
|
+
*/
|
|
34
|
+
private mapSeller;
|
|
35
|
+
/**
|
|
36
|
+
* Map buyer information
|
|
37
|
+
*/
|
|
38
|
+
private mapBuyer;
|
|
39
|
+
/**
|
|
40
|
+
* Map address
|
|
41
|
+
*/
|
|
42
|
+
private mapAddress;
|
|
43
|
+
/**
|
|
44
|
+
* Map contact information
|
|
45
|
+
*/
|
|
46
|
+
private mapContact;
|
|
47
|
+
/**
|
|
48
|
+
* Map delivery information
|
|
49
|
+
*/
|
|
50
|
+
private mapDelivery;
|
|
51
|
+
/**
|
|
52
|
+
* Map payment instructions
|
|
53
|
+
*/
|
|
54
|
+
private mapPaymentInstructions;
|
|
55
|
+
/**
|
|
56
|
+
* Map document totals
|
|
57
|
+
*/
|
|
58
|
+
private mapDocumentTotals;
|
|
59
|
+
/**
|
|
60
|
+
* Map VAT breakdown
|
|
61
|
+
*/
|
|
62
|
+
private mapVATBreakdown;
|
|
63
|
+
/**
|
|
64
|
+
* Map invoice lines
|
|
65
|
+
*/
|
|
66
|
+
private mapInvoiceLines;
|
|
67
|
+
/**
|
|
68
|
+
* Map VAT category from percentage
|
|
69
|
+
*/
|
|
70
|
+
private mapVATCategory;
|
|
71
|
+
/**
|
|
72
|
+
* Reverse map seller
|
|
73
|
+
*/
|
|
74
|
+
private reverseMapSeller;
|
|
75
|
+
/**
|
|
76
|
+
* Reverse map buyer
|
|
77
|
+
*/
|
|
78
|
+
private reverseMapBuyer;
|
|
79
|
+
/**
|
|
80
|
+
* Reverse map invoice lines
|
|
81
|
+
*/
|
|
82
|
+
private reverseMapInvoiceLines;
|
|
83
|
+
/**
|
|
84
|
+
* Validate semantic model completeness
|
|
85
|
+
*/
|
|
86
|
+
validateSemanticModel(model: EN16931SemanticModel): string[];
|
|
87
|
+
}
|