cfdi40 0.1.1 → 0.1.2

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: d6259abaa6dfa3e4dfb6ae269df819f9b655d9ff41b1adefae1b7aecb4ef4bcb
4
- data.tar.gz: 22c78d216df7cbeb071d76fc4770226ac9516ecd73537b8d01bfd4ae61d1891a
3
+ metadata.gz: f610f343a775755d3ec5e603588f8693ac502c576c56a32bf6dda422a7eebebe
4
+ data.tar.gz: 0e72a90973ca6f28b42b0c793951400a0d5ae8532bbb7c2d750c917cbae41b38
5
5
  SHA512:
6
- metadata.gz: 513278acd109f261b9e848b08d0506c4b2cdae2e16da783a8306f6416226994ffd98bba6764f07f7b56f9620b25c6e97d767936fcadbb9e9503cff710fe7d2a6
7
- data.tar.gz: f904dbf8c75d7afa4dbe02812d45773b0a60fe5d2eadc171321b02c3baf080fbd5fad1839c05b6a0ccf54adfd779f6a5253ef6aa4bc1c90b7a014fe99658142c
6
+ metadata.gz: 1cfcc729870cb04928ad9534068843df9ea61a9a6f9b0e994500f0b94b16f01659427984a05e05cc991900055bd4ac5bf8456d2ddabe0ffd7570f8e229693042
7
+ data.tar.gz: cfd0ca0717d596c1347e42d6ff680c39c13c57c0cf83c5ad9005ca96c9efcc5f9e1bd55ed706a086b99657bba0ff244b5eba8abcfabe50980f1481651429a87d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cfdi40 (0.1.1)
4
+ cfdi40 (0.1.2)
5
5
  nokogiri (>= 1.10.10)
6
6
 
7
7
  GEM
@@ -224,12 +224,6 @@ module Cfdi40
224
224
  impuestos_node.total_impuestos_trasladados
225
225
  end
226
226
 
227
- def total_iva_node
228
- return nil unless impuestos_node
229
-
230
- impuestos_node.traslado_iva
231
- end
232
-
233
227
  def calculate!
234
228
  @docxml = nil
235
229
  @subtotal = @conceptos.children_nodes.map(&:importe).map(&:to_f).sum
@@ -241,6 +235,19 @@ module Cfdi40
241
235
  @conceptos.children_nodes
242
236
  end
243
237
 
238
+ def total_iva_node
239
+ # TODO: Puede haber más de un nodo, cuando hay varias tasas de iva
240
+ return nil unless impuestos_node
241
+
242
+ impuestos_node.traslado_iva
243
+ end
244
+
245
+ def total_iva
246
+ return 0 unless traslados
247
+
248
+ traslados.traslados_iva.map(&:importe).map(&:to_f).sum.round(2)
249
+ end
250
+
244
251
  private
245
252
 
246
253
  def add_node_concepto_actividad_pago
@@ -325,11 +332,6 @@ module Cfdi40
325
332
  impuestos_node.traslados
326
333
  end
327
334
 
328
- # TODO: Eliminar
329
- def traslado_iva_node
330
- impuestos_node.traslado_iva
331
- end
332
-
333
335
  def load_private_key
334
336
  return unless defined?(@key_data)
335
337
 
@@ -16,5 +16,9 @@ module Cfdi40
16
16
  def traslado_nodes
17
17
  children_nodes
18
18
  end
19
+
20
+ def traslados_iva
21
+ children_nodes.select { |node| node.impuesto == '002' }
22
+ end
19
23
  end
20
24
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cfdi40
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
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.1.1
4
+ version: 0.1.2
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: 2025-06-18 00:00:00.000000000 Z
11
+ date: 2025-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri