Source code for pyrobale.objects.precheckoutquery

from typing import TYPE_CHECKING, Optional
from .utils import smart_method
if TYPE_CHECKING:
    from .user import User
    from ..client import Client


[docs] class PreCheckoutQuery: def __init__( self, id: Optional[str] = None, from_user: Optional["User"] = None, currency: Optional[str] = None, total_amount: Optional[int] = None, invoice_payload: Optional[str] = None, **kwargs ) -> None:
[docs] self.id = id
[docs] self.from_user = from_user
[docs] self.currency = currency
[docs] self.total_amount = total_amount
[docs] self.invoice_payload = invoice_payload
[docs] self.client = kwargs.get("client", None)
@smart_method
[docs] async def answer(self, ok: bool, error_message: str = None) -> bool: """Answers to a 'PreCheckoutQuery' update Args: ok (bool): True for allowing the payment and False for showing the error message error_message (str): Optional: An string to show the user if the `ok` argument is False Returns: bool: True in success """ return await self.client.answer_pre_checkout_query(self, ok, error_message)