Skip to content

Commit

Permalink
Merge pull request #83 from Aptcoder/chore/filter-banks
Browse files Browse the repository at this point in the history
Chore: Add ability to filter banks list
  • Loading branch information
andela-sjames authored Apr 17, 2022
2 parents 84ce37b + bb548b2 commit fe5cca9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
13 changes: 13 additions & 0 deletions docs/miscellaneous.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ Miscellaneous
from paystackapi.misc import Misc
response = Misc.list_banks()
```

Or with keyword args - the args are query params on the Paystack API.

```python
from paystackapi.misc import Misc
response = Misc.list_banks(country="ghana", currency="NGN")
```
*Optional Arguments*

- `country`: Country to return its banks
- `currency`: Currency
- `gateway`: Gateway type of banks

*Returns*

JSON data from paystack API.
17 changes: 13 additions & 4 deletions paystackapi/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,20 @@
class Misc(PayStackBase):

@classmethod
def list_banks(cls):
"""Static method defined to list banks.
def list_banks(cls, **kwargs):
"""
Static method defined to list banks.
Args:
No argument required.
No argument is required.
country (str): The country from which to obtain the list of supported banks. e.g country=ghana or country=nigeria
gateway (str): The gateway type of the bank. It can be one of these: [emandate, digitalbankmandate]
currency (str): Any of NGN, USD, GHS or ZAR
Returns:
Json data from paystack API.
"""
return cls().requests.get('bank')
return cls().requests.get('bank', qs=kwargs)

0 comments on commit fe5cca9

Please sign in to comment.