activemerchant 1.103.0 → 1.104.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +41 -0
  3. data/lib/active_merchant.rb +1 -1
  4. data/lib/active_merchant/billing/avs_result.rb +8 -8
  5. data/lib/active_merchant/billing/compatibility.rb +2 -1
  6. data/lib/active_merchant/billing/credit_card.rb +3 -1
  7. data/lib/active_merchant/billing/credit_card_methods.rb +12 -0
  8. data/lib/active_merchant/billing/cvv_result.rb +0 -1
  9. data/lib/active_merchant/billing/gateway.rb +3 -0
  10. data/lib/active_merchant/billing/gateways/adyen.rb +32 -9
  11. data/lib/active_merchant/billing/gateways/allied_wallet.rb +2 -2
  12. data/lib/active_merchant/billing/gateways/authorize_net.rb +10 -9
  13. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +10 -0
  14. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +1 -0
  15. data/lib/active_merchant/billing/gateways/axcessms.rb +1 -0
  16. data/lib/active_merchant/billing/gateways/balanced.rb +18 -15
  17. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +4 -0
  18. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +3 -1
  19. data/lib/active_merchant/billing/gateways/blue_pay.rb +6 -5
  20. data/lib/active_merchant/billing/gateways/blue_snap.rb +31 -3
  21. data/lib/active_merchant/billing/gateways/borgun.rb +1 -1
  22. data/lib/active_merchant/billing/gateways/bpoint.rb +0 -2
  23. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +1 -0
  24. data/lib/active_merchant/billing/gateways/braintree_blue.rb +11 -4
  25. data/lib/active_merchant/billing/gateways/bridge_pay.rb +1 -1
  26. data/lib/active_merchant/billing/gateways/card_connect.rb +2 -1
  27. data/lib/active_merchant/billing/gateways/card_save.rb +2 -3
  28. data/lib/active_merchant/billing/gateways/card_stream.rb +6 -6
  29. data/lib/active_merchant/billing/gateways/cardprocess.rb +2 -0
  30. data/lib/active_merchant/billing/gateways/cashnet.rb +1 -0
  31. data/lib/active_merchant/billing/gateways/cc5.rb +1 -1
  32. data/lib/active_merchant/billing/gateways/cecabank.rb +1 -0
  33. data/lib/active_merchant/billing/gateways/cenpos.rb +4 -3
  34. data/lib/active_merchant/billing/gateways/checkout_v2.rb +2 -0
  35. data/lib/active_merchant/billing/gateways/citrus_pay.rb +0 -1
  36. data/lib/active_merchant/billing/gateways/clearhaus.rb +3 -2
  37. data/lib/active_merchant/billing/gateways/conekta.rb +5 -3
  38. data/lib/active_merchant/billing/gateways/creditcall.rb +1 -0
  39. data/lib/active_merchant/billing/gateways/credorax.rb +17 -10
  40. data/lib/active_merchant/billing/gateways/ct_payment.rb +1 -0
  41. data/lib/active_merchant/billing/gateways/cyber_source.rb +38 -0
  42. data/lib/active_merchant/billing/gateways/d_local.rb +6 -0
  43. data/lib/active_merchant/billing/gateways/data_cash.rb +1 -1
  44. data/lib/active_merchant/billing/gateways/decidir.rb +18 -2
  45. data/lib/active_merchant/billing/gateways/digitzs.rb +3 -0
  46. data/lib/active_merchant/billing/gateways/ebanx.rb +13 -2
  47. data/lib/active_merchant/billing/gateways/efsnet.rb +3 -2
  48. data/lib/active_merchant/billing/gateways/elavon.rb +1 -1
  49. data/lib/active_merchant/billing/gateways/eway.rb +2 -1
  50. data/lib/active_merchant/billing/gateways/eway_managed.rb +2 -3
  51. data/lib/active_merchant/billing/gateways/eway_rapid.rb +1 -0
  52. data/lib/active_merchant/billing/gateways/exact.rb +3 -3
  53. data/lib/active_merchant/billing/gateways/fat_zebra.rb +2 -1
  54. data/lib/active_merchant/billing/gateways/first_giving.rb +2 -1
  55. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +2 -2
  56. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +1 -0
  57. data/lib/active_merchant/billing/gateways/flo2cash.rb +2 -2
  58. data/lib/active_merchant/billing/gateways/forte.rb +1 -0
  59. data/lib/active_merchant/billing/gateways/garanti.rb +0 -1
  60. data/lib/active_merchant/billing/gateways/global_collect.rb +29 -0
  61. data/lib/active_merchant/billing/gateways/global_transport.rb +0 -1
  62. data/lib/active_merchant/billing/gateways/hdfc.rb +1 -0
  63. data/lib/active_merchant/billing/gateways/hps.rb +9 -7
  64. data/lib/active_merchant/billing/gateways/iats_payments.rb +4 -4
  65. data/lib/active_merchant/billing/gateways/iridium.rb +1 -1
  66. data/lib/active_merchant/billing/gateways/itransact.rb +3 -2
  67. data/lib/active_merchant/billing/gateways/iveri.rb +1 -0
  68. data/lib/active_merchant/billing/gateways/jetpay.rb +1 -1
  69. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +1 -1
  70. data/lib/active_merchant/billing/gateways/latitude19.rb +2 -1
  71. data/lib/active_merchant/billing/gateways/litle.rb +3 -0
  72. data/lib/active_merchant/billing/gateways/mastercard.rb +1 -0
  73. data/lib/active_merchant/billing/gateways/mercado_pago.rb +45 -0
  74. data/lib/active_merchant/billing/gateways/merchant_one.rb +0 -1
  75. data/lib/active_merchant/billing/gateways/merchant_partners.rb +3 -3
  76. data/lib/active_merchant/billing/gateways/merchant_ware.rb +1 -1
  77. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +16 -1
  78. data/lib/active_merchant/billing/gateways/mercury.rb +2 -2
  79. data/lib/active_merchant/billing/gateways/metrics_global.rb +2 -2
  80. data/lib/active_merchant/billing/gateways/micropayment.rb +0 -1
  81. data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
  82. data/lib/active_merchant/billing/gateways/moneris.rb +36 -8
  83. data/lib/active_merchant/billing/gateways/moneris_us.rb +2 -0
  84. data/lib/active_merchant/billing/gateways/mundipagg.rb +6 -1
  85. data/lib/active_merchant/billing/gateways/nab_transact.rb +2 -2
  86. data/lib/active_merchant/billing/gateways/net_registry.rb +1 -1
  87. data/lib/active_merchant/billing/gateways/netbanx.rb +3 -1
  88. data/lib/active_merchant/billing/gateways/netbilling.rb +3 -3
  89. data/lib/active_merchant/billing/gateways/netpay.rb +1 -0
  90. data/lib/active_merchant/billing/gateways/nmi.rb +5 -6
  91. data/lib/active_merchant/billing/gateways/ogone.rb +4 -2
  92. data/lib/active_merchant/billing/gateways/omise.rb +1 -2
  93. data/lib/active_merchant/billing/gateways/openpay.rb +3 -1
  94. data/lib/active_merchant/billing/gateways/opp.rb +1 -0
  95. data/lib/active_merchant/billing/gateways/optimal_payment.rb +4 -5
  96. data/lib/active_merchant/billing/gateways/orbital.rb +17 -13
  97. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +1 -1
  98. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +1 -1
  99. data/lib/active_merchant/billing/gateways/pagarme.rb +1 -0
  100. data/lib/active_merchant/billing/gateways/pay_conex.rb +1 -1
  101. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +1 -1
  102. data/lib/active_merchant/billing/gateways/pay_hub.rb +1 -0
  103. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +1 -0
  104. data/lib/active_merchant/billing/gateways/pay_secure.rb +1 -1
  105. data/lib/active_merchant/billing/gateways/paybox_direct.rb +4 -2
  106. data/lib/active_merchant/billing/gateways/payeezy.rb +2 -0
  107. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -0
  108. data/lib/active_merchant/billing/gateways/payment_express.rb +2 -2
  109. data/lib/active_merchant/billing/gateways/paymentez.rb +4 -0
  110. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +1 -1
  111. data/lib/active_merchant/billing/gateways/paystation.rb +1 -3
  112. data/lib/active_merchant/billing/gateways/payu_in.rb +1 -1
  113. data/lib/active_merchant/billing/gateways/payu_latam.rb +6 -0
  114. data/lib/active_merchant/billing/gateways/payway.rb +3 -2
  115. data/lib/active_merchant/billing/gateways/pin.rb +1 -0
  116. data/lib/active_merchant/billing/gateways/plugnpay.rb +4 -4
  117. data/lib/active_merchant/billing/gateways/pro_pay.rb +1 -0
  118. data/lib/active_merchant/billing/gateways/psigate.rb +2 -1
  119. data/lib/active_merchant/billing/gateways/psl_card.rb +1 -1
  120. data/lib/active_merchant/billing/gateways/qbms.rb +2 -2
  121. data/lib/active_merchant/billing/gateways/quantum.rb +0 -1
  122. data/lib/active_merchant/billing/gateways/quickbooks.rb +2 -0
  123. data/lib/active_merchant/billing/gateways/quickpay.rb +0 -1
  124. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +5 -5
  125. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +1 -0
  126. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -0
  127. data/lib/active_merchant/billing/gateways/qvalent.rb +2 -0
  128. data/lib/active_merchant/billing/gateways/realex.rb +3 -1
  129. data/lib/active_merchant/billing/gateways/redsys.rb +3 -2
  130. data/lib/active_merchant/billing/gateways/s5.rb +1 -0
  131. data/lib/active_merchant/billing/gateways/safe_charge.rb +2 -0
  132. data/lib/active_merchant/billing/gateways/sage.rb +1 -1
  133. data/lib/active_merchant/billing/gateways/sage_pay.rb +8 -6
  134. data/lib/active_merchant/billing/gateways/secure_net.rb +2 -4
  135. data/lib/active_merchant/billing/gateways/secure_pay.rb +2 -2
  136. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +1 -1
  137. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -1
  138. data/lib/active_merchant/billing/gateways/securion_pay.rb +2 -0
  139. data/lib/active_merchant/billing/gateways/skip_jack.rb +6 -5
  140. data/lib/active_merchant/billing/gateways/smart_ps.rb +0 -1
  141. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +0 -1
  142. data/lib/active_merchant/billing/gateways/spreedly_core.rb +1 -0
  143. data/lib/active_merchant/billing/gateways/stripe.rb +7 -0
  144. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +9 -4
  145. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +1 -1
  146. data/lib/active_merchant/billing/gateways/telr.rb +3 -0
  147. data/lib/active_merchant/billing/gateways/tns.rb +0 -1
  148. data/lib/active_merchant/billing/gateways/trans_first.rb +1 -0
  149. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +4 -2
  150. data/lib/active_merchant/billing/gateways/transax.rb +0 -1
  151. data/lib/active_merchant/billing/gateways/trexle.rb +3 -0
  152. data/lib/active_merchant/billing/gateways/usa_epay.rb +0 -1
  153. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +15 -16
  154. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +5 -0
  155. data/lib/active_merchant/billing/gateways/vanco.rb +1 -1
  156. data/lib/active_merchant/billing/gateways/visanet_peru.rb +1 -0
  157. data/lib/active_merchant/billing/gateways/wepay.rb +7 -6
  158. data/lib/active_merchant/billing/gateways/wirecard.rb +6 -3
  159. data/lib/active_merchant/billing/gateways/world_net.rb +1 -0
  160. data/lib/active_merchant/billing/gateways/worldpay.rb +4 -0
  161. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +0 -1
  162. data/lib/active_merchant/billing/gateways/worldpay_us.rb +2 -2
  163. data/lib/active_merchant/billing/response.rb +1 -1
  164. data/lib/active_merchant/connection.rb +2 -0
  165. data/lib/active_merchant/country.rb +1 -0
  166. data/lib/active_merchant/net_http_ssl_connection.rb +1 -0
  167. data/lib/active_merchant/post_data.rb +1 -0
  168. data/lib/active_merchant/version.rb +1 -1
  169. data/lib/support/ssl_verify.rb +0 -2
  170. data/lib/support/ssl_version.rb +0 -1
  171. metadata +2 -2
