anz_bank_client 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6bda86e04ac9e4f972bd220896ed3b153e090c0c9c07a90da02fbac2a478a78
4
- data.tar.gz: 1a068361988675e5e211e3b93b608f3b0a7dd63f44f8ee9d64b5cecb278ba575
3
+ metadata.gz: 789009701c348b1e64086bd88dae60afe4996cf28db004c961bed1315446eee9
4
+ data.tar.gz: 4ce36e7f8226f3a6a27039876d4823fcadff870aea2b706a15fd05c76269b41e
5
5
  SHA512:
6
- metadata.gz: 807b91ec4851c8aa8c82ad9b9b17d0db013be7cbfb6a5935e4173d2cd1939284f7fe5f3d42eb8eb3add90988d0de1fc52072badabcac630e635fc6e180b828d9
7
- data.tar.gz: 9fa8ab3bb45e89bba0d75cc533c9c6a2ae0434db79f9d9333bec24bb5987af4bbf34fa3afb3b5e4994b8aa0481eaf3ae82db21b35f9065cfc980238f91dbcd06
6
+ metadata.gz: 66a318dddddd8d660bb0d61490c1a9283c43fcdb84f22c840f1bc12e825958b417f154ebf4defaca3f42e73e5613136edb5dc3ad23a9f5bec6e1e545837f073c
7
+ data.tar.gz: 1a2400bad089bf8aedc3eea4c221b138ec115193d9f075f36f5504a36745381c364ceaf4d16eafa4740ec9c7e71913eaf13236f11fcba89bfe1a0711936fdec2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- anz_bank_client (0.1.1)
4
+ anz_bank_client (0.1.3)
5
5
  faraday (~> 2.7)
6
6
  faraday-cookie_jar (~> 0.0.7)
7
7
  faraday-follow_redirects (~> 0.3.0)
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AnzBankClient
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.3"
5
5
  end
@@ -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
- account_uuid = @initialise_response["viewableAccounts"]
149
- .find { |account| account["accountNo"] == account_no }["accountUuid"]
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.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-12 00:00:00.000000000 Z
11
+ date: 2024-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday