activemerchant 1.79.2 → 1.80.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -160,11 +160,11 @@ module ActiveMerchant #:nodoc:
160
160
  authorization = [parameters[:originalReference], response['pspReference']].compact
161
161
 
162
162
  return nil if authorization.empty?
163
- return authorization.join("#")
163
+ return authorization.join('#')
164
164
  end
165
165
 
166
166
  def parse_avs_code(response)
167
- AVS_MAPPING[response["avsResult"][0..1].strip] if response["avsResult"]
167
+ AVS_MAPPING[response['avsResult'][0..1].strip] if response['avsResult']
168
168
  end
169
169
 
170
170
  def flatten_hash(hash, prefix = nil)
@@ -249,13 +249,13 @@ module ActiveMerchant #:nodoc:
249
249
  def parse_street(address)
250
250
  address_to_parse = "#{address[:address1]} #{address[:address2]}"
251
251
  street = address[:street] || address_to_parse.split(/\s+/).keep_if { |x| x !~ /\d/ }.join(' ')
252
- street.empty? ? "Not Provided" : street
252
+ street.empty? ? 'Not Provided' : street
253
253
  end
254
254
 
255
255
  def parse_house_number(address)
256
256
  address_to_parse = "#{address[:address1]} #{address[:address2]}"
257
257
  house = address[:houseNumberOrName] || address_to_parse.split(/\s+/).keep_if { |x| x =~ /\d/ }.join(' ')
258
- house.empty? ? "Not Provided" : house
258
+ house.empty? ? 'Not Provided' : house
259
259
  end
260
260
 
261
261
  def create_address_hash(address, house, street)
@@ -295,7 +295,7 @@ module ActiveMerchant #:nodoc:
295
295
  end
296
296
 
297
297
  def psp_reference_from(authorization)
298
- authorization.nil? ? nil : authorization.split("#").first
298
+ authorization.nil? ? nil : authorization.split('#').first
299
299
  end
300
300
 
301
301
  def payment_request(money, options)
@@ -1,15 +1,15 @@
1
1
  module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  class BarclaysEpdqExtraPlusGateway < OgoneGateway
4
- self.test_url = "https://mdepayments.epdq.co.uk/ncol/test/"
5
- self.live_url = "https://payments.epdq.co.uk/ncol/prod/"
4
+ self.test_url = 'https://mdepayments.epdq.co.uk/ncol/test/'
5
+ self.live_url = 'https://payments.epdq.co.uk/ncol/prod/'
6
6
 
7
- self.display_name = "Barclays ePDQ Extra Plus"
8
- self.homepage_url = "http://www.barclaycard.co.uk/business/accepting-payments/epdq-ecomm/"
7
+ self.display_name = 'Barclays ePDQ Extra Plus'
8
+ self.homepage_url = 'http://www.barclaycard.co.uk/business/accepting-payments/epdq-ecomm/'
9
9
 
10
- self.supported_countries = ["GB"]
10
+ self.supported_countries = ['GB']
11
11
  self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :discover, :jcb, :maestro]
12
- self.default_currency = "GBP"
12
+ self.default_currency = 'GBP'
13
13
  end
14
14
  end
15
15
  end
@@ -1,4 +1,4 @@
1
- require "digest/sha2"
1
+ require 'digest/sha2'
2
2
 
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
@@ -72,7 +72,7 @@ module ActiveMerchant #:nodoc:
72
72
  def add_creditcard(post, creditcard)
73
73
  post[:CARDFULLNAME] = creditcard ? creditcard.name : ''
74
74
  post[:CARDCODE] = creditcard ? creditcard.number : ''
75
- post[:CARDVALIDITYDATE] = creditcard ? "%02d-%02s" % [creditcard.month, creditcard.year.to_s[-2..-1]] : ''
75
+ post[:CARDVALIDITYDATE] = creditcard ? '%02d-%02s' % [creditcard.month, creditcard.year.to_s[-2..-1]] : ''
76
76
  post[:CARDCVV] = creditcard ? creditcard.verification_value : ''
77
77
  end
78
78
 
@@ -170,7 +170,7 @@ module ActiveMerchant #:nodoc:
170
170
  #can't actually delete a secure profile with the supplicated API. This function sets the status of the profile to closed (C).
171
171
  #Closed profiles will have to removed manually.
172
172
  def delete(vault_id)
173
- update(vault_id, false, {:status => "C"})
173
+ update(vault_id, false, {:status => 'C'})
174
174
  end
175
175
 
176
176
  alias_method :unstore, :delete
@@ -62,69 +62,69 @@ module ActiveMerchant #:nodoc:
62
62
  }
63
63
 
64
64
  STATES = {
65
- "ALBERTA" => "AB",
66
- "BRITISH COLUMBIA" => "BC",
67
- "MANITOBA" => "MB",
68
- "NEW BRUNSWICK" => "NB",
69
- "NEWFOUNDLAND AND LABRADOR" => "NL",
70
- "NOVA SCOTIA" => "NS",
71
- "ONTARIO" => "ON",
72
- "PRINCE EDWARD ISLAND" => "PE",
73
- "QUEBEC" => "QC",
74
- "SASKATCHEWAN" => "SK",
75
- "NORTHWEST TERRITORIES" => "NT",
76
- "NUNAVUT" => "NU",
77
- "YUKON" => "YT",
78
- "ALABAMA" => "AL",
79
- "ALASKA" => "AK",
80
- "ARIZONA" => "AZ",
81
- "ARKANSAS" => "AR",
82
- "CALIFORNIA" => "CA",
83
- "COLORADO" => "CO",
84
- "CONNECTICUT" => "CT",
85
- "DELAWARE" => "DE",
86
- "FLORIDA" => "FL",
87
- "GEORGIA" => "GA",
88
- "HAWAII" => "HI",
89
- "IDAHO" => "ID",
90
- "ILLINOIS" => "IL",
91
- "INDIANA" => "IN",
92
- "IOWA" => "IA",
93
- "KANSAS" => "KS",
94
- "KENTUCKY" => "KY",
95
- "LOUISIANA" => "LA",
96
- "MAINE" => "ME",
97
- "MARYLAND" => "MD",
98
- "MASSACHUSETTS" => "MA",
99
- "MICHIGAN" => "MI",
100
- "MINNESOTA" => "MN",
101
- "MISSISSIPPI" => "MS",
102
- "MISSOURI" => "MO",
103
- "MONTANA" => "MT",
104
- "NEBRASKA" => "NE",
105
- "NEVADA" => "NV",
106
- "NEW HAMPSHIRE" => "NH",
107
- "NEW JERSEY" => "NJ",
108
- "NEW MEXICO" => "NM",
109
- "NEW YORK" => "NY",
110
- "NORTH CAROLINA" => "NC",
111
- "NORTH DAKOTA" => "ND",
112
- "OHIO" => "OH",
113
- "OKLAHOMA" => "OK",
114
- "OREGON" => "OR",
115
- "PENNSYLVANIA" => "PA",
116
- "RHODE ISLAND" => "RI",
117
- "SOUTH CAROLINA" => "SC",
118
- "SOUTH DAKOTA" => "SD",
119
- "TENNESSEE" => "TN",
120
- "TEXAS" => "TX",
121
- "UTAH" => "UT",
122
- "VERMONT" => "VT",
123
- "VIRGINIA" => "VA",
124
- "WASHINGTON" => "WA",
125
- "WEST VIRGINIA" => "WV",
126
- "WISCONSIN" => "WI",
127
- "WYOMING" => "WY"
65
+ 'ALBERTA' => 'AB',
66
+ 'BRITISH COLUMBIA' => 'BC',
67
+ 'MANITOBA' => 'MB',
68
+ 'NEW BRUNSWICK' => 'NB',
69
+ 'NEWFOUNDLAND AND LABRADOR' => 'NL',
70
+ 'NOVA SCOTIA' => 'NS',
71
+ 'ONTARIO' => 'ON',
72
+ 'PRINCE EDWARD ISLAND' => 'PE',
73
+ 'QUEBEC' => 'QC',
74
+ 'SASKATCHEWAN' => 'SK',
75
+ 'NORTHWEST TERRITORIES' => 'NT',
76
+ 'NUNAVUT' => 'NU',
77
+ 'YUKON' => 'YT',
78
+ 'ALABAMA' => 'AL',
79
+ 'ALASKA' => 'AK',
80
+ 'ARIZONA' => 'AZ',
81
+ 'ARKANSAS' => 'AR',
82
+ 'CALIFORNIA' => 'CA',
83
+ 'COLORADO' => 'CO',
84
+ 'CONNECTICUT' => 'CT',
85
+ 'DELAWARE' => 'DE',
86
+ 'FLORIDA' => 'FL',
87
+ 'GEORGIA' => 'GA',
88
+ 'HAWAII' => 'HI',
89
+ 'IDAHO' => 'ID',
90
+ 'ILLINOIS' => 'IL',
91
+ 'INDIANA' => 'IN',
92
+ 'IOWA' => 'IA',
93
+ 'KANSAS' => 'KS',
94
+ 'KENTUCKY' => 'KY',
95
+ 'LOUISIANA' => 'LA',
96
+ 'MAINE' => 'ME',
97
+ 'MARYLAND' => 'MD',
98
+ 'MASSACHUSETTS' => 'MA',
99
+ 'MICHIGAN' => 'MI',
100
+ 'MINNESOTA' => 'MN',
101
+ 'MISSISSIPPI' => 'MS',
102
+ 'MISSOURI' => 'MO',
103
+ 'MONTANA' => 'MT',
104
+ 'NEBRASKA' => 'NE',
105
+ 'NEVADA' => 'NV',
106
+ 'NEW HAMPSHIRE' => 'NH',
107
+ 'NEW JERSEY' => 'NJ',
108
+ 'NEW MEXICO' => 'NM',
109
+ 'NEW YORK' => 'NY',
110
+ 'NORTH CAROLINA' => 'NC',
111
+ 'NORTH DAKOTA' => 'ND',
112
+ 'OHIO' => 'OH',
113
+ 'OKLAHOMA' => 'OK',
114
+ 'OREGON' => 'OR',
115
+ 'PENNSYLVANIA' => 'PA',
116
+ 'RHODE ISLAND' => 'RI',
117
+ 'SOUTH CAROLINA' => 'SC',
118
+ 'SOUTH DAKOTA' => 'SD',
119
+ 'TENNESSEE' => 'TN',
120
+ 'TEXAS' => 'TX',
121
+ 'UTAH' => 'UT',
122
+ 'VERMONT' => 'VT',
123
+ 'VIRGINIA' => 'VA',
124
+ 'WASHINGTON' => 'WA',
125
+ 'WEST VIRGINIA' => 'WV',
126
+ 'WISCONSIN' => 'WI',
127
+ 'WYOMING' => 'WY'
128
128
  }
