Class: Ibandit::GermanDetailsConverter::Rule005600

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

Constant Summary collapse

EXCEPTION_BANK_CODES =
%w[
  10010111 26510111 36210111 48010111 59010111 70010111 13010111 27010111
  37010111 50010111 60010111 72010111 16010111 28010111 38010111 50510111
  63010111 75010111 20010111 29010111 39010111 51010111 65310111 76010111
  21010111 29210111 40010111 51310111 66010111 79010111 21210111 30010111
  41010111 51410111 66610111 79510111 23010111 31010111 42010111 52010111
  67010111 81010111 25010111 33010111 42610112 54210111 67210111 82010111
  25410111 35010111 43010111 55010111 68010111 86010111 25910111 35211012
  44010111 57010111 68310111 26010111 36010111 46010111 58510111 69010111
].freeze
PSEUDO_ACCOUNT_NUMBER_MAPPING =
{
  "0000000036" => "1010240003",
  "0000000050" => "1328506100",
  "0000000099" => "1826063000",
  "0000000110" => "1015597802",
  "0000000240" => "1010240000",
  "0000000333" => "1011296100",
  "0000000555" => "1600220800",
  "0000000556" => "1000556100",
  "0000000606" => "1967153801",
  "0000000700" => "1070088000",
  "0000000777" => "1006015200",
  "0000000999" => "1010240001",
  "0000001234" => "1369152400",
  "0000001313" => "1017500000",
  "0000001888" => "1241113000",
  "0000001953" => "1026500901",
  "0000001998" => "1547620500",
  "0000002007" => "1026500907",
  "0000004004" => "1635100100",
  "0000004444" => "1304610900",
  "0000005000" => "1395676000",
  "0000005510" => "1611754300",
  "0000006060" => "1000400200",
  "0000006800" => "1296401301",
  "0000055555" => "1027758200",
  "0000060000" => "1005007001",
  "0000066666" => "1299807801",
  "0000102030" => "1837501600",
  "0000121212" => "1249461502",
  "0000130500" => "1413482100",
  "0000202020" => "1213431002",
  "0000414141" => "1010555101",
  "0000666666" => "1798758900",
  "0005000000" => "1403124100",
  "0500500500" => "1045720000",
}.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



1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
# File 'lib/ibandit/german_details_converter.rb', line 1281

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

  if .gsub(/\A0+/, "").size < 10 &&
      EXCEPTION_BANK_CODES.include?(@bank_code)
    msg = "Account does not support payment transactions"
    raise UnsupportedAccountDetails, msg
  end

  { bank_code: @bank_code, account_number:  }
end