Module: ZATCA
- Extended by:
- ZATCA
- Included in:
- ZATCA
- Defined in:
- lib/zatca.rb,
lib/zatca/tag.rb,
lib/zatca/tags.rb,
lib/zatca/types.rb,
lib/zatca/version.rb,
lib/zatca/tags_schema.rb,
lib/zatca/qr_code_generator.rb
Defined Under Namespace
Modules: Hacks, Types, UBL
Classes: Client, Error, Hashing, QRCodeExtractor, QRCodeGenerator, Tag, Tags
Constant Summary
collapse
- VERSION =
"1.1.0"
- TagsSchema =
Dry::Schema.Params do
required(:seller_name).filled(:string)
required(:vat_registration_number).filled(:string)
required(:timestamp).filled([:date_time, :string])
required(:invoice_total).filled(:string)
required(:vat_total).filled(:string)
optional(:xml_invoice_hash).filled(:string)
optional(:ecdsa_signature).filled(:string)
optional(:ecdsa_public_key).filled(:string)
optional(:ecdsa_stamp_signature).filled(:string)
end
Class Method Summary
collapse
Class Method Details
32
33
34
|
# File 'lib/zatca.rb', line 32
def self.(base64_invoice)
QRCodeExtractor.new(invoice_base64: base64_invoice).
end
|
.render_qr_code(tags: nil, base64: nil) ⇒ Object
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/zatca.rb', line 36
def self.render_qr_code(tags: nil, base64: nil)
if tags.present?
tags = ZATCA::Tags.new(tags) if tags.is_a?(Hash)
QRCodeGenerator.new(tags: tags).render
elsif base64.present?
QRCodeGenerator.new(base64: base64).render
else
raise ArgumentError, "Either tags or base64 must be provided"
end
end
|