"""TransferwiseTransaction logic.""" from typing import Optional from collaborator.models.rds.transferwise_transaction_persister import ( TransferwiseTransactionPersister, ) from collaborator.utils import api as api_utils def get_payments( vendor_id: int, collaborator_id: Optional[int] = None, payment_statuses: list = [], limit: int = 0, offset: int = 0, sort_key: Optional[str] = None, sort_direction: Optional[str] = None, ): """Get transferwise payments for a collaborator. Args: collaborator_id (int): The collaborator unique identifier. payment_statuses (list): limit (int): how many transactions to retrieve. offset (int): the offset (for pagination). sort_key (str?): Key to sort by (defaults to no sorting) sort_direction (str?): Direction to sort by (ASC or DESC) Returns: Response with the collaborator's transactions. """ ( payments, total_records, ) = TransferwiseTransactionPersister.get_collaborator_payments( vendor_id, collaborator_id, payment_statuses, limit, offset, sort_key, sort_direction, ) return api_utils.create_paginated_response(payments, total_records)