Skip to content

Commit 3667bcc

Browse files
committed
Se cambia el formato de logs
1 parent 5c16bb2 commit 3667bcc

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

lib/transaction_router/switch/webservice_client.rb

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ def log
2929
def call(tipo_tx, params, trx_options)
3030
#Item array creation
3131
item_array = []
32+
33+
log.debug "TRXRTR REQUEST => #{params}"
3234

3335
params.each do |name, value|
3436
item_array << { :nombrecampo => name, :valorcampo => value }
@@ -70,7 +72,7 @@ def call(tipo_tx, params, trx_options)
7072
message(body)
7173
# log.debug "message => #{message}"
7274
end
73-
log.debug "response #{response}"
75+
# log.debug "TRXRTR RESPONSE: #{response}"
7476
# response = client.call(:entrada, message: {:tipo_tx => tipo_tx, item: => item_array})
7577
# response = proxy.webservice! do |soap|
7678
# soap.namespace = ns
@@ -86,32 +88,34 @@ def call(tipo_tx, params, trx_options)
8688
open: #{proxy.request.http.open_timeout}
8789
read: #{proxy.request.http.read_timeout}
8890
EXT
89-
log.error msg
91+
log.error "TRXRTR ERROR" + msg
9092
raise self.settings[:on_timeout_exception], msg
9193
rescue Savon::SOAPFault => exs
9294
msg = <<EXS
9395
Error SOAP al invocar al ws: #{exs.message}
9496
Params: #{body.to_s}
9597
EXS
96-
log.error msg
98+
log.error "TRXRTR ERROR" + msg
9799
raise self.settings[:on_http_error_exception], msg
98100
rescue Savon::HTTPError => exh
99101
msg = <<EXH
100102
Error HTTP al invocar al ws: #{exh.message}
101103
Params: #{body.to_s}
102104
EXH
103-
log.error msg
105+
log.error "TRXRTR ERROR" + msg
104106
raise self.settings[:on_soap_error_exception], msg
105107
end
106108
# se pasa la respuesta a un hash y se chequea que venga el arreglo de items
107109
result = response.to_hash
108-
log.debug "\n \n =====RESPONSE XML ====#{tipo_tx}===>\n #{format_xml response.to_xml} \n \n"
109-
log.debug "Respuesta del ws: #{result.to_s}"
110+
if Rails.env = "development" then
111+
log.debug "\n \n =====RESPONSE XML ====#{tipo_tx}===>\n #{format_xml response.to_xml} \n \n"
112+
end
113+
log.debug "TRXRTR RESPONSE: #{result.to_s}"
110114
if response.nil? or not result.key?(:salida_estandar) or result[:salida_estandar].nil? or not result[:salida_estandar].key?(:item)
111115
msg = <<EXE
112116
La respuesta del ws no es válida o no está completa: #{response.to_s}
113117
EXE
114-
log.error msg
118+
log.error "TRXRTR ERROR" + msg
115119
raise self.settings[:on_empty_response_exception], msg
116120
end
117121
# en vez de un arreglo de hashes individuales, se retorna un hash con pares :nombrecampo => :valorcampo

0 commit comments

Comments
 (0)