Module: UnovaFacturX
- Defined in:
- lib/unova_factur_x.rb,
lib/unova_factur_x/version.rb,
lib/unova_factur_x/xml_generator.rb,
lib/unova_factur_x/factur_x_generator.rb
Defined Under Namespace
Classes: Error, FacturXGenerator, XmlGenerator
Constant Summary collapse
- VERSION =
"0.1.1"
Class Method Summary collapse
Class Method Details
.generate(pdf:, document_hash:, type: :invoice, with_validations: true, devise: "EUR") ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/unova_factur_x.rb', line 13 def self.generate(pdf:, document_hash:, type: :invoice, with_validations: true, devise: "EUR") unless %i[invoice credit].include?(type) raise ArgumentError, "Type must be :invoice or :credit (default is :invoice)" end # Génération du XML à partir du hash en entré xml = UnovaFacturX::XmlGenerator.new(document_hash, type: type, validate: with_validations, devise: devise).call # Génération et retour du PDF FacturX à partir du PDF en entré et du XML généré UnovaFacturX::FacturXGenerator.new(pdf: pdf, xml: xml).call end |