Skip to content

Commit

Permalink
Implemented writing XML files with most profiles
Browse files Browse the repository at this point in the history
This is currently missing support for a few fields and
is completely untested.
  • Loading branch information
srittau committed Aug 20, 2024
1 parent 27236e1 commit 4dfc2d6
Show file tree
Hide file tree
Showing 8 changed files with 1,664 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ See the [Factur-X website (French)](https://www.factur-x.org/) or
[FeRD website (German)](https://www.ferd-net.de/) for more information.

Currently, this library supports writing XML files according Factur-X Version
1.0.06 (aka ZUGFeRD 2.2) in the EN 16931 (Comfort) profile. Generally in scope
of this library, but currently not supported are:
1.0.06 (aka ZUGFeRD 2.2) in the profiles up to EN 16931 (Comfort). Generally
in scope of this library, but currently not supported are:

* Other profiles (Minimum, Basic, Basic WL, Extended, XRechnung).
* Reading Factur-X files.
* Extended and XRechnung profiles.
* Reading Factur-X files (XML or PDF).
* Embedding the XML in PDF files.
18 changes: 18 additions & 0 deletions src/facturx/const.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""
XML Utilities for PyFactur-X
"""

URN_MINIMUM_PROFILE = "urn:factur-x.eu:1p0:minimum"
URN_BASIC_WL_PROFILE = "urn:factur-x.eu:1p0:basicwl"
URN_BASIC_PROFILE = (
"urn:cen.eu:en16931:2017#compliant#urn:factur-x.eu:1p0:basic"
)
URN_EN16931_PROFILE = "urn:cen.eu:en16931:2017"
URN_EXTENDED_PROFILE = (
"urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended"
)
URN_XRECHNUNG_PROFILE = "urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.1" # noqa: E501

NS_CII = "urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
NS_RAM = "urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" # noqa: E501
NS_UDT = "urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
6 changes: 6 additions & 0 deletions src/facturx/countries.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import re


def validate_iso_3166_1_alpha_2(code: str) -> bool:
"""Validate an ISO 3166-1 country code in ALPHA-2 format."""
return re.match(r"^[A-Z]{2}$", code) is not None
Loading

0 comments on commit 4dfc2d6

Please sign in to comment.