Sha256: 179fdf47c9bf1a762d83832f8e6d6081a844e087b125b4bcd757911b401dfb70

Contents?: true

Size: 429 Bytes

Versions: 15

Compression:

Stored size: 429 Bytes

Contents

# frozen_string_literal: true

class Valvat
  module Checksum
    class IT < Base
      def validate
        y = figures_str[7..9].to_i
        y >= 1 && (y <= 100 || [120, 121, 999].include?(y)) &&
          figures_str[0..6] != '0000000' &&
          super
      end

      def check_digit
        chk = 10 - sum_of_figures_for_at_es_it_se(reverse_ints: true).modulo(10)
        chk == 10 ? 0 : chk
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
valvat-2.0.1 lib/valvat/checksum/it.rb
valvat-2.0.0 lib/valvat/checksum/it.rb
valvat-1.4.4 lib/valvat/checksum/it.rb
valvat-1.4.3 lib/valvat/checksum/it.rb
valvat-1.4.2 lib/valvat/checksum/it.rb
valvat-1.4.1 lib/valvat/checksum/it.rb
valvat-1.4.0 lib/valvat/checksum/it.rb
valvat-1.3.0 lib/valvat/checksum/it.rb
valvat-1.2.1 lib/valvat/checksum/it.rb
valvat-1.2.0 lib/valvat/checksum/it.rb
valvat-1.1.5 lib/valvat/checksum/it.rb
valvat-1.1.4 lib/valvat/checksum/it.rb
valvat-1.1.3 lib/valvat/checksum/it.rb
valvat-1.1.2 lib/valvat/checksum/it.rb
valvat-1.1.1 lib/valvat/checksum/it.rb