activemerchant 1.79.2 → 1.80.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +33 -0
  3. data/README.md +10 -2
  4. data/lib/active_merchant.rb +1 -1
  5. data/lib/active_merchant/billing/check.rb +4 -4
  6. data/lib/active_merchant/billing/compatibility.rb +1 -1
  7. data/lib/active_merchant/billing/credit_card.rb +21 -21
  8. data/lib/active_merchant/billing/credit_card_formatting.rb +2 -2
  9. data/lib/active_merchant/billing/credit_card_methods.rb +2 -2
  10. data/lib/active_merchant/billing/gateway.rb +13 -13
  11. data/lib/active_merchant/billing/gateways/adyen.rb +31 -15
  12. data/lib/active_merchant/billing/gateways/allied_wallet.rb +22 -22
  13. data/lib/active_merchant/billing/gateways/authorize_net.rb +72 -72
  14. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -3
  15. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +3 -3
  16. data/lib/active_merchant/billing/gateways/axcessms.rb +51 -51
  17. data/lib/active_merchant/billing/gateways/balanced.rb +29 -29
  18. data/lib/active_merchant/billing/gateways/bank_frick.rb +3 -3
  19. data/lib/active_merchant/billing/gateways/banwire.rb +8 -8
  20. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +5 -5
  21. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +6 -6
  22. data/lib/active_merchant/billing/gateways/be2bill.rb +2 -2
  23. data/lib/active_merchant/billing/gateways/beanstream.rb +1 -1
  24. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +69 -69
  25. data/lib/active_merchant/billing/gateways/blue_pay.rb +19 -19
  26. data/lib/active_merchant/billing/gateways/blue_snap.rb +42 -42
  27. data/lib/active_merchant/billing/gateways/bogus.rb +10 -10
  28. data/lib/active_merchant/billing/gateways/borgun.rb +10 -10
  29. data/lib/active_merchant/billing/gateways/bpoint.rb +1 -1
  30. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +2 -2
  31. data/lib/active_merchant/billing/gateways/braintree_blue.rb +94 -94
  32. data/lib/active_merchant/billing/gateways/braintree_orange.rb +1 -1
  33. data/lib/active_merchant/billing/gateways/bridge_pay.rb +39 -39
  34. data/lib/active_merchant/billing/gateways/cams.rb +12 -12
  35. data/lib/active_merchant/billing/gateways/card_connect.rb +38 -13
  36. data/lib/active_merchant/billing/gateways/card_stream.rb +116 -116
  37. data/lib/active_merchant/billing/gateways/cardknox.rb +7 -7
  38. data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
  39. data/lib/active_merchant/billing/gateways/cashnet.rb +10 -10
  40. data/lib/active_merchant/billing/gateways/cc5.rb +3 -5
  41. data/lib/active_merchant/billing/gateways/cecabank.rb +6 -6
  42. data/lib/active_merchant/billing/gateways/cenpos.rb +36 -36
  43. data/lib/active_merchant/billing/gateways/checkout.rb +5 -5
  44. data/lib/active_merchant/billing/gateways/checkout_v2.rb +31 -31
  45. data/lib/active_merchant/billing/gateways/clearhaus.rb +5 -5
  46. data/lib/active_merchant/billing/gateways/commercegate.rb +6 -6
  47. data/lib/active_merchant/billing/gateways/conekta.rb +24 -19
  48. data/lib/active_merchant/billing/gateways/creditcall.rb +41 -41
  49. data/lib/active_merchant/billing/gateways/credorax.rb +104 -103
  50. data/lib/active_merchant/billing/gateways/culqi.rb +25 -25
  51. data/lib/active_merchant/billing/gateways/cyber_source.rb +65 -65
  52. data/lib/active_merchant/billing/gateways/data_cash.rb +4 -4
  53. data/lib/active_merchant/billing/gateways/dibs.rb +24 -24
  54. data/lib/active_merchant/billing/gateways/digitzs.rb +35 -35
  55. data/lib/active_merchant/billing/gateways/ebanx.rb +26 -26
  56. data/lib/active_merchant/billing/gateways/efsnet.rb +10 -10
  57. data/lib/active_merchant/billing/gateways/elavon.rb +5 -5
  58. data/lib/active_merchant/billing/gateways/element.rb +35 -35
  59. data/lib/active_merchant/billing/gateways/epay.rb +4 -4
  60. data/lib/active_merchant/billing/gateways/evo_ca.rb +1 -1
  61. data/lib/active_merchant/billing/gateways/eway.rb +65 -65
  62. data/lib/active_merchant/billing/gateways/eway_managed.rb +11 -11
  63. data/lib/active_merchant/billing/gateways/eway_rapid.rb +31 -31
  64. data/lib/active_merchant/billing/gateways/exact.rb +12 -12
  65. data/lib/active_merchant/billing/gateways/ezic.rb +13 -13
  66. data/lib/active_merchant/billing/gateways/fat_zebra.rb +24 -24
  67. data/lib/active_merchant/billing/gateways/federated_canada.rb +3 -3
  68. data/lib/active_merchant/billing/gateways/first_giving.rb +16 -16
  69. data/lib/active_merchant/billing/gateways/first_pay.rb +7 -4
  70. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +71 -71
  71. data/lib/active_merchant/billing/gateways/flo2cash.rb +12 -12
  72. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
  73. data/lib/active_merchant/billing/gateways/forte.rb +26 -16
  74. data/lib/active_merchant/billing/gateways/garanti.rb +10 -12
  75. data/lib/active_merchant/billing/gateways/global_collect.rb +88 -88
  76. data/lib/active_merchant/billing/gateways/global_transport.rb +4 -4
  77. data/lib/active_merchant/billing/gateways/hdfc.rb +33 -33
  78. data/lib/active_merchant/billing/gateways/hps.rb +28 -28
  79. data/lib/active_merchant/billing/gateways/iats_payments.rb +26 -26
  80. data/lib/active_merchant/billing/gateways/inspire.rb +15 -15
  81. data/lib/active_merchant/billing/gateways/instapay.rb +4 -4
  82. data/lib/active_merchant/billing/gateways/ipp.rb +17 -17
  83. data/lib/active_merchant/billing/gateways/iridium.rb +207 -207
  84. data/lib/active_merchant/billing/gateways/iveri.rb +8 -8
  85. data/lib/active_merchant/billing/gateways/jetpay.rb +134 -134
  86. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +141 -141
  87. data/lib/active_merchant/billing/gateways/komoju.rb +15 -15
  88. data/lib/active_merchant/billing/gateways/kushki.rb +31 -37
  89. data/lib/active_merchant/billing/gateways/latitude19.rb +64 -64
  90. data/lib/active_merchant/billing/gateways/linkpoint.rb +22 -22
  91. data/lib/active_merchant/billing/gateways/litle.rb +4 -4
  92. data/lib/active_merchant/billing/gateways/mastercard.rb +3 -3
  93. data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
  94. data/lib/active_merchant/billing/gateways/mercado_pago.rb +28 -28
  95. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +9 -9
  96. data/lib/active_merchant/billing/gateways/merchant_one.rb +6 -6
  97. data/lib/active_merchant/billing/gateways/merchant_partners.rb +24 -24
  98. data/lib/active_merchant/billing/gateways/merchant_ware.rb +49 -49
  99. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +36 -36
  100. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +4 -4
  101. data/lib/active_merchant/billing/gateways/mercury.rb +28 -28
  102. data/lib/active_merchant/billing/gateways/metrics_global.rb +7 -7
  103. data/lib/active_merchant/billing/gateways/micropayment.rb +31 -31
  104. data/lib/active_merchant/billing/gateways/migs.rb +11 -9
  105. data/lib/active_merchant/billing/gateways/modern_payments.rb +1 -1
  106. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +16 -16
  107. data/lib/active_merchant/billing/gateways/monei.rb +5 -5
  108. data/lib/active_merchant/billing/gateways/moneris.rb +26 -26
  109. data/lib/active_merchant/billing/gateways/moneris_us.rb +81 -37
  110. data/lib/active_merchant/billing/gateways/money_movers.rb +3 -3
  111. data/lib/active_merchant/billing/gateways/mundipagg.rb +1 -1
  112. data/lib/active_merchant/billing/gateways/nab_transact.rb +6 -6
  113. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +3 -3
  114. data/lib/active_merchant/billing/gateways/netaxept.rb +15 -15
  115. data/lib/active_merchant/billing/gateways/netbanx.rb +2 -2
  116. data/lib/active_merchant/billing/gateways/netbilling.rb +1 -1
  117. data/lib/active_merchant/billing/gateways/netpay.rb +5 -5
  118. data/lib/active_merchant/billing/gateways/nmi.rb +18 -18
  119. data/lib/active_merchant/billing/gateways/ogone.rb +22 -22
  120. data/lib/active_merchant/billing/gateways/omise.rb +3 -3
  121. data/lib/active_merchant/billing/gateways/openpay.rb +6 -4
  122. data/lib/active_merchant/billing/gateways/opp.rb +4 -4
  123. data/lib/active_merchant/billing/gateways/optimal_payment.rb +2 -2
  124. data/lib/active_merchant/billing/gateways/orbital.rb +61 -61
  125. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +4 -4
  126. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +5 -5
  127. data/lib/active_merchant/billing/gateways/pagarme.rb +27 -27
  128. data/lib/active_merchant/billing/gateways/pago_facil.rb +8 -8
  129. data/lib/active_merchant/billing/gateways/pay_conex.rb +25 -25
  130. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +32 -32
  131. data/lib/active_merchant/billing/gateways/pay_hub.rb +29 -29
  132. data/lib/active_merchant/billing/gateways/pay_junction.rb +7 -7
  133. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +30 -30
  134. data/lib/active_merchant/billing/gateways/pay_secure.rb +4 -4
  135. data/lib/active_merchant/billing/gateways/paybox_direct.rb +15 -15
  136. data/lib/active_merchant/billing/gateways/payeezy.rb +5 -5
  137. data/lib/active_merchant/billing/gateways/payex.rb +4 -4
  138. data/lib/active_merchant/billing/gateways/payflow.rb +7 -7
  139. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +23 -22
  140. data/lib/active_merchant/billing/gateways/payflow_express.rb +2 -2
  141. data/lib/active_merchant/billing/gateways/payment_express.rb +40 -37
  142. data/lib/active_merchant/billing/gateways/paymentez.rb +11 -3
  143. data/lib/active_merchant/billing/gateways/paymill.rb +115 -115
  144. data/lib/active_merchant/billing/gateways/paypal.rb +1 -1
  145. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +1 -1
  146. data/lib/active_merchant/billing/gateways/payscout.rb +1 -1
  147. data/lib/active_merchant/billing/gateways/paystation.rb +14 -14
  148. data/lib/active_merchant/billing/gateways/payu_in.rb +43 -43
  149. data/lib/active_merchant/billing/gateways/payu_latam.rb +41 -41
  150. data/lib/active_merchant/billing/gateways/payway.rb +6 -6
  151. data/lib/active_merchant/billing/gateways/pin.rb +7 -7
  152. data/lib/active_merchant/billing/gateways/plugnpay.rb +62 -62
  153. data/lib/active_merchant/billing/gateways/pro_pay.rb +123 -123
  154. data/lib/active_merchant/billing/gateways/psigate.rb +16 -16
  155. data/lib/active_merchant/billing/gateways/psl_card.rb +13 -13
  156. data/lib/active_merchant/billing/gateways/qbms.rb +52 -52
  157. data/lib/active_merchant/billing/gateways/quantum.rb +5 -5
  158. data/lib/active_merchant/billing/gateways/quickbooks.rb +10 -10
  159. data/lib/active_merchant/billing/gateways/quickpay.rb +1 -1
  160. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +11 -11
  161. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +3 -3
  162. data/lib/active_merchant/billing/gateways/qvalent.rb +55 -55
  163. data/lib/active_merchant/billing/gateways/realex.rb +16 -15
  164. data/lib/active_merchant/billing/gateways/redsys.rb +128 -121
  165. data/lib/active_merchant/billing/gateways/s5.rb +5 -5
  166. data/lib/active_merchant/billing/gateways/safe_charge.rb +16 -16
  167. data/lib/active_merchant/billing/gateways/sage.rb +20 -20
  168. data/lib/active_merchant/billing/gateways/sage_pay.rb +32 -32
  169. data/lib/active_merchant/billing/gateways/sallie_mae.rb +11 -11
  170. data/lib/active_merchant/billing/gateways/secure_net.rb +19 -19
  171. data/lib/active_merchant/billing/gateways/secure_pay.rb +5 -5
  172. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +7 -7
  173. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +9 -9
  174. data/lib/active_merchant/billing/gateways/securion_pay.rb +12 -12
  175. data/lib/active_merchant/billing/gateways/skip_jack.rb +28 -28
  176. data/lib/active_merchant/billing/gateways/smart_ps.rb +31 -31
  177. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +3 -3
  178. data/lib/active_merchant/billing/gateways/spreedly_core.rb +1 -1
  179. data/lib/active_merchant/billing/gateways/stripe.rb +63 -63
  180. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +5 -5
  181. data/lib/active_merchant/billing/gateways/telr.rb +26 -26
  182. data/lib/active_merchant/billing/gateways/trans_first.rb +28 -28
  183. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +224 -224
  184. data/lib/active_merchant/billing/gateways/transact_pro.rb +7 -7
  185. data/lib/active_merchant/billing/gateways/transnational.rb +1 -1
  186. data/lib/active_merchant/billing/gateways/trexle.rb +5 -5
  187. data/lib/active_merchant/billing/gateways/trust_commerce.rb +38 -38
  188. data/lib/active_merchant/billing/gateways/usa_epay.rb +3 -3
  189. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +37 -37
  190. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +3 -3
  191. data/lib/active_merchant/billing/gateways/vanco.rb +25 -25
  192. data/lib/active_merchant/billing/gateways/verifi.rb +40 -40
  193. data/lib/active_merchant/billing/gateways/viaklix.rb +5 -5
  194. data/lib/active_merchant/billing/gateways/visanet_peru.rb +64 -36
  195. data/lib/active_merchant/billing/gateways/webpay.rb +8 -8
  196. data/lib/active_merchant/billing/gateways/wepay.rb +25 -25
  197. data/lib/active_merchant/billing/gateways/wirecard.rb +26 -26
  198. data/lib/active_merchant/billing/gateways/worldpay.rb +15 -15
  199. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +42 -42
  200. data/lib/active_merchant/billing/gateways/worldpay_us.rb +17 -17
  201. data/lib/active_merchant/billing/model.rb +2 -2
  202. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +1 -1
  203. data/lib/active_merchant/billing/rails.rb +1 -1
  204. data/lib/active_merchant/connection.rb +10 -8
  205. data/lib/active_merchant/country.rb +1 -1
  206. data/lib/active_merchant/net_http_ssl_connection.rb +1 -0
  207. data/lib/active_merchant/network_connection_retries.rb +12 -12
  208. data/lib/active_merchant/post_data.rb +1 -1
  209. data/lib/active_merchant/posts_data.rb +1 -1
  210. data/lib/active_merchant/version.rb +1 -1
  211. data/lib/certs/cacert.pem +37 -0
  212. data/lib/support/gateway_support.rb +2 -2
  213. data/lib/support/ssl_verify.rb +5 -5
  214. data/lib/support/ssl_version.rb +7 -7
  215. metadata +3 -7
  216. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -246
  217. data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
  218. data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
  219. data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
@@ -80,7 +80,7 @@ module ActiveMerchant #:nodoc:
80
80
 
81
81
  def store(payment, options = {})
82
82
  request = build_xml_request do |xml|
83
- xml.Payment(code: SUPPORTED_TRANSACTIONS["store"])
83
+ xml.Payment(code: SUPPORTED_TRANSACTIONS['store'])
84
84
  add_account(xml, payment)
85
85
  add_customer(xml, payment, options)
86
86
  add_recurrence_mode(xml, options)
@@ -174,20 +174,20 @@ module ActiveMerchant #:nodoc:
174
174
 
175
175
  def add_recurrence_mode(xml, options)
176
176
  if options[:recurring] == true
177
- xml.Recurrence(mode: "REPEATED")
177
+ xml.Recurrence(mode: 'REPEATED')
178
178
  else
179
- xml.Recurrence(mode: "INITIAL")
179
+ xml.Recurrence(mode: 'INITIAL')
180
180
  end
181
181
  end
182
182
 
183
183
  def parse(body)
184
184
  results = {}
185
185
  xml = Nokogiri::XML(body)
186
- resp = xml.xpath("//Response/Transaction/Identification")
186
+ resp = xml.xpath('//Response/Transaction/Identification')
187
187
  resp.children.each do |element|
