@@ -14,38 +14,51 @@ def __init__(self, api_client: APIClient):
14
14
15
15
async def get_transactions (
16
16
self ,
17
+ page : Optional [int ] = None ,
18
+ per_page : Optional [int ] = None ,
17
19
from_date : Optional [str ] = None ,
18
20
to_date : Optional [str ] = None ,
19
- page : Optional [int ] = None ,
20
- page_size : Optional [int ] = None ,
21
+ virtual_card_id : Optional [str ] = None ,
22
+ min_amount_cents : Optional [int ] = None ,
23
+ max_amount_cents : Optional [int ] = None ,
24
+ search_term : Optional [str ] = None ,
21
25
) -> Dict :
22
26
"""Get a list of transactions with optional filtering and pagination.
23
27
24
28
Args:
29
+ page (Optional[int]): The page number for pagination (1-based)
30
+ per_page (Optional[int]): Number of items per page
25
31
from_date (Optional[str]): Start date in YYYY-MM-DD format
26
32
to_date (Optional[str]): End date in YYYY-MM-DD format
27
- page (Optional[int]): The page number for pagination (1-based)
28
- page_size (Optional[int]): Number of items per page
33
+ virtual_card_id (str): Filter by specific virtual card
34
+ min_amount_cents (int): Minimum clearing amount in cents
35
+ max_amount_cents (int): Maximum clearing amount in cents
36
+ search_term (Optional[str]): Filter cards by search term (e.g., "Marketing")
29
37
30
38
Returns:
31
39
Dict: A dictionary containing:
32
40
- transactions: List of Transaction objects
33
- - total: Total number of transactions
34
- - page: Current page number
35
- - pageSize: Number of items per page
41
+ - pagination: Dictionary containing the following pagination stats:
42
+ - page: Current page number
43
+ - pageItemCount: Number of items per page
44
+ - totalItems: Total items will be 1 more than pageItemCount if there is another page to fetch
45
+ - numberOfPages: Total number of pages
36
46
37
47
Raises:
38
48
httpx.HTTPError: If the request fails
39
49
"""
40
- params = {}
41
- if from_date :
42
- params ["fromDate" ] = from_date
43
- if to_date :
44
- params ["toDate" ] = to_date
45
- if page is not None :
46
- params ["page" ] = page
47
- if page_size is not None :
48
- params ["count" ] = page_size
50
+
51
+ params = {
52
+ "page" : page ,
53
+ "count" : per_page ,
54
+ "fromDate" : from_date ,
55
+ "toDate" : to_date ,
56
+ "virtualCardId" : virtual_card_id ,
57
+ "minClearingBillingCents" : min_amount_cents ,
58
+ "maxClearingBillingCents" : max_amount_cents ,
59
+ "search" : search_term ,
60
+ }
61
+ params = {k : v for k , v in params .items () if v is not None }
49
62
50
63
return await self ._request (method = "get" , params = params )
51
64
0 commit comments