activemerchant 1.56.0 → 1.66.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +331 -0
  3. data/README.md +9 -9
  4. data/lib/active_merchant/billing/check.rb +3 -0
  5. data/lib/active_merchant/billing/credit_card.rb +8 -3
  6. data/lib/active_merchant/billing/credit_card_methods.rb +41 -1
  7. data/lib/active_merchant/billing/gateway.rb +14 -6
  8. data/lib/active_merchant/billing/gateways/adyen.rb +228 -0
  9. data/lib/active_merchant/billing/gateways/authorize_net.rb +157 -44
  10. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +7 -4
  11. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +283 -0
  12. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +68 -2
  13. data/lib/active_merchant/billing/gateways/blue_pay.rb +2 -2
  14. data/lib/active_merchant/billing/gateways/blue_snap.rb +348 -0
  15. data/lib/active_merchant/billing/gateways/bpoint.rb +1 -1
  16. data/lib/active_merchant/billing/gateways/braintree_blue.rb +58 -20
  17. data/lib/active_merchant/billing/gateways/bridge_pay.rb +37 -8
  18. data/lib/active_merchant/billing/gateways/card_stream.rb +161 -40
  19. data/lib/active_merchant/billing/gateways/cashnet.rb +1 -0
  20. data/lib/active_merchant/billing/gateways/checkout_v2.rb +5 -2
  21. data/lib/active_merchant/billing/gateways/citrus_pay.rb +24 -0
  22. data/lib/active_merchant/billing/gateways/clearhaus.rb +24 -40
  23. data/lib/active_merchant/billing/gateways/conekta.rb +6 -1
  24. data/lib/active_merchant/billing/gateways/creditcall.rb +1 -1
  25. data/lib/active_merchant/billing/gateways/credorax.rb +310 -0
  26. data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
  27. data/lib/active_merchant/billing/gateways/cyber_source.rb +80 -64
  28. data/lib/active_merchant/billing/gateways/data_cash.rb +10 -304
  29. data/lib/active_merchant/billing/gateways/digitzs.rb +292 -0
  30. data/lib/active_merchant/billing/gateways/elavon.rb +40 -26
  31. data/lib/active_merchant/billing/gateways/element.rb +356 -0
  32. data/lib/active_merchant/billing/gateways/fat_zebra.rb +16 -2
  33. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +6 -1
  34. data/lib/active_merchant/billing/gateways/forte.rb +10 -2
  35. data/lib/active_merchant/billing/gateways/global_collect.rb +311 -0
  36. data/lib/active_merchant/billing/gateways/global_transport.rb +1 -0
  37. data/lib/active_merchant/billing/gateways/iats_payments.rb +13 -0
  38. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
  39. data/lib/active_merchant/billing/gateways/iveri.rb +251 -0
  40. data/lib/active_merchant/billing/gateways/jetpay.rb +33 -19
  41. data/lib/active_merchant/billing/gateways/kushki.rb +217 -0
  42. data/lib/active_merchant/billing/gateways/latitude19.rb +416 -0
  43. data/lib/active_merchant/billing/gateways/linkpoint.rb +2 -0
  44. data/lib/active_merchant/billing/gateways/litle.rb +29 -13
  45. data/lib/active_merchant/billing/gateways/mastercard.rb +268 -0
  46. data/lib/active_merchant/billing/gateways/maxipago.rb +145 -122
  47. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +15 -1
  48. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +10 -7
  49. data/lib/active_merchant/billing/gateways/mercury.rb +13 -5
  50. data/lib/active_merchant/billing/gateways/metrics_global.rb +1 -1
  51. data/lib/active_merchant/billing/gateways/migs.rb +23 -1
  52. data/lib/active_merchant/billing/gateways/monei.rb +1 -1
  53. data/lib/active_merchant/billing/gateways/moneris.rb +21 -1
  54. data/lib/active_merchant/billing/gateways/nab_transact.rb +12 -0
  55. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +165 -0
  56. data/lib/active_merchant/billing/gateways/netbanx.rb +245 -0
  57. data/lib/active_merchant/billing/gateways/nmi.rb +30 -9
  58. data/lib/active_merchant/billing/gateways/omise.rb +9 -5
  59. data/lib/active_merchant/billing/gateways/openpay.rb +10 -1
  60. data/lib/active_merchant/billing/gateways/opp.rb +362 -0
  61. data/lib/active_merchant/billing/gateways/orbital.rb +28 -7
  62. data/lib/active_merchant/billing/gateways/pagarme.rb +248 -0
  63. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +190 -0
  64. data/lib/active_merchant/billing/gateways/payeezy.rb +61 -12
  65. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -1
  66. data/lib/active_merchant/billing/gateways/payflow.rb +6 -0
  67. data/lib/active_merchant/billing/gateways/payment_express.rb +1 -1
  68. data/lib/active_merchant/billing/gateways/paymill.rb +29 -11
  69. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +1 -1
  70. data/lib/active_merchant/billing/gateways/paypal_express.rb +1 -6
  71. data/lib/active_merchant/billing/gateways/payu_in.rb +3 -2
  72. data/lib/active_merchant/billing/gateways/payu_latam.rb +402 -0
  73. data/lib/active_merchant/billing/gateways/pin.rb +6 -3
  74. data/lib/active_merchant/billing/gateways/pro_pay.rb +326 -0
  75. data/lib/active_merchant/billing/gateways/psl_card.rb +3 -3
  76. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +1 -1
  77. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +0 -2
  78. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -1
  79. data/lib/active_merchant/billing/gateways/quickpay.rb +3 -3
  80. data/lib/active_merchant/billing/gateways/qvalent.rb +44 -1
  81. data/lib/active_merchant/billing/gateways/redsys.rb +3 -0
  82. data/lib/active_merchant/billing/gateways/s5.rb +8 -5
  83. data/lib/active_merchant/billing/gateways/safe_charge.rb +220 -0
  84. data/lib/active_merchant/billing/gateways/sage.rb +397 -128
  85. data/lib/active_merchant/billing/gateways/sage_pay.rb +45 -20
  86. data/lib/active_merchant/billing/gateways/secure_net.rb +0 -5
  87. data/lib/active_merchant/billing/gateways/secure_pay.rb +1 -1
  88. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +12 -0
  89. data/lib/active_merchant/billing/gateways/securion_pay.rb +46 -17
  90. data/lib/active_merchant/billing/gateways/stripe.rb +125 -29
  91. data/lib/active_merchant/billing/gateways/telr.rb +275 -0
  92. data/lib/active_merchant/billing/gateways/tns.rb +13 -222
  93. data/lib/active_merchant/billing/gateways/trans_first.rb +40 -16
  94. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +606 -0
  95. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +114 -9
  96. data/lib/active_merchant/billing/gateways/vanco.rb +14 -10
  97. data/lib/active_merchant/billing/gateways/visanet_peru.rb +209 -0
  98. data/lib/active_merchant/billing/gateways/wepay.rb +73 -38
  99. data/lib/active_merchant/billing/gateways/wirecard.rb +1 -0
  100. data/lib/active_merchant/billing/gateways/world_net.rb +344 -0
  101. data/lib/active_merchant/billing/gateways/worldpay.rb +48 -16
  102. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +15 -0
  103. data/lib/active_merchant/country.rb +6 -4
  104. data/lib/active_merchant/posts_data.rb +1 -1
  105. data/lib/active_merchant/version.rb +1 -1
  106. metadata +32 -13
  107. data/lib/active_merchant/billing/gateways/app55.rb +0 -176
  108. data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
  109. data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -278
  110. data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -89
  111. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -115
  112. data/lib/active_merchant/billing/gateways/sage/sage_vault.rb +0 -149
  113. data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -97