188
188
  results[element.name.downcase.to_sym] = element.text
189
189
  end
190
- resp = xml.xpath("//Response/Transaction/Processing")
190
+ resp = xml.xpath('//Response/Transaction/Processing')
191
191
  resp.children.each do |element|
192
192
  results[element.name.downcase.to_sym] = element.text
193
193
  end
@@ -23,7 +23,7 @@ module ActiveMerchant #:nodoc:
23
23
  def purchase(money, payment, options={})
24
24
  post = {}
25
25
  post[:sg_APIType] = 1 if options[:three_d_secure]
26
- trans_type = options[:three_d_secure] ? "Sale3D" : "Sale"
26
+ trans_type = options[:three_d_secure] ? 'Sale3D' : 'Sale'
27
27
  add_transaction_data(trans_type, post, money, options)
28
28
  add_payment(post, payment, options)
29
29
  add_customer_details(post, payment, options)
@@ -33,7 +33,7 @@ module ActiveMerchant #:nodoc:
33
33
 
34
34
  def authorize(money, payment, options={})
35
35
  post = {}
36
- add_transaction_data("Auth", post, money, options)
36
+ add_transaction_data('Auth', post, money, options)
37
37
  add_payment(post, payment, options)
38
38
  add_customer_details(post, payment, options)
39
39
 
@@ -42,8 +42,8 @@ module ActiveMerchant #:nodoc:
42
42
 
43
43
  def capture(money, authorization, options={})
44
44
  post = {}
45
- auth, transaction_id, token, exp_month, exp_year, _, original_currency = authorization.split("|")
46
- add_transaction_data("Settle", post, money, (options.merge!({currency: original_currency})))
45
+ auth, transaction_id, token, exp_month, exp_year, _, original_currency = authorization.split('|')
46
+ add_transaction_data('Settle', post, money, (options.merge!({currency: original_currency})))
47
47
  post[:sg_AuthCode] = auth
48
48
  post[:sg_TransactionID] = transaction_id
49
49
  post[:sg_CCToken] = token
@@ -55,8 +55,8 @@ module ActiveMerchant #:nodoc:
55
55
 
56
56
  def refund(money, authorization, options={})
57
57
  post = {}
58
- auth, transaction_id, token, exp_month, exp_year, _, original_currency = authorization.split("|")
59
- add_transaction_data("Credit", post, money, (options.merge!({currency: original_currency})))
58
+ auth, transaction_id, token, exp_month, exp_year, _, original_currency = authorization.split('|')
59
+ add_transaction_data('Credit', post, money, (options.merge!({currency: original_currency})))
60
60
  post[:sg_CreditType] = 2
61
61
  post[:sg_AuthCode] = auth
62
62
  post[:sg_TransactionID] = transaction_id
@@ -70,7 +70,7 @@ module ActiveMerchant #:nodoc:
70
70
  def credit(money, payment, options={})
71
71
  post = {}
72
72
  add_payment(post, payment, options)
73
- add_transaction_data("Credit", post, money, options)
73
+ add_transaction_data('Credit', post, money, options)
74
74
  post[:sg_CreditType] = 1
75
75
 
76
76
  commit(post)
@@ -78,8 +78,8 @@ module ActiveMerchant #:nodoc:
78
78
 
79
79
  def void(authorization, options={})
80
80
  post = {}
81
- auth, transaction_id, token, exp_month, exp_year, original_amount, original_currency = authorization.split("|")
82
- add_transaction_data("Void", post, (original_amount.to_f * 100), (options.merge!({currency: original_currency})))
81
+ auth, transaction_id, token, exp_month, exp_year, original_amount, original_currency = authorization.split('|')
82
+ add_transaction_data('Void', post, (original_amount.to_f * 100), (options.merge!({currency: original_currency})))
83
83
  post[:sg_CreditType] = 2
84
84
  post[:sg_AuthCode] = auth
85
85
  post[:sg_TransactionID] = transaction_id
@@ -116,7 +116,7 @@ module ActiveMerchant #:nodoc:
116
116
  post[:sg_Amount] = amount(money)
117
117
  post[:sg_ClientLoginID] = @options[:client_login_id]
118
118
  post[:sg_ClientPassword] = @options[:client_password]
119
- post[:sg_ResponseFormat] = "4"
119
+ post[:sg_ResponseFormat] = '4'
120
120
  post[:sg_Version] = VERSION
121
121
  post[:sg_ClientUniqueID] = options[:order_id] if options[:order_id]
122
122
  post[:sg_UserID] = options[:user_id] if options[:user_id]
@@ -202,11 +202,11 @@ module ActiveMerchant #:nodoc:
202
202
  end
203
203
 
204
204
  def success_from(response)
205
- response[:status] == "APPROVED"
205
+ response[:status] == 'APPROVED'
206
206
  end
207
207
 
208
208
  def message_from(response)
209
- return "Success" if success_from(response)
209
+ return 'Success' if success_from(response)
210
210
  response[:reason_codes] || response[:reason]
211
211
  end
212
212
 
@@ -219,11 +219,11 @@ module ActiveMerchant #:nodoc:
219
219
  parameters[:sg_ExpYear],
220
220
  parameters[:sg_Amount],
221
221
  parameters[:sg_Currency]
222
- ].join("|")
222
+ ].join('|')
223
223
  end
224
224
 
225
225
  def split_authorization(authorization)
226
- auth_code, transaction_id, token, month, year, original_amount = authorization.split("|")
226
+ auth_code, transaction_id, token, month, year, original_amount = authorization.split('|')
227
227
 
228
228
  {
229
229
  auth_code: auth_code,
@@ -241,7 +241,7 @@ module ActiveMerchant #:nodoc:
241
241
  params.map do |key, value|
242
242
  next if value != false && value.blank?
243
243
  "#{key}=#{CGI.escape(value.to_s)}"
244
- end.compact.join("&")
244
+ end.compact.join('&')
245
245
  end
246
246
 
247
247
  def error_code_from(response)
@@ -254,7 +254,7 @@ module ActiveMerchant #:nodoc:
254
254
  camel_cased_word.to_s.gsub(/::/, '/').
255
255
  gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
256
256
  gsub(/([a-z\d])([A-Z])/,'\1_\2').
257
- tr("-", "_").
257
+ tr('-', '_').
258
258
  downcase
259
259
  end
260
260
  end
@@ -19,8 +19,8 @@ module ActiveMerchant #:nodoc:
19
19
  :refund => '10'
20
20
  }
21
21
 
22
- SOURCE_CARD = "bankcard"
23
- SOURCE_ECHECK = "virtual_check"
22
+ SOURCE_CARD = 'bankcard'
23
+ SOURCE_ECHECK = 'virtual_check'
24
24
 
25
25
  def initialize(options = {})
26
26
  requires!(options, :login, :password)
@@ -36,7 +36,7 @@ module ActiveMerchant #:nodoc:
36
36
 
37
37
  def purchase(money, payment_method, options = {})
