activemerchant 1.112.0 → 1.118.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +115 -0
  3. data/README.md +1 -1
  4. data/lib/active_merchant.rb +1 -1
  5. data/lib/active_merchant/billing/avs_result.rb +1 -1
  6. data/lib/active_merchant/billing/compatibility.rb +3 -3
  7. data/lib/active_merchant/billing/credit_card.rb +3 -1
  8. data/lib/active_merchant/billing/credit_card_methods.rb +58 -11
  9. data/lib/active_merchant/billing/gateway.rb +1 -1
  10. data/lib/active_merchant/billing/gateways/adyen.rb +26 -16
  11. data/lib/active_merchant/billing/gateways/allied_wallet.rb +7 -7
  12. data/lib/active_merchant/billing/gateways/authorize_net.rb +50 -18
  13. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -4
  14. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +3 -2
  15. data/lib/active_merchant/billing/gateways/axcessms.rb +8 -9
  16. data/lib/active_merchant/billing/gateways/balanced.rb +5 -4
  17. data/lib/active_merchant/billing/gateways/bambora_apac.rb +8 -8
  18. data/lib/active_merchant/billing/gateways/bank_frick.rb +8 -8
  19. data/lib/active_merchant/billing/gateways/banwire.rb +1 -1
  20. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +6 -4
  21. data/lib/active_merchant/billing/gateways/beanstream.rb +3 -3
  22. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +4 -5
  23. data/lib/active_merchant/billing/gateways/blue_pay.rb +2 -3
  24. data/lib/active_merchant/billing/gateways/blue_snap.rb +85 -23
  25. data/lib/active_merchant/billing/gateways/bogus.rb +19 -19
  26. data/lib/active_merchant/billing/gateways/borgun.rb +12 -12
  27. data/lib/active_merchant/billing/gateways/bpoint.rb +8 -8
  28. data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
  29. data/lib/active_merchant/billing/gateways/braintree_blue.rb +20 -17
  30. data/lib/active_merchant/billing/gateways/bridge_pay.rb +7 -7
  31. data/lib/active_merchant/billing/gateways/cams.rb +8 -8
  32. data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
  33. data/lib/active_merchant/billing/gateways/card_save.rb +1 -1
  34. data/lib/active_merchant/billing/gateways/card_stream.rb +2 -2
  35. data/lib/active_merchant/billing/gateways/cardknox.rb +8 -8
  36. data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
  37. data/lib/active_merchant/billing/gateways/cecabank.rb +5 -5
  38. data/lib/active_merchant/billing/gateways/cenpos.rb +11 -11
  39. data/lib/active_merchant/billing/gateways/checkout.rb +2 -2
  40. data/lib/active_merchant/billing/gateways/checkout_v2.rb +18 -21
  41. data/lib/active_merchant/billing/gateways/clearhaus.rb +7 -7
  42. data/lib/active_merchant/billing/gateways/commercegate.rb +1 -1
  43. data/lib/active_merchant/billing/gateways/conekta.rb +2 -2
  44. data/lib/active_merchant/billing/gateways/creditcall.rb +10 -10
  45. data/lib/active_merchant/billing/gateways/credorax.rb +32 -15
  46. data/lib/active_merchant/billing/gateways/ct_payment.rb +10 -10
  47. data/lib/active_merchant/billing/gateways/culqi.rb +10 -10
  48. data/lib/active_merchant/billing/gateways/cyber_source.rb +61 -37
  49. data/lib/active_merchant/billing/gateways/d_local.rb +11 -11
  50. data/lib/active_merchant/billing/gateways/data_cash.rb +2 -3
  51. data/lib/active_merchant/billing/gateways/decidir.rb +24 -9
  52. data/lib/active_merchant/billing/gateways/dibs.rb +8 -8
  53. data/lib/active_merchant/billing/gateways/digitzs.rb +6 -6
  54. data/lib/active_merchant/billing/gateways/ebanx.rb +9 -9
  55. data/lib/active_merchant/billing/gateways/efsnet.rb +3 -4
  56. data/lib/active_merchant/billing/gateways/elavon.rb +279 -227
  57. data/lib/active_merchant/billing/gateways/element.rb +8 -8
  58. data/lib/active_merchant/billing/gateways/evo_ca.rb +5 -6
  59. data/lib/active_merchant/billing/gateways/eway.rb +3 -4
  60. data/lib/active_merchant/billing/gateways/eway_managed.rb +6 -7
  61. data/lib/active_merchant/billing/gateways/eway_rapid.rb +8 -8
  62. data/lib/active_merchant/billing/gateways/exact.rb +8 -9
  63. data/lib/active_merchant/billing/gateways/ezic.rb +8 -8
  64. data/lib/active_merchant/billing/gateways/fat_zebra.rb +4 -4
  65. data/lib/active_merchant/billing/gateways/federated_canada.rb +2 -3
  66. data/lib/active_merchant/billing/gateways/first_giving.rb +1 -1
  67. data/lib/active_merchant/billing/gateways/first_pay.rb +6 -6
  68. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +7 -7
  69. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +21 -10
  70. data/lib/active_merchant/billing/gateways/flo2cash.rb +9 -9
  71. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
  72. data/lib/active_merchant/billing/gateways/forte.rb +14 -8
  73. data/lib/active_merchant/billing/gateways/global_collect.rb +29 -10
  74. data/lib/active_merchant/billing/gateways/global_transport.rb +7 -7
  75. data/lib/active_merchant/billing/gateways/hdfc.rb +10 -10
  76. data/lib/active_merchant/billing/gateways/hps.rb +17 -14
  77. data/lib/active_merchant/billing/gateways/iats_payments.rb +9 -4
  78. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
  79. data/lib/active_merchant/billing/gateways/inspire.rb +3 -4
  80. data/lib/active_merchant/billing/gateways/instapay.rb +1 -2
  81. data/lib/active_merchant/billing/gateways/ipp.rb +7 -7
  82. data/lib/active_merchant/billing/gateways/iridium.rb +16 -17
  83. data/lib/active_merchant/billing/gateways/iveri.rb +7 -7
  84. data/lib/active_merchant/billing/gateways/ixopay.rb +7 -7
  85. data/lib/active_merchant/billing/gateways/jetpay.rb +1 -2
  86. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +4 -5
  87. data/lib/active_merchant/billing/gateways/kushki.rb +6 -6
  88. data/lib/active_merchant/billing/gateways/latitude19.rb +14 -14
  89. data/lib/active_merchant/billing/gateways/linkpoint.rb +5 -6
  90. data/lib/active_merchant/billing/gateways/litle.rb +28 -12
  91. data/lib/active_merchant/billing/gateways/mastercard.rb +12 -12
  92. data/lib/active_merchant/billing/gateways/mercado_pago.rb +8 -8
  93. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +1 -2
  94. data/lib/active_merchant/billing/gateways/merchant_one.rb +1 -1
  95. data/lib/active_merchant/billing/gateways/merchant_partners.rb +10 -10
  96. data/lib/active_merchant/billing/gateways/merchant_ware.rb +5 -7
  97. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +4 -6
  98. data/lib/active_merchant/billing/gateways/mercury.rb +4 -4
  99. data/lib/active_merchant/billing/gateways/metrics_global.rb +4 -5
  100. data/lib/active_merchant/billing/gateways/micropayment.rb +8 -8
  101. data/lib/active_merchant/billing/gateways/migs.rb +3 -4
  102. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +2 -4
  103. data/lib/active_merchant/billing/gateways/monei.rb +7 -7
  104. data/lib/active_merchant/billing/gateways/moneris.rb +4 -3
  105. data/lib/active_merchant/billing/gateways/money_movers.rb +2 -3
  106. data/lib/active_merchant/billing/gateways/mundipagg.rb +37 -10
  107. data/lib/active_merchant/billing/gateways/nab_transact.rb +2 -4
  108. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +7 -7
  109. data/lib/active_merchant/billing/gateways/net_registry.rb +1 -2
  110. data/lib/active_merchant/billing/gateways/netaxept.rb +6 -6
  111. data/lib/active_merchant/billing/gateways/netbanx.rb +12 -10
  112. data/lib/active_merchant/billing/gateways/netbilling.rb +4 -5
  113. data/lib/active_merchant/billing/gateways/network_merchants.rb +2 -3
  114. data/lib/active_merchant/billing/gateways/nmi.rb +21 -7
  115. data/lib/active_merchant/billing/gateways/ogone.rb +3 -3
  116. data/lib/active_merchant/billing/gateways/omise.rb +13 -13
  117. data/lib/active_merchant/billing/gateways/openpay.rb +4 -5
  118. data/lib/active_merchant/billing/gateways/opp.rb +12 -12
  119. data/lib/active_merchant/billing/gateways/optimal_payment.rb +3 -4
  120. data/lib/active_merchant/billing/gateways/orbital.rb +175 -81
  121. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +3 -4
  122. data/lib/active_merchant/billing/gateways/pagarme.rb +9 -9
  123. data/lib/active_merchant/billing/gateways/pago_facil.rb +2 -2
  124. data/lib/active_merchant/billing/gateways/pay_conex.rb +8 -8
  125. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +6 -7
  126. data/lib/active_merchant/billing/gateways/pay_hub.rb +7 -8
  127. data/lib/active_merchant/billing/gateways/pay_junction.rb +4 -5
  128. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +9 -9
  129. data/lib/active_merchant/billing/gateways/pay_secure.rb +2 -3
  130. data/lib/active_merchant/billing/gateways/paybox_direct.rb +23 -1
  131. data/lib/active_merchant/billing/gateways/payeezy.rb +35 -17
  132. data/lib/active_merchant/billing/gateways/payex.rb +11 -12
  133. data/lib/active_merchant/billing/gateways/payflow.rb +4 -1
  134. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -1
  135. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +1 -1
  136. data/lib/active_merchant/billing/gateways/payment_express.rb +1 -2
  137. data/lib/active_merchant/billing/gateways/paymentez.rb +26 -6
  138. data/lib/active_merchant/billing/gateways/paymill.rb +10 -10
  139. data/lib/active_merchant/billing/gateways/paypal.rb +10 -2
  140. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +1 -0
  141. data/lib/active_merchant/billing/gateways/paypal_express.rb +1 -1
  142. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
  143. data/lib/active_merchant/billing/gateways/payscout.rb +1 -2
  144. data/lib/active_merchant/billing/gateways/paystation.rb +3 -4
  145. data/lib/active_merchant/billing/gateways/payu_in.rb +3 -3
  146. data/lib/active_merchant/billing/gateways/payu_latam.rb +17 -10
  147. data/lib/active_merchant/billing/gateways/payway.rb +8 -9
  148. data/lib/active_merchant/billing/gateways/pin.rb +11 -0
  149. data/lib/active_merchant/billing/gateways/plugnpay.rb +2 -3
  150. data/lib/active_merchant/billing/gateways/pro_pay.rb +8 -8
  151. data/lib/active_merchant/billing/gateways/psigate.rb +3 -4
  152. data/lib/active_merchant/billing/gateways/psl_card.rb +1 -2
  153. data/lib/active_merchant/billing/gateways/qbms.rb +4 -5
  154. data/lib/active_merchant/billing/gateways/quantum.rb +1 -2
  155. data/lib/active_merchant/billing/gateways/quickbooks.rb +4 -3
  156. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +3 -4
  157. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -2
  158. data/lib/active_merchant/billing/gateways/qvalent.rb +9 -9
  159. data/lib/active_merchant/billing/gateways/realex.rb +1 -1
  160. data/lib/active_merchant/billing/gateways/redsys.rb +87 -7
  161. data/lib/active_merchant/billing/gateways/s5.rb +7 -7
  162. data/lib/active_merchant/billing/gateways/safe_charge.rb +40 -14
  163. data/lib/active_merchant/billing/gateways/sage.rb +3 -5
  164. data/lib/active_merchant/billing/gateways/sage_pay.rb +6 -7
  165. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
  166. data/lib/active_merchant/billing/gateways/secure_net.rb +1 -2
  167. data/lib/active_merchant/billing/gateways/secure_pay.rb +3 -4
  168. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +2 -4
  169. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -2
  170. data/lib/active_merchant/billing/gateways/securion_pay.rb +5 -6
  171. data/lib/active_merchant/billing/gateways/skip_jack.rb +3 -4
  172. data/lib/active_merchant/billing/gateways/smart_ps.rb +5 -6
  173. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +7 -7
  174. data/lib/active_merchant/billing/gateways/spreedly_core.rb +6 -6
  175. data/lib/active_merchant/billing/gateways/stripe.rb +12 -12
  176. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +30 -0
  177. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +3 -4
  178. data/lib/active_merchant/billing/gateways/telr.rb +9 -9
  179. data/lib/active_merchant/billing/gateways/trans_first.rb +3 -3
  180. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +14 -14
  181. data/lib/active_merchant/billing/gateways/transact_pro.rb +9 -9
  182. data/lib/active_merchant/billing/gateways/trust_commerce.rb +8 -9
  183. data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -1
  184. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +36 -36
  185. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +4 -5
  186. data/lib/active_merchant/billing/gateways/vanco.rb +3 -3
  187. data/lib/active_merchant/billing/gateways/verifi.rb +1 -2
  188. data/lib/active_merchant/billing/gateways/viaklix.rb +1 -2
  189. data/lib/active_merchant/billing/gateways/visanet_peru.rb +10 -10
  190. data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
  191. data/lib/active_merchant/billing/gateways/wepay.rb +3 -2
  192. data/lib/active_merchant/billing/gateways/wirecard.rb +1 -2
  193. data/lib/active_merchant/billing/gateways/worldpay.rb +18 -10
  194. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +14 -16
  195. data/lib/active_merchant/billing/gateways/worldpay_us.rb +9 -9
  196. data/lib/active_merchant/billing/response.rb +3 -2
  197. data/lib/active_merchant/country.rb +1 -1
  198. data/lib/active_merchant/network_connection_retries.rb +2 -2
  199. data/lib/active_merchant/post_data.rb +1 -1
  200. data/lib/active_merchant/posts_data.rb +1 -1
  201. data/lib/active_merchant/version.rb +1 -1
  202. data/lib/support/ssl_verify.rb +2 -2
  203. data/lib/support/ssl_version.rb +2 -2
  204. metadata +2 -2
@@ -77,7 +77,7 @@ module ActiveMerchant #:nodoc:
77
77
  commit(:credit, post, source)
78
78
  end
79
79
 
80
- def refund(money, reference, options={})
80
+ def refund(money, reference, options = {})
81
81
  post = {}
82
82
  add_reference(post, reference)
83
83
  add_transaction_data(post, money, options)
@@ -264,8 +264,7 @@ module ActiveMerchant #:nodoc:
264
264
  test: test?,
265
265
  authorization: authorization_from(response, source),
266
266
  avs_result: { code: response[:avs_result] },
267
- cvv_result: response[:cvv_result]
268
- )
267
+ cvv_result: response[:cvv_result])
269
268
  end
270
269
 
271
270
  def url(params, source)
@@ -382,8 +381,7 @@ module ActiveMerchant #:nodoc:
382
381
  end
383
382
 
384
383
  Response.new(success, message, response,
385
- authorization: response[:guid]
386
- )
384
+ authorization: response[:guid])
387
385
  end
388
386
 
389
387
  ENVELOPE_NAMESPACES = {
@@ -162,7 +162,7 @@ module ActiveMerchant #:nodoc:
162
162
  commit(:unstore, post)
163
163
  end
164
164
 
165
- def verify(credit_card, options={})
165
+ def verify(credit_card, options = {})
166
166
  MultiResponse.run(:use_first_response) do |r|
167
167
  r.process { authorize(100, credit_card, options) }
168
168
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -248,7 +248,7 @@ module ActiveMerchant #:nodoc:
248
248
  add_pair(post, :BillingAddress1, truncate(billing_address[:address1], 100))
249
249
  add_pair(post, :BillingAddress2, truncate(billing_address[:address2], 100))
250
250
  add_pair(post, :BillingCity, truncate(billing_address[:city], 40))
251
- add_pair(post, :BillingState, truncate(billing_address[:state], 2)) if is_usa(billing_address[:country])
251
+ add_pair(post, :BillingState, truncate(billing_address[:state], 2)) if usa?(billing_address[:country])
252
252
  add_pair(post, :BillingCountry, truncate(billing_address[:country], 2))
253
253
  add_pair(post, :BillingPhone, sanitize_phone(billing_address[:phone]))
254
254
  add_pair(post, :BillingPostCode, truncate(billing_address[:zip], 10))
@@ -261,7 +261,7 @@ module ActiveMerchant #:nodoc:
261
261
  add_pair(post, :DeliveryAddress1, truncate(shipping_address[:address1], 100))
262
262
  add_pair(post, :DeliveryAddress2, truncate(shipping_address[:address2], 100))
263
263
  add_pair(post, :DeliveryCity, truncate(shipping_address[:city], 40))
264
- add_pair(post, :DeliveryState, truncate(shipping_address[:state], 2)) if is_usa(shipping_address[:country])
264
+ add_pair(post, :DeliveryState, truncate(shipping_address[:state], 2)) if usa?(shipping_address[:country])
265
265
  add_pair(post, :DeliveryCountry, truncate(shipping_address[:country], 2))
266
266
  add_pair(post, :DeliveryPhone, sanitize_phone(shipping_address[:phone]))
267
267
  add_pair(post, :DeliveryPostCode, truncate(shipping_address[:zip], 10))
@@ -317,7 +317,7 @@ module ActiveMerchant #:nodoc:
317
317
  truncate(cleansed, 20)
318
318
  end
319
319
 
320
- def is_usa(country)
320
+ def usa?(country)
321
321
  truncate(country, 2) == 'US'
322
322
  end
323
323
 
@@ -351,10 +351,9 @@ module ActiveMerchant #:nodoc:
351
351
  authorization: authorization_from(response, parameters, action),
352
352
  avs_result: {
353
353
  street_match: AVS_CODE[response['AddressResult']],
354
- postal_match: AVS_CODE[response['PostCodeResult']],
354
+ postal_match: AVS_CODE[response['PostCodeResult']]
355
355
  },
356
- cvv_result: CVV_CODE[response['CV2Result']]
357
- )
356
+ cvv_result: CVV_CODE[response['CV2Result']])
358
357
  end
359
358
 
360
359
  def authorization_from(response, params, action)
@@ -122,8 +122,7 @@ module ActiveMerchant #:nodoc:
122
122
  response = parse(ssl_post(self.live_url, parameters.to_post_data) || '')
123
123
  Response.new(successful?(response), message_from(response), response,
124
124
  test: test?,
125
- authorization: response['refcode']
126
- )
125
+ authorization: response['refcode'])
127
126
  end
128
127
 
129
128
  def successful?(response)
@@ -83,8 +83,7 @@ module ActiveMerchant #:nodoc:
83
83
  test: test?,
84
84
  authorization: build_authorization(response),
85
85
  avs_result: { code: response[:avs_result_code] },
86
- cvv_result: response[:card_code_response_code]
87
- )
86
+ cvv_result: response[:card_code_response_code])
88
87
  end
89
88
 
90
89
  def build_request(request)
@@ -61,8 +61,7 @@ module ActiveMerchant #:nodoc:
61
61
  authorization: response[:transaction_id],
62
62
  fraud_review: fraud_review?(response),
63
63
  avs_result: { code: response[:avs_result_code] },
64
- cvv_result: response[:card_code]
65
- )
64
+ cvv_result: response[:card_code])
66
65
  end
67
66
 
68
67
  def success?(response)
@@ -115,7 +114,7 @@ module ActiveMerchant #:nodoc:
115
114
  post[:description] = options[:description]
116
115
  end
117
116
 
118
- def add_creditcard(post, creditcard, options={})
117
+ def add_creditcard(post, creditcard, options = {})
119
118
  post[:card_num] = creditcard.number
120
119
  post[:card_code] = creditcard.verification_value if creditcard.verification_value?
121
120
  post[:exp_date] = expdate(creditcard)
@@ -123,7 +122,7 @@ module ActiveMerchant #:nodoc:
123
122
  post[:last_name] = creditcard.last_name
124
123
  end
125
124
 
126
- def add_payment_source(params, source, options={})
125
+ def add_payment_source(params, source, options = {})
127
126
  add_creditcard(params, source, options)
128
127
  end
129
128
 
@@ -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 = {})
@@ -51,7 +51,7 @@ module ActiveMerchant #:nodoc:
51
51
  'W' => '9-digit zip/postal code matches billing information, street address does not',
52
52
  'X' => 'Street address and 9-digit zip/postal code matches billing information',
53
53
  'Y' => 'Street address and 5-digit zip/postal code matches billing information',
54
- 'Z' => '5-digit zip/postal code matches billing information, street address does not',
54
+ 'Z' => '5-digit zip/postal code matches billing information, street address does not'
55
55
  }
