ibandit 0.11.24 → 0.11.25

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
  SHA1:
3
- metadata.gz: 668b1fb51b7cf069a3571031168991cdb97f0ea2
4
- data.tar.gz: 4bfe3207906007a781617a7dbff3bbbe6bb82f25
3
+ metadata.gz: 25eea6c456d9782856e5600061dc8414d90f651a
4
+ data.tar.gz: c81156af68d0817c88dd9faad9a908a7a75bab2d
5
5
  SHA512:
6
- metadata.gz: bb3d8b5054d45f508f88a686040dfc51a8a3e4bd1971fe54300c31015cc5cd34ed81a8788740574f703d59738651b49f1852db0156bd22d35c4c8afdd6f19a5c
7
- data.tar.gz: fe66a3af2e980f0f40d09e4db3b99391cfa3442cd23ce14a31e780b9d6a1ee0bcbc3e0c05f112d387b820b03fb7fe4dffedc6360eca2273832d881503fd8b466
6
+ metadata.gz: 343b1bf9e56d78bc6ee805e75d260f20596770d3ff7b9ce6107579cad1dee21d9cbdec714fa7b7c0c4fd59f2facd8ab5e290ccfe4238cba82fca014f321b3511
7
+ data.tar.gz: 45ddb672d2b7db64b3c2dec6bceb6e3b87be62dda0cca036b0f55d77f9e9756e6ad454fd257ab3610d98d1de9206786fb31022816dae13fa61e2e97ad491ec95
@@ -1,3 +1,7 @@
1
+ ## 0.11.25 - January 10, 2019
2
+
3
+ - Prevent account numbers from being all-zero in Australia
4
+
1
5
  ## 0.11.24 - December 13, 2018
2
6
 
3
7
  - Add support for 3-digit financial institution numbers in Canada
@@ -373,7 +373,7 @@ module Ibandit
373
373
  def valid_australian_details?
374
374
  return true unless country_code == "AU"
375
375
 
376
- bsb_check?
376
+ bsb_check? && account_number_not_all_zeros?
377
377
  end
378
378
 
379
379
  def bsb_check?
@@ -512,5 +512,12 @@ module Ibandit
512
512
  return false if input.nil?
513
513
  input.slice(2, 2) == Constants::PSEUDO_IBAN_CHECK_DIGITS
514
514
  end
515
+
516
+ def account_number_not_all_zeros?
517
+ return true if @swift_account_number.to_s.chars.uniq != ["0"]
518
+
519
+ @errors[:account_number] = Ibandit.translate(:is_invalid)
520
+ false
521
+ end
515
522
  end
516
523
  end
@@ -1,3 +1,3 @@
1
1
  module Ibandit
2
- VERSION = "0.11.24".freeze
2
+ VERSION = "0.11.25".freeze
3
3
  end
@@ -273,6 +273,23 @@ describe Ibandit::IBAN do
273
273
  its(:valid?) { is_expected.to eq(true) }
274
274
  its(:to_s) { is_expected.to eq("") }
275
275
  end
276
+
277
+ context "and an account number that is all zero" do
278
+ let(:account_number) { "000000" }
279
+
280
+ its(:country_code) { is_expected.to eq("AU") }
281
+ its(:bank_code) { is_expected.to be_nil }
282
+ its(:branch_code) { is_expected.to eq("123456") }
283
+ its(:account_number) { is_expected.to eq("0000000000") }
284
+ its(:swift_bank_code) { is_expected.to be_nil }
285
+ its(:swift_branch_code) { is_expected.to eq("123456") }
286
+ its(:swift_account_number) { is_expected.to eq("0000000000") }
287
+ its(:swift_national_id) { is_expected.to eq("123456") }
288
+ its(:iban) { is_expected.to be_nil }
289
+ its(:pseudo_iban) { is_expected.to eq("AUZZ1234560000000000") }
290
+ its(:valid?) { is_expected.to eq(false) }
291
+ its(:to_s) { is_expected.to eq("") }
292
+ end
276
293
  end
277
294
 
278
295
  context "when the IBAN was created from an Australian pseudo-IBAN" 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.24
4
+ version: 0.11.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - GoCardless
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-13 00:00:00.000000000 Z
11
+ date: 2019-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -210,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
210
  version: '0'
211
211
  requirements: []
212
212
  rubyforge_project:
213
- rubygems_version: 2.5.2.3
213
+ rubygems_version: 2.6.14
214
214
  signing_key:
215
215
  specification_version: 4
216
216
  summary: Convert national banking details into IBANs, and vice-versa.