anz_bank_client 0.1.1 → 0.1.3
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/Gemfile.lock +1 -1
- data/exe/anzcli +1 -1
- data/lib/anz_bank_client/version.rb +1 -1
- data/lib/anz_bank_client.rb +10 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 789009701c348b1e64086bd88dae60afe4996cf28db004c961bed1315446eee9
|
4
|
+
data.tar.gz: 4ce36e7f8226f3a6a27039876d4823fcadff870aea2b706a15fd05c76269b41e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66a318dddddd8d660bb0d61490c1a9283c43fcdb84f22c840f1bc12e825958b417f154ebf4defaca3f42e73e5613136edb5dc3ad23a9f5bec6e1e545837f073c
|
7
|
+
data.tar.gz: 1a2400bad089bf8aedc3eea4c221b138ec115193d9f075f36f5504a36745381c364ceaf4d16eafa4740ec9c7e71913eaf13236f11fcba89bfe1a0711936fdec2
|
data/Gemfile.lock
CHANGED
data/exe/anzcli
CHANGED
@@ -28,7 +28,7 @@ class AnzCli < Thor
|
|
28
28
|
@session.login(ENV["ANZ_CUSTOMER_NO"], ENV["ANZ_PASSWORD"])
|
29
29
|
else
|
30
30
|
print "Customer number: "
|
31
|
-
customer_no = gets.chomp
|
31
|
+
customer_no = $stdin.gets.chomp
|
32
32
|
print "Password: "
|
33
33
|
password = $stdin.noecho(&:gets).chomp
|
34
34
|
@session.login(customer_no, password)
|
data/lib/anz_bank_client.rb
CHANGED
@@ -9,6 +9,7 @@ require_relative "anz_bank_client/version"
|
|
9
9
|
require "faraday"
|
10
10
|
require "faraday-cookie_jar"
|
11
11
|
require "faraday/follow_redirects"
|
12
|
+
require "base64"
|
12
13
|
|
13
14
|
module AnzBankClient
|
14
15
|
class Error < StandardError; end
|
@@ -134,6 +135,8 @@ module AnzBankClient
|
|
134
135
|
accountBalance: normalised_balance,
|
135
136
|
availableFunds: account.dig("availableFunds", "amount"),
|
136
137
|
isLiabilityType: account["isLoan"] || account["isCreditCard"],
|
138
|
+
supportsTransactions: true,
|
139
|
+
dynamicBalance: account["isInvestment"],
|
137
140
|
}
|
138
141
|
end
|
139
142
|
end
|
@@ -145,8 +148,12 @@ module AnzBankClient
|
|
145
148
|
# @param end_date in iso8601 format
|
146
149
|
def list_transactions(account_no, start_date, end_date)
|
147
150
|
@logger.info "Getting transactions for account #{account_no} from #{start_date} to #{end_date}"
|
148
|
-
|
149
|
-
.find { |account| account["accountNo"] == account_no }
|
151
|
+
account_obj = @initialise_response["viewableAccounts"]
|
152
|
+
.find { |account| account["accountNo"] == account_no }
|
153
|
+
if account_obj.nil?
|
154
|
+
raise "Could not find account #{account_no}"
|
155
|
+
end
|
156
|
+
account_uuid = account_obj["accountUuid"]
|
150
157
|
raise "Could not find account #{account_no}" unless account_uuid
|
151
158
|
|
152
159
|
response = @client.get("https://secure.anz.co.nz/IBCS/service/api/transactions?account=#{account_uuid}&ascending=false&from=#{start_date}&order=postdate&to=#{end_date}")
|
@@ -200,7 +207,7 @@ module AnzBankClient
|
|
200
207
|
encrypted_password = public_key.public_encrypt(password, OpenSSL::PKey::RSA::PKCS1_PADDING)
|
201
208
|
|
202
209
|
# Encode the encrypted message with base64
|
203
|
-
Base64.encode64(encrypted_password).gsub("\n", "")
|
210
|
+
::Base64.encode64(encrypted_password).gsub("\n", "")
|
204
211
|
end
|
205
212
|
end
|
206
213
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anz_bank_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- George Dewar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02
|
11
|
+
date: 2024-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|