Afip 1.5.3 → 1.5.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: eeda5475fee1463de43c975e3c220a18e6d112b12367c3d958a94f85f35870a0
4
- data.tar.gz: b8ef297a83845e6fcab29617fb6a22e682d565962fa0b6080d08c918697ce43e
3
+ metadata.gz: c67572f7bf760c810d922a48ee4cb8f59d604c196438b16f3493cfb3ad891825
4
+ data.tar.gz: be22a7e22df3be79f2c65aab15f3d9e9e984ad14e0337fa1f9b858258c98fc82
5
5
  SHA512:
6
- metadata.gz: bff3589d154c87f160c8611c7c2615ac46012c3203e6b4e811dc934618f4ed675e0a6d128e6c5f0d51b83cc2cb233f54e03888000a98fbb18730bcb4ab0b963f
7
- data.tar.gz: a7c6e6158ad92f87b1988ada803321cd2d96b8b6c4121046be24ee6895bb7fdad09acc922be470641928101fc583d969902dd82825a8df960a2e8fbb3c9b09a4
6
+ metadata.gz: 7610c0b62ce35a555cdf305a48474e4072ec1cdd482e80d807fe24c9f169531eeadcf4dfc947c29fd1f36bea299c563a7ce20576a53c2c0ac535a5eeeb8d9202
7
+ data.tar.gz: cf2bbc4d6af356f55754f19ed4d1742c1070b61b88edf587f0f7b83d3594d36408ab2299836be6e443a6f7e9048b6a1f600913311c5440b0ecbe14a2e9bed3c6
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- Afip (1.5.1)
4
+ Afip (1.5.3)
5
5
  httpi
6
6
  nokogiri (>= 1.10.4)
7
7
  savon
@@ -2,19 +2,19 @@ module Afip
2
2
  class Bill
3
3
  attr_reader :cbte_type, :body, :response, :fecha_emision, :total, :client
4
4
  attr_accessor :net, :doc_num, :iva_cond, :documento, :concepto, :moneda, :cbte_type,
5
- :due_date, :fch_serv_desde, :fch_serv_hasta, :fch_emision,
5
+ :due_date, :fch_serv_desde, :fch_serv_hasta, :fch_emision, :cbte_asoc,
6
6
  :ivas, :sale_point, :cant_reg, :no_gravado, :gravado, :exento, :otros_imp, :tributos, :opcionales
7
7
 
8
8
  def initialize(attrs={})
9
9
  @client = Bill.set_client
10
- @sale_point = attrs[:sale_point]
11
- @body = { "Auth" => Afip.auth_hash }
12
- @net = attrs[:net] || 0.0
10
+ @sale_point = attrs[:sale_point]
11
+ @body = { "Auth" => Afip.auth_hash }
12
+ @net = attrs[:net] || 0.0
13
13
  @documento = attrs[:documento] || Afip.default_documento
14
- @moneda = attrs[:moneda] || Afip.default_moneda
14
+ @moneda = attrs[:moneda] || Afip.default_moneda
15
15
  @iva_cond = attrs[:iva_cond]
16
16
  @concepto = attrs[:concepto] || Afip.default_concepto
17
- @ivas = attrs[:ivas] || Array.new # [ 1, 100.00, 10.50 ], [ 2, 100.00, 21.00 ]
17
+ @ivas = attrs[:ivas] || Array.new # [ 1, 100.00, 10.50 ], [ 2, 100.00, 21.00 ]
18
18
  @fecha_emision = attrs[:fch_emision] || Time.new
19
19
  @fch_serv_hasta = attrs[:fch_serv_hasta]
20
20
  @fch_serv_desde = attrs[:fch_serv_desde]
@@ -22,12 +22,13 @@ module Afip
22
22
  @cbte_type = attrs[:cbte_type]
23
23
  @cant_reg = attrs[:cant_reg] || 1
24
24
  @no_gravado = attrs[:no_gravado] || 0.0
25
- @gravado = attrs[:gravado] || 0.0
26
- @exento = attrs[:exento] || 0.0
25
+ @gravado = attrs[:gravado] || 0.0
26
+ @exento = attrs[:exento] || 0.0
27
27
  @otros_imp = attrs[:otros_imp] || 0.0
28
- @total = net.to_f + iva_sum.to_f + exento.to_f + no_gravado.to_f + otros_imp.to_f
28
+ @total = net.to_f + iva_sum.to_f + exento.to_f + no_gravado.to_f + otros_imp.to_f
29
29
  @tributos = attrs[:tributos] || []
30
- @opcionales = attrs[:opcionales] || []
30
+ @opcionales = attrs[:opcionales] || []
31
+ @cbte_asoc = attrs[:cbte_asoc]
31
32
  end
32
33
 
33
34
  def self.get_ptos_vta
@@ -110,11 +111,20 @@ module Afip
110
111
 
111
112
  array_opcionales = {}
112
113
  array_opcionales["Opcional"] = opcionales.map{ |t|
113
- {
114
- "Id" => t[:id],
115
- "Valor" => t[:valor]
116
- }
117
- }
114
+ {
115
+ "Id" => t[:id],
116
+ "Valor" => t[:valor]
117
+ }
118
+ }
119
+
120
+ array_associados = {}
121
+ array_associados["CbteAsoc"] = cbte_asoc.map{ |b|
122
+ {
123
+ "Tipo" => b[:cbte_tipo],
124
+ "PtoVta" => b[:sale_point]
125
+ "Nro" => b[:cbte_num]
126
+ }
127
+ }
118
128
 
119
129
 
120
130
  fecaereq = {
@@ -124,10 +134,10 @@ module Afip
124
134
  "FECAEDetRequest" => {
125
135
  "Concepto" => Afip::CONCEPTOS[concepto],
126
136
  "DocTipo" => Afip::DOCUMENTOS[documento],
127
- "DocNro" => doc_num,
137
+ "DocNro" => doc_num,
128
138
  "CbteFch" => fecha_emision.strftime('%Y%m%d'),
129
139
  "ImpTotConc" => no_gravado,
130
- "ImpNeto" => net.to_f,
140
+ "ImpNeto" => net.to_f,
131
141
  "MonId" => Afip::MONEDAS[moneda][:codigo],
132
142
  "MonCotiz" => exchange_rate,
133
143
  "ImpOpEx" => exento,
@@ -153,7 +163,11 @@ module Afip
153
163
 
154
164
  if !opcionales.empty?
155
165
  detail["Opcionales"] = array_opcionales
156
- end
166
+ end
167
+
168
+ if !cbte_asoc.empty?
169
+ detaill["CbtesAsoc"] = array_associados
170
+ end
157
171
 
158
172
  unless concepto == "Productos" # En "Productos" ("01"), si se mandan estos parámetros la afip rechaza.
159
173
  detail.merge!({"FchServDesde" => fch_serv_desde.strftime("%Y%m%d"),
@@ -1,3 +1,3 @@
1
1
  module Afip
2
- VERSION = "1.5.3"
2
+ VERSION = "1.5.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Afip
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Facundo A. Díaz Martínez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-18 00:00:00.000000000 Z
11
+ date: 2020-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon