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
@@ -10,13 +10,13 @@ module ActiveMerchant #:nodoc:
10
10
  self.display_name = 'USA ePay'
11
11
 
12
12
  TRANSACTIONS = {
13
- :authorization => 'cc:authonly',
14
- :purchase => 'cc:sale',
15
- :capture => 'cc:capture',
16
- :refund => 'cc:refund',
17
- :void => 'cc:void',
18
- :void_release => 'cc:void:release',
19
- :check_purchase => 'check:sale'
13
+ authorization: 'cc:authonly',
14
+ purchase: 'cc:sale',
15
+ capture: 'cc:capture',
16
+ refund: 'cc:refund',
17
+ void: 'cc:void',
18
+ void_release: 'cc:void:release',
19
+ check_purchase: 'check:sale'
20
20
  }
21
21
 
22
22
  STANDARD_ERROR_CODE_MAPPING = {
@@ -82,7 +82,7 @@ module ActiveMerchant #:nodoc:
82
82
  end
83
83
 
84
84
  def capture(money, authorization, options = {})
85
- post = { :refNum => authorization }
85
+ post = { refNum: authorization }
86
86
 
87
87
  add_amount(post, money)
88
88
  add_test_mode(post, options)
@@ -90,7 +90,7 @@ module ActiveMerchant #:nodoc:
90
90
  end
91
91
 
92
92
  def refund(money, authorization, options = {})
93
- post = { :refNum => authorization }
93
+ post = { refNum: authorization }
94
94
 
95
95
  add_amount(post, money)
96
96
  add_test_mode(post, options)
@@ -107,7 +107,7 @@ module ActiveMerchant #:nodoc:
107
107
  # Pass `no_release: true` to keep the void from immediately settling
108
108
  def void(authorization, options = {})
109
109
  command = (options[:no_release] ? :void : :void_release)
110
- post = { :refNum => authorization }
110
+ post = { refNum: authorization }
111
111
  add_test_mode(post, options)
112
112
  commit(command, post)
113
113
  end
@@ -296,20 +296,20 @@ module ActiveMerchant #:nodoc:
296
296
  end
297
297
 
298
298
  {
299
- :status => fields['UMstatus'],
300
- :auth_code => fields['UMauthCode'],
301
- :ref_num => fields['UMrefNum'],
302
- :batch => fields['UMbatch'],
303
- :avs_result => fields['UMavsResult'],
304
- :avs_result_code => fields['UMavsResultCode'],
305
- :cvv2_result => fields['UMcvv2Result'],
306
- :cvv2_result_code => fields['UMcvv2ResultCode'],
307
- :vpas_result_code => fields['UMvpasResultCode'],
308
- :result => fields['UMresult'],
309
- :error => fields['UMerror'],
310
- :error_code => fields['UMerrorcode'],
311
- :acs_url => fields['UMacsurl'],
312
- :payload => fields['UMpayload']
299
+ status: fields['UMstatus'],
300
+ auth_code: fields['UMauthCode'],
301
+ ref_num: fields['UMrefNum'],
302
+ batch: fields['UMbatch'],
303
+ avs_result: fields['UMavsResult'],
304
+ avs_result_code: fields['UMavsResultCode'],
305
+ cvv2_result: fields['UMcvv2Result'],
306
+ cvv2_result_code: fields['UMcvv2ResultCode'],
307
+ vpas_result_code: fields['UMvpasResultCode'],
308
+ result: fields['UMresult'],
309
+ error: fields['UMerror'],
310
+ error_code: fields['UMerrorcode'],
311
+ acs_url: fields['UMacsurl'],
312
+ payload: fields['UMpayload']
313
313
  }.delete_if { |k, v| v.nil? }
314
314
  end
315
315
 
@@ -320,11 +320,11 @@ module ActiveMerchant #:nodoc:
320
320
  error_code = nil
321
321
  error_code = (STANDARD_ERROR_CODE_MAPPING[response[:error_code]] || STANDARD_ERROR_CODE[:processing_error]) unless approved
322
322
  Response.new(approved, message_from(response), response,
323
- :test => test?,
324
- :authorization => response[:ref_num],
325
- :cvv_result => response[:cvv2_result_code],
326
- :avs_result => { :code => response[:avs_result_code] },
327
- :error_code => error_code
323
+ test: test?,
324
+ authorization: response[:ref_num],
325
+ cvv_result: response[:cvv2_result_code],
326
+ avs_result: { code: response[:avs_result_code] },
327
+ error_code: error_code
328
328
  )
329
329
  end
330
330
 
@@ -50,12 +50,12 @@ module ActiveMerchant #:nodoc:
50
50
  SUCCESS = 1
51
51
 
52
52
  TRANSACTIONS = {
53
- :authorization => 'auth',
54
- :purchase => 'sale',
55
- :capture => 'capture',
56
- :void => 'void',
57
- :credit => 'credit',
58
- :refund => 'refund'
53
+ authorization: 'auth',
54
+ purchase: 'sale',
55
+ capture: 'capture',
56
+ void: 'void',
57
+ credit: 'credit',
58
+ refund: 'refund'
59
59
  }
60
60
 
61
61
  self.supported_countries = ['US']
@@ -195,10 +195,10 @@ module ActiveMerchant #:nodoc:
195
195
  response = parse(ssl_post(self.live_url, post_data(trx_type, post)))
196
196
 
197
197
  Response.new(response[:response].to_i == SUCCESS, message_from(response), response,
198
- :test => test?,
199
- :authorization => response[:transactionid],
200
- :avs_result => { :code => response[:avsresponse] },
201
- :cvv_result => response[:cvvresponse]
198
+ test: test?,
199
+ authorization: response[:transactionid],
200
+ avs_result: { code: response[:avsresponse] },
201
+ cvv_result: response[:cvvresponse]
202
202
  )
203
203
  end
204
204
 
@@ -8,8 +8,8 @@ module ActiveMerchant #:nodoc:
8
8
  self.delimiter = "\r\n"
9
9
 
10
10
  self.actions = {
11
- :purchase => 'SALE',
12
- :credit => 'CREDIT'
11
+ purchase: 'SALE',
12
+ credit: 'CREDIT'
13
13
  }
14
14
 
15
15
  APPROVED = '0'
@@ -137,10 +137,10 @@ module ActiveMerchant #:nodoc:
137
137
  response = parse(ssl_post(test? ? self.test_url : self.live_url, post_data(parameters)))
138
138
 
139
139
  Response.new(response['result'] == APPROVED, message_from(response), response,
140
- :test => @options[:test] || test?,
141
- :authorization => authorization_from(response),
142
- :avs_result => { :code => response['avs_response'] },
143
- :cvv_result => response['cvv2_response']
140
+ test: @options[:test] || test?,
141
+ authorization: authorization_from(response),
142
+ avs_result: { code: response['avs_response'] },
143
+ cvv_result: response['cvv2_response']
144
144
  )
145
145
  end
146
146
 
@@ -155,9 +155,9 @@ module ActiveMerchant #:nodoc:
155
155
  success_from(response),
156
156
  message_from(response, options, action),
157
157
  response,
158
- :test => test?,
159
- :authorization => authorization_from(params, response, options),
160
- :error_code => response['errorCode']
158
+ test: test?,
159
+ authorization: authorization_from(params, response, options),
160
+ error_code: response['errorCode']
161
161
  )
162
162
  end
163
163
 
@@ -230,9 +230,9 @@ module ActiveMerchant #:nodoc:
230
230
  false,
231
231
  message_from(response, options, action),
232
232
  response,
233
- :test => test?,
234
- :authorization => response['transactionUUID'],
235
- :error_code => response['errorCode']
233
+ test: test?,
234
+ authorization: response['transactionUUID'],
235
+ error_code: response['errorCode']
236
236
  )
237
237
  end
238
238
 
@@ -53,7 +53,7 @@ module ActiveMerchant #:nodoc:
53
53
 
54
54
  return r unless options[:set_default] and r.success? and !r.params['id'].blank?
55
55
 
56
- r.process { update_customer(options[:customer], :default_card => r.params['id']) }
56
+ r.process { update_customer(options[:customer], default_card: r.params['id']) }
57
57
  end
58
58
  else
59
59
  commit(:post, 'customers', post, options)
@@ -89,7 +89,7 @@ module ActiveMerchant #:nodoc:
89
89
  'Authorization' => 'Basic ' + Base64.encode64(@api_key.to_s + ':').strip,
90
90
  'User-Agent' => "Webpay/v1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
91
91
  'X-Webpay-Client-User-Agent' => user_agent,
92
- 'X-Webpay-Client-User-Metadata' => {:ip => options[:ip]}.to_json
92
+ 'X-Webpay-Client-User-Metadata' => {ip: options[:ip]}.to_json
93
93
  }
