activemerchant 1.110.0 → 1.116.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (200) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +82 -0
  3. data/lib/active_merchant.rb +1 -1
  4. data/lib/active_merchant/billing/avs_result.rb +1 -1
  5. data/lib/active_merchant/billing/compatibility.rb +3 -3
  6. data/lib/active_merchant/billing/credit_card.rb +1 -1
  7. data/lib/active_merchant/billing/credit_card_methods.rb +6 -6
  8. data/lib/active_merchant/billing/gateway.rb +1 -1
  9. data/lib/active_merchant/billing/gateways/adyen.rb +30 -15
  10. data/lib/active_merchant/billing/gateways/allied_wallet.rb +7 -7
  11. data/lib/active_merchant/billing/gateways/authorize_net.rb +19 -17
  12. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -4
  13. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +2 -2
  14. data/lib/active_merchant/billing/gateways/axcessms.rb +8 -9
  15. data/lib/active_merchant/billing/gateways/balanced.rb +5 -4
  16. data/lib/active_merchant/billing/gateways/bambora_apac.rb +8 -8
  17. data/lib/active_merchant/billing/gateways/bank_frick.rb +8 -8
  18. data/lib/active_merchant/billing/gateways/banwire.rb +1 -1
  19. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +6 -4
  20. data/lib/active_merchant/billing/gateways/beanstream.rb +3 -3
  21. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +4 -5
  22. data/lib/active_merchant/billing/gateways/blue_pay.rb +2 -3
  23. data/lib/active_merchant/billing/gateways/blue_snap.rb +83 -23
  24. data/lib/active_merchant/billing/gateways/bogus.rb +19 -19
  25. data/lib/active_merchant/billing/gateways/borgun.rb +12 -12
  26. data/lib/active_merchant/billing/gateways/bpoint.rb +8 -8
  27. data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
  28. data/lib/active_merchant/billing/gateways/braintree_blue.rb +14 -17
  29. data/lib/active_merchant/billing/gateways/bridge_pay.rb +7 -7
  30. data/lib/active_merchant/billing/gateways/cams.rb +8 -8
  31. data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
  32. data/lib/active_merchant/billing/gateways/card_save.rb +1 -1
  33. data/lib/active_merchant/billing/gateways/card_stream.rb +2 -2
  34. data/lib/active_merchant/billing/gateways/cardknox.rb +8 -8
  35. data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
  36. data/lib/active_merchant/billing/gateways/cecabank.rb +5 -5
  37. data/lib/active_merchant/billing/gateways/cenpos.rb +11 -11
  38. data/lib/active_merchant/billing/gateways/checkout.rb +2 -2
  39. data/lib/active_merchant/billing/gateways/checkout_v2.rb +17 -20
  40. data/lib/active_merchant/billing/gateways/clearhaus.rb +7 -7
  41. data/lib/active_merchant/billing/gateways/commercegate.rb +1 -1
  42. data/lib/active_merchant/billing/gateways/conekta.rb +2 -2
  43. data/lib/active_merchant/billing/gateways/creditcall.rb +10 -10
  44. data/lib/active_merchant/billing/gateways/credorax.rb +15 -9
  45. data/lib/active_merchant/billing/gateways/ct_payment.rb +10 -10
  46. data/lib/active_merchant/billing/gateways/culqi.rb +10 -10
  47. data/lib/active_merchant/billing/gateways/cyber_source.rb +58 -37
  48. data/lib/active_merchant/billing/gateways/d_local.rb +11 -11
  49. data/lib/active_merchant/billing/gateways/data_cash.rb +2 -3
  50. data/lib/active_merchant/billing/gateways/decidir.rb +10 -9
  51. data/lib/active_merchant/billing/gateways/dibs.rb +8 -8
  52. data/lib/active_merchant/billing/gateways/digitzs.rb +6 -6
  53. data/lib/active_merchant/billing/gateways/ebanx.rb +9 -9
  54. data/lib/active_merchant/billing/gateways/efsnet.rb +3 -4
  55. data/lib/active_merchant/billing/gateways/elavon.rb +251 -232
  56. data/lib/active_merchant/billing/gateways/element.rb +12 -8
  57. data/lib/active_merchant/billing/gateways/evo_ca.rb +5 -6
  58. data/lib/active_merchant/billing/gateways/eway.rb +3 -4
  59. data/lib/active_merchant/billing/gateways/eway_managed.rb +6 -7
  60. data/lib/active_merchant/billing/gateways/eway_rapid.rb +8 -8
  61. data/lib/active_merchant/billing/gateways/exact.rb +8 -9
  62. data/lib/active_merchant/billing/gateways/ezic.rb +8 -8
  63. data/lib/active_merchant/billing/gateways/fat_zebra.rb +9 -7
  64. data/lib/active_merchant/billing/gateways/federated_canada.rb +2 -3
  65. data/lib/active_merchant/billing/gateways/first_giving.rb +1 -1
  66. data/lib/active_merchant/billing/gateways/first_pay.rb +6 -6
  67. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +7 -7
  68. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +4 -4
  69. data/lib/active_merchant/billing/gateways/flo2cash.rb +9 -9
  70. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
  71. data/lib/active_merchant/billing/gateways/forte.rb +14 -8
  72. data/lib/active_merchant/billing/gateways/global_collect.rb +15 -10
  73. data/lib/active_merchant/billing/gateways/global_transport.rb +7 -7
  74. data/lib/active_merchant/billing/gateways/hdfc.rb +10 -10
  75. data/lib/active_merchant/billing/gateways/hps.rb +16 -13
  76. data/lib/active_merchant/billing/gateways/iats_payments.rb +9 -4
  77. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
  78. data/lib/active_merchant/billing/gateways/inspire.rb +3 -4
  79. data/lib/active_merchant/billing/gateways/instapay.rb +1 -2
  80. data/lib/active_merchant/billing/gateways/ipp.rb +7 -7
  81. data/lib/active_merchant/billing/gateways/iridium.rb +16 -17
  82. data/lib/active_merchant/billing/gateways/iveri.rb +7 -7
  83. data/lib/active_merchant/billing/gateways/ixopay.rb +7 -7
  84. data/lib/active_merchant/billing/gateways/jetpay.rb +1 -2
  85. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +4 -5
  86. data/lib/active_merchant/billing/gateways/kushki.rb +6 -6
  87. data/lib/active_merchant/billing/gateways/latitude19.rb +14 -14
  88. data/lib/active_merchant/billing/gateways/linkpoint.rb +5 -6
  89. data/lib/active_merchant/billing/gateways/litle.rb +12 -12
  90. data/lib/active_merchant/billing/gateways/mastercard.rb +12 -12
  91. data/lib/active_merchant/billing/gateways/mercado_pago.rb +8 -8
  92. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +1 -2
  93. data/lib/active_merchant/billing/gateways/merchant_one.rb +1 -1
  94. data/lib/active_merchant/billing/gateways/merchant_partners.rb +10 -10
  95. data/lib/active_merchant/billing/gateways/merchant_ware.rb +5 -7
  96. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +4 -6
  97. data/lib/active_merchant/billing/gateways/mercury.rb +4 -4
  98. data/lib/active_merchant/billing/gateways/metrics_global.rb +4 -5
  99. data/lib/active_merchant/billing/gateways/micropayment.rb +8 -8
  100. data/lib/active_merchant/billing/gateways/migs.rb +3 -4
  101. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +2 -4
  102. data/lib/active_merchant/billing/gateways/monei.rb +7 -7
  103. data/lib/active_merchant/billing/gateways/moneris.rb +4 -3
  104. data/lib/active_merchant/billing/gateways/money_movers.rb +2 -3
  105. data/lib/active_merchant/billing/gateways/mundipagg.rb +37 -10
  106. data/lib/active_merchant/billing/gateways/nab_transact.rb +2 -4
  107. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +7 -7
  108. data/lib/active_merchant/billing/gateways/net_registry.rb +1 -2
  109. data/lib/active_merchant/billing/gateways/netaxept.rb +6 -6
  110. data/lib/active_merchant/billing/gateways/netbanx.rb +12 -10
  111. data/lib/active_merchant/billing/gateways/netbilling.rb +4 -5
  112. data/lib/active_merchant/billing/gateways/network_merchants.rb +2 -3
  113. data/lib/active_merchant/billing/gateways/nmi.rb +21 -7
  114. data/lib/active_merchant/billing/gateways/ogone.rb +3 -3
  115. data/lib/active_merchant/billing/gateways/omise.rb +13 -13
  116. data/lib/active_merchant/billing/gateways/openpay.rb +4 -5
  117. data/lib/active_merchant/billing/gateways/opp.rb +12 -12
  118. data/lib/active_merchant/billing/gateways/optimal_payment.rb +3 -4
  119. data/lib/active_merchant/billing/gateways/orbital.rb +66 -64
  120. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +3 -4
  121. data/lib/active_merchant/billing/gateways/pagarme.rb +9 -9
  122. data/lib/active_merchant/billing/gateways/pago_facil.rb +2 -2
  123. data/lib/active_merchant/billing/gateways/pay_conex.rb +8 -8
  124. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +6 -7
  125. data/lib/active_merchant/billing/gateways/pay_hub.rb +7 -8
  126. data/lib/active_merchant/billing/gateways/pay_junction.rb +4 -5
  127. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +9 -9
  128. data/lib/active_merchant/billing/gateways/pay_secure.rb +2 -3
  129. data/lib/active_merchant/billing/gateways/paybox_direct.rb +23 -1
  130. data/lib/active_merchant/billing/gateways/payeezy.rb +12 -12
  131. data/lib/active_merchant/billing/gateways/payex.rb +11 -12
  132. data/lib/active_merchant/billing/gateways/payflow.rb +4 -1
  133. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -1
  134. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +1 -1
  135. data/lib/active_merchant/billing/gateways/payment_express.rb +1 -2
  136. data/lib/active_merchant/billing/gateways/paymentez.rb +5 -5
  137. data/lib/active_merchant/billing/gateways/paymill.rb +10 -10
  138. data/lib/active_merchant/billing/gateways/paypal_express.rb +1 -1
  139. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
  140. data/lib/active_merchant/billing/gateways/payscout.rb +1 -2
  141. data/lib/active_merchant/billing/gateways/paystation.rb +3 -4
  142. data/lib/active_merchant/billing/gateways/payu_in.rb +3 -3
  143. data/lib/active_merchant/billing/gateways/payu_latam.rb +21 -11
  144. data/lib/active_merchant/billing/gateways/payway.rb +8 -9
  145. data/lib/active_merchant/billing/gateways/plugnpay.rb +2 -3
  146. data/lib/active_merchant/billing/gateways/pro_pay.rb +8 -8
  147. data/lib/active_merchant/billing/gateways/psigate.rb +3 -4
  148. data/lib/active_merchant/billing/gateways/psl_card.rb +1 -2
  149. data/lib/active_merchant/billing/gateways/qbms.rb +4 -5
  150. data/lib/active_merchant/billing/gateways/quantum.rb +1 -2
  151. data/lib/active_merchant/billing/gateways/quickbooks.rb +4 -3
  152. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +3 -4
  153. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -2
  154. data/lib/active_merchant/billing/gateways/qvalent.rb +9 -9
  155. data/lib/active_merchant/billing/gateways/realex.rb +2 -1
  156. data/lib/active_merchant/billing/gateways/redsys.rb +7 -7
  157. data/lib/active_merchant/billing/gateways/s5.rb +7 -7
  158. data/lib/active_merchant/billing/gateways/safe_charge.rb +12 -12
  159. data/lib/active_merchant/billing/gateways/sage.rb +3 -5
  160. data/lib/active_merchant/billing/gateways/sage_pay.rb +6 -7
  161. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
  162. data/lib/active_merchant/billing/gateways/secure_net.rb +1 -2
  163. data/lib/active_merchant/billing/gateways/secure_pay.rb +3 -4
  164. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +2 -4
  165. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -2
  166. data/lib/active_merchant/billing/gateways/securion_pay.rb +5 -6
  167. data/lib/active_merchant/billing/gateways/skip_jack.rb +3 -4
  168. data/lib/active_merchant/billing/gateways/smart_ps.rb +5 -6
  169. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +7 -7
  170. data/lib/active_merchant/billing/gateways/spreedly_core.rb +6 -6
  171. data/lib/active_merchant/billing/gateways/stripe.rb +11 -11
  172. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +9 -0
  173. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +3 -4
  174. data/lib/active_merchant/billing/gateways/telr.rb +9 -9
  175. data/lib/active_merchant/billing/gateways/trans_first.rb +3 -3
  176. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +14 -14
  177. data/lib/active_merchant/billing/gateways/transact_pro.rb +9 -9
  178. data/lib/active_merchant/billing/gateways/trust_commerce.rb +8 -9
  179. data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -1
  180. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +36 -36
  181. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +4 -5
  182. data/lib/active_merchant/billing/gateways/vanco.rb +3 -3
  183. data/lib/active_merchant/billing/gateways/verifi.rb +1 -2
  184. data/lib/active_merchant/billing/gateways/viaklix.rb +1 -2
  185. data/lib/active_merchant/billing/gateways/visanet_peru.rb +10 -10
  186. data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
  187. data/lib/active_merchant/billing/gateways/wepay.rb +3 -2
  188. data/lib/active_merchant/billing/gateways/wirecard.rb +1 -2
  189. data/lib/active_merchant/billing/gateways/worldpay.rb +12 -8
  190. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +14 -16
  191. data/lib/active_merchant/billing/gateways/worldpay_us.rb +9 -9
  192. data/lib/active_merchant/billing/response.rb +1 -1
  193. data/lib/active_merchant/country.rb +1 -1
  194. data/lib/active_merchant/network_connection_retries.rb +2 -2
  195. data/lib/active_merchant/post_data.rb +1 -1
  196. data/lib/active_merchant/posts_data.rb +1 -1
  197. data/lib/active_merchant/version.rb +1 -1
  198. data/lib/support/ssl_verify.rb +2 -2
  199. data/lib/support/ssl_version.rb +2 -2
  200. metadata +16 -2
@@ -204,7 +204,7 @@ module ActiveMerchant #:nodoc:
204
204
  perform_reference_credit(money, reference, options)
205
205
  end
206
206
 
207
- def verify(credit_card, options={})
207
+ def verify(credit_card, options = {})
208
208
  MultiResponse.run(:use_first_response) do |r|
209
209
  r.process { authorize(100, credit_card, options) }
210
210
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -432,9 +432,9 @@ module ActiveMerchant #:nodoc:
432
432
  raise "Unknown signature algorithm #{algorithm}"
433
433
  end
434
434
 
435
- filtered_params = signed_parameters.select { |k, v| !v.blank? }
435
+ filtered_params = signed_parameters.select { |_k, v| !v.blank? }
436
436
  sha_encryptor.hexdigest(
437
- filtered_params.sort_by { |k, v| k.upcase }.map { |k, v| "#{k.upcase}=#{v}#{secret}" }.join('')
437
+ filtered_params.sort_by { |k, _v| k.upcase }.map { |k, v| "#{k.upcase}=#{v}#{secret}" }.join('')
438
438
  ).upcase
439
439
  end
440
440
 
@@ -46,7 +46,7 @@ module ActiveMerchant #:nodoc:
46
46
  # * <tt>:api_version</tt> -- Omise's API Version (OPTIONAL), default version is '2014-07-27'
47
47
  # See version at page https://dashboard.omise.co/api-version/edit
48
48
 
49
- def initialize(options={})
49
+ def initialize(options = {})
50
50
  requires!(options, :public_key, :secret_key)
51
51
  @public_key = options[:public_key]
52
52
  @secret_key = options[:secret_key]
@@ -79,7 +79,7 @@ module ActiveMerchant #:nodoc:
79
79
  #
80
80
  # purchase(money, nil, { :customer_id => customer_id })
81
81
 
82
- def purchase(money, payment_method, options={})
82
+ def purchase(money, payment_method, options = {})
83
83
  create_charge(money, payment_method, options)
84
84
  end
85
85
 
@@ -91,7 +91,7 @@ module ActiveMerchant #:nodoc:
91
91
  # * <tt>payment_method</tt> -- The CreditCard object
92
92
  # * <tt>options</tt> -- An optional parameters, such as token or capture
93
93
 
94
- def authorize(money, payment_method, options={})
94
+ def authorize(money, payment_method, options = {})
95
95
  options[:capture] = 'false'
96
96
  create_charge(money, payment_method, options)
97
97
  end
@@ -104,7 +104,7 @@ module ActiveMerchant #:nodoc:
104
104
  # * <tt>charge_id</tt> -- The CreditCard object
105
105
  # * <tt>options</tt> -- An optional parameters, such as token or capture
106
106
 
107
- def capture(money, charge_id, options={})
107
+ def capture(money, charge_id, options = {})
108
108
  post = {}
109
109
  add_amount(post, money, options)
110
110
  commit(:post, "charges/#{CGI.escape(charge_id)}/capture", post, options)
@@ -118,7 +118,7 @@ module ActiveMerchant #:nodoc:
118
118
  # * <tt>charge_id</tt> -- The CreditCard object
119
119
  # * <tt>options</tt> -- An optional parameters, such as token or capture
120
120
 
121
- def refund(money, charge_id, options={})
121
+ def refund(money, charge_id, options = {})
122
122
  options[:amount] = money if money
123
123
  commit(:post, "charges/#{CGI.escape(charge_id)}/refunds", options)
124
124
  end
@@ -132,7 +132,7 @@ module ActiveMerchant #:nodoc:
132
132
  # 'email' (A customer email)
133
133
  # 'description' (A customer description)
134
134
 
135
- def store(payment_method, options={})
135
+ def store(payment_method, options = {})
136
136
  post, card_params = {}, {}
137
137
  add_customer_data(post, options)
138
138
  add_token(card_params, payment_method, options)
@@ -145,7 +145,7 @@ module ActiveMerchant #:nodoc:
145
145
  #
146
146
  # * <tt>customer_id</tt> -- The Customer identifier (REQUIRED).
147
147
 
148
- def unstore(customer_id, options={})
148
+ def unstore(customer_id, options = {})
149
149
  commit(:delete, "customers/#{CGI.escape(customer_id)}")
150
150
  end
151
151
 
@@ -178,7 +178,7 @@ module ActiveMerchant #:nodoc:
178
178
  commit(:post, 'charges', post, options)
179
179
  end
180
180
 
181
- def headers(options={})
181
+ def headers(options = {})
182
182
  key = options[:key] || @secret_key
183
183
  {
184
184
  'Content-Type' => 'application/json;utf-8',
@@ -197,7 +197,7 @@ module ActiveMerchant #:nodoc:
197
197
  parameters.present? ? parameters.to_json : nil
198
198
  end
199
199
 
200
- def https_request(method, endpoint, parameters=nil, options={})
200
+ def https_request(method, endpoint, parameters = nil, options = {})
201
201
  raw_response = response = nil
202
202
  begin
203
203
  raw_response = ssl_request(method, url_for(endpoint), post_data(parameters), headers(options))
@@ -221,7 +221,7 @@ module ActiveMerchant #:nodoc:
221
221
  { message: msg }
222
222
  end
223
223
 
224
- def commit(method, endpoint, params=nil, options={})
224
+ def commit(method, endpoint, params = nil, options = {})
225
225
  response = https_request(method, endpoint, params, options)
226
226
  Response.new(
227
227
  successful?(response),
@@ -284,7 +284,7 @@ module ActiveMerchant #:nodoc:
284
284
  commit(:post, 'tokens', post, { key: @public_key })
285
285
  end
286
286
 
287
- def add_token(post, credit_card, options={})
287
+ def add_token(post, credit_card, options = {})
288
288
  if options[:token_id].present?
289
289
  post[:card] = options[:token_id]
290
290
  else
@@ -304,11 +304,11 @@ module ActiveMerchant #:nodoc:
304
304
  post[:card] = card
305
305
  end
306
306
 
307
- def add_customer(post, options={})
307
+ def add_customer(post, options = {})
308
308
  post[:customer] = options[:customer_id] if options[:customer_id]
309
309
  end
310
310
 
311
- def add_customer_data(post, options={})
311
+ def add_customer_data(post, options = {})
312
312
  post[:description] = options[:description] if options[:description]
313
313
  post[:email] = options[:email] if options[:email]
314
314
  end
@@ -4,7 +4,7 @@ module ActiveMerchant #:nodoc:
4
4
  self.live_url = 'https://api.openpay.mx/v1/'
5
5
  self.test_url = 'https://sandbox-api.openpay.mx/v1/'
6
6
 
7
- self.supported_countries = ['MX']
7
+ self.supported_countries = %w(CO MX)
8
8
  self.supported_cardtypes = %i[visa master american_express carnet]
9
9
  self.homepage_url = 'http://www.openpay.mx/'
10
10
  self.display_name = 'Openpay'
@@ -116,7 +116,7 @@ module ActiveMerchant #:nodoc:
116
116
  post[:device_session_id] = options[:device_session_id]
117
117
  post[:currency] = (options[:currency] || currency(money)).upcase
118
118
  post[:use_card_points] = options[:use_card_points] if options[:use_card_points]
119
- post[:payment_plan] = {payments: options[:payments]} if options[:payments]
119
+ post[:payment_plan] = { payments: options[:payments] } if options[:payments]
120
120
  add_creditcard(post, creditcard, options)
121
121
  post
122
122
  end
@@ -188,11 +188,10 @@ module ActiveMerchant #:nodoc:
188
188
  (success ? response['error_code'] : response['description']),
189
189
  response,
190
190
  test: test?,
191
- authorization: response['id']
192
- )
191
+ authorization: response['id'])
193
192
  end
194
193
 
195
- def http_request(method, resource, parameters={}, options={})
194
+ def http_request(method, resource, parameters = {}, options = {})
196
195
  url = (test? ? self.test_url : self.live_url) + @merchant_id + '/' + resource
197
196
  raw_response = nil
198
197
  begin
@@ -117,39 +117,39 @@ module ActiveMerchant #:nodoc:
117
117
  self.homepage_url = 'https://docs.oppwa.com'
118
118
  self.display_name = 'Open Payment Platform'
119
119
 
120
- def initialize(options={})
120
+ def initialize(options = {})
121
121
  requires!(options, :access_token, :entity_id)
122
122
  super
123
123
  end
124
124
 
125
- def purchase(money, payment, options={})
125
+ def purchase(money, payment, options = {})
126
126
  # debit
127
127
  options[:registrationId] = payment if payment.is_a?(String)
128
128
  execute_dbpa(options[:risk_workflow] ? 'PA.CP' : 'DB',
129
129
  money, payment, options)
130
130
  end
131
131
 
132
- def authorize(money, payment, options={})
132
+ def authorize(money, payment, options = {})
133
133
  # preauthorization PA
134
134
  execute_dbpa('PA', money, payment, options)
135
135
  end
136
136
 
137
- def capture(money, authorization, options={})
137
+ def capture(money, authorization, options = {})
138
138
  # capture CP
139
139
  execute_referencing('CP', money, authorization, options)
140
140
  end
141
141
 
142
- def refund(money, authorization, options={})
142
+ def refund(money, authorization, options = {})
143
143
  # refund RF
144
144
  execute_referencing('RF', money, authorization, options)
145
145
  end
146
146
 
147
- def void(authorization, options={})
147
+ def void(authorization, options = {})
148
148
  # reversal RV
149
149
  execute_referencing('RV', nil, authorization, options)
150
150
  end
151
151
 
152
- def verify(credit_card, options={})
152
+ def verify(credit_card, options = {})
153
153
  MultiResponse.run(:use_first_response) do |r|
154
154
  r.process { authorize(100, credit_card, options) }
155
155
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -243,7 +243,7 @@ module ActiveMerchant #:nodoc:
243
243
  city: address[:city],
244
244
  state: address[:state],
245
245
  postcode: address[:zip],
246
- country: address[:country],
246
+ country: address[:country]
247
247
  }
248
248
  end
249
249
 
@@ -260,7 +260,7 @@ module ActiveMerchant #:nodoc:
260
260
 
261
261
  if options[:registrationId]
262
262
  post[:card] = {
263
- cvv: payment.verification_value,
263
+ cvv: payment.verification_value
264
264
  }
265
265
  else
266
266
  post[:paymentBrand] = payment.brand.upcase
@@ -269,7 +269,7 @@ module ActiveMerchant #:nodoc:
269
269
  number: payment.number,
270
270
  expiryMonth: '%02d' % payment.month,
271
271
  expiryYear: payment.year,
272
- cvv: payment.verification_value,
272
+ cvv: payment.verification_value
273
273
  }
274
274
  end
275
275
  end
@@ -287,7 +287,7 @@ module ActiveMerchant #:nodoc:
287
287
  def add_options(post, options)
288
288
  post[:createRegistration] = options[:create_registration] if options[:create_registration] && !options[:registrationId]
289
289
  post[:testMode] = options[:test_mode] if test? && options[:test_mode]
290
- options.each { |key, value| post[key] = value if key.to_s.match('customParameters\[[a-zA-Z0-9\._]{3,64}\]') }
290
+ options.each { |key, value| post[key] = value if key.to_s =~ /'customParameters\[[a-zA-Z0-9\._]{3,64}\]'/ }
291
291
  post['customParameters[SHOPPER_pluginId]'] = 'activemerchant'
292
292
  post['customParameters[custom_disable3DSecure]'] = options[:disable_3d_secure] if options[:disable_3d_secure]
293
293
  end
@@ -349,7 +349,7 @@ module ActiveMerchant #:nodoc:
349
349
 
350
350
  def json_error(body)
351
351
  message = "Invalid response received #{body.inspect}"
352
- { 'result' => {'description' => message, 'code' => 'unknown' } }
352
+ { 'result' => { 'description' => message, 'code' => 'unknown' } }
353
353
  end
354
354
 
355
355
  def success_from(response)
@@ -125,8 +125,7 @@ module ActiveMerchant #:nodoc:
125
125
  test: test?,
126
126
  authorization: authorization_from(response),
127
127
  avs_result: { code: avs_result_from(response) },
128
- cvv_result: cvv_result_from(response)
129
- )
128
+ cvv_result: cvv_result_from(response))
130
129
  end
131
130
 
132
131
  # The upstream is picky and so we can't use CGI.escape like we want to
@@ -257,7 +256,7 @@ module ActiveMerchant #:nodoc:
257
256
  def schema
258
257
  { 'xmlns' => 'http://www.optimalpayments.com/creditcard/xmlschema/v1',
259
258
  'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
260
- 'xsi:schemaLocation' => 'http://www.optimalpayments.com/creditcard/xmlschema/v1'}
259
+ 'xsi:schemaLocation' => 'http://www.optimalpayments.com/creditcard/xmlschema/v1' }
261
260
  end
262
261
 
263
262
  def build_merchant_account(xml)
@@ -325,7 +324,7 @@ module ActiveMerchant #:nodoc:
325
324
  'master' => 'MC',
326
325
  'american_express' => 'AM',
327
326
  'discover' => 'DI',
328
- 'diners_club' => 'DC', }[key]
327
+ 'diners_club' => 'DC' }[key]
329
328
  end
330
329
  end
331
330
  end
@@ -34,7 +34,7 @@ module ActiveMerchant #:nodoc:
34
34
 