@@ -0,0 +1,283 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class BarclaycardSmartpayGateway < Gateway
4
+ self.test_url = 'https://pal-test.barclaycardsmartpay.com/pal/servlet'
5
+ self.live_url = 'https://pal-live.barclaycardsmartpay.com/pal/servlet'
6
+
7
+ self.supported_countries = ['AL', 'AD', 'AM', 'AT', 'AZ', 'BY', 'BE', 'BA', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'GE', 'DE', 'GR', 'HU', 'IS', 'IE', 'IT', 'KZ', 'LV', 'LI', 'LT', 'LU', 'MK', 'MT', 'MD', 'MC', 'ME', 'NL', 'NO', 'PL', 'PT', 'RO', 'RU', 'SM', 'RS', 'SK', 'SI', 'ES', 'SE', 'CH', 'TR', 'UA', 'GB', 'VA']
8
+ self.default_currency = 'EUR'
9
+ self.money_format = :cents
10
+ self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb, :dankort, :maestro]
11
+
12
+ self.homepage_url = 'https://www.barclaycardsmartpay.com/'
13
+ self.display_name = 'Barclaycard Smartpay'
14
+
15
+ def initialize(options = {})
16
+ requires!(options, :company, :merchant, :password)
17
+ super
18
+ end
19
+
20
+ def purchase(money, creditcard, options = {})
21
+ requires!(options, :order_id)
22
+
23
+ MultiResponse.run do |r|
24
+ r.process { authorize(money, creditcard, options) }
25
+ r.process { capture(money, r.authorization, options) }
26
+ end
27
+ end
28
+
29
+ def authorize(money, creditcard, options = {})
30
+ requires!(options, :order_id)
31
+
32
+ post = payment_request(money, options)
33
+ post[:amount] = amount_hash(money, options[:currency])
34
+ post[:card] = credit_card_hash(creditcard)
35
+
36
+ if address = (options[:billing_address] || options[:address])
37
+ post[:billingAddress] = address_hash(address)
38
+ end
39
+
40
+ if options[:shipping_address]
41
+ post[:deliveryAddress] = address_hash(options[:shipping_address])
42
+ end
43
+
44
+ commit('authorise', post)
45
+ end
46
+
47
+ def capture(money, authorization, options = {})
48
+ requires!(options, :order_id)
49
+
50
+ post = modification_request(authorization, options)
51
+ post[:modificationAmount] = amount_hash(money, options[:currency])
52
+
53
+ commit('capture', post)
54
+ end
55
+
56
+ def refund(money, authorization, options = {})
57
+ requires!(options, :order_id)
58
+
59
+ post = modification_request(authorization, options)
60
+ post[:modificationAmount] = amount_hash(money, options[:currency])
61
+
62
+ commit('refund', post)
63
+ end
64
+
65
+ def credit(money, creditcard, options = {})
66
+ post = payment_request(money, options)
67
+ post[:amount] = amount_hash(money, options[:currency])
68
+ post[:card] = credit_card_hash(creditcard)
69
+
70
+ commit('refundWithData', post)
71
+ end
72
+
73
+ def void(identification, options = {})
74
+ requires!(options, :order_id)
75
+
76
+ post = modification_request(identification, options)
77
+
78
+ commit('cancel', post)
79
+ end
80
+
81
+ def verify(creditcard, options = {})
82
+ authorize(0, creditcard, options)
83
+ end
84
+
85
+ def store(creditcard, options = {})
86
+ post = store_request(options)
87
+ post[:card] = credit_card_hash(creditcard)
88
+ post[:recurring] = {:contract => 'RECURRING'}
89
+
90
+ commit('store', post)
91
+ end
92
+
93
+ def supports_scrubbing?
94
+ true
95
+ end
96
+
97
+ def scrub(transcript)
98
+ transcript.
99
+ gsub(%r(((?:\r\n)?Authorization: Basic )[^\r\n]+(\r\n)?), '\1[FILTERED]').
100
+ gsub(%r((card.number=)\d+), '\1[FILTERED]').
101
+ gsub(%r((card.cvc=)\d+), '\1[FILTERED]')
102
+ end
103
+
104
+ private
105
+
106
+ # Smartpay may return AVS codes not covered by standard AVSResult codes.
107
+ # Smartpay's descriptions noted below.
108
+ AVS_MAPPING = {
109
+ '0' => 'R', # Unknown
110
+ '1' => 'A', # Address matches, postal code doesn't
111
+ '2' => 'N', # Neither postal code nor address match
112
+ '3' => 'R', # AVS unavailable
113
+ '4' => 'E', # AVS not supported for this card type
114
+ '5' => 'U', # No AVS data provided
115
+ '6' => 'Z', # Postal code matches, address doesn't match
116
+ '7' => 'D', # Both postal code and address match
117
+ '8' => 'U', # Address not checked, postal code unknown
118
+ '9' => 'B', # Address matches, postal code unknown
119
+ '10' => 'N', # Address doesn't match, postal code unknown
120
+ '11' => 'U', # Postal code not checked, address unknown
121
+ '12' => 'B', # Address matches, postal code not checked
122
+ '13' => 'U', # Address doesn't match, postal code not checked
123
+ '14' => 'P', # Postal code matches, address unknown
124
+ '15' => 'P', # Postal code matches, address not checked
125
+ '16' => 'N', # Postal code doesn't match, address unknown
126
+ '17' => 'U', # Postal code doesn't match, address not checked
127
+ '18' => 'I' # Neither postal code nor address were checked
128
+ }
129
+
130
+ def commit(action, post)
131
+ request = post_data(flatten_hash(post))
132
+ raw_response = ssl_post(build_url(action), request, headers)
133
+ response = parse(raw_response)
134
+
135
+ Response.new(
136
+ success_from(response),
137
+ message_from(response),
138
+ response,
139
+ test: test?,
140
+ avs_result: AVSResult.new(:code => parse_avs_code(response)),
141
+ authorization: response['recurringDetailReference'] || response['pspReference']
142
+ )
143
+
144
+ rescue ResponseError => e
145
+ case e.response.code
146
+ when '401'
147
+ return Response.new(false, 'Invalid credentials', {}, :test => test?)
148
+ when '403'
149
+ return Response.new(false, 'Not allowed', {}, :test => test?)
150
+ when '422'
151
+ return Response.new(false, 'Unprocessable Entity', {}, :test => test?)
152
+ when '500'
153
+ if e.response.body.split(' ')[0] == 'validation'
154
+ return Response.new(false, e.response.body.split(' ', 3)[2], {}, :test => test?)
155
+ end
156
+ end
157
+ raise
158
+ end
159
+
160
+ def parse_avs_code(response)
161
+ AVS_MAPPING[response["avsResult"][0..1].strip] if response["avsResult"]
162
+ end
163
+
164
+ def flatten_hash(hash, prefix = nil)
165
+ flat_hash = {}
166
+ hash.each_pair do |key, val|
167
+ conc_key = prefix.nil? ? key : "#{prefix}.#{key}"
168
+ if val.is_a?(Hash)
169
+ flat_hash.merge!(flatten_hash(val, conc_key))
170
+ else
171
+ flat_hash[conc_key] = val
172
+ end
173
+ end
174
+ flat_hash
175
+ end
176
+
177
+ def headers
178
+ {
179
+ 'Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8',
180
+ 'Authorization' => 'Basic ' + Base64.strict_encode64("ws@Company.#{@options[:company]}:#{@options[:password]}").strip
181
+ }
182
+ end
183
+
184
+ def parse(response)
185
+ Hash[
186
+ response.split('&').map do |x|
187
+ key, val = x.split('=', 2)
188
+ [key.split('.').last, CGI.unescape(val)]
189
+ end
190
+ ]
191
+ end
192
+
193
+ def post_data(data)
194
+ data.map do |key, val|
195
+ "#{key}=#{CGI.escape(val.to_s)}"
196
+ end.reduce do |x, y|
197
+ "#{x}&#{y}"
198
+ end
199
+ end
200
+
201
+ def message_from(response)
202
+ return response['resultCode'] if response.has_key?('resultCode') # Payment request
203
+ return response['response'] if response['response'] # Modification request
204
+ return response['result'] if response.has_key?('result') # Store/Recurring request
205
+ 'Failure' # Negative fallback in case of error
206
+ end
207
+
208
+ def success_from(response)
209
+ return true if response.has_key?('authCode')
210
+ return true if response['result'] == 'Success'
211
+ return true if response['resultCode'] == 'Received'
212
+ successful_responses = %w([capture-received] [cancel-received] [refund-received])
213
+ successful_responses.include?(response['response'])
214
+ end
215
+
216
+ def build_url(action)
217
+ case action
218
+ when 'store'
219
+ "#{test? ? self.test_url : self.live_url}/Recurring/v12/storeToken"
220
+ else
221
+ "#{test? ? self.test_url : self.live_url}/Payment/v12/#{action}"
222
+ end
223
+ end
224
+
225
+ def address_hash(address)
226
+ full_address = "#{address[:address1]} #{address[:address2]}" if address
227
+ street = address[:street] if address[:street]
228
+ house = address[:houseNumberOrName] if address[:houseNumberOrName]
229
+
230
+ hash = {}
231
+ hash[:city] = address[:city] if address[:city]
232
+ hash[:street] = street || full_address.split(/\s+/).keep_if { |x| x !~ /\d/ }.join(' ')
233
+ hash[:houseNumberOrName] = house || full_address.split(/\s+/).keep_if { |x| x =~ /\d/ }.join(' ')
234
+ hash[:postalCode] = address[:zip] if address[:zip]
235
+ hash[:stateOrProvince] = address[:state] if address[:state]
236
+ hash[:country] = address[:country] if address[:country]
237
+ hash
238
+ end
239
+
240
+ def amount_hash(money, currency)
241
+ hash = {}
242
+ hash[:currency] = currency || currency(money)
243
+ hash[:value] = amount(money) if money
244
+ hash
245
+ end
246
+
247
+ def credit_card_hash(creditcard)
248
+ hash = {}
249
+ hash[:cvc] = creditcard.verification_value if creditcard.verification_value
250
+ hash[:expiryMonth] = format(creditcard.month, :two_digits) if creditcard.month
251
+ hash[:expiryYear] = format(creditcard.year, :four_digits) if creditcard.year
252
+ hash[:holderName] = creditcard.name if creditcard.name
253
+ hash[:number] = creditcard.number if creditcard.number
254
+ hash
255
+ end
256
+
257
+ def modification_request(reference, options)
258
+ hash = {}
259
+ hash[:merchantAccount] = @options[:merchant]
260
+ hash[:originalReference] = reference if reference
261
+ hash.keep_if { |_, v| v }
262
+ end
263
+
264
+ def payment_request(money, options)
265
+ hash = {}
266
+ hash[:merchantAccount] = @options[:merchant]
267
+ hash[:reference] = options[:order_id] if options[:order_id]
268
+ hash[:shopperEmail] = options[:email] if options[:email]
269
+ hash[:shopperIP] = options[:ip] if options[:ip]
270
+ hash[:shopperReference] = options[:customer] if options[:customer]
271
+ hash.keep_if { |_, v| v }
272
+ end
273
+
274
+ def store_request(options)
275
+ hash = {}
276
+ hash[:merchantAccount] = @options[:merchant]
277
+ hash[:shopperEmail] = options[:email] if options[:email]
278
+ hash[:shopperReference] = options[:customer] if options[:customer]
279
+ hash.keep_if { |_, v| v }
280
+ end
281
+ end
282
+ end
283
+ end
@@ -59,6 +59,72 @@ module ActiveMerchant #:nodoc:
59
59
  :cancel => 'C'