94
94
  end
95
95
  end
@@ -180,10 +180,10 @@ module ActiveMerchant #:nodoc:
180
180
  authorization = response[:GuWID]
181
181
 
182
182
  Response.new(success, message, response,
183
- :test => test?,
184
- :authorization => authorization,
185
- :avs_result => { :code => avs_code(response, options) },
186
- :cvv_result => response[:CVCResponseCode]
183
+ test: test?,
184
+ authorization: authorization,
185
+ avs_result: { code: avs_code(response, options) },
186
+ cvv_result: response[:CVCResponseCode]
187
187
  )
188
188
  rescue ResponseError => e
189
189
  if e.response.code == '401'
@@ -197,7 +197,7 @@ module ActiveMerchant #:nodoc:
197
197
  def build_request(action, money, options)
198
198
  options = prepare_options_hash(options)
199
199
  options[:action] = action
200
- xml = Builder::XmlMarkup.new :indent => 2
200
+ xml = Builder::XmlMarkup.new indent: 2
201
201
  xml.instruct!
202
202
  xml.tag! 'WIRECARD_BXML' do
203
203
  xml.tag! 'W_REQUEST' do
@@ -391,7 +391,7 @@ module ActiveMerchant #:nodoc:
391
391
  string << error[:Message] if error[:Message]
392
392
  error[:Advice].each_with_index do |advice, index|
393
393
  string << ' (' if index == 0
394
- string << "#{index+1}. #{advice}"
394
+ string << "#{index + 1}. #{advice}"
395
395
  string << ' and ' if index < error[:Advice].size - 1
396
396
  string << ')' if index == error[:Advice].size - 1
397
397
  end
@@ -57,7 +57,7 @@ module ActiveMerchant #:nodoc:
57
57
  def purchase(money, payment_method, options = {})
58
58
  MultiResponse.run do |r|
59
59
  r.process { authorize(money, payment_method, options) }
60
- r.process { capture(money, r.authorization, options.merge(:authorization_validated => true)) }
60
+ r.process { capture(money, r.authorization, options.merge(authorization_validated: true)) }
61
61
  end
62
62
  end
63
63
 
@@ -73,7 +73,7 @@ module ActiveMerchant #:nodoc:
73
73
  r.process { inquire_request(authorization, options, 'AUTHORISED') } unless options[:authorization_validated]
74
74
  if r.params
75
75
  authorization_currency = r.params['amount_currency_code']
76
- options = options.merge(:currency => authorization_currency) if authorization_currency.present?
76
+ options = options.merge(currency: authorization_currency) if authorization_currency.present?
77
77
  end
78
78
  r.process { capture_request(money, authorization, options) }
79
79
  end
@@ -94,10 +94,12 @@ module ActiveMerchant #:nodoc:
94
94
  r.process { refund_request(money, authorization, options) }
95
95
  end
96
96
 
97
- return response if response.success?
98
- return response unless options[:force_full_refund_if_unsettled]
99
-
100
- void(authorization, options) if response.params['last_event'] == 'AUTHORISED'
97
+ if !response.success? && options[:force_full_refund_if_unsettled] &&
98
+ response.params['last_event'] == 'AUTHORISED'
99
+ void(authorization, options)
100
+ else
101
+ response
102
+ end
101
103
  end
