Module: FacturX
- Defined in:
- lib/factur_x.rb,
lib/factur_x/line.rb,
lib/factur_x/note.rb,
lib/factur_x/codes.rb,
lib/factur_x/party.rb,
lib/factur_x/errors.rb,
lib/factur_x/totals.rb,
lib/factur_x/address.rb,
lib/factur_x/contact.rb,
lib/factur_x/invoice.rb,
lib/factur_x/payment.rb,
lib/factur_x/version.rb,
lib/factur_x/document.rb,
lib/factur_x/formatting.rb,
lib/factur_x/tax_breakdown.rb,
lib/factur_x/allowance_charge.rb,
lib/factur_x/validation/rules.rb,
lib/factur_x/validation/schema.rb
Overview
Generates the factur-x.xml attachment of a Factur-X PDF/A-3 invoice, in the EN 16931 profile.
Defined Under Namespace
Modules: Codes, Formatting, Validation Classes: Address, AllowanceCharge, Contact, Document, Error, Invoice, Line, Note, Party, PaymentMeans, PaymentTerms, ReferencedInvoice, SchemaError, TaxBreakdown, Totals, ValidationError
Constant Summary collapse
- VERSION =
"0.1.1"
Class Method Summary collapse
-
.build(invoice, profile: :fr_ctc, validate: true, validate_schema: true) ⇒ String
The factur-x.xml document.
- .valid?(invoice, profile: :fr_ctc) ⇒ Boolean
-
.violations(invoice, profile: :fr_ctc) ⇒ Array<String>
Collects every business rule violation instead of raising on the first.
Class Method Details
.build(invoice, profile: :fr_ctc, validate: true, validate_schema: true) ⇒ String
Returns the factur-x.xml document.
31 32 33 34 35 36 37 |
# File 'lib/factur_x.rb', line 31 def build(invoice, profile: :fr_ctc, validate: true, validate_schema: true) Validation::Rules.new(invoice, profile: profile).validate! if validate xml = Document.new(invoice).to_xml Validation::Schema.validate!(xml) if validate_schema xml end |
.valid?(invoice, profile: :fr_ctc) ⇒ Boolean
45 46 47 |
# File 'lib/factur_x.rb', line 45 def valid?(invoice, profile: :fr_ctc) violations(invoice, profile: profile).empty? end |
.violations(invoice, profile: :fr_ctc) ⇒ Array<String>
Collects every business rule violation instead of raising on the first.
41 42 43 |
# File 'lib/factur_x.rb', line 41 def violations(invoice, profile: :fr_ctc) Validation::Rules.new(invoice, profile: profile).violations end |