1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-09-15 05:09:30 +00:00

maxTipAmounts and suggestedTipAmounts support in SendInvoice

This commit is contained in:
2021-04-26 20:01:14 +06:00
parent cd30660256
commit a26568aa29
3 changed files with 25 additions and 3 deletions

View File

@@ -35,6 +35,10 @@ data class SendInvoice(
@Serializable(LabeledPricesSerializer::class)
@SerialName(pricesField)
override val prices: List<LabeledPrice>,
@SerialName(maxTipAmountField)
val maxTipAmount: Int? = null,
@SerialName(suggestedTipAmountsField)
val suggestedTipAmounts: List<Int>? = null,
@SerialName(startParameterField)
val startParameter: StartParameter? = null,
@SerialName(providerDataField)
@@ -88,6 +92,17 @@ data class SendInvoice(
var photoHeight: Int? = null
private set
init {
suggestedTipAmounts ?.let { _ ->
require(suggestedTipAmounts.size in suggestedTipAmountsLimit)
maxTipAmount ?.let { _ ->
require(
suggestedTipAmounts.none { it > maxTipAmount }
)
}
}
}
fun setPhoto(
photoUrl: String,
photoSize: Long? = null,