Skip to content

Modules

Top-level package for se-pay.

bank_account

BankAccountService

get_bank_account(self, transaction_id)

Returns the details of a transaction_id.

Source code in sepay/bank_account.py
def get_bank_account(self, transaction_id: str) -> BankAccount:
    """
    Returns the details of a transaction_id.
    """
    path = "bankaccounts/details/{}".format(transaction_id)
    data = self._get(path)

    return self.get_object(BankAccount, data["bankaccount"])

get_bank_accounts(self, filters=None)

Example usage:

filters = {
    "account_number": "123456789",
    "transaction_date_min": "2023-01-01",
    "amount_in": "100.00"
}
bank_accounts = bank_accounts.get_bank_accounts(filters=filters)

Retrieve a list of bank_account. You can filter the results using the following parameters either directly as method arguments or through the filters dictionary:

  • short_name: The name of the bank (short name) to filter accounts.

  • last_transaction_date_min: Filter accounts with the most recent transaction date on or after this date (>=). Format: yyyy-mm-dd.

  • last_transaction_date_max: Filter accounts with the most recent transaction date on or before this date (<=). Format: yyyy-mm-dd.

  • since_id: Show bank accounts starting from the specified ID (>=).

  • limit: Limit the number of bank accounts returned. Defaults to 100.

  • accumulated_min: Filter bank accounts with a balance greater than or equal to this amount (>=).

  • accumulated_max: Filter bank accounts with a balance less than or equal to this amount (>=).

The filters dictionary can include any of the parameters listed above. You can use either individual parameters or the filters dictionary to customize your query.

Source code in sepay/bank_account.py
def get_bank_accounts(
    self,
    filters: Optional[Dict[str, str]] = None,
) -> List[BankAccount]:
    """
    Example usage:

    ```python
    filters = {
        "account_number": "123456789",
        "transaction_date_min": "2023-01-01",
        "amount_in": "100.00"
    }
    bank_accounts = bank_accounts.get_bank_accounts(filters=filters)
    ```

    Retrieve a list of bank_account. You can filter the results using the following parameters
    either directly as method arguments or through the `filters` dictionary:

    - **short_name**:
    The name of the bank (short name) to filter accounts.

    - **last_transaction_date_min**:
    Filter accounts with the most recent transaction date on or after this date (>=). Format: `yyyy-mm-dd`.

    - **last_transaction_date_max**:
    Filter accounts with the most recent transaction date on or before this date (<=). Format: `yyyy-mm-dd`.

    - **since_id**:
    Show bank accounts starting from the specified ID (>=).

    - **limit**:
    Limit the number of bank accounts returned. Defaults to 100.

    - **accumulated_min**:
    Filter bank accounts with a balance greater than or equal to this amount (>=).

    - **accumulated_max**:
    Filter bank accounts with a balance less than or equal to this amount (>=).

    The `filters` dictionary can include any of the parameters listed above. You can use either
    individual parameters or the `filters` dictionary to customize your query.
    """

    path = "bankaccounts/list"
    params = filters or {}

    data = self._get(path, params=params)
    bank_accounts = data.get("bankaccounts", [])

    return [self.get_object(BankAccount, transaction) for transaction in bank_accounts]

get_count(self, filters=None)

Example usage:

filters = {
    "since_id": "1000"
}
count = bank_account.get_count(filters=filters)

Retrieve the count of bank_account based on the specified filters. You can filter the results using the filters dictionary, which can include the following parameters:

  • short_name: The name of the bank, corresponding to the short name field.

  • last_transaction_date_min: Filter accounts with the most recent transaction date on or after this date (>=). Format: yyyy-mm-dd.

  • last_transaction_date_max: Filter accounts with the most recent transaction date on or before this date (<=). Format: yyyy-mm-dd.

  • since_id: Show bank accounts starting from the specified ID (>=).

  • accumulated_min: Filter bank accounts with a balance greater than or equal to this amount (>=).

  • accumulated_max: Filter bank accounts with a balance less than or equal to this amount (<=).

The filters dictionary allows you to customize your query by including any combination of the parameters listed above.

Source code in sepay/bank_account.py
def get_count(self, filters: Optional[Dict[str, str]] = None) -> int:
    """
    Example usage:

    ```python
    filters = {
        "since_id": "1000"
    }
    count = bank_account.get_count(filters=filters)
    ```

    Retrieve the count of bank_account based on the specified filters. You can filter the results
    using the `filters` dictionary, which can include the following parameters:

    - **short_name**:
    The name of the bank, corresponding to the short name field.

    - **last_transaction_date_min**:
    Filter accounts with the most recent transaction date on or after this date (>=). Format: `yyyy-mm-dd`.

    - **last_transaction_date_max**:
    Filter accounts with the most recent transaction date on or before this date (<=). Format: `yyyy-mm-dd`.

    - **since_id**:
    Show bank accounts starting from the specified ID (>=).

    - **accumulated_min**:
    Filter bank accounts with a balance greater than or equal to this amount (>=).

    - **accumulated_max**:
    Filter bank accounts with a balance less than or equal to this amount (<=).

    The `filters` dictionary allows you to customize your query by including any combination
    of the parameters listed above.
    """
    path = "bankaccounts/count"
    params = filters or {}

    data = self._get(path, params=params)

    return data["count_bankaccounts"]

models special

bank_account_model

BankAccount

__class_vars__ special

The names of the class variables defined on the model.

__private_attributes__ special

Metadata about the private attributes of the model.

__pydantic_complete__ special

Whether model building is completed, or if there are still undefined fields.

__pydantic_custom_init__ special

Whether the model has a custom __init__ method.

__pydantic_decorators__ special

Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.

__pydantic_generic_metadata__ special

Metadata for generic models; contains data used for a similar purpose to args, origin, parameters in typing-module generics. May eventually be replaced by these.

__pydantic_parent_namespace__ special

Parent namespace of the model, used for automatic rebuilding of models.

__pydantic_post_init__ special

The name of the post-init method for the model, if defined.

__signature__ special

The synthesized __init__ [Signature][inspect.Signature] of the model.

model_computed_fields

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

transaction_model

Transaction

__class_vars__ special

The names of the class variables defined on the model.

__private_attributes__ special

Metadata about the private attributes of the model.

__pydantic_complete__ special

Whether model building is completed, or if there are still undefined fields.

__pydantic_custom_init__ special

Whether the model has a custom __init__ method.

__pydantic_decorators__ special

Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.

__pydantic_generic_metadata__ special

Metadata for generic models; contains data used for a similar purpose to args, origin, parameters in typing-module generics. May eventually be replaced by these.

__pydantic_parent_namespace__ special

Parent namespace of the model, used for automatic rebuilding of models.

__pydantic_post_init__ special

The name of the post-init method for the model, if defined.

__signature__ special

The synthesized __init__ [Signature][inspect.Signature] of the model.

model_computed_fields

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

transaction

TransactionService

get_count(self, filters=None)

Example usage:

filters = {
    "account_number": "123456789",
    "transaction_date_min": "2023-01-01",
    "transaction_date_max": "2023-12-31",
    "since_id": "1000"
}
transaction_count = transactions.get_count(filters=filters)

Retrieve the count of transactions based on the specified filters. You can filter the results using the filters dictionary, which can include the following parameters:

  • account_number: The bank account number to filter transactions.

  • transaction_date_min: Show transactions created on or after this date (>=). Format: yyyy-mm-dd.

  • transaction_date_max: Show transactions created on or before this date (<=). Format: yyyy-mm-dd.

  • since_id: Show transactions starting from the specified ID (>=).

The filters dictionary allows you to customize your query by including any combination of the parameters listed above.