102
104
 
103
105
  # Credits only function on a Merchant ID/login/profile flagged for Payouts
@@ -106,13 +108,13 @@ module ActiveMerchant #:nodoc:
106
108
  # merchant ID.
107
109
  def credit(money, payment_method, options = {})
108
110
  payment_details = payment_details_from(payment_method)
109
- credit_request(money, payment_method, payment_details.merge(:credit => true, **options))
111
+ credit_request(money, payment_method, payment_details.merge(credit: true, **options))
110
112
  end
111
113
 
112
114
  def verify(payment_method, options={})
113
115
  MultiResponse.run(:use_first_response) do |r|
114
116
  r.process { authorize(100, payment_method, options) }
115
- r.process(:ignore_result) { void(r.authorization, options.merge(:authorization_validated => true)) }
117
+ r.process(:ignore_result) { void(r.authorization, options.merge(authorization_validated: true)) }
116
118
  end
117
119
  end
118
120
 
@@ -163,8 +165,8 @@ module ActiveMerchant #:nodoc:
163
165
  end
164
166
 
165
167
  def build_request
166
- xml = Builder::XmlMarkup.new :indent => 2
167
- xml.instruct! :xml, :encoding => 'UTF-8'
168
+ xml = Builder::XmlMarkup.new indent: 2
169
+ xml.instruct! :xml, encoding: 'UTF-8'
168
170
  xml.declare! :DOCTYPE, :paymentService, :PUBLIC, '-//WorldPay//DTD WorldPay PaymentService v1//EN', 'http://dtd.worldpay.com/paymentService_v1.dtd'
169
171
  xml.paymentService 'version' => '1.4', 'merchantCode' => @options[:login] do
170
172
  yield xml
@@ -222,7 +224,7 @@ module ActiveMerchant #:nodoc:
222
224
  build_order_modify_request(authorization) do |xml|
223
225
  xml.capture do
224
226
  time = Time.now
225
- xml.date 'dayOfMonth' => time.day, 'month' => time.month, 'year'=> time.year
227
+ xml.date 'dayOfMonth' => time.day, 'month' => time.month, 'year' => time.year
226
228
  add_amount(xml, money, options)
227
229
  end
228
230
  end
@@ -235,7 +237,7 @@ module ActiveMerchant #:nodoc:
235
237
  def build_refund_request(money, authorization, options)
236
238
  build_order_modify_request(authorization) do |xml|
237
239
  xml.refund do
238
- add_amount(xml, money, options.merge(:debit_credit_indicator => 'credit'))
240
+ add_amount(xml, money, options.merge(debit_credit_indicator: 'credit'))
239
241
  end
240
242
  end
241
243
  end
@@ -544,7 +546,7 @@ module ActiveMerchant #:nodoc:
544
546
  xml = xml.strip.gsub(/\&/, '&amp;')
545
547
  doc = Nokogiri::XML(xml, &:strict)
546
548
  doc.remove_namespaces!
547
- resp_params = {:action => action}
549
+ resp_params = {action: action}
548
550
 
549
551
  parse_elements(doc.root, resp_params)
550
552
  resp_params
@@ -580,7 +582,7 @@ module ActiveMerchant #:nodoc:
580
582
  xml = ssl_post(url, request, headers(options))
581
583
  raw = parse(action, xml)
582
584
  if options[:execute_threed]
583
- raw[:cookie] = @cookie
585
+ raw[:cookie] = @cookie if defined?(@cookie)
584
586
  raw[:session_id] = options[:session_id]
585
587
  raw[:is3DSOrder] = true
586
588
  end
@@ -591,17 +593,17 @@ module ActiveMerchant #:nodoc:
591
593
  success,
592
594
  message,
593
595
  raw,
