Repository: python-telegram-bot/python-telegram-bot

Issue:
[BUG] send_invoice: send_phone_number_to_provider is set from send_email_to_provider
<!--
Thanks for reporting issues of python-telegram-bot!

Use this template to notify us if you found a bug.

To make it easier for us to help you please enter detailed information below.

Please note, we only support the latest version of python-telegram-bot and
master branch. Please make sure to upgrade & recreate the issue on the latest
version prior to opening an issue.
-->
### Steps to reproduce
1. Create bot with connected payment provider YooKassa

2. Call `bot.send_invoice(..., send_phone_number_to_provider=True, need_phone_number=True)`

### Expected behaviour
`sendInvoice` POST request to Telegram API with `send_phone_number_to_provider: true` in body

### Actual behaviour
`sendInvoice` POST request to Telegram API without `send_phone_number_to_provider: true` in body. This behaviour produces an error "Customer e-mail and phone number are not specified" when trying to pay with YooKassa.

### Configuration
**Operating System:**
Linux Mint 20.1 Ulyssa

**Version of Python, python-telegram-bot & dependencies:**

```
python-telegram-bot 13.5
Bot API 5.2
certifi 2020.12.05
Python 3.9.0+ (default, Oct 20 2020, 08:43:38)  [GCC 9.3.0]
```




Discussion:

Resolving patch:
diff --git a/telegram/bot.py b/telegram/bot.py
--- a/telegram/bot.py
+++ b/telegram/bot.py
@@ -3425,7 +3425,7 @@ def send_invoice(
         if is_flexible is not None:
             data['is_flexible'] = is_flexible
         if send_phone_number_to_provider is not None:
-            data['send_phone_number_to_provider'] = send_email_to_provider
+            data['send_phone_number_to_provider'] = send_phone_number_to_provider
         if send_email_to_provider is not None:
             data['send_email_to_provider'] = send_email_to_provider
 


Test patch:
diff --git a/tests/test_invoice.py b/tests/test_invoice.py
--- a/tests/test_invoice.py
+++ b/tests/test_invoice.py
@@ -94,7 +94,7 @@ def test_send_required_args_only(self, bot, chat_id, provider_token):
         assert message.invoice.total_amount == self.total_amount
 
     @flaky(3, 1)
-    def test_send_all_args(self, bot, chat_id, provider_token):
+    def test_send_all_args(self, bot, chat_id, provider_token, monkeypatch):
         message = bot.send_invoice(
             chat_id,
             self.title,
@@ -128,6 +128,61 @@ def test_send_all_args(self, bot, chat_id, provider_token):
         assert message.invoice.title == self.title
         assert message.invoice.total_amount == self.total_amount
 
+        # We do this next one as safety guard to make sure that we pass all of the optional
+        # parameters correctly because #2526 went unnoticed for 3 years …
+        def make_assertion(*args, **_):
+            kwargs = args[1]
+            return (
+                kwargs['chat_id'] == 'chat_id'
+                and kwargs['title'] == 'title'
+                and kwargs['description'] == 'description'
+                and kwargs['payload'] == 'payload'
+                and kwargs['provider_token'] == 'provider_token'
+                and kwargs['currency'] == 'currency'
+                and kwargs['prices'] == [p.to_dict() for p in self.prices]
+                and kwargs['max_tip_amount'] == 'max_tip_amount'
+                and kwargs['suggested_tip_amounts'] == 'suggested_tip_amounts'
+                and kwargs['start_parameter'] == 'start_parameter'
+                and kwargs['provider_data'] == 'provider_data'
+                and kwargs['photo_url'] == 'photo_url'
+                and kwargs['photo_size'] == 'photo_size'
+                and kwargs['photo_width'] == 'photo_width'
+                and kwargs['photo_height'] == 'photo_height'
+                and kwargs['need_name'] == 'need_name'
+                and kwargs['need_phone_number'] == 'need_phone_number'
+                and kwargs['need_email'] == 'need_email'
+                and kwargs['need_shipping_address'] == 'need_shipping_address'
+                and kwargs['send_phone_number_to_provider'] == 'send_phone_number_to_provider'
+                and kwargs['send_email_to_provider'] == 'send_email_to_provider'
+                and kwargs['is_flexible'] == 'is_flexible'
+            )
+
+        monkeypatch.setattr(bot, '_message', make_assertion)
+        assert bot.send_invoice(
+            chat_id='chat_id',
+            title='title',
+            description='description',
+            payload='payload',
+            provider_token='provider_token',
+            currency='currency',
+            prices=self.prices,
+            max_tip_amount='max_tip_amount',
+            suggested_tip_amounts='suggested_tip_amounts',
+            start_parameter='start_parameter',
+            provider_data='provider_data',
+            photo_url='photo_url',
+            photo_size='photo_size',
+            photo_width='photo_width',
+            photo_height='photo_height',
+            need_name='need_name',
+            need_phone_number='need_phone_number',
+            need_email='need_email',
+            need_shipping_address='need_shipping_address',
+            send_phone_number_to_provider='send_phone_number_to_provider',
+            send_email_to_provider='send_email_to_provider',
+            is_flexible='is_flexible',
+        )
+
     def test_send_object_as_provider_data(self, monkeypatch, bot, chat_id, provider_token):
         def test(url, data, **kwargs):
             return (