From 122a54c6894be9676f59b27b9e363dedf9373337 Mon Sep 17 00:00:00 2001 From: ruben Date: Thu, 2 Jan 2025 02:43:19 +0100 Subject: [PATCH] Api Version 8.1 --- pom.xml | 2 +- telegrambots-abilities/pom.xml | 6 +- telegrambots-client-jetty-adapter/pom.xml | 2 +- telegrambots-client/pom.xml | 2 +- telegrambots-extensions/README.md | 4 +- telegrambots-extensions/pom.xml | 6 +- telegrambots-longpolling/pom.xml | 2 +- telegrambots-meta/pom.xml | 2 +- .../payments/star/StarTransaction.java | 9 ++- .../transactionpartner/AffiliateInfo.java | 69 +++++++++++++++++++ .../TransactionPartner.java | 6 +- .../TransactionPartnerAffiliateProgram.java | 50 ++++++++++++++ .../TransactionPartnerUser.java | 7 ++ .../pom.xml | 4 +- .../pom.xml | 4 +- telegrambots-test-reports/pom.xml | 2 +- telegrambots-webhook/pom.xml | 2 +- 17 files changed, 158 insertions(+), 21 deletions(-) create mode 100644 telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/payments/transactionpartner/AffiliateInfo.java create mode 100644 telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/payments/transactionpartner/TransactionPartnerAffiliateProgram.java diff --git a/pom.xml b/pom.xml index 4645cd44f..c3a52f271 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots pom - 8.0.0 + 8.1.0 telegrambots-meta diff --git a/telegrambots-abilities/pom.xml b/telegrambots-abilities/pom.xml index a7b067811..f4feebede 100644 --- a/telegrambots-abilities/pom.xml +++ b/telegrambots-abilities/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 8.0.0 + 8.1.0 telegrambots-abilities @@ -104,12 +104,12 @@ org.telegram telegrambots-webhook - 8.0.0 + 8.1.0 org.telegram telegrambots-longpolling - 8.0.0 + 8.1.0 diff --git a/telegrambots-client-jetty-adapter/pom.xml b/telegrambots-client-jetty-adapter/pom.xml index debfb1e8e..441a83e27 100644 --- a/telegrambots-client-jetty-adapter/pom.xml +++ b/telegrambots-client-jetty-adapter/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 8.0.0 + 8.1.0 Telegram Bots Client Jetty HttpClient adapter diff --git a/telegrambots-client/pom.xml b/telegrambots-client/pom.xml index b33bb16fa..2545e923a 100644 --- a/telegrambots-client/pom.xml +++ b/telegrambots-client/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 8.0.0 + 8.1.0 Telegram Bots Client diff --git a/telegrambots-extensions/README.md b/telegrambots-extensions/README.md index 8c8cf6926..0a061badb 100644 --- a/telegrambots-extensions/README.md +++ b/telegrambots-extensions/README.md @@ -16,12 +16,12 @@ Just import add the library to your project with one of these options: org.telegram telegrambots-extensions - 8.0.0 + 8.1.0 ``` 2. Using Gradle: ```gradle - implementation 'org.telegram:telegrambots-extensions:8.0.0' + implementation 'org.telegram:telegrambots-extensions:8.1.0' ``` \ No newline at end of file diff --git a/telegrambots-extensions/pom.xml b/telegrambots-extensions/pom.xml index f57530d6a..51aa23150 100644 --- a/telegrambots-extensions/pom.xml +++ b/telegrambots-extensions/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 8.0.0 + 8.1.0 telegrambots-extensions @@ -89,12 +89,12 @@ org.telegram telegrambots-webhook - 8.0.0 + 8.1.0 org.telegram telegrambots-longpolling - 8.0.0 + 8.1.0 diff --git a/telegrambots-longpolling/pom.xml b/telegrambots-longpolling/pom.xml index 7bc1d917c..63af99cc5 100644 --- a/telegrambots-longpolling/pom.xml +++ b/telegrambots-longpolling/pom.xml @@ -6,7 +6,7 @@ org.telegram Bots - 8.0.0 + 8.1.0 telegrambots-longpolling diff --git a/telegrambots-meta/pom.xml b/telegrambots-meta/pom.xml index 95b899b04..e50a318b6 100644 --- a/telegrambots-meta/pom.xml +++ b/telegrambots-meta/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 8.0.0 + 8.1.0 telegrambots-meta diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/payments/star/StarTransaction.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/payments/star/StarTransaction.java index 81a4a9741..5efeafd04 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/payments/star/StarTransaction.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/payments/star/StarTransaction.java @@ -32,6 +32,7 @@ public class StarTransaction implements BotApiObject { private static final String ID_FIELD = "id"; private static final String AMOUNT_FIELD = "amount"; + private static final String NANO_STAR_AMOUNT_FIELD = "nanostar_amount"; private static final String DATE_FIELD = "date"; private static final String SOURCE_FIELD = "source"; private static final String RECEIVER_FIELD = "receiver"; @@ -45,7 +46,7 @@ public class StarTransaction implements BotApiObject { @NonNull private String id; /** - * Number of Telegram Stars transferred by the transaction + * Integer amount of Telegram Stars transferred by the transaction */ @JsonProperty(AMOUNT_FIELD) @NonNull @@ -70,4 +71,10 @@ public class StarTransaction implements BotApiObject { */ @JsonProperty(RECEIVER_FIELD) private TransactionPartner receiver; + /** + * Optional. + * The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999 + */ + @JsonProperty(NANO_STAR_AMOUNT_FIELD) + private Integer nanoStarAmount; } diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/payments/transactionpartner/AffiliateInfo.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/payments/transactionpartner/AffiliateInfo.java new file mode 100644 index 000000000..90e3e5445 --- /dev/null +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/payments/transactionpartner/AffiliateInfo.java @@ -0,0 +1,69 @@ +package org.telegram.telegrambots.meta.api.objects.payments.transactionpartner; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NonNull; +import lombok.RequiredArgsConstructor; +import lombok.Setter; +import lombok.ToString; +import lombok.experimental.SuperBuilder; +import lombok.extern.jackson.Jacksonized; +import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; +import org.telegram.telegrambots.meta.api.objects.User; +import org.telegram.telegrambots.meta.api.objects.chat.Chat; + +/** + * @author Ruben Bermudez + * @version 8.1 + * Contains information about the affiliate that received a commission via this transaction. + */ +@EqualsAndHashCode(callSuper = false) +@Getter +@Setter +@ToString +@RequiredArgsConstructor +@SuperBuilder +@Jacksonized +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class AffiliateInfo implements BotApiObject { + private static final String AFFILIATE_USER_FIELD = "affiliate_user"; + private static final String AFFILIATE_CHAT_FIELD = "affiliate_chat"; + private static final String COMMISSION_PER_MILLE_FIELD = "commission_per_mille"; + private static final String AMOUNT_FIELD = "amount"; + private static final String NANO_STAR_AMOUNT_FIELD = "nanostar_amount"; + + /** + * Optional. + * The bot or the user that received an affiliate commission if it was received by a bot or a user + */ + @JsonProperty(AFFILIATE_USER_FIELD) + private User affiliateUser; + /** + * Optional. + * The chat that received an affiliate commission if it was received by a chat + */ + @JsonProperty(AFFILIATE_CHAT_FIELD) + private Chat affiliateChat; + /** + * The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from referred users + */ + @JsonProperty(COMMISSION_PER_MILLE_FIELD) + @NonNull + private Integer commissionPerMille; + /** + * Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0; can be negative for refunds + */ + @JsonProperty(AMOUNT_FIELD) + @NonNull + private Integer amount; + /** + * Optional. + * The number of 1/1000000000 shares of Telegram Stars received by the affiliate; from -999999999 to 999999999; can be negative for refunds + */ + @JsonProperty(NANO_STAR_AMOUNT_FIELD) + private Integer nanoStarAmount; +} diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/payments/transactionpartner/TransactionPartner.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/payments/transactionpartner/TransactionPartner.java index 40257b727..f6023ec16 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/payments/transactionpartner/TransactionPartner.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/payments/transactionpartner/TransactionPartner.java @@ -14,6 +14,9 @@ * TransactionPartnerFragment * TransactionPartnerUser * TransactionPartnerOther + * TransactionPartnerTelegramAds + * TransactionPartnerTelegramApi + * TransactionPartnerAffiliateProgram */ @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, @@ -26,7 +29,8 @@ @JsonSubTypes.Type(value = TransactionPartnerUser.class, name = "user"), @JsonSubTypes.Type(value = TransactionPartnerOther.class, name = "other"), @JsonSubTypes.Type(value = TransactionPartnerTelegramAds.class, name = "telegram_ads"), - @JsonSubTypes.Type(value = TransactionPartnerTelegramApi.class, name = "telegram_api") + @JsonSubTypes.Type(value = TransactionPartnerTelegramApi.class, name = "telegram_api"), + @JsonSubTypes.Type(value = TransactionPartnerAffiliateProgram.class, name = "affiliate_program") }) public interface TransactionPartner extends Validable, BotApiObject { } diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/payments/transactionpartner/TransactionPartnerAffiliateProgram.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/payments/transactionpartner/TransactionPartnerAffiliateProgram.java new file mode 100644 index 000000000..6f1359c2e --- /dev/null +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/payments/transactionpartner/TransactionPartnerAffiliateProgram.java @@ -0,0 +1,50 @@ +package org.telegram.telegrambots.meta.api.objects.payments.transactionpartner; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lombok.Setter; +import lombok.ToString; +import lombok.experimental.SuperBuilder; +import lombok.extern.jackson.Jacksonized; +import org.telegram.telegrambots.meta.api.objects.User; + +/** + * @author Ruben Bermudez + * @version 8.1 + * + * Describes the affiliate program that issued the affiliate commission received via this transaction. + */ + +@EqualsAndHashCode(callSuper = false) +@Getter +@Setter +@ToString +@RequiredArgsConstructor +@Jacksonized +@JsonIgnoreProperties(ignoreUnknown = true) +@SuperBuilder +public class TransactionPartnerAffiliateProgram implements TransactionPartner { + private static final String TYPE_FIELD = "type"; + private static final String SPONSOR_USER_FIELD = "sponsor_user"; + private static final String COMMISSION_PER_MILLE_FIELD = "commission_per_mille"; + + /** + * Type of the transaction partner, always “affiliate_program” + */ + @JsonProperty(TYPE_FIELD) + private final String type = "affiliate_program"; + /** + * Optional. + * Information about the bot that sponsored the affiliate program + */ + @JsonProperty(SPONSOR_USER_FIELD) + private User sponsorUser; + /** + * The number of Telegram Stars received by the bot for each 1000 Telegram Stars received by the affiliate program sponsor from referred users + */ + @JsonProperty(COMMISSION_PER_MILLE_FIELD) + private Integer commissionPerMille; +} diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/payments/transactionpartner/TransactionPartnerUser.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/payments/transactionpartner/TransactionPartnerUser.java index 3ba87661e..420ac2e48 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/payments/transactionpartner/TransactionPartnerUser.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/payments/transactionpartner/TransactionPartnerUser.java @@ -40,6 +40,7 @@ public class TransactionPartnerUser implements TransactionPartner { private static final String PAID_MEDIA_PAYLOAD_FIELD = "paid_media_payload"; private static final String GIFT_FIELD = "gift"; private static final String SUBSCRIPTION_PERIOD_FIELD = "subscription_period"; + private static final String AFFILIATE_FIELD = "affiliate"; /** * Type of the transaction partner, always “user” @@ -85,4 +86,10 @@ public class TransactionPartnerUser implements TransactionPartner { */ @JsonProperty(SUBSCRIPTION_PERIOD_FIELD) private Integer subscriptionPeriod; + /** + * Optional. + * Information about the affiliate that received a commission via this transaction + */ + @JsonProperty(AFFILIATE_FIELD) + private AffiliateInfo affiliate; } diff --git a/telegrambots-springboot-longpolling-starter/pom.xml b/telegrambots-springboot-longpolling-starter/pom.xml index 3f3ca294c..fe4a8ef79 100644 --- a/telegrambots-springboot-longpolling-starter/pom.xml +++ b/telegrambots-springboot-longpolling-starter/pom.xml @@ -7,7 +7,7 @@ org.telegram Bots - 8.0.0 + 8.1.0 telegrambots-springboot-longpolling-starter @@ -71,7 +71,7 @@ UTF-8 UTF-8 - 8.0.0 + 8.1.0 3.2.3 diff --git a/telegrambots-springboot-webhook-starter/pom.xml b/telegrambots-springboot-webhook-starter/pom.xml index 609f9c43e..4aa40415e 100644 --- a/telegrambots-springboot-webhook-starter/pom.xml +++ b/telegrambots-springboot-webhook-starter/pom.xml @@ -6,7 +6,7 @@ org.telegram Bots - 8.0.0 + 8.1.0 telegrambots-springboot-webhook-starter @@ -71,7 +71,7 @@ UTF-8 UTF-8 - 8.0.0 + 8.1.0 3.2.3 2.17.2 diff --git a/telegrambots-test-reports/pom.xml b/telegrambots-test-reports/pom.xml index aa9161384..103110736 100644 --- a/telegrambots-test-reports/pom.xml +++ b/telegrambots-test-reports/pom.xml @@ -6,7 +6,7 @@ org.telegram Bots - 8.0.0 + 8.1.0 telegrambots-test-reports diff --git a/telegrambots-webhook/pom.xml b/telegrambots-webhook/pom.xml index 475145c52..2a9ebc43d 100644 --- a/telegrambots-webhook/pom.xml +++ b/telegrambots-webhook/pom.xml @@ -6,7 +6,7 @@ org.telegram Bots - 8.0.0 + 8.1.0 telegrambots-webhook