Class: Ibandit::GermanDetailsConverter::Rule003501

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

Constant Summary collapse

PSEUDO_ACCOUNT_NUMBER_MAPPING =
{ "0000009696" => "1490196966" }.freeze

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



869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
# File 'lib/ibandit/german_details_converter.rb', line 869

def converted_details
  if @account_number.to_i.between?(800000000, 899999999)
    msg = "Account does not support payment transactions"
    raise UnsupportedAccountDetails, msg
  end

  updated_bank_code = Rule003101::BANK_CODE_MAPPING.fetch(
    @account_number.rjust(10, "0").slice(0, 3),
    @bank_code,
  )

   = PSEUDO_ACCOUNT_NUMBER_MAPPING.fetch(
    @account_number.rjust(10, "0"),
    @account_number,
  )

  { bank_code: updated_bank_code, account_number:  }
end