129
129
 
130
130
  def self.included(base)
@@ -206,7 +206,7 @@ module ActiveMerchant #:nodoc:
206
206
  end
207
207
 
208
208
  def split_auth(string)
209
- string.split(";")
209
+ string.split(';')
210
210
  end
211
211
 
212
212
  def add_amount(post, money)
@@ -386,8 +386,8 @@ module ActiveMerchant #:nodoc:
386
386
 
387
387
  # Clean up the message text if there is any
388
388
  if results[:messageText]
389
- results[:messageText].gsub!(/<LI>/, "")
390
- results[:messageText].gsub!(/(\.)?<br>/, ". ")
389
+ results[:messageText].gsub!(/<LI>/, '')
390
+ results[:messageText].gsub!(/(\.)?<br>/, '. ')
391
391
  results[:messageText].strip!
392
392
  end
393
393
 
@@ -413,7 +413,7 @@ module ActiveMerchant #:nodoc:
413
413
  response = parse(ssl_post((use_profile_api ? SECURE_PROFILE_URL : self.live_url), data))
414
414
  response[:customer_vault_id] = response[:customerCode] if response[:customerCode]
415
415
  build_response(success?(response), message_from(response), response,
416
- :test => test? || response[:authCode] == "TEST",
416
+ :test => test? || response[:authCode] == 'TEST',
417
417
  :authorization => authorization_from(response),
418
418
  :cvv_result => CVD_CODES[response[:cvdId]],
419
419
  :avs_result => { :code => (AVS_CODES.include? response[:avsId]) ? AVS_CODES[response[:avsId]] : response[:avsId] }
@@ -445,7 +445,7 @@ module ActiveMerchant #:nodoc:
445
445
  if source.is_a?(String) or source.is_a?(Integer)
446
446
  post[:customerCode] = source
447
447
  else
448
- card_brand(source) == "check" ? add_check(post, source) : add_credit_card(post, source)
448
+ card_brand(source) == 'check' ? add_check(post, source) : add_credit_card(post, source)
449
449
  end
450
450
  end
451
451
 
@@ -466,7 +466,7 @@ module ActiveMerchant #:nodoc:
466
466
  params[:vbvEnabled] = '0'
467
467
  params[:scEnabled] = '0'
468
468
 
469
- params.reject{|k, v| v.blank?}.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
469
+ params.reject{|k, v| v.blank?}.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
470
470
  end
471
471
 
472
472
  end
@@ -155,7 +155,7 @@ module ActiveMerchant #:nodoc:
155
155
  # * <tt>options</tt> -- A hash of parameters.
156
156
  def refund(money, identification, options = {})
157
157
  if(identification && !identification.kind_of?(String))
158
- ActiveMerchant.deprecated "refund should only be used to refund a referenced transaction"
158
+ ActiveMerchant.deprecated 'refund should only be used to refund a referenced transaction'
159
159
  return credit(money, identification, options)
160
160
  end
161
161
 
@@ -163,7 +163,7 @@ module ActiveMerchant #:nodoc:
163
163
  post[:PAYMENT_ACCOUNT] = ''
164
164
  post[:MASTER_ID] = identification
165
165
  post[:TRANS_TYPE] = 'REFUND'
166
- post[:NAME1] = (options[:first_name] ? options[:first_name] : "")
166
+ post[:NAME1] = options[:first_name] || ''
167
167
  post[:NAME2] = options[:last_name] if options[:last_name]
168
168
  post[:ZIP] = options[:zip] if options[:zip]
169
169
  add_invoice(post, options)
@@ -174,7 +174,7 @@ module ActiveMerchant #:nodoc:
174
174
 
175
175
  def credit(money, payment_object, options = {})
176
176
  if(payment_object && payment_object.kind_of?(String))
177
- ActiveMerchant.deprecated "credit should only be used to credit a payment method"
177
+ ActiveMerchant.deprecated 'credit should only be used to credit a payment method'
178
178
  return refund(money, payment_object, options)
179
179
  end
180
180
 
@@ -183,7 +183,7 @@ module ActiveMerchant #:nodoc:
183
183
  add_payment_method(post, payment_object)
184
184
  post[:TRANS_TYPE] = 'CREDIT'
185
185
 
186
- post[:NAME1] = (options[:first_name] ? options[:first_name] : "")
186
+ post[:NAME1] = options[:first_name] || ''
187
187
  post[:NAME2] = options[:last_name] if options[:last_name]
188
188
  post[:ZIP] = options[:zip] if options[:zip]
189
189
  add_invoice(post, options)
@@ -347,7 +347,7 @@ module ActiveMerchant #:nodoc:
347
347
  # The bp20api has max one value per form field.
348
348
  response_fields = Hash[CGI::parse(body).map{|k,v| [k.upcase,v.first]}]
349
349
 
350
- if response_fields.include? "REBILL_ID"
350
+ if response_fields.include? 'REBILL_ID'
351
351
  return parse_recurring(response_fields)
352
352
  end
353
353
 
@@ -378,12 +378,12 @@ module ActiveMerchant #:nodoc:
378
378
  else
379
379
  message = message.chomp('.')
380
380
  end
381
- elsif message == "Missing ACCOUNT_ID"
382
- message = "The merchant login ID or password is invalid"
381
+ elsif message == 'Missing ACCOUNT_ID'
382
+ message = 'The merchant login ID or password is invalid'
383
383
  elsif message =~ /Approved/
384
- message = "This transaction has been approved"
384
+ message = 'This transaction has been approved'
385
385
  elsif message =~ /Expired/
386
- message = "The credit card has expired"
386
+ message = 'The credit card has expired'
387
387
  end
388
388
  message
389
389
  end
@@ -418,13 +418,13 @@ module ActiveMerchant #:nodoc:
418
418
  end
419
419
 
420
420
  CHECK_ACCOUNT_TYPES = {
421
- "checking" => "C",
422
- "savings" => "S"
421
+ 'checking' => 'C',
422
+ 'savings' => 'S'
423
423
  }
424
424
 
425
425
  def add_check(post, check)
426
426
  post[:PAYMENT_TYPE] = 'ACH'
427
- post[:PAYMENT_ACCOUNT] = [CHECK_ACCOUNT_TYPES[check.account_type], check.routing_number, check.account_number].join(":")
427
+ post[:PAYMENT_ACCOUNT] = [CHECK_ACCOUNT_TYPES[check.account_type], check.routing_number, check.account_number].join(':')
428
428
  post[:NAME1] = check.first_name
429
429
  post[:NAME2] = check.last_name
430
430
  end
@@ -465,15 +465,15 @@ module ActiveMerchant #:nodoc:
465
465
  post[:version] = '1'
466
466
  post[:login] = ''
467
467
  post[:tran_key] = ''
468
- post[:relay_response] = "FALSE"
468
+ post[:relay_response] = 'FALSE'
469
469
  post[:type] = action
470
- post[:delim_data] = "TRUE"
471
- post[:delim_char] = ","
472
- post[:encap_char] = "$"
470
+ post[:delim_data] = 'TRUE'
471
+ post[:delim_char] = ','
472
+ post[:encap_char] = '$'
473
473
  post[:card_num] = '4111111111111111'
474
474
  post[:exp_date] = '1212'
475
475
  post[:solution_ID] = application_id if application_id
476
- post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
476
+ post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
477
477
  end
478
478
 
479
479
  def expdate(creditcard)
@@ -494,7 +494,7 @@ module ActiveMerchant #:nodoc:
494
494
  post[:MASTER_ID],
495
495
  post[:NAME1],
496
496
  post[:PAYMENT_ACCOUNT]
497
- ].join("")
497
+ ].join('')
498
498
  )
499
499
  end
500
500
 
@@ -505,7 +505,7 @@ module ActiveMerchant #:nodoc:
505
505
  @options[:login],
506
506
  post[:TRANS_TYPE],
507
507
  post[:REBILL_ID]
508
- ].join("")
508
+ ].join('')
509
509
  )
510
510
  end
511
511
 
@@ -3,8 +3,8 @@ require 'nokogiri'
3
3
  module ActiveMerchant
4
4
  module Billing
5
5
  class BlueSnapGateway < Gateway
6
- self.test_url = "https://sandbox.bluesnap.com/services/2"
7
- self.live_url = "https://ws.bluesnap.com/services/2"
6
+ self.test_url = 'https://sandbox.bluesnap.com/services/2'
7
+ self.live_url = 'https://ws.bluesnap.com/services/2'
8
8
  self.supported_countries = %w(US CA GB AT BE BG HR CY CZ DK EE FI FR DE GR HU IE IT LV LT LU MT NL PL PT RO SK SI ES SE)
9
9
 
10
10
  self.default_currency = 'USD'
@@ -14,11 +14,11 @@ module ActiveMerchant
14
14
  self.display_name = 'BlueSnap'
15
15
 
16
16
  TRANSACTIONS = {
17
- purchase: "AUTH_CAPTURE",
18
- authorize: "AUTH_ONLY",
19
- capture: "CAPTURE",
20
- void: "AUTH_REVERSAL",
21
- refund: "REFUND"
17
+ purchase: 'AUTH_CAPTURE',
18
+ authorize: 'AUTH_ONLY',
19
+ capture: 'CAPTURE',
20
+ void: 'AUTH_REVERSAL',
21
+ refund: 'REFUND'
22
22
  }
