Skip to content

Actions

components.payment_gateway.subcomponents.banking_documents.business_logic.actions.sepa_mandate_actions

SepaMandateActions

declare_sepa_mandate

declare_sepa_mandate(
    session,
    /,
    account_holder_id,
    provider,
    external_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/business_logic/actions/sepa_mandate_actions.py
def declare_sepa_mandate(
    self,
    session: Session,
    /,
    account_holder_id: AccountHolderId,
    provider: PaymentServiceProvider,
    external_id: str,
    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,
        status=status,
        account_holder_id=account_holder_id,
        provider=provider,
        external_id=external_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/business_logic/actions/sepa_mandate_actions.py
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,
        )