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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/Afip/bill.rb +32 -18
- data/lib/Afip/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c67572f7bf760c810d922a48ee4cb8f59d604c196438b16f3493cfb3ad891825
|
4
|
+
data.tar.gz: be22a7e22df3be79f2c65aab15f3d9e9e984ad14e0337fa1f9b858258c98fc82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7610c0b62ce35a555cdf305a48474e4072ec1cdd482e80d807fe24c9f169531eeadcf4dfc947c29fd1f36bea299c563a7ce20576a53c2c0ac535a5eeeb8d9202
|
7
|
+
data.tar.gz: cf2bbc4d6af356f55754f19ed4d1742c1070b61b88edf587f0f7b83d3594d36408ab2299836be6e443a6f7e9048b6a1f600913311c5440b0ecbe14a2e9bed3c6
|
data/Gemfile.lock
CHANGED
data/lib/Afip/bill.rb
CHANGED
@@ -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
|
11
|
-
@body
|
12
|
-
@net
|
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
|
14
|
+
@moneda = attrs[:moneda] || Afip.default_moneda
|
15
15
|
@iva_cond = attrs[:iva_cond]
|
16
16
|
@concepto = attrs[:concepto] || Afip.default_concepto
|
17
|
-
@ivas
|
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
|
26
|
-
@exento
|
25
|
+
@gravado = attrs[:gravado] || 0.0
|
26
|
+
@exento = attrs[:exento] || 0.0
|
27
27
|
@otros_imp = attrs[:otros_imp] || 0.0
|
28
|
-
@total
|
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
|
-
|
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
|
-
|
115
|
-
|
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"
|
137
|
+
"DocNro" => doc_num,
|
128
138
|
"CbteFch" => fecha_emision.strftime('%Y%m%d'),
|
129
139
|
"ImpTotConc" => no_gravado,
|
130
|
-
"ImpNeto"
|
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
|
-
|
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"),
|
data/lib/Afip/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2020-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: savon
|