lib/active_merchant/billing/credit_card_methods.rb
# Returns true if it validates. Optionally, you can pass a card brand as an argument and
# make sure it is of the correct brand.
#
# References:
# - http://perl.about.com/compute/perl/library/nosearch/P073000.htm
# - http://www.beachnet.com/~hstiles/cardtype.html
Returns true if it validates. Optionally, you can pass a card brand as an argument and
make sure it is of the correct brand.


Returns true if it validates . Optionally you can pass a card brand as an argument and make sure it is of the correct brand .
def valid_creditel_algo?(numbers) 
          num_array = numbers.to_s.chars.map(&:to_i)
          multipliers = [5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9]
          num_sum = num_array[0..14].zip(multipliers).map { |a, b| a * b }.reduce(:+)
          final_num = num_sum % 10
          final_num == num_array[15]
        end
def valid_creditel_algo? ( numbers ) num_array = numbers . to_s . chars . map ( & :to_i ) multipliers = [ 5 , 4 , 3 , 2 , 1 , 9 , 8 , 7 , 6 , 5 , 4 , 3 , 2 , 1 , 9 ] num_sum = num_array [ 0 .. 14 ] . zip ( multipliers ) . map { | a , b | a * b } . reduce ( :+ ) final_num = num_sum % 10 final_num == num_array [ 15 ] end
Returns true if it validates.
Returns true if it validates .
#:nodoc:
numbers
<not_specific>