aq_banking 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/aq_banking/commander.rb +27 -9
- data/lib/aq_banking/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb755fc3ecf19519221f888fbbff0eb89105db84
|
4
|
+
data.tar.gz: c914bed545653e9feae6e2e565e0dc74ce8e813f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3b465c9fa966876670fefd120a3e74d3aacf08b1fdd7bb54c3c67e960429d650725376687dcac66f362b37216a53ffc9a485754eb7be6f3303961f5dc59fc22
|
7
|
+
data.tar.gz: c458b092d76bd9805f6b80edb7a5f4f75d0eeaf7dac10a8cbb7f1cc4efaad77e65e24ce153965a31f073de79bce778455e3b7fe8fc3a5b974b0913c64287e66c
|
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/aq_banking.svg)](https://badge.fury.io/rb/aq_banking)
|
1
2
|
[![Travis Status](https://travis-ci.org/rweng/aq_banking.svg)](https://travis-ci.org/rweng/aq_banking)
|
2
3
|
[![codecov.io](http://codecov.io/github/rweng/aq_banking/coverage.svg?branch=master)](http://codecov.io/github/rweng/aq_banking?branch=master)
|
3
4
|
|
data/lib/aq_banking/commander.rb
CHANGED
@@ -19,6 +19,8 @@ module AqBanking
|
|
19
19
|
# @return [String]
|
20
20
|
# @raise [SystemCmdError]
|
21
21
|
def send_request(bank_code, account_number, pin_file, from: nil, to: nil)
|
22
|
+
logger.debug 'sending request %p' % {bank_code: bank_code, account_number: account_number, pin_file: pin_file, from: from, to: to}
|
23
|
+
|
22
24
|
from = Date.parse(from) if from.is_a? String
|
23
25
|
to = Date.parse(to) if to.is_a? String
|
24
26
|
|
@@ -35,6 +37,7 @@ module AqBanking
|
|
35
37
|
def with_pin bank_code, user_id, password, &block
|
36
38
|
pin_file = build_pin_file bank_code: bank_code, user_id: user_id, password: password
|
37
39
|
|
40
|
+
logger.debug 'calling with_pin block with file: %p' % [pin_file]
|
38
41
|
block.call(pin_file.path) if block
|
39
42
|
ensure
|
40
43
|
pin_file.close!
|
@@ -50,19 +53,19 @@ module AqBanking
|
|
50
53
|
|
51
54
|
logger.debug 'calling Commander#with_pin with args %p %p %p' % [bank_code, user_id, password]
|
52
55
|
with_pin bank_code, user_id, password do |pin_file_path|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
56
|
+
# ensure that no old password is in cache
|
57
|
+
remove_user bank_code: bank_code, user_id: user_id
|
58
|
+
|
59
|
+
add_account(server_url: server_url, hbci_version: hbci_version,
|
60
|
+
bank_code: bank_code, user_id: user_id, user_name: user_name)
|
58
61
|
|
59
|
-
|
60
|
-
call_getsysid pin_file: pin_file_path, user_id: user_id, bank_code: bank_code
|
61
|
-
end
|
62
|
+
call_getsysid pin_file: pin_file_path, user_id: user_id, bank_code: bank_code
|
62
63
|
|
63
|
-
logger.debug 'sending request %p' % [bank_code, account_number, pin_file_path, from: from, to: to]
|
64
64
|
send_request(bank_code, account_number, pin_file_path, from: from, to: to)
|
65
65
|
end
|
66
|
+
ensure
|
67
|
+
# clean up after ourselves
|
68
|
+
remove_user bank_code: bank_code, user_id: user_id
|
66
69
|
end
|
67
70
|
|
68
71
|
# @return [Boolean]
|
@@ -79,7 +82,20 @@ module AqBanking
|
|
79
82
|
result.stdout.include?("Bank: de/#{bank_code} User Id: #{user_id}")
|
80
83
|
end
|
81
84
|
|
85
|
+
# removes user at bank with bank-code from aqhbci-tool.
|
86
|
+
#
|
87
|
+
# @param [String] bank_code
|
88
|
+
# @param [String] user_id
|
89
|
+
# @return [Boolean]
|
90
|
+
def remove_user(bank_code:, user_id:)
|
91
|
+
logger.debug 'removing user %p' % {bank_code: bank_code, user_id: user_id}
|
92
|
+
|
93
|
+
run "aqhbci-tool4 deluser -u %p -b %p" % [user_id, bank_code]
|
94
|
+
end
|
95
|
+
|
82
96
|
def add_account(server_url:, hbci_version:, bank_code:, user_id:, user_name: '')
|
97
|
+
logger.debug 'adding account %p' % {server_url: server_url, hbci_version: hbci_version, bank_code: bank_code, user_id: user_id, user_name: user_name}
|
98
|
+
|
83
99
|
cmd = ""
|
84
100
|
cmd << "#{aq_hbci} adduser -t pintan --context=1"
|
85
101
|
cmd << " -b #{bank_code} -u #{user_id}"
|
@@ -91,6 +107,8 @@ module AqBanking
|
|
91
107
|
end
|
92
108
|
|
93
109
|
def call_getsysid(pin_file:, user_id:, bank_code:)
|
110
|
+
logger.debug 'calling getsysid with %p' % {pin_file: pin_file, user_id: user_id, bank_code: bank_code}
|
111
|
+
|
94
112
|
cmd = "#{aq_hbci} -P #{pin_file} getsysid -u #{user_id} -b #{bank_code}"
|
95
113
|
|
96
114
|
run_or_raise(cmd, 'Could not get sysid. This might be because the userId or password is wrong. Check if these are the credentials with which you log into your online banking.')
|
data/lib/aq_banking/version.rb
CHANGED