Afip 1.4.8 → 1.5.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f2b65711ad19aaedc0e7c47d8ae3de32243566256163e5a3e91df1e79c0ebab
4
- data.tar.gz: 46944b5fa828c6355251b17787d411b49e6eaa35cfe0517bd967d4615e6ab687
3
+ metadata.gz: ad4975819120b21f08173fa96621aa9374044c8a4dc11984a6857daa1ad3e2e8
4
+ data.tar.gz: 5b02b04486f20e479b75aaac2cc9a65929246232dabdd4c5d616eaab7e8cf445
5
5
  SHA512:
6
- metadata.gz: f81f51171d8b9adaa4d83952899c11f136fac0435961d26aea64a107d23b74142cc3befb1b5fcff03f50e36d6ccd603a8d8d02bfdaf6520c8377534c15435bb0
7
- data.tar.gz: cff67aa184aff54ec64a77be0d077bba5355c19dae43ee9449f7cfc0c985c47650580c5f7c78d8fda20a4443a929daceaf475e53c899344c05ffcc554014acf5
6
+ metadata.gz: 22a2ccc56c83aa604d9f9c893ef644a4a23f6f8736143b17f3cd0d8fd4291607e59d1f7fc29c56ce3c98f0593869683e5f164adf4d721c7c99e77d7cc64ecc54
7
+ data.tar.gz: b5026aecc8b36cd95d9569682fa78969c2a941e5cecb5e993eedb6c2a86194c6218f7f2565fd0c6bbe0fbb306526901854e6eaa8f0fadc0d51a82ba8ef6e8bfb
Binary file
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
Binary file
Binary file
@@ -36,6 +36,6 @@ Gem::Specification.new do |spec|
36
36
  spec.add_dependency "savon"
37
37
  spec.add_dependency "httpi"
38
38
  spec.add_dependency "nokogiri", ">= 1.10.4"
39
- spec.add_development_dependency "bundler"
40
- spec.add_development_dependency "rake"
39
+ spec.add_development_dependency "bundler", "~> 1.16"
40
+ spec.add_development_dependency "rake", "~> 12.3.3"
41
41
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- Afip (1.4.7)
4
+ Afip (1.5.5)
5
5
  httpi
6
6
  nokogiri (>= 1.10.4)
7
7
  savon
@@ -22,8 +22,8 @@ GEM
22
22
  nokogiri (1.10.9)
23
23
  mini_portile2 (~> 2.4.0)
24
24
  nori (2.6.0)
25
- rack (2.2.2)
26
- rake (10.5.0)
25
+ rack (2.2.3)
26
+ rake (12.3.3)
27
27
  savon (2.12.0)
28
28
  akami (~> 1.2)
29
29
  builder (>= 2.1.2)
@@ -42,8 +42,8 @@ PLATFORMS
42
42
 
43
43
  DEPENDENCIES
44
44
  Afip!
45
- bundler
46
- rake
45
+ bundler (~> 1.16)
46
+ rake (~> 12.3.3)
47
47
 
48
48
  BUNDLED WITH
49
- 2.1.4
49
+ 1.17.3
Binary file
Binary file
@@ -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
@@ -86,35 +87,44 @@ module Afip
86
87
 
87
88
  def setup_bill
88
89
  array_ivas = {}
89
- array_ivas["AlicIva"] = ivas.map{ |i| { "Id" => i[0], "BaseImp" => i[1].round(4), "Importe" => i[2].round(4)} unless ["01", "02"].include?(i[0])}.compact
90
+ array_ivas["AlicIva"] = ivas.map{ |i| { "Id" => i[0], "BaseImp" => i[1].round(2), "Importe" => i[2].round(2)} unless ["01", "02"].include?(i[0])}.compact
90
91
 
91
92
  array_tributos = {}
92
93
  array_tributos["Tributo"] = tributos.map{ |t|
93
94
  if t[1].blank?
94
95
  {
95
96
  "Id" => t[0],
96
- "BaseImp" => t[2].to_f.round(4),
97
- "Alic" => t[3].to_f.round(4),
98
- "Importe" => t[4].to_f.round(4)
97
+ "BaseImp" => t[2].to_f.round(2),
98
+ "Alic" => t[3].to_f.round(2),
99
+ "Importe" => t[4].to_f.round(2)
99
100
  }
100
101
  else
101
102
  {
102
103
  "Id" => t[0],
103
104
  "Desc" => t[1],
104
- "BaseImp" => t[2].to_f.round(4),
105
- "Alic" => t[3].to_f.round(4),
106
- "Importe" => t[4].to_f.round(4)
105
+ "BaseImp" => t[2].to_f.round(2),
106
+ "Alic" => t[3].to_f.round(2),
107
+ "Importe" => t[4].to_f.round(2)
107
108
  }
108
109
  end
109
110
  }
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,14 +134,14 @@ 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,
134
- "ImpTotal" => (Afip.own_iva_cond == :responsable_monotributo ? net : total).to_f.round(4),
144
+ "ImpTotal" => (Afip.own_iva_cond == :responsable_monotributo ? net : total).to_f.round(2),
135
145
  "CbteDesde" => next_bill_number,
136
146
  "CbteHasta" => next_bill_number
137
147
  }
@@ -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
+ detail["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"),
@@ -186,7 +200,7 @@ module Afip
186
200
  self.ivas.each{ |i|
187
201
  iva_sum += i[2]
188
202
  }
189
- return iva_sum.round(4)
203
+ return iva_sum.round(2)
190
204
  end
191
205
 
192
206
  def next_bill_number
@@ -200,7 +214,7 @@ module Afip
200
214
 
201
215
  def setup_response(response)
202
216
  # TODO: turn this into an all-purpose Response class
203
- pp response
217
+ pp response
204
218
  result = response[:fecae_solicitar_response][:fecae_solicitar_result]
205
219
 
206
220
  if not result[:fe_det_resp] or not result[:fe_cab_resp] then
@@ -1,3 +1,3 @@
1
1
  module Afip
2
- VERSION = "1.4.8"
2
+ VERSION = "1.5.6"
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.4.8
4
+ version: 1.5.6
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-16 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
@@ -56,30 +56,30 @@ dependencies:
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '1.16'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '1.16'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 12.3.3
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 12.3.3
83
83
  description: Gema para la comunicacion con los Web Services de AFIP.
84
84
  email:
85
85
  - facundo_diaz_martinez@hotmail.com
@@ -87,8 +87,11 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
+ - ".DS_Store"
91
+ - ".gitignore"
90
92
  - Afip-1.2.1.gem
91
- - Afip-1.4.gem
93
+ - Afip-1.4.9.gem
94
+ - Afip-1.5.gem
92
95
  - Afip.gemspec
93
96
  - Gemfile
94
97
  - Gemfile.lock
@@ -97,7 +100,9 @@ files:
97
100
  - Rakefile
98
101
  - bin/console
99
102
  - bin/setup
103
+ - lib/.DS_Store
100
104
  - lib/Afip.rb
105
+ - lib/Afip/.DS_Store
101
106
  - lib/Afip/auth_data.rb
102
107
  - lib/Afip/authorizer.rb
103
108
  - lib/Afip/bill.rb
@@ -109,7 +114,6 @@ files:
109
114
  - lib/Afip/padron.rb
110
115
  - lib/Afip/version.rb
111
116
  - lib/Afip/wsaa.rb
112
- - pkg/Afip-1.4.7.gem
113
117
  homepage: http://litecode.com.ar/
114
118
  licenses:
115
119
  - MIT
Binary file
Binary file