bsb 1.2.13 → 1.3.0
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 +4 -4
- data/.github/workflows/publish.yml +1 -1
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +21 -0
- data/config/bsb_db.json +4518 -1278
- data/lib/bsb/aus_pay_net/client.rb +3 -7
- data/lib/bsb/base_generator.rb +4 -2
- data/lib/bsb/version.rb +1 -1
- data/lib/tasks/sync_bsb_db.rake +1 -1
- data/test/bsb/aus_pay_net/client_test.rb +10 -1
- data/test/bsb/base_generator_test.rb +50 -0
- data/test/fixtures/vcr_cassettes/auspaynet_fetch_all_bsbs.yml +28 -29
- data/test/tasks/sync_bsb_db_test.rb +5 -0
- metadata +3 -2
|
@@ -7,9 +7,6 @@ module BSB
|
|
|
7
7
|
module Client
|
|
8
8
|
class MissingSubscriptionKeyError < StandardError; end
|
|
9
9
|
|
|
10
|
-
OUTPUT_PARAM_WIDTH = 30
|
|
11
|
-
LEADER_WIDTH = OUTPUT_PARAM_WIDTH + 11
|
|
12
|
-
|
|
13
10
|
Response = Struct.new(:body, keyword_init: true)
|
|
14
11
|
|
|
15
12
|
def self.fetch_all_bsbs
|
|
@@ -26,13 +23,12 @@ module BSB
|
|
|
26
23
|
}
|
|
27
24
|
) do |faraday|
|
|
28
25
|
faraday.response :raise_error
|
|
26
|
+
faraday.response :json
|
|
29
27
|
end
|
|
30
28
|
|
|
31
|
-
response = conn.post('/
|
|
32
|
-
req.body = { outputparam: ' ' * OUTPUT_PARAM_WIDTH }.to_json
|
|
33
|
-
end
|
|
29
|
+
response = conn.post('/BSBQuery-V2/manual/paths/invoke')
|
|
34
30
|
|
|
35
|
-
Response.new(body: response.body
|
|
31
|
+
Response.new(body: response.body.fetch('data'))
|
|
36
32
|
end
|
|
37
33
|
end
|
|
38
34
|
end
|
data/lib/bsb/base_generator.rb
CHANGED
data/lib/bsb/version.rb
CHANGED
data/lib/tasks/sync_bsb_db.rake
CHANGED
|
@@ -5,7 +5,16 @@ require 'test_helper'
|
|
|
5
5
|
|
|
6
6
|
describe BSB::AusPayNet::Client do
|
|
7
7
|
describe '.fetch_all_bsbs' do
|
|
8
|
-
before
|
|
8
|
+
before do
|
|
9
|
+
if ENV['AUSPAYNET_SUB_KEY'].nil?
|
|
10
|
+
@remove_auspay_key = true
|
|
11
|
+
ENV['AUSPAYNET_SUB_KEY'] = 'something'
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
after do
|
|
16
|
+
ENV.delete('AUSPAYNET_SUB_KEY') if @remove_auspay_key
|
|
17
|
+
end
|
|
9
18
|
|
|
10
19
|
it 'returns the expected response' do
|
|
11
20
|
VCR.use_cassette('auspaynet_fetch_all_bsbs') do
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'test_helper'
|
|
4
|
+
require 'bsb/base_generator'
|
|
5
|
+
|
|
6
|
+
describe BSB::BaseGenerator do
|
|
7
|
+
describe '#json' do
|
|
8
|
+
it 'returns a JSON string' do
|
|
9
|
+
hash = { key: 'value' }
|
|
10
|
+
generator = BSB::BaseGenerator.new(hash)
|
|
11
|
+
expected_json = <<~JSON.strip
|
|
12
|
+
{
|
|
13
|
+
"key": "value"
|
|
14
|
+
}
|
|
15
|
+
JSON
|
|
16
|
+
|
|
17
|
+
assert_equal expected_json, generator.json
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it 'returns a JSON representation of the sorted hash when sorted is true' do
|
|
21
|
+
hash = { '123456' => '3', '012345' => '2', '234567' => '4', '00001' => '1' }
|
|
22
|
+
generator = BSB::BaseGenerator.new(hash)
|
|
23
|
+
expected_json = <<~JSON.strip
|
|
24
|
+
{
|
|
25
|
+
"00001": "1",
|
|
26
|
+
"012345": "2",
|
|
27
|
+
"123456": "3",
|
|
28
|
+
"234567": "4"
|
|
29
|
+
}
|
|
30
|
+
JSON
|
|
31
|
+
|
|
32
|
+
assert_equal expected_json, generator.json(sorted: true)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'returns a JSON representation of the unsorted hash when sorted is false' do
|
|
36
|
+
hash = { '123456' => '3', '012345' => '2', '234567' => '4', '00001' => '1' }
|
|
37
|
+
generator = BSB::BaseGenerator.new(hash)
|
|
38
|
+
expected_json = <<~JSON.strip
|
|
39
|
+
{
|
|
40
|
+
"123456": "3",
|
|
41
|
+
"012345": "2",
|
|
42
|
+
"234567": "4",
|
|
43
|
+
"00001": "1"
|
|
44
|
+
}
|
|
45
|
+
JSON
|
|
46
|
+
|
|
47
|
+
assert_equal expected_json, generator.json(sorted: false)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
http_interactions:
|
|
3
3
|
- request:
|
|
4
4
|
method: post
|
|
5
|
-
uri: https://auspaynet-bicbsb-api-prod.azure-api.net/
|
|
5
|
+
uri: https://auspaynet-bicbsb-api-prod.azure-api.net/BSBQuery-V2/manual/paths/invoke
|
|
6
6
|
body:
|
|
7
|
-
encoding:
|
|
8
|
-
string: '
|
|
7
|
+
encoding: US-ASCII
|
|
8
|
+
string: ''
|
|
9
9
|
headers:
|
|
10
10
|
Content-type:
|
|
11
11
|
- application/json
|
|
12
12
|
Ocp-apim-subscription-key:
|
|
13
13
|
- "<AUSPAYNET_SUB_KEY>"
|
|
14
14
|
User-Agent:
|
|
15
|
-
- Faraday v2.
|
|
15
|
+
- Faraday v2.12.0
|
|
16
16
|
response:
|
|
17
17
|
status:
|
|
18
18
|
code: 200
|
|
@@ -25,56 +25,55 @@ http_interactions:
|
|
|
25
25
|
transfer-encoding:
|
|
26
26
|
- chunked
|
|
27
27
|
content-type:
|
|
28
|
-
-
|
|
28
|
+
- application/json
|
|
29
29
|
content-encoding:
|
|
30
30
|
- gzip
|
|
31
31
|
expires:
|
|
32
32
|
- "-1"
|
|
33
33
|
vary:
|
|
34
34
|
- Accept-Encoding
|
|
35
|
-
set-cookie:
|
|
36
|
-
- ARRAffinity=0aa69915266871205a67096b40953eafb333722c9d662666b4ee1cbd3af96c28;Path=/;HttpOnly;Secure;Domain=prod-07.australiasoutheast.logic.azure.com,
|
|
37
|
-
ARRAffinitySameSite=0aa69915266871205a67096b40953eafb333722c9d662666b4ee1cbd3af96c28;Path=/;HttpOnly;SameSite=None;Secure;Domain=prod-07.australiasoutheast.logic.azure.com
|
|
38
35
|
strict-transport-security:
|
|
39
36
|
- max-age=31536000; includeSubDomains
|
|
40
37
|
x-ms-workflow-run-id:
|
|
41
|
-
- '
|
|
38
|
+
- '08584575192488054635250345459CU61'
|
|
42
39
|
x-ms-correlation-id:
|
|
43
|
-
-
|
|
40
|
+
- a1c9ff2c-1071-48cb-89b9-abcba0c3ca33
|
|
44
41
|
x-ms-client-tracking-id:
|
|
45
|
-
- '
|
|
42
|
+
- '08584575192488054635250345459CU61'
|
|
46
43
|
x-ms-trigger-history-name:
|
|
47
|
-
- '
|
|
44
|
+
- '08584575192488054635250345459CU61'
|
|
48
45
|
x-ms-execution-location:
|
|
49
46
|
- australiasoutheast
|
|
50
47
|
x-ms-workflow-system-id:
|
|
51
|
-
- "/locations/australiasoutheast/scaleunits/prod-
|
|
48
|
+
- "/locations/australiasoutheast/scaleunits/prod-58/workflows/b6cb1d81c12f46cd9433109c878b4ca2"
|
|
52
49
|
x-ms-workflow-id:
|
|
53
|
-
-
|
|
50
|
+
- b6cb1d81c12f46cd9433109c878b4ca2
|
|
54
51
|
x-ms-workflow-version:
|
|
55
|
-
- '
|
|
52
|
+
- '08584576177772871167'
|
|
56
53
|
x-ms-workflow-name:
|
|
57
|
-
- logicapp-all-wildcardquery
|
|
54
|
+
- logicapp-all-wildcardquery-V2
|
|
58
55
|
x-ms-tracking-id:
|
|
59
|
-
-
|
|
56
|
+
- a1c9ff2c-1071-48cb-89b9-abcba0c3ca33
|
|
60
57
|
x-ms-ratelimit-burst-remaining-workflow-writes:
|
|
61
|
-
- '
|
|
58
|
+
- '2044'
|
|
62
59
|
x-ms-ratelimit-remaining-workflow-download-contentsize:
|
|
63
|
-
- '
|
|
64
|
-
x-ms-ratelimit-remaining-workflow-upload-contentsize:
|
|
65
|
-
- '214748112'
|
|
60
|
+
- '140739431'
|
|
66
61
|
x-ms-ratelimit-time-remaining-directapirequests:
|
|
67
|
-
- '
|
|
62
|
+
- '13634951'
|
|
68
63
|
x-ms-request-id:
|
|
69
|
-
- australiasoutheast:
|
|
64
|
+
- australiasoutheast:a1c9ff2c-1071-48cb-89b9-abcba0c3ca33
|
|
70
65
|
request-context:
|
|
71
66
|
- appId=cid-v1:62fce8e1-7550-4725-83ec-f11232c5768f
|
|
72
67
|
date:
|
|
73
|
-
-
|
|
68
|
+
- Tue, 08 Apr 2025 04:47:18 GMT
|
|
74
69
|
body:
|
|
75
|
-
encoding:
|
|
76
|
-
string: '{"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
70
|
+
encoding: ASCII-8BIT
|
|
71
|
+
string: '{"status":"success","message":"Query executed with filters applied","timestamp":"2025-04-08T04:47:16.863","requestId":"08584575192488054635250345459CU61","data":"[{\"BSBCode\":\"942-304\",\"BSBName\":\"Bank
|
|
72
|
+
of Sydney Ltd - Doncaster\",\"FiMnemonic\":\"LBA\",\"Address\":\"Shop 1, 700
|
|
73
|
+
Doncaster Road\",\"Suburb\":\"Doncaster\",\"State\":\"VIC\",\"Postcode\":\"3108\",\"StreamCode\":\"EH\",\"lastmodified\":\"2024-03-01T06:48:44\",\"BIC\":\"LIKIAU2S\",\"BICINT\":\"\",\"repair\":\"0\",\"FIName\":\"Bank
|
|
74
|
+
of Sydney Ltd\"},{\"BSBCode\":\"942-303\",\"BSBName\":\"Bank of Sydney Ltd
|
|
75
|
+
- Northcote\",\"FiMnemonic\":\"LBA\",\"Address\":\"25 Nthcote Ctr High & Seperation
|
|
76
|
+
St\",\"Suburb\":\"Northcote\",\"State\":\"VIC\",\"Postcode\":\"3070\",\"StreamCode\":\"EH\",\"lastmodified\":\"2024-03-01T06:48:44\",\"BIC\":\"LIKIAU2S\",\"BICINT\":\"\",\"repair\":\"0\",\"FIName\":\"Bank
|
|
77
|
+
of Sydney Ltd\"}]"}'
|
|
78
|
+
recorded_at: Tue, 08 Apr 2025 04:47:19 GMT
|
|
80
79
|
recorded_with: VCR 6.3.1
|
|
@@ -6,12 +6,17 @@ require 'bsb/database_generator'
|
|
|
6
6
|
|
|
7
7
|
describe 'sync_bsb_db rake task' do # rubocop:disable Metrics/BlockLength
|
|
8
8
|
before do
|
|
9
|
+
@old_sub_key = ENV.fetch('AUSPAYNET_SUB_KEY', nil)
|
|
9
10
|
ENV.update('AUSPAYNET_SUB_KEY' => 'something')
|
|
10
11
|
Rake.application.rake_require('../lib/tasks/sync_bsb_db')
|
|
11
12
|
Rake::Task['bsb:sync_bsb_db'].reenable
|
|
12
13
|
File.write('test/tmp/bsb_db.json', File.read('test/fixtures/bsb_db.json'))
|
|
13
14
|
end
|
|
14
15
|
|
|
16
|
+
after do
|
|
17
|
+
ENV['AUSPAYNET_SUB_KEY'] = @old_sub_key
|
|
18
|
+
end
|
|
19
|
+
|
|
15
20
|
let(:auspaynet_bsb_client_response) do
|
|
16
21
|
BSB::AusPayNet::Client::Response.new(
|
|
17
22
|
body: JSON.dump(
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bsb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Zhou
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-05-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activemodel
|
|
@@ -58,6 +58,7 @@ files:
|
|
|
58
58
|
- lib/tasks/sync_bsb_db.rake
|
|
59
59
|
- release-please-config.json
|
|
60
60
|
- test/bsb/aus_pay_net/client_test.rb
|
|
61
|
+
- test/bsb/base_generator_test.rb
|
|
61
62
|
- test/bsb_number_validator_test.rb
|
|
62
63
|
- test/bsb_test.rb
|
|
63
64
|
- test/fixtures/bsb_db.json
|