Skip to content

components.payment_gateway.public.banking_documents

This module defines the public API for the banking documents subcomponent.

Only business logic classes are exposed here. Basic entities and enums are exposed in separate modules to avoid loading the entire subcomponent with its models and dependencies when they are not needed.

Classes

SepaMandateActions

Sepa Mandate Actions

Functions

declare_sepa_mandate
declare_sepa_mandate(
    session,
    /,
    workspace_key,
    external_id,
    account_holder_id,
    sepa_creditor_identifier,
    debtor_name,
    debtor_iban,
    debtor_country,
    unique_mandate_reference,
    issued_at,
    status,
)

Declare a SEPA mandate.

Source code in components/payment_gateway/subcomponents/banking_documents/protected/business_logic/actions/sepa_mandate_actions.py
@obs.api_call()
def declare_sepa_mandate(
    self,
    session: Session,
    /,
    workspace_key: str,
    external_id: str,
    account_holder_id: AccountHolderId,
    sepa_creditor_identifier: str,
    debtor_name: str,
    debtor_iban: str,
    debtor_country: str,
    unique_mandate_reference: str,
    issued_at: datetime,
    status: SepaMandateStatus,
) -> SepaMandateId:
    """
    Declare a SEPA mandate.
    """
    sepa_mandate = SepaMandateModelBroker.create_sepa_mandate(
        session,
        workspace_key=workspace_key,
        external_id=external_id,
        status=status,
        account_holder_id=account_holder_id,
        sepa_creditor_identifier=sepa_creditor_identifier,
        debtor_name=debtor_name,
        debtor_iban=debtor_iban,
        debtor_country=debtor_country,
        unique_mandate_reference=unique_mandate_reference,
        issued_at=issued_at,
    )
    return SepaMandateId(sepa_mandate.id)
update_sepa_mandate_status
update_sepa_mandate_status(
    session, /, sepa_mandate_id, status
)

Update the status of a specific SEPA mandate.

Source code in components/payment_gateway/subcomponents/banking_documents/protected/business_logic/actions/sepa_mandate_actions.py
@obs.api_call()
def update_sepa_mandate_status(
    self,
    session: Session,
    /,
    sepa_mandate_id: SepaMandateId,
    status: SepaMandateStatus,
) -> None:
    """
    Update the status of a specific SEPA mandate.
    """
    with raise_if_sepa_mandate_not_found(sepa_mandate_id):
        SepaMandateModelBroker.set_sepa_mandate_status(
            session,
            id=sepa_mandate_id,
            status=status,
        )

SepaMandateQueries

Sepa Mandate Queries

Functions

get_sepa_mandate
get_sepa_mandate(session, /, id)

Get a SEPA mandate by ID.

Source code in components/payment_gateway/subcomponents/banking_documents/protected/business_logic/queries/sepa_mandate_queries.py
@obs.api_call()
def get_sepa_mandate(
    self,
    session: Session,
    /,
    id: SepaMandateId,
) -> SepaMandate:
    """
    Get a SEPA mandate by ID.
    """
    with raise_if_sepa_mandate_not_found(id):
        sepa_mandate = SepaMandateModelBroker.get_sepa_mandate(session, id=id)

    return _to_dataclass(sepa_mandate=sepa_mandate)
get_sepa_mandate_by_external_id
get_sepa_mandate_by_external_id(
    session, /, workspace_key, external_id
)

Get a SEPA mandate by its external ID.

Source code in components/payment_gateway/subcomponents/banking_documents/protected/business_logic/queries/sepa_mandate_queries.py
@obs.api_call()
def get_sepa_mandate_by_external_id(
    self,
    session: Session,
    /,
    workspace_key: str,
    external_id: str,
) -> SepaMandate:
    """
    Get a SEPA mandate by its external ID.
    """
    with raise_if_sepa_mandate_not_found_for_external_id(external_id):
        sepa_mandate = SepaMandateModelBroker.get_sepa_mandate_by_external_id(
            session,
            workspace_key=workspace_key,
            external_id=external_id,
        )

    return _to_dataclass(sepa_mandate=sepa_mandate)