akitaonrails-lw-pagto-certo 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -104,14 +104,14 @@ class LwPagtoCerto
104
104
  payload = IniciaTransacao.new( self.chave_vendedor, self.url_retorno, transacao )
105
105
  response = LwPagtoCerto.soap.iniciaTransacao(payload)
106
106
  response = Hash.from_xml(response.iniciaTransacaoResult)
107
- response = response["loca_web"]["transacao"].symbolize_keys
107
+ response = response["LocaWeb"]["Transacao"].symbolize_keys
108
108
 
109
109
  response[:data] = Time.parse(response[:data].gsub(/(\d+)\/(\d+)\/(\d+)\s(.*)/,
110
110
  "#{$3}-#{$2}-#{$1}T#{$4}")) if response[:data]
111
- if response[:cod_retorno]
111
+ if response[:CodRetorno]
112
112
  response.instance_eval do
113
113
  def cod_retorno_mensagem
114
- LwPagtoCerto::INICIA_COD_RETORNO[self[:cod_retorno].to_sym]
114
+ LwPagtoCerto::INICIA_COD_RETORNO[self[:CodRetorno].to_sym]
115
115
  end
116
116
  end
117
117
  end
@@ -123,25 +123,33 @@ class LwPagtoCerto
123
123
  # lw = LwPagtoCerto.new(:chave_vendedor => "xxxxx", :url_retorno => "http://dominio.com/pagto")
124
124
  # retorno = lw.consulta("xxxxxxxx") # passa Id da transação retornada ao chamar "inicia"
125
125
  #
126
- # puts retorno[:cod_retorno]
127
- # puts retorno[:id_transacao]
128
- # puts retorno[:codigo]
126
+ # puts retorno[:CodRetorno]
127
+ # puts retorno[:IdTransacao]
128
+ # puts retorno[:Codigo]
129
129
  # puts retorno[:data] # => "26/3/2009 15:19:41"
130
- # puts retorno[:mensagem_retorno]
130
+ # puts retorno[:MensagemRetorno]
131
131
  def consulta(id_transacao = "")
132
132
  payload = ConsultaTransacao.new self.chave_vendedor, id_transacao
133
133
  response = LwPagtoCerto.soap.consultaTransacao(payload)
134
134
  response = Hash.from_xml(response.consultaTransacaoResult)
135
- response = response["loca_web"]["transacao"].symbolize_keys
136
- if response[:cod_retorno]
135
+ response = response["LocaWeb"]["Transacao"].symbolize_keys
136
+ if response[:CodRetorno]
137
137
  response.instance_eval do
138
138
  def cod_retorno_mensagem
139
- LwPagtoCerto::FINALIZA_COD_RETORNO[self[:cod_retorno].to_sym]
139
+ LwPagtoCerto::FINALIZA_COD_RETORNO[self[:CodRetorno].to_sym]
140
140
  end
141
141
  end
142
142
  end
143
143
  response
144
144
  end
145
+
146
+ def consultaPedido(id_transacao = "")
147
+ payload = ConsultaTransacao.new self.chave_vendedor, id_transacao
148
+ response = LwPagtoCerto.soap.consultaTransacao(payload)
149
+ response = Hash.from_xml(response.consultaTransacaoResult)
150
+ return response["LocaWeb"]["Pedido"].symbolize_keys if response["LocaWeb"]["Pedido"]
151
+ return []
152
+ end
145
153
 
146
154
  # Usado internamento pelo Inicia Transacao para gerar o XML
147
155
  # que define a transacao sendo iniciada. Utilize os accessors
@@ -199,4 +207,4 @@ class LwPagtoCerto
199
207
  def endpoint_url(url)
200
208
  soap.endpoint_url = url
201
209
  end
202
- end
210
+ end
@@ -1,5 +1,5 @@
1
1
  class LwPagtoCerto
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
 
4
4
  MODULO_CARTAO = "CartaoCredito"
5
5
  MODULO_BOLETO = "Boleto"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: akitaonrails-lw-pagto-certo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabio Akita