38
38
  post = {}
39
- if card_brand(payment_method) == "check"
39
+ if card_brand(payment_method) == 'check'
40
40
  source = SOURCE_ECHECK
41
41
  add_check(post, payment_method)
42
42
  add_check_customer_data(post, options)
@@ -59,13 +59,13 @@ module ActiveMerchant #:nodoc:
59
59
  def void(reference, options = {})
60
60
  post = {}
61
61
  add_reference(post, reference)
62
- source = reference.split(";").last
62
+ source = reference.split(';').last
63
63
  commit(:void, post, source)
64
64
  end
65
65
 
66
66
  def credit(money, payment_method, options = {})
67
67
  post = {}
68
- if card_brand(payment_method) == "check"
68
+ if card_brand(payment_method) == 'check'
69
69
  source = SOURCE_ECHECK
70
70
  add_check(post, payment_method)
71
71
  add_check_customer_data(post, options)
@@ -115,8 +115,8 @@ module ActiveMerchant #:nodoc:
115
115
  # use the same method as in pay_conex
116
116
  def force_utf8(string)
117
117
  return nil unless string
118
- binary = string.encode("BINARY", invalid: :replace, undef: :replace, replace: "?") # Needed for Ruby 2.0 since #encode is a no-op if the string is already UTF-8. It's not needed for Ruby 2.1 and up since it's not a no-op there.
119
- binary.encode("UTF-8", invalid: :replace, undef: :replace, replace: "?")
118
+ binary = string.encode('BINARY', invalid: :replace, undef: :replace, replace: '?') # Needed for Ruby 2.0 since #encode is a no-op if the string is already UTF-8. It's not needed for Ruby 2.1 and up since it's not a no-op there.
119
+ binary.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
120
120
  end
121
121
 
122
122
  def add_credit_card(post, credit_card)
@@ -143,7 +143,7 @@ module ActiveMerchant #:nodoc:
143
143
  # RCK for Returned Checks
144
144
  # ARC for Account Receivable Entry
145
145
  # TEL for TelephoneInitiated
146
- post[:C_customer_type] = "WEB"
146
+ post[:C_customer_type] = 'WEB'
147
147
 
148
148
  # Optional  10  Digit Originator  ID – Assigned  By for  each transaction  class  or  business  purpose. If  not provided, the default Originator ID for the specific  Customer Type will be applied. 
149
149
  post[:C_originator_id] = options[:originator_id]
@@ -160,7 +160,7 @@ module ActiveMerchant #:nodoc:
160
160
  end
161
161
 
162
162
  def format_birth_date(date)
163
- date.respond_to?(:strftime) ? date.strftime("%m/%d/%Y") : date
163
+ date.respond_to?(:strftime) ? date.strftime('%m/%d/%Y') : date
164
164
  end
165
165
 
166
166
  # DDA for Checking
@@ -214,7 +214,7 @@ module ActiveMerchant #:nodoc:
214
214
  end
215
215
 
216
216
  def add_reference(post, reference)
217
- ref, _ = reference.to_s.split(";")
217
+ ref, _ = reference.to_s.split(';')
218
218
  post[:T_reference] = ref
219
219
  end
220
220
 
@@ -231,7 +231,7 @@ module ActiveMerchant #:nodoc:
231
231
 
232
232
  post[:C_address] = billing_address[:address1]
233
233
  post[:C_city] = billing_address[:city]
234
- post[:C_state] = empty?(billing_address[:state]) ? "Outside of US" : billing_address[:state]
234
+ post[:C_state] = empty?(billing_address[:state]) ? 'Outside of US' : billing_address[:state]
235
235
  post[:C_zip] = billing_address[:zip]
236
236
  post[:C_country] = billing_address[:country]
237
237
  post[:C_telephone] = billing_address[:phone]
@@ -288,7 +288,7 @@ module ActiveMerchant #:nodoc:
288
288
  params[:M_key] = @options[:password]
289
289
  params[:T_code] = TRANSACTIONS[action]
290
290
 
291
- params.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
291
+ params.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
292
292
  end
293
293
 
294
294
  def vault
@@ -357,8 +357,8 @@ module ActiveMerchant #:nodoc:
357
357
  end
358
358
 
359
359
  def exp_date(credit_card)
360
- year = sprintf("%.4i", credit_card.year)
361
- month = sprintf("%.2i", credit_card.month)
360
+ year = sprintf('%.4i', credit_card.year)
361
+ month = sprintf('%.2i', credit_card.month)
362
362
 
363
363
  "#{month}#{year[-2..-1]}"
364
364
  end
@@ -384,8 +384,8 @@ module ActiveMerchant #:nodoc:
384
384
  end
385
385
 
