Skip to content

Commit d5c9212

Browse files
Eldinnietsnoam
authored andcommitted
Add two arguments to send_invoice (python-telegram-bot#986)
Telegram silently added `send_phone_number_to_provider` and `send_email_to_provider` to the send_invoice method.
1 parent 8690ba2 commit d5c9212

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

telegram/bot.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2202,6 +2202,8 @@ def send_invoice(self,
22022202
reply_to_message_id=None,
22032203
reply_markup=None,
22042204
provider_data=None,
2205+
send_phone_number_to_provider=None,
2206+
send_email_to_provider=None,
22052207
timeout=None,
22062208
**kwargs):
22072209
"""Use this method to send invoices.
@@ -2236,6 +2238,10 @@ def send_invoice(self,
22362238
complete the order.
22372239
need_shipping_address (:obj:`bool`, optional): Pass True, if you require the user's
22382240
shipping address to complete the order.
2241+
send_phone_number_to_provider (:obj:`bool`, optional): Pass True, if user's phone
2242+
number should be sent to provider.
2243+
send_email_to_provider (:obj:`bool`, optional): Pass True, if user's email address
2244+
should be sent to provider.
22392245
is_flexible (:obj:`bool`, optional): Pass True, if the final price depends on the
22402246
shipping method.
22412247
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
@@ -2292,6 +2298,10 @@ def send_invoice(self,
22922298
data['need_shipping_address'] = need_shipping_address
22932299
if is_flexible is not None:
22942300
data['is_flexible'] = is_flexible
2301+
if send_phone_number_to_provider is not None:
2302+
data['send_phone_number_to_provider'] = send_email_to_provider
2303+
if send_email_to_provider is not None:
2304+
data['send_email_to_provider'] = send_email_to_provider
22952305

22962306
return url, data
22972307

tests/test_invoice.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ def test_send_all_args(self, bot, chat_id, provider_token):
100100
need_phone_number=True,
101101
need_email=True,
102102
need_shipping_address=True,
103+
send_phone_number_to_provider=True,
104+
send_email_to_provider=True,
103105
is_flexible=True)
104106

105107
assert message.invoice.currency == self.currency

0 commit comments

Comments
 (0)