fdis 0.1.10 → 0.1.11

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: 520a75ea98b3981ce2ad784b6f16c4aa3e71717518a6cf10d8e4ef566066a9d5
4
- data.tar.gz: a960ff084bf1772a6551a43feb53df6a532de1ec5366dedd1dfeb8f358e973f8
3
+ metadata.gz: 0b2fb454bc57115bd0fa4c7f95315b0122aae72c070659e7b63a8776206cd736
4
+ data.tar.gz: f65497acb24b633ac32028a31d15515e6336990119c531c011556aab3d9d91d8
5
5
  SHA512:
6
- metadata.gz: 59651fa191b4ff31782182e63957b042318a86fb7b4a3544336bef385c6d92554f49dce21cee6c277c02748ec3de726e3066dd13f66bd3a5d422e965185bd693
7
- data.tar.gz: aadfb046bd81828b4aca783a9f34687b12ba4eeebcefb58a101a32c15d76f024ecef8b6cedd7f4f5593d46d37049cad2655d1d1406dc313050b07d3dab03a4cf
6
+ metadata.gz: c0c6ac3db69281e33487b97d141d9aff787791d71f624dd432d360a93c532acd363a5a357f77ee3edf426bbc8dc0446cee3c1ad373a39ea03ae1407477a7076b
7
+ data.tar.gz: d12dc995ba1f94ebefa64bca2195fcfc45bde93142b51ecab1a9b31cf02c4f0175de0dfbb273e80fa6dc263d9c9ab15c86d9c7dc7893f3bc12777a0aa20765ff
@@ -156,6 +156,35 @@ module Fdis
156
156
  child_pago_relacionado['ImpSaldoInsoluto'] = (saldo_anterior - monto).round(2).to_s
157
157
  saldo_anterior -= monto
158
158
 
159
+ if iva_id == 16 or iva_id == 8
160
+ child_pago_relacionado['ObjetoImpDR'] = '02'
161
+
162
+ impuestos_dr = Nokogiri::XML::Node.new "pago20:ImpuestosDR", xml
163
+ traslados_dr = Nokogiri::XML::Node.new "pago20:TrasladosDR", xml
164
+ traslado = Nokogiri::XML::Node.new "pago20:TrasladoDR", xml
165
+ traslado['TipoFactorDR'] = 'Tasa'
166
+ traslado['ImpuestoDR'] = '002'
167
+
168
+ if iva_id == 16
169
+ traslado['TasaOCuotaDR'] = '0.160000'
170
+ t_subtotal = monto / 1.16
171
+ t_tax = monto - t_subtotal
172
+ else
173
+ traslado['TasaOCuotaDR'] = '0.080000'
174
+ t_subtotal = monto / 1.08
175
+ t_tax = monto - t_subtotal
176
+ end
177
+
178
+ traslado['BaseDR'] = t_subtotal.round(4).to_s #subtotal
179
+ traslado['ImporteDR'] = t_tax.round(4).to_s # tax
180
+
181
+ traslados_dr.add_child(traslado)
182
+ impuestos_dr.add_child(traslados_dr)
183
+ child_pago_relacionado.add_child(impuestos_dr)
184
+ else
185
+ child_pago_relacionado['ObjetoImpDR'] = '01'
186
+ end
187
+
159
188
  child_pago.add_child(child_pago_relacionado)
160
189
  end
161
190
 
@@ -180,7 +209,7 @@ module Fdis
180
209
  File.delete("#{key_pem_url}")
181
210
 
182
211
  puts '------ Fdis: comprobante de pago antes de timbre -------'
183
- puts xml.to_xml
212
+ p xml.to_xml
184
213
  base64_xml = Base64.encode64(xml.to_xml)
185
214
 
186
215
  # haciendo llamada a API
@@ -202,8 +231,15 @@ module Fdis
202
231
  json_response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
203
232
  http.request(request)
204
233
  end
205
- puts "-- #{json_response.code} --"
206
- puts "-- #{json_response.message} --"
234
+
235
+ puts "---- Fdis: request"
236
+ puts "-- body: #{request.body} --"
237
+
238
+ puts "---- Fdis: Respuesta"
239
+ puts "-- Codigo: #{json_response.code} --"
240
+ puts "-- Mensaje: #{json_response.message} --"
241
+ puts "-- Body: "
242
+ p json_response.body
207
243
  # puts "-- Body --"
208
244
  # puts json_response.body
209
245
  # puts '---'
data/lib/fdis/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Fdis
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.11"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fdis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Angel Padilla
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-01 00:00:00.000000000 Z
11
+ date: 2022-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler