lib/active_merchant/billing/credit_card_methods.rb
# Checks the validity of a card number by use of the the Luhn Algorithm. 
# Please see http://en.wikipedia.org/wiki/Luhn_algorithm for details.
Checks the validity of a card number by use of the the Luhn Algorithm.
Checks the validity of a card number by use of the the Luhn Algorithm .
def valid_checksum?(number) 
          sum = 0
          for i in 0..number.length
            weight = number[-1 * (i + 2), 1].to_i * (2 - (i % 2))
            sum += (weight < 10) ? weight : weight - 9
          end
          (number[-1,1].to_i == (10 - sum % 10) % 10)
        end
def valid_checksum? ( number ) sum = 0 for i in 0 .. number . length weight = number [ - 1 * ( i + 2 ) , 1 ] . to_i * ( 2 - ( i % 2 ) ) sum += ( weight < 10 ) ? weight : weight - 9 end ( number [ - 1 , 1 ] . to_i == ( 10 - sum % 10 ) % 10 ) end
Checks the validity of a card number by use of the the Luhn Algorithm.
Checks the validity of a card number by use of the the Luhn Algorithm .
#:nodoc:
number
<not_specific>