activemerchant 1.83.0 → 1.84.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +19 -0
- data/lib/active_merchant/billing/base.rb +1 -1
- data/lib/active_merchant/billing/check.rb +3 -2
- data/lib/active_merchant/billing/compatibility.rb +2 -4
- data/lib/active_merchant/billing/credit_card.rb +6 -39
- data/lib/active_merchant/billing/credit_card_formatting.rb +0 -1
- data/lib/active_merchant/billing/credit_card_methods.rb +67 -44
- data/lib/active_merchant/billing/gateway.rb +1 -8
- data/lib/active_merchant/billing/gateways/adyen.rb +1 -1
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +0 -1
- data/lib/active_merchant/billing/gateways/authorize_net.rb +0 -1
- data/lib/active_merchant/billing/gateways/axcessms.rb +1 -1
- data/lib/active_merchant/billing/gateways/balanced.rb +9 -9
- data/lib/active_merchant/billing/gateways/banwire.rb +5 -5
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +1 -1
- data/lib/active_merchant/billing/gateways/beanstream.rb +1 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +0 -1
- data/lib/active_merchant/billing/gateways/blue_snap.rb +5 -7
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +12 -6
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +0 -1
- data/lib/active_merchant/billing/gateways/card_connect.rb +2 -2
- data/lib/active_merchant/billing/gateways/card_save.rb +1 -1
- data/lib/active_merchant/billing/gateways/card_stream.rb +9 -18
- data/lib/active_merchant/billing/gateways/cardknox.rb +8 -9
- data/lib/active_merchant/billing/gateways/cc5.rb +0 -1
- data/lib/active_merchant/billing/gateways/cecabank.rb +0 -1
- data/lib/active_merchant/billing/gateways/cenpos.rb +1 -1
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +6 -6
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -1
- data/lib/active_merchant/billing/gateways/commercegate.rb +0 -1
- data/lib/active_merchant/billing/gateways/conekta.rb +6 -8
- data/lib/active_merchant/billing/gateways/creditcall.rb +1 -2
- data/lib/active_merchant/billing/gateways/ct_payment.rb +1 -1
- data/lib/active_merchant/billing/gateways/culqi.rb +8 -10
- data/lib/active_merchant/billing/gateways/cyber_source.rb +1 -2
- data/lib/active_merchant/billing/gateways/data_cash.rb +16 -29
- data/lib/active_merchant/billing/gateways/dibs.rb +1 -7
- data/lib/active_merchant/billing/gateways/digitzs.rb +1 -1
- data/lib/active_merchant/billing/gateways/efsnet.rb +0 -4
- data/lib/active_merchant/billing/gateways/element.rb +1 -1
- data/lib/active_merchant/billing/gateways/epay.rb +8 -9
- data/lib/active_merchant/billing/gateways/eway.rb +1 -0
- data/lib/active_merchant/billing/gateways/eway_managed.rb +2 -3
- data/lib/active_merchant/billing/gateways/exact.rb +0 -2
- data/lib/active_merchant/billing/gateways/ezic.rb +0 -1
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +9 -11
- data/lib/active_merchant/billing/gateways/federated_canada.rb +1 -1
- data/lib/active_merchant/billing/gateways/first_giving.rb +3 -3
- data/lib/active_merchant/billing/gateways/first_pay.rb +5 -0
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +2 -2
- data/lib/active_merchant/billing/gateways/garanti.rb +4 -5
- data/lib/active_merchant/billing/gateways/global_collect.rb +6 -7
- data/lib/active_merchant/billing/gateways/iats_payments.rb +1 -1
- data/lib/active_merchant/billing/gateways/inspire.rb +2 -2
- data/lib/active_merchant/billing/gateways/ipp.rb +1 -1
- data/lib/active_merchant/billing/gateways/iridium.rb +3 -3
- data/lib/active_merchant/billing/gateways/iveri.rb +1 -1
- data/lib/active_merchant/billing/gateways/komoju.rb +1 -1
- data/lib/active_merchant/billing/gateways/kushki.rb +7 -9
- data/lib/active_merchant/billing/gateways/latitude19.rb +29 -34
- data/lib/active_merchant/billing/gateways/linkpoint.rb +1 -3
- data/lib/active_merchant/billing/gateways/litle.rb +1 -1
- data/lib/active_merchant/billing/gateways/mastercard.rb +1 -2
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +0 -1
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +0 -1
- data/lib/active_merchant/billing/gateways/merchant_one.rb +1 -1
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +3 -3
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +3 -3
- data/lib/active_merchant/billing/gateways/mercury.rb +1 -1
- data/lib/active_merchant/billing/gateways/micropayment.rb +0 -2
- data/lib/active_merchant/billing/gateways/modern_payments.rb +1 -0
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +4 -3
- data/lib/active_merchant/billing/gateways/moneris.rb +0 -1
- data/lib/active_merchant/billing/gateways/moneris_us.rb +1 -2
- data/lib/active_merchant/billing/gateways/money_movers.rb +1 -1
- data/lib/active_merchant/billing/gateways/mundipagg.rb +9 -9
- data/lib/active_merchant/billing/gateways/nab_transact.rb +0 -1
- data/lib/active_merchant/billing/gateways/net_registry.rb +1 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +1 -2
- data/lib/active_merchant/billing/gateways/ogone.rb +9 -10
- data/lib/active_merchant/billing/gateways/openpay.rb +7 -8
- data/lib/active_merchant/billing/gateways/opp.rb +110 -112
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +1 -4
- data/lib/active_merchant/billing/gateways/orbital.rb +1 -2
- data/lib/active_merchant/billing/gateways/pagarme.rb +3 -5
- data/lib/active_merchant/billing/gateways/pay_conex.rb +0 -1
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +10 -12
- data/lib/active_merchant/billing/gateways/pay_secure.rb +1 -1
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +0 -1
- data/lib/active_merchant/billing/gateways/payeezy.rb +15 -4
- data/lib/active_merchant/billing/gateways/payex.rb +5 -6
- data/lib/active_merchant/billing/gateways/payflow.rb +0 -4
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -2
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +1 -1
- data/lib/active_merchant/billing/gateways/payflow_express.rb +54 -55
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -1
- data/lib/active_merchant/billing/gateways/payment_express.rb +0 -6
- data/lib/active_merchant/billing/gateways/paymill.rb +0 -2
- data/lib/active_merchant/billing/gateways/paypal.rb +0 -8
- data/lib/active_merchant/billing/gateways/payscout.rb +0 -1
- data/lib/active_merchant/billing/gateways/paystation.rb +2 -2
- data/lib/active_merchant/billing/gateways/payu_latam.rb +37 -32
- data/lib/active_merchant/billing/gateways/pin.rb +2 -2
- data/lib/active_merchant/billing/gateways/plugnpay.rb +1 -0
- data/lib/active_merchant/billing/gateways/psl_card.rb +3 -10
- data/lib/active_merchant/billing/gateways/quantum.rb +4 -4
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +0 -3
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +3 -7
- data/lib/active_merchant/billing/gateways/realex.rb +6 -8
- data/lib/active_merchant/billing/gateways/redsys.rb +1 -0
- data/lib/active_merchant/billing/gateways/s5.rb +0 -1
- data/lib/active_merchant/billing/gateways/safe_charge.rb +4 -4
- data/lib/active_merchant/billing/gateways/sage.rb +16 -13
- data/lib/active_merchant/billing/gateways/sage_pay.rb +2 -9
- data/lib/active_merchant/billing/gateways/secure_net.rb +0 -1
- data/lib/active_merchant/billing/gateways/securion_pay.rb +3 -6
- data/lib/active_merchant/billing/gateways/skip_jack.rb +2 -2
- data/lib/active_merchant/billing/gateways/smart_ps.rb +2 -4
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +5 -5
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +1 -2
- data/lib/active_merchant/billing/gateways/stripe.rb +60 -15
- data/lib/active_merchant/billing/gateways/telr.rb +5 -6
- data/lib/active_merchant/billing/gateways/tns.rb +1 -1
- data/lib/active_merchant/billing/gateways/trans_first.rb +0 -1
- data/lib/active_merchant/billing/gateways/trexle.rb +6 -5
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +1 -0
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +2 -2
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +0 -1
- data/lib/active_merchant/billing/gateways/vanco.rb +1 -1
- data/lib/active_merchant/billing/gateways/viaklix.rb +1 -0
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +28 -32
- data/lib/active_merchant/billing/gateways/wepay.rb +0 -1
- data/lib/active_merchant/billing/gateways/wirecard.rb +2 -1
- data/lib/active_merchant/billing/gateways/worldpay.rb +1 -4
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +5 -8
- data/lib/active_merchant/connection.rb +0 -2
- data/lib/active_merchant/country.rb +1 -0
- data/lib/active_merchant/net_http_ssl_connection.rb +1 -1
- data/lib/active_merchant/network_connection_retries.rb +1 -0
- data/lib/active_merchant/post_data.rb +1 -0
- data/lib/active_merchant/posts_data.rb +0 -2
- data/lib/active_merchant/version.rb +1 -1
- data/lib/support/gateway_support.rb +3 -4
- data/lib/support/ssl_verify.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4602e2af4d4ec3329ce11f1576662b177dd71504
|
4
|
+
data.tar.gz: 8d66a22aa55c1e7b78dbcad4673e230e6ee3425f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 395ec9d80c88f8d49501e1a06aa9d7035f161bffec4ac6946729fad84efc87c3f2b28b2d185cfb9e2c69013c84477f7922a9413047e7ef2582fddd443c176749
|
7
|
+
data.tar.gz: ada93899bf3c38c65e6d28f516f6093690a764077d50d4d6d76b6e80e5097370dbcf7f44c876460ea4cadeb3e70ba1fbd9283d7466f193dd66fb92372542e5e8
|
data/CHANGELOG
CHANGED
@@ -2,6 +2,25 @@
|
|
2
2
|
|
3
3
|
== HEAD
|
4
4
|
|
5
|
+
== Version 1.84.0 (September 27, 2018)
|
6
|
+
* PayU Latam: support partial captures [bpollack] #2974
|
7
|
+
* Braintree: Reflect correct test mode in Braintree responses [elfassy] [#2980]
|
8
|
+
* FirstPay: Expose error code [curiousepic] #2979
|
9
|
+
* Barclaycard Smartpay: Pass device_fingerprint when specified [dtykocki] #2981
|
10
|
+
* Komoju: remove no-longer-relevant sandbox URL [miyazawadegica] #2987
|
11
|
+
* [POSSIBLE BREAKAGE] Determine credit cards via functions [bpollack] #2983
|
12
|
+
* Drop support for Laser cards [bpollack] #2983
|
13
|
+
* Improve Maestro card detection [bpollack] #2983
|
14
|
+
* Add ROU alpha3 code for Romania [dtykocki] #2989
|
15
|
+
* [POSSIBLE BREAKAGE] Drop support for Solo and Switch cards [bpollack] #2991
|
16
|
+
* Add support for Carnet cards [bpollack] #2992
|
17
|
+
* Stripe: support a reason for voiding a transaction [whitby3001] #2378
|
18
|
+
* Payeezy: Add reversal_id in support of timeout reversals [dtykocki] #2997
|
19
|
+
* Stripe: support Level 3 transaction fields [bpollack] #2996
|
20
|
+
* Conekta: support Carnet cards [bpollack] #2999
|
21
|
+
* Openpay: support Carnet cards [bpollack] #2999
|
22
|
+
* Adyen: Add support for GooglePay [dtykocki] #2971
|
23
|
+
|
5
24
|
== Version 1.83.0 (August 30, 2018)
|
6
25
|
* CT Payment: Update How Address is Passed [nfarve] #2960
|
7
26
|
* Adyen: Add RecurringProcessingModel [nfarve] #2951
|
@@ -49,7 +49,7 @@ module ActiveMerchant #:nodoc:
|
|
49
49
|
# notification = chronopay.notification(raw_post)
|
50
50
|
#
|
51
51
|
def self.integration(name)
|
52
|
-
Billing::Integrations.const_get(
|
52
|
+
Billing::Integrations.const_get(name.to_s.downcase.camelize)
|
53
53
|
end
|
54
54
|
|
55
55
|
# A check to see if we're in test mode
|
@@ -7,8 +7,8 @@ module ActiveMerchant #:nodoc:
|
|
7
7
|
# You may use Check in place of CreditCard with any gateway that supports it.
|
8
8
|
class Check < Model
|
9
9
|
attr_accessor :first_name, :last_name,
|
10
|
-
|
11
|
-
|
10
|
+
:bank_name, :routing_number, :account_number,
|
11
|
+
:account_holder_type, :account_type, :number
|
12
12
|
|
13
13
|
# Used for Canadian bank accounts
|
14
14
|
attr_accessor :institution_number, :transit_number
|
@@ -53,6 +53,7 @@ module ActiveMerchant #:nodoc:
|
|
53
53
|
def credit_card?
|
54
54
|
false
|
55
55
|
end
|
56
|
+
|
56
57
|
# Routing numbers may be validated by calculating a checksum and dividing it by 10. The
|
57
58
|
# formula is:
|
58
59
|
# (3(d1 + d4 + d7) + 7(d2 + d5 + d8) + 1(d3 + d6 + d9))mod 10 = 0
|
@@ -29,9 +29,7 @@ module ActiveMerchant
|
|
29
29
|
result = lower_case_and_underscored_word.to_s.dup
|
30
30
|
result.gsub!(/_id$/, '')
|
31
31
|
result.gsub!(/_/, ' ')
|
32
|
-
result.gsub(/([a-z\d]*)/i) {
|
33
|
-
match.downcase
|
34
|
-
}.gsub(/^\w/) { $&.upcase }
|
32
|
+
result.gsub(/([a-z\d]*)/i, &:downcase).gsub(/^\w/) { $&.upcase }
|
35
33
|
end
|
36
34
|
end
|
37
35
|
end
|
@@ -102,7 +100,7 @@ module ActiveMerchant
|
|
102
100
|
self.each do |key, messages|
|
103
101
|
next unless(messages && !messages.empty?)
|
104
102
|
if key == 'base'
|
105
|
-
result <<
|
103
|
+
result << messages.first.to_s
|
106
104
|
else
|
107
105
|
result << "#{Compatibility.humanize(key)} #{messages.first}"
|
108
106
|
end
|
@@ -15,12 +15,9 @@ module ActiveMerchant #:nodoc:
|
|
15
15
|
# * American Express
|
16
16
|
# * Diner's Club
|
17
17
|
# * JCB
|
18
|
-
# * Switch
|
19
|
-
# * Solo
|
20
18
|
# * Dankort
|
21
19
|
# * Maestro
|
22
20
|
# * Forbrugsforeningen
|
23
|
-
# * Laser
|
24
21
|
#
|
25
22
|
# For testing purposes, use the 'bogus' credit card brand. This skips the vast majority of
|
26
23
|
# validations, allowing you to focus on your core concerns until you're ready to be more concerned
|
@@ -88,12 +85,9 @@ module ActiveMerchant #:nodoc:
|
|
88
85
|
# * +'american_express'+
|
89
86
|
# * +'diners_club'+
|
90
87
|
# * +'jcb'+
|
91
|
-
# * +'switch'+
|
92
|
-
# * +'solo'+
|
93
88
|
# * +'dankort'+
|
94
89
|
# * +'maestro'+
|
95
90
|
# * +'forbrugsforeningen'+
|
96
|
-
# * +'laser'+
|
97
91
|
#
|
98
92
|
# Or, if you wish to test your implementation, +'bogus'+.
|
99
93
|
#
|
@@ -121,10 +115,6 @@ module ActiveMerchant #:nodoc:
|
|
121
115
|
# @return [String]
|
122
116
|
attr_accessor :last_name
|
123
117
|
|
124
|
-
# Required for Switch / Solo cards
|
125
|
-
attr_reader :start_month, :start_year
|
126
|
-
attr_accessor :issue_number
|
127
|
-
|
128
118
|
# Returns or sets the card verification value.
|
129
119
|
#
|
130
120
|
# This attribute is optional but recommended. The verification value is
|
@@ -303,8 +293,7 @@ module ActiveMerchant #:nodoc:
|
|
303
293
|
|
304
294
|
errors_hash(
|
305
295
|
errors +
|
306
|
-
validate_card_brand_and_number
|
307
|
-
validate_switch_or_solo_attributes
|
296
|
+
validate_card_brand_and_number
|
308
297
|
)
|
309
298
|
end
|
310
299
|
|
@@ -350,7 +339,7 @@ module ActiveMerchant #:nodoc:
|
|
350
339
|
errors = []
|
351
340
|
|
352
341
|
if !empty?(brand)
|
353
|
-
errors << [:brand, 'is invalid'] if !CreditCard.card_companies.
|
342
|
+
errors << [:brand, 'is invalid'] if !CreditCard.card_companies.include?(brand)
|
354
343
|
end
|
355
344
|
|
356
345
|
if empty?(number)
|
@@ -379,27 +368,6 @@ module ActiveMerchant #:nodoc:
|
|
379
368
|
errors
|
380
369
|
end
|
381
370
|
|
382
|
-
def validate_switch_or_solo_attributes #:nodoc:
|
383
|
-
errors = []
|
384
|
-
|
385
|
-
if %w[switch solo].include?(brand)
|
386
|
-
valid_start_month = valid_month?(start_month)
|
387
|
-
valid_start_year = valid_start_year?(start_year)
|
388
|
-
|
389
|
-
if((!valid_start_month || !valid_start_year) && !valid_issue_number?(issue_number))
|
390
|
-
if empty?(issue_number)
|
391
|
-
errors << [:issue_number, 'cannot be empty']
|
392
|
-
errors << [:start_month, 'is invalid'] if !valid_start_month
|
393
|
-
errors << [:start_year, 'is invalid'] if !valid_start_year
|
394
|
-
else
|
395
|
-
errors << [:issue_number, 'is invalid'] if !valid_issue_number?(issue_number)
|
396
|
-
end
|
397
|
-
end
|
398
|
-
end
|
399
|
-
|
400
|
-
errors
|
401
|
-
end
|
402
|
-
|
403
371
|
class ExpiryDate #:nodoc:
|
404
372
|
attr_reader :month, :year
|
405
373
|
def initialize(month, year)
|
@@ -412,14 +380,13 @@ module ActiveMerchant #:nodoc:
|
|
412
380
|
end
|
413
381
|
|
414
382
|
def expiration #:nodoc:
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
Time.at(0).utc
|
419
|
-
end
|
383
|
+
Time.utc(year, month, month_days, 23, 59, 59)
|
384
|
+
rescue ArgumentError
|
385
|
+
Time.at(0).utc
|
420
386
|
end
|
421
387
|
|
422
388
|
private
|
389
|
+
|
423
390
|
def month_days
|
424
391
|
mdays = [nil,31,28,31,30,31,30,31,31,30,31,30,31]
|
425
392
|
mdays[2] = 29 if Date.leap?(year)
|
@@ -2,21 +2,24 @@ module ActiveMerchant #:nodoc:
|
|
2
2
|
module Billing #:nodoc:
|
3
3
|
# Convenience methods that can be included into a custom Credit Card object, such as an ActiveRecord based Credit Card object.
|
4
4
|
module CreditCardMethods
|
5
|
-
|
6
|
-
'visa' => /^4\d{12}(\d{3})?(\d{3})
|
7
|
-
'master' =>
|
8
|
-
'discover' => /^(6011|65\d{2}|64[4-9]\d)\d{12}|(62\d{14})
|
9
|
-
'american_express' => /^3[47]\d{13}
|
10
|
-
'diners_club' => /^3(0[0-5]|[68]\d)\d{11}
|
11
|
-
'jcb' => /^35(28|29|[3-8]\d)\d{12}
|
12
|
-
'
|
13
|
-
'
|
14
|
-
'
|
15
|
-
'
|
16
|
-
'
|
17
|
-
'
|
18
|
-
|
19
|
-
|
5
|
+
CARD_COMPANY_DETECTORS = {
|
6
|
+
'visa' => ->(num) { num =~ /^4\d{12}(\d{3})?(\d{3})?$/ },
|
7
|
+
'master' => ->(num) { num&.size == 16 && in_bin_range?(num.slice(0, 6), MASTERCARD_RANGES) },
|
8
|
+
'discover' => ->(num) { num =~ /^(6011|65\d{2}|64[4-9]\d)\d{12}|(62\d{14})$/ },
|
9
|
+
'american_express' => ->(num) { num =~ /^3[47]\d{13}$/ },
|
10
|
+
'diners_club' => ->(num) { num =~ /^3(0[0-5]|[68]\d)\d{11}$/ },
|
11
|
+
'jcb' => ->(num) { num =~ /^35(28|29|[3-8]\d)\d{12}$/ },
|
12
|
+
'dankort' => ->(num) { num =~ /^5019\d{12}$/ },
|
13
|
+
'maestro' => ->(num) { (12..19).include?(num&.size) && in_bin_range?(num.slice(0, 6), MAESTRO_RANGES) },
|
14
|
+
'forbrugsforeningen' => ->(num) { num =~ /^600722\d{10}$/ },
|
15
|
+
'sodexo' => ->(num) { num =~ /^(606071|603389|606070|606069|606068|600818)\d{8}$/ },
|
16
|
+
'vr' => ->(num) { num =~ /^(627416|637036)\d{8}$/ },
|
17
|
+
'carnet' => lambda { |num|
|
18
|
+
num&.size == 16 && (
|
19
|
+
in_bin_range?(num.slice(0, 6), CARNET_RANGES) ||
|
20
|
+
CARNET_BINS.any? { |bin| num.slice(0, bin.size) == bin }
|
21
|
+
)
|
22
|
+
}
|
20
23
|
}
|
21
24
|
|
22
25
|
# http://www.barclaycard.co.uk/business/files/bin_rules.pdf
|
@@ -39,12 +42,43 @@ module ActiveMerchant #:nodoc:
|
|
39
42
|
(491730..491759),
|
40
43
|
]
|
41
44
|
|
45
|
+
CARNET_RANGES = [
|
46
|
+
(506199..506499),
|
47
|
+
]
|
48
|
+
|
49
|
+
CARNET_BINS = Set.new(
|
50
|
+
[
|
51
|
+
'286900', '502275', '606333', '627535', '636318', '636379', '639388',
|
52
|
+
'639484', '639559', '50633601', '50633606', '58877274', '62753500',
|
53
|
+
'60462203', '60462204', '588772'
|
54
|
+
]
|
55
|
+
)
|
56
|
+
|
57
|
+
# https://www.mastercard.us/content/dam/mccom/global/documents/mastercard-rules.pdf, page 73
|
58
|
+
MASTERCARD_RANGES = [
|
59
|
+
(222100..272099),
|
60
|
+
(510000..559999),
|
61
|
+
]
|
62
|
+
|
63
|
+
# https://www.mastercard.us/content/dam/mccom/global/documents/mastercard-rules.pdf, page 73
|
64
|
+
MAESTRO_RANGES = [
|
65
|
+
(639000..639099),
|
66
|
+
(670000..679999),
|
67
|
+
]
|
68
|
+
|
42
69
|
def self.included(base)
|
43
70
|
base.extend(ClassMethods)
|
44
71
|
end
|
45
72
|
|
73
|
+
def self.in_bin_range?(number, ranges)
|
74
|
+
bin = number.to_i
|
75
|
+
ranges.any? do |range|
|
76
|
+
range.cover?(bin)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
46
80
|
def valid_month?(month)
|
47
|
-
(1..12).
|
81
|
+
(1..12).cover?(month.to_i)
|
48
82
|
end
|
49
83
|
|
50
84
|
def credit_card?
|
@@ -77,7 +111,14 @@ module ActiveMerchant #:nodoc:
|
|
77
111
|
end
|
78
112
|
|
79
113
|
def card_verification_value_length(brand)
|
80
|
-
brand
|
114
|
+
case brand
|
115
|
+
when 'american_express'
|
116
|
+
4
|
117
|
+
when 'maestro'
|
118
|
+
0
|
119
|
+
else
|
120
|
+
3
|
121
|
+
end
|
81
122
|
end
|
82
123
|
|
83
124
|
def valid_issue_number?(number)
|
@@ -103,37 +144,18 @@ module ActiveMerchant #:nodoc:
|
|
103
144
|
valid_checksum?(number)
|
104
145
|
end
|
105
146
|
|
106
|
-
# Regular expressions for the known card companies.
|
107
|
-
#
|
108
|
-
# References:
|
109
|
-
# - http://en.wikipedia.org/wiki/Credit_card_number
|
110
|
-
# - http://www.barclaycardbusiness.co.uk/information_zone/processing/bin_rules.html
|
111
147
|
def card_companies
|
112
|
-
|
148
|
+
CARD_COMPANY_DETECTORS.keys
|
113
149
|
end
|
114
150
|
|
115
151
|
# Returns a string containing the brand of card from the list of known information below.
|
116
|
-
# Need to check the cards in a particular order, as there is some overlap of the allowable ranges
|
117
|
-
#--
|
118
|
-
# TODO Refactor this method. We basically need to tighten up the Maestro Regexp.
|
119
|
-
#
|
120
|
-
# Right now the Maestro regexp overlaps with the MasterCard regexp (IIRC). If we can tighten
|
121
|
-
# things up, we can boil this whole thing down to something like...
|
122
|
-
#
|
123
|
-
# def brand?(number)
|
124
|
-
# return 'visa' if valid_test_mode_card_number?(number)
|
125
|
-
# card_companies.find([nil]) { |brand, regexp| number =~ regexp }.first.dup
|
126
|
-
# end
|
127
|
-
#
|
128
152
|
def brand?(number)
|
129
153
|
return 'bogus' if valid_test_mode_card_number?(number)
|
130
154
|
|
131
|
-
|
132
|
-
return company.dup if number
|
155
|
+
CARD_COMPANY_DETECTORS.each do |company, func|
|
156
|
+
return company.dup if func.call(number)
|
133
157
|
end
|
134
158
|
|
135
|
-
return 'maestro' if number =~ card_companies['maestro']
|
136
|
-
|
137
159
|
return nil
|
138
160
|
end
|
139
161
|
|
@@ -154,11 +176,12 @@ module ActiveMerchant #:nodoc:
|
|
154
176
|
end
|
155
177
|
|
156
178
|
def first_digits(number)
|
157
|
-
number.
|
179
|
+
number.slice(0,6)
|
158
180
|
end
|
159
181
|
|
160
182
|
def last_digits(number)
|
161
|
-
|
183
|
+
return '' if number.nil?
|
184
|
+
number.length <= 4 ? number : number.slice(-4..-1)
|
162
185
|
end
|
163
186
|
|
164
187
|
def mask(number)
|
@@ -178,16 +201,16 @@ module ActiveMerchant #:nodoc:
|
|
178
201
|
private
|
179
202
|
|
180
203
|
def valid_card_number_length?(number) #:nodoc:
|
181
|
-
number.
|
204
|
+
number.length >= 12
|
182
205
|
end
|
183
206
|
|
184
207
|
def valid_card_number_characters?(number) #:nodoc:
|
185
|
-
!number.
|
208
|
+
!number.match(/\D/)
|
186
209
|
end
|
187
210
|
|
188
211
|
def valid_test_mode_card_number?(number) #:nodoc:
|
189
212
|
ActiveMerchant::Billing::Base.test? &&
|
190
|
-
%w[1 2 3 success failure error].include?(number
|
213
|
+
%w[1 2 3 success failure error].include?(number)
|
191
214
|
end
|
192
215
|
|
193
216
|
ODD_LUHN_VALUE = {
|
@@ -56,8 +56,6 @@ module ActiveMerchant #:nodoc:
|
|
56
56
|
include PostsData
|
57
57
|
include CreditCardFormatting
|
58
58
|
|
59
|
-
DEBIT_CARDS = [ :switch, :solo ]
|
60
|
-
|
61
59
|
CREDIT_DEPRECATION_MESSAGE = 'Support for using credit to refund existing transactions is deprecated and will be removed from a future release of ActiveMerchant. Please use the refund method instead.'
|
62
60
|
RECURRING_DEPRECATION_MESSAGE = 'Recurring functionality in ActiveMerchant is deprecated and will be removed in a future version. Please contact the ActiveMerchant maintainers if you have an interest in taking ownership of a separate gem that continues support for it.'
|
63
61
|
|
@@ -195,7 +193,7 @@ module ActiveMerchant #:nodoc:
|
|
195
193
|
end
|
196
194
|
|
197
195
|
def scrub(transcript)
|
198
|
-
raise
|
196
|
+
raise 'This gateway does not support scrubbing.'
|
199
197
|
end
|
200
198
|
|
201
199
|
def supports_network_tokenization?
|
@@ -305,11 +303,6 @@ module ActiveMerchant #:nodoc:
|
|
305
303
|
[first_name, last_name]
|
306
304
|
end
|
307
305
|
|
308
|
-
def requires_start_date_or_issue_number?(credit_card)
|
309
|
-
return false if card_brand(credit_card).blank?
|
310
|
-
DEBIT_CARDS.include?(card_brand(credit_card).to_sym)
|
311
|
-
end
|
312
|
-
|
313
306
|
def requires!(hash, *params)
|
314
307
|
params.each do |param|
|
315
308
|
if param.is_a?(Array)
|
@@ -121,6 +121,7 @@ module ActiveMerchant #:nodoc:
|
|
121
121
|
post[:additionalData] ||= {}
|
122
122
|
post[:additionalData][:overwriteBrand] = normalize(options[:overwrite_brand]) if options[:overwrite_brand]
|
123
123
|
post[:additionalData][:customRoutingFlag] = options[:custom_routing_flag] if options[:custom_routing_flag]
|
124
|
+
post[:additionalData]['paymentdatasource.type'] = NETWORK_TOKENIZATION_CARD_SOURCE[payment.source.to_s] if payment.is_a?(NetworkTokenizationCreditCard)
|
124
125
|
end
|
125
126
|
|
126
127
|
def add_shopper_interaction(post, payment, options={})
|
@@ -248,7 +249,6 @@ module ActiveMerchant #:nodoc:
|
|
248
249
|
test: test?,
|
249
250
|
error_code: success ? nil : error_code_from(response)
|
250
251
|
)
|
251
|
-
|
252
252
|
end
|
253
253
|
|
254
254
|
def url
|
@@ -8,7 +8,7 @@ module ActiveMerchant #:nodoc:
|
|
8
8
|
GI GR HR HU IE IL IM IS IT LI LT LU LV MC MT MX NL
|
9
9
|
NO PL PT RO RU SE SI SK TR US VA)
|
10
10
|
|
11
|
-
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :maestro
|
11
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :maestro]
|
12
12
|
|
13
13
|
self.homepage_url = 'http://www.axcessms.com/'
|
14
14
|
self.display_name = 'Axcess MS'
|
@@ -117,8 +117,8 @@ module ActiveMerchant #:nodoc:
|
|
117
117
|
case identifier
|
118
118
|
when %r{\|}
|
119
119
|
uri = identifier.
|
120
|
-
|
121
|
-
|
120
|
+
split('|').
|
121
|
+
detect{|part| part.size > 0}
|
122
122
|
uri.split('/')[2]
|
123
123
|
when %r{\/}
|
124
124
|
identifier.split('/')[5]
|
@@ -172,7 +172,7 @@ module ActiveMerchant #:nodoc:
|
|
172
172
|
message_from(raw_response),
|
173
173
|
raw_response,
|
174
174
|
authorization: authorization_from(entity_name, raw_response),
|
175
|
-
test: test
|
175
|
+
test: test?
|
176
176
|
)
|
177
177
|
end
|
178
178
|
|
@@ -236,12 +236,12 @@ module ActiveMerchant #:nodoc:
|
|
236
236
|
|
237
237
|
def headers
|
238
238
|
@@ua ||= JSON.dump(
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
239
|
+
bindings_version: ActiveMerchant::VERSION,
|
240
|
+
lang: 'ruby',
|
241
|
+
lang_version: "#{RUBY_VERSION} p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE})",
|
242
|
+
lib_version: BalancedGateway::VERSION,
|
243
|
+
platform: RUBY_PLATFORM,
|
244
|
+
publisher: 'active_merchant'
|
245
245
|
)
|
246
246
|
|
247
247
|
{
|