You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
3.1 KiB

  1. # -*- encoding: utf-8 -*-
  2. """Classes and definitions used in parsing bank statements."""
  3. ##############################################################################
  4. #
  5. # Copyright (C) 2015 Therp BV - http://therp.nl.
  6. # All Rights Reserved
  7. #
  8. # This program is free software: you can redistribute it and/or modify
  9. # it under the terms of the GNU Affero General Public License as published by
  10. # the Free Software Foundation, either version 3 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU Affero General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU Affero General Public License
  19. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. #
  21. ##############################################################################
  22. class BankStatement(object):
  23. """A bank statement groups data about several bank transactions."""
  24. def __init__(self):
  25. self.statement_id = ''
  26. self.local_account = ''
  27. self.local_currency = ''
  28. self.start_balance = 0.0
  29. self.end_balance = 0.0
  30. self.date = ''
  31. self.transactions = []
  32. class BankTransaction(object):
  33. """Single transaction that is part of a bank statement."""
  34. def __init__(self):
  35. """Define and initialize attributes.
  36. Does not include attributes that belong to statement.
  37. """
  38. self.transaction_id = False # Message id
  39. self.transfer_type = False # Action type that initiated this message
  40. self.eref = False # end to end reference for transactions
  41. self.execution_date = False # The posted date of the action
  42. self.value_date = False # The value date of the action
  43. self.remote_account = False # The account of the other party
  44. self.remote_currency = False # The currency used by the other party
  45. self.exchange_rate = 0.0
  46. # The exchange rate used for conversion of local_currency and
  47. # remote_currency
  48. self.transferred_amount = 0.0 # actual amount transferred
  49. self.message = False # message from the remote party
  50. self.remote_owner = False # name of the other party
  51. self.remote_owner_address = [] # other parties address lines
  52. self.remote_owner_city = False # other parties city name
  53. self.remote_owner_postalcode = False # other parties zip code
  54. self.remote_owner_country_code = False # other parties country code
  55. self.remote_bank_bic = False # bic of other party's bank
  56. self.provision_costs = False # costs charged by bank for transaction
  57. self.provision_costs_currency = False
  58. self.provision_costs_description = False
  59. self.error_message = False # error message for interaction with user
  60. self.storno_retry = False
  61. # If True, make cancelled debit eligible for a next direct debit run
  62. self.data = '' # Raw data from which the transaction has been parsed
  63. # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: