tanga_activemerchant 1.38.0.4 → 1.38.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f622cabb77a23c4401a3d30b8b97eaa0c2db3e9c
4
- data.tar.gz: 77f67675295af932a84bf28270d73137f25da853
3
+ metadata.gz: fb9423c2510b5d1c7e259ec8cadc6644c1b61cf2
4
+ data.tar.gz: 8b8a78a47a4aeb31d64abf377350f97d53325f2a
5
5
  SHA512:
6
- metadata.gz: adfadb497c15ece449b4daeac0ed60a2c0a9127b6da85167994fefe70925ebc4ea85256180218cb1c269f63ee9740f5073444b4e5f1088068a27b52b36ed7ea0
7
- data.tar.gz: 35c113ca111aa74916b7b1142ac9f32bc107f4a31d5d0607814f0062e470ed9c4232739f832d9494e68cfd376af5da60c0ddb5bf17f6e83fbedf3228ccecd6b6
6
+ metadata.gz: 26d7227ca192aeb6ebb6375e253c846e48b542a29251dd381f11659263d309935f1b86a2ce50c113d811d09f8699574edfad445a3705e3af8d3004eb319d2f16
7
+ data.tar.gz: f75c7c08857c02caba3c0f2c4edf06420cd648203038948460a6d03c7f508c1819f874277eec6eb4c8c3e664ce71e299c9957eddeffb9360fe318ba080b47556
@@ -2,9 +2,9 @@ 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
- CARD_COMPANIES = {
5
+ CARD_COMPANIES = {
6
6
  'visa' => /^4\d{12}(\d{3})?$/,
7
- 'master' => /^(5[1-5]\d{4}|677189)\d{10}$/,
7
+ 'master' => /^(5[1-5]\d{4}|677189|222[1-9]\d{2}|22[3-9]\d{3}|2[3-6]\d{4}|27[01]\d{3}|2720\d{2})\d{10}$/,
8
8
  'discover' => /^(6011|65\d{2}|64[4-9]\d)\d{12}|(62\d{14})$/,
9
9
  'american_express' => /^3[47]\d{13}$/,
10
10
  'diners_club' => /^3(0[0-5]|[68]\d)\d{11}$/,
@@ -16,69 +16,69 @@ module ActiveMerchant #:nodoc:
16
16
  'forbrugsforeningen' => /^600722\d{10}$/,
17
17
  'laser' => /^(6304|6706|6709|6771(?!89))\d{8}(\d{4}|\d{6,7})?$/
18
18
  }
19
-
19
+
20
20
  def self.included(base)
21
21
  base.extend(ClassMethods)
22
22
  end
23
-
23
+
24
24
  def valid_month?(month)
25
25
  (1..12).include?(month.to_i)
26
26
  end
27
-
27
+
28
28
  def valid_expiry_year?(year)
29
29
  (Time.now.year..Time.now.year + 20).include?(year.to_i)
30
30
  end
31
-
31
+
32
32
  def valid_start_year?(year)
33
33
  year.to_s =~ /^\d{4}$/ && year.to_i > 1987
34
34
  end
35
-
35
+
36
36
  def valid_issue_number?(number)
37
37
  number.to_s =~ /^\d{1,2}$/
38
38
  end
39
-
39
+
40
40
  module ClassMethods
41
- # Returns true if it validates. Optionally, you can pass a card brand as an argument and
41
+ # Returns true if it validates. Optionally, you can pass a card brand as an argument and
42
42
  # make sure it is of the correct brand.
43
43
  #
44
44
  # References:
45
45
  # - http://perl.about.com/compute/perl/library/nosearch/P073000.htm
46
46
  # - http://www.beachnet.com/~hstiles/cardtype.html
47
47
  def valid_number?(number)
48
- valid_test_mode_card_number?(number) ||
49
- valid_card_number_length?(number) &&
48
+ valid_test_mode_card_number?(number) ||
49
+ valid_card_number_length?(number) &&
50
50
  valid_checksum?(number)
51
51
  end
52
-
52
+
53
53
  # Regular expressions for the known card companies.
54
- #
55
- # References:
56
- # - http://en.wikipedia.org/wiki/Credit_card_number
57
- # - http://www.barclaycardbusiness.co.uk/information_zone/processing/bin_rules.html
54
+ #
55
+ # References:
56
+ # - http://en.wikipedia.org/wiki/Credit_card_number
57
+ # - http://www.barclaycardbusiness.co.uk/information_zone/processing/bin_rules.html
58
58
  def card_companies
59
59
  CARD_COMPANIES
60
60
  end
61
-
61
+
62
62
  # Returns a string containing the brand of card from the list of known information below.
63
63
  # Need to check the cards in a particular order, as there is some overlap of the allowable ranges
64
64
  #--
65
- # TODO Refactor this method. We basically need to tighten up the Maestro Regexp.
66
- #
67
- # Right now the Maestro regexp overlaps with the MasterCard regexp (IIRC). If we can tighten
68
- # things up, we can boil this whole thing down to something like...
69
- #
65
+ # TODO Refactor this method. We basically need to tighten up the Maestro Regexp.
66
+ #
67
+ # Right now the Maestro regexp overlaps with the MasterCard regexp (IIRC). If we can tighten
68
+ # things up, we can boil this whole thing down to something like...
69
+ #
70
70
  # def brand?(number)
71
71
  # return 'visa' if valid_test_mode_card_number?(number)
72
72
  # card_companies.find([nil]) { |brand, regexp| number =~ regexp }.first.dup
73
73
  # end
74
- #
74
+ #
75
75
  def brand?(number)
76
76
  return 'bogus' if valid_test_mode_card_number?(number)
77
77
 
78
78
  card_companies.reject { |c,p| c == 'maestro' }.each do |company, pattern|
79
- return company.dup if number =~ pattern
79
+ return company.dup if number =~ pattern
80
80
  end
81
-
81
+
82
82
  return 'maestro' if number =~ card_companies['maestro']
83
83
 
84
84
  return nil
@@ -88,19 +88,19 @@ module ActiveMerchant #:nodoc:
88
88
  deprecated "CreditCard#type? is deprecated and will be removed from a future release of ActiveMerchant. Please use CreditCard#brand? instead."
89
89
  brand?(number)
90
90
  end
91
-
91
+
92
92
  def first_digits(number)
93
- number.to_s.slice(0,6)
93
+ number.to_s.slice(0,6)
94
94
  end
95
-
96
- def last_digits(number)
97
- number.to_s.length <= 4 ? number : number.to_s.slice(-4..-1)
95
+
96
+ def last_digits(number)
97
+ number.to_s.length <= 4 ? number : number.to_s.slice(-4..-1)
98
98
  end
99
-
99
+
100
100
  def mask(number)
101
101
  "XXXX-XXXX-XXXX-#{last_digits(number)}"
102
102
  end
103
-
103
+
104
104
  # Checks to see if the calculated brand matches the specified brand
105
105
  def matching_brand?(number, brand)
106
106
  brand?(number) == brand
@@ -114,19 +114,19 @@ module ActiveMerchant #:nodoc:
114
114
  def deprecated(message)
115
115
  warn(Kernel.caller[1] + message)
116
116
  end
117
-
117
+
118
118
  private
119
-
119
+
120
120
  def valid_card_number_length?(number) #:nodoc:
121
121
  number.to_s.length >= 12
122
122
  end
123
-
123
+
124
124
  def valid_test_mode_card_number?(number) #:nodoc:
125
- ActiveMerchant::Billing::Base.test? &&
125
+ ActiveMerchant::Billing::Base.test? &&
126
126
  %w[1 2 3 success failure error].include?(number.to_s)
127
127
  end
128
-
129
- # Checks the validity of a card number by use of the the Luhn Algorithm.
128
+
129
+ # Checks the validity of a card number by use of the the Luhn Algorithm.
130
130
  # Please see http://en.wikipedia.org/wiki/Luhn_algorithm for details.
131
131
  def valid_checksum?(number) #:nodoc:
132
132
  sum = 0
@@ -134,7 +134,7 @@ module ActiveMerchant #:nodoc:
134
134
  weight = number[-1 * (i + 2), 1].to_i * (2 - (i % 2))
135
135
  sum += (weight < 10) ? weight : weight - 9
136
136
  end
137
-
137
+
138
138
  (number[-1,1].to_i == (10 - sum % 10) % 10)
139
139
  end
140
140
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveMerchant
2
- VERSION = "1.38.0.4"
2
+ VERSION = "1.38.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tanga_activemerchant
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.38.0.4
4
+ version: 1.38.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - gem-public_cert.pem
12
- date: 2016-10-26 00:00:00.000000000 Z
12
+ date: 2017-06-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -510,7 +510,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
510
510
  version: '0'
511
511
  requirements: []
512
512
  rubyforge_project: activemerchant
513
- rubygems_version: 2.5.1
513
+ rubygems_version: 2.4.5.1
514
514
  signing_key:
515
515
  specification_version: 4
516
516
  summary: Framework and tools for dealing with credit card transactions.