activemerchant 1.28.0 → 1.29.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data.tar.gz.sig +3 -3
  2. data/CHANGELOG +36 -0
  3. data/CONTRIBUTORS +8 -0
  4. data/README.md +5 -0
  5. data/lib/active_merchant/billing/gateway.rb +2 -1
  6. data/lib/active_merchant/billing/gateways.rb +6 -7
  7. data/lib/active_merchant/billing/gateways/authorize_net.rb +3 -2
  8. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +77 -78
  9. data/lib/active_merchant/billing/gateways/balanced.rb +0 -1
  10. data/lib/active_merchant/billing/gateways/banwire.rb +1 -2
  11. data/lib/active_merchant/billing/gateways/barclays_epdq.rb +19 -20
  12. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +35 -36
  13. data/lib/active_merchant/billing/gateways/blue_pay.rb +135 -140
  14. data/lib/active_merchant/billing/gateways/braintree_blue.rb +12 -4
  15. data/lib/active_merchant/billing/gateways/card_stream.rb +54 -59
  16. data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -1
  17. data/lib/active_merchant/billing/gateways/cyber_source.rb +19 -14
  18. data/lib/active_merchant/billing/gateways/data_cash.rb +106 -112
  19. data/lib/active_merchant/billing/gateways/efsnet.rb +29 -34
  20. data/lib/active_merchant/billing/gateways/elavon.rb +7 -1
  21. data/lib/active_merchant/billing/gateways/epay.rb +0 -1
  22. data/lib/active_merchant/billing/gateways/eway.rb +88 -93
  23. data/lib/active_merchant/billing/gateways/eway_managed.rb +47 -51
  24. data/lib/active_merchant/billing/gateways/exact.rb +45 -54
  25. data/lib/active_merchant/billing/gateways/federated_canada.rb +3 -4
  26. data/lib/active_merchant/billing/gateways/first_pay.rb +37 -38
  27. data/lib/active_merchant/billing/gateways/garanti.rb +1 -2
  28. data/lib/active_merchant/billing/gateways/hdfc.rb +207 -0
  29. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +5 -8
  30. data/lib/active_merchant/billing/gateways/inspire.rb +52 -52
  31. data/lib/active_merchant/billing/gateways/instapay.rb +10 -11
  32. data/lib/active_merchant/billing/gateways/iridium.rb +38 -39
  33. data/lib/active_merchant/billing/gateways/itransact.rb +7 -9
  34. data/lib/active_merchant/billing/gateways/jetpay.rb +45 -46
  35. data/lib/active_merchant/billing/gateways/linkpoint.rb +104 -108
  36. data/lib/active_merchant/billing/gateways/litle.rb +1 -5
  37. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +153 -155
  38. data/lib/active_merchant/billing/gateways/merchant_ware.rb +49 -50
  39. data/lib/active_merchant/billing/gateways/mercury.rb +272 -0
  40. data/lib/active_merchant/billing/gateways/metrics_global.rb +9 -10
  41. data/lib/active_merchant/billing/gateways/migs.rb +5 -3
  42. data/lib/active_merchant/billing/gateways/modern_payments.rb +6 -7
  43. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +40 -41
  44. data/lib/active_merchant/billing/gateways/moneris.rb +46 -50
  45. data/lib/active_merchant/billing/gateways/moneris_us.rb +52 -55
  46. data/lib/active_merchant/billing/gateways/nab_transact.rb +0 -5
  47. data/lib/active_merchant/billing/gateways/net_registry.rb +20 -21
  48. data/lib/active_merchant/billing/gateways/netaxept.rb +30 -36
  49. data/lib/active_merchant/billing/gateways/netbilling.rb +2 -2
  50. data/lib/active_merchant/billing/gateways/ogone.rb +0 -5
  51. data/lib/active_merchant/billing/gateways/optimal_payment.rb +1 -6
  52. data/lib/active_merchant/billing/gateways/orbital.rb +25 -21
  53. data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +93 -0
  54. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +1 -6
  55. data/lib/active_merchant/billing/gateways/pay_junction.rb +62 -63
  56. data/lib/active_merchant/billing/gateways/pay_secure.rb +29 -30
  57. data/lib/active_merchant/billing/gateways/paybox_direct.rb +0 -5
  58. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +33 -38
  59. data/lib/active_merchant/billing/gateways/payment_express.rb +48 -51
  60. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +7 -11
  61. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +7 -0
  62. data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +3 -0
  63. data/lib/active_merchant/billing/gateways/paystation.rb +62 -64
  64. data/lib/active_merchant/billing/gateways/payway.rb +2 -9
  65. data/lib/active_merchant/billing/gateways/plugnpay.rb +0 -1
  66. data/lib/active_merchant/billing/gateways/psigate.rb +102 -94
  67. data/lib/active_merchant/billing/gateways/psl_card.rb +66 -67
  68. data/lib/active_merchant/billing/gateways/qbms.rb +0 -6
  69. data/lib/active_merchant/billing/gateways/quantum.rb +2 -8
  70. data/lib/active_merchant/billing/gateways/quickpay.rb +2 -3
  71. data/lib/active_merchant/billing/gateways/realex.rb +6 -16
  72. data/lib/active_merchant/billing/gateways/redsys.rb +394 -0
  73. data/lib/active_merchant/billing/gateways/sage.rb +15 -16
  74. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +25 -26
  75. data/lib/active_merchant/billing/gateways/sage_pay.rb +51 -56
  76. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
  77. data/lib/active_merchant/billing/gateways/samurai.rb +1 -4
  78. data/lib/active_merchant/billing/gateways/secure_net.rb +0 -1
  79. data/lib/active_merchant/billing/gateways/secure_pay.rb +5 -8
  80. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +0 -5
  81. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +17 -18
  82. data/lib/active_merchant/billing/gateways/skip_jack.rb +29 -34
  83. data/lib/active_merchant/billing/gateways/smart_ps.rb +55 -56
  84. data/lib/active_merchant/billing/gateways/stripe.rb +8 -3
  85. data/lib/active_merchant/billing/gateways/trans_first.rb +28 -29
  86. data/lib/active_merchant/billing/gateways/trust_commerce.rb +85 -87
  87. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +27 -28
  88. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +0 -5
  89. data/lib/active_merchant/billing/gateways/verifi.rb +86 -87
  90. data/lib/active_merchant/billing/gateways/viaklix.rb +42 -47
  91. data/lib/active_merchant/billing/gateways/vindicia.rb +30 -28
  92. data/lib/active_merchant/billing/gateways/webpay.rb +45 -0
  93. data/lib/active_merchant/billing/gateways/wirecard.rb +0 -6
  94. data/lib/active_merchant/billing/gateways/worldpay.rb +4 -9
  95. data/lib/active_merchant/billing/integrations/a1agregator.rb +26 -0
  96. data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +31 -0
  97. data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +186 -0
  98. data/lib/active_merchant/billing/integrations/a1agregator/status.rb +38 -0
  99. data/lib/active_merchant/billing/integrations/liqpay.rb +30 -0
  100. data/lib/active_merchant/billing/integrations/liqpay/helper.rb +43 -0
  101. data/lib/active_merchant/billing/integrations/liqpay/notification.rb +89 -0
  102. data/lib/active_merchant/billing/integrations/liqpay/return.rb +83 -0
  103. data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +17 -1
  104. data/lib/active_merchant/billing/integrations/notification.rb +4 -0
  105. data/lib/active_merchant/billing/integrations/pay_fast.rb +70 -0
  106. data/lib/active_merchant/billing/integrations/pay_fast/common.rb +42 -0
  107. data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +50 -0
  108. data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +134 -0
  109. data/lib/active_merchant/billing/integrations/pay_fast/return.rb +10 -0
  110. data/lib/active_merchant/billing/integrations/paypal/notification.rb +64 -0
  111. data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +10 -7
  112. data/lib/active_merchant/billing/integrations/webmoney/notification.rb +12 -0
  113. data/lib/active_merchant/billing/response.rb +19 -4
  114. data/lib/active_merchant/version.rb +1 -1
  115. metadata +45 -27
  116. metadata.gz.sig +0 -0
@@ -2,66 +2,66 @@ module ActiveMerchant
2
2
  module Billing
3
3
  #
4
4
  # ActiveMerchant PSL Card Gateway
5
- #
5
+ #
6
6
  # Notes:
7
7
  # -To be able to use the capture function, the IP address of the machine must be
8
8
  # registered with PSL
9
- # -ESALE_KEYED should only be used in situations where the cardholder perceives the
10
- # transaction to be Internet-based, such as purchasing from a web site/on-line store.
11
- # If the Internet is used purely for the transport of information from the merchant
12
- # directly to the gateway then the appropriate cardholder present or not present message
9
+ # -ESALE_KEYED should only be used in situations where the cardholder perceives the
10
+ # transaction to be Internet-based, such as purchasing from a web site/on-line store.
11
+ # If the Internet is used purely for the transport of information from the merchant
12
+ # directly to the gateway then the appropriate cardholder present or not present message
13
13
  # type should be used rather than the ‘E’ equivalent.
14
14
  # -The CV2 / AVS policies are set up with the account settings when signing up for an account
15
15
  class PslCardGateway < Gateway
16
16
  self.money_format = :cents
17
17
  self.default_currency = 'GBP'
18
-
18
+
19
19
  self.supported_countries = ['GB']
20
20
  # Visa Credit, Visa Debit, Mastercard, Maestro, Solo, Electron,
21
21
  # American Express, Diners Club, JCB, International Maestro,
22
22
  # Style, Clydesdale Financial Services, Other
23
-
23
+
24
24
  self.supported_cardtypes = [ :visa, :master, :american_express, :diners_club, :jcb, :switch, :solo, :maestro ]
25
25
  self.homepage_url = 'http://www.paymentsolutionsltd.com/'
26
26
  self.display_name = 'PSL Payment Solutions'
27
-
27
+
28
28
  # Default ISO 3166 country code (GB)
29
29
  cattr_accessor :location
30
30
  self.location = 826
31
-
31
+
32
32
  # PslCard server self.live_url - The url is the same whether testing or live - use
33
33
  # the test account when testing...
34
34
  self.live_url = self.test_url = 'https://pslcard3.paymentsolutionsltd.com/secure/transact.asp?'
35
-
35
+
36
36
  # eCommerce sale transaction, details keyed by merchant or cardholder
37
- MESSAGE_TYPE = 'ESALE_KEYED'
38
-
37
+ MESSAGE_TYPE = 'ESALE_KEYED'
38
+
39
39
  # The type of response that we want to get from PSL, options are HTML, XML or REDIRECT
40
40
  RESPONSE_ACTION = 'HTML'
41
-
41
+
42
42
  # Currency Codes
43
43
  CURRENCY_CODES = {
44
44
  'AUD' => 036,
45
45
  'GBP' => 826,
46
46
  'USD' => 840
47
47
  }
48
-
48
+
49
49
  #The terminal used - only for swipe transactions, so hard coded to 32 for online
50
50
  EMV_TERMINAL_TYPE = 32
51
-
51
+
52
52
  #Different Dispatch types
53
53
  DISPATCH_LATER = 'LATER'
54
54
  DISPATCH_NOW = 'NOW'
55
-
55
+
56
56
  # Return codes
57
57
  APPROVED = '00'
58
-
58
+
59
59
  #Nominal amount to authorize for a 'dispatch later' type
60
60
  #The nominal amount is held straight away, when the goods are ready
61
61
  #to be dispatched, PSL is informed and the full amount is the
62
62
  #taken.
63
63
  NOMINAL_AMOUNT = 101
64
-
64
+
65
65
  AVS_CODE = {
66
66
  "ALL MATCH" => 'Y',
67
67
  "SECURITY CODE MATCH ONLY" => 'N',
@@ -70,7 +70,7 @@ module ActiveMerchant
70
70
  "DATA NOT CHECKED" => 'R',
71
71
  "SECURITY CHECKS NOT SUPPORTED" => 'X'
72
72
  }
73
-
73
+
74
74
  CVV_CODE = {
75
75
  "ALL MATCH" => 'M',
76
76
  "SECURITY CODE MATCH ONLY" => 'M',
@@ -79,23 +79,22 @@ module ActiveMerchant
79
79
  "DATA NOT CHECKED" => 'P',
80
80
  "SECURITY CHECKS NOT SUPPORTED" => 'X'
81
81
  }
82
-
82
+
83
83
  # Create a new PslCardGateway
84
- #
84
+ #
85
85
  # The gateway requires that a valid :login be passed in the options hash
86
- #
86
+ #
87
87
  # Paramaters:
88
88
  # -options:
89
89
  # :login - the PslCard account login (required)
90
90
  def initialize(options = {})
91
91
  requires!(options, :login)
92
-
93
- @options = options
92
+
94
93
  super
95
94
  end
96
95
 
97
96
  # Purchase the item straight away
98
- #
97
+ #
99
98
  # Parameters:
