Skip to content

Queries

components.payment_gateway.subcomponents.merchants.protected.business_logic.queries.merchant_queries

MerchantQueries

This class is responsible for getting the merchant information.

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/business_logic/queries/merchant_queries.py
@obs.api_call()
def get_merchant_info(
    self,
    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,
    )