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:
@@ -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,
|
||||
|
Reference in New Issue
Block a user