Class: Ibandit::GermanDetailsConverter::Rule004200

Inherits:
BaseRule
  • Object
show all
Defined in:
lib/ibandit/german_details_converter.rb

Direct Known Subclasses

Rule004201

Instance Method Summary collapse

Methods inherited from BaseRule

#initialize

Constructor Details

This class inherits a constructor from Ibandit::GermanDetailsConverter::BaseRule

Instance Method Details

#converted_detailsObject



945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
# File 'lib/ibandit/german_details_converter.rb', line 945

def converted_details
   = @account_number.gsub(/\A0+/, "")

  if @account_number.to_i.between?(50462000, 50463999) ||
      @account_number.to_i.between?(50469000, 50469999)
    { bank_code: @bank_code, account_number: @account_number }
  elsif .size != 8 ||
      [3] != "0" ||
      %w[00000 00999].include?(.slice(3, 5))
    msg = "Account does not support payment transactions"
    raise UnsupportedAccountDetails, msg
  else
    { bank_code: @bank_code, account_number: @account_number }
  end
end