cfdi40 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb9a12ec72926735a554f302b13993914393c626cc4dcd797791dfcf0ed8191a
4
- data.tar.gz: 4bc4708eb4c2c0671fa11c81dbcb40a8a8c9a585d2fa02531137efeee942a9d0
3
+ metadata.gz: c93f265a23f6c466d800ce90e2258525844b3f15451971b0140f8c2ee826d2c5
4
+ data.tar.gz: 1fcd506dfa5eefbffa1fec8ad3e98543cbc0045936859ca171b42caf46ff6649
5
5
  SHA512:
6
- metadata.gz: f41d5ee33e1e705d2b12b2c623cd6b197d2c93c1a9e5d994ffc38630954fc4cb6ed6a1c2ae084513bfa6991f7c1bf67b4cc609ebbca3c2d1c99d74167897f470
7
- data.tar.gz: 9f55e7a93233c1c8121d26424c2a7604d36b58f6695b104dc64ea39091e16bb45f3da10231ff4367e75c56d843fd724284b2adae053617244a2295227d3bc41d
6
+ metadata.gz: 8a13afec5754aeb24cf6168f66b23b658e79cb8d8cbf93c74a11bc592ae5913f77b3d6d5da45e19b69384c94a9221bb4f7b9897e0bc6672f7360b71a0538d759
7
+ data.tar.gz: 473a8ce2434b628e1fb61e8342cbdcdc1972fb00350a382e5b2b113c0d16018b804cd6d05438a2b26ddb54ba121491f9df94a75f976247eea682d7fcd7e461f2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cfdi40 (0.0.3)
4
+ cfdi40 (0.0.4)
5
5
  nokogiri (>= 1.10.10)
6
6
 
7
7
  GEM
@@ -10,12 +10,12 @@ GEM
10
10
  ast (2.4.2)
11
11
  json (2.3.1)
12
12
  minitest (5.15.0)
13
- nokogiri (1.13.9-x86_64-linux)
13
+ nokogiri (1.14.2-x86_64-linux)
14
14
  racc (~> 1.4)
15
15
  parallel (1.20.1)
16
16
  parser (3.1.2.1)
17
17
  ast (~> 2.4.1)
18
- racc (1.6.0)
18
+ racc (1.6.2)
19
19
  rainbow (3.0.0)
20
20
  rake (13.0.6)
21
21
  regexp_parser (1.8.2)
@@ -19,11 +19,11 @@ module Cfdi40
19
19
  define_attribute :no_certificado, xml_attribute: 'NoCertificado'
20
20
  define_attribute :certificado, xml_attribute: 'Certificado'
21
21
  define_attribute :condiciones_de_pago, xml_attribute: 'CondicionesDePago'
22
- define_attribute :subtotal, xml_attribute: 'SubTotal', format: :t_Importe
23
- define_attribute :descuento, xml_attribute: 'Descuento', format: :t_Importe
22
+ define_attribute :subtotal, xml_attribute: 'SubTotal', format: :t_ImporteMXN
23
+ define_attribute :descuento, xml_attribute: 'Descuento', format: :t_ImporteMXN
24
24
  define_attribute :moneda, xml_attribute: 'Moneda', default: 'MXN'
25
25
  define_attribute :tipo_cambio, xml_attribute: 'TipoCambio'
26
- define_attribute :total, xml_attribute: 'Total', format: :t_Importe
26
+ define_attribute :total, xml_attribute: 'Total', format: :t_ImporteMXN
27
27
  define_attribute :tipo_de_comprobante, xml_attribute: 'TipoDeComprobante', default: 'I'
28
28
  define_attribute :exportacion, xml_attribute: 'Exportacion', default: '01'
29
29
  define_attribute :metodo_pago, xml_attribute: 'MetodoPago'
@@ -133,7 +133,8 @@ module Cfdi40
133
133
  end
134
134
 
135
135
  def original_content
136
- xslt = Nokogiri::XSLT(File.open('lib/xslt/cadenaoriginal_local.xslt'))
136
+ xslt_path = File.join(File.dirname(__FILE__), '..', '..', 'lib/xslt/cadenaoriginal_local.xslt')
137
+ xslt = Nokogiri::XSLT(File.open(xslt_path))
137
138
  transformed = xslt.transform(docxml)
138
139
  # The ampersand (&) char must be used in original content
139
140
  # even though the documentation indicates otherwise
@@ -226,10 +227,10 @@ module Cfdi40
226
227
  end
227
228
 
228
229
  def load_private_key
229
- return unless defined?(@key_data) && defined?(@key_pass)
230
+ return unless defined?(@key_data)
230
231
 
231
232
  @sat_csd ||= SatCsd.new
232
- @sat_csd.set_private_key(@key_data, @key_pass)
233
+ @sat_csd.set_private_key(@key_data, (defined?(@key_pass) ? @key_pass : nil))
233
234
  end
234
235
  end
235
236
  end
data/lib/cfdi40/node.rb CHANGED
@@ -147,6 +147,8 @@ module Cfdi40
147
147
  case self.class.formats[accessor]
148
148
  when :t_Importe
149
149
  sprintf("%0.6f", public_send(accessor).to_f)
150
+ when :t_ImporteMXN
151
+ sprintf("%0.2f", public_send(accessor).to_f)
150
152
  else
151
153
  public_send(accessor)
152
154
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cfdi40
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfdi40
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Israel Benítez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-19 00:00:00.000000000 Z
11
+ date: 2023-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri