1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-22 08:37:12 +00:00

add support of nanostar_amount

This commit is contained in:
InsanusMokrassar 2024-12-06 12:32:38 +06:00
parent 4cdae11adc
commit 0b6d9e47b9
2 changed files with 14 additions and 0 deletions

View File

@ -467,6 +467,7 @@ const val actionField = "action"
const val positionField = "position" const val positionField = "position"
const val labelField = "label" const val labelField = "label"
const val amountField = "amount" const val amountField = "amount"
const val nanostarAmountField = "nanostar_amount"
const val pricesField = "prices" const val pricesField = "prices"
const val payloadField = "payload" const val payloadField = "payload"
const val vcardField = "vcard" const val vcardField = "vcard"

View File

@ -19,6 +19,7 @@ import kotlinx.serialization.json.JsonElement
sealed interface StarTransaction { sealed interface StarTransaction {
val id: StarTransactionId val id: StarTransactionId
val amount: Int val amount: Int
val nanostarAmount: Int
val date: TelegramDate val date: TelegramDate
val partner: TransactionPartner val partner: TransactionPartner
val source: TransactionPartner? val source: TransactionPartner?
@ -30,6 +31,8 @@ sealed interface StarTransaction {
override val id: StarTransactionId, override val id: StarTransactionId,
@SerialName(amountField) @SerialName(amountField)
override val amount: Int, override val amount: Int,
@SerialName(nanostarAmountField)
override val nanostarAmount: Int,
@SerialName(dateField) @SerialName(dateField)
override val date: TelegramDate, override val date: TelegramDate,
@SerialName(sourceField) @SerialName(sourceField)
@ -48,6 +51,8 @@ sealed interface StarTransaction {
override val id: StarTransactionId, override val id: StarTransactionId,
@SerialName(amountField) @SerialName(amountField)
override val amount: Int, override val amount: Int,
@SerialName(nanostarAmountField)
override val nanostarAmount: Int,
@SerialName(dateField) @SerialName(dateField)
override val date: TelegramDate, override val date: TelegramDate,
@SerialName(receiverField) @SerialName(receiverField)
@ -65,6 +70,8 @@ sealed interface StarTransaction {
@SerialName(idField) @SerialName(idField)
override val id: StarTransactionId, override val id: StarTransactionId,
override val amount: Int, override val amount: Int,
@SerialName(nanostarAmountField)
override val nanostarAmount: Int,
override val date: TelegramDate, override val date: TelegramDate,
override val source: TransactionPartner?, override val source: TransactionPartner?,
override val receiver: TransactionPartner?, override val receiver: TransactionPartner?,
@ -79,6 +86,8 @@ sealed interface StarTransaction {
private data class Surrogate( private data class Surrogate(
val id: StarTransactionId, val id: StarTransactionId,
val amount: Int, val amount: Int,
@SerialName(nanostarAmountField)
val nanostarAmount: Int,
val date: TelegramDate, val date: TelegramDate,
val source: TransactionPartner? = null, val source: TransactionPartner? = null,
val receiver: TransactionPartner? = null, val receiver: TransactionPartner? = null,
@ -94,6 +103,7 @@ sealed interface StarTransaction {
Unknown( Unknown(
id = data.id, id = data.id,
amount = data.amount, amount = data.amount,
nanostarAmount = data.nanostarAmount,
date = data.date, date = data.date,
source = data.source, source = data.source,
receiver = data.receiver, receiver = data.receiver,
@ -104,12 +114,14 @@ sealed interface StarTransaction {
data.source != null -> Incoming( data.source != null -> Incoming(
id = data.id, id = data.id,
amount = data.amount, amount = data.amount,
nanostarAmount = data.nanostarAmount,
date = data.date, date = data.date,
partner = data.source partner = data.source
) )
data.receiver != null -> Outgoing( data.receiver != null -> Outgoing(
id = data.id, id = data.id,
amount = data.amount, amount = data.amount,
nanostarAmount = data.nanostarAmount,
date = data.date, date = data.date,
partner = data.receiver partner = data.receiver
) )
@ -126,6 +138,7 @@ sealed interface StarTransaction {
val surrogate = Surrogate( val surrogate = Surrogate(
id = value.id, id = value.id,
amount = value.amount, amount = value.amount,
nanostarAmount = value.nanostarAmount,
date = value.date, date = value.date,
source = value.source, source = value.source,
receiver = value.receiver, receiver = value.receiver,