100
99
  # -money: Amount to be charged as an Integer value in cents
101
100
  # -authorization: the PSL cross reference from the previous authorization
@@ -103,27 +102,27 @@ module ActiveMerchant
103
102
  #
104
103
  # Returns:
105
104
  # -ActiveRecord::Billing::Response object
106
- #
105
+ #
107
106
  def purchase(money, credit_card, options = {})
108
107
  post = {}
109
-
108
+
110
109
  add_amount(post, money, DISPATCH_NOW, options)
111
110
  add_credit_card(post, credit_card)
112
111
  add_address(post, options)
113
112
  add_invoice(post, options)
114
113
  add_purchase_details(post)
115
-
114
+
116
115
  commit(post)
117
116
  end
118
-
117
+
119
118
  # Authorize the transaction
120
- #
121
- # Reserves the funds on the customer's credit card, but does not
119
+ #
120
+ # Reserves the funds on the customer's credit card, but does not
122
121
  # charge the card.
123
122
  #
124
123
  # This implementation does not authorize the full amount, rather it checks that the full amount
125
124
  # is available and only 'reserves' the nominal amount (currently a pound and a penny)
126
- #
125
+ #
127
126
  # Parameters:
128
127
  # -money: Amount to be charged as an Integer value in cents
129
128
  # -authorization: the PSL cross reference from the previous authorization
@@ -131,23 +130,23 @@ module ActiveMerchant
131
130
  #
132
131
  # Returns:
133
132
  # -ActiveRecord::Billing::Response object
134
- #
133
+ #
135
134
  def authorize(money, credit_card, options = {})
136
135
  post = {}
137
-
136
+
138
137
  add_amount(post, money, DISPATCH_LATER, options)
139
138
  add_credit_card(post, credit_card)
140
139
  add_address(post, options)
141
140
  add_invoice(post, options)
142
141
  add_purchase_details(post)
143
-
142
+
144
143
  commit(post)
145
144
  end
146
-
147
- # Post an authorization.
145
+
146
+ # Post an authorization.
147
+ #
148
+ # Captures the funds from an authorized transaction.
148
149
  #
149
- # Captures the funds from an authorized transaction.
150
- #
151
150
  # Parameters:
152
151
  # -money: Amount to be charged as an Integer value in cents
153
152
  # -authorization: The PSL Cross Reference
@@ -158,7 +157,7 @@ module ActiveMerchant
158
157
  #
159
158
  def capture(money, authorization, options = {})
160
159
  post = {}
161
-
160
+
162
161
  add_amount(post, money, DISPATCH_NOW, options)
163
162
  add_reference(post, authorization)
164
163
  add_purchase_details(post)
@@ -167,82 +166,82 @@ module ActiveMerchant
167
166
  end
168
167
 
169
168
  private
170
-
169
+
171
170
  def add_credit_card(post, credit_card)
172
171
  post[:QAName] = credit_card.name
173
172
  post[:CardNumber] = credit_card.number
174
173
  post[:EMVTerminalType] = EMV_TERMINAL_TYPE
175
174
  post[:ExpMonth] = credit_card.month
176
175
  post[:ExpYear] = credit_card.year
177
-
178
- if requires_start_date_or_issue_number?(credit_card)
176
+
177
+ if requires_start_date_or_issue_number?(credit_card)
179
178
  post[:IssueNumber] = credit_card.issue_number unless credit_card.issue_number.blank?
180
179
  post[:StartMonth] = credit_card.start_month unless credit_card.start_month.blank?
181
180
  post[:StartYear] = credit_card.start_year unless credit_card.start_year.blank?
182
181
  end
183
-
182
+
184
183
  # CV2 check
185
184
  post[:AVSCV2Check] = credit_card.verification_value? ? 'YES' : 'NO'
186
185
  post[:CV2] = credit_card.verification_value if credit_card.verification_value?
187
186
  end
188
-
187
+
189
188
  def add_address(post, options)
190
189
  address = options[:billing_address] || options[:address]
191
190
  return if address.nil?
192
-
191
+
193
192
  post[:QAAddress] = [:address1, :address2, :city, :state].collect{|a| address[a]}.reject{|a| a.blank?}.join(' ')
194
193
  post[:QAPostcode] = address[:zip]
195
194
  end
196
-
195
+
197
196
  def add_invoice(post, options)
198
197
  post[:MerchantName] = options[:merchant] || 'Merchant Name' # May use this as the order_id field