594
- :authorization => authorization_from(action, raw, options),
595
- :error_code => error_code_from(success, raw),
596
- :test => test?,
597
- :avs_result => AVSResult.new(code: AVS_CODE_MAP[raw[:avs_result_code_description]]),
598
- :cvv_result => CVVResult.new(CVC_CODE_MAP[raw[:cvc_result_code_description]])
596
+ authorization: authorization_from(action, raw, options),
597
+ error_code: error_code_from(success, raw),
598
+ test: test?,
599
+ avs_result: AVSResult.new(code: AVS_CODE_MAP[raw[:avs_result_code_description]]),
600
+ cvv_result: CVVResult.new(CVC_CODE_MAP[raw[:cvc_result_code_description]])
599
601
  )
600
602
  rescue Nokogiri::SyntaxError
601
603
  unparsable_response(xml)
602
604
  rescue ActiveMerchant::ResponseError => e
603
605
  if e.response.code.to_s == '401'
604
- return Response.new(false, 'Invalid credentials', {}, :test => test?)
606
+ return Response.new(false, 'Invalid credentials', {}, test: test?)
605
607
  else
606
608
  raise e
607
609
  end
@@ -21,7 +21,7 @@ module ActiveMerchant #:nodoc:
21
21
  end
22
22
 
23
23
  def authorize(money, credit_card, options={})
24
- response = create_token(true, credit_card.first_name+' '+credit_card.last_name, credit_card.month, credit_card.year, credit_card.number, credit_card.verification_value)
24
+ response = create_token(true, credit_card.first_name + ' ' + credit_card.last_name, credit_card.month, credit_card.year, credit_card.number, credit_card.verification_value)
25
25
  if response.success?
26
26
  options[:authorizeOnly] = true
27
27
  post = create_post_for_auth_or_purchase(response.authorization, money, options)
@@ -32,22 +32,22 @@ module ActiveMerchant #:nodoc:
32
32
 
33
33
  def capture(money, authorization, options={})
34
34
  if authorization
35
- commit(:post, "orders/#{CGI.escape(authorization)}/capture", {'captureAmount'=>money}, options, 'capture')
35
+ commit(:post, "orders/#{CGI.escape(authorization)}/capture", {'captureAmount' => money}, options, 'capture')
36
36
  else
37
37
  Response.new(false,
38
38
  'FAILED',
39
39
  'FAILED',
40
- :test => test?,
41
- :authorization => false,
42
- :avs_result => {},
43
- :cvv_result => {},
44
- :error_code => false
40
+ test: test?,
41
+ authorization: false,
42
+ avs_result: {},
43
+ cvv_result: {},
44
+ error_code: false
45
45
  )
46
46
  end
47
47
  end
48
48
 
49
49
  def purchase(money, credit_card, options={})
50
- response = create_token(true, credit_card.first_name+' '+credit_card.last_name, credit_card.month, credit_card.year, credit_card.number, credit_card.verification_value)
50
+ response = create_token(true, credit_card.first_name + ' ' + credit_card.last_name, credit_card.month, credit_card.year, credit_card.number, credit_card.verification_value)
51
51
  if response.success?
52
52
  post = create_post_for_auth_or_purchase(response.authorization, money, options)
53
53
  response = commit(:post, 'orders', post, options, 'purchase')
@@ -74,16 +74,16 @@ module ActiveMerchant #:nodoc:
74
74
 
75
75
  def create_token(reusable, name, exp_month, exp_year, number, cvc)
