1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 16:23:48 +00:00

add send invoice extensions

This commit is contained in:
InsanusMokrassar 2020-02-07 00:01:21 +06:00
parent dfe5595fd3
commit 0dd632eb46

View File

@ -1,6 +1,7 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.payments
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.*
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
@ -101,3 +102,49 @@ data class SendInvoice(
photoHeight = null
}
}
suspend fun RequestsExecutor.sendInvoice(
chatId: ChatId,
title: String,
description: String,
payload: String,
providerToken: String,
startParameter: StartParameter,
currency: Currency,
prices: List<LabeledPrice>,
providerData: String? = null,
requireName: Boolean = false,
requirePhoneNumber: Boolean = false,
requireEmail: Boolean = false,
requireShippingAddress: Boolean = false,
shouldSendPhoneNumberToProvider: Boolean = false,
shouldSendEmailToProvider: Boolean = false,
priceDependOnShipAddress: Boolean = false,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
SendInvoice(chatId, title, description, payload, providerToken, startParameter, currency, prices, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, replyToMessageId, replyMarkup)
)
suspend fun RequestsExecutor.sendInvoice(
user: CommonUser,
title: String,
description: String,
payload: String,
providerToken: String,
startParameter: StartParameter,
currency: Currency,
prices: List<LabeledPrice>,
providerData: String? = null,
requireName: Boolean = false,
requirePhoneNumber: Boolean = false,
requireEmail: Boolean = false,
requireShippingAddress: Boolean = false,
shouldSendPhoneNumberToProvider: Boolean = false,
shouldSendEmailToProvider: Boolean = false,
priceDependOnShipAddress: Boolean = false,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = sendInvoice(user.id, title, description, payload, providerToken, startParameter, currency, prices, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, replyToMessageId, replyMarkup)