activemerchant 1.78.0 → 1.79.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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +49 -0
  3. data/lib/active_merchant.rb +2 -5
  4. data/lib/active_merchant/billing/credit_card_methods.rb +3 -1
  5. data/lib/active_merchant/billing/gateways/adyen.rb +17 -2
  6. data/lib/active_merchant/billing/gateways/authorize_net.rb +16 -11
  7. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +1 -0
  8. data/lib/active_merchant/billing/gateways/borgun.rb +0 -1
  9. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +1 -0
  10. data/lib/active_merchant/billing/gateways/braintree_blue.rb +17 -4
  11. data/lib/active_merchant/billing/gateways/checkout_v2.rb +7 -0
  12. data/lib/active_merchant/billing/gateways/clearhaus.rb +0 -2
  13. data/lib/active_merchant/billing/gateways/cyber_source.rb +11 -2
  14. data/lib/active_merchant/billing/gateways/ebanx.rb +3 -3
  15. data/lib/active_merchant/billing/gateways/elavon.rb +1 -1
  16. data/lib/active_merchant/billing/gateways/first_pay.rb +10 -9
  17. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +11 -0
  18. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +12 -0
  19. data/lib/active_merchant/billing/gateways/migs.rb +0 -2
  20. data/lib/active_merchant/billing/gateways/mundipagg.rb +291 -0
  21. data/lib/active_merchant/billing/gateways/nab_transact.rb +4 -4
  22. data/lib/active_merchant/billing/gateways/paymentez.rb +6 -13
  23. data/lib/active_merchant/billing/gateways/paypal.rb +0 -12
  24. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +14 -0
  25. data/lib/active_merchant/billing/gateways/paystation.rb +10 -0
  26. data/lib/active_merchant/billing/gateways/psigate.rb +11 -0
  27. data/lib/active_merchant/billing/gateways/qbms.rb +11 -0
  28. data/lib/active_merchant/billing/gateways/realex.rb +14 -1
  29. data/lib/active_merchant/billing/gateways/redsys.rb +1 -1
  30. data/lib/active_merchant/billing/gateways/safe_charge.rb +8 -4
  31. data/lib/active_merchant/billing/gateways/smart_ps.rb +1 -1
  32. data/lib/active_merchant/billing/gateways/spreedly_core.rb +41 -6
  33. data/lib/active_merchant/billing/gateways/stripe.rb +14 -4
  34. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +6 -1
  35. data/lib/active_merchant/billing/gateways/worldpay.rb +45 -14
  36. data/lib/active_merchant/connection.rb +38 -9
  37. data/lib/active_merchant/net_http_ssl_connection.rb +9 -0
  38. data/lib/active_merchant/network_connection_retries.rb +2 -0
  39. data/lib/active_merchant/posts_data.rb +10 -0
  40. data/lib/active_merchant/version.rb +1 -1
  41. data/lib/support/ssl_version.rb +87 -0
  42. metadata +7 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74c4f022672e86aa7cd1f77ff2076e4c0da77484
4
- data.tar.gz: 07e322c21469013b7c303291e7a05fc058255051
3
+ metadata.gz: fc758ea4c33fcefecc9d94e1dc19c858d01292b8
4
+ data.tar.gz: 0c81fa395b72670baf36ba18fbb3c7bd2e246c0e
5
5
  SHA512:
6
- metadata.gz: df95a75ad33fa425c7fd8b0d6aba3462c1bd9037e93ed29da6aaf9cfc4a1b441dc6b4da20f84e76875a964101666d95a3456dae3964b21a462ed3e1f20505a97
7
- data.tar.gz: 0cbdceebdcacc3eee2d6d63625602da8e84e4f16dff6288c331d7137c33cb67b60946ad69111eae6aaafa430d31ac1d76e9e6efa31ddc90f5e25358f6eeae188
6
+ metadata.gz: bbfe31171a450822d61d4c2d9eed29ae72fa5e85d501616c789ebbbf283f722bc3072fdf716b8eaedeebbd901461e0a701c0f258720b5f1547b2ff6f25242259
7
+ data.tar.gz: 2e65932a609a54ffa6d63b70cf004b536160e00e6cb3cbc3d6cfa8c63e28ccb92bbbad63655e7071829677724cc35bb2b8475fbc96beb27f80691ed2a454120e
data/CHANGELOG CHANGED
@@ -2,6 +2,54 @@
2
2
 
3
3
  == HEAD
4
4
 
5
+ == Version 1.79.0 (May 30, 2018)
6
+ * Allow setting min/max SSL version for a connection on Ruby 2.5 [bdewater] #2775
7
+ * Add `gateways:ssl:min_version` rake task to test upcoming TLS 1.0 deprecation deadline [bdewater] #2775
8
+ * Log negotiated SSL version and cipher [bdewater + methodmissing] #2862
9
+ * Remove support for Rails < 4.2, add support for Rails 5.2 and Ruby 2.5 [bdewater]
10
+ * Spreedly: Support verify and find transactions [abarrak] #2798
11
+ * Adyen: Support merchant-specific subdomains [curiousepic] #2799
12
+ * Fix ENV based configuration of Net::Http for proxies [bbergstrom] #2800
13
+ * ANET: Withhold cryptogram for credit [curiousepic] #2804
14
+ * Borgun: Remove batch from request parameters [deedeelavinder] #2805
15
+ * WorldPay: Remove Inquiry requests in verify transactions [nfarve] #2802
16
+ * Credorax: Update tests [curiousepic] #2809
17
+ * Braintree: Remove decimal for non-fractional currencies [nfarve] #2806
18
+ * Realex: Add documented country support for US and CA [a-salty-strudel] #2810
19
+ * Paymentez: Add `tax_percentage` optional parameter [deedeelavinder] #2814
20
+ * Braintree: Add `skip_advanced_fraud_checking` optional parameter [deedeelavinder] #2811
21
+ * SafeCharge: Additional gateway options [dtykocki] #2816
22
+ * FirstPay: Handle missing billing addresses [dtykocki] #2822
23
+ * Realex: Add ApplePay Support [nfarve] #2820
24
+ * Checkout V2: Additional gateway options [dtykocki] #2821
25
+ * CyberSource: Support 3ds validate request [curiousepic] #2823
26
+ * Paymentez: Remove card tokenization step from authorize [dtykocki] #2825
27
+ * WorldPay: Add 3DS [nfarve] #2819
28
+ * EBANX: Interpolate authorization string [curiousepic] #2830
29
+ * CyberSource: Support 3DS validation for authorize [curiousepic] #2832
30
+ * Redsys: Fix ISO code for PLN [chopenhauer] #2831
31
+ * Merchant E Solutions: Support transcript scrubbing [curiousepic] #2836
32
+ * Paystation: Support transcript scrubbing [curiousepic] #2837
33
+ * Psigate: Support transcript scrubbing [curiousepic] #2835
34
+ * Braintree: Adding 3D Secure pass thru capabilities [filipebarcos] #2843
35
+ * Authorize.net: Add flexibility for 3D Secure Parameters [filipebarcos] #2844
36
+ * Elavon: Update Country List [nfarve] #2840
37
+ * WorldPay: Update Country List [nfarve] #2841
38
+ * Merchant Warrior: Support transcript scrubbing [curiousepic] #2845
39
+ * NAB Transact: Pass nonfractional amounts correctly [curiousepic] #2843
40
+ * Realex: Update Country List [nfarve] #2842
41
+ * QBMS: Support transcript scrubbing [curiousepic] #2849
42
+ * Adyen: Add support for installments [nfarve] #2839
43
+ * Paymentez: Read messages on Failure with no error [nfarve] #2850
44
+ * Paymentez: Fix response message conditional [curiousepic] #2851
45
+ * Add ability to send email receipt [nfarve] #2852
46
+ * Barclaycard Smartpay: Pass shopper_interaction [curiousepic] #2853
47
+ * Stripe: Treat UGX as a zero-decimal currency [bpollack] #2857
48
+ * Mundipagg: Remove Billing Address if no Address Sent [nfarve] #2855
49
+ * Paypal: Support more robust scrubbing [curiousepic] #2858
50
+ * Stripe: Report internal Stripe errors as failures [bpollack] #2859
51
+ * Authorize.net: Add ability to pass `customer_payment_profile_id` [nfarve] #2854
52
+
5
53
  == Version 1.78.0 (March 29, 2018)
6
54
  * Litle: Add store for echecks [nfarve] #2779
7
55
  * Litle: Add Support for Echeck [nfarve] #2776
@@ -50,6 +98,7 @@
50
98
  * CardStream: Change refund to use REFUND_SALE [dtykocki] #2795
51
99
  * Spreedly: Scrub sensitive transaction data [abarrak] #2781
52
100
  * Stripe: Add `exchange_rate` parameter [WilsonChiang] #2796
101
+ * Mundipagg: New Gateway Implementation [nfarve] #2791
53
102
 
54
103
  == Version 1.77.0 (January 31, 2018)
55
104
  * Authorize.net: Allow Transaction Id to be passed for refuds [nfarve] #2698
@@ -28,11 +28,6 @@ require 'active_support/core_ext/hash/conversions'
28
28
  require 'active_support/core_ext/object/conversions'
29
29
  require 'active_support/core_ext/class/attribute'
30
30
  require 'active_support/core_ext/enumerable'
31
-
32
- if(!defined?(ActiveSupport::VERSION) || (ActiveSupport::VERSION::STRING < "4.1"))
33
- require 'active_support/core_ext/class/attribute_accessors'
34
- end
35
-
36
31
  require 'active_support/core_ext/module/attribute_accessors'
37
32
 
38
33
  require 'base64'
@@ -42,8 +37,10 @@ require 'cgi'
42
37
  require 'rexml/document'
43
38
  require 'timeout'
44
39
  require 'socket'
40
+ require 'openssl'
45
41
 
46
42
  require 'active_merchant/network_connection_retries'
43
+ require 'active_merchant/net_http_ssl_connection'
47
44
  require 'active_merchant/connection'
48
45
  require 'active_merchant/post_data'
49
46
  require 'active_merchant/posts_data'
@@ -14,7 +14,9 @@ module ActiveMerchant #:nodoc:
14
14
  'dankort' => /^5019\d{12}$/,
15
15
  'maestro' => /^(5[06-8]|6\d)\d{10,17}$/,
16
16
  'forbrugsforeningen' => /^600722\d{10}$/,
17
- 'laser' => /^(6304|6706|6709|6771(?!89))\d{8}(\d{4}|\d{6,7})?$/
17
+ 'laser' => /^(6304|6706|6709|6771(?!89))\d{8}(\d{4}|\d{6,7})?$/,
18
+ 'sodexo' => /^(606071|603389|606070|606069|606068|600818)\d{8}$/,
19
+ 'vr' => /^(627416|637036)\d{8}$/
18
20
  }
19
21
 
20
22
  # http://www.barclaycard.co.uk/business/files/bin_rules.pdf
@@ -47,6 +47,7 @@ module ActiveMerchant #:nodoc:
47
47
  add_extra_data(post, options)
48
48
  add_shopper_interaction(post, payment, options)
49
49
  add_address(post, options)
50
+ add_installments(post, options) if options[:installments]
50
51
  commit('authorise', post)
51
52
  end
52
53
 
@@ -196,14 +197,18 @@ module ActiveMerchant #:nodoc:
196
197
  post[:recurring] = recurring
197
198
  end
198
199
 
200
+ def add_installments(post, options)
201
+ post[:installments] = {
202
+ value: options[:installments]
203
+ }
204
+ end
205
+
199
206
  def parse(body)
200
207
  return {} if body.blank?
201
208
  JSON.parse(body)
202
209
  end
203
210
 
204
211
  def commit(action, parameters)
205
- url = (test? ? test_url : live_url)
206
-
207
212
  begin