56
56
 
57
57
  CHANGE_STATUS_ERROR_MESSAGES = {
@@ -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
@@ -28,7 +28,7 @@ module ActiveMerchant #:nodoc:
28
28
  self.supported_countries = %w(AT AU BE BG BR CA CH CY CZ DE DK EE ES FI FR GB GR HK IE IT JP LT LU LV MT MX NL NO NZ PL PT RO SE SG SI SK US)
29
29
  self.default_currency = 'USD'
30
30
  self.money_format = :cents
31
- self.supported_cardtypes = %i[visa master american_express discover jcb diners_club maestro]
31
+ self.supported_cardtypes = %i[visa master american_express discover jcb diners_club maestro unionpay]
32
32
  self.currencies_without_fractions = %w(BIF CLP DJF GNF JPY KMF KRW MGA PYG RWF VND VUV XAF XOF XPF UGX)
33
33
 
34
34
  self.homepage_url = 'https://stripe.com/'
@@ -53,7 +53,7 @@ module ActiveMerchant #:nodoc:
53
53
 
54
54
  BANK_ACCOUNT_HOLDER_TYPE_MAPPING = {
55
55
  'personal' => 'individual',
56
- 'business' => 'company',
56
+ 'business' => 'company'
57
57
  }
58
58
 
59
59
  MINIMUM_AUTHORIZE_AMOUNTS = {
@@ -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)
@@ -755,7 +755,7 @@ module ActiveMerchant #:nodoc:
755
755
  currency: 'usd',
756
756
  routing_number: bank_account.routing_number,
757
757
  name: bank_account.name,
758
- account_holder_type: account_holder_type,
758
+ account_holder_type: account_holder_type
759
759
  }
760
760
  }
761
761