mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 00:03:48 +00:00
add support of TransactionPartnerTelegramApi
This commit is contained in:
parent
dc463b5626
commit
45bbcb5ec1
@ -503,6 +503,7 @@ const val currencyField = "currency"
|
|||||||
const val startParameterField = "start_parameter"
|
const val startParameterField = "start_parameter"
|
||||||
const val totalAmountField = "total_amount"
|
const val totalAmountField = "total_amount"
|
||||||
const val invoicePayloadField = "invoice_payload"
|
const val invoicePayloadField = "invoice_payload"
|
||||||
|
const val requestCountField = "request_count"
|
||||||
const val paidMediaPayloadField = "paid_media_payload"
|
const val paidMediaPayloadField = "paid_media_payload"
|
||||||
const val shippingOptionIdField = "shipping_option_id"
|
const val shippingOptionIdField = "shipping_option_id"
|
||||||
const val shippingQueryIdField = "shipping_query_id"
|
const val shippingQueryIdField = "shipping_query_id"
|
||||||
|
@ -55,6 +55,22 @@ sealed interface TransactionPartner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents [TransactionPartnerTelegramApi](https://core.telegram.org/bots/api#transactionpartnertelegramapi)
|
||||||
|
*/
|
||||||
|
@Serializable(TransactionPartner.Companion::class)
|
||||||
|
data class TelegramAPI(
|
||||||
|
@SerialName(requestCountField)
|
||||||
|
val requestCount: Int
|
||||||
|
) : TransactionPartner {
|
||||||
|
@EncodeDefault
|
||||||
|
override val type: String = Companion.type
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val type: String = "telegram_api"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Serializable(TransactionPartner.Companion::class)
|
@Serializable(TransactionPartner.Companion::class)
|
||||||
data object Ads : TransactionPartner {
|
data object Ads : TransactionPartner {
|
||||||
@EncodeDefault
|
@EncodeDefault
|
||||||
@ -79,7 +95,8 @@ sealed interface TransactionPartner {
|
|||||||
val type: String,
|
val type: String,
|
||||||
val withdrawal_state: RevenueWithdrawalState? = null,
|
val withdrawal_state: RevenueWithdrawalState? = null,
|
||||||
val user: PreviewUser? = null,
|
val user: PreviewUser? = null,
|
||||||
val invoice_payload: InvoicePayload? = null
|
val invoice_payload: InvoicePayload? = null,
|
||||||
|
val request_count: Int? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
override val descriptor: SerialDescriptor
|
override val descriptor: SerialDescriptor
|
||||||
@ -96,6 +113,9 @@ sealed interface TransactionPartner {
|
|||||||
User.type -> User(
|
User.type -> User(
|
||||||
data.user ?: return unknown,
|
data.user ?: return unknown,
|
||||||
)
|
)
|
||||||
|
TelegramAPI.type -> TelegramAPI(
|
||||||
|
data.request_count ?: return unknown,
|
||||||
|
)
|
||||||
Ads.type -> Ads
|
Ads.type -> Ads
|
||||||
Fragment.type -> Fragment(
|
Fragment.type -> Fragment(
|
||||||
data.withdrawal_state ?: return unknown,
|
data.withdrawal_state ?: return unknown,
|
||||||
@ -109,6 +129,7 @@ sealed interface TransactionPartner {
|
|||||||
Other -> Surrogate(value.type)
|
Other -> Surrogate(value.type)
|
||||||
Ads -> Surrogate(value.type)
|
Ads -> Surrogate(value.type)
|
||||||
is User -> Surrogate(value.type, user = value.user)
|
is User -> Surrogate(value.type, user = value.user)
|
||||||
|
is TelegramAPI -> Surrogate(value.type, request_count = value.requestCount)
|
||||||
is Fragment -> Surrogate(
|
is Fragment -> Surrogate(
|
||||||
value.type,
|
value.type,
|
||||||
value.withdrawalState
|
value.withdrawalState
|
||||||
|
Loading…
Reference in New Issue
Block a user