-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add transactions API to fetch last transactions and account info #38
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -59,6 +59,16 @@ Listing transactions within a period: | |||||
'transaction_id': 'XXXXXXXXXX' | ||||||
} | ||||||
|
||||||
Getting transactions with account information in one request: | ||||||
|
||||||
.. code:: python | ||||||
|
||||||
>>> client.transaction('2013-01-20', '2013-03-20') | ||||||
( | ||||||
{'currency': 'CZK', 'account_number_full': 'XXXXXXXXXX/2010', 'balance': 42.00, 'account_number': 'XXXXXXXXXX', 'bank_code': '2010'}, | ||||||
'transactions': <generator object _parse_transactions at 0x170c190> | ||||||
) | ||||||
|
||||||
Listing transactions from a single account statement: | ||||||
|
||||||
.. code:: python | ||||||
|
@@ -72,6 +82,16 @@ Listing the latest transactions: | |||||
>>> client.last() # return transactions added from last listing | ||||||
>>> client.last(from_id='...') # sets cursor to given transaction_id and returns following transactions | ||||||
>>> client.last(from_date='2013-03-01') # sets cursor to given date and returns following transactions | ||||||
|
||||||
Getting the latest transactions with account information in one request: | ||||||
|
||||||
.. code:: python | ||||||
|
||||||
>>> client.last_transaction() | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
( | ||||||
{'currency': 'CZK', 'account_number_full': 'XXXXXXXXXX/2010', 'balance': 42.00, 'account_number': 'XXXXXXXXXX', 'bank_code': '2010'}, | ||||||
'transactions': <generator object _parse_transactions at 0x170c190> | ||||||
) | ||||||
|
||||||
Conflict Error | ||||||
-------------- | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,6 +201,23 @@ def test_transactions_integration(client_float, method, args, kwargs): | |
assert count > 0 | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"method,args,kwargs", | ||
[ | ||
("transactions", [date(2016, 8, 4), date(2016, 8, 30)], {}), | ||
("transactions", ["2016-08-04", "2016-08-30"], {}), | ||
("last_transactions", [], {"from_id": 308}), | ||
("last_transactions", [], {"from_date": date(2016, 8, 4)}), | ||
("last_transactions", [], {"from_date": "2016-08-04"}), | ||
], | ||
) | ||
def test_transactions_api(client_decimal, method, args, kwargs): | ||
info, transactions = getattr(client_decimal, method)(*args, **kwargs) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer this to be at least two test functions, one for |
||
transaction = next(transactions) | ||
assert transaction["amount"] == Decimal("-130.0") | ||
assert info["balance"] == Decimal("2060.52") | ||
|
||
|
||
def test_period_coerces_date(transactions_json): | ||
client = FioBank("...") | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.