anz_bank_client 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- 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 +8 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c15b49548ec220f8db3dd750e6d4de206d501aa3c8b74848c541534174f1c435
|
4
|
+
data.tar.gz: a68aad4abcf6e137b9a796e017a7ecc683da9f0bfd2451a068930a061ff3caf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2a6b555a62d4832da6747f08d4ea5ca9c37f18bc6e2986953b10cf6e9a6f362d1b0d62b7b6f30c97f773c28dbc549dfbc72ca587a3713303a4751674d814711
|
7
|
+
data.tar.gz: 59f0984b3b1878bc5bd19877df6f60988915dac48dece351c9a824fcd19c214bf4d457438563669f0efdb4ab07158f5592b920f32045a4ff306e7bc85bef3388
|
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
|
@@ -145,8 +146,12 @@ module AnzBankClient
|
|
145
146
|
# @param end_date in iso8601 format
|
146
147
|
def list_transactions(account_no, start_date, end_date)
|
147
148
|
@logger.info "Getting transactions for account #{account_no} from #{start_date} to #{end_date}"
|
148
|
-
|
149
|
-
.find { |account| account["accountNo"] == account_no }
|
149
|
+
account_obj = @initialise_response["viewableAccounts"]
|
150
|
+
.find { |account| account["accountNo"] == account_no }
|
151
|
+
if account_obj.nil?
|
152
|
+
raise "Could not find account #{account_no}"
|
153
|
+
end
|
154
|
+
account_uuid = account_obj["accountUuid"]
|
150
155
|
raise "Could not find account #{account_no}" unless account_uuid
|
151
156
|
|
152
157
|
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 +205,7 @@ module AnzBankClient
|
|
200
205
|
encrypted_password = public_key.public_encrypt(password, OpenSSL::PKey::RSA::PKCS1_PADDING)
|
201
206
|
|
202
207
|
# Encode the encrypted message with base64
|
203
|
-
Base64.encode64(encrypted_password).gsub("\n", "")
|
208
|
+
::Base64.encode64(encrypted_password).gsub("\n", "")
|
204
209
|
end
|
205
210
|
end
|
206
211
|
end
|