activemerchant 1.83.0 → 1.84.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +19 -0
  3. data/lib/active_merchant/billing/base.rb +1 -1
  4. data/lib/active_merchant/billing/check.rb +3 -2
  5. data/lib/active_merchant/billing/compatibility.rb +2 -4
  6. data/lib/active_merchant/billing/credit_card.rb +6 -39
  7. data/lib/active_merchant/billing/credit_card_formatting.rb +0 -1
  8. data/lib/active_merchant/billing/credit_card_methods.rb +67 -44
  9. data/lib/active_merchant/billing/gateway.rb +1 -8
  10. data/lib/active_merchant/billing/gateways/adyen.rb +1 -1
  11. data/lib/active_merchant/billing/gateways/allied_wallet.rb +0 -1
  12. data/lib/active_merchant/billing/gateways/authorize_net.rb +0 -1
  13. data/lib/active_merchant/billing/gateways/axcessms.rb +1 -1
  14. data/lib/active_merchant/billing/gateways/balanced.rb +9 -9
  15. data/lib/active_merchant/billing/gateways/banwire.rb +5 -5
  16. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +1 -1
  17. data/lib/active_merchant/billing/gateways/beanstream.rb +1 -0
  18. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +0 -1
  19. data/lib/active_merchant/billing/gateways/blue_snap.rb +5 -7
  20. data/lib/active_merchant/billing/gateways/braintree_blue.rb +12 -6
  21. data/lib/active_merchant/billing/gateways/bridge_pay.rb +0 -1
  22. data/lib/active_merchant/billing/gateways/card_connect.rb +2 -2
  23. data/lib/active_merchant/billing/gateways/card_save.rb +1 -1
  24. data/lib/active_merchant/billing/gateways/card_stream.rb +9 -18
  25. data/lib/active_merchant/billing/gateways/cardknox.rb +8 -9
  26. data/lib/active_merchant/billing/gateways/cc5.rb +0 -1
  27. data/lib/active_merchant/billing/gateways/cecabank.rb +0 -1
  28. data/lib/active_merchant/billing/gateways/cenpos.rb +1 -1
  29. data/lib/active_merchant/billing/gateways/checkout_v2.rb +6 -6
  30. data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -1
  31. data/lib/active_merchant/billing/gateways/commercegate.rb +0 -1
  32. data/lib/active_merchant/billing/gateways/conekta.rb +6 -8
  33. data/lib/active_merchant/billing/gateways/creditcall.rb +1 -2
  34. data/lib/active_merchant/billing/gateways/ct_payment.rb +1 -1
  35. data/lib/active_merchant/billing/gateways/culqi.rb +8 -10
  36. data/lib/active_merchant/billing/gateways/cyber_source.rb +1 -2
  37. data/lib/active_merchant/billing/gateways/data_cash.rb +16 -29
  38. data/lib/active_merchant/billing/gateways/dibs.rb +1 -7
  39. data/lib/active_merchant/billing/gateways/digitzs.rb +1 -1
  40. data/lib/active_merchant/billing/gateways/efsnet.rb +0 -4
  41. data/lib/active_merchant/billing/gateways/element.rb +1 -1
  42. data/lib/active_merchant/billing/gateways/epay.rb +8 -9
  43. data/lib/active_merchant/billing/gateways/eway.rb +1 -0
  44. data/lib/active_merchant/billing/gateways/eway_managed.rb +2 -3
  45. data/lib/active_merchant/billing/gateways/exact.rb +0 -2
  46. data/lib/active_merchant/billing/gateways/ezic.rb +0 -1
  47. data/lib/active_merchant/billing/gateways/fat_zebra.rb +9 -11
  48. data/lib/active_merchant/billing/gateways/federated_canada.rb +1 -1
  49. data/lib/active_merchant/billing/gateways/first_giving.rb +3 -3
  50. data/lib/active_merchant/billing/gateways/first_pay.rb +5 -0
  51. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +2 -2
  52. data/lib/active_merchant/billing/gateways/garanti.rb +4 -5
  53. data/lib/active_merchant/billing/gateways/global_collect.rb +6 -7
  54. data/lib/active_merchant/billing/gateways/iats_payments.rb +1 -1
  55. data/lib/active_merchant/billing/gateways/inspire.rb +2 -2
  56. data/lib/active_merchant/billing/gateways/ipp.rb +1 -1
  57. data/lib/active_merchant/billing/gateways/iridium.rb +3 -3
  58. data/lib/active_merchant/billing/gateways/iveri.rb +1 -1
  59. data/lib/active_merchant/billing/gateways/komoju.rb +1 -1
  60. data/lib/active_merchant/billing/gateways/kushki.rb +7 -9
  61. data/lib/active_merchant/billing/gateways/latitude19.rb +29 -34
  62. data/lib/active_merchant/billing/gateways/linkpoint.rb +1 -3
  63. data/lib/active_merchant/billing/gateways/litle.rb +1 -1
  64. data/lib/active_merchant/billing/gateways/mastercard.rb +1 -2
  65. data/lib/active_merchant/billing/gateways/mercado_pago.rb +0 -1
  66. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +0 -1
  67. data/lib/active_merchant/billing/gateways/merchant_one.rb +1 -1
  68. data/lib/active_merchant/billing/gateways/merchant_ware.rb +3 -3
  69. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +3 -3
  70. data/lib/active_merchant/billing/gateways/mercury.rb +1 -1
  71. data/lib/active_merchant/billing/gateways/micropayment.rb +0 -2
  72. data/lib/active_merchant/billing/gateways/modern_payments.rb +1 -0
  73. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +4 -3
  74. data/lib/active_merchant/billing/gateways/moneris.rb +0 -1
  75. data/lib/active_merchant/billing/gateways/moneris_us.rb +1 -2
  76. data/lib/active_merchant/billing/gateways/money_movers.rb +1 -1
  77. data/lib/active_merchant/billing/gateways/mundipagg.rb +9 -9
  78. data/lib/active_merchant/billing/gateways/nab_transact.rb +0 -1
  79. data/lib/active_merchant/billing/gateways/net_registry.rb +1 -0
  80. data/lib/active_merchant/billing/gateways/nmi.rb +1 -2
  81. data/lib/active_merchant/billing/gateways/ogone.rb +9 -10
  82. data/lib/active_merchant/billing/gateways/openpay.rb +7 -8
  83. data/lib/active_merchant/billing/gateways/opp.rb +110 -112
  84. data/lib/active_merchant/billing/gateways/optimal_payment.rb +1 -4
  85. data/lib/active_merchant/billing/gateways/orbital.rb +1 -2
  86. data/lib/active_merchant/billing/gateways/pagarme.rb +3 -5
  87. data/lib/active_merchant/billing/gateways/pay_conex.rb +0 -1
  88. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +10 -12
  89. data/lib/active_merchant/billing/gateways/pay_secure.rb +1 -1
  90. data/lib/active_merchant/billing/gateways/paybox_direct.rb +0 -1
  91. data/lib/active_merchant/billing/gateways/payeezy.rb +15 -4
  92. data/lib/active_merchant/billing/gateways/payex.rb +5 -6
  93. data/lib/active_merchant/billing/gateways/payflow.rb +0 -4
  94. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -2
  95. data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +1 -1
  96. data/lib/active_merchant/billing/gateways/payflow_express.rb +54 -55
  97. data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -1
  98. data/lib/active_merchant/billing/gateways/payment_express.rb +0 -6
  99. data/lib/active_merchant/billing/gateways/paymill.rb +0 -2
  100. data/lib/active_merchant/billing/gateways/paypal.rb +0 -8
  101. data/lib/active_merchant/billing/gateways/payscout.rb +0 -1
  102. data/lib/active_merchant/billing/gateways/paystation.rb +2 -2
  103. data/lib/active_merchant/billing/gateways/payu_latam.rb +37 -32
  104. data/lib/active_merchant/billing/gateways/pin.rb +2 -2
  105. data/lib/active_merchant/billing/gateways/plugnpay.rb +1 -0
  106. data/lib/active_merchant/billing/gateways/psl_card.rb +3 -10
  107. data/lib/active_merchant/billing/gateways/quantum.rb +4 -4
  108. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +0 -3
  109. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +3 -7
  110. data/lib/active_merchant/billing/gateways/realex.rb +6 -8
  111. data/lib/active_merchant/billing/gateways/redsys.rb +1 -0
  112. data/lib/active_merchant/billing/gateways/s5.rb +0 -1
  113. data/lib/active_merchant/billing/gateways/safe_charge.rb +4 -4
  114. data/lib/active_merchant/billing/gateways/sage.rb +16 -13
  115. data/lib/active_merchant/billing/gateways/sage_pay.rb +2 -9
  116. data/lib/active_merchant/billing/gateways/secure_net.rb +0 -1
  117. data/lib/active_merchant/billing/gateways/securion_pay.rb +3 -6
  118. data/lib/active_merchant/billing/gateways/skip_jack.rb +2 -2
  119. data/lib/active_merchant/billing/gateways/smart_ps.rb +2 -4
  120. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +5 -5
  121. data/lib/active_merchant/billing/gateways/spreedly_core.rb +1 -2
  122. data/lib/active_merchant/billing/gateways/stripe.rb +60 -15
  123. data/lib/active_merchant/billing/gateways/telr.rb +5 -6
  124. data/lib/active_merchant/billing/gateways/tns.rb +1 -1
  125. data/lib/active_merchant/billing/gateways/trans_first.rb +0 -1
  126. data/lib/active_merchant/billing/gateways/trexle.rb +6 -5
  127. data/lib/active_merchant/billing/gateways/trust_commerce.rb +1 -0
  128. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +2 -2
  129. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +0 -1
  130. data/lib/active_merchant/billing/gateways/vanco.rb +1 -1
  131. data/lib/active_merchant/billing/gateways/viaklix.rb +1 -0
  132. data/lib/active_merchant/billing/gateways/visanet_peru.rb +28 -32
  133. data/lib/active_merchant/billing/gateways/wepay.rb +0 -1
  134. data/lib/active_merchant/billing/gateways/wirecard.rb +2 -1
  135. data/lib/active_merchant/billing/gateways/worldpay.rb +1 -4
  136. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +5 -8
  137. data/lib/active_merchant/connection.rb +0 -2
  138. data/lib/active_merchant/country.rb +1 -0
  139. data/lib/active_merchant/net_http_ssl_connection.rb +1 -1
  140. data/lib/active_merchant/network_connection_retries.rb +1 -0
  141. data/lib/active_merchant/post_data.rb +1 -0
  142. data/lib/active_merchant/posts_data.rb +0 -2
  143. data/lib/active_merchant/version.rb +1 -1
  144. data/lib/support/gateway_support.rb +3 -4
  145. data/lib/support/ssl_verify.rb +0 -1
  146. metadata +2 -2
