factur-x-builder 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +16 -0
- data/README.md +26 -0
- data/lib/factur_x/document.rb +1 -0
- data/lib/factur_x/party.rb +9 -1
- data/lib/factur_x/schemas/Factur-X_1.09_EN16931_ReusableAggregateBusinessInformationEntity_100.xsd +2 -2
- data/lib/factur_x/schemas/Factur-X_EN16931.xsd +3 -3
- data/lib/factur_x/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ac6a0f9f68bea474096e87b73b676318343d3aff63d83dbc452f742a67ebb8f8
|
|
4
|
+
data.tar.gz: 7c07d34573f36f5f16ce094ab8f84df948d288ab052e3a3c69ea1370176b1470
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3cff2a09eae0ec30028c99e5453a5149154b9b45869dfa4bd88950e4803aeb58af4455f49b154f2e1b715ffe5877e38cdff482b0e190a57bab9fc4cc9af1afdd
|
|
7
|
+
data.tar.gz: 7376dda081fe40784a55c71554215951cf7ec4d0f2a2f67e76e0370bbf0b8b927da565e1754722e2890b8591becb670ce3472d523f0040569f05a9d65e56e72e
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
|
+
## [Unreleased]
|
|
2
|
+
|
|
3
|
+
### Fixed
|
|
4
|
+
|
|
5
|
+
- The vendored XSD files were renamed without updating the `schemaLocation` of the files that
|
|
6
|
+
import them, which made every `FacturX.build` raise `Nokogiri::XML::SyntaxError`. A test now
|
|
7
|
+
checks that the schema compiles and that every `schemaLocation` resolves to an existing file.
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `Party#legal_information` (BT-33, seller additional legal information), emitted as
|
|
12
|
+
`SellerTradeParty/Description`: legal form, share capital, RCS registration, or a registered
|
|
13
|
+
office that differs from the invoicing establishment. EN 16931 allows a single postal address
|
|
14
|
+
per party, so this is the only structured place for a second one.
|
|
15
|
+
|
|
1
16
|
## [0.1.0] - 2026-08-05
|
|
2
17
|
|
|
3
18
|
- Initial release
|
|
19
|
+
|
|
4
20
|
### Added
|
|
5
21
|
|
|
6
22
|
- `FacturX.build` generates an EN 16931 `factur-x.xml` document from invoicing domain objects:
|
data/README.md
CHANGED
|
@@ -112,6 +112,32 @@ FacturX.violations(invoice) # => ["...", "..."]
|
|
|
112
112
|
FacturX.valid?(invoice) # => false
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
+
### One address per party
|
|
116
|
+
|
|
117
|
+
EN 16931 gives each party exactly one `PostalTradeAddress`, and it must be the address of the
|
|
118
|
+
establishment identified by the SIRET carried in `GlobalID`. There is no second slot: the element
|
|
119
|
+
that would hold a registered office, `SpecifiedLegalOrganization/PostalTradeAddress`, exists in the
|
|
120
|
+
`extended` XSD but the French CTC schematron forbids it (`CII-SR-225`), as it forbids
|
|
121
|
+
`ShipFromTradeParty` (`CII-SR-166`).
|
|
122
|
+
|
|
123
|
+
When the registered office differs from the invoicing establishment, it belongs in BT-33:
|
|
124
|
+
|
|
125
|
+
```ruby
|
|
126
|
+
FacturX::Party.new(
|
|
127
|
+
name: "OFFICE DE TOURISME DES MONTS FICTIFS - Établissement de Chambéry",
|
|
128
|
+
legal_information: "SARL au capital de 50 000 € - RCS Clermont-Ferrand 398 765 438 - " \
|
|
129
|
+
"Siège social : 4 boulevard des Sources, 63240 LE MONT-FICTIF",
|
|
130
|
+
siret: "39876543800005",
|
|
131
|
+
siren: "398765438",
|
|
132
|
+
vat_number: "FR79398765438",
|
|
133
|
+
address: FacturX::Address.new(line_one: "8 rue des Entrepôts", postcode: "73000",
|
|
134
|
+
city: "Chambéry", country_code: "FR")
|
|
135
|
+
)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
BT-33 is free text — the counterpart of `cbc:CompanyLegalForm` in UBL. Receivers display it, they do
|
|
139
|
+
not parse it.
|
|
140
|
+
|
|
115
141
|
### Profiles
|
|
116
142
|
|
|
117
143
|
By default the French e-invoicing rules apply on top of EN 16931: an invoicing mode (BT-23) and the
|
data/lib/factur_x/document.rb
CHANGED
|
@@ -306,6 +306,7 @@ module FacturX
|
|
|
306
306
|
xml["ram"].send(element_name) do
|
|
307
307
|
text(xml, :GlobalID, party.global_id, scheme_attribute(party.global_id_scheme))
|
|
308
308
|
text(xml, :Name, party.name)
|
|
309
|
+
text(xml, :Description, party.legal_information)
|
|
309
310
|
emit_legal_organization(xml, party)
|
|
310
311
|
emit_contact(xml, party)
|
|
311
312
|
emit_address(xml, party.address)
|
data/lib/factur_x/party.rb
CHANGED
|
@@ -9,18 +9,26 @@ module FacturX
|
|
|
9
9
|
# (scheme 0009), `siren` the legal organization ID (scheme 0002), and
|
|
10
10
|
# `routing_id` the electronic address (scheme 0225) used to route the
|
|
11
11
|
# invoice through the PPF, defaulting to the SIRET.
|
|
12
|
+
#
|
|
13
|
+
# `legal_information` is BT-33, the seller's additional legal information:
|
|
14
|
+
# legal form, share capital, RCS registration, and any other statement the
|
|
15
|
+
# printed invoice must carry. A party holds a single postal address, so this
|
|
16
|
+
# is also where a registered office that differs from the invoicing
|
|
17
|
+
# establishment belongs.
|
|
12
18
|
class Party
|
|
13
|
-
attr_reader :name, :trading_name, :siret, :siren, :vat_number, :tax_id,
|
|
19
|
+
attr_reader :name, :trading_name, :legal_information, :siret, :siren, :vat_number, :tax_id,
|
|
14
20
|
:address, :contact, :global_id, :global_id_scheme,
|
|
15
21
|
:legal_id, :legal_id_scheme, :routing_id, :routing_id_scheme
|
|
16
22
|
|
|
17
23
|
def initialize(name:, address: nil, contact: nil, trading_name: nil,
|
|
24
|
+
legal_information: nil,
|
|
18
25
|
siret: nil, siren: nil, vat_number: nil, tax_id: nil,
|
|
19
26
|
global_id: nil, global_id_scheme: nil,
|
|
20
27
|
legal_id: nil, legal_id_scheme: nil,
|
|
21
28
|
routing_id: :derive_from_siret, routing_id_scheme: nil)
|
|
22
29
|
@name = name
|
|
23
30
|
@trading_name = trading_name
|
|
31
|
+
@legal_information = legal_information
|
|
24
32
|
@address = address
|
|
25
33
|
@contact = contact
|
|
26
34
|
@siret = siret
|
data/lib/factur_x/schemas/Factur-X_1.09_EN16931_ReusableAggregateBusinessInformationEntity_100.xsd
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
|
|
6
6
|
targetNamespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
|
|
7
7
|
elementFormDefault="qualified">
|
|
8
|
-
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" schemaLocation="Factur-X_1.
|
|
9
|
-
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" schemaLocation="Factur-X_1.
|
|
8
|
+
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" schemaLocation="Factur-X_1.09_EN16931_QualifiedDataType_100.xsd"/>
|
|
9
|
+
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" schemaLocation="Factur-X_1.09_EN16931_UnqualifiedDataType_100.xsd"/>
|
|
10
10
|
<xs:complexType name="CreditorFinancialAccountType">
|
|
11
11
|
<xs:sequence>
|
|
12
12
|
<xs:element name="IBANID" type="udt:IDType" minOccurs="0"/>
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
|
|
7
7
|
targetNamespace="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
|
|
8
8
|
elementFormDefault="qualified">
|
|
9
|
-
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" schemaLocation="Factur-X_1.
|
|
10
|
-
<xs:import namespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" schemaLocation="Factur-X_1.
|
|
11
|
-
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" schemaLocation="Factur-X_1.
|
|
9
|
+
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" schemaLocation="Factur-X_1.09_EN16931_QualifiedDataType_100.xsd"/>
|
|
10
|
+
<xs:import namespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" schemaLocation="Factur-X_1.09_EN16931_ReusableAggregateBusinessInformationEntity_100.xsd"/>
|
|
11
|
+
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" schemaLocation="Factur-X_1.09_EN16931_UnqualifiedDataType_100.xsd"/>
|
|
12
12
|
<xs:element name="CrossIndustryInvoice" type="rsm:CrossIndustryInvoiceType"/>
|
|
13
13
|
<xs:complexType name="CrossIndustryInvoiceType">
|
|
14
14
|
<xs:sequence>
|
data/lib/factur_x/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: factur-x-builder
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Hotentic
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-08-
|
|
11
|
+
date: 2026-08-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: nokogiri
|