ibandit 0.11.28 → 1.1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +37 -0
  3. data/.rubocop.yml +7 -10
  4. data/.rubocop_todo.yml +70 -15
  5. data/CHANGELOG.md +24 -0
  6. data/Gemfile +0 -6
  7. data/README.md +7 -7
  8. data/data/german_iban_rules.yml +1099 -1594
  9. data/data/raw/BLZ2.txt +15947 -17888
  10. data/data/structures.yml +4 -4
  11. data/ibandit.gemspec +4 -3
  12. data/lib/ibandit.rb +7 -4
  13. data/lib/ibandit/check_digit.rb +3 -1
  14. data/lib/ibandit/constants.rb +3 -1
  15. data/lib/ibandit/errors.rb +2 -0
  16. data/lib/ibandit/german_details_converter.rb +26 -2
  17. data/lib/ibandit/iban.rb +17 -11
  18. data/lib/ibandit/iban_assembler.rb +2 -0
  19. data/lib/ibandit/iban_splitter.rb +8 -7
  20. data/lib/ibandit/local_details_cleaner.rb +40 -37
  21. data/lib/ibandit/pseudo_iban_assembler.rb +5 -1
  22. data/lib/ibandit/pseudo_iban_splitter.rb +7 -1
  23. data/lib/ibandit/sweden/bank_lookup.rb +2 -0
  24. data/lib/ibandit/sweden/local_details_converter.rb +6 -2
  25. data/lib/ibandit/sweden/validator.rb +2 -0
  26. data/lib/ibandit/version.rb +3 -1
  27. data/spec/fixtures/germany_integration_test_cases.json +23 -17
  28. data/spec/fixtures/germany_unit_test_cases.json +31 -6
  29. data/spec/ibandit/constants_spec.rb +2 -0
  30. data/spec/ibandit/german_details_converter_spec.rb +9 -3
  31. data/spec/ibandit/iban_assembler_spec.rb +92 -3
  32. data/spec/ibandit/iban_spec.rb +197 -17
  33. data/spec/ibandit/iban_splitter_spec.rb +6 -0
  34. data/spec/ibandit/local_details_cleaner_spec.rb +136 -6
  35. data/spec/ibandit/pseudo_iban_assembler_spec.rb +3 -1
  36. data/spec/ibandit/pseudo_iban_splitter_spec.rb +2 -0
  37. data/spec/ibandit/structure_spec.rb +6 -4
  38. data/spec/ibandit/sweden/local_details_converter_spec.rb +3 -0
  39. data/spec/ibandit/sweden/validator_spec.rb +35 -0
  40. data/spec/spec_helper.rb +2 -0
  41. metadata +21 -8
  42. data/.travis.yml +0 -16
@@ -149,15 +149,15 @@ CH:
149
149
  :bank_code_format: "\\d{5}"
150
150
  :account_number_format: "[A-Z0-9]{12}"
151
151
  CR:
152
- :bank_code_position: 5
152
+ :bank_code_position: 6
153
153
  :bank_code_length: 3
154
154
  :branch_code_position: 0
155
155
  :branch_code_length: 0
156
- :account_number_position: 8
156
+ :account_number_position: 9
157
157
  :account_number_length: 14
158
- :total_length: 21
158
+ :total_length: 22
159
159
  :national_id_length: 3
160
- :bban_format: "\\d{3}\\d{14}"
160
+ :bban_format: "0\\d{3}\\d{14}"
161
161
  :bank_code_format: "\\d{3}"
162
162
  :account_number_format: "\\d{14}"
163
163
  CY:
@@ -1,15 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require File.expand_path("../lib/ibandit/version", __FILE__)
3
+ require File.expand_path("lib/ibandit/version", __dir__)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
+ gem.add_development_dependency "gc_ruboconfig", "~> 2.12.0"
6
7
  gem.add_development_dependency "nokogiri", "~> 1.6"
7
8
  gem.add_development_dependency "pry", "~> 0.10"
8
9
  gem.add_development_dependency "pry-nav", "~> 0.2"
9
10
  gem.add_development_dependency "rspec", "~> 3.3"
10
11
  gem.add_development_dependency "rspec-its", "~> 1.2"
