activemerchant 1.105.0 → 1.107.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +99 -1
  3. data/README.md +2 -2
  4. data/lib/active_merchant/billing/credit_card_methods.rb +12 -3
  5. data/lib/active_merchant/billing/gateway.rb +22 -22
  6. data/lib/active_merchant/billing/gateways/adyen.rb +18 -7
  7. data/lib/active_merchant/billing/gateways/allied_wallet.rb +2 -2
  8. data/lib/active_merchant/billing/gateways/authorize_net.rb +19 -19
  9. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +11 -11
  10. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +35 -35
  11. data/lib/active_merchant/billing/gateways/axcessms.rb +3 -3
  12. data/lib/active_merchant/billing/gateways/bambora_apac.rb +1 -1
  13. data/lib/active_merchant/billing/gateways/bank_frick.rb +1 -1
  14. data/lib/active_merchant/billing/gateways/banwire.rb +2 -2
  15. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +5 -5
  16. data/lib/active_merchant/billing/gateways/be2bill.rb +4 -4
  17. data/lib/active_merchant/billing/gateways/beanstream.rb +1 -1
  18. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +27 -27
  19. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -1
  20. data/lib/active_merchant/billing/gateways/blue_pay.rb +8 -8
  21. data/lib/active_merchant/billing/gateways/blue_snap.rb +5 -2
  22. data/lib/active_merchant/billing/gateways/bogus.rb +20 -20
  23. data/lib/active_merchant/billing/gateways/borgun.rb +17 -6
  24. data/lib/active_merchant/billing/gateways/bpoint.rb +1 -1
  25. data/lib/active_merchant/billing/gateways/braintree_blue.rb +81 -77
  26. data/lib/active_merchant/billing/gateways/bridge_pay.rb +3 -3
  27. data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
  28. data/lib/active_merchant/billing/gateways/card_stream.rb +19 -19
  29. data/lib/active_merchant/billing/gateways/cc5.rb +7 -7
  30. data/lib/active_merchant/billing/gateways/cecabank.rb +3 -3
  31. data/lib/active_merchant/billing/gateways/cenpos.rb +3 -3
  32. data/lib/active_merchant/billing/gateways/checkout_v2.rb +20 -9
  33. data/lib/active_merchant/billing/gateways/clearhaus.rb +1 -1
  34. data/lib/active_merchant/billing/gateways/commercegate.rb +2 -2
  35. data/lib/active_merchant/billing/gateways/conekta.rb +1 -1
  36. data/lib/active_merchant/billing/gateways/creditcall.rb +4 -4
  37. data/lib/active_merchant/billing/gateways/ct_payment.rb +1 -1
  38. data/lib/active_merchant/billing/gateways/culqi.rb +2 -2
  39. data/lib/active_merchant/billing/gateways/cyber_source.rb +154 -91
  40. data/lib/active_merchant/billing/gateways/d_local.rb +4 -2
  41. data/lib/active_merchant/billing/gateways/data_cash.rb +33 -33
  42. data/lib/active_merchant/billing/gateways/decidir.rb +7 -2
  43. data/lib/active_merchant/billing/gateways/ebanx.rb +14 -2
  44. data/lib/active_merchant/billing/gateways/efsnet.rb +23 -23
  45. data/lib/active_merchant/billing/gateways/elavon.rb +70 -18
  46. data/lib/active_merchant/billing/gateways/element.rb +12 -4
  47. data/lib/active_merchant/billing/gateways/epay.rb +40 -40
  48. data/lib/active_merchant/billing/gateways/evo_ca.rb +11 -11
  49. data/lib/active_merchant/billing/gateways/eway.rb +3 -3
  50. data/lib/active_merchant/billing/gateways/eway_managed.rb +40 -40
  51. data/lib/active_merchant/billing/gateways/eway_rapid.rb +7 -7
  52. data/lib/active_merchant/billing/gateways/exact.rb +11 -11
  53. data/lib/active_merchant/billing/gateways/fat_zebra.rb +3 -2
  54. data/lib/active_merchant/billing/gateways/federated_canada.rb +5 -5
  55. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +21 -21
  56. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +20 -20
  57. data/lib/active_merchant/billing/gateways/flo2cash.rb +4 -4
  58. data/lib/active_merchant/billing/gateways/forte.rb +8 -7
  59. data/lib/active_merchant/billing/gateways/garanti.rb +8 -8
  60. data/lib/active_merchant/billing/gateways/global_collect.rb +30 -24
  61. data/lib/active_merchant/billing/gateways/hdfc.rb +3 -3
  62. data/lib/active_merchant/billing/gateways/hps.rb +5 -3
  63. data/lib/active_merchant/billing/gateways/iats_payments.rb +32 -15
  64. data/lib/active_merchant/billing/gateways/inspire.rb +7 -7
  65. data/lib/active_merchant/billing/gateways/instapay.rb +3 -3
  66. data/lib/active_merchant/billing/gateways/ipp.rb +1 -1
  67. data/lib/active_merchant/billing/gateways/iridium.rb +12 -10
  68. data/lib/active_merchant/billing/gateways/itransact.rb +7 -7
  69. data/lib/active_merchant/billing/gateways/iveri.rb +6 -3
  70. data/lib/active_merchant/billing/gateways/ixopay.rb +22 -0
  71. data/lib/active_merchant/billing/gateways/jetpay.rb +4 -4
  72. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +5 -5
  73. data/lib/active_merchant/billing/gateways/kushki.rb +34 -5
  74. data/lib/active_merchant/billing/gateways/latitude19.rb +2 -2
  75. data/lib/active_merchant/billing/gateways/linkpoint.rb +62 -62
  76. data/lib/active_merchant/billing/gateways/litle.rb +8 -3
  77. data/lib/active_merchant/billing/gateways/mastercard.rb +2 -2
  78. data/lib/active_merchant/billing/gateways/mercado_pago.rb +1 -0
  79. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +5 -5
  80. data/lib/active_merchant/billing/gateways/merchant_one.rb +2 -2
  81. data/lib/active_merchant/billing/gateways/merchant_partners.rb +4 -4
  82. data/lib/active_merchant/billing/gateways/merchant_ware.rb +12 -12
  83. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +11 -11
  84. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +12 -2
  85. data/lib/active_merchant/billing/gateways/mercury.rb +9 -9
  86. data/lib/active_merchant/billing/gateways/metrics_global.rb +15 -15
  87. data/lib/active_merchant/billing/gateways/migs.rb +13 -13
  88. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +7 -7
  89. data/lib/active_merchant/billing/gateways/monei.rb +19 -19
  90. data/lib/active_merchant/billing/gateways/moneris.rb +10 -10
  91. data/lib/active_merchant/billing/gateways/money_movers.rb +5 -5
  92. data/lib/active_merchant/billing/gateways/mundipagg.rb +1 -1
  93. data/lib/active_merchant/billing/gateways/nab_transact.rb +15 -15
  94. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +1 -1
  95. data/lib/active_merchant/billing/gateways/net_registry.rb +6 -6
  96. data/lib/active_merchant/billing/gateways/netaxept.rb +4 -4
  97. data/lib/active_merchant/billing/gateways/netbanx.rb +14 -14
  98. data/lib/active_merchant/billing/gateways/netbilling.rb +12 -12
  99. data/lib/active_merchant/billing/gateways/netpay.rb +2 -2
  100. data/lib/active_merchant/billing/gateways/network_merchants.rb +5 -5
  101. data/lib/active_merchant/billing/gateways/ogone.rb +7 -7
  102. data/lib/active_merchant/billing/gateways/openpay.rb +2 -2
  103. data/lib/active_merchant/billing/gateways/opp.rb +13 -7
  104. data/lib/active_merchant/billing/gateways/optimal_payment.rb +13 -9
  105. data/lib/active_merchant/billing/gateways/orbital.rb +54 -12
  106. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +7 -7
  107. data/lib/active_merchant/billing/gateways/pay_conex.rb +2 -2
  108. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +16 -16
  109. data/lib/active_merchant/billing/gateways/pay_junction.rb +16 -16
  110. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +18 -2
  111. data/lib/active_merchant/billing/gateways/pay_secure.rb +6 -6
  112. data/lib/active_merchant/billing/gateways/paybox_direct.rb +36 -36
  113. data/lib/active_merchant/billing/gateways/payflow.rb +7 -7
  114. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +12 -12
  115. data/lib/active_merchant/billing/gateways/payflow_express.rb +4 -4
  116. data/lib/active_merchant/billing/gateways/payment_express.rb +9 -9
  117. data/lib/active_merchant/billing/gateways/paymill.rb +3 -3
  118. data/lib/active_merchant/billing/gateways/paypal.rb +1 -1
  119. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +5 -5
  120. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
  121. data/lib/active_merchant/billing/gateways/payscout.rb +5 -5
  122. data/lib/active_merchant/billing/gateways/paystation.rb +2 -2
  123. data/lib/active_merchant/billing/gateways/payu_latam.rb +3 -3
  124. data/lib/active_merchant/billing/gateways/payway.rb +12 -12
  125. data/lib/active_merchant/billing/gateways/pin.rb +16 -16
  126. data/lib/active_merchant/billing/gateways/plugnpay.rb +10 -10
  127. data/lib/active_merchant/billing/gateways/psigate.rb +26 -26
  128. data/lib/active_merchant/billing/gateways/psl_card.rb +4 -4
  129. data/lib/active_merchant/billing/gateways/qbms.rb +23 -23
  130. data/lib/active_merchant/billing/gateways/quantum.rb +4 -4
  131. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +95 -95
  132. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +9 -9
  133. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +2 -2
  134. data/lib/active_merchant/billing/gateways/qvalent.rb +1 -1
  135. data/lib/active_merchant/billing/gateways/realex.rb +17 -10
  136. data/lib/active_merchant/billing/gateways/redsys.rb +24 -16
  137. data/lib/active_merchant/billing/gateways/safe_charge.rb +1 -1
  138. data/lib/active_merchant/billing/gateways/sage.rb +10 -10
  139. data/lib/active_merchant/billing/gateways/sage_pay.rb +35 -35
  140. data/lib/active_merchant/billing/gateways/sallie_mae.rb +2 -2
  141. data/lib/active_merchant/billing/gateways/secure_net.rb +9 -9
  142. data/lib/active_merchant/billing/gateways/secure_pay.rb +13 -13
  143. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +16 -16
  144. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +2 -2
  145. data/lib/active_merchant/billing/gateways/skip_jack.rb +8 -8
  146. data/lib/active_merchant/billing/gateways/smart_ps.rb +16 -16
  147. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +6 -6
  148. data/lib/active_merchant/billing/gateways/spreedly_core.rb +4 -4
  149. data/lib/active_merchant/billing/gateways/stripe.rb +15 -10
  150. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +50 -9
  151. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +2 -2
  152. data/lib/active_merchant/billing/gateways/trans_first.rb +4 -4
  153. data/lib/active_merchant/billing/gateways/trust_commerce.rb +19 -19
  154. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +110 -110
  155. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +29 -29
  156. data/lib/active_merchant/billing/gateways/verifi.rb +10 -10
  157. data/lib/active_merchant/billing/gateways/viaklix.rb +6 -6
  158. data/lib/active_merchant/billing/gateways/visanet_peru.rb +6 -6
  159. data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
  160. data/lib/active_merchant/billing/gateways/wirecard.rb +6 -6
  161. data/lib/active_merchant/billing/gateways/worldpay.rb +22 -20
  162. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +32 -32
  163. data/lib/active_merchant/billing/gateways/worldpay_us.rb +2 -2
  164. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +1 -1
  165. data/lib/active_merchant/connection.rb +1 -1
  166. data/lib/active_merchant/network_connection_retries.rb +3 -3
  167. data/lib/active_merchant/post_data.rb +1 -1
  168. data/lib/active_merchant/version.rb +1 -1
  169. data/lib/certs/cacert.pem +75 -0
  170. data/lib/support/ssl_verify.rb +2 -2
  171. data/lib/support/ssl_version.rb +2 -2
  172. metadata +4 -4
  173. data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -352
@@ -283,10 +283,10 @@ module ActiveMerchant #:nodoc:
283
283
  def response_from(raw_response, authorization_field)
284
284
  parsed = parse(raw_response)
285
285
  options = {
286
- :authorization => parsed[authorization_field],
287
- :test => (parsed[:on_test_gateway] == 'true'),
288
- :avs_result => { :code => parsed[:response_avs_code] },
289
- :cvv_result => parsed[:response_cvv_code]
286
+ authorization: parsed[authorization_field],
287
+ test: (parsed[:on_test_gateway] == 'true'),
288
+ avs_result: { code: parsed[:response_avs_code] },
289
+ cvv_result: parsed[:response_cvv_code]
290
290
  }
291
291
 
292
292
  Response.new(parsed[:succeeded] == 'true', parsed[:message] || parsed[:error], parsed, options)
@@ -80,6 +80,11 @@ module ActiveMerchant #:nodoc:
80
80
  end
81
81
 
82
82
  def authorize(money, payment, options = {})
83
+ if ach?(payment)
84
+ direct_bank_error = 'Direct bank account transactions are not supported for authorize.'
85
+ return Response.new(false, direct_bank_error)
86
+ end
87
+
83
88
  MultiResponse.run do |r|
84
89
  if payment.is_a?(ApplePayPaymentToken)
85
90
  r.process { tokenize_apple_pay_token(payment) }
@@ -419,7 +424,7 @@ module ActiveMerchant #:nodoc:
419
424
 
420
425
  def add_external_account(post, card_params, payment)
421
426
  external_account = {}
422
- external_account[:object] ='card'
427
+ external_account[:object] = 'card'
423
428
  external_account[:currency] = (options[:currency] || currency(payment)).downcase
424
429
  post[:external_account] = external_account.merge(card_params[:card])
425
430
  end
@@ -612,7 +617,7 @@ module ActiveMerchant #:nodoc:
612
617
  'User-Agent' => "Stripe/v1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
613
618
  'Stripe-Version' => api_version(options),
614
619
  'X-Stripe-Client-User-Agent' => stripe_client_user_agent(options),
615
- 'X-Stripe-Client-User-Metadata' => {:ip => options[:ip]}.to_json
620
+ 'X-Stripe-Client-User-Metadata' => {ip: options[:ip]}.to_json
616
621
  }
617
622
  headers['Idempotency-Key'] = idempotency_key if idempotency_key
618
623
  headers['Stripe-Account'] = options[:stripe_account] if options[:stripe_account]
@@ -647,7 +652,7 @@ module ActiveMerchant #:nodoc:
647
652
  add_expand_parameters(parameters, options) if parameters
648
653
  response = api_request(method, url, parameters, options)
649
654
  response['webhook_id'] = options[:webhook_id] if options[:webhook_id]
650
- success = success_from(response)
655
+ success = success_from(response, options)
651
656
 
652
657
  card = card_from_response(response)
653
658
  avs_code = AVS_CODE_TRANSLATOR["line1: #{card["address_line1_check"]}, zip: #{card["address_zip_check"]}"]
@@ -656,12 +661,12 @@ module ActiveMerchant #:nodoc:
656
661
  Response.new(success,
657
662
  message_from(success, response),
658
663
  response,
659
- :test => response_is_test?(response),
660
- :authorization => authorization_from(success, url, method, response),
661
- :avs_result => { :code => avs_code },
662
- :cvv_result => cvc_code,
663
- :emv_authorization => emv_authorization_from_response(response),
664
- :error_code => success ? nil : error_code_from(response)
664
+ test: response_is_test?(response),
665
+ authorization: authorization_from(success, url, method, response),
666
+ avs_result: { code: avs_code },
667
+ cvv_result: cvc_code,
668
+ emv_authorization: emv_authorization_from_response(response),
669
+ error_code: success ? nil : error_code_from(response)
665
670
  )
666
671
  end
667
672
 
@@ -681,7 +686,7 @@ module ActiveMerchant #:nodoc:
681
686
  success ? 'Transaction approved' : response.fetch('error', {'message' => 'No error details'})['message']
682
687
  end
683
688
 
684
- def success_from(response)
689
+ def success_from(response, options)
685
690
  !response.key?('error') && response['status'] != 'failed'
686
691
  end
687
692
 
@@ -20,7 +20,9 @@ module ActiveMerchant #:nodoc:
20
20
  add_capture_method(post, options)
21
21
  add_confirmation_method(post, options)
22
22
  add_customer(post, options)
23
- add_payment_method_token(post, payment_method, options)
23
+ payment_method = add_payment_method_token(post, payment_method, options)
24
+ return payment_method if payment_method.is_a?(ActiveMerchant::Billing::Response)
25
+
24
26
  add_metadata(post, options)
25
27
  add_return_url(post, options)
26
28
  add_connected_account(post, options)
@@ -41,11 +43,12 @@ module ActiveMerchant #:nodoc:
41
43
 
42
44
  def confirm_intent(intent_id, payment_method, options = {})
43
45
  post = {}
44
- add_payment_method_token(post, payment_method, options)
46
+ payment_method = add_payment_method_token(post, payment_method, options)
47
+ return payment_method if payment_method.is_a?(ActiveMerchant::Billing::Response)
48
+
45
49
  CONFIRM_INTENT_ATTRIBUTES.each do |attribute|
46
50
  add_whitelisted_attribute(post, options, attribute)
47
51
  end
48
-
49
52
  commit(:post, "payment_intents/#{intent_id}/confirm", post, options)
50
53
  end
51
54
 
@@ -58,7 +61,7 @@ module ActiveMerchant #:nodoc:
58
61
  post[:card][:exp_year] = payment_method.year
59
62
  post[:card][:cvc] = payment_method.verification_value if payment_method.verification_value
60
63
  add_billing_address(post, options)
61
-
64
+ options = format_idempotency_key(options, 'pm')
62
65
  commit(:post, 'payment_methods', post, options)
63
66
  end
64
67
 
@@ -66,7 +69,9 @@ module ActiveMerchant #:nodoc:
66
69
  post = {}
67
70
  add_amount(post, money, options)
68
71
 
69
- add_payment_method_token(post, payment_method, options)
72
+ payment_method = add_payment_method_token(post, payment_method, options)
73
+ return payment_method if payment_method.is_a?(ActiveMerchant::Billing::Response)
74
+
70
75
  add_payment_method_types(post, options)
71
76
  add_customer(post, options)
72
77
  add_metadata(post, options)
@@ -76,7 +81,6 @@ module ActiveMerchant #:nodoc:
76
81
  UPDATE_INTENT_ATTRIBUTES.each do |attribute|
77
82
  add_whitelisted_attribute(post, options, attribute)
78
83
  end
79
-
80
84
  commit(:post, "payment_intents/#{intent_id}", post, options)
81
85
  end
82
86
 
@@ -97,6 +101,7 @@ module ActiveMerchant #:nodoc:
97
101
  post[:transfer_data][:amount] = options[:transfer_amount]
98
102
  end
99
103
  post[:application_fee_amount] = options[:application_fee] if options[:application_fee]
104
+ options = format_idempotency_key(options, 'capture')
100
105
  commit(:post, "payment_intents/#{intent_id}/capture", post, options)
101
106
  end
102
107
 
@@ -107,8 +112,22 @@ module ActiveMerchant #:nodoc:
107
112
  end
108
113
 
109
114
  def refund(money, intent_id, options = {})
110
- intent = commit(:get, "payment_intents/#{intent_id}", nil, options)
111
- charge_id = intent.params.dig('charges', 'data')[0].dig('id')
115
+ if intent_id.include?('pi_')
116
+ intent = api_request(:get, "payment_intents/#{intent_id}", nil, options)
117
+
118
+ return Response.new(false, intent['error']['message'], intent) if intent['error']
119
+
120
+ charge_id = intent.try(:[], 'charges').try(:[], 'data').try(:[], 0).try(:[], 'id')
121
+
122
+ if charge_id.nil?
123
+ error_message = "No associated charge for #{intent['id']}"
124
+ error_message << "; payment_intent has a status of #{intent['status']}" if intent.try(:[], 'status') && intent.try(:[], 'status') != 'succeeded'
125
+ return Response.new(false, error_message, intent)
126
+ end
127
+ else
128
+ charge_id = intent_id
129
+ end
130
+
112
131
  super(money, charge_id, options)
113
132
  end
114
133
 
@@ -122,16 +141,20 @@ module ActiveMerchant #:nodoc:
122
141
  # If customer option is provided, create a payment method and attach to customer id
123
142
  # Otherwise, create a customer, then attach
124
143
  if payment_method.is_a?(StripePaymentToken) || payment_method.is_a?(ActiveMerchant::Billing::CreditCard)
125
- add_payment_method_token(params, payment_method, options)
144
+ payment_method = add_payment_method_token(params, payment_method, options)
145
+ return payment_method if payment_method.is_a?(ActiveMerchant::Billing::Response)
146
+
126
147
  if options[:customer]
127
148
  customer_id = options[:customer]
128
149
  else
129
150
  post[:validate] = options[:validate] unless options[:validate].nil?
130
151
  post[:description] = options[:description] if options[:description]
131
152
  post[:email] = options[:email] if options[:email]
153
+ options = format_idempotency_key(options, 'customer')
132
154
  customer = commit(:post, 'customers', post, options)
133
155
  customer_id = customer.params['id']
134
156
  end
157
+ options = format_idempotency_key(options, 'attach')
135
158
  commit(:post, "payment_methods/#{params[:payment_method]}/attach", { customer: customer_id }, options)
136
159
  else
137
160
  super(payment_method, options)
@@ -190,6 +213,8 @@ module ActiveMerchant #:nodoc:
190
213
 
191
214
  if payment_method.is_a?(ActiveMerchant::Billing::CreditCard)
192
215
  p = create_payment_method(payment_method, options)
216
+ return p unless p.success?
217
+
193
218
  payment_method = p.params['id']
194
219
  end
195
220
 
@@ -264,6 +289,22 @@ module ActiveMerchant #:nodoc:
264
289
  post[:shipping][:tracking_number] = shipping[:tracking_number] if shipping[:tracking_number]
265
290
  post
266
291
  end
292
+
293
+ def format_idempotency_key(options, suffix)
294
+ return options unless options[:idempotency_key]
295
+
296
+ options.merge(idempotency_key: "#{options[:idempotency_key]}-#{suffix}")
297
+ end
298
+
299
+ def success_from(response, options)
300
+ if response['status'] == 'requires_action' && !options[:execute_threed]
301
+ response['error'] = {}
302
+ response['error']['message'] = 'Received unexpected 3DS authentication response. Use the execute_threed option to initiate a proper 3DS flow.'
303
+ return false
304
+ end
305
+
306
+ super(response, options)
307
+ end
267
308
  end
268
309
  end
269
310
  end
@@ -109,7 +109,7 @@ module ActiveMerchant #:nodoc:
109
109
  TRANSACTION_APPROVED_MSG :
110
110
  TRANSACTION_DECLINED_MSG,
111
111
  response,
112
- :test => test?
112
+ test: test?
113
113
  )
114
114
  else
115
115
  build_error_response(message, response)
@@ -144,7 +144,7 @@ module ActiveMerchant #:nodoc:
144
144
  false,
145
145
  message,
146
146
  params,
147
- :test => test?
147
+ test: test?
148
148
  )
149
149
  end
150
150
  end
@@ -175,10 +175,10 @@ module ActiveMerchant #:nodoc:
175
175
  success_from(response),
176
176
  message_from(response),
177
177
  response,
178
- :test => test?,
179
- :authorization => authorization_from(response),
180
- :avs_result => { :code => response[:avs_code] },
181
- :cvv_result => response[:cvv2_code]
178
+ test: test?,
179
+ authorization: authorization_from(response),
180
+ avs_result: { code: response[:avs_code] },
181
+ cvv_result: response[:cvv2_code]
182
182
  )
183
183
  end
184
184
 
@@ -151,7 +151,7 @@ module ActiveMerchant #:nodoc:
151
151
 
152
152
  def authorize(money, creditcard_or_billing_id, options = {})
153
153
  parameters = {
154
- :amount => amount(money),
154
+ amount: amount(money),
155
155
  }
156
156
 
157
157
  add_order_id(parameters, options)
@@ -168,7 +168,7 @@ module ActiveMerchant #:nodoc:
168
168
  # to process a purchase are an amount in cents or a money object and a creditcard object or billingid string.
169
169
  def purchase(money, creditcard_or_billing_id, options = {})
170
170
  parameters = {
171
- :amount => amount(money),
171
+ amount: amount(money),
172
172
  }
173
173
 
174
174
  add_order_id(parameters, options)
@@ -187,8 +187,8 @@ module ActiveMerchant #:nodoc:
187
187
  def capture(money, authorization, options = {})
188
188
  transaction_id, _ = split_authorization(authorization)
189
189
  parameters = {
190
- :amount => amount(money),
191
- :transid => transaction_id,
190
+ amount: amount(money),
191
+ transid: transaction_id,
192
192
  }
193
193
  add_aggregator(parameters, options)
194
194
  add_custom_fields(parameters, options)
@@ -202,8 +202,8 @@ module ActiveMerchant #:nodoc:
202
202
  transaction_id, _ = split_authorization(identification)
203
203
 
204
204
  parameters = {
205
- :amount => amount(money),
206
- :transid => transaction_id
205
+ amount: amount(money),
206
+ transid: transaction_id
207
207
  }
208
208
 
209
209
  add_aggregator(parameters, options)
@@ -239,7 +239,7 @@ module ActiveMerchant #:nodoc:
239
239
  action = (VOIDABLE_ACTIONS - ['preauth']).include?(original_action) ? 'void' : 'reversal'
240
240
 
241
241
  parameters = {
242
- :transid => transaction_id,
242
+ transid: transaction_id,
243
243
  }
244
244
 
245
245
  add_aggregator(parameters, options)
@@ -281,11 +281,11 @@ module ActiveMerchant #:nodoc:
281
281
  end
282
282
 
283
283
  parameters = {
284
- :amount => amount(money),
285
- :cycle => cycle,
286
- :verify => options[:verify] || 'y',
287
- :billingid => options[:billingid] || nil,
288
- :payments => options[:payments] || nil,
284
+ amount: amount(money),
285
+ cycle: cycle,
286
+ verify: options[:verify] || 'y',
287
+ billingid: options[:billingid] || nil,
288
+ payments: options[:payments] || nil,
289
289
  }
290
290
 
291
291
  add_creditcard(parameters, creditcard)
@@ -299,8 +299,8 @@ module ActiveMerchant #:nodoc:
299
299
 
300
300
  def store(creditcard, options = {})
301
301
  parameters = {
302
- :verify => options[:verify] || 'y',
303
- :billingid => options[:billingid] || options[:billing_id] || nil,
302
+ verify: options[:verify] || 'y',
303
+ billingid: options[:billingid] || options[:billing_id] || nil,
304
304
  }
305
305
 
306
306
  add_creditcard(parameters, creditcard)
@@ -314,7 +314,7 @@ module ActiveMerchant #:nodoc:
314
314
  # unstore() the information will be removed and a Response object will be returned indicating the success of the action.
315
315
  def unstore(identification, options = {})
316
316
  parameters = {
317
- :billingid => identification,
317
+ billingid: identification,
318
318
  }
319
319
 
320
320
  add_custom_fields(parameters, options)
@@ -444,10 +444,10 @@ module ActiveMerchant #:nodoc:
444
444
  success = SUCCESS_TYPES.include?(data['status'])
445
445
  message = message_from(data)
446
446
  Response.new(success, message, data,
447
- :test => test?,
448
- :authorization => authorization_from(action, data),
449
- :cvv_result => data['cvv'],
450
- :avs_result => { :code => data['avs'] }
447
+ test: test?,
448
+ authorization: authorization_from(action, data),
449
+ cvv_result: data['cvv'],
450
+ avs_result: { code: data['avs'] }
451
451
  )
452
452
  end
453
453
 
@@ -78,29 +78,29 @@ module ActiveMerchant #:nodoc:
78
78
  self.display_name = 'USA ePay Advanced SOAP Interface'
79
79
 
80
80
  CUSTOMER_PROFILE_OPTIONS = {
81
- :id => [:string, 'CustomerID'], # merchant assigned number
82
- :notes => [:string, 'Notes'],
83
- :data => [:string, 'CustomData'],
84
- :url => [:string, 'URL']
81
+ id: [:string, 'CustomerID'], # merchant assigned number
82
+ notes: [:string, 'Notes'],
83
+ data: [:string, 'CustomData'],
84
+ url: [:string, 'URL']
85
85
  } #:nodoc:
86
86
 
87
87
  CUSTOMER_RECURRING_BILLING_OPTIONS = {
88
- :enabled => [:boolean, 'Enabled'],
89
- :schedule => [:string, 'Schedule'],
90
- :number_left => [:integer, 'NumLeft'],
91
- :currency => [:string, 'Currency'],
92
- :description => [:string, 'Description'],
93
- :order_id => [:string, 'OrderID'],
94
- :user => [:string, 'User'],
95
- :source => [:string, 'Source'],
96
- :send_receipt => [:boolean, 'SendReceipt'],
97
- :receipt_note => [:string, 'ReceiptNote']
88
+ enabled: [:boolean, 'Enabled'],
89
+ schedule: [:string, 'Schedule'],
90
+ number_left: [:integer, 'NumLeft'],
91
+ currency: [:string, 'Currency'],
92
+ description: [:string, 'Description'],
93
+ order_id: [:string, 'OrderID'],
94
+ user: [:string, 'User'],
95
+ source: [:string, 'Source'],
96
+ send_receipt: [:boolean, 'SendReceipt'],
97
+ receipt_note: [:string, 'ReceiptNote']
98
98
  } #:nodoc:
99
99
 
100
100
  CUSTOMER_POINT_OF_SALE_OPTIONS = {
101
- :price_tier => [:string, 'PriceTier'],
102
- :tax_class => [:string, 'TaxClass'],
103
- :lookup_code => [:string, 'LookupCode']
101
+ price_tier: [:string, 'PriceTier'],
102
+ tax_class: [:string, 'TaxClass'],
103
+ lookup_code: [:string, 'LookupCode']
104
104
  } #:nodoc:
105
105
 
106
106
  CUSTOMER_OPTIONS = [
@@ -110,23 +110,23 @@ module ActiveMerchant #:nodoc:
110
110
  ].inject(:merge) #:nodoc:
111
111
 
112
112
  COMMON_ADDRESS_OPTIONS = {
113
- :first_name => [:string, 'FirstName'],
114
- :last_name => [:string, 'LastName'],
115
- :city => [:string, 'City'],
116
- :state => [:string, 'State'],
117
- :zip => [:string, 'Zip'],
118
- :country => [:string, 'Country'],
119
- :phone => [:string, 'Phone'],
120
- :email => [:string, 'Email'],
121
- :fax => [:string, 'Fax'],
122
- :company => [:string, 'Company']
113
+ first_name: [:string, 'FirstName'],
114
+ last_name: [:string, 'LastName'],
115
+ city: [:string, 'City'],
116
+ state: [:string, 'State'],
117
+ zip: [:string, 'Zip'],
118
+ country: [:string, 'Country'],
119
+ phone: [:string, 'Phone'],
120
+ email: [:string, 'Email'],
121
+ fax: [:string, 'Fax'],
122
+ company: [:string, 'Company']
123
123
  } #:nodoc:
124
124
 
125
125
  ADDRESS_OPTIONS = [
126
126
  COMMON_ADDRESS_OPTIONS,
127
127
  {
128
- :address1 => [:string, 'Street'],
129
- :address2 => [:string, 'Street2'],
128
+ address1: [:string, 'Street'],
129
+ address2: [:string, 'Street2'],
130
130
  }
131
131
  ].inject(:merge) #:nodoc
132
132
 
@@ -135,98 +135,98 @@ module ActiveMerchant #:nodoc:
135
135
  CUSTOMER_RECURRING_BILLING_OPTIONS,
136
136
  COMMON_ADDRESS_OPTIONS,
137
137
  {
138
- :address1 => [:string, 'Address'],
139
- :address2 => [:string, 'Address2'],
138
+ address1: [:string, 'Address'],
139
+ address2: [:string, 'Address2'],
140
140
  },
141
141
  {
142
- :card_number => [:string, 'CardNumber'],
143
- :card_exp => [:string, 'CardExp'],
144
- :account => [:string, 'Account'],
145
- :routing => [:string, 'Routing'],
146
- :check_format => [:string, 'CheckFormat'],
147
- :record_type => [:string, 'RecordType'],
142
+ card_number: [:string, 'CardNumber'],
143
+ card_exp: [:string, 'CardExp'],
144
+ account: [:string, 'Account'],
145
+ routing: [:string, 'Routing'],
146
+ check_format: [:string, 'CheckFormat'],
147
+ record_type: [:string, 'RecordType'],
148
148
  }
149
149
  ].inject(:merge) #:nodoc
150
150
 
151
151
  CUSTOMER_TRANSACTION_REQUEST_OPTIONS = {
152
- :command => [:string, 'Command'],
153
- :ignore_duplicate => [:boolean, 'IgnoreDuplicate'],
154
- :client_ip => [:string, 'ClientIP'],
155
- :customer_receipt => [:boolean, 'CustReceipt'],
156
- :customer_email => [:boolean, 'CustReceiptEmail'],
157
- :customer_template => [:boolean, 'CustReceiptName'],
158
- :merchant_receipt => [:boolean, 'MerchReceipt'],
159
- :merchant_email => [:boolean, 'MerchReceiptEmail'],
160
- :merchant_template => [:boolean, 'MerchReceiptName'],
161
- :recurring => [:boolean, 'isRecurring'],
162
- :verification_value => [:string, 'CardCode'],
163
- :software => [:string, 'Software']
152
+ command: [:string, 'Command'],
153
+ ignore_duplicate: [:boolean, 'IgnoreDuplicate'],
154
+ client_ip: [:string, 'ClientIP'],
155
+ customer_receipt: [:boolean, 'CustReceipt'],
156
+ customer_email: [:boolean, 'CustReceiptEmail'],
157
+ customer_template: [:boolean, 'CustReceiptName'],
158
+ merchant_receipt: [:boolean, 'MerchReceipt'],
159
+ merchant_email: [:boolean, 'MerchReceiptEmail'],
160
+ merchant_template: [:boolean, 'MerchReceiptName'],
161
+ recurring: [:boolean, 'isRecurring'],
162
+ verification_value: [:string, 'CardCode'],
163
+ software: [:string, 'Software']
164
164
  } #:nodoc:
165
165
 
166
166
  TRANSACTION_REQUEST_OBJECT_OPTIONS = {
167
- :command => [:string, 'Command'],
168
- :ignore_duplicate => [:boolean, 'IgnoreDuplicate'],
169
- :authorization_code => [:string, 'AuthCode'],
170
- :reference_number => [:string, 'RefNum'],
171
- :account_holder => [:string, 'AccountHolder'],
172
- :client_ip => [:string, 'ClientIP'],
173
- :customer_id => [:string, 'CustomerID'],
174
- :customer_receipt => [:boolean, 'CustReceipt'],
175
- :customer_template => [:boolean, 'CustReceiptName'],
176
- :software => [:string, 'Software']
167
+ command: [:string, 'Command'],
168
+ ignore_duplicate: [:boolean, 'IgnoreDuplicate'],
169
+ authorization_code: [:string, 'AuthCode'],
170
+ reference_number: [:string, 'RefNum'],
171
+ account_holder: [:string, 'AccountHolder'],
172
+ client_ip: [:string, 'ClientIP'],
173
+ customer_id: [:string, 'CustomerID'],
174
+ customer_receipt: [:boolean, 'CustReceipt'],
175
+ customer_template: [:boolean, 'CustReceiptName'],
176
+ software: [:string, 'Software']
177
177
  } #:nodoc:
178
178
 
179
179
  TRANSACTION_DETAIL_OPTIONS = {
180
- :invoice => [:string, 'Invoice'],
181
- :po_number => [:string, 'PONum'],
182
- :order_id => [:string, 'OrderID'],
183
- :clerk => [:string, 'Clerk'],
184
- :terminal => [:string, 'Terminal'],
185
- :table => [:string, 'Table'],
186
- :description => [:string, 'Description'],
187
- :comments => [:string, 'Comments'],
188
- :allow_partial_auth => [:boolean, 'AllowPartialAuth'],
189
- :currency => [:string, 'Currency'],
190
- :non_tax => [:boolean, 'NonTax'],
180
+ invoice: [:string, 'Invoice'],
181
+ po_number: [:string, 'PONum'],
182
+ order_id: [:string, 'OrderID'],
183
+ clerk: [:string, 'Clerk'],
184
+ terminal: [:string, 'Terminal'],
185
+ table: [:string, 'Table'],
186
+ description: [:string, 'Description'],
187
+ comments: [:string, 'Comments'],
188
+ allow_partial_auth: [:boolean, 'AllowPartialAuth'],
189
+ currency: [:string, 'Currency'],
190
+ non_tax: [:boolean, 'NonTax'],
191
191
  } #:nodoc:
192
192
 
193
193
  TRANSACTION_DETAIL_MONEY_OPTIONS = {
194
- :amount => [:double, 'Amount'],
195
- :tax => [:double, 'Tax'],
196
- :tip => [:double, 'Tip'],
197
- :non_tax => [:boolean, 'NonTax'],
198
- :shipping => [:double, 'Shipping'],
199
- :discount => [:double, 'Discount'],
200
- :subtotal => [:double, 'Subtotal']
194
+ amount: [:double, 'Amount'],
195
+ tax: [:double, 'Tax'],
196
+ tip: [:double, 'Tip'],
197
+ non_tax: [:boolean, 'NonTax'],
198
+ shipping: [:double, 'Shipping'],
199
+ discount: [:double, 'Discount'],
200
+ subtotal: [:double, 'Subtotal']
201
201
  } #:nodoc:
202
202
 
203
203
  CREDIT_CARD_DATA_OPTIONS = {
204
- :magnetic_stripe => [:string, 'MagStripe'],
205
- :dukpt => [:string, 'DUKPT'],
206
- :signature => [:string, 'Signature'],
207
- :terminal_type => [:string, 'TermType'],
208
- :magnetic_support => [:string, 'MagSupport'],
209
- :xid => [:string, 'XID'],
210
- :cavv => [:string, 'CAVV'],
211
- :eci => [:integer, 'ECI'],
212
- :internal_card_authorization => [:boolean, 'InternalCardAuth'],
213
- :pares => [:string, 'Pares']
204
+ magnetic_stripe: [:string, 'MagStripe'],
205
+ dukpt: [:string, 'DUKPT'],
206
+ signature: [:string, 'Signature'],
207
+ terminal_type: [:string, 'TermType'],
208
+ magnetic_support: [:string, 'MagSupport'],
209
+ xid: [:string, 'XID'],
210
+ cavv: [:string, 'CAVV'],
211
+ eci: [:integer, 'ECI'],
212
+ internal_card_authorization: [:boolean, 'InternalCardAuth'],
213
+ pares: [:string, 'Pares']
214
214
  } #:nodoc:
215
215
 
216
216
  CHECK_DATA_OPTIONS = {
217
- :drivers_license => [:string, 'DriversLicense'],
218
- :drivers_license_state => [:string, 'DriversLicenseState'],
219
- :record_type => [:string, 'RecordType'],
220
- :aux_on_us => [:string, 'AuxOnUS'],
221
- :epc_code => [:string, 'EpcCode'],
222
- :front_image => [:string, 'FrontImage'],
223
- :back_image => [:string, 'BackImage']
217
+ drivers_license: [:string, 'DriversLicense'],
218
+ drivers_license_state: [:string, 'DriversLicenseState'],
219
+ record_type: [:string, 'RecordType'],
220
+ aux_on_us: [:string, 'AuxOnUS'],
221
+ epc_code: [:string, 'EpcCode'],
222
+ front_image: [:string, 'FrontImage'],
223
+ back_image: [:string, 'BackImage']
224
224
  } #:nodoc:
225
225
 
226
226
  RECURRING_BILLING_OPTIONS = {
227
- :schedule => [:string, 'Schedule'],
228
- :number_left => [:integer, 'NumLeft'],
229
- :enabled => [:boolean, 'Enabled']
227
+ schedule: [:string, 'Schedule'],
228
+ number_left: [:integer, 'NumLeft'],
229
+ enabled: [:boolean, 'Enabled']
230
230
  } #:nodoc:
231
231
 
232
232
  AVS_RESULTS = {
@@ -290,7 +290,7 @@ module ActiveMerchant #:nodoc:
290
290
  # Note: See run_transaction for additional options.
291
291
  #
292
292
  def purchase(money, creditcard, options={})
293
- run_sale(options.merge!(:amount => money, :payment_method => creditcard))
293
+ run_sale(options.merge!(amount: money, payment_method: creditcard))
294
294
  end
295
295
 
296
296
  # Authorize an amount on a credit card or account.
@@ -298,7 +298,7 @@ module ActiveMerchant #:nodoc:
298
298
  # Note: See run_transaction for additional options.
299
299
  #
300
300
  def authorize(money, creditcard, options={})
301
- run_auth_only(options.merge!(:amount => money, :payment_method => creditcard))
301
+ run_auth_only(options.merge!(amount: money, payment_method: creditcard))
302
302
  end
303
303
 
304
304
  # Capture an authorized transaction.
@@ -306,7 +306,7 @@ module ActiveMerchant #:nodoc:
306
306
  # Note: See run_transaction for additional options.
307
307
  #
308
308
  def capture(money, identification, options={})
309
- capture_transaction(options.merge!(:amount => money, :reference_number => identification))
309
+ capture_transaction(options.merge!(amount: money, reference_number: identification))
310
310
  end
311
311
 
312
312
  # Void a previous transaction that has not been settled.
@@ -314,7 +314,7 @@ module ActiveMerchant #:nodoc:
314
314
  # Note: See run_transaction for additional options.
315
315
  #
316
316
  def void(identification, options={})
317
- void_transaction(options.merge!(:reference_number => identification))
317
+ void_transaction(options.merge!(reference_number: identification))
318
318
  end
319
319
 
320
320
  # Refund a previous transaction.
@@ -322,7 +322,7 @@ module ActiveMerchant #:nodoc:
322
322
  # Note: See run_transaction for additional options.
323
323
  #
324
324
  def refund(money, identification, options={})
325
- refund_transaction(options.merge!(:amount => money, :reference_number => identification))
325
+ refund_transaction(options.merge!(amount: money, reference_number: identification))
326
326
  end
327
327
 
328
328
  def credit(money, identification, options={})
@@ -1031,7 +1031,7 @@ module ActiveMerchant #:nodoc:
1031
1031
  # Build soap header, etc.
1032
1032
  def build_request(action, options = {})
1033
1033
  soap = Builder::XmlMarkup.new
1034
- soap.instruct!(:xml, :version => '1.0', :encoding => 'utf-8')
1034
+ soap.instruct!(:xml, version: '1.0', encoding: 'utf-8')
1035
1035
  soap.tag! 'SOAP-ENV:Envelope',
1036
1036
  'xmlns:SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/',
1037
1037
  'xmlns:ns1' => 'urn:usaepay',
@@ -1310,7 +1310,7 @@ module ActiveMerchant #:nodoc:
1310
1310
  if options[:payment_methods]
1311
1311
  length = options[:payment_methods].length
1312
1312
  soap.PaymentMethods 'SOAP-ENC:arrayType' => "ns1:PaymentMethod[#{length}]",
1313
- 'xsi:type' =>'ns1:PaymentMethodArray' do
1313
+ 'xsi:type' => 'ns1:PaymentMethodArray' do
1314
1314
  build_customer_payment_methods soap, options
1315
1315
  end
1316
1316
  end
@@ -1536,15 +1536,15 @@ module ActiveMerchant #:nodoc:
1536
1536
  success,
1537
1537
  message,
1538
1538
  response_params,
1539
- :test => test?,
1540
- :authorization => authorization,
1541
- :avs_result => avs_from(avs),
1542
- :cvv_result => cvv
1539
+ test: test?,
1540
+ authorization: authorization,
1541
+ avs_result: avs_from(avs),
1542
+ cvv_result: cvv
1543
1543
  )
1544
1544
  end
1545
1545
 
1546
1546
  def avs_from(avs)
1547
- avs_params = { :code => avs }
1547
+ avs_params = { code: avs }
1548
1548
  avs_params[:message] = AVS_CUSTOM_MESSAGES[avs] if AVS_CUSTOM_MESSAGES.key?(avs)
1549
1549
  avs_params
1550
1550
  end
@@ -1552,7 +1552,7 @@ module ActiveMerchant #:nodoc:
1552
1552
  def parse(action, soap)
1553
1553
  xml = REXML::Document.new(soap)
1554
1554
  root = REXML::XPath.first(xml, '//SOAP-ENV:Body')
1555
- response = root ? parse_element(root[0]) : { :response => soap }
1555
+ response = root ? parse_element(root[0]) : { response: soap }
1556
1556
 
1557
1557
  success, message, authorization, avs, cvv = false, FAILURE_MESSAGE, nil, nil, nil
1558
1558