Skip to content

Commit

Permalink
quickfile: return last 'transaction_count' txns
Browse files Browse the repository at this point in the history
API ReturnCount which must be between 0 and 200 (inclusive)
  • Loading branch information
markferry committed Apr 6, 2022
1 parent fa0e0c2 commit 7d0c728
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/tariochbctools/importers/quickfile/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ def _post(self, endpoint, endpoint_data):

return r

def bank_search(self, account_number):
def bank_search(self, account_number, transaction_count):
endpoint_data = {
"SearchParameters": {
"ReturnCount": "10",
"ReturnCount": str(transaction_count),
"Offset": "0",
"OrderResultsBy": "TransactionDate",
"OrderDirection": "ASC",
"OrderDirection": "DESC",
"NominalCode": str(account_number),
}
}
Expand Down Expand Up @@ -182,7 +182,8 @@ def extract(self, file, existing_entries=None):

def _extract_bank_transactions(self, bank_account, invert_sign=False):
entries = []
response = self.quickfile.bank_search(bank_account)
transaction_count = self.config["transaction_count"] # [0..200]
response = self.quickfile.bank_search(bank_account, transaction_count)
metadata = response.MetaData
transactions = response.Transactions["Transaction"]
local_account = self.config["accounts"].get(bank_account)
Expand Down
1 change: 1 addition & 0 deletions tests/tariochbctools/importers/test_quickfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
accounts:
1200: Assets:Other
1201: Assets:Savings
transaction_count: 200
"""

# Example from the quickfile API docs
Expand Down

0 comments on commit 7d0c728

Please sign in to comment.