Class: Ibandit::GermanDetailsConverter::Rule004200

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

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



940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
# File 'lib/ibandit/german_details_converter.rb', line 940

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