nab_com_au 0.4.0 → 0.4.2
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/CHANGELOG +18 -0
- data/LICENSE +21 -0
- data/README.md +82 -0
- data/lib/NabComAu/Account.rb +0 -13
- data/lib/NabComAu/VERSION.rb +1 -1
- data/nab_com_au.gemspec +4 -2
- data/test/NabComAu/Account_test.rb +7 -0
- metadata +6 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 79c11bf5baf0f70919b24438084f51650b6faa1bc3956e428a16c8420474eff2
|
|
4
|
+
data.tar.gz: 5ea65b8fa555359929ff019af8c92a43abb675c0aa761c51b9f270a91aaa7bef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c66b1df7d1a126b77fcbc8ea903b48dc4663570d05f2a730fc6f5fbedf956e251bed71f3476c4f95f6ac0e0be50da09665b20ae2a3ed52a75642a803dd4822ae
|
|
7
|
+
data.tar.gz: 678df5388f00a6bc879de89a1b3276053b22aa85a4fac8d3b6637a1cf12061d705068544e38ab8c0b859e605b5a15de33392de568974daaf9c73e3e223929aa0
|
data/CHANGELOG
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# nab_com_au/CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 20261116
|
|
4
|
+
|
|
5
|
+
0.4.2: + README.md, + LICENSE
|
|
6
|
+
|
|
7
|
+
1. + README.md
|
|
8
|
+
2. + LICENSE
|
|
9
|
+
3. ~ nab_com_au.gemspec: README.md and LICENSE are among the files; the description no longer speaks of stopping at the confirmation page, which 0.3.0 dropped.
|
|
10
|
+
4. ~ NabComAu::VERSION: /0.4.1/0.4.2/
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
0.4.1: - NabComAu::Account#validate_args: Now uses superclass WebAccount's.
|
|
14
|
+
|
|
15
|
+
1. - NabComAu::Account#validate_args, webaccount 0.10's being the same.
|
|
16
|
+
2. ~ nab_com_au.gemspec: webaccount /'~> 0.9'/'~> 0.10'/
|
|
17
|
+
3. ~ test/NabComAu/Account_test.rb: That validate_args is WebAccount's is tested.
|
|
18
|
+
4. ~ NabComAu::VERSION: /0.4.0/0.4.1/
|
|
19
|
+
|
|
20
|
+
|
|
3
21
|
## 20261115
|
|
4
22
|
|
|
5
23
|
0.4.0: ~ NabComAu::Account::PAGE_SELECTORS: /logged_out_xpath/logged_out_selector/, NAB's logged-out notice, upon webaccount 0.9.
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022-2026 thoran
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# nab_com_au
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
Log into NAB Internet Banking (ib.nab.com.au) and pay a bill by BPAY from an account, via Selenium WebDriver and WebAccount.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add this line to your application's Gemfile:
|
|
10
|
+
```ruby
|
|
11
|
+
gem 'nab_com_au'
|
|
12
|
+
```
|
|
13
|
+
And then execute:
|
|
14
|
+
```shell
|
|
15
|
+
$ bundle
|
|
16
|
+
```
|
|
17
|
+
Or install it yourself as:
|
|
18
|
+
```shell
|
|
19
|
+
$ gem install nab_com_au
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
### Paying a bill by BPAY
|
|
25
|
+
```ruby
|
|
26
|
+
require 'nab_com_au'
|
|
27
|
+
|
|
28
|
+
nab_account = NabComAu::Account.new(username: nab_id, password: password)
|
|
29
|
+
nab_account.login
|
|
30
|
+
nab_account.bpay(
|
|
31
|
+
source_bank_account_name_or_number: 'Everyday Account',
|
|
32
|
+
biller_name_or_code: '1234',
|
|
33
|
+
customer_reference_number: '5678',
|
|
34
|
+
amount: '1.00'
|
|
35
|
+
)
|
|
36
|
+
nab_account.shutdown # Quits the browser.
|
|
37
|
+
```
|
|
38
|
+
The payment is made: `bpay` goes through NAB's confirmation page, entering the password there, and submits it.
|
|
39
|
+
|
|
40
|
+
The account paid from is picked from the list by its name, or by its number, given as `'123456789'` or `'12-345-6789'`.
|
|
41
|
+
|
|
42
|
+
A biller given as digits is entered as a biller code. Since NAB matches a code as a substring, where it matches more than one biller the one whose code it is is chosen from the results. A biller given by name is chosen from the list of billers already paid, or else searched for by name.
|
|
43
|
+
|
|
44
|
+
### Credentials
|
|
45
|
+
|
|
46
|
+
The username is the NAB ID. It and the password are given, or set afterwards:
|
|
47
|
+
```ruby
|
|
48
|
+
nab_account = NabComAu::Account.new(username: nab_id, password: password)
|
|
49
|
+
nab_account.username, nab_account.password = nab_id, password
|
|
50
|
+
```
|
|
51
|
+
Where either is missing, `login` raises ArgumentError before starting the browser, naming every one missing. `bpay` does the same for the payment's details and the password.
|
|
52
|
+
|
|
53
|
+
### The browser
|
|
54
|
+
|
|
55
|
+
The browser is WebAccount's: Chrome, unless `browser: :firefox` is given. Given a `profile_directory`, it's started with that profile, kept between runs; without one, each run has a new, temporary profile.
|
|
56
|
+
```ruby
|
|
57
|
+
NabComAu::Account.new(profile_directory: '~/path/to/profile')
|
|
58
|
+
NabComAu::Account.new(browser: :firefox, profile_directory: '~/path/to/firefox-profile')
|
|
59
|
+
```
|
|
60
|
+
`headless:`, `window_size:` and `user_agent:` are passed to WebAccount too.
|
|
61
|
+
|
|
62
|
+
## Limitations
|
|
63
|
+
|
|
64
|
+
Transfers aren't made yet: `transfer` raises NotImplementedError.
|
|
65
|
+
|
|
66
|
+
`login` doesn't wait to see that it's logged in, so `logged_in?` stays false, and `shutdown` quits the browser without logging out. `logout` logs out.
|
|
67
|
+
|
|
68
|
+
The selectors were taken from the live site, and a change to it will break them. Each key of `NabComAu::Account::PAGE_SELECTORS` is also a keyword of `new`, and has a setter, either of which wins over NAB's, so as a selector which has changed can be given without waiting for a new version:
|
|
69
|
+
```ruby
|
|
70
|
+
NabComAu::Account.new(login_page_submit_button_selector: {id: 'loginButton'})
|
|
71
|
+
nab_account.logged_out_selector = {xpath: "//*[contains(text(), 'logged out')]"}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The tests cover only what doesn't depend on NAB's site, and never submit a payment.
|
|
75
|
+
|
|
76
|
+
## Contributing
|
|
77
|
+
|
|
78
|
+
1. Fork it: https://github.com/thoran/nab_com_au/fork
|
|
79
|
+
2. Create your feature branch: `git checkout -b my-new-feature`
|
|
80
|
+
3. Commit your changes: `git commit -am 'Add some feature'`
|
|
81
|
+
4. Push to the branch: `git push origin my-new-feature`
|
|
82
|
+
5. Create a new pull request
|
data/lib/NabComAu/Account.rb
CHANGED
|
@@ -62,18 +62,5 @@ module NabComAu
|
|
|
62
62
|
transfer.driver = driver
|
|
63
63
|
transfer.pay
|
|
64
64
|
end
|
|
65
|
-
|
|
66
|
-
private
|
|
67
|
-
|
|
68
|
-
def validate_args(args)
|
|
69
|
-
missing_args = []
|
|
70
|
-
args.each do |arg_name, value|
|
|
71
|
-
missing_args << arg_name unless value
|
|
72
|
-
end
|
|
73
|
-
return if missing_args.empty?
|
|
74
|
-
aggregate_error = missing_args.join(', ')
|
|
75
|
-
copula = missing_args.count > 1 ? 'are' : 'is'
|
|
76
|
-
raise ArgumentError, "#{aggregate_error} #{copula} missing."
|
|
77
|
-
end
|
|
78
65
|
end
|
|
79
66
|
end
|
data/lib/NabComAu/VERSION.rb
CHANGED
data/nab_com_au.gemspec
CHANGED
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
|
15
15
|
spec.version = NabComAu::VERSION
|
|
16
16
|
|
|
17
17
|
spec.summary = "Pay bills by BPAY from NAB Internet Banking via Selenium WebDriver."
|
|
18
|
-
spec.description = "Log into NAB Internet Banking with a username and password, and pay a bill by BPAY from an account
|
|
18
|
+
spec.description = "Log into NAB Internet Banking with a username and password, and pay a bill by BPAY from an account."
|
|
19
19
|
|
|
20
20
|
spec.author = 'thoran'
|
|
21
21
|
spec.email = 'code@thoran.com'
|
|
@@ -31,12 +31,14 @@ Gem::Specification.new do |spec|
|
|
|
31
31
|
Dir['test/**/*.rb'],
|
|
32
32
|
'CHANGELOG',
|
|
33
33
|
'Gemfile',
|
|
34
|
+
'LICENSE',
|
|
34
35
|
'Rakefile',
|
|
36
|
+
'README.md',
|
|
35
37
|
].flatten
|
|
36
38
|
|
|
37
39
|
spec.dependencies = [
|
|
38
40
|
['selenium-webdriver', '>= 4.0'],
|
|
39
|
-
['webaccount', '~> 0.
|
|
41
|
+
['webaccount', '~> 0.10']
|
|
40
42
|
]
|
|
41
43
|
|
|
42
44
|
spec.development_dependencies = %w{
|
|
@@ -62,6 +62,13 @@ describe NabComAu::Account do
|
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
+
describe "#validate_args" do
|
|
66
|
+
it "is WebAccount's" do
|
|
67
|
+
_(NabComAu::Account.instance_method(:validate_args).owner).must_equal WebAccount
|
|
68
|
+
_(NabComAu::Bpay.instance_method(:validate_args).owner).must_equal WebAccount
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
65
72
|
describe "#driver=" do
|
|
66
73
|
it "is the browser driven, none being started" do
|
|
67
74
|
driver = untouchable_driver
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nab_com_au
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- thoran
|
|
@@ -29,14 +29,14 @@ dependencies:
|
|
|
29
29
|
requirements:
|
|
30
30
|
- - "~>"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '0.
|
|
32
|
+
version: '0.10'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '0.
|
|
39
|
+
version: '0.10'
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: minitest
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -80,8 +80,7 @@ dependencies:
|
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
81
|
version: '0'
|
|
82
82
|
description: Log into NAB Internet Banking with a username and password, and pay a
|
|
83
|
-
bill by BPAY from an account
|
|
84
|
-
to confirm.
|
|
83
|
+
bill by BPAY from an account.
|
|
85
84
|
email: code@thoran.com
|
|
86
85
|
executables: []
|
|
87
86
|
extensions: []
|
|
@@ -89,6 +88,8 @@ extra_rdoc_files: []
|
|
|
89
88
|
files:
|
|
90
89
|
- CHANGELOG
|
|
91
90
|
- Gemfile
|
|
91
|
+
- LICENSE
|
|
92
|
+
- README.md
|
|
92
93
|
- Rakefile
|
|
93
94
|
- lib/Nab.rb
|
|
94
95
|
- lib/NabComAu/Account.rb
|