Skip to content

Commit

Permalink
Add affiliate field to TransactionPartnerUser & create AffiliateInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
anfanik committed Dec 8, 2024
1 parent e195926 commit 3569eea
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.pengrad.telegrambot.model.stars.affiliate

import com.pengrad.telegrambot.model.Chat
import com.pengrad.telegrambot.model.User

data class AffiliateInfo(
@get:JvmName("affiliateUser") val affiliateUser: User? = null,
@get:JvmName("affiliateChat") val affiliateChat: Chat? = null,
@get:JvmName("commissionPerMille") val commissionPerMille: Int,
@get:JvmName("amount") val amount: Int,
@get:JvmName("nanostarAmount") val nanostarAmount: Int? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ package com.pengrad.telegrambot.model.stars.partner
import com.pengrad.telegrambot.model.User
import com.pengrad.telegrambot.model.gift.Gift
import com.pengrad.telegrambot.model.paidmedia.PaidMedia
import com.pengrad.telegrambot.model.stars.affiliate.AffiliateInfo
import com.pengrad.telegrambot.model.stars.partner.TransactionPartnerType.USER

data class TransactionPartnerUser(
@get:JvmName("user") val user: User,
@get:JvmName("affiliate") val affiliate: AffiliateInfo,
@get:JvmName("invoicePayload") val invoicePayload: String? = null,
@get:JvmName("paidMedia") val paidMedia: Array<PaidMedia>? = null,
@get:JvmName("paidMediaPayload") val paidMediaPayload: String? = null,
Expand All @@ -25,6 +27,7 @@ data class TransactionPartnerUser(

if (subscriptionPeriod != other.subscriptionPeriod) return false
if (user != other.user) return false
if (affiliate != other.affiliate) return false
if (invoicePayload != other.invoicePayload) return false
if (paidMedia != null) {
if (other.paidMedia == null) return false
Expand All @@ -40,6 +43,7 @@ data class TransactionPartnerUser(
override fun hashCode(): Int {
var result = subscriptionPeriod ?: 0
result = 31 * result + user.hashCode()
result = 31 * result + affiliate.hashCode()
result = 31 * result + (invoicePayload?.hashCode() ?: 0)
result = 31 * result + (paidMedia?.contentHashCode() ?: 0)
result = 31 * result + (paidMediaPayload?.hashCode() ?: 0)
Expand Down

0 comments on commit 3569eea

Please sign in to comment.