Skip to content

Commit

Permalink
Update to BotAPI 7.7
Browse files Browse the repository at this point in the history
  • Loading branch information
z44d committed Jul 7, 2024
1 parent 16bfe1b commit ff412d9
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
Empty file removed tgram/tes
Empty file.
40 changes: 40 additions & 0 deletions tgram/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ def __init__(
pinned_message: "Message" = None,
invoice: "Invoice" = None,
successful_payment: "SuccessfulPayment" = None,
refunded_payment: "RefundedPayment" = None,
users_shared: "UsersShared" = None,
chat_shared: "ChatShared" = None,
connected_website: "str" = None,
Expand Down Expand Up @@ -636,6 +637,7 @@ def __init__(
self.pinned_message = pinned_message
self.invoice = invoice
self.successful_payment = successful_payment
self.refunded_payment = refunded_payment
self.users_shared = users_shared
self.chat_shared = chat_shared
self.connected_website = connected_website
Expand Down Expand Up @@ -765,6 +767,9 @@ def _parse(me: "tgram.TgBot" = None, d: dict = None) -> Optional["Message"]:
successful_payment=SuccessfulPayment._parse(
me=me, d=d.get("successful_payment")
),
refunded_payment=RefundedPayment._parse(
me=me, d=d.get("refunded_payment")
),
users_shared=UsersShared._parse(me=me, d=d.get("users_shared")),
chat_shared=ChatShared._parse(me=me, d=d.get("chat_shared")),
connected_website=d.get("connected_website"),
Expand Down Expand Up @@ -7346,6 +7351,41 @@ def _parse(
)


class RefundedPayment(Type_):
def __init__(
self,
currency: "str",
total_amount: "int",
invoice_payload: "str",
telegram_payment_charge_id: "str",
provider_payment_charge_id: "str" = None,
me: tgram.TgBot = None,
json: "dict" = None,
) -> None:
super().__init__(me=me, json=json)
self.currency = currency
self.total_amount = total_amount
self.invoice_payload = invoice_payload
self.telegram_payment_charge_id = telegram_payment_charge_id
self.provider_payment_charge_id = provider_payment_charge_id

@staticmethod
def _parse(me: "tgram.TgBot" = None, d: dict = None) -> Optional["RefundedPayment"]:
return (
RefundedPayment(
me=me,
json=d,
currency=d.get("currency"),
total_amount=d.get("total_amount"),
invoice_payload=d.get("invoice_payload"),
telegram_payment_charge_id=d.get("telegram_payment_charge_id"),
provider_payment_charge_id=d.get("provider_payment_charge_id"),
)
if d
else None
)


class ShippingQuery(Type_):
def __init__(
self,
Expand Down

0 comments on commit ff412d9

Please sign in to comment.