Afip 1.4.3 → 1.4.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: 000720e3f13fd9d36252f26083c5346bd0eaee36c2f0021d6b002534cfce70bc
4
- data.tar.gz: 2eb800667cdf4f7d32cef9c4a61242a263e14d1681767e8a7e01f09de54f74e5
3
+ metadata.gz: d1e15bae23befe6c31d73deed6eb0c6b5810fc1476737fb33699843bb5130cc6
4
+ data.tar.gz: '0820e7288c7fdb7f9538019ab4c19b324018feecdc217ddbd010a686c9168c86'
5
5
  SHA512:
6
- metadata.gz: 17c43e2fadbb4b7230a9c1c19c7e3831357488959fb1f609ba5459c16824e38915630a6490d0939c37b84a01e821d54939827a507392019ddbfc22a8372a541a
7
- data.tar.gz: 3d35108c84758558169079c678c5a27b77efa6864c3f6798f039dba91ea4ce05d41164436c6b1f7c7fd212beed1f0d519ccd3d3da3ba0cdcfaa07bf841ac2c5b
6
+ metadata.gz: 6f07cbdfa44a0c14f642219261b7192c0553c3ea65fad43f415cc5251d1cbd2ce886e272473817c507c84bd803893dd954771e887c9e60098affc11bf1cfc568
7
+ data.tar.gz: 714431bbbfbb2810e02bdb5a82c5677e7af7d2122de821ad006af5d7067ad7429e874a72a231212559299ce774d38ea7d9b96e7e811fcc45513bedef86627012
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- Afip (1.4.2)
4
+ Afip (1.4.3)
5
5
  httpi
6
6
  nokogiri (>= 1.10.4)
7
7
  savon
data/lib/Afip/bill.rb CHANGED
@@ -3,7 +3,7 @@ module Afip
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
5
  :due_date, :fch_serv_desde, :fch_serv_hasta, :fch_emision,
6
- :ivas, :sale_point, :cant_reg, :no_gravado, :gravado, :exento, :otros_imp, :tributos
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
@@ -27,6 +27,7 @@ module Afip
27
27
  @otros_imp = attrs[:otros_imp] || 0.0
28
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 = attes[:opcionales] || []
30
31
  end
31
32
 
32
33
  def self.get_ptos_vta
@@ -88,25 +89,33 @@ module Afip
88
89
  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
89
90
 
90
91
  array_tributos = {}
91
- array_tributos["Tributo"] = tributos.map{ |t|
92
- if t[1].blank?
93
- {
92
+ array_tributos["Tributo"] = tributos.map{ |t|
93
+ if t[1].blank?
94
+ {
94
95
  "Id" => t[0],
95
96
  "BaseImp" => t[2].to_f.round(2),
96
97
  "Alic" => t[3].to_f.round(2),
97
98
  "Importe" => t[4].to_f.round(2)
98
99
  }
99
- else
100
- {
100
+ else
101
+ {
101
102
  "Id" => t[0],
102
103
  "Desc" => t[1],
103
104
  "BaseImp" => t[2].to_f.round(2),
104
105
  "Alic" => t[3].to_f.round(2),
105
106
  "Importe" => t[4].to_f.round(2)
106
107
  }
107
- end
108
+ end
109
+ }
110
+
111
+ array_opcionales["Opcional"] = opcionales.map{ |t|
112
+ {
113
+ "Id" => t[:id],
114
+ "Valor" => t[:valor]
115
+ }
108
116
  }
109
117
 
118
+
110
119
  fecaereq = {
111
120
  "FeCAEReq" => {
112
121
  "FeCabReq" => Afip::Bill.header(cant_reg, cbte_type, sale_point),
@@ -141,6 +150,10 @@ module Afip
141
150
  detail["Tributos"] = array_tributos
142
151
  end
143
152
 
153
+ if !opcionales.empty?
154
+ detail["Opcionales"] = array_opcionales
155
+ end
156
+
144
157
  unless concepto == "Productos" # En "Productos" ("01"), si se mandan estos parámetros la afip rechaza.
145
158
  detail.merge!({"FchServDesde" => fch_serv_desde.strftime("%Y%m%d"),
146
159
  "FchServHasta" => fch_serv_hasta.strftime("%Y%m%d"),
data/lib/Afip/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Afip
2
- VERSION = "1.4.3"
2
+ VERSION = "1.4.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Afip
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Facundo A. Díaz Martínez