zatca 0.1.2 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -2
  3. data/bin/console +0 -0
  4. data/bin/setup +0 -0
  5. data/lib/zatca/client.rb +173 -0
  6. data/lib/zatca/hacks.rb +45 -0
  7. data/lib/zatca/hashing.rb +18 -0
  8. data/lib/zatca/qr_code_extractor.rb +31 -0
  9. data/lib/zatca/qr_code_generator.rb +9 -2
  10. data/lib/zatca/signing/certificate.rb +78 -0
  11. data/lib/zatca/signing/csr.rb +220 -0
  12. data/lib/zatca/signing/ecdsa.rb +59 -0
  13. data/lib/zatca/tag.rb +18 -8
  14. data/lib/zatca/tags.rb +5 -1
  15. data/lib/zatca/tags_schema.rb +5 -5
  16. data/lib/zatca/types.rb +7 -0
  17. data/lib/zatca/ubl/base_component.rb +142 -0
  18. data/lib/zatca/ubl/builder.rb +166 -0
  19. data/lib/zatca/ubl/common_aggregate_components/allowance_charge.rb +64 -0
  20. data/lib/zatca/ubl/common_aggregate_components/classified_tax_category.rb +25 -0
  21. data/lib/zatca/ubl/common_aggregate_components/delivery.rb +27 -0
  22. data/lib/zatca/ubl/common_aggregate_components/invoice_line.rb +63 -0
  23. data/lib/zatca/ubl/common_aggregate_components/item.rb +21 -0
  24. data/lib/zatca/ubl/common_aggregate_components/legal_monetary_total.rb +59 -0
  25. data/lib/zatca/ubl/common_aggregate_components/party.rb +28 -0
  26. data/lib/zatca/ubl/common_aggregate_components/party_identification.rb +25 -0
  27. data/lib/zatca/ubl/common_aggregate_components/party_legal_entity.rb +19 -0
  28. data/lib/zatca/ubl/common_aggregate_components/party_tax_scheme.rb +30 -0
  29. data/lib/zatca/ubl/common_aggregate_components/postal_address.rb +59 -0
  30. data/lib/zatca/ubl/common_aggregate_components/price.rb +20 -0
  31. data/lib/zatca/ubl/common_aggregate_components/tax_category.rb +56 -0
  32. data/lib/zatca/ubl/common_aggregate_components/tax_total.rb +58 -0
  33. data/lib/zatca/ubl/common_aggregate_components.rb +2 -0
  34. data/lib/zatca/ubl/invoice.rb +481 -0
  35. data/lib/zatca/ubl/invoice_subtype_builder.rb +50 -0
  36. data/lib/zatca/ubl/signing/cert.rb +48 -0
  37. data/lib/zatca/ubl/signing/invoice_signed_data_reference.rb +44 -0
  38. data/lib/zatca/ubl/signing/key_info.rb +25 -0
  39. data/lib/zatca/ubl/signing/object.rb +20 -0
  40. data/lib/zatca/ubl/signing/qualifying_properties.rb +27 -0
  41. data/lib/zatca/ubl/signing/signature.rb +50 -0
  42. data/lib/zatca/ubl/signing/signature_information.rb +19 -0
  43. data/lib/zatca/ubl/signing/signature_properties_reference.rb +26 -0
  44. data/lib/zatca/ubl/signing/signed_info.rb +21 -0
  45. data/lib/zatca/ubl/signing/signed_properties.rb +81 -0
  46. data/lib/zatca/ubl/signing/signed_signature_properties.rb +23 -0
  47. data/lib/zatca/ubl/signing/ubl_document_signatures.rb +25 -0
  48. data/lib/zatca/ubl/signing/ubl_extension.rb +22 -0
  49. data/lib/zatca/ubl/signing/ubl_extensions.rb +17 -0
  50. data/lib/zatca/ubl/signing.rb +2 -0
  51. data/lib/zatca/ubl.rb +2 -0
  52. data/lib/zatca/version.rb +1 -1
  53. data/lib/zatca.rb +27 -3
  54. data/zatca.gemspec +52 -0
  55. metadata +165 -10
  56. data/Gemfile.lock +0 -100
@@ -0,0 +1,50 @@
1
+ class ZATCA::UBL::Signing::Signature < ZATCA::UBL::BaseComponent
2
+ attr_reader :signing_time, :cert_digest_value, :cert_issuer_name, :cert_serial_number
3
+
4
+ def initialize(
5
+ invoice_hash:, signed_properties_hash:, signature_value:,
6
+ certificate:, signing_time:, cert_digest_value:, cert_issuer_name:,
7
+ cert_serial_number:
8
+ )
9
+ super()
10
+
11
+ @invoice_digest = invoice_hash
12
+ @signed_properties_hash = signed_properties_hash
13
+ @signature_value = signature_value
14
+ @certificate = certificate
15
+ @signing_time = signing_time
16
+ @cert_digest_value = cert_digest_value
17
+ @cert_issuer_name = cert_issuer_name
18
+ @cert_serial_number = cert_serial_number
19
+ end
20
+
21
+ def attributes
22
+ {
23
+ "xmlns:ds" => "http://www.w3.org/2000/09/xmldsig#",
24
+ "Id" => "signature"
25
+ }
26
+ end
27
+
28
+ def name
29
+ "ds:Signature"
30
+ end
31
+
32
+ def elements
33
+ [
34
+ ZATCA::UBL::Signing::SignedInfo.new(
35
+ invoice_digest: @invoice_digest,
36
+ signed_properties_hash: @signed_properties_hash
37
+ ),
38
+
39
+ ZATCA::UBL::BaseComponent.new(name: "ds:SignatureValue", value: @signature_value),
40
+ ZATCA::UBL::Signing::KeyInfo.new(certificate: @certificate),
41
+
42
+ ZATCA::UBL::Signing::Object.new(
43
+ signing_time: @signing_time,
44
+ cert_digest_value: @cert_digest_value,
45
+ cert_issuer_name: @cert_issuer_name,
46
+ cert_serial_number: @cert_serial_number
47
+ )
48
+ ]
49
+ end
50
+ end
@@ -0,0 +1,19 @@
1
+ class ZATCA::UBL::Signing::SignatureInformation < ZATCA::UBL::BaseComponent
2
+ def initialize(signature:)
3
+ super()
4
+
5
+ @signature = signature
6
+ end
7
+
8
+ def name
9
+ "sac:SignatureInformation"
10
+ end
11
+
12
+ def elements
13
+ [
14
+ ZATCA::UBL::BaseComponent.new(name: "cbc:ID", value: "urn:oasis:names:specification:ubl:signature:1"),
15
+ ZATCA::UBL::BaseComponent.new(name: "sbc:ReferencedSignatureID", value: "urn:oasis:names:specification:ubl:signature:Invoice"),
16
+ @signature
17
+ ]
18
+ end
19
+ end
@@ -0,0 +1,26 @@
1
+ class ZATCA::UBL::Signing::SignaturePropertiesReference < ZATCA::UBL::BaseComponent
2
+ attr_accessor :digest_value
3
+
4
+ def initialize(digest_value:)
5
+ super()
6
+ @digest_value = digest_value
7
+ end
8
+
9
+ def name
10
+ "ds:Reference"
11
+ end
12
+
13
+ def attributes
14
+ {
15
+ "Type" => "http://www.w3.org/2000/09/xmldsig#SignatureProperties",
16
+ "URI" => "#xadesSignedProperties"
17
+ }
18
+ end
19
+
20
+ def elements
21
+ [
22
+ ZATCA::UBL::BaseComponent.new(name: "ds:DigestMethod", attributes: {"Algorithm" => "http://www.w3.org/2001/04/xmlenc#sha256"}),
23
+ ZATCA::UBL::BaseComponent.new(name: "ds:DigestValue", value: @digest_value)
24
+ ]
25
+ end
26
+ end
@@ -0,0 +1,21 @@
1
+ class ZATCA::UBL::Signing::SignedInfo < ZATCA::UBL::BaseComponent
2
+ def initialize(invoice_digest:, signed_properties_hash:)
3
+ super()
4
+
5
+ @invoice_digest = invoice_digest
6
+ @signed_properties_hash = signed_properties_hash
7
+ end
8
+
9
+ def name
10
+ "ds:SignedInfo"
11
+ end
12
+
13
+ def elements
14
+ [
15
+ ZATCA::UBL::BaseComponent.new(name: "ds:CanonicalizationMethod", attributes: {"Algorithm" => "http://www.w3.org/2006/12/xml-c14n11"}),
16
+ ZATCA::UBL::BaseComponent.new(name: "ds:SignatureMethod", attributes: {"Algorithm" => "http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha256"}),
17
+ ZATCA::UBL::Signing::InvoiceSignedDataReference.new(digest_value: @invoice_digest),
18
+ ZATCA::UBL::Signing::SignaturePropertiesReference.new(digest_value: @signed_properties_hash)
19
+ ]
20
+ end
21
+ end
@@ -0,0 +1,81 @@
1
+ class ZATCA::UBL::Signing::SignedProperties < ZATCA::UBL::BaseComponent
2
+ def initialize(
3
+ signing_time:,
4
+ cert_digest_value:,
5
+ cert_issuer_name:,
6
+ cert_serial_number:
7
+ )
8
+ super()
9
+
10
+ @signing_time = signing_time
11
+ @cert_digest_value = cert_digest_value
12
+ @cert_issuer_name = cert_issuer_name
13
+ @cert_serial_number = cert_serial_number
14
+ end
15
+
16
+ def name
17
+ "xades:SignedProperties"
18
+ end
19
+
20
+ def attributes
21
+ {
22
+ "Id" => "xadesSignedProperties"
23
+ }
24
+ end
25
+
26
+ def elements
27
+ [
28
+ ZATCA::UBL::Signing::SignedSignatureProperties.new(
29
+ signing_time: @signing_time,
30
+ cert_digest_value: @cert_digest_value,
31
+ cert_issuer_name: @cert_issuer_name,
32
+ cert_serial_number: @cert_serial_number
33
+ )
34
+ ]
35
+ end
36
+
37
+ def generate_hash
38
+ ZATCA::Hashing.generate_hashes(zatca_whitespaced_xml_for_hashing)[:hexdigest_base64]
39
+ end
40
+
41
+ private
42
+
43
+ # rubocop:disable Layout/HeredocIndentation
44
+ # rubocop:disable Layout/ClosingHeredocIndentation
45
+ #
46
+ # We need this version of the XML with this exact whitespacing because ZATCA
47
+ # did not opt for canonicalization before hashing (unlike the invoice hash),
48
+ # and also because they have XML attributes that are only added the moment you
49
+ # generate the hash but are expected to be removed in all other instances.
50
+ #
51
+ # We will use this version of the XML to generate the hash only, and expect
52
+ # the output of `build_xml` to generate the non-signing version of the XML.
53
+ # See:
54
+ # - https://zatca1.discourse.group/t/what-do-signed-properties-look-like-when-hashing
55
+ # - https://web.archive.org/web/20230925182417/https://zatca1.discourse.group/t/what-do-signed-properties-look-like-when-hashing/717
56
+
57
+ def zatca_whitespaced_xml_for_hashing
58
+ # Note: chomp is used to get rid of the final newline character
59
+ <<-XML.chomp
60
+ <xades:SignedProperties xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" Id="xadesSignedProperties">
61
+ <xades:SignedSignatureProperties>
62
+ <xades:SigningTime>#{@signing_time}</xades:SigningTime>
63
+ <xades:SigningCertificate>
64
+ <xades:Cert>
65
+ <xades:CertDigest>
66
+ <ds:DigestMethod xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
67
+ <ds:DigestValue xmlns:ds="http://www.w3.org/2000/09/xmldsig#">#{@cert_digest_value}</ds:DigestValue>
68
+ </xades:CertDigest>
69
+ <xades:IssuerSerial>
70
+ <ds:X509IssuerName xmlns:ds="http://www.w3.org/2000/09/xmldsig#">#{@cert_issuer_name}</ds:X509IssuerName>
71
+ <ds:X509SerialNumber xmlns:ds="http://www.w3.org/2000/09/xmldsig#">#{@cert_serial_number}</ds:X509SerialNumber>
72
+ </xades:IssuerSerial>
73
+ </xades:Cert>
74
+ </xades:SigningCertificate>
75
+ </xades:SignedSignatureProperties>
76
+ </xades:SignedProperties>
77
+ XML
78
+ end
79
+ # rubocop:enable Layout/HeredocIndentation
80
+ # rubocop:enable Layout/ClosingHeredocIndentation
81
+ end
@@ -0,0 +1,23 @@
1
+ class ZATCA::UBL::Signing::SignedSignatureProperties < ZATCA::UBL::BaseComponent
2
+ def initialize(signing_time:, cert_digest_value:, cert_issuer_name:, cert_serial_number:)
3
+ super()
4
+
5
+ @signing_time = signing_time
6
+ @cert_digest_value = cert_digest_value
7
+ @cert_issuer_name = cert_issuer_name
8
+ @cert_serial_number = cert_serial_number
9
+ end
10
+
11
+ def name
12
+ "xades:SignedSignatureProperties"
13
+ end
14
+
15
+ def elements
16
+ [
17
+ ZATCA::UBL::BaseComponent.new(name: "xades:SigningTime", value: @signing_time),
18
+ ZATCA::UBL::BaseComponent.new(name: "xades:SigningCertificate", elements: [
19
+ ZATCA::UBL::Signing::Cert.new(cert_digest_value: @cert_digest_value, cert_issuer_name: @cert_issuer_name, cert_serial_number: @cert_serial_number)
20
+ ])
21
+ ]
22
+ end
23
+ end
@@ -0,0 +1,25 @@
1
+ class ZATCA::UBL::Signing::UBLDocumentSignatures < ZATCA::UBL::BaseComponent
2
+ def initialize(signature:)
3
+ super()
4
+
5
+ @signature = signature
6
+ end
7
+
8
+ def name
9
+ "sig:UBLDocumentSignatures"
10
+ end
11
+
12
+ def attributes
13
+ {
14
+ "xmlns:sig" => "urn:oasis:names:specification:ubl:schema:xsd:CommonSignatureComponents-2",
15
+ "xmlns:sac" => "urn:oasis:names:specification:ubl:schema:xsd:SignatureAggregateComponents-2",
16
+ "xmlns:sbc" => "urn:oasis:names:specification:ubl:schema:xsd:SignatureBasicComponents-2"
17
+ }
18
+ end
19
+
20
+ def elements
21
+ [
22
+ ZATCA::UBL::Signing::SignatureInformation.new(signature: @signature)
23
+ ]
24
+ end
25
+ end
@@ -0,0 +1,22 @@
1
+ class ZATCA::UBL::Signing::UBLExtension < ZATCA::UBL::BaseComponent
2
+ def initialize(signature:)
3
+ super()
4
+
5
+ @signature = signature
6
+ end
7
+
8
+ def name
9
+ "ext:UBLExtension"
10
+ end
11
+
12
+ def elements
13
+ [
14
+ ZATCA::UBL::BaseComponent.new(name: "ext:ExtensionURI", value: "urn:oasis:names:specification:ubl:dsig:enveloped:xades"),
15
+ ZATCA::UBL::BaseComponent.new(name: "ext:ExtensionContent", elements: [
16
+ ZATCA::UBL::Signing::UBLDocumentSignatures.new(signature: @signature)
17
+ ])
18
+ ]
19
+ end
20
+
21
+ private
22
+ end
@@ -0,0 +1,17 @@
1
+ class ZATCA::UBL::Signing::UBLExtensions < ZATCA::UBL::BaseComponent
2
+ def initialize(signature:)
3
+ super()
4
+
5
+ @signature = signature
6
+ end
7
+
8
+ def name
9
+ "ext:UBLExtensions"
10
+ end
11
+
12
+ def elements
13
+ [
14
+ ZATCA::UBL::Signing::UBLExtension.new(signature: @signature)
15
+ ]
16
+ end
17
+ end
@@ -0,0 +1,2 @@
1
+ module ZATCA::UBL::Signing
2
+ end
data/lib/zatca/ubl.rb ADDED
@@ -0,0 +1,2 @@
1
+ module ZATCA::UBL
2
+ end
data/lib/zatca/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ZATCA
4
- VERSION = "0.1.2"
4
+ VERSION = "1.0.1"
5
5
  end
data/lib/zatca.rb CHANGED
@@ -1,13 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "zatca/version"
4
+ require_relative "zatca/types"
4
5
 
6
+ require "active_support/all"
5
7
  require "zeitwerk"
8
+ require "dry-initializer"
9
+ require "dry-types"
6
10
 
7
11
  loader = Zeitwerk::Loader.for_gem
8
12
  loader.inflector.inflect(
9
13
  "zatca" => "ZATCA",
10
- "qr_code_generator" => "QRCodeGenerator"
14
+ "qr_code_generator" => "QRCodeGenerator",
15
+ "qr_code_extractor" => "QRCodeExtractor",
16
+ "ubl" => "UBL",
17
+ "csr" => "CSR",
18
+ "ubl_document_signature" => "UBLDocumentSignature",
19
+ "ubl_document_signatures" => "UBLDocumentSignatures",
20
+ "ubl_extension" => "UBLExtension",
21
+ "ubl_extensions" => "UBLExtensions",
22
+ "id" => "ID",
23
+ "ecdsa" => "ECDSA"
11
24
  )
12
25
  loader.setup
13
26
 
@@ -16,8 +29,19 @@ module ZATCA
16
29
 
17
30
  class Error < StandardError; end
18
31
 
19
- def self.render_qr_code(tags)
20
- QRCodeGenerator.new(ZATCA::Tags.new(tags)).render
32
+ def self.extract_qr_base64_from_base64_invoice(base64_invoice)
33
+ QRCodeExtractor.new(invoice_base64: base64_invoice).extract
34
+ end
35
+
36
+ def self.render_qr_code(tags: nil, base64: nil)
37
+ if tags.present?
38
+ tags = ZATCA::Tags.new(tags) if tags.is_a?(Hash)
39
+ QRCodeGenerator.new(tags: tags).render
40
+ elsif base64.present?
41
+ QRCodeGenerator.new(base64: base64).render
42
+ else
43
+ raise ArgumentError, "Either tags or base64 must be provided"
44
+ end
21
45
  end
