active_merchant_webpay 0.0.2 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'active_merchant/billing/integrations/notification'
2
3
 
3
4
  module ActiveMerchant #:nodoc:
@@ -9,6 +10,18 @@ module ActiveMerchant #:nodoc:
9
10
  FAILURE_RESPONSE = 'RECHAZADO'
10
11
  VALID_MAC_RESPONSE = 'CORRECTO'
11
12
 
13
+ RESPONSE_CODES = {
14
+ '0' => 'Transacción aprobada.',
15
+ '-1' => 'Rechazo de tx. en B24, No autorizada',
16
+ '-2' => 'Transacción debe reintentarse.',
17
+ '-3' => 'Error en tx.',
18
+ '-4' => 'Rechazo de tx. En B24, No autorizada',
19
+ '-5' => 'Rechazo por error de tasa.',
20
+ '-6' => 'Excede cupo máximo mensual.',
21
+ '-7' => 'Excede límite diario por transacción.',
22
+ '-8' => 'Rubro no autorizado.'
23
+ }
24
+
12
25
  def initialize(raw_post)
13
26
  super(CGI.unescape(raw_post))
14
27
  end
@@ -81,7 +94,7 @@ module ActiveMerchant #:nodoc:
81
94
  end
82
95
 
83
96
  def message
84
- params['TBK_RESPUESTA']
97
+ RESPONSE_CODES[params['TBK_RESPUESTA']]
85
98
  end
86
99
 
87
100
  # Check the transaction's validity. This method has to be called after a new
@@ -101,6 +114,8 @@ module ActiveMerchant #:nodoc:
101
114
  # render :text => notify.acknowledge
102
115
  # end
103
116
  def valid?
117
+ return false if params['TBK_RESPUESTA'] != '0'
118
+
104
119
  if @valid.nil?
105
120
  file = Tempfile.new 'webpay-mac-check'
106
121
  file.write raw
@@ -2,7 +2,7 @@ module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  module Integrations #:nodoc:
4
4
  module Webpay
5
- VERSION = "0.0.2"
5
+ VERSION = "0.0.5"
6
6
  end
7
7
  end
8
8
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 5
9
+ version: 0.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - "Sebasti\xC3\xA1n Gamboa"
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-02-04 00:00:00 -03:00
17
+ date: 2011-02-11 00:00:00 -03:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency