activemerchant 1.114.0 → 1.116.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +45 -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_methods.rb +5 -5
  7. data/lib/active_merchant/billing/gateways/adyen.rb +23 -13
  8. data/lib/active_merchant/billing/gateways/allied_wallet.rb +7 -7
  9. data/lib/active_merchant/billing/gateways/authorize_net.rb +13 -11
  10. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -4
  11. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +1 -1
  12. data/lib/active_merchant/billing/gateways/axcessms.rb +8 -9
  13. data/lib/active_merchant/billing/gateways/balanced.rb +4 -3
  14. data/lib/active_merchant/billing/gateways/bambora_apac.rb +7 -7
  15. data/lib/active_merchant/billing/gateways/bank_frick.rb +7 -7
  16. data/lib/active_merchant/billing/gateways/banwire.rb +1 -1
  17. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +6 -4
  18. data/lib/active_merchant/billing/gateways/beanstream.rb +3 -3
  19. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +4 -5
  20. data/lib/active_merchant/billing/gateways/blue_pay.rb +2 -3
  21. data/lib/active_merchant/billing/gateways/blue_snap.rb +19 -17
  22. data/lib/active_merchant/billing/gateways/bogus.rb +19 -19
  23. data/lib/active_merchant/billing/gateways/borgun.rb +11 -11
  24. data/lib/active_merchant/billing/gateways/bpoint.rb +8 -8
  25. data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
  26. data/lib/active_merchant/billing/gateways/braintree_blue.rb +7 -10
  27. data/lib/active_merchant/billing/gateways/bridge_pay.rb +7 -7
  28. data/lib/active_merchant/billing/gateways/cams.rb +8 -8
  29. data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
  30. data/lib/active_merchant/billing/gateways/card_save.rb +1 -1
  31. data/lib/active_merchant/billing/gateways/card_stream.rb +2 -2
  32. data/lib/active_merchant/billing/gateways/cardknox.rb +7 -7
  33. data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
  34. data/lib/active_merchant/billing/gateways/cecabank.rb +5 -5
  35. data/lib/active_merchant/billing/gateways/cenpos.rb +10 -10
  36. data/lib/active_merchant/billing/gateways/checkout.rb +2 -2
  37. data/lib/active_merchant/billing/gateways/checkout_v2.rb +16 -19
  38. data/lib/active_merchant/billing/gateways/clearhaus.rb +7 -7
  39. data/lib/active_merchant/billing/gateways/commercegate.rb +1 -1
  40. data/lib/active_merchant/billing/gateways/conekta.rb +2 -2
  41. data/lib/active_merchant/billing/gateways/creditcall.rb +10 -10
  42. data/lib/active_merchant/billing/gateways/credorax.rb +9 -9
  43. data/lib/active_merchant/billing/gateways/ct_payment.rb +10 -10
  44. data/lib/active_merchant/billing/gateways/culqi.rb +9 -9
  45. data/lib/active_merchant/billing/gateways/cyber_source.rb +30 -31
  46. data/lib/active_merchant/billing/gateways/d_local.rb +11 -11
  47. data/lib/active_merchant/billing/gateways/data_cash.rb +2 -3
  48. data/lib/active_merchant/billing/gateways/decidir.rb +9 -8
  49. data/lib/active_merchant/billing/gateways/dibs.rb +8 -8
  50. data/lib/active_merchant/billing/gateways/digitzs.rb +5 -5
  51. data/lib/active_merchant/billing/gateways/ebanx.rb +9 -9
  52. data/lib/active_merchant/billing/gateways/efsnet.rb +2 -3
  53. data/lib/active_merchant/billing/gateways/elavon.rb +251 -232
  54. data/lib/active_merchant/billing/gateways/element.rb +8 -8
  55. data/lib/active_merchant/billing/gateways/evo_ca.rb +5 -6
  56. data/lib/active_merchant/billing/gateways/eway.rb +3 -4
  57. data/lib/active_merchant/billing/gateways/eway_managed.rb +6 -7
  58. data/lib/active_merchant/billing/gateways/eway_rapid.rb +6 -6
  59. data/lib/active_merchant/billing/gateways/exact.rb +8 -9
  60. data/lib/active_merchant/billing/gateways/ezic.rb +7 -7
  61. data/lib/active_merchant/billing/gateways/fat_zebra.rb +4 -4
  62. data/lib/active_merchant/billing/gateways/federated_canada.rb +2 -3
  63. data/lib/active_merchant/billing/gateways/first_giving.rb +1 -1
  64. data/lib/active_merchant/billing/gateways/first_pay.rb +6 -6
  65. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +7 -7
  66. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +4 -4
  67. data/lib/active_merchant/billing/gateways/flo2cash.rb +8 -8
  68. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
  69. data/lib/active_merchant/billing/gateways/forte.rb +14 -8
  70. data/lib/active_merchant/billing/gateways/global_collect.rb +10 -10
  71. data/lib/active_merchant/billing/gateways/global_transport.rb +7 -7
  72. data/lib/active_merchant/billing/gateways/hdfc.rb +9 -9
  73. data/lib/active_merchant/billing/gateways/hps.rb +7 -7
  74. data/lib/active_merchant/billing/gateways/iats_payments.rb +9 -4
  75. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
  76. data/lib/active_merchant/billing/gateways/inspire.rb +3 -4
  77. data/lib/active_merchant/billing/gateways/instapay.rb +1 -2
  78. data/lib/active_merchant/billing/gateways/ipp.rb +5 -5
  79. data/lib/active_merchant/billing/gateways/iridium.rb +14 -15
  80. data/lib/active_merchant/billing/gateways/iveri.rb +7 -7
  81. data/lib/active_merchant/billing/gateways/ixopay.rb +7 -7
  82. data/lib/active_merchant/billing/gateways/jetpay.rb +1 -2
  83. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +4 -5
  84. data/lib/active_merchant/billing/gateways/kushki.rb +6 -6
  85. data/lib/active_merchant/billing/gateways/latitude19.rb +14 -14
  86. data/lib/active_merchant/billing/gateways/linkpoint.rb +4 -5
  87. data/lib/active_merchant/billing/gateways/litle.rb +11 -11
  88. data/lib/active_merchant/billing/gateways/mastercard.rb +10 -10
  89. data/lib/active_merchant/billing/gateways/mercado_pago.rb +7 -7
  90. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +1 -2
  91. data/lib/active_merchant/billing/gateways/merchant_one.rb +1 -1
  92. data/lib/active_merchant/billing/gateways/merchant_partners.rb +10 -10
  93. data/lib/active_merchant/billing/gateways/merchant_ware.rb +5 -7
  94. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +4 -6
  95. data/lib/active_merchant/billing/gateways/mercury.rb +4 -4
  96. data/lib/active_merchant/billing/gateways/metrics_global.rb +4 -5
  97. data/lib/active_merchant/billing/gateways/micropayment.rb +8 -8
  98. data/lib/active_merchant/billing/gateways/migs.rb +3 -4
  99. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +2 -4
  100. data/lib/active_merchant/billing/gateways/monei.rb +7 -7
  101. data/lib/active_merchant/billing/gateways/moneris.rb +4 -3
  102. data/lib/active_merchant/billing/gateways/money_movers.rb +2 -3
  103. data/lib/active_merchant/billing/gateways/mundipagg.rb +37 -10
  104. data/lib/active_merchant/billing/gateways/nab_transact.rb +2 -4
  105. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +7 -7
  106. data/lib/active_merchant/billing/gateways/net_registry.rb +1 -2
  107. data/lib/active_merchant/billing/gateways/netaxept.rb +6 -6
  108. data/lib/active_merchant/billing/gateways/netbanx.rb +8 -8
  109. data/lib/active_merchant/billing/gateways/netbilling.rb +4 -5
  110. data/lib/active_merchant/billing/gateways/network_merchants.rb +2 -3
  111. data/lib/active_merchant/billing/gateways/nmi.rb +21 -7
  112. data/lib/active_merchant/billing/gateways/ogone.rb +3 -3
  113. data/lib/active_merchant/billing/gateways/omise.rb +13 -13
  114. data/lib/active_merchant/billing/gateways/openpay.rb +3 -4
  115. data/lib/active_merchant/billing/gateways/opp.rb +9 -9
  116. data/lib/active_merchant/billing/gateways/optimal_payment.rb +2 -3
  117. data/lib/active_merchant/billing/gateways/orbital.rb +61 -66
  118. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +3 -4
  119. data/lib/active_merchant/billing/gateways/pagarme.rb +8 -8
  120. data/lib/active_merchant/billing/gateways/pago_facil.rb +2 -2
  121. data/lib/active_merchant/billing/gateways/pay_conex.rb +8 -8
  122. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +6 -7
  123. data/lib/active_merchant/billing/gateways/pay_hub.rb +7 -8
  124. data/lib/active_merchant/billing/gateways/pay_junction.rb +2 -3
  125. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +9 -9
  126. data/lib/active_merchant/billing/gateways/pay_secure.rb +2 -3
  127. data/lib/active_merchant/billing/gateways/paybox_direct.rb +23 -1
  128. data/lib/active_merchant/billing/gateways/payeezy.rb +9 -9
  129. data/lib/active_merchant/billing/gateways/payex.rb +6 -7
  130. data/lib/active_merchant/billing/gateways/payflow.rb +1 -1
  131. data/lib/active_merchant/billing/gateways/payment_express.rb +1 -2
  132. data/lib/active_merchant/billing/gateways/paymentez.rb +5 -5
  133. data/lib/active_merchant/billing/gateways/paymill.rb +7 -7
  134. data/lib/active_merchant/billing/gateways/paypal_express.rb +1 -1
  135. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
  136. data/lib/active_merchant/billing/gateways/payscout.rb +1 -2
  137. data/lib/active_merchant/billing/gateways/paystation.rb +3 -4
  138. data/lib/active_merchant/billing/gateways/payu_in.rb +3 -3
  139. data/lib/active_merchant/billing/gateways/payu_latam.rb +17 -10
  140. data/lib/active_merchant/billing/gateways/payway.rb +8 -9
  141. data/lib/active_merchant/billing/gateways/plugnpay.rb +1 -2
  142. data/lib/active_merchant/billing/gateways/pro_pay.rb +8 -8
  143. data/lib/active_merchant/billing/gateways/psigate.rb +2 -3
  144. data/lib/active_merchant/billing/gateways/psl_card.rb +1 -2
  145. data/lib/active_merchant/billing/gateways/qbms.rb +1 -2
  146. data/lib/active_merchant/billing/gateways/quantum.rb +1 -2
  147. data/lib/active_merchant/billing/gateways/quickbooks.rb +1 -1
  148. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +3 -4
  149. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -2
  150. data/lib/active_merchant/billing/gateways/qvalent.rb +8 -8
  151. data/lib/active_merchant/billing/gateways/realex.rb +1 -1
  152. data/lib/active_merchant/billing/gateways/redsys.rb +4 -4
  153. data/lib/active_merchant/billing/gateways/s5.rb +7 -7
  154. data/lib/active_merchant/billing/gateways/safe_charge.rb +12 -12
  155. data/lib/active_merchant/billing/gateways/sage.rb +3 -5
  156. data/lib/active_merchant/billing/gateways/sage_pay.rb +2 -3
  157. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
  158. data/lib/active_merchant/billing/gateways/secure_net.rb +1 -2
  159. data/lib/active_merchant/billing/gateways/secure_pay.rb +3 -4
  160. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +2 -4
  161. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -2
  162. data/lib/active_merchant/billing/gateways/securion_pay.rb +5 -6
  163. data/lib/active_merchant/billing/gateways/skip_jack.rb +2 -3
  164. data/lib/active_merchant/billing/gateways/smart_ps.rb +5 -6
  165. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +7 -7
  166. data/lib/active_merchant/billing/gateways/spreedly_core.rb +6 -6
  167. data/lib/active_merchant/billing/gateways/stripe.rb +9 -9
  168. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +9 -0
  169. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +3 -4
  170. data/lib/active_merchant/billing/gateways/telr.rb +8 -8
  171. data/lib/active_merchant/billing/gateways/trans_first.rb +2 -2
  172. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +12 -12
  173. data/lib/active_merchant/billing/gateways/transact_pro.rb +9 -9
  174. data/lib/active_merchant/billing/gateways/trust_commerce.rb +1 -2
  175. data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -1
  176. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +32 -32
  177. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +3 -4
  178. data/lib/active_merchant/billing/gateways/vanco.rb +3 -3
  179. data/lib/active_merchant/billing/gateways/verifi.rb +1 -2
  180. data/lib/active_merchant/billing/gateways/viaklix.rb +1 -2
  181. data/lib/active_merchant/billing/gateways/visanet_peru.rb +10 -10
  182. data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
  183. data/lib/active_merchant/billing/gateways/wepay.rb +3 -2
  184. data/lib/active_merchant/billing/gateways/wirecard.rb +1 -2
  185. data/lib/active_merchant/billing/gateways/worldpay.rb +12 -8
  186. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +14 -16
  187. data/lib/active_merchant/billing/gateways/worldpay_us.rb +7 -7
  188. data/lib/active_merchant/billing/response.rb +1 -1
  189. data/lib/active_merchant/country.rb +1 -1
  190. data/lib/active_merchant/network_connection_retries.rb +2 -2
  191. data/lib/active_merchant/post_data.rb +1 -1
  192. data/lib/active_merchant/posts_data.rb +1 -1
  193. data/lib/active_merchant/version.rb +1 -1
  194. data/lib/support/ssl_verify.rb +2 -2
  195. data/lib/support/ssl_version.rb +2 -2
  196. metadata +2 -2
@@ -185,8 +185,7 @@ module ActiveMerchant #:nodoc:
185
185
 
186
186
  Response.new(success?(response), message_from(response), response,
187
187
  test: test?,
188
- authorization: authorization_from(response)
189
- )
188
+ authorization: authorization_from(response))
190
189
  end
191
190
 
192
191
  def build_periodic_item(action, money, credit_card, options)
@@ -242,8 +241,7 @@ module ActiveMerchant #:nodoc:
242
241
 
243
242
  Response.new(success?(response), message_from(response), response,
244
243
  test: test?,
245
- authorization: authorization_from(response)
246
- )
244
+ authorization: authorization_from(response))
247
245
  end
248
246
 
249
247
  def success?(response)
@@ -86,8 +86,7 @@ module ActiveMerchant #:nodoc:
86
86
 
87
87
  Response.new(response[:result_code] == 1, message_from(response), response,
88
88
  test: test?,
89
- authorization: response[:merchant_transaction_reference]
90
- )
89
+ authorization: response[:merchant_transaction_reference])
91
90
  end
92
91
 
93
92
  def message_from(result)
@@ -31,17 +31,17 @@ module ActiveMerchant #:nodoc:
31
31
  'expired_token' => STANDARD_ERROR_CODE[:card_declined]
32
32
  }
33
33
 
34
- def initialize(options={})
34
+ def initialize(options = {})
35
35
  requires!(options, :secret_key)
36
36
  super
37
37
  end
38
38
 
39
- def purchase(money, payment, options={})
39
+ def purchase(money, payment, options = {})
40
40
  post = create_post_for_auth_or_purchase(money, payment, options)
41
41
  commit('charges', post, options)
42
42
  end
43
43
 
44
- def authorize(money, payment, options={})
44
+ def authorize(money, payment, options = {})
45
45
  post = create_post_for_auth_or_purchase(money, payment, options)
46
46
  post[:captured] = 'false'
47
47
  commit('charges', post, options)
@@ -63,7 +63,7 @@ module ActiveMerchant #:nodoc:
63
63
  commit("charges/#{CGI.escape(authorization)}/refund", {}, options)
64
64
  end
65
65
 
66
- def verify(credit_card, options={})
66
+ def verify(credit_card, options = {})
67
67
  MultiResponse.run(:use_first_response) do |r|
68
68
  r.process { authorize(100, credit_card, options) }
69
69
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -190,8 +190,7 @@ module ActiveMerchant #:nodoc:
190
190
  response,
191
191
  test: test?,
192
192
  authorization: (success ? response['id'] : response['error']['charge']),
193
- error_code: (success ? nil : STANDARD_ERROR_CODE_MAPPING[response['error']['code']])
194
- )
193
+ error_code: (success ? nil : STANDARD_ERROR_CODE_MAPPING[response['error']['code']]))
195
194
  end
196
195
 
197
196
  def headers(options = {})
@@ -213,7 +213,7 @@ module ActiveMerchant #:nodoc:
213
213
  #
214
214
  # * <tt>:force_settlement</tt> -- Force the settlement to occur as soon as possible. This option is not supported by other gateways. See the SkipJack API reference for more details
215
215
  def capture(money, authorization, options = {})
216
- post = { }
216
+ post = {}
217
217
  add_status_action(post, 'SETTLE')
218
218
  add_forced_settlement(post, options)
219
219
  add_transaction_id(post, authorization)
@@ -267,8 +267,7 @@ module ActiveMerchant #:nodoc:
267
267
  test: test?,
268
268
  authorization: response[:szTransactionFileName] || parameters[:szTransactionId],
269
269
  avs_result: { code: response[:szAVSResponseCode] },
270
- cvv_result: response[:szCVV2ResponseCode]
271
- )
270
+ cvv_result: response[:szCVV2ResponseCode])
272
271
  end
273
272
 
274
273
  def url_for(action)
@@ -123,7 +123,7 @@ module ActiveMerchant #:nodoc:
123
123
  commit(nil, nil, post)
124
124
  end
125
125
 
126
- alias_method :unstore, :delete
126
+ alias unstore delete
127
127
 
128
128
  private
129
129
 
@@ -133,9 +133,9 @@ module ActiveMerchant #:nodoc:
133
133
  post[:ipaddress] = options[:ip] if options.has_key? :ip
134
134
  end
135
135
 
136
- def add_address(post, address, prefix='')
136
+ def add_address(post, address, prefix = '')
137
137
  prefix += '_' unless prefix.blank?
138
- unless address.blank? or address.values.blank?
138
+ unless address.blank? || address.values.blank?
139
139
  post[prefix + 'address1'] = address[:address1].to_s
140
140
  post[prefix + 'address2'] = address[:address2].to_s unless address[:address2].blank?
141
141
  post[prefix + 'company'] = address[:company].to_s
@@ -163,7 +163,7 @@ module ActiveMerchant #:nodoc:
163
163
  post[:orderid] = options[:order_id].to_s.gsub(/[^\w.]/, '')
164
164
  end
165
165
 
166
- def add_payment_source(params, source, options={})
166
+ def add_payment_source(params, source, options = {})
167
167
  case determine_funding_source(source)
168
168
  when :vault then add_customer_vault_id(params, source)
169
169
  when :credit_card then add_creditcard(params, source, options)
@@ -230,8 +230,7 @@ module ActiveMerchant #:nodoc:
230
230
  authorization: (response['transactionid'] || response['customer_vault_id']),
231
231
  test: test?,
232
232
  cvv_result: response['cvvresponse'],
233
- avs_result: { code: response['avsresponse'] }
234
- )
233
+ avs_result: { code: response['avsresponse'] })
235
234
  end
236
235
 
237
236
  def expdate(creditcard)
@@ -39,11 +39,11 @@ module ActiveMerchant #:nodoc:
39
39
  commit('CaptureTransaction', do_capture(money, authorization, options), options)
40
40
  end
41
41
 
42
- def refund(money, authorization, options={})
42
+ def refund(money, authorization, options = {})
43
43
  commit('RefundTransaction', do_refund(money, authorization, options), options)
44
44
  end
45
45
 
46
- def void(authorization, options={})
46
+ def void(authorization, options = {})
47
47
  commit('CancelTransaction', do_void(authorization, options), options)
48
48
  end
49
49
 
@@ -139,7 +139,7 @@ module ActiveMerchant #:nodoc:
139
139
  soap.tag!('cardExpireYear', card.year.to_s)
140
140
  end
141
141
 
142
- def fill_order_info(soap, money, options, skip_currency=false)
142
+ def fill_order_info(soap, money, options, skip_currency = false)
143
143
  soap.tag!('orderID', options[:order_id].to_s)
144
144
  soap.tag!('orderDescription', "Order #{options[:order_id]}")
145
145
  soap.tag!('amount', amount(money).to_s)
@@ -157,8 +157,8 @@ module ActiveMerchant #:nodoc:
157
157
  end
158
158
 
159
159
  def commit(soap_action, soap, options)
160
- headers = {'SOAPAction' => "\"urn:Interface##{soap_action}\"",
161
- 'Content-Type' => 'text/xml; charset=utf-8'}
160
+ headers = { 'SOAPAction' => "\"urn:Interface##{soap_action}\"",
161
+ 'Content-Type' => 'text/xml; charset=utf-8' }
162
162
  response_string = ssl_post(test? ? self.test_url : self.live_url, soap, headers)
163
163
  response = parse(response_string, soap_action)
164
164
  return Response.new(response['errorcode'] == '000',
@@ -179,9 +179,9 @@ module ActiveMerchant #:nodoc:
179
179
  'xmlns:types' => 'urn:Interface/encodedTypes',
180
180
  'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/'
181
181
  }) do
182
- retval.tag!('soap:Body', {'soap:encodingStyle' => 'http://schemas.xmlsoap.org/soap/encoding/'}) do
182
+ retval.tag!('soap:Body', { 'soap:encodingStyle' => 'http://schemas.xmlsoap.org/soap/encoding/' }) do
183
183
  retval.tag!("tns:#{request}") do
184
- retval.tag!("#{request}Request", {'xsi:type' => "tns:#{request}Request"}) do
184
+ retval.tag!("#{request}Request", { 'xsi:type' => "tns:#{request}Request" }) do
185
185
  yield retval
186
186
  end
187
187
  end
@@ -56,7 +56,7 @@ module ActiveMerchant #:nodoc:
56
56
  commit("gateways/#{@options[:gateway_token]}/authorize.xml", request)
57
57
  end
58
58
 
59
- def capture(money, authorization, options={})
59
+ def capture(money, authorization, options = {})
60
60
  request = build_xml_request('transaction') do |doc|
61
61
  add_invoice(doc, money, options)
62
62
  end
@@ -64,7 +64,7 @@ module ActiveMerchant #:nodoc:
64
64
  commit("transactions/#{authorization}/capture.xml", request)
65
65
  end
66
66
 
67
- def refund(money, authorization, options={})
67
+ def refund(money, authorization, options = {})
68
68
  request = build_xml_request('transaction') do |doc|
69
69
  add_invoice(doc, money, options)
70
70
  add_extra_options(:gateway_specific_fields, doc, options)
@@ -73,7 +73,7 @@ module ActiveMerchant #:nodoc:
73
73
  commit("transactions/#{authorization}/credit.xml", request)
74
74
  end
75
75
 
76
- def void(authorization, options={})
76
+ def void(authorization, options = {})
77
77
  commit("transactions/#{authorization}/void.xml", '')
78
78
  end
79
79
 
@@ -98,7 +98,7 @@ module ActiveMerchant #:nodoc:
98
98
  #
99
99
  # credit_card - The CreditCard to store
100
100
  # options - A standard ActiveMerchant options hash
101
- def store(credit_card, options={})
101
+ def store(credit_card, options = {})
102
102
  retain = (options.has_key?(:retain) ? options[:retain] : true)
103
103
  save_card(retain, credit_card, options)
104
104
  end
@@ -108,7 +108,7 @@ module ActiveMerchant #:nodoc:
108
108
  #
109
109
  # credit_card - The CreditCard to store
110
110
  # options - A standard ActiveMerchant options hash
111
- def unstore(authorization, options={})
111
+ def unstore(authorization, options = {})
112
112
  commit("payment_methods/#{authorization}/redact.xml", '', :put)
113
113
  end
114
114
 
@@ -117,7 +117,7 @@ module ActiveMerchant #:nodoc:
117
117
  commit("transactions/#{transaction_token}.xml", nil, :get)
118
118
  end
119
119
 
120
- alias_method :status, :find
120
+ alias status find
121
121
 
122
122
  def supports_scrubbing?
123
123
  true
@@ -221,7 +221,7 @@ module ActiveMerchant #:nodoc:
221
221
  # The /cards endpoint does not update other customer parameters.
222
222
  r.process { commit(:post, "customers/#{CGI.escape(options[:customer])}/cards", params, options) }
223
223
 
224
- post[:default_card] = r.params['id'] if options[:set_default] and r.success? and !r.params['id'].blank?
224
+ post[:default_card] = r.params['id'] if options[:set_default] && r.success? && !r.params['id'].blank?
225
225
 
226
226
  r.process { update_customer(options[:customer], post) } if post.count > 0
227
227
  end
@@ -309,8 +309,8 @@ module ActiveMerchant #:nodoc:
309
309
  add_creditcard(post, payment, options, true)
310
310
  add_source_owner(post, payment, options)
311
311
  elsif type == 'three_d_secure'
312
- post[:three_d_secure] = {card: payment}
313
- post[:redirect] = {return_url: options[:redirect_url]}
312
+ post[:three_d_secure] = { card: payment }
313
+ post[:redirect] = { return_url: options[:redirect_url] }
314
314
  end
315
315
  commit(:post, 'sources', post, options)
316
316
  end
@@ -560,11 +560,12 @@ module ActiveMerchant #:nodoc:
560
560
  end
561
561
 
562
562
  def add_connected_account(post, options = {})
563
+ post[:on_behalf_of] = options[:on_behalf_of] if options[:on_behalf_of]
564
+
563
565
  return unless options[:transfer_destination]
564
566
 
565
567
  post[:transfer_data] = { destination: options[:transfer_destination] }
566
568
  post[:transfer_data][:amount] = options[:transfer_amount] if options[:transfer_amount]
567
- post[:on_behalf_of] = options[:on_behalf_of] if options[:on_behalf_of]
568
569
  post[:transfer_group] = options[:transfer_group] if options[:transfer_group]
569
570
  post[:application_fee_amount] = options[:application_fee_amount] if options[:application_fee_amount]
570
571
  end
@@ -617,7 +618,7 @@ module ActiveMerchant #:nodoc:
617
618
  'User-Agent' => "Stripe/v1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
618
619
  'Stripe-Version' => api_version(options),
619
620
  'X-Stripe-Client-User-Agent' => stripe_client_user_agent(options),
620
- 'X-Stripe-Client-User-Metadata' => {ip: options[:ip]}.to_json
621
+ 'X-Stripe-Client-User-Metadata' => { ip: options[:ip] }.to_json
621
622
  }
622
623
  headers['Idempotency-Key'] = idempotency_key if idempotency_key
623
624
  headers['Stripe-Account'] = options[:stripe_account] if options[:stripe_account]
@@ -627,7 +628,7 @@ module ActiveMerchant #:nodoc:
627
628
  def stripe_client_user_agent(options)
628
629
  return user_agent unless options[:application]
629
630
 
630
- JSON.dump(JSON.parse(user_agent).merge!({application: options[:application]}))
631
+ JSON.dump(JSON.parse(user_agent).merge!({ application: options[:application] }))
631
632
  end
632
633
 
633
634
  def api_version(options)
@@ -666,8 +667,7 @@ module ActiveMerchant #:nodoc:
666
667
  avs_result: { code: avs_code },
667
668
  cvv_result: cvc_code,
668
669
  emv_authorization: emv_authorization_from_response(response),
669
- error_code: success ? nil : error_code_from(response)
670
- )
670
+ error_code: success ? nil : error_code_from(response))
671
671
  end
672
672
 
673
673
  def authorization_from(success, url, method, response)
@@ -683,7 +683,7 @@ module ActiveMerchant #:nodoc:
683
683
  end
684
684
 
685
685
  def message_from(success, response)
686
- success ? 'Transaction approved' : response.fetch('error', {'message' => 'No error details'})['message']
686
+ success ? 'Transaction approved' : response.fetch('error', { 'message' => 'No error details' })['message']
687
687
  end
688
688
 
689
689
  def success_from(response, options)
@@ -29,6 +29,7 @@ module ActiveMerchant #:nodoc:
29
29
  add_shipping_address(post, options)
30
30
  setup_future_usage(post, options)
31
31
  add_exemption(post, options)
32
+ request_three_d_secure(post, options)
32
33
 
33
34
  CREATE_INTENT_ATTRIBUTES.each do |attribute|
34
35
  add_whitelisted_attribute(post, options, attribute)
@@ -267,6 +268,14 @@ module ActiveMerchant #:nodoc:
267
268
  post[:payment_method_options][:card][:moto] = true if options[:moto]
268
269
  end
269
270
 
271
+ def request_three_d_secure(post, options = {})
272
+ return unless options[:request_three_d_secure] && %w(any automatic).include?(options[:request_three_d_secure])
273
+
274
+ post[:payment_method_options] ||= {}
275
+ post[:payment_method_options][:card] ||= {}
276
+ post[:payment_method_options][:card][:request_three_d_secure] = options[:request_three_d_secure]
277
+ end
278
+
270
279
  def setup_future_usage(post, options = {})
271
280
  post[:setup_future_usage] = options[:setup_future_usage] if %w(on_session off_session).include?(options[:setup_future_usage])
272
281
  post[:off_session] = options[:off_session] if options[:off_session] && options[:confirm] == true
@@ -109,8 +109,7 @@ module ActiveMerchant #:nodoc:
109
109
  TRANSACTION_APPROVED_MSG :
110
110
  TRANSACTION_DECLINED_MSG,
111
111
  response,
112
- test: test?
113
- )
112
+ test: test?)
114
113
  else
115
114
  build_error_response(message, response)
116
115
  end
@@ -125,7 +124,7 @@ module ActiveMerchant #:nodoc:
125
124
  end
126
125
  end
127
126
 
128
- def call_api(api, params=nil)
127
+ def call_api(api, params = nil)
129
128
  params ||= {}
130
129
  params[:merchant_id] = @options[:login]
131
130
  params[:api_key] = @options[:api_key]
@@ -139,7 +138,7 @@ module ActiveMerchant #:nodoc:
139
138
  (test? ? self.test_url : self.live_url) + api
140
139
  end
141
140
 
142
- def build_error_response(message, params={})
141
+ def build_error_response(message, params = {})
143
142
  Response.new(
144
143
  false,
145
144
  message,
@@ -28,12 +28,12 @@ module ActiveMerchant #:nodoc:
28
28
  'E' => 'R'
29
29
  }
30
30
 
31
- def initialize(options={})
31
+ def initialize(options = {})
32
32
  requires!(options, :merchant_id, :api_key)
33
33
  super
34
34
  end
35
35
 
36
- def purchase(amount, payment_method, options={})
36
+ def purchase(amount, payment_method, options = {})
37
37
  commit(:purchase, amount, options[:currency]) do |doc|
38
38
  add_invoice(doc, 'sale', amount, payment_method, options)
39
39
  add_payment_method(doc, payment_method, options)
@@ -41,7 +41,7 @@ module ActiveMerchant #:nodoc:
41
41
  end
42
42
  end
43
43
 
44
- def authorize(amount, payment_method, options={})
44
+ def authorize(amount, payment_method, options = {})
45
45
  commit(:authorize, amount, options[:currency]) do |doc|
46
46
  add_invoice(doc, 'auth', amount, payment_method, options)
47
47
  add_payment_method(doc, payment_method, options)
@@ -49,26 +49,26 @@ module ActiveMerchant #:nodoc:
49
49
  end
50
50
  end
51
51
 
52
- def capture(amount, authorization, options={})
52
+ def capture(amount, authorization, options = {})
53
53
  commit(:capture) do |doc|
54
54
  add_invoice(doc, 'capture', amount, authorization, options)
55
55
  end
56
56
  end
57
57
 
58
- def void(authorization, options={})
58
+ def void(authorization, options = {})
59
59
  _, amount, currency = split_authorization(authorization)
60
60
  commit(:void) do |doc|
61
61
  add_invoice(doc, 'void', amount.to_i, authorization, options.merge(currency: currency))
62
62
  end
63
63
  end
64
64
 
65
- def refund(amount, authorization, options={})
65
+ def refund(amount, authorization, options = {})
66
66
  commit(:refund) do |doc|
67
67
  add_invoice(doc, 'refund', amount, authorization, options)
68
68
  end
69
69
  end
70
70
 
71
- def verify(credit_card, options={})
71
+ def verify(credit_card, options = {})
72
72
  commit(:verify) do |doc|
73
73
  add_invoice(doc, 'verify', 100, credit_card, options)
74
74
  add_payment_method(doc, credit_card, options)
@@ -162,7 +162,7 @@ module ActiveMerchant #:nodoc:
162
162
  country.code(:alpha2)
163
163
  end
164
164
 
165
- def commit(action, amount=nil, currency=nil)
165
+ def commit(action, amount = nil, currency = nil)
166
166
  currency = default_currency if currency == nil
167
167
  request = build_xml_request { |doc| yield(doc) }
168
168
  response = ssl_post(live_url, request, headers)
@@ -46,7 +46,7 @@ module ActiveMerchant #:nodoc:
46
46
  commit((payment.is_a?(Check) ? :purchase_echeck : :purchase), post)
47
47
  end
48
48
 
49
- def refund(money, authorization, options={})
49
+ def refund(money, authorization, options = {})
50
50
  post = {}
51
51
 
52
52
  transaction_id, payment_type = split_authorization(authorization)
@@ -57,7 +57,7 @@ module ActiveMerchant #:nodoc:
57
57
  commit((payment_type == 'check' ? :refund_echeck : :refund), post)
58
58
  end
59
59
 
60
- def void(authorization, options={})
60
+ def void(authorization, options = {})
61
61
  post = {}
62
62
 
63
63
  transaction_id, = split_authorization(authorization)
@@ -182,12 +182,12 @@ module ActiveMerchant #:nodoc:
182
182
  wallet_sale: 14
183
183
  }
184
184
 
185
- def initialize(options={})
185
+ def initialize(options = {})
186
186
  requires!(options, :gateway_id, :reg_key)
187
187
  super
188
188
  end
189
189
 
190
- def purchase(amount, payment_method, options={})
190
+ def purchase(amount, payment_method, options = {})
191
191
  if credit_card?(payment_method)
192
192
  action = :purchase
193
193
  request = build_xml_transaction_request do |doc|
@@ -216,7 +216,7 @@ module ActiveMerchant #:nodoc:
216
216
  commit(action, request)
217
217
  end
218
218
 
219
- def authorize(amount, payment_method, options={})
219
+ def authorize(amount, payment_method, options = {})
220
220
  if credit_card?(payment_method)
221
221
  request = build_xml_transaction_request do |doc|
222
222
  add_credit_card(doc, payment_method)
@@ -234,7 +234,7 @@ module ActiveMerchant #:nodoc:
234
234
  commit(:authorize, request)
235
235
  end
236
236
 
237
- def capture(amount, authorization, options={})
237
+ def capture(amount, authorization, options = {})
238
238
  transaction_id = split_authorization(authorization)[1]
239
239
  request = build_xml_transaction_request do |doc|
240
240
  add_amount(doc, amount)
@@ -244,7 +244,7 @@ module ActiveMerchant #:nodoc:
244
244
  commit(:capture, request)
245
245
  end
246
246
 
247
- def void(authorization, options={})
247
+ def void(authorization, options = {})
248
248
  action, transaction_id = split_authorization(authorization)
249
249
 
250
250
  request = build_xml_transaction_request do |doc|
@@ -254,7 +254,7 @@ module ActiveMerchant #:nodoc:
254
254
  commit(void_type(action), request)
255
255
  end
256
256
 
257
- def refund(amount, authorization, options={})
257
+ def refund(amount, authorization, options = {})
258
258
  action, transaction_id = split_authorization(authorization)
259
259
 
260
260
  request = build_xml_transaction_request do |doc|
@@ -265,7 +265,7 @@ module ActiveMerchant #:nodoc:
265
265
  commit(refund_type(action), request)
266
266
  end
267
267
 
268
- def credit(amount, payment_method, options={})
268
+ def credit(amount, payment_method, options = {})
269
269
  request = build_xml_transaction_request do |doc|
270
270
  add_pan(doc, payment_method)
271
271
  add_amount(doc, amount)
@@ -274,7 +274,7 @@ module ActiveMerchant #:nodoc:
274
274
  commit(:credit, request)
275
275
  end
276
276
 
277
- def verify(credit_card, options={})
277
+ def verify(credit_card, options = {})
278
278
  request = build_xml_transaction_request do |doc|
279
279
  add_credit_card(doc, credit_card)
280
280
  add_contact(doc, credit_card.name, options)
@@ -283,7 +283,7 @@ module ActiveMerchant #:nodoc:
283
283
  commit(:verify, request)
284
284
  end
285
285
 
286
- def store(payment_method, options={})
286
+ def store(payment_method, options = {})
287
287
  store_customer_request = build_xml_payment_storage_request do |doc|
288
288
  store_customer_details(doc, payment_method.name, options)
289
289
  end
@@ -322,7 +322,7 @@ module ActiveMerchant #:nodoc:
322
322
 
323
323
  private
324
324
 
325
- CURRENCY_CODES = Hash.new { |h, k| raise ArgumentError.new("Unsupported currency: #{k}") }
325
+ CURRENCY_CODES = Hash.new { |_h, k| raise ArgumentError.new("Unsupported currency: #{k}") }
326
326
  CURRENCY_CODES['USD'] = '840'
327
327
 
328
328
  def headers
@@ -462,7 +462,7 @@ module ActiveMerchant #:nodoc:
462
462
  end
463
463
  end
464
464
 
465
- def build_xml_request(wrapper, merchant_product_type=nil)
465
+ def build_xml_request(wrapper, merchant_product_type = nil)
466
466
  Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
467
467
  xml['soapenv'].Envelope('xmlns:soapenv' => SOAPENV_NAMESPACE) do
468
468
  xml['soapenv'].Body do
@@ -485,7 +485,7 @@ module ActiveMerchant #:nodoc:
485
485
  doc.root.to_xml
486
486
  end
487
487
 
488
- def add_merchant(doc, product_type=nil)
488
+ def add_merchant(doc, product_type = nil)
489
489
  doc['v1'].merc do
490
490
  doc['v1'].id @options[:gateway_id]
491
491
  doc['v1'].regKey @options[:reg_key]