Skip to content

Commit

Permalink
Update to Bot API 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
DjMike238 committed Jan 4, 2025
1 parent 3c29f4e commit 385b300
Showing 1 changed file with 34 additions and 11 deletions.
45 changes: 34 additions & 11 deletions payments.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,31 @@ type RevenueWithdrawalStateFailed struct {
// ImplementsRevenueWithdrawalState is used to implement the RevenueWithdrawalState interface.
func (r RevenueWithdrawalStateFailed) ImplementsRevenueWithdrawalState() {}

// AffiliateInfo
type AffiliateInfo struct {
AffiliateUser *User `json:"affiliate_user,omitempty"`
AffiliateChat *Chat `json:"affiliate_chat,omitempty"`
CommissionPerMille int `json:"commission_per_mille"`
Amount int `json:"amount"`
NanostarAmount int `json:"nanostar_amount,omitempty"`
}

// TransactionPartner describes the source of a transaction, or its recipient for outgoing transactions.
type TransactionPartner interface {
ImplementsTransactionPartner()
}

// TransactionPartnerAffiliateProgram describes the affiliate program that issued the affiliate commission received via this transaction.
// Type MUST be "affiliate_program".
type TransactionPartnerAffiliateProgram struct {
SponsorUser *User `json:"sponsor_user,omitempty"`
Type string `json:"type"`
CommissionPerMille int `json:"commission_per_mille,omitempty"`
}

// ImplementsTransactionPartner is used to implement the TransactionPartner interface.
func (t TransactionPartnerAffiliateProgram) ImplementsTransactionPartner() {}

// TransactionPartnerFragment describes a withdrawal transaction with Fragment.
// Type MUST be "fragment".
type TransactionPartnerFragment struct {
Expand All @@ -163,12 +183,14 @@ func (t TransactionPartnerFragment) ImplementsTransactionPartner() {}
// TransactionPartnerUser describes a transaction with a user.
// Type MUST be "user".
type TransactionPartnerUser struct {
PaidMedia *[]PaidMedia `json:"paid_media,omitempty"`
Type string `json:"type"`
InvoicePayload string `json:"invoice_payload,omitempty"`
User User `json:"user"`
Gift Gift `json:"gift,omitempty"`
SubscriptionPeriod int `json:"subscription_period,omitempty"`
PaidMedia *[]PaidMedia `json:"paid_media,omitempty"`
Type string `json:"type"`
InvoicePayload string `json:"invoice_payload,omitempty"`
PaidMediaPayload string `json:"paid_media_payload,omitempty"`
User User `json:"user"`
Affiliate *AffiliateInfo `json:"affiliate,omitempty"`
Gift Gift `json:"gift,omitempty"`
SubscriptionPeriod int `json:"subscription_period,omitempty"`
}

// ImplementsTransactionPartner is used to implement the TransactionPartner interface.
Expand Down Expand Up @@ -204,11 +226,12 @@ func (t TransactionPartnerOther) ImplementsTransactionPartner() {}

// StarTransaction describes a Telegram Star transaction.
type StarTransaction struct {
Source TransactionPartner `json:"source"`
Receiver TransactionPartner `json:"receiver"`
ID string `json:"id"`
Amount int `json:"amount"`
Date int `json:"date"`
Source TransactionPartner `json:"source"`
Receiver TransactionPartner `json:"receiver"`
ID string `json:"id"`
Amount int `json:"amount"`
NanostarAmount int `json:"nanostar_amount,omitempty"`
Date int `json:"date"`
}

// StarTransactions contains a list of Telegram Star transactions.
Expand Down

0 comments on commit 385b300

Please sign in to comment.