fdis 0.1.10 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fdis/facturacion.rb +40 -5
- data/lib/fdis/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: 32c356fa5da7b7e877ea46e3e996f9e4fa1b31be3216fb641948165599a0d15e
|
4
|
+
data.tar.gz: 637f19bc950c24de4cb262a90512a589c9bcb1a1b315d60e36ac09f7dfea933d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fec084e5bfe1bb35bbd61d44eeb22a0eb69d7542d88ac13bf401a60f9161b9bba39ef095ddb8f1fbc5e0c58628dc3b4b3ae8f06fb7cf7e79767285546076e9c
|
7
|
+
data.tar.gz: 7a4038d5863a756d120ec4483f28e4ffc81cb6dbf41ce069d383b4f378b7e3c592cea365e3ca7d21872bbd61db69c282855c3790dfe3902e819cf886a45bd275
|
data/lib/fdis/facturacion.rb
CHANGED
@@ -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
|
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
|
-
|
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
|
-
|
206
|
-
puts "
|
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
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.
|
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-
|
11
|
+
date: 2022-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|