@@ -143,7 +143,7 @@ module ActiveMerchant #:nodoc:
143
143
  990028 => 'Transaction cancelled' # Customer clicks the 'Cancel' button on the payment page
144
144
  }
145
145
 
146
- SUCCESS_CODES = %w( 990004 990005 990017 990012 990018 990031 )
146
+ SUCCESS_CODES = %w(990004 990005 990017 990012 990018 990031)
147
147
 
148
148
  TRANSACTION_CODES = {
149
149
  0 => 'Not Done',
@@ -145,6 +145,7 @@ module ActiveMerchant #:nodoc:
145
145
 
146
146
  def add_address(post, address)
147
147
  return unless address
148
+
148
149
  post[:address1] = address[:address1]
149
150
  post[:address2] = address[:address2]
150
151
  post[:zip] = address[:zip]
@@ -168,6 +168,7 @@ module ActiveMerchant #:nodoc:
168
168
 
169
169
  def success_from(response)
170
170
  return response['response']['approved'] if response['response']
171
+
171
172
  false
172
173
  end
173
174
 
@@ -79,7 +79,7 @@ module ActiveMerchant #:nodoc:
79
79
  end
80
80
 
81
81
  def authorization_from(response)
82
- [ response[:authnum], response[:transid] ].compact.join(';')
82
+ [response[:authnum], response[:transid]].compact.join(';')
83
83
  end
84
84
 
85
85
  def test_response?(response)
@@ -153,8 +153,10 @@ module ActiveMerchant #:nodoc:
153
153
  request_data = post_data(action, parameters)
154
154
  response = parse(ssl_post(test? ? self.test_url : self.live_url, request_data))
155
155
  response = parse(ssl_post(self.live_url_backup, request_data)) if service_unavailable?(response) && !test?
156
- Response.new(success?(response), message_from(response), response.merge(
157
- :timestamp => parameters[:dateq]),
156
+ Response.new(
157
+ success?(response),
158
+ message_from(response),
159
+ response.merge(:timestamp => parameters[:dateq]),
158
160
  :test => test?,
159
161
  :authorization => response[:numappel].to_s + response[:numtrans].to_s,
160
162
  :fraud_review => false,
@@ -305,6 +305,7 @@ module ActiveMerchant
305
305
 
306
306
  def post_data(params)
307
307
  return nil unless params
308
+
308
309
  params.reject { |k, v| v.blank? }.collect { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
309
310
  end
310
311
 
@@ -335,6 +336,7 @@ module ActiveMerchant
335
336
 
336
337
  def error_code(response, success)
337
338
  return if success
339
+
338
340
  response['Error'].to_h['messages'].to_a.map { |e| e['code'] }.join(', ')
339
341
  end
340
342
 
@@ -132,6 +132,7 @@ module ActiveMerchant #:nodoc:
132
132
 
133
133
  def add_address(xml, tag, address, options)
134
134
  return if address.nil?
135
+
135
136
  xml.tag! tag do
136
137
  xml.tag! 'Name', address[:name] unless address[:name].blank?
137
138
  xml.tag! 'EMail', options[:email] unless options[:email].blank?
@@ -13,9 +13,9 @@ module ActiveMerchant #:nodoc:
13
13
  # VISA, Mastercard, Diners Club and Farmers cards are supported
14
14
  #
15
15
  # However, regular accounts with DPS only support VISA and Mastercard
16
- self.supported_cardtypes = [ :visa, :master, :american_express, :diners_club, :jcb ]
16
+ self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb]
17
17
 
18
- self.supported_countries = %w[ AU FJ GB HK IE MY NZ PG SG US ]
18
+ self.supported_countries = %w[AU FJ GB HK IE MY NZ PG SG US]
19
19
 
20
20
  self.homepage_url = 'http://www.paymentexpress.com/'
21
21
  self.display_name = 'PaymentExpress'
@@ -236,10 +236,13 @@ module ActiveMerchant #:nodoc:
236
236
  def card_success_from(response)
237
237
  return false if response.include?('error')
238
238
  return true if response['message'] == 'card deleted'
239
+
239
240
  response['card']['status'] == 'valid'
240
241
  end
241
242
 
242
243
  def message_from(response)
244
+ return response['detail'] if response['detail'].present?
245
+
243
246
  if !success_from(response) && response['error']
244
247
  response['error'] && response['error']['type']
245
248
  else
@@ -274,6 +277,7 @@ module ActiveMerchant #:nodoc:
274
277
 
275
278
  def error_code_from(response)
276
279
  return if success_from(response)
280
+
277
281
  if response['transaction']
278
282
  detail = response['transaction']['status_detail']
279
283
  return STANDARD_ERROR_CODE[STANDARD_ERROR_CODE_MAPPING[detail]] if STANDARD_ERROR_CODE_MAPPING.include?(detail)
@@ -31,6 +31,7 @@ module ActiveMerchant #:nodoc:
31
31
  def build_setup_request(action, money, options)
32
32
  requires!(options, :items)
33
33
  raise ArgumentError, 'Must include at least 1 Item' unless options[:items].length > 0
34
+
34
35
  options[:items].each do |item|
35
36
  requires!(item, :name, :number, :quantity, :amount, :description, :category)
36
37
  raise ArgumentError, "Each of the items must have the category 'Digital'" unless item[:category] == 'Digital'
@@ -38,7 +39,6 @@ module ActiveMerchant #:nodoc:
38
39
 
39
40
  super
40
41
  end
41
-
42
42
  end
43
43
  end
44
44
  end
@@ -1,7 +1,6 @@
1
1
  module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class PaystationGateway < Gateway
4
-
5
4
  self.live_url = self.test_url = 'https://www.paystation.co.nz/direct/paystation.dll'
6
5
 
7
6
  # an "error code" of "0" means "No error - transaction successful"
@@ -14,7 +13,7 @@ module ActiveMerchant #:nodoc:
14
13
  self.supported_countries = ['NZ']
15
14
 
16
15
  # TODO: check this with paystation (amex and diners need to be enabled)
17
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club ]
16
+ self.supported_cardtypes = [:visa, :master, :american_express, :diners_club]
18
17
 
19
18
  self.homepage_url = 'http://paystation.co.nz'
20
19
  self.display_name = 'Paystation'
@@ -195,7 +194,6 @@ module ActiveMerchant #:nodoc:
195
194
  def format_date(month, year)
196
195
  "#{format(year, :two_digits)}#{format(month, :two_digits)}"
197
196
  end
198
-
199
197
  end
200
198
 
201
199
  class PaystationResponse < Response
@@ -33,7 +33,7 @@ module ActiveMerchant #:nodoc:
33
33
 
34
34
  MultiResponse.run do |r|
35
35
  r.process { commit(url('purchase'), post) }
36
- if(r.params['enrolled'].to_s == '0')
36
+ if r.params['enrolled'].to_s == '0'
37
37
  r.process { commit(r.params['post_uri'], r.params['form_post_vars']) }
38
38
  else
39
39
  r.process { handle_3dsecure(r) }
@@ -180,6 +180,7 @@ module ActiveMerchant #:nodoc:
180
180
 
181
181
  def billing_address_fields(options)
182
182
  return unless address = options[:billing_address]
183
+
183
184
  billing_address = {}
184
185
  billing_address[:street1] = address[:address1]
185
186
  billing_address[:street2] = address[:address2]
@@ -217,6 +218,7 @@ module ActiveMerchant #:nodoc:
217
218
 
218
219
  def shipping_address_fields(options)
219
220
  return unless address = options[:shipping_address]
221
+
220
222
  shipping_address = {}
221
223
  shipping_address[:street1] = address[:address1]
222
224
  shipping_address[:street2] = address[:address2]
@@ -292,6 +294,7 @@ module ActiveMerchant #:nodoc:
292
294
 
293
295
  def add_process_without_cvv2(payment_method, options)
294
296
  return true if payment_method.verification_value.blank? && options[:cvv].blank?
297
+
295
298
  false
296
299
  end
297
300
 
@@ -379,10 +382,12 @@ module ActiveMerchant #:nodoc:
379
382
  case action
380
383
  when 'store'
381
384
  return response['code'] if success
385
+
382
386
  error_description = response['creditCardToken']['errorDescription'] if response['creditCardToken']
383
387
  response['error'] || error_description || 'FAILED'
384
388
  when 'verify_credentials'
385
389
  return 'VERIFIED' if success
390
+
386
391
  'FAILED'
387
392
  else
388
393
  if response['transactionResponse']
@@ -390,6 +395,7 @@ module ActiveMerchant #:nodoc:
390
395
  response_code = response['transactionResponse']['responseCode'] || response['transactionResponse']['pendingReason']
391
396
  end
392
397
  return response_code if success
398
+
393
399
  response['error'] || response_message || response_code || 'FAILED'
394
400
  end
395
401
  end
@@ -3,8 +3,8 @@ module ActiveMerchant
3
3
  class PaywayGateway < Gateway
4
4
  self.live_url = self.test_url = 'https://ccapi.client.qvalent.com/payway/ccapi'
5
5
 
6
- self.supported_countries = [ 'AU' ]
7
- self.supported_cardtypes = [ :visa, :master, :diners_club, :american_express, :bankcard ]
6
+ self.supported_countries = ['AU']
7
+ self.supported_cardtypes = [:visa, :master, :diners_club, :american_express, :bankcard]
8
8
  self.display_name = 'Pay Way'
9
9
  self.homepage_url = 'http://www.payway.com.au'
10
10
  self.default_currency = 'AUD'
@@ -198,6 +198,7 @@ module ActiveMerchant
198
198
  )
199
199
  rescue ActiveMerchant::ResponseError => e
200
200
  raise unless e.response.code == '403'
201
+
201
202
  return Response.new(false, 'Invalid credentials', {}, :test => test?)
202
203
  rescue ActiveMerchant::ClientCertificateError
203
204
  return Response.new(false, 'Invalid certificate', {}, :test => test?)
@@ -101,6 +101,7 @@ module ActiveMerchant #:nodoc:
101
101
 
102
102
  def add_address(post, creditcard, options)
103
103
  return if creditcard.kind_of?(String)
104
+
104
105
  address = (options[:billing_address] || options[:address])
105
106
  return unless address
106
107
 
@@ -16,7 +16,7 @@ module ActiveMerchant
16
16
  'U' => 'Issuer was not certified for card verification'
17
17
  }
18
18
 
19
- CARD_CODE_ERRORS = %w( N S )
19
+ CARD_CODE_ERRORS = %w(N S)
20
20
 
21
21
  AVS_MESSAGES = {
22
22
  'A' => 'Street address matches billing information, zip/postal code does not',
@@ -34,7 +34,7 @@ module ActiveMerchant
34
34
  'Z' => '5-digit zip/postal code matches billing information, street address does not',
35
35
  }
36
36
 
37
- AVS_ERRORS = %w( A E N R W Z )
37
+ AVS_ERRORS = %w(A E N R W Z)
38
38
 
39
39
  PAYMENT_GATEWAY_RESPONSES = {
40
40
  'P01' => 'AVS Mismatch Failure',
@@ -88,8 +88,8 @@ module ActiveMerchant
88
88
  :credit => 'newreturn'
89
89
  }
90
90
 
91
- SUCCESS_CODES = [ 'pending', 'success' ]
92
- FAILURE_CODES = [ 'badcard', 'fraud' ]
91
+ SUCCESS_CODES = ['pending', 'success']
92
+ FAILURE_CODES = ['badcard', 'fraud']
93
93
 
94
94
  self.default_currency = 'USD'
95
95
  self.supported_countries = ['US']
@@ -284,6 +284,7 @@ module ActiveMerchant #:nodoc:
284
284
 
285
285
  def message_from(response)
286
286
  return 'Success' if success_from(response)
287
+
287
288
  message = STATUS_RESPONSE_CODES[response[:status]]
288
289
  message += " - #{TRANSACTION_RESPONSE_CODES[response[:response_code]]}" if response[:response_code]
289
290
 
@@ -180,7 +180,7 @@ module ActiveMerchant #:nodoc:
180
180
  )
181
181
  end
182
182
 
183
- if(address = (options[:billing_address] || options[:address]))
183
+ if (address = (options[:billing_address] || options[:address]))
184
184
  params[:Bname] = address[:name] || creditcard.name
185
185
  params[:Baddress1] = address[:address1] unless address[:address1].blank?
186
186
  params[:Baddress2] = address[:address2] unless address[:address2].blank?
@@ -210,6 +210,7 @@ module ActiveMerchant #:nodoc:
210
210
  return SUCCESS_MESSAGE
211
211
  else
212
212
  return FAILURE_MESSAGE if response[:errmsg].blank?
213
+
213
214
  return response[:errmsg].gsub(/[^\w]/, ' ').split.join(' ').capitalize
214
215
  end
215
216
  end
@@ -21,7 +21,7 @@ module ActiveMerchant
21
21
  # American Express, Diners Club, JCB, International Maestro,
22
22
  # Style, Clydesdale Financial Services, Other
23
23
 
24
- self.supported_cardtypes = [ :visa, :master, :american_express, :diners_club, :jcb, :maestro ]
24
+ self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb, :maestro]
25
25
  self.homepage_url = 'http://www.paymentsolutionsltd.com/'
26
26
  self.display_name = 'PSL Payment Solutions'
27
27
 
@@ -11,8 +11,8 @@ module ActiveMerchant #:nodoc:
11
11
  self.homepage_url = 'http://payments.intuit.com/'
12
12
  self.display_name = 'QuickBooks Merchant Services'
13
13
  self.default_currency = 'USD'
14
- self.supported_cardtypes = [ :visa, :master, :discover, :american_express, :diners_club, :jcb ]
15
- self.supported_countries = [ 'US' ]
14
+ self.supported_cardtypes = [:visa, :master, :discover, :american_express, :diners_club, :jcb]
15
+ self.supported_countries = ['US']
16
16
 
17
17
  TYPES = {
18
18
  :authorize => 'CustomerCreditCardAuth',
@@ -270,7 +270,6 @@ module ActiveMerchant #:nodoc:
270
270
  def authorization_parts_from(authorization)
271
271
  authorization.split(/;/)
272
272
  end
273
-
274
273
  end
275
274
  end
276
275
  end
@@ -240,6 +240,7 @@ module ActiveMerchant #:nodoc:
240
240
  return oauth_v2_headers if @options[:refresh_token]
241
241
 
242
242
  raise ArgumentError, "Invalid HTTP method: #{method}. Valid methods are :post and :get" unless [:post, :get].include?(method)
243
+
243
244
  request_uri = URI.parse(uri)
244
245
 
245
246
  # Following the guidelines from http://nouncer.com/oauth/authentication.html
@@ -285,6 +286,7 @@ module ActiveMerchant #:nodoc:
285
286
  return response unless @options[:refresh_token]
286
287
  return response unless options[:allow_refresh]
287
288
  return response unless response.params['code'] == 'AuthenticationFailed'
289
+
288
290
  refresh_access_token
289
291
  commit(endpoint, body)
290
292
  end
@@ -19,7 +19,6 @@ module ActiveMerchant #:nodoc:
19
19
  QuickpayV10Gateway.new(options)
20
20
  end
21
21
  end
22
-
23
22
  end
24
23
  end
25
24
  end
@@ -140,11 +140,11 @@ module QuickpayCommon
140
140
  10 => {
141
141
  :authorize => %w(mobile_number acquirer autofee customer_id extras
142
142
  zero_auth customer_ip),
143
- :capture => %w( extras ),
144
- :cancel => %w( extras ),
145
- :refund => %w( extras ),
146
- :subscribe => %w( variables branding_id),
147
- :authorize_subscription => %w( mobile_number acquirer customer_ip),
143
+ :capture => %w(extras),
144
+ :cancel => %w(extras),
145
+ :refund => %w(extras),
146
+ :subscribe => %w(variables branding_id),
147
+ :authorize_subscription => %w(mobile_number acquirer customer_ip),
148
148
  :recurring => %w(auto_capture autofee zero_auth)
149
149
  }
150
150
  }
@@ -249,6 +249,7 @@ module ActiveMerchant
249
249
 
250
250
  def map_address(address)
251
251
  return {} if address.nil?
252
+
252
253
  requires!(address, :name, :address1, :city, :zip, :country)
253
254
  country = Country.find(address[:country])
254
255
  mapped = {
@@ -141,6 +141,7 @@ module ActiveMerchant #:nodoc:
141
141
 
142
142
  def add_testmode(post)
143
143
  return if post[:transaction].present?
144
+
144
145
  post[:testmode] = test? ? '1' : '0'
145
146
  end
146
147
 
@@ -147,6 +147,7 @@ module ActiveMerchant #:nodoc:
147
147
 
148
148
  def stored_credential_usage(post, payment_method, options)
149
149
  return unless payment_method.brand == 'visa'
150
+
150
151
  stored_credential = options[:stored_credential]
151
152
  if stored_credential[:initial_transaction]
152
153
  post['card.storedCredentialUsage'] = 'INITIAL_STORAGE'
@@ -222,6 +223,7 @@ module ActiveMerchant #:nodoc:
222
223
 
223
224
  def cvv_result(succeeded, raw)
224
225
  return unless succeeded
226
+
225
227
  code = CVV_CODE_MAPPING[raw['response.cvnResponse']] || raw['response.cvnResponse']
226
228
  CVVResult.new(code)
227
229
  end
@@ -31,7 +31,7 @@ module ActiveMerchant
31
31
 
32
32
  self.money_format = :cents
33
33
  self.default_currency = 'EUR'
34
- self.supported_cardtypes = [ :visa, :master, :american_express, :diners_club ]
34
+ self.supported_cardtypes = [:visa, :master, :american_express, :diners_club]
35
35
  self.supported_countries = %w(IE GB FR BE NL LU IT US CA ES)
36
36
  self.homepage_url = 'http://www.realexpayments.com/'
37
37
  self.display_name = 'Realex'
@@ -268,6 +268,7 @@ module ActiveMerchant
268
268
 
269
269
  def add_comments(xml, options)
270
270
  return unless options[:description]
271
+
271
272
  xml.tag! 'comments' do
272
273
  xml.tag! 'comment', options[:description], 'id' => 1
273
274
  end
@@ -305,6 +306,7 @@ module ActiveMerchant
305
306
 
306
307
  def add_three_d_secure(xml, options)
307
308
  return unless three_d_secure = options[:three_d_secure]
309
+
308
310
  version = three_d_secure.fetch(:version, '')
309
311
  xml.tag! 'mpi' do
310
312
  if version =~ /^2/
@@ -36,7 +36,7 @@ module ActiveMerchant #:nodoc:
36
36
  #
37
37
  #
38
38
  class RedsysGateway < Gateway
39
- self.live_url = 'https://sis.sermepa.es/sis/operaciones'
39
+ self.live_url = 'https://sis.redsys.es/sis/operaciones'
40
40
  self.test_url = 'https://sis-t.redsys.es:25443/sis/operaciones'
41
41
 
42
42
  self.supported_countries = ['ES']
@@ -44,7 +44,7 @@ module ActiveMerchant #:nodoc:
44
44
  self.money_format = :cents
45
45
 
46
46
  # Not all card types may be activated by the bank!
47
- self.supported_cardtypes = [:visa, :master, :american_express, :jcb, :diners_club]
47
+ self.supported_cardtypes = [:visa, :master, :american_express, :jcb, :diners_club, :unionpay]
48
48
  self.homepage_url = 'http://www.redsys.es/'
49
49
  self.display_name = 'Redsys'
50
50
 
@@ -521,6 +521,7 @@ module ActiveMerchant #:nodoc:
521
521
  def currency_code(currency)
522
522
  return currency if currency =~ /^\d+$/
523
523
  raise ArgumentError, "Unknown currency #{currency}" unless CURRENCY_CODES[currency]
524
+
524
525
  CURRENCY_CODES[currency]
525
526
  end
526
527