@@ -2,7 +2,6 @@ require 'rexml/document'
2
2
 
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
-
6
5
  # Initialization Options
7
6
  # :login Your store number
8
7
  # :pem The text of your linkpoint PEM file. Note
@@ -259,6 +258,7 @@ module ActiveMerchant #:nodoc:
259
258
  end
260
259
 
261
260
  private
261
+
262
262
  # Commit the transaction by posting the XML file to the LinkPoint server
263
263
  def commit(money, creditcard, options = {})
264
264
  response = parse(ssl_post(test? ? self.test_url : self.live_url, post_data(money, creditcard, options)))
@@ -324,7 +324,6 @@ module ActiveMerchant #:nodoc:
324
324
  # Set up the parameters hash just once so we don't have to do it
325
325
  # for every action.
326
326
  def parameters(money, creditcard, options = {})
327
-
328
327
  params = {
329
328
  :payment => {
330
329
  :subtotal => amount(options[:subtotal]),
@@ -418,7 +417,6 @@ module ActiveMerchant #:nodoc:
418
417
  end
419
418
 
420
419
  def parse(xml)
421
-
422
420
  # For reference, a typical response...
423
421
  # <r_csp></r_csp>
424
422
  # <r_time></r_time>
@@ -364,7 +364,7 @@ module ActiveMerchant #:nodoc:
364
364
 
365
365
  doc = Nokogiri::XML(xml).remove_namespaces!
366
366
  doc.xpath("//litleOnlineResponse/#{kind}Response/*").each do |node|
367
- if (node.elements.empty?)
367
+ if node.elements.empty?
368
368
  parsed[node.name.to_sym] = node.text
369
369
  else
370
370
  node.elements.each do |childnode|
@@ -1,7 +1,6 @@
1
1
  module ActiveMerchant
2
2
  module Billing
3
3
  module MastercardGateway
4
-
5
4
  def initialize(options={})
6
5
  requires!(options, :userid, :password)
7
6
  super
@@ -81,6 +80,7 @@ module ActiveMerchant
81
80
  end
82
81
 
83
82
  private
83
+
84
84
  def new_post
85
85
  {
86
86
  order: {},
@@ -262,7 +262,6 @@ module ActiveMerchant
262
262
  next_transactionid = SecureRandom.uuid
263
263
  [orderid, next_transactionid, prev_transactionid]
264
264
  end
265
-
266
265
  end
267
266
  end
268
267
  end
@@ -119,7 +119,6 @@ module ActiveMerchant #:nodoc:
119
119
  ip_address: options[:ip_address]
120
120
  }.merge(options[:additional_info] || {})
121
121
 
122
-
123
122
  add_address(post, options)
124
123
  add_shipping_address(post, options)
125
124
  end
@@ -158,7 +158,6 @@ module ActiveMerchant #:nodoc:
158
158
  url = test? ? self.test_url : self.live_url
159
159
  parameters[:transaction_amount] = amount(money) if money unless action == 'V'
160
160
 
161
-
162
161
  response = begin
163
162
  parse( ssl_post(url, post_data(action,parameters)) )
164
163
  rescue ActiveMerchant::ResponseError => e
@@ -77,7 +77,7 @@ module ActiveMerchant #:nodoc:
77
77
  def add_creditcard(post, creditcard)
78
78
  post['cvv'] = creditcard.verification_value
79
79
  post['ccnumber'] = creditcard.number
80
- post['ccexp'] = "#{sprintf("%02d", creditcard.month)}#{"#{creditcard.year}"[-2, 2]}"
80
+ post['ccexp'] = "#{sprintf("%02d", creditcard.month)}#{creditcard.year.to_s[-2, 2]}"
81
81
  end
82
82
 
83
83
  def commit(action, money, parameters={})
@@ -293,9 +293,9 @@ module ActiveMerchant #:nodoc:
293
293
  def commit(action, request, v4 = false)
294
294
  begin
295
295
  data = ssl_post(url(v4), request,
296
- 'Content-Type' => 'text/xml; charset=utf-8',
297
- 'SOAPAction' => soap_action(action, v4)
298
- )
296
+ 'Content-Type' => 'text/xml; charset=utf-8',
297
+ 'SOAPAction' => soap_action(action, v4)
298
+ )
299
299
  response = parse(action, data)
300
300
  rescue ActiveMerchant::ResponseError => e
301
301
  response = parse_error(e.response)
@@ -262,9 +262,9 @@ module ActiveMerchant #:nodoc:
262
262
  def commit(action, request)
263
263
  begin
264
264
  data = ssl_post(url, request,
265
- 'Content-Type' => 'text/xml; charset=utf-8',
266
- 'SOAPAction' => soap_action(action)
267
- )
265
+ 'Content-Type' => 'text/xml; charset=utf-8',
266
+ 'SOAPAction' => soap_action(action)
267
+ )
268
268
  response = parse(action, data)