22
46
  end
23
47
 
data/zatca.gemspec ADDED
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/zatca/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "zatca"
7
+ spec.version = ZATCA::VERSION
8
+ spec.authors = ["Omar Bahareth"]
9
+ spec.email = ["obahareth@mrsool.co"]
10
+
11
+ spec.summary = "A library for generating QR Codes for the e-invoice standard by ZATCA in Saudi Arabia."
12
+ spec.description = "A library for generating QR Codes for the e-invoice standard by ZATCA in Saudi Arabia."
13
+ spec.homepage = "https://github.com/mrsool/zatca"
14
+ spec.required_ruby_version = ">= 2.5.0"
15
+
16
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
17
+
18
+ spec.metadata["homepage_uri"] = spec.homepage
19
+ spec.metadata["source_code_uri"] = "https://github.com/mrsool/zatca"
20
+ spec.metadata["changelog_uri"] = "https://github.com/mrsool/zatca/releases"
21
+
22
+ # Specify which files should be added to the gem when it is released.
23
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
+ `git ls-files -z`.split("\x0").reject do |f|
26
+ (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features|einvoicing-sdk)/|\.(?:git|travis|circleci)|appveyor)})
27
+ end
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ # Dependencies
34
+ spec.add_dependency "zeitwerk", "~> 2.4"
35
+ spec.add_dependency "dry-schema", ">= 1.5"
36
+ spec.add_dependency "rqrcode", "~> 2.1.0"
37
+ spec.add_dependency "httpx", "~> 0.21.0"
38
+ spec.add_dependency "nokogiri", ">= 1.12"
39
+ spec.add_dependency "activesupport", ">= 5.2"
40
+ spec.add_dependency "dry-initializer", ">= 3.0"
41
+ spec.add_dependency "starkbank-ecdsa", "~> 2.0"
42
+
43
+ # Development Dependencies
44
+ spec.add_development_dependency "standard", "~> 1.3"
45
+ spec.add_development_dependency "byebug", "~> 9.0"
46
+ spec.add_development_dependency "rspec", "~> 3.10"
47
+ spec.add_development_dependency "vcr", "~> 6.0.0"
48
+ spec.add_development_dependency "webmock", "~> 3.18.1"
49
+ spec.add_development_dependency "amazing_print", "~> 1.4.0"
50
+ # For more information and examples about making a new gem, checkout our
51
+ # guide at: https://bundler.io/guides/creating_gem.html
52
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zatca
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Omar Bahareth
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-22 00:00:00.000000000 Z
11
+ date: 2023-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk
@@ -28,14 +28,14 @@ dependencies:
28
28
  name: dry-schema
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.5'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.5'
41
41
  - !ruby/object:Gem::Dependency
@@ -52,6 +52,76 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 2.1.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: httpx
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.21.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.21.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: nokogiri
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '1.12'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '1.12'
83
+ - !ruby/object:Gem::Dependency
84
+ name: activesupport
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '5.2'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '5.2'
97
+ - !ruby/object:Gem::Dependency
98
+ name: dry-initializer
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '3.0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '3.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: starkbank-ecdsa
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '2.0'
55
125
  - !ruby/object:Gem::Dependency
56
126
  name: standard
57
127
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +164,48 @@ dependencies:
94
164
  - - "~>"
95
165
  - !ruby/object:Gem::Version
96
166
  version: '3.10'
167
+ - !ruby/object:Gem::Dependency
168
+ name: vcr
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: 6.0.0
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: 6.0.0
181
+ - !ruby/object:Gem::Dependency
182
+ name: webmock
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: 3.18.1
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: 3.18.1
195
+ - !ruby/object:Gem::Dependency
196
+ name: amazing_print
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: 1.4.0
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: 1.4.0
97
209
  description: A library for generating QR Codes for the e-invoice standard by ZATCA
98
210
  in Saudi Arabia.
99
211
  email:
@@ -104,18 +216,61 @@ extra_rdoc_files: []
104
216
  files:
105
217
  - ".rspec"
106
218
  - Gemfile
107
- - Gemfile.lock
108
219
  - LICENSE
109
220
  - README.md
110
221
  - Rakefile
111
222
  - bin/console
112
223
  - bin/setup
113
224
  - lib/zatca.rb
225
+ - lib/zatca/client.rb
226
+ - lib/zatca/hacks.rb
227
+ - lib/zatca/hashing.rb
228
+ - lib/zatca/qr_code_extractor.rb
114
229
  - lib/zatca/qr_code_generator.rb
230
+ - lib/zatca/signing/certificate.rb
231
+ - lib/zatca/signing/csr.rb
232
+ - lib/zatca/signing/ecdsa.rb
115
233
  - lib/zatca/tag.rb
116
234
  - lib/zatca/tags.rb
117
235
  - lib/zatca/tags_schema.rb
236
+ - lib/zatca/types.rb
237
+ - lib/zatca/ubl.rb
238
+ - lib/zatca/ubl/base_component.rb
239
+ - lib/zatca/ubl/builder.rb
240
+ - lib/zatca/ubl/common_aggregate_components.rb
241
+ - lib/zatca/ubl/common_aggregate_components/allowance_charge.rb
242
+ - lib/zatca/ubl/common_aggregate_components/classified_tax_category.rb
243
+ - lib/zatca/ubl/common_aggregate_components/delivery.rb
244
+ - lib/zatca/ubl/common_aggregate_components/invoice_line.rb
245
+ - lib/zatca/ubl/common_aggregate_components/item.rb
246
+ - lib/zatca/ubl/common_aggregate_components/legal_monetary_total.rb
247
+ - lib/zatca/ubl/common_aggregate_components/party.rb
248
+ - lib/zatca/ubl/common_aggregate_components/party_identification.rb
249
+ - lib/zatca/ubl/common_aggregate_components/party_legal_entity.rb
250
+ - lib/zatca/ubl/common_aggregate_components/party_tax_scheme.rb
251
+ - lib/zatca/ubl/common_aggregate_components/postal_address.rb
252
+ - lib/zatca/ubl/common_aggregate_components/price.rb
253
+ - lib/zatca/ubl/common_aggregate_components/tax_category.rb
254
+ - lib/zatca/ubl/common_aggregate_components/tax_total.rb
255
+ - lib/zatca/ubl/invoice.rb
256
+ - lib/zatca/ubl/invoice_subtype_builder.rb
257
+ - lib/zatca/ubl/signing.rb
258
+ - lib/zatca/ubl/signing/cert.rb
259
+ - lib/zatca/ubl/signing/invoice_signed_data_reference.rb
260
+ - lib/zatca/ubl/signing/key_info.rb
261
+ - lib/zatca/ubl/signing/object.rb
262
+ - lib/zatca/ubl/signing/qualifying_properties.rb
263
+ - lib/zatca/ubl/signing/signature.rb
264
+ - lib/zatca/ubl/signing/signature_information.rb
265
+ - lib/zatca/ubl/signing/signature_properties_reference.rb
266
+ - lib/zatca/ubl/signing/signed_info.rb
267
+ - lib/zatca/ubl/signing/signed_properties.rb
268
+ - lib/zatca/ubl/signing/signed_signature_properties.rb
269
+ - lib/zatca/ubl/signing/ubl_document_signatures.rb
270
+ - lib/zatca/ubl/signing/ubl_extension.rb
271
+ - lib/zatca/ubl/signing/ubl_extensions.rb
118
272
  - lib/zatca/version.rb
273
+ - zatca.gemspec
119
274
  homepage: https://github.com/mrsool/zatca
120
275
  licenses: []
121
276
  metadata:
@@ -123,7 +278,7 @@ metadata:
123
278
  homepage_uri: https://github.com/mrsool/zatca
124
279
  source_code_uri: https://github.com/mrsool/zatca
125
280
  changelog_uri: https://github.com/mrsool/zatca/releases
126
- post_install_message:
281
+ post_install_message:
127
282
  rdoc_options: []
128
283
  require_paths:
129
284
  - lib
@@ -131,15 +286,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
131
286
  requirements:
132
287
  - - ">="
133
288
  - !ruby/object:Gem::Version
134
- version: 2.4.0
289
+ version: 2.5.0
135
290
  required_rubygems_version: !ruby/object:Gem::Requirement
136
291
  requirements:
137
292
  - - ">="
138
293
  - !ruby/object:Gem::Version
139
294
  version: '0'
140
295
  requirements: []
141
- rubygems_version: 3.2.22
142
- signing_key:
296
+ rubygems_version: 3.3.3
297
+ signing_key:
143
298
  specification_version: 4
144
299
  summary: A library for generating QR Codes for the e-invoice standard by ZATCA in
145
300
  Saudi Arabia.