60
60
  }
61
61
 
62
+ STATES = {
63
+ "ALBERTA" => "AB",
64
+ "BRITISH COLUMBIA" => "BC",
65
+ "MANITOBA" => "MB",
66
+ "NEW BRUNSWICK" => "NB",
67
+ "NEWFOUNDLAND AND LABRADOR" => "NL",
68
+ "NOVA SCOTIA" => "NS",
69
+ "ONTARIO" => "ON",
70
+ "PRINCE EDWARD ISLAND" => "PE",
71
+ "QUEBEC" => "QC",
72
+ "SASKATCHEWAN" => "SK",
73
+ "NORTHWEST TERRITORIES" => "NT",
74
+ "NUNAVUT" => "NU",
75
+ "YUKON" => "YT",
76
+ "ALABAMA" => "AL",
77
+ "ALASKA" => "AK",
78
+ "ARIZONA" => "AZ",
79
+ "ARKANSAS" => "AR",
80
+ "CALIFORNIA" => "CA",
81
+ "COLORADO" => "CO",
82
+ "CONNECTICUT" => "CT",
83
+ "DELAWARE" => "DE",
84
+ "FLORIDA" => "FL",
85
+ "GEORGIA" => "GA",
86
+ "HAWAII" => "HI",
87
+ "IDAHO" => "ID",
88
+ "ILLINOIS" => "IL",
89
+ "INDIANA" => "IN",
90
+ "IOWA" => "IA",
91
+ "KANSAS" => "KS",
92
+ "KENTUCKY" => "KY",
93
+ "LOUISIANA" => "LA",
94
+ "MAINE" => "ME",
95
+ "MARYLAND" => "MD",
96
+ "MASSACHUSETTS" => "MA",
97
+ "MICHIGAN" => "MI",
98
+ "MINNESOTA" => "MN",
99
+ "MISSISSIPPI" => "MS",
100
+ "MISSOURI" => "MO",
101
+ "MONTANA" => "MT",
102
+ "NEBRASKA" => "NE",
103
+ "NEVADA" => "NV",
104
+ "NEW HAMPSHIRE" => "NH",
105
+ "NEW JERSEY" => "NJ",
106
+ "NEW MEXICO" => "NM",
107
+ "NEW YORK" => "NY",
108
+ "NORTH CAROLINA" => "NC",
109
+ "NORTH DAKOTA" => "ND",
110
+ "OHIO" => "OH",
111
+ "OKLAHOMA" => "OK",
112
+ "OREGON" => "OR",
113
+ "PENNSYLVANIA" => "PA",
114
+ "RHODE ISLAND" => "RI",
115
+ "SOUTH CAROLINA" => "SC",
116
+ "SOUTH DAKOTA" => "SD",
117
+ "TENNESSEE" => "TN",
118
+ "TEXAS" => "TX",
119
+ "UTAH" => "UT",
120
+ "VERMONT" => "VT",
121
+ "VIRGINIA" => "VA",
122
+ "WASHINGTON" => "WA",
123
+ "WEST VIRGINIA" => "WV",
124
+ "WISCONSIN" => "WI",
125
+ "WYOMING" => "WY"
126
+ }
127
+
62
128
  def self.included(base)
63
129
  base.default_currency = 'CAD'
64
130
 
@@ -161,7 +227,7 @@ module ActiveMerchant #:nodoc:
161
227
  post[:ordAddress1] = billing_address[:address1]
162
228
  post[:ordAddress2] = billing_address[:address2]
163
229
  post[:ordCity] = billing_address[:city]
164
- post[:ordProvince] = billing_address[:state]
230
+ post[:ordProvince] = STATES[billing_address[:state].upcase] || billing_address[:state] if billing_address[:state]
165
231
  post[:ordPostalCode] = billing_address[:zip]
166
232
  post[:ordCountry] = billing_address[:country]
167
233
  end
@@ -172,7 +238,7 @@ module ActiveMerchant #:nodoc:
172
238
  post[:shipAddress1] = shipping_address[:address1]
173
239
  post[:shipAddress2] = shipping_address[:address2]
174
240
  post[:shipCity] = shipping_address[:city]
175
- post[:shipProvince] = shipping_address[:state]
241
+ post[:shipProvince] = STATES[shipping_address[:state].upcase] || shipping_address[:state] if shipping_address[:state]
176
242
  post[:shipPostalCode] = shipping_address[:zip]
177
243
  post[:shipCountry] = shipping_address[:country]
178
244
  post[:shippingMethod] = shipping_address[:shipping_method]
@@ -43,7 +43,7 @@ module ActiveMerchant #:nodoc:
43
43
  'USUAL_DATE' => :undoc_usual_date, # Not found in the bp20rebadmin API doc.
44
44
  }
45
45
 
46
- self.supported_countries = ['US']
46
+ self.supported_countries = ['US', 'CA']
47
47
  self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
48
48
  self.homepage_url = 'http://www.bluepay.com/'
49
49
  self.display_name = 'BluePay'
@@ -472,7 +472,7 @@ module ActiveMerchant #:nodoc:
472
472
  post[:encap_char] = "$"
473
473
  post[:card_num] = '4111111111111111'
474
474
  post[:exp_date] = '1212'
475
- post[:solution_ID] = application_id if(application_id && application_id != "ActiveMerchant")
475
+ post[:solution_ID] = application_id if application_id
476
476
  post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
477
477
  end
478
478