386
386
  ENVELOPE_NAMESPACES = {
387
- 'xmlns:SOAP-ENV' => "http://schemas.xmlsoap.org/soap/envelope/",
388
- 'xmlns:ns1' => "https://www.sagepayments.net/web_services/wsVault/wsVault"
387
+ 'xmlns:SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/',
388
+ 'xmlns:ns1' => 'https://www.sagepayments.net/web_services/wsVault/wsVault'
389
389
  }
390
390
 
391
391
  ACTION_ELEMENTS = {
@@ -415,8 +415,8 @@ module ActiveMerchant #:nodoc:
415
415
 
416
416
  def build_headers(action)
417
417
  {
418
- "SOAPAction" => SOAP_ACTIONS[action],
419
- "Content-Type" => "text/xml; charset=utf-8"
418
+ 'SOAPAction' => SOAP_ACTIONS[action],
419
+ 'Content-Type' => 'text/xml; charset=utf-8'
420
420
  }
421
421
  end
422
422
 
@@ -430,12 +430,12 @@ module ActiveMerchant #:nodoc:
430
430
  xml = REXML::Document.new(xml)
431
431
 
432
432
  # Store
433
- xml.elements.each("//Table1/*") do |node|
433
+ xml.elements.each('//Table1/*') do |node|
434
434
  response[node.name.underscore.to_sym] = node.text
435
435
  end
436
436
 
437
437
  # Unstore
438
- xml.elements.each("//DELETE_DATAResponse/*") do |node|
438
+ xml.elements.each('//DELETE_DATAResponse/*') do |node|
439
439
  response[node.name.underscore.to_sym] = node.text
440
440
  end
441
441
  end
@@ -25,30 +25,30 @@ module ActiveMerchant #:nodoc:
25
25
  }
26
26
 
27
27
  CREDIT_CARDS = {
28
- :visa => "VISA",
29
- :master => "MC",
30
- :delta => "DELTA",
31
- :solo => "SOLO",
32
- :switch => "MAESTRO",
33
- :maestro => "MAESTRO",
34
- :american_express => "AMEX",
35
- :electron => "UKE",
36
- :diners_club => "DC",
37
- :jcb => "JCB"
28
+ :visa => 'VISA',
29
+ :master => 'MC',
30
+ :delta => 'DELTA',
31
+ :solo => 'SOLO',
32
+ :switch => 'MAESTRO',
33
+ :maestro => 'MAESTRO',
34
+ :american_express => 'AMEX',
35
+ :electron => 'UKE',
36
+ :diners_club => 'DC',
37
+ :jcb => 'JCB'
38
38
  }
39
39
 
40
40
  AVS_CODE = {
41
- "NOTPROVIDED" => nil,
42
- "NOTCHECKED" => 'X',
43
- "MATCHED" => 'Y',
44
- "NOTMATCHED" => 'N'
41
+ 'NOTPROVIDED' => nil,
42
+ 'NOTCHECKED' => 'X',
43
+ 'MATCHED' => 'Y',
44
+ 'NOTMATCHED' => 'N'
45
45
  }
46
46
 
47
47
  CVV_CODE = {
48
- "NOTPROVIDED" => 'S',
49
- "NOTCHECKED" => 'X',
50
- "MATCHED" => 'M',
51
- "NOTMATCHED" => 'N'
48
+ 'NOTPROVIDED' => 'S',
49
+ 'NOTCHECKED' => 'X',
50
+ 'MATCHED' => 'M',
51
+ 'NOTMATCHED' => 'N'
52
52
  }
53
53
 
54
54
  OPTIONAL_REQUEST_FIELDS = {
@@ -327,7 +327,7 @@ module ActiveMerchant #:nodoc:
327
327
  end
328
328
 
329
329
  def map_card_type(credit_card)
330
- raise ArgumentError, "The credit card type must be provided" if card_brand(credit_card).blank?
330
+ raise ArgumentError, 'The credit card type must be provided' if card_brand(credit_card).blank?
331
331
 
332
332
  card_type = card_brand(credit_card).to_sym
333
333
 
@@ -342,8 +342,8 @@ module ActiveMerchant #:nodoc:
342
342
  def format_date(month, year)
343
343
  return nil if year.blank? || month.blank?
344
344
 
345
- year = sprintf("%.4i", year)
346
- month = sprintf("%.2i", month)
345
+ year = sprintf('%.4i', year)
346
+ month = sprintf('%.2i', month)
347
347
 
348
348
  "#{month}#{year[-2..-1]}"
349
349
  end
@@ -351,14 +351,14 @@ module ActiveMerchant #:nodoc:
351
351
  def commit(action, parameters)
352
352
  response = parse( ssl_post(url_for(action), post_data(action, parameters)) )
353
353
 
354
- Response.new(response["Status"] == APPROVED, message_from(response), response,
354
+ Response.new(response['Status'] == APPROVED, message_from(response), response,
355
355
  :test => test?,
356
356
  :authorization => authorization_from(response, parameters, action),
357
357
  :avs_result => {
358
- :street_match => AVS_CODE[ response["AddressResult"] ],
359
- :postal_match => AVS_CODE[ response["PostCodeResult"] ],
358
+ :street_match => AVS_CODE[ response['AddressResult'] ],
359
+ :postal_match => AVS_CODE[ response['PostCodeResult'] ],
360
360
  },
361
- :cvv_result => CVV_CODE[ response["CV2Result"] ]
361
+ :cvv_result => CVV_CODE[ response['CV2Result'] ]
362
362
  )
363
363
  end
364
364
 
@@ -368,10 +368,10 @@ module ActiveMerchant #:nodoc:
368
368
  response['Token']
369
369
  else
370
370
  [ params[:VendorTxCode],
371
- response["VPSTxId"] || params[:VPSTxId],
372
- response["TxAuthNo"],
373
- response["SecurityKey"] || params[:SecurityKey],
374
- action ].join(";")
371
+ response['VPSTxId'] || params[:VPSTxId],
372
+ response['TxAuthNo'],
373
+ response['SecurityKey'] || params[:SecurityKey],
374
+ action ].join(';')
375
375
  end
376
376
  end
377
377
 
@@ -386,7 +386,7 @@ module ActiveMerchant #:nodoc:
386
386
 
387
387
  def build_url(action)
388
388
  endpoint = case action
389
- when :purchase, :authorization then "vspdirect-register"
389
+ when :purchase, :authorization then 'vspdirect-register'
390
390
  when :store then 'directtoken'
391
391
  else TRANSACTIONS[action].downcase
392
392
  end
@@ -394,7 +394,7 @@ module ActiveMerchant #:nodoc:
394
394
  end
395
395
 
396
396
  def build_simulator_url(action)
397
- endpoint = [ :purchase, :authorization ].include?(action) ? "VSPDirectGateway.asp" : "VSPServerGateway.asp?Service=Vendor#{TRANSACTIONS[action].capitalize}Tx"
397
+ endpoint = [ :purchase, :authorization ].include?(action) ? 'VSPDirectGateway.asp' : "VSPServerGateway.asp?Service=Vendor#{TRANSACTIONS[action].capitalize}Tx"
398
398
  "#{self.simulator_url}/#{endpoint}"
399
399
  end
400
400
 
@@ -413,7 +413,7 @@ module ActiveMerchant #:nodoc:
413
413
  parameters.update(:ReferrerID => application_id)
414
414
  end
415
415
 
416
- parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
416
+ parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
417
417
  end
418
418
 
419
419
  # SagePay returns data in the following format
@@ -21,7 +21,7 @@ module ActiveMerchant #:nodoc:
21
21
  end
22
22
 
23
23
  def test?
24
- @options[:login] == "TEST0"
24
+ @options[:login] == 'TEST0'
25
25
  end
26
26
 
27
27
  def authorize(money, creditcard, options = {})
@@ -94,11 +94,11 @@ module ActiveMerchant #:nodoc:
94
94
 
95
95
  def parse(body)
96
96
  h = {}
97
- body.gsub!("<html><body><plaintext>", "")
97
+ body.gsub!('<html><body><plaintext>', '')
98
98
  body.
99
99
  split("\r\n").
100
100
  map do |i|
101
- a = i.split("=")
101
+ a = i.split('=')
102
102
  h[a.first] = a.last unless a.first.nil?
103
103
  end
104
104
  h
@@ -111,30 +111,30 @@ module ActiveMerchant #:nodoc:
111
111
 
112
112
  case action
113
113
  when :sale
114
- parameters[:action] = "ns_quicksale_cc"
114
+ parameters[:action] = 'ns_quicksale_cc'
115
115
  when :authonly
116
- parameters[:action] = "ns_quicksale_cc"
116
+ parameters[:action] = 'ns_quicksale_cc'
117
117
  parameters[:authonly] = 1
118
118
  when :capture
119
- parameters[:action] = "ns_quicksale_cc"
119
+ parameters[:action] = 'ns_quicksale_cc'
120
120
  end
121
121
 
122
- response = parse(ssl_post(self.live_url, parameters.to_post_data) || "")
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"]
125
+ :authorization => response['refcode']
126
126
  )
127
127
  end
128
128
 
129
129
  def successful?(response)
130
- response["Status"] == "Accepted"
130
+ response['Status'] == 'Accepted'
131
131
  end
132
132
 
133
133
  def message_from(response)
134
134
  if successful?(response)
135
- "Accepted"
135
+ 'Accepted'
136
136
  else
137
- response["Reason"].split(":")[2].capitalize unless response["Reason"].nil?
137
+ response['Reason'].split(':')[2].capitalize unless response['Reason'].nil?
138
138
  end
139
139
  end
140
140
  end