Skip to content

Commit

Permalink
Added support for multi-account mutations
Browse files Browse the repository at this point in the history
  • Loading branch information
ivasic committed Jul 10, 2018
1 parent ac81167 commit f593203
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions abna/__init__.py
Expand Up @@ -38,15 +38,16 @@ def login(self, card, token):
if not rsp.ok:
raise Exception(rsp.json())

def mutations(self, last_key=None):
def mutations(self, last_key=None, iban=None):
params = {
'accountNumber': self.iban,
'includeActions': 'EXTENDED',
}
if last_key is not None:
params['lastMutationKey'] = last_key

url = BASE + '/mutations/' + self.iban
iban = iban or self.iban
url = BASE + '/mutations/' + iban
rsp = self.session.get(url, headers=SERVICE_VERSION, params=params)
if rsp.ok:
return rsp.json()
Expand Down

4 comments on commit f593203

@djc
Copy link

@djc djc commented on f593203 Jul 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a good idea. Do you want to submit it as a PR? I actually thought it might make sense to make iban the first argument to mutations(), and possibly mandatory rather than optional.

@ivasic
Copy link
Owner Author

@ivasic ivasic commented on f593203 Jul 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, I'll send a PR. The change you proposed sounds absolutely reasonable, though it breaks backwards compatibility. If we were to do that, I'd definitely make iban mandatory otherwise existing (old) code would confuse iban for last_key causing runtime bugs. What are your thoughts @djc, makes sense to go ahead with it?

@djc
Copy link

@djc djc commented on f593203 Jul 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not that worried about backwards compatibility at this stage, there probably aren't that many people using it. I'll also write up a changelog for the 0.2 release to describe the change. So yes, please go ahead (and make iban mandatory)!

@ivasic
Copy link
Owner Author

@ivasic ivasic commented on f593203 Jul 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. Sending a PR then..

Please sign in to comment.