From 3569eea158706d9329e8dcf62b521b35c4fc7481 Mon Sep 17 00:00:00 2001 From: Andrew Anfanik Date: Sun, 8 Dec 2024 06:01:29 +0200 Subject: [PATCH] Add affiliate field to TransactionPartnerUser & create AffiliateInfo --- .../model/stars/affiliate/AffiliateInfo.kt | 12 ++++++++++++ .../model/stars/partner/TransactionPartnerUser.kt | 4 ++++ 2 files changed, 16 insertions(+) create mode 100644 library/src/main/java/com/pengrad/telegrambot/model/stars/affiliate/AffiliateInfo.kt diff --git a/library/src/main/java/com/pengrad/telegrambot/model/stars/affiliate/AffiliateInfo.kt b/library/src/main/java/com/pengrad/telegrambot/model/stars/affiliate/AffiliateInfo.kt new file mode 100644 index 00000000..93381a3b --- /dev/null +++ b/library/src/main/java/com/pengrad/telegrambot/model/stars/affiliate/AffiliateInfo.kt @@ -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 +) diff --git a/library/src/main/java/com/pengrad/telegrambot/model/stars/partner/TransactionPartnerUser.kt b/library/src/main/java/com/pengrad/telegrambot/model/stars/partner/TransactionPartnerUser.kt index 04119f8d..4d2c2b9a 100644 --- a/library/src/main/java/com/pengrad/telegrambot/model/stars/partner/TransactionPartnerUser.kt +++ b/library/src/main/java/com/pengrad/telegrambot/model/stars/partner/TransactionPartnerUser.kt @@ -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? = null, @get:JvmName("paidMediaPayload") val paidMediaPayload: String? = null, @@ -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 @@ -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)