lib/active_merchant/billing/credit_card_methods.rb
# Checks the validity of a card number by use of specific algorithms
Checks the validity of a card number by use of specific algorithms
Checks the validity of a card number by use of specific algorithms
def valid_naranja_algo?(numbers) 
          num_array = numbers.to_s.chars.map(&:to_i)
          multipliers = [4, 3, 2, 7, 6, 5, 4, 3, 2, 7, 6, 5, 4, 3, 2]
          num_sum = num_array[0..14].zip(multipliers).map { |a, b| a * b }.reduce(:+)
          intermediate = 11 - (num_sum % 11)
          final_num = intermediate > 9 ? 0 : intermediate
          final_num == num_array[15]
        end
def valid_naranja_algo? ( numbers ) num_array = numbers . to_s . chars . map ( & :to_i ) multipliers = [ 4 , 3 , 2 , 7 , 6 , 5 , 4 , 3 , 2 , 7 , 6 , 5 , 4 , 3 , 2 ] num_sum = num_array [ 0 .. 14 ] . zip ( multipliers ) . map { | a , b | a * b } . reduce ( :+ ) intermediate = 11 - ( num_sum % 11 ) final_num = intermediate > 9 ? 0 : intermediate final_num == num_array [ 15 ] end
Checks the validity of a card number by use of specific algorithms
Checks the validity of a card number by use of specific algorithms
#:nodoc:
numbers
<not_specific>