Skip to content

components.payment_gateway.public.merchants

This module defines the public API for the merchants subcomponent.

Only business logic is 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.

Functions

get_merchant_info

get_merchant_info(session, /, merchant_id)

Get the merchant info from its ID.

Source code in components/payment_gateway/subcomponents/merchants/protected/api.py
@obs.api_call()
def get_merchant_info(
    session: Session,
    /,
    merchant_id: str,
) -> MerchantInfo | None:
    """
    Get the merchant info from its ID.
    """
    from components.payment_gateway.subcomponents.merchants.models.brokers.merchant_info import (
        MerchantInfoModelBroker,
    )

    merchant_info = MerchantInfoModelBroker.find_merchant_info_by_merchant_id(
        session,
        merchant_id,
    )
    if merchant_info is None:
        return None

    return MerchantInfo(
        merchant_id=merchant_info.merchant_id,
        acquirer_id=merchant_info.acquirer_id,
        mcc=merchant_info.mcc,
        name=merchant_info.name,
        postal_code=merchant_info.postal_code,
        city=merchant_info.city,
        country=merchant_info.country,
    )