fdis 0.1.10 → 0.1.12

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: 520a75ea98b3981ce2ad784b6f16c4aa3e71717518a6cf10d8e4ef566066a9d5
4
- data.tar.gz: a960ff084bf1772a6551a43feb53df6a532de1ec5366dedd1dfeb8f358e973f8
3
+ metadata.gz: 32c356fa5da7b7e877ea46e3e996f9e4fa1b31be3216fb641948165599a0d15e
4
+ data.tar.gz: 637f19bc950c24de4cb262a90512a589c9bcb1a1b315d60e36ac09f7dfea933d
5
5
  SHA512:
6
- metadata.gz: 59651fa191b4ff31782182e63957b042318a86fb7b4a3544336bef385c6d92554f49dce21cee6c277c02748ec3de726e3066dd13f66bd3a5d422e965185bd693
7
- data.tar.gz: aadfb046bd81828b4aca783a9f34687b12ba4eeebcefb58a101a32c15d76f024ecef8b6cedd7f4f5593d46d37049cad2655d1d1406dc313050b07d3dab03a4cf
6
+ metadata.gz: 5fec084e5bfe1bb35bbd61d44eeb22a0eb69d7542d88ac13bf401a60f9161b9bba39ef095ddb8f1fbc5e0c58628dc3b4b3ae8f06fb7cf7e79767285546076e9c
7
+ data.tar.gz: 7a4038d5863a756d120ec4483f28e4ffc81cb6dbf41ce069d383b4f378b7e3c592cea365e3ca7d21872bbd61db69c282855c3790dfe3902e819cf886a45bd275
@@ -98,7 +98,7 @@ module Fdis
98
98
  receptor = xml.at_xpath("//cfdi:Receptor")
99
99
  receptor['Nombre'] = params[:receptor_razon].to_s
100
100
  receptor['Rfc'] = params[:receptor_rfc].to_s
101
- receptor['DomicilioFiscalReceptor'] = params[:receptor_cp].to_s
101
+ receptor['DomicilioFiscalReceptor'] = params.fetch(:receptor_cp, '47180')
102
102
  receptor['RegimenFiscalReceptor'] = params.fetch(:receptor_regimen, '616')
103
103
 
104
104
 
@@ -148,7 +148,6 @@ module Fdis
148
148
  child_pago_relacionado['Folio'] = line[:id].to_s
149
149
 
150
150
  child_pago_relacionado['MonedaDR'] = line.fetch(:moneda, 'MXN')
151
- child_pago_relacionado['MetodoDePagoDR'] = 'PPD'
152
151
  child_pago_relacionado['NumParcialidad'] = (index + 1).to_s
153
152
 
154
153
  child_pago_relacionado['ImpSaldoAnt'] = (saldo_anterior).round(2).to_s
@@ -156,6 +155,35 @@ module Fdis
156
155
  child_pago_relacionado['ImpSaldoInsoluto'] = (saldo_anterior - monto).round(2).to_s
157
156
  saldo_anterior -= monto
158
157
 
158
+ if iva_id == 16 or iva_id == 8
159
+ child_pago_relacionado['ObjetoImpDR'] = '02'
160
+
161
+ impuestos_dr = Nokogiri::XML::Node.new "pago20:ImpuestosDR", xml
162
+ traslados_dr = Nokogiri::XML::Node.new "pago20:TrasladosDR", xml
163
+ traslado = Nokogiri::XML::Node.new "pago20:TrasladoDR", xml
164
+ traslado['TipoFactorDR'] = 'Tasa'
165
+ traslado['ImpuestoDR'] = '002'
166
+
167
+ if iva_id == 16
168
+ traslado['TasaOCuotaDR'] = '0.160000'
169
+ t_subtotal = monto / 1.16
170
+ t_tax = monto - t_subtotal
171
+ else
172
+ traslado['TasaOCuotaDR'] = '0.080000'
173
+ t_subtotal = monto / 1.08
174
+ t_tax = monto - t_subtotal
175
+ end
176
+
177
+ traslado['BaseDR'] = t_subtotal.round(4).to_s #subtotal
178
+ traslado['ImporteDR'] = t_tax.round(4).to_s # tax
179
+
180
+ traslados_dr.add_child(traslado)
181
+ impuestos_dr.add_child(traslados_dr)
182
+ child_pago_relacionado.add_child(impuestos_dr)
183
+ else
184
+ child_pago_relacionado['ObjetoImpDR'] = '01'
185
+ end
186
+
159
187
  child_pago.add_child(child_pago_relacionado)
160
188
  end
161
189
 
@@ -180,7 +208,7 @@ module Fdis
180
208
  File.delete("#{key_pem_url}")
181
209
 
182
210
  puts '------ Fdis: comprobante de pago antes de timbre -------'
183
- puts xml.to_xml
211
+ p xml.to_xml
184
212
  base64_xml = Base64.encode64(xml.to_xml)
185
213
 
186
214
  # haciendo llamada a API
@@ -202,8 +230,15 @@ module Fdis
202
230
  json_response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
203
231
  http.request(request)
204
232
  end
205
- puts "-- #{json_response.code} --"
206
- puts "-- #{json_response.message} --"
233
+
234
+ puts "---- Fdis: request"
235
+ puts "-- body: #{request.body} --"
236
+
237
+ puts "---- Fdis: Respuesta"
238
+ puts "-- Codigo: #{json_response.code} --"
239
+ puts "-- Mensaje: #{json_response.message} --"
240
+ puts "-- Body: "
241
+ p json_response.body
207
242
  # puts "-- Body --"
208
243
  # puts json_response.body
209
244
  # puts '---'
data/lib/fdis/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Fdis
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.12"
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.12
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