Skip to content

Commit b73f51b

Browse files
authored
Merge pull request #2336 from coder2020official/botapi-77
bot api 7.7
2 parents 18834e4 + 2d56fa8 commit b73f51b

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<p align="center">A simple, but extensible Python implementation for the <a href="https://core.telegram.org/bots/api">Telegram Bot API</a>.</p>
1111
<p align="center">Both synchronous and asynchronous.</p>
1212

13-
## <p align="center">Supported Bot API version: <a href="https://core.telegram.org/bots/api#july-1-2024">7.6</a>!
13+
## <p align="center">Supported Bot API version: <a href="https://core.telegram.org/bots/api#july-7-2024">7.6</a>!
1414

1515
<h2><a href='https://pytba.readthedocs.io/en/latest/index.html'>Official documentation</a></h2>
1616
<h2><a href='https://pytba.readthedocs.io/ru/latest/index.html'>Official ru documentation</a></h2>

telebot/types.py

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,9 @@ class Message(JsonDeserializable):
10801080
the payment. More about payments »
10811081
:type successful_payment: :class:`telebot.types.SuccessfulPayment`
10821082
1083+
:param refunded_payment: Optional. Message is a service message about a refunded payment, information about the payment. More about payments »
1084+
:type refunded_payment: :class:`telebot.types.RefundedPayment`
1085+
10831086
:param users_shared: Optional. Service message: a user was shared with the bot
10841087
:type users_shared: :class:`telebot.types.UsersShared`
10851088
@@ -1391,7 +1394,8 @@ def de_json(cls, json_string):
13911394
opts['show_caption_above_media'] = obj['show_caption_above_media']
13921395
if 'paid_media' in obj:
13931396
opts['paid_media'] = PaidMediaInfo.de_json(obj['paid_media'])
1394-
1397+
if 'refunded_payment' in obj:
1398+
opts['refunded_payment'] = RefundedPayment.de_json(obj['refunded_payment'])
13951399

13961400
return cls(message_id, from_user, date, chat, content_type, opts, json_string)
13971401

@@ -1502,6 +1506,7 @@ def __init__(self, message_id, from_user, date, chat, content_type, options, jso
15021506
self.effect_id: Optional[str] = None
15031507
self.show_caption_above_media: Optional[bool] = None
15041508
self.paid_media : Optional[PaidMediaInfo] = None
1509+
self.refunded_payment : Optional[RefundedPayment] = None
15051510

15061511
for key in options:
15071512
setattr(self, key, options[key])
@@ -10676,5 +10681,43 @@ def to_dict(self):
1067610681
if self.supports_streaming is not None:
1067710682
data['supports_streaming'] = self.supports_streaming
1067810683
return data
10684+
10685+
class RefundedPayment(JsonDeserializable):
10686+
"""
10687+
This object contains basic information about a refunded payment.
10688+
10689+
Telegram documentation: https://core.telegram.org/bots/api#refundedpayment
10690+
10691+
:param currency: Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars. Currently, always “XTR”
10692+
:type currency: :obj:`str`
10693+
10694+
:param total_amount: Total refunded price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45, total_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
10695+
:type total_amount: :obj:`int`
10696+
10697+
:param invoice_payload: Bot-specified invoice payload
10698+
:type invoice_payload: :obj:`str`
10699+
10700+
:param telegram_payment_charge_id: Telegram payment identifier
10701+
:type telegram_payment_charge_id: :obj:`str`
10702+
10703+
:param provider_payment_charge_id: Optional. Provider payment identifier
10704+
:type provider_payment_charge_id: :obj:`str`
10705+
10706+
:return: Instance of the class
10707+
:rtype: :class:`RefundedPayment`
10708+
"""
10709+
10710+
def __init__(self, currency, total_amount, invoice_payload, telegram_payment_charge_id, provider_payment_charge_id=None, **kwargs):
10711+
self.currency: str = currency
10712+
self.total_amount: int = total_amount
10713+
self.invoice_payload: str = invoice_payload
10714+
self.telegram_payment_charge_id: str = telegram_payment_charge_id
10715+
self.provider_payment_charge_id: Optional[str] = provider_payment_charge_id
10716+
10717+
@classmethod
10718+
def de_json(cls, json_string):
10719+
if json_string is None: return None
10720+
obj = cls.check_json(json_string)
10721+
return cls(**obj)
1067910722

1068010723

0 commit comments

Comments
 (0)