ibandit 1.19.0 → 1.20.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47171b99a86687a326f6f674684d5faa489f4aef980e623e2f43d3ffdf841d84
4
- data.tar.gz: 6074f09b34e39a205fdacabbc1a7376dfec8ac38f2821cbfd1d7ae6a8ba683cf
3
+ metadata.gz: 2c3c4654f26735c5412bd2cf3f02c1c5802d1fb2c6c9f775f1472ea0660cc0c3
4
+ data.tar.gz: d67a80fea5521e0eac1f1486aefaf584b886ebf846a5d05e3bce8ec6fee21182
5
5
  SHA512:
6
- metadata.gz: 9f2ff5eb107524c44c68118315f916d86c7550335bae82747165edbfcf4f11d196b29cd3ec6f130babbf7765866925768dca7b5532357510248e8994e9bca0ae
7
- data.tar.gz: 0a66dd61f63feeb8534a6b48de006c64928c6f43bf65463ca8e24ccd412d13aa87fc8b8102a4fb54d5585d70a96df91db50be8117c7c025ac576fb0d033c4909
6
+ metadata.gz: 8c092c285a2923177c42b7deb1e305e9a2b4b1625d642da44a1bca3adac3667276216f187e947fe3f90009ec4f1b190898cf12236dac52e202ba8df61e99fe45
7
+ data.tar.gz: f1fcb038c96b3ba56fe53fe92688b2c19e25a9dfcbdc423d387fbceca835afa4e78337bf87ec3f9dee71d5bd5880837ac4f0728a4f67a45a7a2de0135aa230a7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.20.0 - October 13, 2023
2
+
3
+ - Do not allow all 0 transit numbers in CA
4
+
1
5
  ## 1.19.0 - October 3, 2023
2
6
 
3
7
  - Do not allow all-0 account numbers for CA
@@ -20,7 +20,7 @@ CA:
20
20
  end: 12
21
21
  excl: false
22
22
  :bank_code_format: "\\d{4}"
23
- :branch_code_format: "\\d{5}"
23
+ :branch_code_format: "0{0,4}[1-9][0-9]{0,4}"
24
24
  :account_number_format: "(?!0+\\z)\\d{7,12}"
25
25
  :national_id_length: 9
26
26
  :pseudo_iban_bank_code_length: 4
data/data/structures.yml CHANGED
@@ -1500,7 +1500,7 @@ CA:
1500
1500
  end: 12
1501
1501
  excl: false
1502
1502
  :bank_code_format: "\\d{4}"
1503
- :branch_code_format: "\\d{5}"
1503
+ :branch_code_format: 0{0,4}[1-9][0-9]{0,4}
1504
1504
  :account_number_format: "(?!0+\\z)\\d{7,12}"
1505
1505
  :national_id_length: 9
1506
1506
  :pseudo_iban_bank_code_length: 4
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ibandit
4
- VERSION = "1.19.0"
4
+ VERSION = "1.20.0"
5
5
  end
@@ -422,10 +422,55 @@ describe Ibandit::IBAN do
422
422
  {
423
423
  country_code: "CA",
424
424
  bank_code: bank_code,
425
- branch_code: "00063",
425
+ branch_code: branch_code,
426
426
  account_number: account_number,
427
427
  }
428
428
  end
429
+ let(:branch_code) { "00063" }
430
+
431
+ context "and a 5 digit branch code" do
432
+ let(:account_number) { "0123456" }
433
+ let(:bank_code) { "036" }
434
+ let(:branch_code) { "00063" }
435
+
436
+ its(:country_code) { is_expected.to eq("CA") }
437
+ its(:bank_code) { is_expected.to eq("0036") }
438
+ its(:branch_code) { is_expected.to eq("00063") }
439
+ its(:account_number) { is_expected.to eq("0123456") }
440
+ its(:swift_bank_code) { is_expected.to eq("0036") }
441
+ its(:swift_branch_code) { is_expected.to eq("00063") }
442
+ its(:swift_account_number) { is_expected.to eq("0123456") }
443
+ its(:swift_national_id) { is_expected.to eq("003600063") }
444
+ its(:pseudo_iban) { is_expected.to eq("CAZZ003600063_____0123456") }
445
+
446
+ its(:iban) { is_expected.to be_nil }
447
+ its(:valid?) { is_expected.to eq(true) }
448
+ its(:to_s) { is_expected.to eq("") }
449
+ end
450
+
451
+ context "for an all zero transit number" do
452
+ let(:account_number) { "0123456" }
453
+ let(:bank_code) { "036" }
454
+ let(:branch_code) { "00000" }
455
+
456
+ it "is invalid and has the correct errors" do
457
+ expect(subject.valid?).to eq(false)
458
+ expect(subject.errors).
459
+ to eq(branch_code: "format is invalid")
460
+ end
461
+ end
462
+
463
+ context "and a 4 digit branch code" do
464
+ let(:account_number) { "0123456" }
465
+ let(:bank_code) { "036" }
466
+ let(:branch_code) { "0063" }
467
+
468
+ it "is invalid and has the correct errors" do
469
+ expect(subject.valid?).to eq(false)
470
+ expect(subject.errors).
471
+ to eq(branch_code: "is the wrong length (should be 5 characters)")
472
+ end
473
+ end
429
474
 
430
475
  context "and a 3 digit bank code" do
431
476
  let(:account_number) { "0123456" }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ibandit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.19.0
4
+ version: 1.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GoCardless
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-03 00:00:00.000000000 Z
11
+ date: 2023-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gc_ruboconfig