This object represents one shipping option. Telegram Documentation: https://core.telegram.org/bots/api#shippingoption :param id: Shipping option identifier :type id: :obj:`str` :param title: Option title :type title: :obj:`str` :param prices: List of price portions
| 6651 | |
| 6652 | # noinspection PyUnresolvedReferences,PyShadowingBuiltins |
| 6653 | class ShippingOption(JsonSerializable): |
| 6654 | """ |
| 6655 | This object represents one shipping option. |
| 6656 | |
| 6657 | Telegram Documentation: https://core.telegram.org/bots/api#shippingoption |
| 6658 | |
| 6659 | :param id: Shipping option identifier |
| 6660 | :type id: :obj:`str` |
| 6661 | |
| 6662 | :param title: Option title |
| 6663 | :type title: :obj:`str` |
| 6664 | |
| 6665 | :param prices: List of price portions |
| 6666 | :type prices: :obj:`list` of :class:`telebot.types.LabeledPrice` |
| 6667 | |
| 6668 | :return: Instance of the class |
| 6669 | :rtype: :class:`telebot.types.ShippingOption` |
| 6670 | """ |
| 6671 | def __init__(self, id, title): |
| 6672 | self.id: str = id |
| 6673 | self.title: str = title |
| 6674 | self.prices: List[LabeledPrice] = [] |
| 6675 | |
| 6676 | def add_price(self, *args) -> 'ShippingOption': |
| 6677 | """ |
| 6678 | Add LabeledPrice to ShippingOption |
| 6679 | |
| 6680 | :param args: LabeledPrices |
| 6681 | :type args: :obj:`LabeledPrice` |
| 6682 | |
| 6683 | :return: None |
| 6684 | """ |
| 6685 | for price in args: |
| 6686 | self.prices.append(price) |
| 6687 | return self |
| 6688 | |
| 6689 | def to_json(self): |
| 6690 | price_list = [] |
| 6691 | for p in self.prices: |
| 6692 | price_list.append(p.to_dict()) |
| 6693 | json_dict = json.dumps({'id': self.id, 'title': self.title, 'prices': price_list}) |
| 6694 | return json_dict |
| 6695 | |
| 6696 | |
| 6697 | class SuccessfulPayment(JsonDeserializable): |
no outgoing calls
no test coverage detected
searching dependent graphs…