208
213
  raw_response = ssl_post("#{url}/#{action.to_s}", post_data(action, parameters), request_headers)
209
214
  response = parse(raw_response)
@@ -224,6 +229,16 @@ module ActiveMerchant #:nodoc:
224
229
 
225
230
  end
226
231
 
232
+ def url
233
+ if test?
234
+ test_url
235
+ elsif @options[:subdomain]
236
+ "https://#{@options[:subdomain]}-pal-live.adyenpayments.com/pal/servlet/Payment/v18"
237
+ else
238
+ live_url
239
+ end
240
+ end
241
+
227
242
  def basic_auth
228
243
  Base64.strict_encode64("#{@username}:#{@password}")
229
244
  end
@@ -167,7 +167,7 @@ module ActiveMerchant
167
167
  xml.transactionType('refundTransaction')
168
168
  xml.amount(amount(amount))
169
169
 
170
- add_payment_source(xml, payment)
170
+ add_payment_source(xml, payment, options, :credit)
171
171
  xml.refTransId(transaction_id_from(options[:transaction_id])) if options[:transaction_id]
172
172
  add_invoice(xml, 'refundTransaction', options)
173
173
  add_customer_data(xml, payment, options)
@@ -246,7 +246,7 @@ module ActiveMerchant
246
246
  xml.transactionRequest do
247
247
  xml.transactionType(transaction_type)
248
248
  xml.amount(amount(amount))
249
- add_payment_source(xml, payment)
249
+ add_payment_source(xml, payment, options)
250
250
  add_invoice(xml, transaction_type, options)
251
251
  add_tax_fields(xml, options)
252
252
  add_duty_fields(xml, options)
@@ -268,7 +268,7 @@ module ActiveMerchant
268
268
  add_tax_fields(xml, options)
269
269
  add_shipping_fields(xml, options)
270
270
  add_duty_fields(xml, options)
271
- add_payment_source(xml, payment)
271
+ add_payment_source(xml, payment, options)
272
272
  add_invoice(xml, transaction_type, options)
273
273
  add_tax_exempt_status(xml, options)
274
274
  end
@@ -375,16 +375,16 @@ module ActiveMerchant
375
375
  end
376
376
  end
377
377
 
378
- def add_payment_source(xml, source)
378
+ def add_payment_source(xml, source, options, action = nil)
379
379
  return unless source
380
380
  if source.is_a?(String)
381
- add_token_payment_method(xml, source)
381
+ add_token_payment_method(xml, source, options)
382
382
  elsif card_brand(source) == 'check'
383
383
  add_check(xml, source)
384
384
  elsif card_brand(source) == 'apple_pay'
385
385
  add_apple_pay_payment_token(xml, source)
386
386
  else
387
- add_credit_card(xml, source)
387
+ add_credit_card(xml, source, action)
388
388
  end
389
389
  end
390
390
 
@@ -457,7 +457,7 @@ module ActiveMerchant
457
457
  end
458
458
  end
459
459
 
460
- def add_credit_card(xml, credit_card)
460
+ def add_credit_card(xml, credit_card, action)
461
461
  if credit_card.track_data
462
462
  add_swipe_data(xml, credit_card)
463
463
  else
@@ -468,7 +468,7 @@ module ActiveMerchant
468
468
  if credit_card.valid_card_verification_value?(credit_card.verification_value, credit_card.brand)
469
469
  xml.cardCode(credit_card.verification_value)
470
470
  end
471
- if credit_card.is_a?(NetworkTokenizationCreditCard)
471
+ if credit_card.is_a?(NetworkTokenizationCreditCard) && action != :credit
472
472
  xml.cryptogram(credit_card.payment_cryptogram)
473
473
  end
474
474
  end
@@ -489,8 +489,10 @@ module ActiveMerchant
489
489
  end
490
490
  end
491
491
 
492
- def add_token_payment_method(xml, token)
492
+ def add_token_payment_method(xml, token, options)
493
493
  customer_profile_id, customer_payment_profile_id, _ = split_authorization(token)
494
+ customer_profile_id = options[:customer_profile_id] if options[:customer_profile_id]
495
+ customer_payment_profile_id = options[:customer_payment_profile_id] if options[:customer_payment_profile_id]
494
496
  xml.customerProfileId(customer_profile_id)
495
497
  xml.customerPaymentProfileId(customer_payment_profile_id)
496
498
  end
@@ -552,8 +554,11 @@ module ActiveMerchant
552
554
  xml.customerIP(options[:ip]) unless empty?(options[:ip])
553
555
 
554
556
  xml.cardholderAuthentication do
555
- xml.authenticationIndicator(options[:authentication_indicator])
556
- xml.cardholderAuthenticationValue(options[:cardholder_authentication_value])
557
+ three_d_secure = options.fetch(:three_d_secure, {})
558
+ xml.authenticationIndicator(
559
+ options[:authentication_indicator] || three_d_secure[:eci])
560
+ xml.cardholderAuthenticationValue(
561
+ options[:cardholder_authentication_value] || three_d_secure[:cavv])
557
562
  end
558
563
  end
559
564
 
@@ -305,6 +305,7 @@ module ActiveMerchant #:nodoc:
305
305
  hash[:shopperEmail] = options[:email] if options[:email]
306
306
  hash[:shopperIP] = options[:ip] if options[:ip]
307
307
  hash[:shopperReference] = options[:customer] if options[:customer]
308
+ hash[:shopperInteraction] = options[:shopper_interaction] if options[:shopper_interaction]
308
309
  hash.keep_if { |_, v| v }
309
310
  end
310
311
 
@@ -98,7 +98,6 @@ module ActiveMerchant #:nodoc:
98
98
  def add_reference(post, authorization)
99
99
  dateandtime, batch, transaction, rrn, authcode, _, _, _ = split_authorization(authorization)
100
100
  post[:DateAndTime] = dateandtime
101
- post[:Batch] = batch
102
101
  post[:Transaction] = transaction
103
102
  post[:RRN] = rrn
104
103
  post[:AuthCode] = authcode
@@ -5,6 +5,7 @@ module BraintreeCommon
5
5
  base.homepage_url = 'http://www.braintreepaymentsolutions.com'
6
6
  base.display_name = 'Braintree'
7
7
  base.default_currency = 'USD'
8
+ base.currencies_without_fractions = %w(BIF CLP DJF GNF JPY KMF KRW LAK PYG RWF UGX VND VUV XAF XOF XPF)
8
9
  end
9
10
 
10
11
  def supports_scrubbing
@@ -78,7 +78,7 @@ module ActiveMerchant #:nodoc:
78
78
 
79
79
  def capture(money, authorization, options = {})
80
80
  commit do
81
- result = @braintree_gateway.transaction.submit_for_settlement(authorization, amount(money).to_s)
81
+ result = @braintree_gateway.transaction.submit_for_settlement(authorization, localized_amount(money, options[:currency] || default_currency).to_s)
82
82
  response_from_result(result)
83
83
  end
84
84
  end
@@ -95,7 +95,7 @@ module ActiveMerchant #:nodoc:
95
95
  # legacy signature: #refund(transaction_id, options = {})
96
96
  # new signature: #refund(money, transaction_id, options = {})
97
97
  money, transaction_id, options = extract_refund_args(args)
98
- money = amount(money).to_s if money
98
+ money = localized_amount(money, options[:currency] || default_currency).to_s if money
99
99
 
100
100
  commit do
101
101
  response = response_from_result(@braintree_gateway.transaction.refund(transaction_id, money))
@@ -530,6 +530,7 @@ module ActiveMerchant #:nodoc:
530
530
 
531
531
  {
532
532
  "order_id" => transaction.order_id,
533
+ "amount" => transaction.amount.to_s,
533
534
  "status" => transaction.status,
534
535
  "credit_card_details" => credit_card_details,
535
536
  "customer_details" => customer_details,
@@ -543,7 +544,7 @@ module ActiveMerchant #:nodoc:
543
544
 
544
545
  def create_transaction_parameters(money, credit_card_or_vault_id, options)
545
546
  parameters = {
546
- :amount => amount(money).to_s,
547
+ :amount => localized_amount(money, options[:currency] || default_currency).to_s,
547
548
  :order_id => options[:order_id],
548
549
  :customer => {
549
550
  :id => options[:store] == true ? "" : options[:store],
@@ -554,10 +555,14 @@ module ActiveMerchant #:nodoc:
554
555
  :options => {
555
556
  :store_in_vault => options[:store] ? true : false,
556
557
  :submit_for_settlement => options[:submit_for_settlement],
557
- :hold_in_escrow => options[:hold_in_escrow]
558
+ :hold_in_escrow => options[:hold_in_escrow],
558
559
  }
559
560
  }
560
561
 
562
+ if options[:skip_advanced_fraud_checking]
563
+ parameters[:options].merge!({ :skip_advanced_fraud_checking => options[:skip_advanced_fraud_checking] })
564
+ end
565
+
561
566
  parameters[:custom_fields] = options[:custom_fields]
562
567
  parameters[:device_data] = options[:device_data] if options[:device_data]
563
568
  parameters[:service_fee_amount] = options[:service_fee_amount] if options[:service_fee_amount]
@@ -629,6 +634,14 @@ module ActiveMerchant #:nodoc:
629
634
  }
630
635
  end
631
636
 
637
+ if options[:three_d_secure]
638
+ parameters[:three_d_secure_pass_thru] = {
639
+ cavv: options[:three_d_secure][:cavv],
640
+ eci_flag: options[:three_d_secure][:eci],
641
+ xid: options[:three_d_secure][:xid],
642
+ }
643
+ end
644
+
632
645
  parameters
633
646
  end
634
647
  end
@@ -34,6 +34,7 @@ module ActiveMerchant #:nodoc:
34
34
  add_invoice(post, amount, options)
35
35
  add_payment_method(post, payment_method)
36
36
  add_customer_data(post, options)
37
+ add_transaction_data(post, options)
37
38
 
38
39
  commit(:authorize, post)
39
40
  end
@@ -113,6 +114,12 @@ module ActiveMerchant #:nodoc:
113
114
  end
114
115
  end
115
116
 
117
+ def add_transaction_data(post, options={})
118
+ post[:cardOnFile] = true if options[:card_on_file] == true
119
+ post[:transactionIndicator] = options[:transaction_indicator] || 1
120
+ post[:previousChargeId] = options[:previous_charge_id] if options[:previous_charge_id]
121
+ end
122
+
116
123
  def commit(action, post, authorization = nil)
117
124
  begin
118
125
  raw_response = ssl_post(url(post, action, authorization), post.to_json, headers)
@@ -1,5 +1,3 @@
1
- require 'openssl'
2
-
3
1
  module ActiveMerchant #:nodoc:
4
2
  module Billing #:nodoc:
5
3
  class ClearhausGateway < Gateway
@@ -258,7 +258,7 @@ module ActiveMerchant #:nodoc:
258
258
  add_decision_manager_fields(xml, options)
259
259
  add_mdd_fields(xml, options)
260
260
  add_auth_service(xml, creditcard_or_reference, options)
261
- xml.tag! 'payerAuthEnrollService', {'run' => 'true'} if options[:payer_auth_enroll_service]
261
+ add_threeds_services(xml, options)
262
262
  add_payment_network_token(xml) if network_tokenization?(creditcard_or_reference)
263
263
  add_business_rules_data(xml, creditcard_or_reference, options)
264
264
  xml.target!
@@ -295,7 +295,7 @@ module ActiveMerchant #:nodoc:
295
295
  add_check_service(xml)
296
296
  else
297
297
  add_purchase_service(xml, payment_method_or_reference, options)
298
- xml.tag! 'payerAuthEnrollService', {'run' => 'true'} if options[:payer_auth_enroll_service]
298
+ add_threeds_services(xml, options)
299
299
  add_payment_network_token(xml) if network_tokenization?(payment_method_or_reference)
300
300
  add_business_rules_data(xml, payment_method_or_reference, options) unless options[:pinless_debit_card]
301
301
  end
@@ -667,6 +667,15 @@ module ActiveMerchant #:nodoc:
667
667
  xml.tag!'pinlessDebitValidateService', {'run' => 'true'}
668
668
  end
669
669
 
670
+ def add_threeds_services(xml, options)
671
+ xml.tag! 'payerAuthEnrollService', {'run' => 'true'} if options[:payer_auth_enroll_service]
672
+ if options[:payer_auth_validate_service]
673
+ xml.tag! 'payerAuthValidateService', {'run' => 'true'} do
674
+ xml.tag! 'signedPARes', options[:pares]
675
+ end
676
+ end
677
+ end
678
+
670
679
  def lookup_country_code(country_field)
671
680
  country_code = Country.find(country_field) rescue nil
672
681
  country_code.code(:alpha2) if country_code
@@ -241,7 +241,7 @@ module ActiveMerchant #:nodoc:
241
241
 
242
242
  def authorization_from(action, parameters, response)
243
243
  if action == :store
244
- response.try(:[], "token") + "|" + CARD_BRAND[parameters[:payment_type_code].to_sym]
244
+ "#{response.try(:[], "token")}|#{CARD_BRAND[parameters[:payment_type_code].to_sym]}"
245
245
  else
246
246
  response.try(:[], "payment").try(:[], "hash")
247
247
  end
@@ -254,8 +254,8 @@ module ActiveMerchant #:nodoc:
254
254
  end
255
255
 
256
256
  def url_for(hostname, action, parameters)
257
- return hostname + URL_MAP[action] + "?#{convert_to_url_form_encoded(parameters)}" if requires_http_get(action)
258
- hostname + URL_MAP[action]
257
+ return "#{hostname}#{URL_MAP[action]}?#{convert_to_url_form_encoded(parameters)}" if requires_http_get(action)
258
+ "#{hostname}#{URL_MAP[action]}"
259
259
  end
260
260
 
261
261
  def requires_http_get(action)
@@ -11,7 +11,7 @@ module ActiveMerchant #:nodoc:
11
11
  self.live_url = 'https://api.convergepay.com/VirtualMerchant/process.do'
12
12
 
13
13
  self.display_name = 'Elavon MyVirtualMerchant'
14
- self.supported_countries = %w(US CA PR DE IE NO PL LU BE NL)
14
+ self.supported_countries = %w(US CA PR DE IE NO PL LU BE NL MX)
15
15
  self.supported_cardtypes = [:visa, :master, :american_express, :discover]
16
16
  self.homepage_url = 'http://www.elavon.com/'
17
17
 
@@ -70,15 +70,16 @@ module ActiveMerchant #:nodoc:
70
70
  end
71
71
 
72
72
  def add_address(post, creditcard, options)
73
- address = options[:billing_address] || options[:address]
74
- post[:owner_name] = address[:name]
75
- post[:owner_street] = address[:address1]
76
- post[:owner_street2] = address[:address2] if address[:address2]
77
- post[:owner_city] = address[:city]
78
- post[:owner_state] = address[:state]
79
- post[:owner_zip] = address[:zip]
80
- post[:owner_country] = address[:country]
81
- post[:owner_phone] = address[:phone] if address[:phone]
73
+ if address = options[:billing_address] || options[:address]
74
+ post[:owner_name] = address[:name]
75
+ post[:owner_street] = address[:address1]
76
+ post[:owner_street2] = address[:address2] if address[:address2]
77
+ post[:owner_city] = address[:city]
78
+ post[:owner_state] = address[:state]
79
+ post[:owner_zip] = address[:zip]
80
+ post[:owner_country] = address[:country]
81
+ post[:owner_phone] = address[:phone] if address[:phone]
82
+ end
82
83
  end
83
84
 
84
85
  def add_invoice(post, money, options)