Source code in sepay/transaction.py
def get_count(self, filters: Optional[Dict[str, str]] = None) -> int:
    """
    Example usage:

    ```python
    filters = {
        "account_number": "123456789",
        "transaction_date_min": "2023-01-01",
        "transaction_date_max": "2023-12-31",
        "since_id": "1000"
    }
    transaction_count = transactions.get_count(filters=filters)
    ```

    Retrieve the count of transactions based on the specified filters. You can filter the results
    using the `filters` dictionary, which can include the following parameters:

    - **account_number**:
    The bank account number to filter transactions.

    - **transaction_date_min**:
    Show transactions created on or after this date (>=). Format: `yyyy-mm-dd`.

    - **transaction_date_max**:
    Show transactions created on or before this date (<=). Format: `yyyy-mm-dd`.

    - **since_id**:
    Show transactions starting from the specified ID (>=).

    The `filters` dictionary allows you to customize your query by including any combination
    of the parameters listed above.
    """
    path = "transactions/count"
    params = filters or {}

    data = self._get(path, params=params)

    return data["count_transactions"]

get_transaction(self, transaction_id)

Returns the details of a transaction_id.

Source code in sepay/transaction.py
def get_transaction(self, transaction_id: str) -> Transaction:
    """
    Returns the details of a transaction_id.
    """
    path = "transactions/details/{}".format(transaction_id)
    data = self._get(path)

    return self.get_object(Transaction, data["transaction"])

get_transactions(self, filters=None)

Example usage:

filters = {
    "account_number": "123456789",
    "transaction_date_min": "2023-01-01",
    "amount_in": "100.00"
}
transactions = transactions.get_transactions(filters=filters)

Retrieve a list of transactions. You can filter the results using the following parameters either directly as method arguments or through the filters dictionary:

  • account_number: The bank account number to filter transactions.

  • transaction_date_min: Show transactions created on or after this date (>=). Format: yyyy-mm-dd.

  • transaction_date_max: Show transactions created on or before this date (<=). Format: yyyy-mm-dd.

  • since_id: Show transactions starting from the specified ID (>=).

  • limit: Limit the number of transactions returned. Maximum is 5000, default is 5000.

  • reference_number: Retrieve transactions matching the specified reference number.

  • amount_in: Retrieve incoming transactions that match this amount.

  • amount_out: Retrieve outgoing transactions that match this amount.

The filters dictionary can include any of the parameters listed above. You can use either individual parameters or the filters dictionary to customize your query.

Source code in sepay/transaction.py
def get_transactions(self, filters: Optional[Dict[str, str]] = None) -> List[Transaction]:
    """
    Example usage:

    ```python
    filters = {
        "account_number": "123456789",
        "transaction_date_min": "2023-01-01",
        "amount_in": "100.00"
    }
    transactions = transactions.get_transactions(filters=filters)
    ```

    Retrieve a list of transactions. You can filter the results using the following parameters
    either directly as method arguments or through the `filters` dictionary:

    - **account_number**:
    The bank account number to filter transactions.

    - **transaction_date_min**:
    Show transactions created on or after this date (>=). Format: `yyyy-mm-dd`.

    - **transaction_date_max**:
    Show transactions created on or before this date (<=). Format: `yyyy-mm-dd`.

    - **since_id**:
    Show transactions starting from the specified ID (>=).

    - **limit**:
    Limit the number of transactions returned. Maximum is 5000, default is 5000.

    - **reference_number**:
    Retrieve transactions matching the specified reference number.

    - **amount_in**:
    Retrieve incoming transactions that match this amount.

    - **amount_out**:
    Retrieve outgoing transactions that match this amount.

    The `filters` dictionary can include any of the parameters listed above. You can use either
    individual parameters or the `filters` dictionary to customize your query.
    """

    path = "transactions/list"
    params = filters or {}

    data = self._get(path, params=params)
    transactions = data.get("transactions", [])

    return [self.get_object(Transaction, transaction) for transaction in transactions]