ibandit 0.11.9 → 0.11.10
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/data/structures.yml +3 -3
- data/lib/ibandit/local_details_cleaner.rb +7 -1
- data/lib/ibandit/version.rb +1 -1
- data/spec/ibandit/iban_spec.rb +57 -19
- data/spec/ibandit/local_details_cleaner_spec.rb +2 -2
- data/spec/ibandit/pseudo_iban_assembler_spec.rb +2 -2
- 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: a9a33af92874b7a40f4a8696b7cd25eb59590094
|
4
|
+
data.tar.gz: 3cdd502edd0f62bc40119f3863b8711a21bd6669
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 062edcac1e201a30ea007c6dacf131d611fd679bf74c711d290ea18e91246c933cd4cc55a9e523c9bbdd810aa6dcde80b11af092adbdcbb110c3d736b3638126
|
7
|
+
data.tar.gz: d00da8559f97e04603bed2dac82fc66792bff1ed3d95510f4cfc3d8c0480581dd3f0c13e0b901efc4f1ddce1b0568e7cf119706143f60f25f490b11cc0316e80
|
data/CHANGELOG.md
CHANGED
data/data/structures.yml
CHANGED
@@ -52,12 +52,12 @@ AT:
|
|
52
52
|
AU:
|
53
53
|
:bank_code_length: 0
|
54
54
|
:branch_code_length: 6
|
55
|
-
:account_number_length:
|
55
|
+
:account_number_length: 10
|
56
56
|
:branch_code_format: "\\d{6}"
|
57
|
-
:account_number_format: "
|
57
|
+
:account_number_format: "[A-Z0-9]{10}"
|
58
58
|
:pseudo_iban_bank_code_length: 0
|
59
59
|
:pseudo_iban_branch_code_length: 6
|
60
|
-
:pseudo_iban_account_number_length:
|
60
|
+
:pseudo_iban_account_number_length: 10
|
61
61
|
:national_id_length: 6
|
62
62
|
AZ:
|
63
63
|
:bank_code_position: 5
|
@@ -62,9 +62,15 @@ module Ibandit
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def self.clean_au_details(local_details)
|
65
|
+
# Account number may be up to 10 digits long.
|
66
|
+
# Add leading zeros to account number if < 10 digits.
|
67
|
+
#
|
68
|
+
# Minimum account_number length is 6
|
69
|
+
return {} unless local_details[:account_number].length >= 6
|
70
|
+
|
65
71
|
{
|
66
72
|
branch_code: local_details[:branch_code].delete("-"),
|
67
|
-
account_number: local_details[:account_number],
|
73
|
+
account_number: local_details[:account_number].rjust(10, "0"),
|
68
74
|
}
|
69
75
|
end
|
70
76
|
|
data/lib/ibandit/version.rb
CHANGED
data/spec/ibandit/iban_spec.rb
CHANGED
@@ -164,22 +164,60 @@ describe Ibandit::IBAN do
|
|
164
164
|
{
|
165
165
|
country_code: "AU",
|
166
166
|
branch_code: "123-456",
|
167
|
-
account_number:
|
167
|
+
account_number: account_number,
|
168
168
|
}
|
169
169
|
end
|
170
170
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
171
|
+
context "and a 9 digit account number" do
|
172
|
+
let(:account_number) { "123456789" }
|
173
|
+
|
174
|
+
its(:country_code) { is_expected.to eq("AU") }
|
175
|
+
its(:bank_code) { is_expected.to be_nil }
|
176
|
+
its(:branch_code) { is_expected.to eq("123456") }
|
177
|
+
its(:account_number) { is_expected.to eq("0123456789") }
|
178
|
+
its(:swift_bank_code) { is_expected.to be_nil }
|
179
|
+
its(:swift_branch_code) { is_expected.to eq("123456") }
|
180
|
+
its(:swift_account_number) { is_expected.to eq("0123456789") }
|
181
|
+
its(:swift_national_id) { is_expected.to eq("123456") }
|
182
|
+
its(:iban) { is_expected.to be_nil }
|
183
|
+
its(:pseudo_iban) { is_expected.to eq("AUZZ1234560123456789") }
|
184
|
+
its(:valid?) { is_expected.to eq(true) }
|
185
|
+
its(:to_s) { is_expected.to eq("") }
|
186
|
+
end
|
187
|
+
|
188
|
+
context "and a 6 digit account number" do
|
189
|
+
let(:account_number) { "123456" }
|
190
|
+
|
191
|
+
its(:country_code) { is_expected.to eq("AU") }
|
192
|
+
its(:bank_code) { is_expected.to be_nil }
|
193
|
+
its(:branch_code) { is_expected.to eq("123456") }
|
194
|
+
its(:account_number) { is_expected.to eq("0000123456") }
|
195
|
+
its(:swift_bank_code) { is_expected.to be_nil }
|
196
|
+
its(:swift_branch_code) { is_expected.to eq("123456") }
|
197
|
+
its(:swift_account_number) { is_expected.to eq("0000123456") }
|
198
|
+
its(:swift_national_id) { is_expected.to eq("123456") }
|
199
|
+
its(:iban) { is_expected.to be_nil }
|
200
|
+
its(:pseudo_iban) { is_expected.to eq("AUZZ1234560000123456") }
|
201
|
+
its(:valid?) { is_expected.to eq(true) }
|
202
|
+
its(:to_s) { is_expected.to eq("") }
|
203
|
+
end
|
204
|
+
|
205
|
+
context "and a 10 characters alphanumeric account number" do
|
206
|
+
let(:account_number) { "AB1234567" }
|
207
|
+
|
208
|
+
its(:country_code) { is_expected.to eq("AU") }
|
209
|
+
its(:bank_code) { is_expected.to be_nil }
|
210
|
+
its(:branch_code) { is_expected.to eq("123456") }
|
211
|
+
its(:account_number) { is_expected.to eq("0AB1234567") }
|
212
|
+
its(:swift_bank_code) { is_expected.to be_nil }
|
213
|
+
its(:swift_branch_code) { is_expected.to eq("123456") }
|
214
|
+
its(:swift_account_number) { is_expected.to eq("0AB1234567") }
|
215
|
+
its(:swift_national_id) { is_expected.to eq("123456") }
|
216
|
+
its(:iban) { is_expected.to be_nil }
|
217
|
+
its(:pseudo_iban) { is_expected.to eq("AUZZ1234560AB1234567") }
|
218
|
+
its(:valid?) { is_expected.to eq(true) }
|
219
|
+
its(:to_s) { is_expected.to eq("") }
|
220
|
+
end
|
183
221
|
end
|
184
222
|
|
185
223
|
context "when the IBAN was created from an Australian pseudo-IBAN" do
|
@@ -188,13 +226,13 @@ describe Ibandit::IBAN do
|
|
188
226
|
its(:country_code) { is_expected.to eq("AU") }
|
189
227
|
its(:bank_code) { is_expected.to be_nil }
|
190
228
|
its(:branch_code) { is_expected.to eq("123456") }
|
191
|
-
its(:account_number) { is_expected.to eq("
|
229
|
+
its(:account_number) { is_expected.to eq("0123456789") }
|
192
230
|
its(:swift_bank_code) { is_expected.to be_nil }
|
193
231
|
its(:swift_branch_code) { is_expected.to eq("123456") }
|
194
|
-
its(:swift_account_number) { is_expected.to eq("
|
232
|
+
its(:swift_account_number) { is_expected.to eq("0123456789") }
|
195
233
|
its(:swift_national_id) { is_expected.to eq("123456") }
|
196
234
|
its(:iban) { is_expected.to be_nil }
|
197
|
-
its(:pseudo_iban) { is_expected.to eq("
|
235
|
+
its(:pseudo_iban) { is_expected.to eq("AUZZ1234560123456789") }
|
198
236
|
its(:valid?) { is_expected.to eq(true) }
|
199
237
|
its(:to_s) { is_expected.to eq("") }
|
200
238
|
end
|
@@ -207,7 +245,7 @@ describe Ibandit::IBAN do
|
|
207
245
|
it "is invalid and has the correct errors" do
|
208
246
|
expect(subject.valid?).to eq(false)
|
209
247
|
expect(subject.errors).
|
210
|
-
to eq(account_number: "is the wrong length (should be
|
248
|
+
to eq(account_number: "is the wrong length (should be 10 characters)")
|
211
249
|
end
|
212
250
|
end
|
213
251
|
|
@@ -216,12 +254,12 @@ describe Ibandit::IBAN do
|
|
216
254
|
{
|
217
255
|
country_code: "AU",
|
218
256
|
branch_code: "123-4XX",
|
219
|
-
account_number: "
|
257
|
+
account_number: "123456789:",
|
220
258
|
}
|
221
259
|
end
|
222
260
|
|
223
261
|
its(:iban) { is_expected.to be_nil }
|
224
|
-
its(:pseudo_iban) { is_expected.to eq("
|
262
|
+
its(:pseudo_iban) { is_expected.to eq("AUZZ1234XX123456789:") }
|
225
263
|
it "is invalid and has the correct errors" do
|
226
264
|
expect(subject.valid?).to eq(false)
|
227
265
|
expect(subject.errors).to eq(account_number: "is invalid",
|
@@ -84,7 +84,7 @@ describe Ibandit::LocalDetailsCleaner do
|
|
84
84
|
let(:branch_code) { "123-456" }
|
85
85
|
|
86
86
|
its([:country_code]) { is_expected.to eq(country_code) }
|
87
|
-
its([:account_number]) { is_expected.to eq(
|
87
|
+
its([:account_number]) { is_expected.to eq("0123456789") }
|
88
88
|
its([:branch_code]) { is_expected.to eq("123456") }
|
89
89
|
end
|
90
90
|
|
@@ -92,7 +92,7 @@ describe Ibandit::LocalDetailsCleaner do
|
|
92
92
|
let(:branch_code) { "123456" }
|
93
93
|
|
94
94
|
its([:country_code]) { is_expected.to eq(country_code) }
|
95
|
-
its([:account_number]) { is_expected.to eq(
|
95
|
+
its([:account_number]) { is_expected.to eq("0123456789") }
|
96
96
|
its([:branch_code]) { is_expected.to eq("123456") }
|
97
97
|
end
|
98
98
|
end
|
@@ -45,11 +45,11 @@ describe Ibandit::PseudoIBANAssembler do
|
|
45
45
|
{
|
46
46
|
country_code: "AU",
|
47
47
|
branch_code: "123456",
|
48
|
-
account_number: "
|
48
|
+
account_number: "A123456789",
|
49
49
|
}
|
50
50
|
end
|
51
51
|
|
52
|
-
it { is_expected.to eq("
|
52
|
+
it { is_expected.to eq("AUZZ123456A123456789") }
|
53
53
|
end
|
54
54
|
|
55
55
|
context "without a branch code" do
|
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.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GoCardless
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
205
|
version: '0'
|
206
206
|
requirements: []
|
207
207
|
rubyforge_project:
|
208
|
-
rubygems_version: 2.6.
|
208
|
+
rubygems_version: 2.6.14
|
209
209
|
signing_key:
|
210
210
|
specification_version: 4
|
211
211
|
summary: Convert national banking details into IBANs, and vice-versa.
|