11
- gem.add_development_dependency "rubocop", "~> 0.52.0"
12
- gem.add_development_dependency "sax-machine", "~> 1.3"
12
+ gem.add_development_dependency "rspec_junit_formatter", "~> 0.4.1"
13
+ gem.add_development_dependency "sax-machine", "~> 1.3"
13
14
 
14
15
  gem.add_runtime_dependency "i18n"
15
16
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "i18n"
2
4
  require "ibandit/version"
3
5
  require "ibandit/errors"
@@ -14,8 +16,8 @@ require "ibandit/pseudo_iban_splitter"
14
16
  require "ibandit/local_details_cleaner"
15
17
  require "ibandit/check_digit"
16
18
 
17
- I18n.load_path += Dir[File.expand_path("../../config/locales/*.{rb,yml}",
18
- __FILE__)]
19
+ I18n.load_path += Dir[File.expand_path("../config/locales/*.{rb,yml}",
20
+ __dir__)]
19
21
 
20
22
  module Ibandit
21
23
  class << self
@@ -23,17 +25,18 @@ module Ibandit
23
25
 
24
26
  def find_bic(country_code, national_id)
25
27
  raise NotImplementedError, "BIC finder is not defined" unless @bic_finder
28
+
26
29
  @bic_finder.call(country_code, national_id)
27
30
  end
28
31
 
29
32
  def structures
30
33
  @structures ||= YAML.load_file(
31
- File.expand_path("../../data/structures.yml", __FILE__),
34
+ File.expand_path("../data/structures.yml", __dir__),
32
35
  )
33
36
  end
34
37
 
35
38
  def translate(key, options = {})
36
- I18n.translate(key, { scope: [:ibandit] }.merge(options))
39
+ I18n.translate(key, scope: [:ibandit], **options)
37
40
  end
38
41
  end
39
42
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ibandit
2
4
  module CheckDigit
3
5
  ITALIAN_ODD_MAPPING = {
@@ -21,7 +23,7 @@ module Ibandit
21
23
  end
22
24
  end
23
25
  remainder = digits.join.to_i % 97
24
- sprintf("%02d", 98 - remainder)
26
+ sprintf("%<check_digit>02d", check_digit: 98 - remainder)
25
27
  end
26
28
 
27
29
  def self.italian(string)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ibandit
2
4
  module Constants
3
5
  CONSTRUCTABLE_IBAN_COUNTRY_CODES = %w[AT BE BG CY CZ DE DK EE ES FI FR GB GR
@@ -8,7 +10,7 @@ module Ibandit
8
10
  DECONSTRUCTABLE_IBAN_COUNTRY_CODES =
9
11
  CONSTRUCTABLE_IBAN_COUNTRY_CODES - PSEUDO_IBAN_COUNTRY_CODES
10
12
 
11
- PSEUDO_IBAN_CHECK_DIGITS = "ZZ".freeze
13
+ PSEUDO_IBAN_CHECK_DIGITS = "ZZ"
12
14
 
13
15
  PSEUDO_IBAN_PADDING_CHARACTER_FOR = {
14
16
  "SE" => "X", # Using X for backwards compatibility
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ibandit
2
4
  class InvalidCharacterError < StandardError; end
3
5
  class UnsupportedAccountDetails < StandardError; end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # German bank details don't map directly to IBANs in the same way as in other
2
4
  # countries - each bank has idiosyncracies for translating its cusomers' bank
3
5
  # details. These idiosyncracies are described in a document from the Bundesbank:
@@ -7,7 +9,7 @@ module Ibandit
7
9
  module GermanDetailsConverter
8
10
  def self.rules
9
11
  @rules ||= YAML.load_file(
10
- File.expand_path("../../../data/german_iban_rules.yml", __FILE__),
12
+ File.expand_path("../../data/german_iban_rules.yml", __dir__),
11
13
  )
12
14
  end
13
15
 
@@ -290,6 +292,7 @@ module Ibandit
290
292
 
291
293
  def valid?
292
294
  return false unless valid_length? && valid_account_type?
295
+
293
296
  [master_number[-1].to_i, 10].include?(remainder)
294
297
  end
295
298
 
@@ -514,7 +517,7 @@ module Ibandit
514
517
  updated_account_number =
515
518
  case unpadded_account_number.size
516
519
  when 5, 6 then unpadded_account_number + "00"
517
- when 7 then
520
+ when 7
518
521
  if Check63.new(unpadded_account_number + "00").valid?
519
522
  unpadded_account_number + "00"
520
523
  else
@@ -954,6 +957,23 @@ module Ibandit
954
957
  end
955
958
  end
956
959
 
960
+ # New version of Rule004200 but with another range:
961
+ # For 10-digit Account Numbers, only the following Account Numbers are
962
+ # applicable to be issued / created into an IBAN with the
963
+ # standard-IBAN rule: nnn4400001 to nnn4499999
964
+ class Rule004201 < Rule004200
965
+ def converted_details
966
+ unpadded_account_number = @account_number.gsub(/\A0+/, "")
967
+
968
+ if unpadded_account_number.size == 10 &&
969
+ %w[4400001 4499999].include?(unpadded_account_number.slice(3, 10))
970
+ { bank_code: @bank_code, account_number: @account_number }
971
+ else
972
+ super
973
+ end
974
+ end
975
+ end
976
+
957
977
  class Rule004301 < BaseRule
958
978
  def converted_details
959
979
  { bank_code: "66650085", account_number: @account_number }
@@ -1025,6 +1045,10 @@ module Ibandit
1025
1045
  end
1026
1046
  end
1027
1047
 
1048
+ class Rule004901 < Rule000000
1049
+ # Rule 0049 01 is actually about modulus checking, not IBAN construction
1050
+ end
1051
+
1028
1052
  class Rule005000 < BaseRule
1029
1053
  def converted_details
1030
1054
  { bank_code: "28550000", account_number: @account_number }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "yaml"
2
4
 
3
5
  module Ibandit
@@ -155,7 +157,7 @@ module Ibandit
155
157
 
156
158
  def valid_bank_code_length?
157
159
  return unless valid_country_code?
158
- return true if structure[:bank_code_length] == 0
160
+ return true if structure[:bank_code_length]&.zero?
159
161
 
160
162
  if swift_bank_code.nil? || swift_bank_code.empty?
161
163
  @errors[:bank_code] = Ibandit.translate(:is_required)
@@ -175,7 +177,7 @@ module Ibandit
175
177
  return true
176
178
  end
177
179
 
178
- if structure[:branch_code_length] == 0
180
+ if structure[:branch_code_length]&.zero?
179
181
  @errors[:branch_code] = Ibandit.translate(:not_used_in_country,
180
182
  country_code: country_code)
181
183
  elsif swift_branch_code.nil? || swift_branch_code.empty?
@@ -208,6 +210,7 @@ module Ibandit
208
210
 
209
211
  def valid_characters?
210
212
  return if iban.nil?
213
+
211
214
  if iban.scan(/[^A-Z0-9]/).any?
212
215
  @errors[:characters] =
213
216
  Ibandit.translate(:non_alphanumeric_characters,
@@ -222,7 +225,7 @@ module Ibandit
222
225
  return unless valid_country_code?
223
226
  return unless structure[:bban_format]
224
227
 
225
- if bban =~ Regexp.new(structure[:bban_format])
228
+ if bban&.match?(Regexp.new(structure[:bban_format]))
226
229
  true
227
230
  else
228
231
  @errors[:format] = Ibandit.translate(:invalid_format,
@@ -233,9 +236,9 @@ module Ibandit
233
236
 
234
237
  def valid_bank_code_format?
235
238
  return unless valid_bank_code_length?
236
- return true if structure[:bank_code_length] == 0
239
+ return true if structure[:bank_code_length]&.zero?
237
240
 
238
- if swift_bank_code =~ Regexp.new(structure[:bank_code_format])
241
+ if swift_bank_code&.match?(Regexp.new(structure[:bank_code_format]))
239
242
  true
240
243
  else
241
244
  @errors[:bank_code] = Ibandit.translate(:is_invalid)
@@ -247,7 +250,7 @@ module Ibandit
247
250
  return unless valid_branch_code_length?
248
251
  return true unless structure[:branch_code_format]
249
252
 
250
- if swift_branch_code =~ Regexp.new(structure[:branch_code_format])
253
+ if swift_branch_code&.match?(Regexp.new(structure[:branch_code_format]))
251
254
  true
252
255
  else
253
256
  @errors[:branch_code] = Ibandit.translate(:is_invalid)
@@ -258,7 +261,9 @@ module Ibandit
258
261
  def valid_account_number_format?
259
262
  return unless valid_account_number_length?
260
263
 
261
- if swift_account_number =~ Regexp.new(structure[:account_number_format])
264
+ if swift_account_number&.match?(
265
+ Regexp.new(structure[:account_number_format]),
266
+ )
262
267
  true
263
268
  else
264
269
  @errors[:account_number] = Ibandit.translate(:is_invalid)
@@ -457,12 +462,12 @@ module Ibandit
457
462
  @swift_branch_code = try_dup(local_details[:swift_branch_code])
458
463
  @swift_bank_code = try_dup(local_details[:swift_bank_code])
459
464
 
460
- @iban = IBANAssembler.assemble(swift_details)
465
+ @iban = IBANAssembler.assemble(swift_details)
461
466
 
462
467
  if source == :pseudo_iban
463
- @check_digits = try_dup(local_details[:check_digits])
468
+ @check_digits = try_dup(local_details[:check_digits])
464
469
  else
465
- @check_digits = @iban.slice(2, 2) unless @iban.nil?
470
+ @check_digits = @iban.slice(2, 2) unless @iban.nil?
466
471
  end
467
472
  end
468
473
 
@@ -477,7 +482,7 @@ module Ibandit
477
482
  @swift_account_number = swift_details[:account_number]
478
483
 
479
484
  return if Constants::PSEUDO_IBAN_COUNTRY_CODES.
480
- include?(@country_code)
485
+ include?(@country_code)
481
486
 
482
487
  @bank_code = swift_details[:bank_code]
483
488
  @branch_code = swift_details[:branch_code]
@@ -530,6 +535,7 @@ module Ibandit
530
535
 
531
536
  def pseudo_iban?(input)
532
537
  return false if input.nil?
538
+
533
539
  input.slice(2, 2) == Constants::PSEUDO_IBAN_CHECK_DIGITS
534
540
  end
535
541
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ibandit
2
4
  module IBANAssembler
3
5
  EXCEPTION_COUNTRY_CODES = %w[IT SM BE].freeze
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ibandit
2
4
  module IBANSplitter
3
5
  def self.split(iban)
4
6
  {
5
- country_code: country_code_from(iban),
6
- check_digits: check_digits_from(iban),
7
- bank_code: bank_code_from(iban),
8
- branch_code: branch_code_from(iban),
7
+ country_code: country_code_from(iban),
8
+ check_digits: check_digits_from(iban),
9
+ bank_code: bank_code_from(iban),
10
+ branch_code: branch_code_from(iban),
9
11
  account_number: account_number_from(iban),
10
12
  }
11
13
  end
@@ -36,9 +38,8 @@ module Ibandit
36
38
  end
37
39
 
38
40
  def self.branch_code_from(iban)
39
- unless decomposable?(iban) && structure(iban)[:branch_code_length] > 0
40
- return
41
- end
41
+ return unless decomposable?(iban) &&
42
+ structure(iban)[:branch_code_length]&.positive?
42
43
 
43
44
  iban.slice(
44
45
  structure(iban)[:branch_code_position] - 1,
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ibandit
2
4
  module LocalDetailsCleaner
3
5
  def self.clean(local_details)
@@ -57,8 +59,9 @@ module Ibandit
57
59
  # Account number may be 4-11 digits long.
58
60
  # Add leading zeros to account number if < 11 digits.
59
61
  return {} unless local_details[:account_number].length >= 4
62
+
60
63
  {
61
- bank_code: local_details[:bank_code],
64
+ bank_code: local_details[:bank_code],
62
65
  account_number: local_details[:account_number].rjust(11, "0"),
63
66
  }
64
67
  end
@@ -71,7 +74,7 @@ module Ibandit
71
74
  return {} unless local_details[:account_number].length >= 5
72
75
 
73
76
  {
74
- branch_code: local_details[:branch_code].delete("-"),
77
+ branch_code: local_details[:branch_code].delete("-"),
75
78
  account_number: local_details[:account_number].rjust(10, "0"),
76
79
  }
77
80
  end
@@ -80,7 +83,7 @@ module Ibandit
80
83
  account_number = local_details[:account_number].tr("-", "")
81
84
 
82
85
  {
83
- bank_code: local_details[:bank_code] || account_number.slice(0, 3),
86
+ bank_code: local_details[:bank_code] || account_number.slice(0, 3),
84
87
  account_number: account_number,
85
88
  }
86
89
  end
@@ -137,8 +140,8 @@ module Ibandit
137
140
  end
138
141
 
139
142
  {
140
- bank_code: bank_code,
141
- branch_code: branch_code,
143
+ bank_code: bank_code,
144
+ branch_code: branch_code,
142
145
  account_number: account_number,
143
146
  }
144
147
  end
@@ -158,7 +161,7 @@ module Ibandit
158
161
  end
159
162
 
160
163
  {
161
- bank_code: local_details[:bank_code],
164
+ bank_code: local_details[:bank_code],
162
165
  account_number: account_number,
163
166
  }
164
167
  end
@@ -180,7 +183,7 @@ module Ibandit
180
183
  return {} unless converted_details[:account_number].length >= 4
181
184
 
182
185
  {
183
- bank_code: converted_details[:bank_code],
186
+ bank_code: converted_details[:bank_code],
184
187
  account_number: converted_details[:account_number].rjust(10, "0"),
185
188
  }
186
189
  end
@@ -195,14 +198,14 @@ module Ibandit
195
198
  bank_code, account_number = local_details[:account_number].split("-", 2)
196
199
  elsif local_details[:account_number].gsub(/\s/, "").length == 14
197
200
  cleaned_account_number = local_details[:account_number].gsub(/\s/, "")
198
- bank_code = cleaned_account_number.slice(0, 4)
201
+ bank_code = cleaned_account_number.slice(0, 4)
199
202
  account_number = cleaned_account_number.slice(4, 10)
200
203
  else
201
204
  return {}
202
205
  end
203
206
 
204
207
  {
205
- bank_code: bank_code.rjust(4, "0"),
208
+ bank_code: bank_code.rjust(4, "0"),
206
209
  account_number: account_number.delete("-").rjust(10, "0"),
207
210
  }
208
211
  end
@@ -246,8 +249,8 @@ module Ibandit
246
249
  end
247
250
 
248
251
  {
249
- bank_code: bank_code,
250
- branch_code: branch_code,
252
+ bank_code: bank_code,
253
+ branch_code: branch_code,
251
254
  account_number: account_number,
252
255
  }
253
256
  end
@@ -267,15 +270,15 @@ module Ibandit
267
270
  end
268
271
 
269
272
  {
270
- bank_code: local_details[:bank_code],
273
+ bank_code: local_details[:bank_code],
271
274
  account_number: account_number,
272
275
  }
273
276
  end
274
277
 
275
278
  def self.clean_fr_details(local_details)
276
279
  {
277
- bank_code: local_details[:bank_code],
278
- branch_code: local_details[:branch_code],
280
+ bank_code: local_details[:bank_code],
281
+ branch_code: local_details[:branch_code],
279
282
  account_number: local_details[:account_number].gsub(/[-\s]/, ""),
280
283
  }
281
284
  end
@@ -296,8 +299,8 @@ module Ibandit
296
299
  account_number = account_number.rjust(8, "0") if account_number.length > 5
297
300
 
298
301
  {
299
- bank_code: bank_code,
300
- branch_code: branch_code,
302
+ bank_code: bank_code,
303
+ branch_code: branch_code,
301
304
  account_number: account_number,
302
305
  }
303
306
  end
@@ -317,7 +320,7 @@ module Ibandit
317
320
  bank_code, account_number = local_details[:account_number].split("-", 2)
318
321
 
319
322
  {
320
- bank_code: bank_code,
323
+ bank_code: bank_code,
321
324
  account_number: account_number,
322
325
  }
323
326
  end
@@ -334,14 +337,14 @@ module Ibandit
334
337
  case cleaned_acct_number.length
335
338
  when 16
336
339
  {
337
- bank_code: cleaned_acct_number.slice(0, 3),
338
- branch_code: cleaned_acct_number.slice(3, 4),
340
+ bank_code: cleaned_acct_number.slice(0, 3),
341
+ branch_code: cleaned_acct_number.slice(3, 4),
339
342
  account_number: cleaned_acct_number.slice(7, 9).ljust(17, "0"),
340
343
  }
341
344
  when 24
342
345
  {
343
- bank_code: cleaned_acct_number.slice(0, 3),
344
- branch_code: cleaned_acct_number.slice(3, 4),
346
+ bank_code: cleaned_acct_number.slice(0, 3),
347
+ branch_code: cleaned_acct_number.slice(3, 4),
345
348
  account_number: cleaned_acct_number.slice(7, 17),
346
349
  }
347
350
  else local_details
@@ -363,8 +366,8 @@ module Ibandit
363
366
  account_number = account_number.rjust(8, "0") if account_number.length > 5
364
367
 
365
368
  {
366
- bank_code: bank_code,
367
- branch_code: branch_code,
369
+ bank_code: bank_code,
370
+ branch_code: branch_code,
368
371
  account_number: account_number,
369
372
  }
370
373
  end
@@ -381,7 +384,7 @@ module Ibandit
381
384
  end
382
385
 
383
386
  {
384
- bank_code: bank_code.rjust(4, "0"),
387
+ bank_code: bank_code.rjust(4, "0"),
385
388
  account_number: pad_is_account_number(parts),
386
389
  }
387
390
  end
@@ -389,8 +392,8 @@ module Ibandit
389
392
  def self.clean_it_details(local_details)
390
393
  # Add leading zeros to account number if < 12 digits.
391
394
  {
392
- bank_code: local_details[:bank_code],
393
- branch_code: local_details[:branch_code],
395
+ bank_code: local_details[:bank_code],
396
+ branch_code: local_details[:branch_code],
394
397
  account_number: local_details[:account_number].rjust(12, "0"),
395
398
  }
396
399
  end
@@ -430,8 +433,8 @@ module Ibandit
430
433
  account_number = account_number.rjust(18, "0")
431
434
 
432
435
  {
433
- bank_code: bank_code,
434
- branch_code: branch_code,
436
+ bank_code: bank_code,
437
+ branch_code: branch_code,
435
438
  account_number: account_number,
436
439
  }
437
440
  end
@@ -439,7 +442,7 @@ module Ibandit
439
442
  def self.clean_nl_details(local_details)
440
443
  # Add leading zeros to account number if < 10 digits.
441
444
  {
442
- bank_code: local_details[:bank_code],
445
+ bank_code: local_details[:bank_code],
443
446
  account_number: local_details[:account_number].rjust(10, "0"),
444
447
  }
445
448
  end
@@ -458,7 +461,7 @@ module Ibandit
458
461
  end
459
462
 
460
463
  {
461
- bank_code: bank_code,
464
+ bank_code: bank_code,
462
465
  account_number: account_number,
463
466
  }
464
467
  end
@@ -496,8 +499,8 @@ module Ibandit
496
499
  end
497
500
 
498
501
  {
499
- bank_code: bank_code,
500
- branch_code: branch_code,
502
+ bank_code: bank_code,
503
+ branch_code: branch_code,
501
504
  account_number: account_number,
502
505
  }
503
506
  end
@@ -516,7 +519,7 @@ module Ibandit
516
519
  end
517
520
 
518
521
  {
519
- bank_code: bank_code,
522
+ bank_code: bank_code,
520
523
  account_number: account_number,
521
524
  }
522
525
  end
@@ -549,7 +552,7 @@ module Ibandit
549
552
  def self.clean_si_details(local_details)
550
553
  # Add leading zeros to account number if < 10 digits.
551
554
  {
552
- bank_code: local_details[:bank_code],
555
+ bank_code: local_details[:bank_code],
553
556
  account_number: local_details[:account_number].rjust(10, "0"),
554
557
  }
555
558
  end
@@ -570,7 +573,7 @@ module Ibandit
570
573
  ken_1 = parts[2].nil? ? "" : parts[2].rjust(6, "0")
571
574
  ken_2 = parts[3].nil? ? "" : parts[3].rjust(4, "0")
572
575
 
573
- kennitala = ken_1.empty? ? "" : (ken_1 + ken_2).rjust(10, "0")
576
+ kennitala = ken_1.empty? ? "" : (ken_1 + ken_2).rjust(10, "0")
574
577
 
575
578
  hufo + reikningsnumer + kennitala
576
579
  end
@@ -578,8 +581,8 @@ module Ibandit
578
581
 
579
582
  def self.swift_details_for(local_details)
580
583
  {
581
- swift_bank_code: local_details[:bank_code],
582
- swift_branch_code: local_details[:branch_code],
584
+ swift_bank_code: local_details[:bank_code],
585
+ swift_branch_code: local_details[:branch_code],
583
586
  swift_account_number: local_details[:account_number],
584
587
  }
585
588
  end