Sha256: 4c4d0c4af08c84213ee132972974349309330b31ffeabfb905a0f66bc4d45ca9

Contents?: true

Size: 388 Bytes

Versions: 3

Compression:

Stored size: 388 Bytes

Contents

module Virtuaaliviivakoodi
  class IBANNormalizer
    def self.call(iban)
      iban_validator = IBANTools::IBAN.new(iban)

      raise(ArgumentError, "IBAN is not valid") unless iban_validator.validation_errors.empty?
      raise(ArgumentError, "IBAN is not Finnish") unless iban_validator.country_code == "FI"

      # No country code
      iban_validator.code[2..-1]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
virtuaaliviivakoodi-1.0.0 lib/virtuaaliviivakoodi/iban_normalizer.rb
virtuaaliviivakoodi-0.1.1 lib/virtuaaliviivakoodi/iban_normalizer.rb
virtuaaliviivakoodi-0.1.0 lib/virtuaaliviivakoodi/iban_normalizer.rb