76
76
  obj = {
77
- 'reusable'=> reusable,
78
- 'paymentMethod'=> {
79
- 'type'=> 'Card',
80
- 'name'=> name,
81
- 'expiryMonth'=> exp_month,
82
- 'expiryYear'=> exp_year,
83
- 'cardNumber'=> number,
84
- 'cvc'=> cvc
77
+ 'reusable' => reusable,
78
+ 'paymentMethod' => {
79
+ 'type' => 'Card',
80
+ 'name' => name,
81
+ 'expiryMonth' => exp_month,
82
+ 'expiryYear' => exp_year,
83
+ 'cardNumber' => number,
84
+ 'cvc' => cvc
85
85
  },
86
- 'clientKey'=> @client_key
86
+ 'clientKey' => @client_key
87
87
  }
88
88
  token_response = commit(:post, 'tokens', obj, {'Authorization' => @service_key}, 'token')
89
89
  token_response
@@ -95,15 +95,15 @@ module ActiveMerchant #:nodoc:
95
95
  'orderDescription' => options[:description] || 'Worldpay Order',
96
96
  'amount' => money,
97
97
  'currencyCode' => options[:currency] || default_currency,
98
- 'name' => options[:billing_address]&&options[:billing_address][:name] ? options[:billing_address][:name] : '',
98
+ 'name' => options[:billing_address] && options[:billing_address][:name] ? options[:billing_address][:name] : '',
99
99
  'billingAddress' => {
100
- 'address1'=>options[:billing_address]&&options[:billing_address][:address1] ? options[:billing_address][:address1] : '',
101
- 'address2'=>options[:billing_address]&&options[:billing_address][:address2] ? options[:billing_address][:address2] : '',
102
- 'address3'=>'',
103
- 'postalCode'=>options[:billing_address]&&options[:billing_address][:zip] ? options[:billing_address][:zip] : '',
104
- 'city'=>options[:billing_address]&&options[:billing_address][:city] ? options[:billing_address][:city] : '',
105
- 'state'=>options[:billing_address]&&options[:billing_address][:state] ? options[:billing_address][:state] : '',
106
- 'countryCode'=>options[:billing_address]&&options[:billing_address][:country] ? options[:billing_address][:country] : ''
100
+ 'address1' => options[:billing_address] && options[:billing_address][:address1] ? options[:billing_address][:address1] : '',
101
+ 'address2' => options[:billing_address] && options[:billing_address][:address2] ? options[:billing_address][:address2] : '',
102
+ 'address3' => '',
103
+ 'postalCode' => options[:billing_address] && options[:billing_address][:zip] ? options[:billing_address][:zip] : '',
104
+ 'city' => options[:billing_address] && options[:billing_address][:city] ? options[:billing_address][:city] : '',
105
+ 'state' => options[:billing_address] && options[:billing_address][:state] ? options[:billing_address][:state] : '',
106
+ 'countryCode' => options[:billing_address] && options[:billing_address][:country] ? options[:billing_address][:country] : ''
107
107
  },
108
108
  'customerOrderCode' => options[:order_id],
109
109
  'orderType' => 'ECOM',
@@ -121,7 +121,7 @@ module ActiveMerchant #:nodoc:
121
121
  'Content-Type' => 'application/json',
122
122
  'User-Agent' => "Worldpay/v1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
123
123
  'X-Worldpay-Client-User-Agent' => user_agent,
124
- 'X-Worldpay-Client-User-Metadata' => {:ip => options[:ip]}.to_json
124
+ 'X-Worldpay-Client-User-Metadata' => {ip: options[:ip]}.to_json
125
125
  }
126
126
  headers['Authorization'] = options['Authorization'] if options['Authorization']
127
127
  headers
@@ -147,7 +147,7 @@ module ActiveMerchant #:nodoc:
147
147
  success = true
148
148
  elsif type == 'purchase' && response['paymentStatus'] == 'SUCCESS'
149
149
  success = true
150
- elsif type == 'capture' || type=='refund' || type=='void'
150
+ elsif type == 'capture' || type == 'refund' || type == 'void'
151
151
  success = true
152
152
  end
153
153
  end
@@ -174,11 +174,11 @@ module ActiveMerchant #:nodoc:
174
174
  Response.new(success,
175
175
  success ? 'SUCCESS' : response['message'],
176
176
  response,
177
- :test => test?,
178
- :authorization => authorization,
179
- :avs_result => {},
180
- :cvv_result => {},
181
- :error_code => success ? nil : response['customCode']
177
+ test: test?,
178
+ authorization: authorization,
179
+ avs_result: {},
180
+ cvv_result: {},
181
+ error_code: success ? nil : response['customCode']
182
182
  )
183
183
  end
184
184