Skip to content

Commit

Permalink
Fix IBAN.bank_name for countris without bank code
Browse files Browse the repository at this point in the history
  • Loading branch information
mdomke committed Jul 28, 2022
1 parent 73549e8 commit 472d1c9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ Changelog

Versions follow `CalVer <http://www.calver.org/>`_ with the scheme ``YY.0M.Micro``.

`2022.07.0`_ - 2022/0//07
`2022.07.1`_ - 2022/28/07
-------------------------
Fixed
~~~~~
* In some countries the BBAN does not include a bank code, but only a branch code (e.g. Poland). In
those cases the branch code should be used to lookup the bank associated to an IBAN instead of the
obviously empty bank code.

`2022.07.0`_ - 2022/07/07
-------------------------
Fixed
~~~~~
Expand Down Expand Up @@ -322,6 +330,7 @@ Added
* Added :attr:`.BIC.country` and :attr:`.IBAN.country`.


.. _2022.07.1: https://github.com/mdomke/schwifty/compare/2022.07.0...2022.07.1
.. _2022.07.0: https://github.com/mdomke/schwifty/compare/2022.06.3...2022.07.0
.. _2022.06.3: https://github.com/mdomke/schwifty/compare/2022.06.2...2022.06.3
.. _2022.06.2: https://github.com/mdomke/schwifty/compare/2022.06.1...2022.06.2
Expand Down
2 changes: 1 addition & 1 deletion schwifty/iban.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def account_code(self) -> str:
def bank(self) -> Optional[dict]:
bank_registry = registry.get("bank_code")
assert isinstance(bank_registry, dict)
return bank_registry.get((self.country_code, self.bank_code))
return bank_registry.get((self.country_code, self.bank_code or self.branch_code))

@property
def bank_name(self) -> Optional[str]:
Expand Down

0 comments on commit 472d1c9

Please sign in to comment.