diff --git a/CHANGELOG.md b/CHANGELOG.md index 78447cf777..9aa353a4eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # TelegramBotAPI changelog +## 14.0.1 + +* In `core` and `api` modules related to invoices changed their APIs to suite current API + ## 14.0.0 **Add support of [Telegram Bots API 7.4](https://core.telegram.org/bots/api-changelog#may-28-2024)** diff --git a/gradle.properties b/gradle.properties index 3b7d215268..bf9769c9e5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,4 +6,4 @@ kotlin.incremental=true kotlin.incremental.js=true library_group=dev.inmo -library_version=14.0.0 +library_version=14.0.1 diff --git a/tgbotapi.api/api/tgbotapi.api.api b/tgbotapi.api/api/tgbotapi.api.api index b55d26fdbb..0e1d372e14 100644 --- a/tgbotapi.api/api/tgbotapi.api.api +++ b/tgbotapi.api/api/tgbotapi.api.api @@ -2089,12 +2089,12 @@ public final class dev/inmo/tgbotapi/extensions/api/send/payments/RefundStarPaym } public final class dev/inmo/tgbotapi/extensions/api/send/payments/SendInvoiceKt { - public static final fun sendInvoice-8--Wda8 (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/lang/Integer;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;ZZZZZZZLdev/inmo/tgbotapi/types/MessageThreadId;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun sendInvoice-8--Wda8$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/lang/Integer;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;ZZZZZZZLdev/inmo/tgbotapi/types/MessageThreadId;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun sendInvoice-JwfE-H4 (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/payments/LabeledPrice;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/MessageThreadId;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun sendInvoice-JwfE-H4$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/payments/LabeledPrice;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/MessageThreadId;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public static final fun sendInvoice-NCwJssg (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/lang/Integer;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;ZZZZZZZLdev/inmo/tgbotapi/types/MessageThreadId;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun sendInvoice-NCwJssg$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/lang/Integer;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;ZZZZZZZLdev/inmo/tgbotapi/types/MessageThreadId;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; - public static final fun sendInvoice-saz62xw (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/lang/Integer;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;ZZZZZZZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static synthetic fun sendInvoice-saz62xw$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/lang/Integer;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;ZZZZZZZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; + public static final fun sendInvoice-a-j8NSU (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/payments/LabeledPrice;Ljava/lang/String;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun sendInvoice-a-j8NSU$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/payments/LabeledPrice;Ljava/lang/String;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; public static final fun sendInvoice-tXTtQSU (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/lang/Integer;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;ZZZZZZZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static synthetic fun sendInvoice-tXTtQSU$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/chat/CommonUser;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/lang/Integer;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;ZZZZZZZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; } diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/payments/SendInvoice.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/payments/SendInvoice.kt index a88f10c3f0..aea0885b1e 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/payments/SendInvoice.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/payments/SendInvoice.kt @@ -82,18 +82,9 @@ suspend fun TelegramBot.sendInvoice( title: String, description: String, payload: String, - prices: List, - maxTipAmount: Int? = null, - suggestedTipAmounts: List? = null, + price: LabeledPrice, startParameter: StartParameter? = null, providerData: String? = null, - requireName: Boolean = false, - requirePhoneNumber: Boolean = false, - requireEmail: Boolean = false, - requireShippingAddress: Boolean = false, - shouldSendPhoneNumberToProvider: Boolean = false, - shouldSendEmailToProvider: Boolean = false, - priceDependOnShipAddress: Boolean = false, threadId: MessageThreadId? = chatId.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, @@ -101,7 +92,7 @@ suspend fun TelegramBot.sendInvoice( replyParameters: ReplyParameters? = null, replyMarkup: InlineKeyboardMarkup? = null ) = execute( - SendInvoice(chatId, title, description, payload, null, Currency.XTR, prices, maxTipAmount, suggestedTipAmounts ?.sorted(), startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, threadId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) + SendInvoice(chatId, title, description, payload, price, startParameter, providerData, threadId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) /** @@ -113,18 +104,9 @@ suspend fun TelegramBot.sendInvoice( title: String, description: String, payload: String, - prices: List, - maxTipAmount: Int? = null, - suggestedTipAmounts: List? = null, + price: LabeledPrice, startParameter: StartParameter? = null, providerData: String? = null, - requireName: Boolean = false, - requirePhoneNumber: Boolean = false, - requireEmail: Boolean = false, - requireShippingAddress: Boolean = false, - shouldSendPhoneNumberToProvider: Boolean = false, - shouldSendEmailToProvider: Boolean = false, - priceDependOnShipAddress: Boolean = false, disableNotification: Boolean = false, protectContent: Boolean = false, effectId: EffectId? = null, @@ -135,18 +117,9 @@ suspend fun TelegramBot.sendInvoice( title = title, description = description, payload = payload, - prices = prices, - maxTipAmount = maxTipAmount, - suggestedTipAmounts = suggestedTipAmounts, + price = price, startParameter = startParameter, providerData = providerData, - requireName = requireName, - requirePhoneNumber = requirePhoneNumber, - requireEmail = requireEmail, - requireShippingAddress = requireShippingAddress, - shouldSendPhoneNumberToProvider = shouldSendPhoneNumberToProvider, - shouldSendEmailToProvider = shouldSendEmailToProvider, - priceDependOnShipAddress = priceDependOnShipAddress, threadId = null, disableNotification = disableNotification, protectContent = protectContent, diff --git a/tgbotapi.core/api/tgbotapi.core.api b/tgbotapi.core/api/tgbotapi.core.api index a96f060e06..0c0a8ff283 100644 --- a/tgbotapi.core/api/tgbotapi.core.api +++ b/tgbotapi.core/api/tgbotapi.core.api @@ -6116,10 +6116,10 @@ public final class dev/inmo/tgbotapi/requests/send/payments/RefundStarPayment$Co public final class dev/inmo/tgbotapi/requests/send/payments/SendInvoice : dev/inmo/tgbotapi/abstracts/CommonSendInvoiceData, dev/inmo/tgbotapi/abstracts/types/ChatRequest, dev/inmo/tgbotapi/abstracts/types/DisableNotification, dev/inmo/tgbotapi/abstracts/types/WithReplyMarkup, dev/inmo/tgbotapi/abstracts/types/WithReplyParameters, dev/inmo/tgbotapi/requests/send/abstracts/OptionallyWithEffectRequest, dev/inmo/tgbotapi/requests/send/abstracts/SendMessageRequest { public static final field Companion Ldev/inmo/tgbotapi/requests/send/payments/SendInvoice$Companion; + public synthetic fun (Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/payments/LabeledPrice;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/MessageThreadId;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/payments/LabeledPrice;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/MessageThreadId;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public synthetic fun (Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/lang/Integer;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;ZZZZZZZLdev/inmo/tgbotapi/types/MessageThreadId;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public synthetic fun (Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/lang/Integer;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;ZZZZZZZLdev/inmo/tgbotapi/types/MessageThreadId;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Lkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/lang/Integer;Ljava/util/List;Ljava/lang/String;ZZZZZZZLdev/inmo/tgbotapi/types/MessageThreadId;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (Ldev/inmo/tgbotapi/types/IdChatIdentifier;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/lang/Integer;Ljava/util/List;Ljava/lang/String;ZZZZZZZLdev/inmo/tgbotapi/types/MessageThreadId;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ldev/inmo/tgbotapi/types/IdChatIdentifier; public final fun component10 ()Ljava/lang/String; public final fun component11 ()Ljava/lang/String; diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/payments/SendInvoice.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/payments/SendInvoice.kt index ff5eda11ed..8134b11004 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/payments/SendInvoice.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/payments/SendInvoice.kt @@ -105,17 +105,9 @@ data class SendInvoice( title: String, description: String, payload: String, - prices: List, - maxTipAmount: Int? = null, - suggestedTipAmounts: List? = null, + price: LabeledPrice, + startParameter: StartParameter? = null, providerData: String? = null, - requireName: Boolean = false, - requirePhoneNumber: Boolean = false, - requireEmail: Boolean = false, - requireShippingAddress: Boolean = false, - shouldSendPhoneNumberToProvider: Boolean = false, - shouldSendEmailToProvider: Boolean = false, - priceDependOnShipAddress: Boolean = false, threadId: MessageThreadId? = chatId.threadId, disableNotification: Boolean = false, protectContent: Boolean = false, @@ -129,17 +121,9 @@ data class SendInvoice( payload = payload, providerToken = null, currency = Currency.XTR, - prices = prices, - maxTipAmount = maxTipAmount, - suggestedTipAmounts = suggestedTipAmounts, + prices = listOf(price), + startParameter = startParameter, providerData = providerData, - requireName = requireName, - requirePhoneNumber = requirePhoneNumber, - requireEmail = requireEmail, - requireShippingAddress = requireShippingAddress, - shouldSendPhoneNumberToProvider = shouldSendPhoneNumberToProvider, - shouldSendEmailToProvider = shouldSendEmailToProvider, - priceDependOnShipAddress = priceDependOnShipAddress, threadId = threadId, disableNotification = disableNotification, protectContent = protectContent,