Support tip sending.
This commit is contained in:
parent
c3ff8539db
commit
f1b949456b
@ -4893,8 +4893,8 @@ validateOrderInfo chat_id:int53 message_id:int53 order_info:orderInfo allow_save
|
||||
|
||||
//@description Sends a filled-out payment form to the bot for final verification @chat_id Chat identifier of the Invoice message @message_id Message identifier
|
||||
//@payment_form_id Payment form identifier returned by getPaymentForm @order_info_id Identifier returned by validateOrderInfo, or an empty string @shipping_option_id Identifier of a chosen shipping option, if applicable
|
||||
//@credentials The credentials chosen by user for payment
|
||||
sendPaymentForm chat_id:int53 message_id:int53 payment_form_id:int64 order_info_id:string shipping_option_id:string credentials:InputCredentials = PaymentResult;
|
||||
//@credentials The credentials chosen by user for payment @tip_amount Chosen by the user amount of tip in the smallest units of the currency
|
||||
sendPaymentForm chat_id:int53 message_id:int53 payment_form_id:int64 order_info_id:string shipping_option_id:string credentials:InputCredentials tip_amount:int53 = PaymentResult;
|
||||
|
||||
//@description Returns information about a successful payment @chat_id Chat identifier of the PaymentSuccessful message @message_id Message identifier
|
||||
getPaymentReceipt chat_id:int53 message_id:int53 = PaymentReceipt;
|
||||
|
@ -37391,7 +37391,7 @@ void MessagesManager::validate_order_info(FullMessageId full_message_id, tl_obje
|
||||
|
||||
void MessagesManager::send_payment_form(FullMessageId full_message_id, int64 payment_form_id,
|
||||
const string &order_info_id, const string &shipping_option_id,
|
||||
const tl_object_ptr<td_api::InputCredentials> &credentials,
|
||||
const tl_object_ptr<td_api::InputCredentials> &credentials, int64 tip_amount,
|
||||
Promise<tl_object_ptr<td_api::paymentResult>> &&promise) {
|
||||
auto r_message_id = get_invoice_message_id(full_message_id);
|
||||
if (r_message_id.is_error()) {
|
||||
@ -37399,7 +37399,7 @@ void MessagesManager::send_payment_form(FullMessageId full_message_id, int64 pay
|
||||
}
|
||||
|
||||
::td::send_payment_form(full_message_id.get_dialog_id(), r_message_id.ok(), payment_form_id, order_info_id,
|
||||
shipping_option_id, credentials, std::move(promise));
|
||||
shipping_option_id, credentials, tip_amount, std::move(promise));
|
||||
}
|
||||
|
||||
void MessagesManager::get_payment_receipt(FullMessageId full_message_id,
|
||||
|
@ -918,7 +918,7 @@ class MessagesManager : public Actor {
|
||||
|
||||
void send_payment_form(FullMessageId full_message_id, int64 payment_form_id, const string &order_info_id,
|
||||
const string &shipping_option_id, const tl_object_ptr<td_api::InputCredentials> &credentials,
|
||||
Promise<tl_object_ptr<td_api::paymentResult>> &&promise);
|
||||
int64 tip_amount, Promise<tl_object_ptr<td_api::paymentResult>> &&promise);
|
||||
|
||||
void get_payment_receipt(FullMessageId full_message_id, Promise<tl_object_ptr<td_api::paymentReceipt>> &&promise);
|
||||
|
||||
|
@ -360,7 +360,8 @@ class SendPaymentFormQuery : public Td::ResultHandler {
|
||||
}
|
||||
|
||||
void send(DialogId dialog_id, ServerMessageId server_message_id, int64 payment_form_id, const string &order_info_id,
|
||||
const string &shipping_option_id, tl_object_ptr<telegram_api::InputPaymentCredentials> input_credentials) {
|
||||
const string &shipping_option_id, tl_object_ptr<telegram_api::InputPaymentCredentials> input_credentials,
|
||||
int64 tip_amount) {
|
||||
CHECK(input_credentials != nullptr);
|
||||
|
||||
dialog_id_ = dialog_id;
|
||||
@ -376,9 +377,12 @@ class SendPaymentFormQuery : public Td::ResultHandler {
|
||||
if (!shipping_option_id.empty()) {
|
||||
flags |= telegram_api::payments_sendPaymentForm::SHIPPING_OPTION_ID_MASK;
|
||||
}
|
||||
send_query(G()->net_query_creator().create(
|
||||
telegram_api::payments_sendPaymentForm(flags, payment_form_id, std::move(input_peer), server_message_id.get(),
|
||||
order_info_id, shipping_option_id, std::move(input_credentials), 0)));
|
||||
if (tip_amount != 0) {
|
||||
flags |= telegram_api::payments_sendPaymentForm::TIP_AMOUNT_MASK;
|
||||
}
|
||||
send_query(G()->net_query_creator().create(telegram_api::payments_sendPaymentForm(
|
||||
flags, payment_form_id, std::move(input_peer), server_message_id.get(), order_info_id, shipping_option_id,
|
||||
std::move(input_credentials), tip_amount)));
|
||||
}
|
||||
|
||||
void on_result(uint64 id, BufferSlice packet) override {
|
||||
@ -877,7 +881,7 @@ void validate_order_info(DialogId dialog_id, ServerMessageId server_message_id,
|
||||
|
||||
void send_payment_form(DialogId dialog_id, ServerMessageId server_message_id, int64 payment_form_id,
|
||||
const string &order_info_id, const string &shipping_option_id,
|
||||
const tl_object_ptr<td_api::InputCredentials> &credentials,
|
||||
const tl_object_ptr<td_api::InputCredentials> &credentials, int64 tip_amount,
|
||||
Promise<tl_object_ptr<td_api::paymentResult>> &&promise) {
|
||||
CHECK(credentials != nullptr);
|
||||
|
||||
@ -930,7 +934,7 @@ void send_payment_form(DialogId dialog_id, ServerMessageId server_message_id, in
|
||||
.get_actor_unsafe()
|
||||
->create_handler<SendPaymentFormQuery>(std::move(promise))
|
||||
->send(dialog_id, server_message_id, payment_form_id, order_info_id, shipping_option_id,
|
||||
std::move(input_credentials));
|
||||
std::move(input_credentials), tip_amount);
|
||||
}
|
||||
|
||||
void get_payment_receipt(DialogId dialog_id, ServerMessageId server_message_id,
|
||||
|
@ -149,7 +149,7 @@ void validate_order_info(DialogId dialog_id, ServerMessageId server_message_id,
|
||||
|
||||
void send_payment_form(DialogId dialog_id, ServerMessageId server_message_id, int64 payment_form_id,
|
||||
const string &order_info_id, const string &shipping_option_id,
|
||||
const tl_object_ptr<td_api::InputCredentials> &credentials,
|
||||
const tl_object_ptr<td_api::InputCredentials> &credentials, int64 tip_amount,
|
||||
Promise<tl_object_ptr<td_api::paymentResult>> &&promise);
|
||||
|
||||
void get_payment_receipt(DialogId dialog_id, ServerMessageId server_message_id,
|
||||
|
@ -7734,7 +7734,7 @@ void Td::on_request(uint64 id, td_api::sendPaymentForm &request) {
|
||||
CREATE_REQUEST_PROMISE();
|
||||
messages_manager_->send_payment_form({DialogId(request.chat_id_), MessageId(request.message_id_)},
|
||||
request.payment_form_id_, request.order_info_id_, request.shipping_option_id_,
|
||||
request.credentials_, std::move(promise));
|
||||
request.credentials_, request.tip_amount_, std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::getPaymentReceipt &request) {
|
||||
|
@ -1839,25 +1839,28 @@ class CliClient final : public Actor {
|
||||
} else if (op == "spfs") {
|
||||
string chat_id;
|
||||
string message_id;
|
||||
int64 tip_amount;
|
||||
int64 payment_form_id;
|
||||
string order_info_id;
|
||||
string shipping_option_id;
|
||||
string saved_credentials_id;
|
||||
get_args(args, chat_id, message_id, payment_form_id, order_info_id, shipping_option_id, saved_credentials_id);
|
||||
get_args(args, chat_id, message_id, tip_amount, payment_form_id, order_info_id, shipping_option_id,
|
||||
saved_credentials_id);
|
||||
send_request(td_api::make_object<td_api::sendPaymentForm>(
|
||||
as_chat_id(chat_id), as_message_id(message_id), payment_form_id, order_info_id, shipping_option_id,
|
||||
td_api::make_object<td_api::inputCredentialsSaved>(saved_credentials_id)));
|
||||
td_api::make_object<td_api::inputCredentialsSaved>(saved_credentials_id), tip_amount));
|
||||
} else if (op == "spfn") {
|
||||
string chat_id;
|
||||
string message_id;
|
||||
int64 tip_amount;
|
||||
int64 payment_form_id;
|
||||
string order_info_id;
|
||||
string shipping_option_id;
|
||||
string data;
|
||||
get_args(args, chat_id, message_id, payment_form_id, order_info_id, shipping_option_id, data);
|
||||
get_args(args, chat_id, message_id, tip_amount, payment_form_id, order_info_id, shipping_option_id, data);
|
||||
send_request(td_api::make_object<td_api::sendPaymentForm>(
|
||||
as_chat_id(chat_id), as_message_id(message_id), payment_form_id, order_info_id, shipping_option_id,
|
||||
td_api::make_object<td_api::inputCredentialsNew>(data, true)));
|
||||
td_api::make_object<td_api::inputCredentialsNew>(data, true), tip_amount));
|
||||
} else if (op == "gpre") {
|
||||
string chat_id;
|
||||
string message_id;
|
||||
|
Loading…
Reference in New Issue
Block a user