199
198
  post[:OrderID] = options[:order_id] unless options[:order_id].blank?
200
199
  end
201
-
200
+
202
201
  def add_reference(post, authorization)
203
202
  post[:CrossReference] = authorization
204
203
  end
205
-
204
+
206
205
  def add_amount(post, money, dispatch_type, options)
207
206
  post[:CurrencyCode] = currency_code(options[:currency] || currency(money))
208
-
207
+
209
208
  if dispatch_type == DISPATCH_LATER
210
209
  post[:amount] = amount(NOMINAL_AMOUNT)
211
210
  post[:DispatchLaterAmount] = amount(money)
212
211
  else
213
212
  post[:amount] = amount(money)
214
213
  end
215
-
214
+
216
215
  post[:Dispatch] = dispatch_type
217
216
  end
218
-
217
+
219
218
  def add_purchase_details(post)
220
219
  post[:EchoAmount] = 'YES'
221
220
  post[:SCBI] = 'YES' # Return information about the transaction
222
221
  post[:MessageType] = MESSAGE_TYPE
223
222
  end
224
-
223
+
225
224
  # Get the currency code for the passed money object
226
- #
225
+ #
227
226
  # The money class stores the currency as an ISO 4217:2001 Alphanumeric,
228
227
  # however PSL requires the ISO 4217:2001 Numeric code.
229
- #
228
+ #
230
229
  # Parameters:
231
230
  # -money: Integer value in cents
232
- #
231
+ #
233
232
  # Returns:
234
233
  # -the ISO 4217:2001 Numberic currency code
235
- #
234
+ #
236
235
  def currency_code(currency)
237
236
  CURRENCY_CODES[currency]
238
237
  end
239
-
238
+
240
239
  # Parse the PSL response and create a Response object
241
240
  #
242
241
  # Parameters:
243
242
  # -body: The response string returned from PSL, Formatted:
244
243
  # Key=value&key=value...
245
- #
244
+ #
246
245
  # Returns:
247
246
  # -a hash with all of the values returned in the PSL response
248
247
  #
@@ -255,7 +254,7 @@ module ActiveMerchant
255
254
  end
256
255
  fields.symbolize_keys
257
256
  end
258
-
257
+
259
258
  # Send the passed data to PSL for processing
260
259
  #
261
260
  # Parameters:
@@ -266,23 +265,23 @@ module ActiveMerchant
266
265
  #
267
266
  def commit(request)
268
267
  response = parse( ssl_post(self.live_url, post_data(request)) )
269
-
270
- Response.new(response[:ResponseCode] == APPROVED, response[:Message], response,
271
- :test => test?,
268
+
269
+ Response.new(response[:ResponseCode] == APPROVED, response[:Message], response,
270
+ :test => test?,
272
271
  :authorization => response[:CrossReference],
273
272
  :cvv_result => CVV_CODE[response[:AVSCV2Check]],
274
273
  :avs_result => { :code => AVS_CODE[response[:AVSCV2Check]] }
275
274
  )
276
275
  end
277
-
276
+
278
277
  # Put the passed data into a format that can be submitted to PSL
279
278
  # Key=Value&Key=Value...
280
279
  #
281
280
  # Any ampersands and equal signs are removed from the data being posted
282
- # as PSL puts them back into the response string which then cannot be parsed.
281
+ # as PSL puts them back into the response string which then cannot be parsed.
283
282
  # This is after escaping before sending the request to PSL - this is a work
284
283
  # around for the time being
285
- #
284
+ #
286
285
  # Parameters:
287
286
  # -post: Hash of all the data to be sent
288
287
  #
@@ -294,7 +293,7 @@ module ActiveMerchant
294
293
  post[:MerchantID] = @options[:login]
295
294
  post[:ValidityID] = @options[:password]
296
295
  post[:ResponseAction] = RESPONSE_ACTION
297
-
296
+
298
297
  post.collect { |key, value|
299
298
  "#{key}=#{CGI.escape(value.to_s.tr('&=', ' '))}"
300
299
  }.join("&")
@@ -38,8 +38,6 @@ module ActiveMerchant #:nodoc:
38
38
  #
39
39
  def initialize(options = {})
40
40
  requires!(options, :login, :ticket)
41
- test_mode = options[:test] || false
42
- @options = options
43
41
  super
44
42
  end
45
43
 
@@ -115,10 +113,6 @@ module ActiveMerchant #:nodoc:
115
113
  commit(:query, nil, {})
116
114
  end
117
115
 
118
- def test?
119
- @options[:test] || super
120
- end
121
-
122
116
  private
123
117
 
124
118
  def hosted?
@@ -37,15 +37,9 @@ module ActiveMerchant #:nodoc:
37
37
  #
38
38
  def initialize(options = {})
39
39
  requires!(options, :login, :password)
40
- @options = options
41
40
  super
42
41
  end
43
42
 
44
- # Should run against the test servers or not?
45
- def test?
46
- @options[:test] || Base.gateway_mode == :test
47
- end
48
-
49
43
  # Request an authorization for an amount from CyberSource
50
44
  #
51
45
  def authorize(money, creditcard, options = {})
@@ -268,11 +262,11 @@ module ActiveMerchant #:nodoc:
268
262
  end
269
263
  return reply
270
264
  end
271
-
265
+
272
266
  def authorization_for(reply)
273
267
  "#{reply[:TransactionID]};#{reply[:CreditCardNumber]}"
274
268
  end
275
-
269
+
276
270
  def authorization_parts_from(authorization)
277
271
  authorization.split(/;/)
278
272
  end
@@ -93,7 +93,6 @@ module ActiveMerchant #:nodoc:
93
93
  def initialize(options = {})
94
94
  requires!(options, :login, :password)
95
95
  @protocol = options.delete(:version) || 3 # default to protocol version 3
96
- @options = options
97
96
  super
98
97
  end
99
98
 
@@ -215,10 +214,10 @@ module ActiveMerchant #:nodoc:
215
214
  end
216
215
 
217
216
  def add_testmode(post)
218
- return if post[:transaction].present?
217
+ return if post[:transaction].present?
219
218
  post[:testmode] = test? ? '1' : '0'
220
219
  end
221
-
220
+
222
221
  def add_fraud_parameters(post, options)
223
222
  if @protocol == 4
224
223
  post[:fraud_remote_addr] = options[:fraud_remote_addr] if options[:fraud_remote_addr]
@@ -20,7 +20,7 @@ module ActiveMerchant
20
20
  # same order id
21
21
  class RealexGateway < Gateway
22
22
  self.live_url = self.test_url = 'https://epage.payandshop.com/epage-remote.cgi'
23
-
23
+
24
24
  CARD_MAPPING = {
25
25
  'master' => 'MC',
26
26
  'visa' => 'VISA',
@@ -45,7 +45,6 @@ module ActiveMerchant
45
45
  def initialize(options = {})
46
46
  requires!(options, :login, :password)
47
47
  options[:refund_hash] = Digest::SHA1.hexdigest(options[:rebate_secret]) if options.has_key?(:rebate_secret)
48
- @options = options
49
48
  super
50
49
  end
51
50
 
@@ -81,10 +80,10 @@ module ActiveMerchant
81
80
  def void(authorization, options = {})
82
81
  request = build_void_request(authorization, options)
83
82
  commit(request)
84
- end
85
-
86
- private
87
- def commit(request)
83
+ end
84
+
85
+ private
86
+ def commit(request)
88
87
  response = parse(ssl_post(self.live_url, request))
89
88
 
90
89
  Response.new(response[:result] == "00", message_from(response), response,
@@ -188,7 +187,7 @@ module ActiveMerchant
188
187
 
189
188
  if billing_address
190
189
  xml.tag! 'address', 'type' => 'billing' do
191
- xml.tag! 'code', avs_input_code( billing_address )
190
+ xml.tag! 'code', format_shipping_zip_code(billing_address[:zip])
192
191
  xml.tag! 'country', billing_address[:country]
193
192
  end
194
193
  end
@@ -241,19 +240,10 @@ module ActiveMerchant
241
240
  end
242
241
  end
243
242
 
244
- def avs_input_code(address)
245
- address.values_at(:zip, :address1).map{ |v| extract_digits(v) }.join('|')
246
- end
247
-
248
243
  def format_shipping_zip_code(zip)
249
244
  zip.to_s.gsub(/\W/, '')
250
245
  end
251
246
 
252
- def extract_digits(string)
253
- return "" if string.nil?
254
- string.gsub(/[\D]/,'')
255
- end
256
-
257
247
  def new_timestamp
258
248
  Time.now.strftime('%Y%m%d%H%M%S')
259
249
  end