ibandit 0.11.11 → 0.11.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/ibandit/iban.rb +14 -0
- data/lib/ibandit/version.rb +1 -1
- data/spec/ibandit/iban_spec.rb +101 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08d2b3f6258a3edcbfb5b2e7edcd1c44909d2476'
|
4
|
+
data.tar.gz: 57e642a2dff2d94ffa93fa93b6ed30ca7862c797
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b54fe472f576c2ddf662794fd279df02779750493fe27608bdc07d45d9085e449e6c3cf889a7f113803a1b18972e2ecaac872e03b2b6b0e6e243e2c9103d569
|
7
|
+
data.tar.gz: bd9ccc9de7cd8dfb2f6bb676945046d78ed7168de51c4ad0b353b59cc4722c8018bdfd9137ab634251f09493a1c9937308175e87e273c07db028f88de7bf0f0e
|
data/CHANGELOG.md
CHANGED
data/lib/ibandit/iban.rb
CHANGED
@@ -269,6 +269,7 @@ module Ibandit
|
|
269
269
|
case country_code
|
270
270
|
when "DE" then supports_iban_determination?
|
271
271
|
when "SE" then valid_swedish_details?
|
272
|
+
when "AU" then valid_australian_details?
|
272
273
|
else true
|
273
274
|
end
|
274
275
|
end
|
@@ -341,6 +342,19 @@ module Ibandit
|
|
341
342
|
true
|
342
343
|
end
|
343
344
|
|
345
|
+
def valid_australian_details?
|
346
|
+
return true unless country_code == "AU"
|
347
|
+
|
348
|
+
bsb_check?
|
349
|
+
end
|
350
|
+
|
351
|
+
def bsb_check?
|
352
|
+
return true unless country_code == "AU"
|
353
|
+
return true unless Ibandit.modulus_checker
|
354
|
+
|
355
|
+
valid_modulus_check_branch_code?
|
356
|
+
end
|
357
|
+
|
344
358
|
###################
|
345
359
|
# Private methods #
|
346
360
|
###################
|
data/lib/ibandit/version.rb
CHANGED
data/spec/ibandit/iban_spec.rb
CHANGED
@@ -1698,6 +1698,107 @@ describe Ibandit::IBAN do
|
|
1698
1698
|
end
|
1699
1699
|
end
|
1700
1700
|
|
1701
|
+
describe "valid_australian_details" do
|
1702
|
+
subject { iban.valid_australian_details? }
|
1703
|
+
|
1704
|
+
context "with non-Australian details" do
|
1705
|
+
let(:arg) do
|
1706
|
+
{
|
1707
|
+
country_code: "GB",
|
1708
|
+
bank_code: "1234",
|
1709
|
+
branch_code: "200000",
|
1710
|
+
account_number: "55779911",
|
1711
|
+
}
|
1712
|
+
end
|
1713
|
+
|
1714
|
+
it { is_expected.to be(true) }
|
1715
|
+
end
|
1716
|
+
|
1717
|
+
context "with Australian details" do
|
1718
|
+
let(:arg) do
|
1719
|
+
{
|
1720
|
+
country_code: "AU",
|
1721
|
+
branch_code: "123-456",
|
1722
|
+
account_number: "123456789",
|
1723
|
+
}
|
1724
|
+
end
|
1725
|
+
|
1726
|
+
context "without a modulus checker defined" do
|
1727
|
+
it { is_expected.to be(true) }
|
1728
|
+
end
|
1729
|
+
|
1730
|
+
context "with a modulus checker defined" do
|
1731
|
+
before do
|
1732
|
+
Ibandit.modulus_checker = double(
|
1733
|
+
valid_branch_code?: valid_branch_code,
|
1734
|
+
)
|
1735
|
+
iban.valid_australian_details?
|
1736
|
+
end
|
1737
|
+
after { Ibandit.modulus_checker = nil }
|
1738
|
+
|
1739
|
+
let(:valid_branch_code) { true }
|
1740
|
+
|
1741
|
+
it "calls valid_branch_code? with an IBAN object" do
|
1742
|
+
expect(Ibandit.modulus_checker).
|
1743
|
+
to receive(:valid_branch_code?).
|
1744
|
+
with(instance_of(Ibandit::IBAN))
|
1745
|
+
|
1746
|
+
iban.valid_australian_details?
|
1747
|
+
end
|
1748
|
+
|
1749
|
+
it { is_expected.to be(true) }
|
1750
|
+
|
1751
|
+
context "with an invalid bsb" do
|
1752
|
+
let(:valid_branch_code) { false }
|
1753
|
+
|
1754
|
+
it { is_expected.to be(false) }
|
1755
|
+
|
1756
|
+
context "locale en", locale: :en do
|
1757
|
+
specify do
|
1758
|
+
expect(iban.errors).to include(branch_code: "is invalid")
|
1759
|
+
end
|
1760
|
+
end
|
1761
|
+
|
1762
|
+
context "locale fr", locale: :fr do
|
1763
|
+
specify do
|
1764
|
+
expect(iban.errors).to include(branch_code: "est invalide")
|
1765
|
+
end
|
1766
|
+
end
|
1767
|
+
|
1768
|
+
context "locale de", locale: :de do
|
1769
|
+
specify do
|
1770
|
+
expect(iban.errors).to include(branch_code: "ist nicht gültig")
|
1771
|
+
end
|
1772
|
+
end
|
1773
|
+
|
1774
|
+
context "locale pt", locale: :pt do
|
1775
|
+
specify do
|
1776
|
+
expect(iban.errors).to include(branch_code: "é inválido")
|
1777
|
+
end
|
1778
|
+
end
|
1779
|
+
|
1780
|
+
context "locale es", locale: :es do
|
1781
|
+
specify do
|
1782
|
+
expect(iban.errors).to include(branch_code: "es inválido")
|
1783
|
+
end
|
1784
|
+
end
|
1785
|
+
|
1786
|
+
context "locale it", locale: :it do
|
1787
|
+
specify do
|
1788
|
+
expect(iban.errors).to include(branch_code: "non è valido")
|
1789
|
+
end
|
1790
|
+
end
|
1791
|
+
|
1792
|
+
context "locale nl", locale: :nl do
|
1793
|
+
specify do
|
1794
|
+
expect(iban.errors).to include(branch_code: "is ongeldig")
|
1795
|
+
end
|
1796
|
+
end
|
1797
|
+
end
|
1798
|
+
end
|
1799
|
+
end
|
1800
|
+
end
|
1801
|
+
|
1701
1802
|
describe "#valid?" do
|
1702
1803
|
describe "validations called" do
|
1703
1804
|
after { iban.valid? }
|
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: 0.11.
|
4
|
+
version: 0.11.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GoCardless
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -206,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
206
|
version: '0'
|
207
207
|
requirements: []
|
208
208
|
rubyforge_project:
|
209
|
-
rubygems_version: 2.6.
|
209
|
+
rubygems_version: 2.6.14
|
210
210
|
signing_key:
|
211
211
|
specification_version: 4
|
212
212
|
summary: Convert national banking details into IBANs, and vice-versa.
|