269
269
  rescue ActiveMerchant::ResponseError => e
270
270
  response = parse_error(e.response, action)
@@ -319,7 +319,7 @@ module ActiveMerchant #:nodoc:
319
319
  end
320
320
 
321
321
  def authorization_from(response)
322
- dollars, cents = (response[:purchase] || '').split('.').collect{|e| e.to_i}
322
+ dollars, cents = (response[:purchase] || '').split('.').collect(&:to_i)
323
323
  dollars ||= 0
324
324
  cents ||= 0
325
325
  [
@@ -12,7 +12,6 @@ module ActiveMerchant #:nodoc:
12
12
  self.money_format = :cents
13
13
  self.supported_cardtypes = [:visa, :master, :american_express]
14
14
 
15
-
16
15
  def initialize(options={})
17
16
  requires!(options, :access_key)
18
17
  super
@@ -57,7 +56,6 @@ module ActiveMerchant #:nodoc:
57
56
  end
58
57
 
59
58
  def verify(credit_card, options={})
60
-
61
59
  MultiResponse.run(:use_first_response) do |r|
62
60
  r.process { authorize(250, credit_card, options) }
63
61
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -28,6 +28,7 @@ module ActiveMerchant #:nodoc:
28
28
  end
29
29
 
30
30
  private
31
+
31
32
  def cim
32
33
  @cim ||= ModernPaymentsCimGateway.new(@options)
33
34
  end
@@ -66,6 +66,7 @@ module ActiveMerchant #:nodoc:
66
66
  end
67
67
 
68
68
  private
69
+
69
70
  def add_payment_details(post, options)
70
71
  post[:pmtDate] = (options[:payment_date] || Time.now.utc).strftime('%Y-%m-%dT%H:%M:%SZ')
71
72
  post[:pmtType] = PAYMENT_METHOD[options[:payment_method] || :credit_card]
@@ -146,9 +147,9 @@ module ActiveMerchant #:nodoc:
146
147
 
147
148
  def commit(action, params)
148
149
  data = ssl_post(url(action), build_request(action, params),
149
- { 'Content-Type' =>'text/xml; charset=utf-8',
150
- 'SOAPAction' => "#{xmlns(action)}#{action}" }
151
- )
150
+ { 'Content-Type' =>'text/xml; charset=utf-8',
151
+ 'SOAPAction' => "#{xmlns(action)}#{action}" }
152
+ )
152
153
 
153
154
  response = parse(action, data)
154
155
  Response.new(successful?(action, response), message_from(action, response), response,
@@ -2,7 +2,6 @@ require 'rexml/document'
2
2
 
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
-
6
5
  # To learn more about the Moneris gateway, please contact
7
6
  # eselectplus@moneris.com for a copy of their integration guide. For
8
7
  # information on remote testing, please see "Test Environment Penny Value
@@ -2,7 +2,6 @@ require 'rexml/document'
2
2
 
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
-
6
5
  # To learn more about the Moneris (US) gateway, please contact
7
6
  # ussales@moneris.com for a copy of their integration guide. For
8
7
  # information on remote testing, please see "Test Environment Penny Value
@@ -58,7 +57,7 @@ module ActiveMerchant #:nodoc:
58
57
  post[:order_id] = options[:order_id]
59
58
  post[:address] = options[:billing_address] || options[:address]
60
59
  post[:crypt_type] = options[:crypt_type] || @options[:crypt_type]
61
- action = (post[:data_key].blank?) ? 'us_preauth' : 'us_res_preauth_cc'
60
+ action = post[:data_key].blank? ? 'us_preauth' : 'us_res_preauth_cc'
62
61
  commit(action, post)
63
62
  end
64
63
 
@@ -126,7 +126,7 @@ module ActiveMerchant #:nodoc:
126
126
  end
127
127
 
128
128
  def test?
129
- (@options[:login].eql?('demo')) && (@options[:password].eql?('password'))
129
+ @options[:login].eql?('demo') && @options[:password].eql?('password')
130
130
  end
131
131
 
132
132
  def message_from(response)
@@ -247,15 +247,15 @@ module ActiveMerchant #:nodoc:
247
247
  test: test?,
248
248
  error_code: error_code_from(response)
249
249
  )
250
- rescue ResponseError => e
251
- message = get_error_message(e)
252
- return Response.new(
253
- false,
254
- "#{STANDARD_ERROR_MESSAGE_MAPPING[e.response.code]} #{message}",
255
- parse(e.response.body),
256
- test: test?,
257
- error_code: STANDARD_ERROR_CODE_MAPPING[e.response.code],
258
- )
250
+ rescue ResponseError => e
251
+ message = get_error_message(e)
252
+ return Response.new(
253
+ false,
254
+ "#{STANDARD_ERROR_MESSAGE_MAPPING[e.response.code]} #{message}",
255
+ parse(e.response.body),
256
+ test: test?,
257
+ error_code: STANDARD_ERROR_CODE_MAPPING[e.response.code]
258
+ )
259
259
  end
260
260
 
261
261
  def success_from(response)
@@ -41,7 +41,6 @@ module ActiveMerchant #:nodoc:
41
41
 
42
42
  SUCCESS_CODES = [ '00', '08', '11', '16', '77' ]
43
43
 
44
-
45
44
  def initialize(options = {})
46
45
  requires!(options, :login, :password)
47
46
  super
@@ -122,6 +122,7 @@ module ActiveMerchant
122
122
  end
123
123
 
124
124
  private
125
+
125
126
  def add_request_details(params, options)
126
127
  params['COMMENT'] = options[:description] unless options[:description].blank?
127
128
  end
@@ -140,7 +140,7 @@ module ActiveMerchant #:nodoc:
140
140
  def add_payment_method(post, payment_method, options)
141
141
  if(payment_method.is_a?(String))
142
142
  post[:customer_vault_id] = payment_method
143
- elsif (payment_method.is_a?(NetworkTokenizationCreditCard))
143
+ elsif payment_method.is_a?(NetworkTokenizationCreditCard)
144
144
  post[:ccnumber] = payment_method.number
145
145
  post[:ccexp] = exp_date(payment_method)
146
146
  post[:token_cryptogram] = payment_method.payment_cryptogram
@@ -214,7 +214,6 @@ module ActiveMerchant #:nodoc:
214
214
  end
215
215
 
216
216
  def commit(action, params)
217
-
218
217
  params[action == 'add_customer' ? :customer_vault : :type] = action
219
218
  params[:username] = @options[:login]
220
219
  params[:password] = @options[:password]
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+
2
3
  require 'rexml/document'
3
4
 
4
5
  module ActiveMerchant #:nodoc:
@@ -121,12 +122,10 @@ module ActiveMerchant #:nodoc:
121
122
 
122
123
  SUCCESS_MESSAGE = 'The transaction was successful'
123
124
 
124
- THREE_D_SECURE_DISPLAY_WAYS = { :main_window => 'MAINW', # display the identification page in the main window
125
- # (default value).
126
- :pop_up => 'POPUP', # display the identification page in a pop-up window
127
- # and return to the main window at the end.
128
- :pop_ix => 'POPIX' } # display the identification page in a pop-up window
129
- # and remain in the pop-up window.
125
+ THREE_D_SECURE_DISPLAY_WAYS = { :main_window => 'MAINW', # display the identification page in the main window (default value).
126
+
127
+ :pop_up => 'POPUP', # display the identification page in a pop-up window and return to the main window at the end.
128
+ :pop_ix => 'POPIX' } # display the identification page in a pop-up window and remain in the pop-up window.
130
129
 
131
130
  OGONE_NO_SIGNATURE_DEPRECATION_MESSAGE = 'Signature usage will be the default for a future release of ActiveMerchant. You should either begin using it, or update your configuration to explicitly disable it (signature_encryptor: none)'
132
131
  OGONE_STORE_OPTION_DEPRECATION_MESSAGE = "The 'store' option has been renamed to 'billing_id', and its usage is deprecated."
@@ -226,10 +225,10 @@ module ActiveMerchant #:nodoc:
226
225
 
227
226
  def scrub(transcript)
228
227
  transcript.
229
- gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
230
- gsub(%r((&?cardno=)[^&]*)i, '\1[FILTERED]').
231
- gsub(%r((&?cvc=)[^&]*)i, '\1[FILTERED]').
232
- gsub(%r((&?pswd=)[^&]*)i, '\1[FILTERED]')
228
+ gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
229
+ gsub(%r((&?cardno=)[^&]*)i, '\1[FILTERED]').
230
+ gsub(%r((&?cvc=)[^&]*)i, '\1[FILTERED]').
231
+ gsub(%r((&?pswd=)[^&]*)i, '\1[FILTERED]')
233
232
  end
234
233
 
235
234
  private
@@ -5,7 +5,7 @@ module ActiveMerchant #:nodoc:
5
5
  self.test_url = 'https://sandbox-api.openpay.mx/v1/'
6
6
 
7
7
  self.supported_countries = ['MX']
8
- self.supported_cardtypes = [:visa, :master, :american_express]
8
+ self.supported_cardtypes = [:visa, :master, :american_express, :carnet]
9
9
  self.homepage_url = 'http://www.openpay.mx/'
10
10
  self.display_name = 'Openpay'
11
11
  self.default_currency = 'MXN'
@@ -104,6 +104,7 @@ module ActiveMerchant #:nodoc:
104
104
  gsub(%r((cvv2\\?":\\?")\\?"), '\1[BLANK]"').
105
105
  gsub(%r((cvv2\\?":\\?")\s+), '\1[BLANK]')
106
106
  end
107
+
107
108
  private
108
109
 
109
110
  def create_post_for_auth_or_purchase(money, creditcard, options)
@@ -126,8 +127,8 @@ module ActiveMerchant #:nodoc:
126
127
  elsif creditcard.respond_to?(:number)
127
128
  card = {
128
129
  card_number: creditcard.number,
129
- expiration_month: "#{sprintf("%02d", creditcard.month)}",
130
- expiration_year: "#{"#{creditcard.year}"[-2, 2]}",
130
+ expiration_month: sprintf('%02d', creditcard.month),
131
+ expiration_year: creditcard.year.to_s[-2, 2],
131
132
  cvv2: creditcard.verification_value,
132
133
  holder_name: creditcard.name
133
134
  }
@@ -208,11 +209,9 @@ module ActiveMerchant #:nodoc:
208
209
  end
209
210
 
210
211
  def response_error(raw_response)
211
- begin
212
- parse(raw_response)
213
- rescue JSON::ParserError
214
- json_error(raw_response)
215
- end
212
+ parse(raw_response)
213
+ rescue JSON::ParserError
214
+ json_error(raw_response)
216
215
  end
217
216
 
218
217
  def json_error(raw_response)
@@ -1,112 +1,112 @@
1
1
  module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class OppGateway < Gateway
4
- # = Open Payment Platform
5
- #
6
- # The Open Payment Platform includes a powerful omni-channel transaction processing API,
7
- # enabling you to quickly and flexibly build new applications and services on the platform.
8
- #
9
- # This plugin enables connectivity to the Open Payment Platform for activemerchant.
10
- #
11
- # For any questions or comments please contact support@payon.com
12
- #
13
- # == Usage
14
- #
15
- # gateway = ActiveMerchant::Billing::OppGateway.new(
16
- # user_id: 'merchant user id',
17
- # password: 'password',
18
- # entity_id: 'entity id',
19
- # )
20
- #
21
- # # set up credit card object as in main ActiveMerchant example
22
- # creditcard = ActiveMerchant::Billing::CreditCard.new(
23
- # :type => 'visa',
24
- # :number => '4242424242424242',
25
- # :month => 8,
26
- # :year => 2009,
27
- # :first_name => 'Bob',
28
- # :last_name => 'Bobsen'
29
- # :verification_value: '123')
30
- #
31
- # # Request: complete example, including address, billing address, shipping address
32
- # complete_request_options = {
33
- # order_id: "your merchant/shop order id", # alternative is to set merchantInvoiceId
34
- # merchant_transaction_id: "your merchant/shop transaction id",
35
- # address: address,
36
- # description: 'Store Purchase - Books',
37
- # risk_workflow: false,
38
- # test_mode: 'EXTERNAL' # or 'INTERNAL', valid only for test system
39
- # create_registration: false, # payment details will be stored on the server an latter can be referenced
40
- #
41
- # billing_address: {
42
- # address1: '123 Test Street',
43
- # city: 'Test',
44
- # state: 'TE',
45
- # zip: 'AB12CD',
46
- # country: 'GB',
47
- # },
48
- # shipping_address: {
49
- # name: 'Muton DeMicelis',
50
- # address1: 'My Street On Upiter, Apt 3.14/2.78',
51
- # city: 'Munich',
52
- # state: 'Bov',
53
- # zip: '81675',
54
- # country: 'DE',
55
- # },
56
- # customer: {
57
- # merchant_customer_id: "your merchant/customer id",
58
- # givenname: 'Jane',
59
- # surname: 'Jones',
60
- # birth_date: '1965-05-01',
61
- # phone: '(?!?)555-5555',
62
- # mobile: '(?!?)234-23423',
63
- # email: 'jane@jones.com',
64
- # company_name: 'JJ Ltd.',
65
- # identification_doctype: 'PASSPORT',
66
- # identification_docid: 'FakeID2342431234123',
67
- # ip: 101.102.103.104,
68
- # },
69
- # }
70
- #
71
- # # Request: minimal example
72
- # minimal_request_options = {
73
- # order_id: "your merchant/shop order id", # alternative is to set merchantInvoiceId
74
- # description: 'Store Purchase - Books',
75
- # }
76
- #
77
- # options =
78
- # # run request
79
- # response = gateway.purchase(754, creditcard, options) # charge 7,54 EUR
80
- #
81
- # response.success? # Check whether the transaction was successful
82
- # response.error_code # Retrieve the error message - it's mapped to Gateway::STANDARD_ERROR_CODE
83
- # response.message # Retrieve the message returned by opp
84
- # response.authorization # Retrieve the unique transaction ID returned by opp
85
- # response.params['result']['code'] # Retrieve original return code returned by opp server
86
- #
87
- # == Errors
88
- # If transaction is not successful, response.error_code contains mapped to Gateway::STANDARD_ERROR_CODE error message.
89
- # Complete list of opp error codes can be viewed on https://docs.oppwa.com/
90
- # Because this list is much bigger than Gateway::STANDARD_ERROR_CODE, only fraction is mapped to Gateway::STANDARD_ERROR_CODE.
91
- # All other codes are mapped as Gateway::STANDARD_ERROR_CODE[:processing_error], so if this is the case,
92
- # you may check the original result code from OPP that can be found in response.params['result']['code']
93
- #
94
- # == Special features
95
- # For purchase method risk check can be forced when options[:risk_workflow] = true
96
- # This will split (on OPP server side) the transaction into two separate transactions: authorize and capture,
97
- # but capture will be executed only if risk checks are successful.
98
- #
99
- # For testing you may use the test account details listed fixtures.yml under opp. It is important to note that there are two test modes available:
100
- # options[:test_mode]='EXTERNAL' causes test transactions to be forwarded to the processor's test system for 'end-to-end' testing
101
- # options[:test_mode]='INTERNAL' causes transactions to be sent to opp simulators, which is useful when switching to the live endpoint for connectivity testing.
102
- # If no test_mode parameter is sent, test_mode=INTERNAL is the default behaviour.
103
- #
104
- # Billing Address, Shipping Address, Custom Parameters are supported as described under https://docs.oppwa.com/parameters
105
- # See complete example above for details.
106
- #
107
- # == Tokenization
108
- # When create_registration is set to true, the payment details will be stored and a token will be returned in registrationId response field,
109
- # which can subsequently be used to reference the stored payment.
4
+ # = Open Payment Platform
5
+ #
6
+ # The Open Payment Platform includes a powerful omni-channel transaction processing API,
7
+ # enabling you to quickly and flexibly build new applications and services on the platform.
8
+ #
9
+ # This plugin enables connectivity to the Open Payment Platform for activemerchant.
10
+ #
11
+ # For any questions or comments please contact support@payon.com
12
+ #
13
+ # == Usage
14
+ #
15
+ # gateway = ActiveMerchant::Billing::OppGateway.new(
16
+ # user_id: 'merchant user id',
17
+ # password: 'password',
18
+ # entity_id: 'entity id',
19
+ # )
20
+ #
21
+ # # set up credit card object as in main ActiveMerchant example
22
+ # creditcard = ActiveMerchant::Billing::CreditCard.new(
23
+ # :type => 'visa',
24
+ # :number => '4242424242424242',
25
+ # :month => 8,
26
+ # :year => 2009,
27
+ # :first_name => 'Bob',
28
+ # :last_name => 'Bobsen'
29
+ # :verification_value: '123')
30
+ #
31
+ # # Request: complete example, including address, billing address, shipping address
32
+ # complete_request_options = {
33
+ # order_id: "your merchant/shop order id", # alternative is to set merchantInvoiceId
34
+ # merchant_transaction_id: "your merchant/shop transaction id",
35
+ # address: address,
36
+ # description: 'Store Purchase - Books',
37
+ # risk_workflow: false,
38
+ # test_mode: 'EXTERNAL' # or 'INTERNAL', valid only for test system
39
+ # create_registration: false, # payment details will be stored on the server an latter can be referenced
40
+ #
41
+ # billing_address: {
42
+ # address1: '123 Test Street',
43
+ # city: 'Test',
44
+ # state: 'TE',
45
+ # zip: 'AB12CD',
46
+ # country: 'GB',
47
+ # },
48
+ # shipping_address: {
49
+ # name: 'Muton DeMicelis',
50
+ # address1: 'My Street On Upiter, Apt 3.14/2.78',
51
+ # city: 'Munich',
52
+ # state: 'Bov',
53
+ # zip: '81675',
54
+ # country: 'DE',
55
+ # },
56
+ # customer: {
57
+ # merchant_customer_id: "your merchant/customer id",
58
+ # givenname: 'Jane',
59
+ # surname: 'Jones',
60
+ # birth_date: '1965-05-01',
61
+ # phone: '(?!?)555-5555',
62
+ # mobile: '(?!?)234-23423',
63
+ # email: 'jane@jones.com',
64
+ # company_name: 'JJ Ltd.',
65
+ # identification_doctype: 'PASSPORT',
66
+ # identification_docid: 'FakeID2342431234123',
67
+ # ip: 101.102.103.104,
68
+ # },
69
+ # }
70
+ #
71
+ # # Request: minimal example
72
+ # minimal_request_options = {
73
+ # order_id: "your merchant/shop order id", # alternative is to set merchantInvoiceId
74
+ # description: 'Store Purchase - Books',
75
+ # }
76
+ #
77
+ # options =
78
+ # # run request
79
+ # response = gateway.purchase(754, creditcard, options) # charge 7,54 EUR
80
+ #
81
+ # response.success? # Check whether the transaction was successful
82
+ # response.error_code # Retrieve the error message - it's mapped to Gateway::STANDARD_ERROR_CODE
83
+ # response.message # Retrieve the message returned by opp
84
+ # response.authorization # Retrieve the unique transaction ID returned by opp
85
+ # response.params['result']['code'] # Retrieve original return code returned by opp server
86
+ #
87
+ # == Errors
88
+ # If transaction is not successful, response.error_code contains mapped to Gateway::STANDARD_ERROR_CODE error message.
89
+ # Complete list of opp error codes can be viewed on https://docs.oppwa.com/
90
+ # Because this list is much bigger than Gateway::STANDARD_ERROR_CODE, only fraction is mapped to Gateway::STANDARD_ERROR_CODE.
91
+ # All other codes are mapped as Gateway::STANDARD_ERROR_CODE[:processing_error], so if this is the case,
92
+ # you may check the original result code from OPP that can be found in response.params['result']['code']
93
+ #
94
+ # == Special features
95
+ # For purchase method risk check can be forced when options[:risk_workflow] = true
96
+ # This will split (on OPP server side) the transaction into two separate transactions: authorize and capture,
97
+ # but capture will be executed only if risk checks are successful.
98
+ #
99
+ # For testing you may use the test account details listed fixtures.yml under opp. It is important to note that there are two test modes available:
100
+ # options[:test_mode]='EXTERNAL' causes test transactions to be forwarded to the processor's test system for 'end-to-end' testing
101
+ # options[:test_mode]='INTERNAL' causes transactions to be sent to opp simulators, which is useful when switching to the live endpoint for connectivity testing.
102
+ # If no test_mode parameter is sent, test_mode=INTERNAL is the default behaviour.
103
+ #
104
+ # Billing Address, Shipping Address, Custom Parameters are supported as described under https://docs.oppwa.com/parameters
105
+ # See complete example above for details.
106
+ #
107
+ # == Tokenization
108
+ # When create_registration is set to true, the payment details will be stored and a token will be returned in registrationId response field,
109
+ # which can subsequently be used to reference the stored payment.
110
110
 
111
111
  self.test_url = 'https://test.oppwa.com/v1/payments'
112
112
  self.live_url = 'https://oppwa.com/v1/payments'
@@ -313,16 +313,14 @@ module ActiveMerchant #:nodoc:
313
313
  response,
314
314
  authorization: authorization_from(response),
315
315
  test: test?,
316
- error_code: success ? nil : error_code_from(response),
316
+ error_code: success ? nil : error_code_from(response)
317
317
  )
318
318
  end
319
319
 
320
320
  def parse(body)
321
- begin
322
- JSON.parse(body)
323
- rescue JSON::ParserError
324
- json_error(body)
325
- end
321
+ JSON.parse(body)
322
+ rescue JSON::ParserError
323
+ json_error(body)
326
324
  end
327
325
 
328
326
  def json_error(body)