35
35
  POST_HEADERS = {
36
36
  'MIME-Version' => '1.1',
37
- 'Content-Type' => "application/PTI#{API_VERSION.gsub(/\./, '')}",
37
+ 'Content-Type' => "application/PTI#{API_VERSION.delete('.')}",
38
38
  'Content-transfer-encoding' => 'text',
39
39
  'Request-number' => '1',
40
40
  'Document-type' => 'Request',
@@ -237,7 +237,7 @@ module ActiveMerchant #:nodoc:
237
237
  commit(order, :refund, options[:trace_number])
238
238
  end
239
239
 
240
- def credit(money, authorization, options= {})
240
+ def credit(money, authorization, options = {})
241
241
  ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
242
242
  refund(money, authorization, options)
243
243
  end
@@ -286,13 +286,13 @@ module ActiveMerchant #:nodoc:
286
286
  end
287
287
 
288
288
  def retrieve_customer_profile(customer_ref_num)
289
- options = {customer_profile_action: RETRIEVE, customer_ref_num: customer_ref_num}
289
+ options = { customer_profile_action: RETRIEVE, customer_ref_num: customer_ref_num }
290
290
  order = build_customer_request_xml(nil, options)
291
291
  commit(order, :retrieve_customer_profile)
292
292
  end
293
293
 
294
294
  def delete_customer_profile(customer_ref_num)
295
- options = {customer_profile_action: DELETE, customer_ref_num: customer_ref_num}
295
+ options = { customer_profile_action: DELETE, customer_ref_num: customer_ref_num }
296
296
  order = build_customer_request_xml(nil, options)
297
297
  commit(order, :delete_customer_profile)
298
298
  end
@@ -355,61 +355,61 @@ module ActiveMerchant #:nodoc:
355
355
  xml.tag! :SDMerchantEmail, soft_desc[:merchant_email] || nil
356
356
  end
357
357
 
358
- def add_level_2_tax(xml, options={})
359
- if (level_2 = options[:level_2_data])
360
- xml.tag! :TaxInd, level_2[:tax_indicator] if [TAX_NOT_PROVIDED, TAX_INCLUDED, NON_TAXABLE_TRANSACTION].include?(level_2[:tax_indicator].to_i)
361
- xml.tag! :Tax, level_2[:tax].to_i if level_2[:tax]
358
+ def add_level2_tax(xml, options = {})
359
+ if (level2 = options[:level_2_data])
360
+ xml.tag! :TaxInd, level2[:tax_indicator] if [TAX_NOT_PROVIDED, TAX_INCLUDED, NON_TAXABLE_TRANSACTION].include?(level2[:tax_indicator].to_i)
361
+ xml.tag! :Tax, level2[:tax].to_i if level2[:tax]
362
362
  end
363
363
  end
364
364
 
365
- def add_level_3_tax(xml, options={})
366
- if (level_3 = options[:level_3_data])
367
- xml.tag! :PC3VATtaxAmt, byte_limit(level_3[:vat_tax], 12) if level_3[:vat_tax]
368
- xml.tag! :PC3AltTaxAmt, byte_limit(level_3[:alt_tax], 9) if level_3[:alt_tax]
369
- xml.tag! :PC3VATtaxRate, byte_limit(level_3[:vat_rate], 4) if level_3[:vat_rate]
370
- xml.tag! :PC3AltTaxInd, byte_limit(level_3[:alt_ind], 15) if level_3[:alt_ind]
365
+ def add_level3_tax(xml, options = {})
366
+ if (level3 = options[:level_3_data])
367
+ xml.tag! :PC3VATtaxAmt, byte_limit(level3[:vat_tax], 12) if level3[:vat_tax]
368
+ xml.tag! :PC3AltTaxAmt, byte_limit(level3[:alt_tax], 9) if level3[:alt_tax]
369
+ xml.tag! :PC3VATtaxRate, byte_limit(level3[:vat_rate], 4) if level3[:vat_rate]
370
+ xml.tag! :PC3AltTaxInd, byte_limit(level3[:alt_ind], 15) if level3[:alt_ind]
371
371
  end
372
372
  end
373
373
 
374
- def add_level_2_advice_addendum(xml, options={})
375
- if (level_2 = options[:level_2_data])
376
- xml.tag! :AMEXTranAdvAddn1, byte_limit(level_2[:advice_addendum_1], 40) if level_2[:advice_addendum_1]
377
- xml.tag! :AMEXTranAdvAddn2, byte_limit(level_2[:advice_addendum_2], 40) if level_2[:advice_addendum_2]
378
- xml.tag! :AMEXTranAdvAddn3, byte_limit(level_2[:advice_addendum_3], 40) if level_2[:advice_addendum_3]
379
- xml.tag! :AMEXTranAdvAddn4, byte_limit(level_2[:advice_addendum_4], 40) if level_2[:advice_addendum_4]
374
+ def add_level2_advice_addendum(xml, options = {})
375
+ if (level2 = options[:level_2_data])
376
+ xml.tag! :AMEXTranAdvAddn1, byte_limit(level2[:advice_addendum_1], 40) if level2[:advice_addendum_1]
377
+ xml.tag! :AMEXTranAdvAddn2, byte_limit(level2[:advice_addendum_2], 40) if level2[:advice_addendum_2]
378
+ xml.tag! :AMEXTranAdvAddn3, byte_limit(level2[:advice_addendum_3], 40) if level2[:advice_addendum_3]
379
+ xml.tag! :AMEXTranAdvAddn4, byte_limit(level2[:advice_addendum_4], 40) if level2[:advice_addendum_4]
380
380
  end
381
381
  end
382
382
 
383
- def add_level_2_purchase(xml, options={})
384
- if (level_2 = options[:level_2_data])
385
- xml.tag! :PCOrderNum, byte_limit(level_2[:purchase_order], 17) if level_2[:purchase_order]
386
- xml.tag! :PCDestZip, byte_limit(format_address_field(level_2[:zip]), 10) if level_2[:zip]
387
- xml.tag! :PCDestName, byte_limit(format_address_field(level_2[:name]), 30) if level_2[:name]
388
- xml.tag! :PCDestAddress1, byte_limit(format_address_field(level_2[:address1]), 30) if level_2[:address1]
389
- xml.tag! :PCDestAddress2, byte_limit(format_address_field(level_2[:address2]), 30) if level_2[:address2]
390
- xml.tag! :PCDestCity, byte_limit(format_address_field(level_2[:city]), 20) if level_2[:city]
391
- xml.tag! :PCDestState, byte_limit(format_address_field(level_2[:state]), 2) if level_2[:state]
383
+ def add_level2_purchase(xml, options = {})
384
+ if (level2 = options[:level_2_data])
385
+ xml.tag! :PCOrderNum, byte_limit(level2[:purchase_order], 17) if level2[:purchase_order]
386
+ xml.tag! :PCDestZip, byte_limit(format_address_field(level2[:zip]), 10) if level2[:zip]
387
+ xml.tag! :PCDestName, byte_limit(format_address_field(level2[:name]), 30) if level2[:name]
388
+ xml.tag! :PCDestAddress1, byte_limit(format_address_field(level2[:address1]), 30) if level2[:address1]
389
+ xml.tag! :PCDestAddress2, byte_limit(format_address_field(level2[:address2]), 30) if level2[:address2]
390
+ xml.tag! :PCDestCity, byte_limit(format_address_field(level2[:city]), 20) if level2[:city]
391
+ xml.tag! :PCDestState, byte_limit(format_address_field(level2[:state]), 2) if level2[:state]
392
392
  end
393
393
  end
394
394
 
395
- def add_level_3_purchase(xml, options={})
396
- if (level_3 = options[:level_3_data])
397
- xml.tag! :PC3FreightAmt, byte_limit(level_3[:freight_amount], 12) if level_3[:freight_amount]
398
- xml.tag! :PC3DutyAmt, byte_limit(level_3[:duty_amount], 12) if level_3[:duty_amount]
399
- xml.tag! :PC3DestCountryCd, byte_limit(level_3[:dest_country], 3) if level_3[:dest_country]
400
- xml.tag! :PC3ShipFromZip, byte_limit(level_3[:ship_from_zip], 10) if level_3[:ship_from_zip]
401
- xml.tag! :PC3DiscAmt, byte_limit(level_3[:discount_amount], 12) if level_3[:discount_amount]
395
+ def add_level3_purchase(xml, options = {})
396
+ if (level3 = options[:level_3_data])
397
+ xml.tag! :PC3FreightAmt, byte_limit(level3[:freight_amount], 12) if level3[:freight_amount]
398
+ xml.tag! :PC3DutyAmt, byte_limit(level3[:duty_amount], 12) if level3[:duty_amount]
399
+ xml.tag! :PC3DestCountryCd, byte_limit(level3[:dest_country], 3) if level3[:dest_country]
400
+ xml.tag! :PC3ShipFromZip, byte_limit(level3[:ship_from_zip], 10) if level3[:ship_from_zip]
401
+ xml.tag! :PC3DiscAmt, byte_limit(level3[:discount_amount], 12) if level3[:discount_amount]
402
402
  end
403
403
  end
404
404
 
405
- def add_line_items(xml, options={})
405
+ def add_line_items(xml, options = {})
406
406
  xml.tag! :PC3LineItemCount, byte_limit(options[:line_items].count, 2)
407
407
  xml.tag! :PC3LineItemArray do
408
408
  options[:line_items].each_with_index do |line_item, index|
409
409
  xml.tag! :PC3LineItem do
410
410
  xml.tag! :PC3DtlIndex, byte_limit(index + 1, 2)
411
411
  line_item.each do |key, value|
412
- if key == :line_tot
412
+ if [:line_tot, 'line_tot'].include? key
413
413
  formatted_key = :PC3Dtllinetot
414
414
  else
415
415
  formatted_key = "PC3Dtl#{key.to_s.camelize}".to_sym
@@ -421,6 +421,10 @@ module ActiveMerchant #:nodoc:
421
421
  end
422
422
  end
423
423
 
424
+ def add_card_indicators(xml, options)
425
+ xml.tag! :CardIndicators, options[:card_indicators] if options[:card_indicators]
426
+ end
427
+
424
428
  def add_address(xml, creditcard, options)
425
429
  if (address = (options[:billing_address] || options[:address]))
426
430
  avs_supported = AVS_SUPPORTED_COUNTRIES.include?(address[:country].to_s) || empty?(address[:country])
@@ -474,7 +478,7 @@ module ActiveMerchant #:nodoc:
474
478
  end
475
479
  end
476
480
 
477
- def add_creditcard(xml, creditcard, currency=nil)
481
+ def add_creditcard(xml, creditcard, currency = nil)
478
482
  unless creditcard.nil?
479
483
  xml.tag! :AccountNum, creditcard.number
480
484
  xml.tag! :Exp, expiry_date(creditcard)
@@ -511,13 +515,9 @@ module ActiveMerchant #:nodoc:
511
515
  end
512
516
 
513
517
  def add_xid(xml, creditcard, three_d_secure)
514
- xid = if three_d_secure && creditcard.brand == 'visa'
515
- three_d_secure[:xid]
516
- elsif creditcard.is_a?(NetworkTokenizationCreditCard)
517
- creditcard.transaction_id
518
- end
518
+ return unless three_d_secure && creditcard.brand == 'visa'
519
519
 
520
- xml.tag!(:XID, xid) if xid
520
+ xml.tag!(:XID, three_d_secure[:xid]) if three_d_secure[:xid]
521
521
  end
522
522
 
523
523
  def add_cavv(xml, creditcard, three_d_secure)
@@ -556,7 +556,7 @@ module ActiveMerchant #:nodoc:
556
556
  xml.tag!(:PymtBrandProgramCode, 'ASK')
557
557
  end
558
558
 
559
- def add_refund(xml, currency=nil)
559
+ def add_refund(xml, currency = nil)
560
560
  xml.tag! :AccountNum, nil
561
561
 
562
562
  xml.tag! :CurrencyCode, currency_code(currency)
@@ -643,7 +643,7 @@ module ActiveMerchant #:nodoc:
643
643
  end
644
644
  end
645
645
 
646
- def commit(order, message_type, trace_number=nil)
646
+ def commit(order, message_type, trace_number = nil)
647
647
  headers = POST_HEADERS.merge('Content-length' => order.size.to_s)
648
648
  if @options[:retry_logic] && trace_number
649
649
  headers['Trace-number'] = trace_number.to_s
@@ -665,11 +665,10 @@ module ActiveMerchant #:nodoc:
665
665
  test: self.test?,
666
666
  avs_result: OrbitalGateway::AVSResult.new(response[:avs_resp_code]),
667
667
  cvv_result: OrbitalGateway::CVVResult.new(response[:cvv2_resp_code])
668
- }
669
- )
668
+ })
670
669
  end
671
670
 
672
- def remote_url(url=:primary)
671
+ def remote_url(url = :primary)
673
672
  if url == :primary
674
673
  (self.test? ? self.test_url : self.live_url)
675
674
  else
@@ -729,22 +728,22 @@ module ActiveMerchant #:nodoc:
729
728
  xml.tag! :Amount, amount(money)
730
729
  xml.tag! :Comments, parameters[:comments] if parameters[:comments]
731
730
 
732
- add_level_2_tax(xml, parameters)
733
- add_level_2_advice_addendum(xml, parameters)
731
+ add_level2_tax(xml, parameters)
732
+ add_level2_advice_addendum(xml, parameters)
734
733
 
735
734
  add_aav(xml, creditcard, three_d_secure)
736
735
  # CustomerAni, AVSPhoneType and AVSDestPhoneType could be added here.
737
736
 
738
- add_dpanind(xml, creditcard)
739
- add_aevv(xml, creditcard, three_d_secure)
740
- add_digital_token_cryptogram(xml, creditcard)
741
-
742
737
  if parameters[:soft_descriptors].is_a?(OrbitalSoftDescriptors)
743
738
  add_soft_descriptors(xml, parameters[:soft_descriptors])
744
739
  elsif parameters[:soft_descriptors].is_a?(Hash)
745
740
  add_soft_descriptors_from_hash(xml, parameters[:soft_descriptors])
746
741
  end
747
742
 
743
+ add_dpanind(xml, creditcard)
744
+ add_aevv(xml, creditcard, three_d_secure)
745
+ add_digital_token_cryptogram(xml, creditcard)
746
+
748
747
  set_recurring_ind(xml, parameters)
749
748
 
750
749
  # Append Transaction Reference Number at the end for Refund transactions
@@ -753,10 +752,11 @@ module ActiveMerchant #:nodoc:
753
752
  xml.tag! :TxRefNum, tx_ref_num
754
753
  end
755
754
 
756
- add_level_2_purchase(xml, parameters)
757
- add_level_3_purchase(xml, parameters)
758
- add_level_3_tax(xml, parameters)
755
+ add_level2_purchase(xml, parameters)
756
+ add_level3_purchase(xml, parameters)
757
+ add_level3_tax(xml, parameters)
759
758
  add_line_items(xml, parameters) if parameters[:line_items]
759
+ add_card_indicators(xml, parameters)
760
760
  add_stored_credentials(xml, parameters)
761
761
  add_pymt_brand_program_code(xml, creditcard, three_d_secure)
762
762
  end
@@ -783,11 +783,13 @@ module ActiveMerchant #:nodoc:
783
783
  add_xml_credentials(xml)
784
784
  xml.tag! :OrderID, format_order_id(order_id)
785
785
  xml.tag! :Amount, amount(money)
786
- add_level_2_tax(xml, parameters)
786
+ add_level2_tax(xml, parameters)
787
787
  add_bin_merchant_and_terminal(xml, parameters)
788
788
  xml.tag! :TxRefNum, tx_ref_num
789
- add_level_2_purchase(xml, parameters)
790
- add_level_2_advice_addendum(xml, parameters)
789
+ add_level2_purchase(xml, parameters)
790
+ add_level2_advice_addendum(xml, parameters)
791
+ add_level3_purchase(xml, parameters)
792
+ add_level3_tax(xml, parameters)
791
793
  end
792
794
  end
793
795
  xml.target!
@@ -857,7 +859,7 @@ module ActiveMerchant #:nodoc:
857
859
  # 3. PINless Debit transactions can only use uppercase and lowercase alpha (A-Z, a-z) and numeric (0-9)
858
860
  def format_order_id(order_id)
859
861
  illegal_characters = /[^,$@&\- \w]/
860
- order_id = order_id.to_s.gsub(/\./, '-')
862
+ order_id = order_id.to_s.tr('.', '-')
861
863
  order_id.gsub!(illegal_characters, '')
862
864
  order_id.lstrip!
863
865
  order_id[0...22]
@@ -979,7 +981,7 @@ module ActiveMerchant #:nodoc:
979
981
  'R' => 'Issuer does not participate in AVS',
980
982
  'UK' => 'Unknown',
981
983
  'X' => 'Zip Match/Zip 4 Match/Address Match',
982
- 'Z' => 'Zip Match/Locale no match',
984
+ 'Z' => 'Zip Match/Locale no match'
983
985
  }
984
986
 
985
987
  # Map vendor's AVS result code to a postal match code