23
23
 
24
24
  CVC_CODE_TRANSLATOR = {
@@ -105,8 +105,8 @@ module ActiveMerchant
105
105
  def store(credit_card, options = {})
106
106
  commit(:store) do |doc|
107
107
  add_personal_info(doc, credit_card, options)
108
- doc.send("payment-sources") do
109
- doc.send("credit-card-info") do
108
+ doc.send('payment-sources') do
109
+ doc.send('credit-card-info') do
110
110
  add_credit_card(doc, credit_card)
111
111
  end
112
112
  end
@@ -138,17 +138,17 @@ module ActiveMerchant
138
138
  private
139
139
 
140
140
  def add_auth_purchase(doc, money, payment_method, options)
141
- doc.send("recurring-transaction", options[:recurring] ? "RECURRING" : "ECOMMERCE")
141
+ doc.send('recurring-transaction', options[:recurring] ? 'RECURRING' : 'ECOMMERCE')
142
142
  add_order(doc, options)
143
143
  add_amount(doc, money, options)
144
- doc.send("transaction-fraud-info") do
145
- doc.send("shopper-ip-address", options[:ip]) if options[:ip]
144
+ doc.send('transaction-fraud-info') do
145
+ doc.send('shopper-ip-address', options[:ip]) if options[:ip]
146
146
  end
147
147
 
148
148
  if payment_method.is_a?(String)
149
- doc.send("vaulted-shopper-id", payment_method)
149
+ doc.send('vaulted-shopper-id', payment_method)
150
150
  else
151
- doc.send("card-holder-info") do
151
+ doc.send('card-holder-info') do
152
152
  add_personal_info(doc, payment_method, options)
153
153
  end
154
154
  add_credit_card(doc, payment_method)
@@ -161,34 +161,34 @@ module ActiveMerchant
161
161
  end
162
162
 
163
163
  def add_personal_info(doc, credit_card, options)
164
- doc.send("first-name", credit_card.first_name)
165
- doc.send("last-name", credit_card.last_name)
164
+ doc.send('first-name', credit_card.first_name)
165
+ doc.send('last-name', credit_card.last_name)
166
166
  doc.email(options[:email]) if options[:email]
167
167
  add_address(doc, options)
168
168
  end
169
169
 
170
170
  def add_credit_card(doc, card)
171
- doc.send("credit-card") do
172
- doc.send("card-number", card.number)
173
- doc.send("security-code", card.verification_value)
174
- doc.send("expiration-month", card.month)
175
- doc.send("expiration-year", card.year)
171
+ doc.send('credit-card') do
172
+ doc.send('card-number', card.number)
173
+ doc.send('security-code', card.verification_value)
174
+ doc.send('expiration-month', card.month)
175
+ doc.send('expiration-year', card.year)
176
176
  end
177
177
  end
178
178
 
179
179
  def add_description(doc, description)
180
- doc.send("transaction-meta-data") do
181
- doc.send("meta-data") do
182
- doc.send("meta-key", "description")
183
- doc.send("meta-value", truncate(description, 500))
184
- doc.send("meta-description", "Description")
180
+ doc.send('transaction-meta-data') do
181
+ doc.send('meta-data') do
182
+ doc.send('meta-key', 'description')
183
+ doc.send('meta-value', truncate(description, 500))
184
+ doc.send('meta-description', 'Description')
185
185
  end
186
186
  end
187
187
  end
188
188
 
189
189
  def add_order(doc, options)
190
- doc.send("merchant-transaction-id", truncate(options[:order_id], 50)) if options[:order_id]
191
- doc.send("soft-descriptor", options[:soft_descriptor]) if options[:soft_descriptor]
190
+ doc.send('merchant-transaction-id', truncate(options[:order_id], 50)) if options[:order_id]
191
+ doc.send('soft-descriptor', options[:soft_descriptor]) if options[:soft_descriptor]
192
192
  add_description(doc, options[:description]) if options[:description]
193
193
  end
194
194
 
@@ -204,7 +204,7 @@ module ActiveMerchant
204
204
  end
205
205
 
206
206
  def add_authorization(doc, authorization)
207
- doc.send("transaction-id", authorization)
207
+ doc.send('transaction-id', authorization)
208
208
  end
209
209
 
210
210
  def parse(response)
@@ -222,7 +222,7 @@ module ActiveMerchant
222
222
  end
223
223
  end
224
224
 
225
- parsed["content-location-header"] = response['content-location']
225
+ parsed['content-location-header'] = response['content-location']
226
226
  parsed
227
227
  end
228
228
 
@@ -262,12 +262,12 @@ module ActiveMerchant
262
262
 
263
263
  def url(action = nil)
264
264
  base = test? ? test_url : live_url
265
- resource = (action == :store) ? "vaulted-shoppers" : "transactions"
265
+ resource = (action == :store) ? 'vaulted-shoppers' : 'transactions'
266
266
  "#{base}/#{resource}"
267
267
  end
268
268
 
269
269
  def cvv_result(parsed)
270
- CVVResult.new(CVC_CODE_TRANSLATOR[parsed["cvv-response-code"]])
270
+ CVVResult.new(CVC_CODE_TRANSLATOR[parsed['cvv-response-code']])
271
271
  end
272
272
 
273
273
  def avs_result(parsed)
@@ -283,31 +283,31 @@ module ActiveMerchant
283
283
  end
284
284
 
285
285
  def message_from(succeeded, parsed_response)
286
- return "Success" if succeeded
287
- parsed_response["description"]
286
+ return 'Success' if succeeded
287
+ parsed_response['description']
288
288
  end
289
289
 
290
290
  def authorization_from(action, parsed_response)
291
- (action == :store) ? vaulted_shopper_id(parsed_response) : parsed_response["transaction-id"]
291
+ (action == :store) ? vaulted_shopper_id(parsed_response) : parsed_response['transaction-id']
292
292
  end
293
293
 
294
294
  def vaulted_shopper_id(parsed_response)
295
- return nil unless parsed_response["content-location-header"]
296
- parsed_response["content-location-header"].split("/").last
295
+ return nil unless parsed_response['content-location-header']
296
+ parsed_response['content-location-header'].split('/').last
297
297
  end
298
298
 
299
299
  def error_code_from(parsed_response)
300
- parsed_response["code"]
300
+ parsed_response['code']
301
301
  end
302
302
 
303
303
  def root_attributes
304
304
  {
305
- xmlns: "http://ws.plimus.com"
305
+ xmlns: 'http://ws.plimus.com'
306
306
  }
307
307
  end
308
308
 
309
309
  def root_element(action)
310
- (action == :store) ? "vaulted-shopper" : "card-transaction"
310
+ (action == :store) ? 'vaulted-shopper' : 'card-transaction'
311
311
  end
312
312
 
313
313
  def headers
@@ -320,7 +320,7 @@ module ActiveMerchant
320
320
  def build_xml_request(action)
321
321
  builder = Nokogiri::XML::Builder.new
322
322
  builder.__send__(root_element(action), root_attributes) do |doc|
323
- doc.send("card-transaction-type", TRANSACTIONS[action]) if TRANSACTIONS[action]
323
+ doc.send('card-transaction-type', TRANSACTIONS[action]) if TRANSACTIONS[action]
324
324
  yield(doc)
325
325
  end
326
326
  builder.doc.root.to_xml
@@ -336,7 +336,7 @@ module ActiveMerchant
336
336
  end
337
337
 
338
338
  def bad_authentication_response
339
- { "description" => "Unable to authenticate. Please check your credentials." }
339
+ { 'description' => 'Unable to authenticate. Please check your credentials.' }
340
340
  end
341
341
  end
342
342
  end