Skip to content

Add support for account_ids in ListTransactionParams #296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion unit/models/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,14 +571,15 @@ def to_json_api(self) -> Dict:


class ListTransactionParams(UnitParams):
def __init__(self, limit: int = 100, offset: int = 0, account_id: Optional[str] = None,
def __init__(self, limit: int = 100, offset: int = 0, account_id: Optional[str] = None, account_ids: Optional[List[str]],
customer_id: Optional[str] = None, query: Optional[str] = None, tags: Optional[Dict[str, str]] = None,
since: Optional[str] = None, until: Optional[str] = None, card_id: Optional[str] = None,
type: Optional[List[str]] = None, exclude_fees: Optional[bool] = None,
sort: Optional[Literal["createdAt", "-createdAt"]] = None, include: Optional[str] = None):
self.limit = limit
self.offset = offset
self.account_id = account_id
self.account_ids = account_ids
self.customer_id = customer_id
self.query = query
self.tags = tags
Expand All @@ -596,6 +597,9 @@ def to_dict(self) -> Dict:
parameters["filter[customerId]"] = self.customer_id
if self.account_id:
parameters["filter[accountId]"] = self.account_id
if self.account_ids:
for idx, account_id in enumerate(self.account_ids):
parameters[f"filter[accountIds][{idx}]"] = account_id
if self.query:
parameters["filter[query]"] = self.query
if self.tags:
Expand Down