Skip to content

Commit

Permalink
Api Version 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenlagus committed Jan 2, 2025
1 parent 9a67e3b commit 122a54c
Show file tree
Hide file tree
Showing 17 changed files with 158 additions and 21 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<packaging>pom</packaging>
<version>8.0.0</version>
<version>8.1.0</version>

<modules>
<module>telegrambots-meta</module>
Expand Down
6 changes: 3 additions & 3 deletions telegrambots-abilities/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>8.0.0</version>
<version>8.1.0</version>
</parent>

<artifactId>telegrambots-abilities</artifactId>
Expand Down Expand Up @@ -104,12 +104,12 @@
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-webhook</artifactId>
<version>8.0.0</version>
<version>8.1.0</version>
</dependency>
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-longpolling</artifactId>
<version>8.0.0</version>
<version>8.1.0</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion telegrambots-client-jetty-adapter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>8.0.0</version>
<version>8.1.0</version>
</parent>

<name>Telegram Bots Client Jetty HttpClient adapter</name>
Expand Down
2 changes: 1 addition & 1 deletion telegrambots-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>8.0.0</version>
<version>8.1.0</version>
</parent>

<name>Telegram Bots Client</name>
Expand Down
4 changes: 2 additions & 2 deletions telegrambots-extensions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ Just import add the library to your project with one of these options:
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-extensions</artifactId>
<version>8.0.0</version>
<version>8.1.0</version>
</dependency>
```

2. Using Gradle:

```gradle
implementation 'org.telegram:telegrambots-extensions:8.0.0'
implementation 'org.telegram:telegrambots-extensions:8.1.0'
```
6 changes: 3 additions & 3 deletions telegrambots-extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>8.0.0</version>
<version>8.1.0</version>
</parent>

<artifactId>telegrambots-extensions</artifactId>
Expand Down Expand Up @@ -89,12 +89,12 @@
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-webhook</artifactId>
<version>8.0.0</version>
<version>8.1.0</version>
</dependency>
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-longpolling</artifactId>
<version>8.0.0</version>
<version>8.1.0</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion telegrambots-longpolling/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>8.0.0</version>
<version>8.1.0</version>
</parent>

<artifactId>telegrambots-longpolling</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion telegrambots-meta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>8.0.0</version>
<version>8.1.0</version>
</parent>

<artifactId>telegrambots-meta</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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
Expand All @@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
* TransactionPartnerFragment
* TransactionPartnerUser
* TransactionPartnerOther
* TransactionPartnerTelegramAds
* TransactionPartnerTelegramApi
* TransactionPartnerAffiliateProgram
*/
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
Expand All @@ -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 {
}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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”
Expand Down Expand Up @@ -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;
}
4 changes: 2 additions & 2 deletions telegrambots-springboot-longpolling-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>8.0.0</version>
<version>8.1.0</version>
</parent>

<artifactId>telegrambots-springboot-longpolling-starter</artifactId>
Expand Down Expand Up @@ -71,7 +71,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<telegrambots.version>8.0.0</telegrambots.version>
<telegrambots.version>8.1.0</telegrambots.version>
<spring.version>3.2.3</spring.version>
</properties>

Expand Down
4 changes: 2 additions & 2 deletions telegrambots-springboot-webhook-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>8.0.0</version>
<version>8.1.0</version>
</parent>

<artifactId>telegrambots-springboot-webhook-starter</artifactId>
Expand Down Expand Up @@ -71,7 +71,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<telegrambots.version>8.0.0</telegrambots.version>
<telegrambots.version>8.1.0</telegrambots.version>
<spring.version>3.2.3</spring.version>
<jackson.version>2.17.2</jackson.version>
</properties>
Expand Down
2 changes: 1 addition & 1 deletion telegrambots-test-reports/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>8.0.0</version>
<version>8.1.0</version>
</parent>

<artifactId>telegrambots-test-reports</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion telegrambots-webhook/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>8.0.0</version>
<version>8.1.0</version>
</parent>

<artifactId>telegrambots-webhook</artifactId>
Expand Down

0 comments on commit 122a54c

Please sign in to comment.