@@ -10411,6 +10411,8 @@ def de_json(cls, json_string):
1041110411 return TransactionPartnerTelegramAds .de_json (obj )
1041210412 elif obj ["type" ] == "telegram_api" :
1041310413 return TransactionPartnerTelegramApi .de_json (obj )
10414+ elif obj ["type" ] == "affiliate_program" :
10415+ return TransactionPartnerAffiliateProgram .de_json (obj )
1041410416 elif obj ["type" ] == "other" :
1041510417 return TransactionPartnerOther .de_json (obj )
1041610418
@@ -10486,6 +10488,9 @@ class TransactionPartnerUser(TransactionPartner):
1048610488 :param user: Information about the user
1048710489 :type user: :class:`User`
1048810490
10491+ :param affiliate: Optional. Information about the affiliate that received a commission via this transaction
10492+ :type affiliate: :class:`AffiliateInfo`
10493+
1048910494 :param invoice_payload: Optional, Bot-specified invoice payload
1049010495 :type invoice_payload: :obj:`str`
1049110496
@@ -10502,10 +10507,11 @@ class TransactionPartnerUser(TransactionPartner):
1050210507 :rtype: :class:`TransactionPartnerUser`
1050310508 """
1050410509
10505- def __init__ (self , type , user , invoice_payload = None , paid_media : Optional [List [PaidMedia ]] = None ,
10510+ def __init__ (self , type , user , affiliate = None , invoice_payload = None , paid_media : Optional [List [PaidMedia ]] = None ,
1050610511 subscription_period = None , gift : Optional [Gift ] = None , ** kwargs ):
1050710512 self .type : str = type
1050810513 self .user : User = user
10514+ self .affiliate : Optional [AffiliateInfo ] = affiliate
1050910515 self .invoice_payload : Optional [str ] = invoice_payload
1051010516 self .paid_media : Optional [List [PaidMedia ]] = paid_media
1051110517 self .subscription_period : Optional [int ] = subscription_period
@@ -10584,6 +10590,9 @@ class StarTransaction(JsonDeserializable):
1058410590 :param amount: Number of Telegram Stars transferred by the transaction
1058510591 :type amount: :obj:`int`
1058610592
10593+ :param nanostar_amount: Optional. The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999
10594+ :type nanostar_amount: :obj:`int`
10595+
1058710596 :param date: Date the transaction was created in Unix time
1058810597 :type date: :obj:`int`
1058910598
@@ -10607,12 +10616,13 @@ def de_json(cls, json_string):
1060710616 obj ['receiver' ] = TransactionPartner .de_json (obj ['receiver' ])
1060810617 return cls (** obj )
1060910618
10610- def __init__ (self , id , amount , date , source = None , receiver = None , ** kwargs ):
10619+ def __init__ (self , id , amount , date , source = None , receiver = None , nanostar_amount = None , ** kwargs ):
1061110620 self .id : str = id
1061210621 self .amount : int = amount
1061310622 self .date : int = date
1061410623 self .source : Optional [TransactionPartner ] = source
1061510624 self .receiver : Optional [TransactionPartner ] = receiver
10625+ self .nanostar_amount : Optional [int ] = nanostar_amount
1061610626
1061710627
1061810628class StarTransactions (JsonDeserializable ):
@@ -11093,4 +11103,82 @@ def de_json(cls, json_string):
1109311103 obj = cls .check_json (json_string )
1109411104 obj ['gifts' ] = [Gift .de_json (gift ) for gift in obj ['gifts' ]]
1109511105 return cls (** obj )
11096-
11106+
11107+
11108+ class TransactionPartnerAffiliateProgram (TransactionPartner ):
11109+ """
11110+ Describes the affiliate program that issued the affiliate commission received via this transaction.
11111+
11112+ Telegram documentation: https://core.telegram.org/bots/api#transactionpartneraffiliateprogram
11113+
11114+ :param type: Type of the transaction partner, always “affiliate_program”
11115+ :type type: :obj:`str`
11116+
11117+ :param sponsor_user: Optional. Information about the bot that sponsored the affiliate program
11118+ :type sponsor_user: :class:`User`
11119+
11120+ :param commission_per_mille: The number of Telegram Stars received by the bot for each 1000 Telegram Stars received by the affiliate program sponsor from referred users
11121+ :type commission_per_mille: :obj:`int`
11122+
11123+ :return: Instance of the class
11124+ :rtype: :class:`TransactionPartnerAffiliateProgram`
11125+ """
11126+
11127+ def __init__ (self , type , commission_per_mille , sponsor_user = None , ** kwargs ):
11128+ self .type : str = type
11129+ self .sponsor_user : Optional [User ] = sponsor_user
11130+ self .commission_per_mille : int = commission_per_mille
11131+
11132+ @classmethod
11133+ def de_json (cls , json_string ):
11134+ if json_string is None : return None
11135+ obj = cls .check_json (json_string )
11136+ if 'sponsor_user' in obj :
11137+ obj ['sponsor_user' ] = User .de_json (obj ['sponsor_user' ])
11138+
11139+ return cls (** obj )
11140+
11141+
11142+ class AffiliateInfo (JsonDeserializable ):
11143+ """
11144+ Contains information about the affiliate that received a commission via this transaction.
11145+
11146+ Telegram documentation: https://core.telegram.org/bots/api#affiliateinfo
11147+
11148+ :param affiliate_user: Optional. The bot or the user that received an affiliate commission if it was received by a bot or a user
11149+ :type affiliate_user: :class:`User`
11150+
11151+ :param affiliate_chat: Optional. The chat that received an affiliate commission if it was received by a chat
11152+ :type affiliate_chat: :class:`Chat`
11153+
11154+ :param commission_per_mille: The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from referred users
11155+ :type commission_per_mille: :obj:`int`
11156+
11157+ :param amount: Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0; can be negative for refunds
11158+ :type amount: :obj:`int`
11159+
11160+ :param nanostar_amount: Optional. The number of 1/1000000000 shares of Telegram Stars received by the affiliate; from -999999999 to 999999999; can be negative for refunds
11161+ :type nanostar_amount: :obj:`int`
11162+
11163+ :return: Instance of the class
11164+ :rtype: :class:`AffiliateInfo`
11165+ """
11166+
11167+ def __init__ (self , commission_per_mille , amount , affiliate_user = None , affiliate_chat = None , nanostar_amount = None , ** kwargs ):
11168+ self .affiliate_user : Optional [User ] = affiliate_user
11169+ self .affiliate_chat : Optional [Chat ] = affiliate_chat
11170+ self .commission_per_mille : int = commission_per_mille
11171+ self .amount : int = amount
11172+ self .nanostar_amount : Optional [int ] = nanostar_amount
11173+
11174+ @classmethod
11175+ def de_json (cls , json_string ):
11176+ if json_string is None : return None
11177+ obj = cls .check_json (json_string )
11178+ if 'affiliate_user' in obj :
11179+ obj ['affiliate_user' ] = User .de_json (obj ['affiliate_user' ])
11180+ if 'affiliate_chat' in obj :
11181+ obj ['affiliate_chat' ] = Chat .de_json (obj ['affiliate_chat' ])
11182+ return cls (** obj )
11183+
11184+
0 commit comments