diff --git a/CHANGELOG.md b/CHANGELOG.md index 6705148e18..7fb182eb04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,8 +43,8 @@ * Now it is possible to get updates by polling with custom executor engine * `CommonMultipartFileRequest` now is internal * Added `LiveLocation` class for more useful tracking live locations -* `InvoiceOfPayment` now is `MessageContent` instead of `PaymentInfo` -* `SendInvoice` now return `ContentMessage` +* `InvoiceOfPayment` is renamed to `InvoiceContent` and now is `MessageContent` instead of `PaymentInfo` +* `SendInvoice` now return `ContentMessage` * `paymentInfo` inside of `CommonMessageImpl` now can be set only to `SuccessfulPaymentInfo` * Added `RecordVideoNoteAction` and `UploadVideoNoteAction` for `record_video_note` and `upload_video_note` actions diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/payments/SendInvoice.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/payments/SendInvoice.kt index 8a54257331..40d17c9c43 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/payments/SendInvoice.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/payments/SendInvoice.kt @@ -6,15 +6,13 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMe import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.* -import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategy -import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.PhotoContent -import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.InvoiceOfPayment +import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.InvoiceContent import com.github.insanusmokrassar.TelegramBotAPI.types.payments.LabeledPrice import com.github.insanusmokrassar.TelegramBotAPI.types.payments.LabeledPricesSerializer import com.github.insanusmokrassar.TelegramBotAPI.types.payments.abstracts.* import kotlinx.serialization.* -private val invoiceMessageSerializer: DeserializationStrategy> +private val invoiceMessageSerializer: DeserializationStrategy> = TelegramBotAPIMessageDeserializationStrategyClass() /** @@ -67,9 +65,9 @@ data class SendInvoice( DisableNotification, ReplyMessageId, ReplyMarkup, - SendMessageRequest> { + SendMessageRequest> { override fun method(): String = "sendInvoice" - override val resultDeserializer: DeserializationStrategy> + override val resultDeserializer: DeserializationStrategy> get() = invoiceMessageSerializer override val requestSerializer: SerializationStrategy<*> get() = serializer() diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt index 05877079c7..6b833e32c6 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt @@ -14,9 +14,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Unknow import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.* import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.* -import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.InvoiceOfPayment +import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.InvoiceContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.SuccessfulPaymentInfo -import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.abstracts.PaymentInfo import com.github.insanusmokrassar.TelegramBotAPI.types.payments.Invoice import com.github.insanusmokrassar.TelegramBotAPI.types.payments.SuccessfulPayment import com.github.insanusmokrassar.TelegramBotAPI.types.polls.Poll @@ -130,7 +129,7 @@ internal data class RawMessage( location != null -> LocationContent(location) venue != null -> VenueContent(venue) poll != null -> PollContent(poll) - invoice != null -> InvoiceOfPayment(invoice) + invoice != null -> InvoiceContent(invoice) else -> null } } diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/payments/InvoiceOfPayment.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/payments/InvoiceContent.kt similarity index 75% rename from src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/payments/InvoiceOfPayment.kt rename to src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/payments/InvoiceContent.kt index 3c177554af..f40983184a 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/payments/InvoiceOfPayment.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/payments/InvoiceContent.kt @@ -1,17 +1,14 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.message.payments import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request -import com.github.insanusmokrassar.TelegramBotAPI.requests.send.payments.SendInvoice import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage -import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent -import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.abstracts.PaymentInfo import com.github.insanusmokrassar.TelegramBotAPI.types.payments.Invoice -data class InvoiceOfPayment( +data class InvoiceContent( val invoice: Invoice ) : MessageContent { override fun createResend( @@ -19,7 +16,7 @@ data class InvoiceOfPayment( disableNotification: Boolean, replyToMessageId: MessageIdentifier?, replyMarkup: KeyboardMarkup? - ): Request> { + ): Request> { error("Unfortunately, currently InvoiceOfPayment can not be resend due to requirement of additional parameters," + " which can't be provided during the call of this method") }