Sha256: dfd602b8fd764e8169e789a81a2cda4765988d190e413047f0b78960f72e2627

Contents?: true

Size: 358 Bytes

Versions: 4

Compression:

Stored size: 358 Bytes

Contents

class Valvat
  module Checksum
    class NL < Base
      def validate
        vat.to_s.gsub(/[A-Z]/) { |let| (let.ord - 55).to_s }.to_i % 97 == 1 ||
        super
      end

      def check_digit
        sum_figures_by do |fig, i|
          fig*(i+2)
        end.modulo(11)
      end

      def str_wo_country
        super[0..-4]
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
valvat-1.0.1 lib/valvat/checksum/nl.rb
valvat-1.0.0 lib/valvat/checksum/nl.rb
valvat-0.9.1 lib/valvat/checksum/nl.rb
valvat-0.9.0 lib/valvat/checksum/nl.rb