ibandit 0.8.4 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9234545e3b5c740bd66377f5bbd7c953acca6608
4
- data.tar.gz: 24b8485010fdfaaec1e0f322551baf24d425115b
3
+ metadata.gz: c4fcf311c9ff784733a34a07ecb38aa6699cd041
4
+ data.tar.gz: bb2c9ceb88d909c050c430e5e8e11965f9b11152
5
5
  SHA512:
6
- metadata.gz: 721390a0eea238bfc2e0a82c4ba62ce82cef50824950dea2fba6d1363a07fbdeace1e08d2632bd0642bc210624d5c41437da1555ed1a08146ced9c273db21940
7
- data.tar.gz: 99d83b4a47aca4580de7716cefc9e746f1f323d531f3352f873085dec9fce3084f194cfa4c73689d7a8b766bc13de3df62140f66030a83255ca8eac614721271
6
+ metadata.gz: 6f9e13863ddfb58f0b7a8ecc85adaaad9337fe392e50b7bedfcd2a79a110f2f622013c46993384dee3ad4dba4945856f5e91c4e2a3638fe2a090175207eb1374
7
+ data.tar.gz: d9bec271c5691fb295ce0e6ee397f770675d521af9aacf21170c7d28b289e4127cde62a0ef4c391537d47c3ec6f43c727a31722bc1808fc277b93aa1f5b45f5b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.8.5 - November 20, 2015
2
+
3
+ - Handle Danish long-format account numbers without a hyphen
4
+
1
5
  ## 0.8.4 - October 15, 2015
2
6
 
3
7
  - Fix bug in Sweden::Validator.valid_serial_number_length?
@@ -147,8 +147,14 @@ module Ibandit
147
147
  if local_details[:bank_code]
148
148
  bank_code = local_details[:bank_code].rjust(4, '0')
149
149
  account_number = local_details[:account_number].rjust(10, '0')
150
- else
150
+ elsif local_details[:account_number].include?('-')
151
151
  bank_code, account_number = local_details[:account_number].split('-', 2)
152
+ elsif local_details[:account_number].gsub(/\s/, '').length == 14
153
+ cleaned_account_number = local_details[:account_number].gsub(/\s/, '')
154
+ bank_code = cleaned_account_number.slice(0, 4)
155
+ account_number = cleaned_account_number.slice(4, 10)
156
+ else
157
+ return {}
152
158
  end
153
159
 
154
160
  {
@@ -1,3 +1,3 @@
1
1
  module Ibandit
2
- VERSION = '0.8.4'.freeze
2
+ VERSION = '0.8.5'.freeze
3
3
  end
@@ -245,6 +245,23 @@ describe Ibandit::LocalDetailsCleaner do
245
245
  its([:account_number]) { is_expected.to eq('0003179681') }
246
246
  end
247
247
 
248
+ context 'with a space-separated 14-digit account number' do
249
+ let(:bank_code) { nil }
250
+ let(:branch_code) { nil }
251
+ let(:account_number) { '0345 0003179681' }
252
+
253
+ its([:bank_code]) { is_expected.to eq('0345') }
254
+ its([:account_number]) { is_expected.to eq('0003179681') }
255
+ end
256
+
257
+ context 'with a space-separated 13-digit account number' do
258
+ let(:bank_code) { nil }
259
+ let(:branch_code) { nil }
260
+ let(:account_number) { '0345 003179681' }
261
+
262
+ it { is_expected.to eq(local_details_with_swift) }
263
+ end
264
+
248
265
  context 'without an account number' do
249
266
  let(:account_number) { nil }
250
267
  it { is_expected.to eq(local_details_with_swift) }
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.8.4
4
+ version: 0.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grey Baker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-15 00:00:00.000000000 Z
11
+ date: 2015-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec