Add paymentForm.id.

This commit is contained in:
levlam 2021-03-30 17:18:08 +03:00
parent 26dc0ad930
commit 17e8860855
7 changed files with 31 additions and 25 deletions

View File

@ -1341,9 +1341,9 @@ inputCredentialsGooglePay data:string = InputCredentials;
//@description Stripe payment provider @publishable_key Stripe API publishable key @need_country True, if the user country must be provided @need_postal_code True, if the user ZIP/postal code must be provided @need_cardholder_name True, if the cardholder name must be provided //@description Stripe payment provider @publishable_key Stripe API publishable key @need_country True, if the user country must be provided @need_postal_code True, if the user ZIP/postal code must be provided @need_cardholder_name True, if the cardholder name must be provided
paymentsProviderStripe publishable_key:string need_country:Bool need_postal_code:Bool need_cardholder_name:Bool = PaymentsProviderStripe; paymentsProviderStripe publishable_key:string need_country:Bool need_postal_code:Bool need_cardholder_name:Bool = PaymentsProviderStripe;
//@description Contains information about an invoice payment form @invoice Full information of the invoice @url Payment form URL @payments_provider Contains information about the payment provider, if available, to support it natively without the need for opening the URL; may be null //@description Contains information about an invoice payment form @id The payment form identifier @invoice Full information of the invoice @url Payment form URL @payments_provider Contains information about the payment provider, if available, to support it natively without the need for opening the URL; may be null
//@saved_order_info Saved server-side order information; may be null @saved_credentials Contains information about saved card credentials; may be null @can_save_credentials True, if the user can choose to save credentials @need_password True, if the user will be able to save credentials protected by a password they set up //@saved_order_info Saved server-side order information; may be null @saved_credentials Contains information about saved card credentials; may be null @can_save_credentials True, if the user can choose to save credentials @need_password True, if the user will be able to save credentials protected by a password they set up
paymentForm invoice:invoice url:string payments_provider:paymentsProviderStripe saved_order_info:orderInfo saved_credentials:savedCredentials can_save_credentials:Bool need_password:Bool = PaymentForm; paymentForm id:int64 invoice:invoice url:string payments_provider:paymentsProviderStripe saved_order_info:orderInfo saved_credentials:savedCredentials can_save_credentials:Bool need_password:Bool = PaymentForm;
//@description Contains a temporary identifier of validated order information, which is stored for one hour. Also contains the available shipping options @order_info_id Temporary identifier of the order information @shipping_options Available shipping options //@description Contains a temporary identifier of validated order information, which is stored for one hour. Also contains the available shipping options @order_info_id Temporary identifier of the order information @shipping_options Available shipping options
validatedOrderInfo order_info_id:string shipping_options:vector<shippingOption> = ValidatedOrderInfo; validatedOrderInfo order_info_id:string shipping_options:vector<shippingOption> = ValidatedOrderInfo;
@ -4888,9 +4888,10 @@ getPaymentForm chat_id:int53 message_id:int53 = PaymentForm;
//@description Validates the order information provided by a user and returns the available shipping options for a flexible invoice @chat_id Chat identifier of the Invoice message @message_id Message identifier @order_info The order information, provided by the user @allow_save True, if the order information can be saved //@description Validates the order information provided by a user and returns the available shipping options for a flexible invoice @chat_id Chat identifier of the Invoice message @message_id Message identifier @order_info The order information, provided by the user @allow_save True, if the order information can be saved
validateOrderInfo chat_id:int53 message_id:int53 order_info:orderInfo allow_save:Bool = ValidatedOrderInfo; validateOrderInfo chat_id:int53 message_id:int53 order_info:orderInfo allow_save:Bool = ValidatedOrderInfo;
//@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 @order_info_id Identifier returned by ValidateOrderInfo, or an empty string @shipping_option_id Identifier of a chosen shipping option, if applicable //@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 //@credentials The credentials chosen by user for payment
sendPaymentForm chat_id:int53 message_id:int53 order_info_id:string shipping_option_id:string credentials:InputCredentials = PaymentResult; sendPaymentForm chat_id:int53 message_id:int53 payment_form_id:int64 order_info_id:string shipping_option_id:string credentials:InputCredentials = PaymentResult;
//@description Returns information about a successful payment @chat_id Chat identifier of the PaymentSuccessful message @message_id Message identifier //@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; getPaymentReceipt chat_id:int53 message_id:int53 = PaymentReceipt;

View File

@ -37389,8 +37389,8 @@ void MessagesManager::validate_order_info(FullMessageId full_message_id, tl_obje
std::move(promise)); std::move(promise));
} }
void MessagesManager::send_payment_form(FullMessageId full_message_id, const string &order_info_id, void MessagesManager::send_payment_form(FullMessageId full_message_id, int64 payment_form_id,
const string &shipping_option_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,
Promise<tl_object_ptr<td_api::paymentResult>> &&promise) { Promise<tl_object_ptr<td_api::paymentResult>> &&promise) {
auto r_message_id = get_invoice_message_id(full_message_id); auto r_message_id = get_invoice_message_id(full_message_id);
@ -37398,8 +37398,8 @@ void MessagesManager::send_payment_form(FullMessageId full_message_id, const str
return promise.set_error(r_message_id.move_as_error()); return promise.set_error(r_message_id.move_as_error());
} }
::td::send_payment_form(full_message_id.get_dialog_id(), r_message_id.ok(), order_info_id, shipping_option_id, ::td::send_payment_form(full_message_id.get_dialog_id(), r_message_id.ok(), payment_form_id, order_info_id,
credentials, std::move(promise)); shipping_option_id, credentials, std::move(promise));
} }
void MessagesManager::get_payment_receipt(FullMessageId full_message_id, void MessagesManager::get_payment_receipt(FullMessageId full_message_id,

View File

@ -916,8 +916,8 @@ class MessagesManager : public Actor {
void validate_order_info(FullMessageId full_message_id, tl_object_ptr<td_api::orderInfo> order_info, bool allow_save, void validate_order_info(FullMessageId full_message_id, tl_object_ptr<td_api::orderInfo> order_info, bool allow_save,
Promise<tl_object_ptr<td_api::validatedOrderInfo>> &&promise); Promise<tl_object_ptr<td_api::validatedOrderInfo>> &&promise);
void send_payment_form(FullMessageId full_message_id, const string &order_info_id, const string &shipping_option_id, void send_payment_form(FullMessageId full_message_id, int64 payment_form_id, const string &order_info_id,
const tl_object_ptr<td_api::InputCredentials> &credentials, const string &shipping_option_id, const tl_object_ptr<td_api::InputCredentials> &credentials,
Promise<tl_object_ptr<td_api::paymentResult>> &&promise); Promise<tl_object_ptr<td_api::paymentResult>> &&promise);
void get_payment_receipt(FullMessageId full_message_id, Promise<tl_object_ptr<td_api::paymentReceipt>> &&promise); void get_payment_receipt(FullMessageId full_message_id, Promise<tl_object_ptr<td_api::paymentReceipt>> &&promise);

View File

@ -288,7 +288,7 @@ class GetPaymentFormQuery : public Td::ResultHandler {
(payment_form->flags_ & telegram_api::payments_paymentForm::CAN_SAVE_CREDENTIALS_MASK) != 0; (payment_form->flags_ & telegram_api::payments_paymentForm::CAN_SAVE_CREDENTIALS_MASK) != 0;
bool need_password = (payment_form->flags_ & telegram_api::payments_paymentForm::PASSWORD_MISSING_MASK) != 0; bool need_password = (payment_form->flags_ & telegram_api::payments_paymentForm::PASSWORD_MISSING_MASK) != 0;
promise_.set_value(make_tl_object<td_api::paymentForm>( promise_.set_value(make_tl_object<td_api::paymentForm>(
convert_invoice(std::move(payment_form->invoice_)), std::move(payment_form->url_), payment_form->form_id_, convert_invoice(std::move(payment_form->invoice_)), std::move(payment_form->url_),
convert_payment_provider(payment_form->native_provider_, std::move(payment_form->native_params_)), convert_payment_provider(payment_form->native_provider_, std::move(payment_form->native_params_)),
convert_order_info(std::move(payment_form->saved_info_)), convert_order_info(std::move(payment_form->saved_info_)),
convert_saved_credentials(std::move(payment_form->saved_credentials_)), can_save_credentials, need_password)); convert_saved_credentials(std::move(payment_form->saved_credentials_)), can_save_credentials, need_password));
@ -358,7 +358,7 @@ class SendPaymentFormQuery : public Td::ResultHandler {
: promise_(std::move(promise)) { : promise_(std::move(promise)) {
} }
void send(DialogId dialog_id, ServerMessageId server_message_id, const string &order_info_id, 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) {
CHECK(input_credentials != nullptr); CHECK(input_credentials != nullptr);
@ -376,8 +376,8 @@ class SendPaymentFormQuery : public Td::ResultHandler {
flags |= telegram_api::payments_sendPaymentForm::SHIPPING_OPTION_ID_MASK; flags |= telegram_api::payments_sendPaymentForm::SHIPPING_OPTION_ID_MASK;
} }
send_query(G()->net_query_creator().create( send_query(G()->net_query_creator().create(
telegram_api::payments_sendPaymentForm(flags, 0, std::move(input_peer), server_message_id.get(), order_info_id, telegram_api::payments_sendPaymentForm(flags, payment_form_id, std::move(input_peer), server_message_id.get(),
shipping_option_id, std::move(input_credentials), 0))); order_info_id, shipping_option_id, std::move(input_credentials), 0)));
} }
void on_result(uint64 id, BufferSlice packet) override { void on_result(uint64 id, BufferSlice packet) override {
@ -871,8 +871,9 @@ void validate_order_info(DialogId dialog_id, ServerMessageId server_message_id,
->send(dialog_id, server_message_id, convert_order_info(std::move(order_info)), allow_save); ->send(dialog_id, server_message_id, convert_order_info(std::move(order_info)), allow_save);
} }
void send_payment_form(DialogId dialog_id, ServerMessageId server_message_id, const string &order_info_id, void send_payment_form(DialogId dialog_id, ServerMessageId server_message_id, int64 payment_form_id,
const string &shipping_option_id, const tl_object_ptr<td_api::InputCredentials> &credentials, 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) { Promise<tl_object_ptr<td_api::paymentResult>> &&promise) {
CHECK(credentials != nullptr); CHECK(credentials != nullptr);
@ -924,7 +925,8 @@ void send_payment_form(DialogId dialog_id, ServerMessageId server_message_id, co
G()->td() G()->td()
.get_actor_unsafe() .get_actor_unsafe()
->create_handler<SendPaymentFormQuery>(std::move(promise)) ->create_handler<SendPaymentFormQuery>(std::move(promise))
->send(dialog_id, server_message_id, order_info_id, shipping_option_id, std::move(input_credentials)); ->send(dialog_id, server_message_id, payment_form_id, order_info_id, shipping_option_id,
std::move(input_credentials));
} }
void get_payment_receipt(DialogId dialog_id, ServerMessageId server_message_id, void get_payment_receipt(DialogId dialog_id, ServerMessageId server_message_id,

View File

@ -145,8 +145,9 @@ void validate_order_info(DialogId dialog_id, ServerMessageId server_message_id,
tl_object_ptr<td_api::orderInfo> order_info, bool allow_save, tl_object_ptr<td_api::orderInfo> order_info, bool allow_save,
Promise<tl_object_ptr<td_api::validatedOrderInfo>> &&promise); Promise<tl_object_ptr<td_api::validatedOrderInfo>> &&promise);
void send_payment_form(DialogId dialog_id, ServerMessageId server_message_id, const string &order_info_id, void send_payment_form(DialogId dialog_id, ServerMessageId server_message_id, int64 payment_form_id,
const string &shipping_option_id, const tl_object_ptr<td_api::InputCredentials> &credentials, 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); Promise<tl_object_ptr<td_api::paymentResult>> &&promise);
void get_payment_receipt(DialogId dialog_id, ServerMessageId server_message_id, void get_payment_receipt(DialogId dialog_id, ServerMessageId server_message_id,

View File

@ -7733,8 +7733,8 @@ void Td::on_request(uint64 id, td_api::sendPaymentForm &request) {
} }
CREATE_REQUEST_PROMISE(); CREATE_REQUEST_PROMISE();
messages_manager_->send_payment_form({DialogId(request.chat_id_), MessageId(request.message_id_)}, messages_manager_->send_payment_form({DialogId(request.chat_id_), MessageId(request.message_id_)},
request.order_info_id_, request.shipping_option_id_, request.credentials_, request.payment_form_id_, request.order_info_id_, request.shipping_option_id_,
std::move(promise)); request.credentials_, std::move(promise));
} }
void Td::on_request(uint64 id, const td_api::getPaymentReceipt &request) { void Td::on_request(uint64 id, const td_api::getPaymentReceipt &request) {

View File

@ -1839,22 +1839,24 @@ class CliClient final : public Actor {
} else if (op == "spfs") { } else if (op == "spfs") {
string chat_id; string chat_id;
string message_id; string message_id;
int64 payment_form_id;
string order_info_id; string order_info_id;
string shipping_option_id; string shipping_option_id;
string saved_credentials_id; string saved_credentials_id;
get_args(args, chat_id, message_id, order_info_id, shipping_option_id, saved_credentials_id); get_args(args, chat_id, message_id, payment_form_id, order_info_id, shipping_option_id, saved_credentials_id);
send_request(td_api::make_object<td_api::sendPaymentForm>( send_request(td_api::make_object<td_api::sendPaymentForm>(
as_chat_id(chat_id), as_message_id(message_id), order_info_id, shipping_option_id, 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)));
} else if (op == "spfn") { } else if (op == "spfn") {
string chat_id; string chat_id;
string message_id; string message_id;
int64 payment_form_id;
string order_info_id; string order_info_id;
string shipping_option_id; string shipping_option_id;
string data; string data;
get_args(args, chat_id, message_id, order_info_id, shipping_option_id, data); get_args(args, chat_id, message_id, payment_form_id, order_info_id, shipping_option_id, data);
send_request(td_api::make_object<td_api::sendPaymentForm>( send_request(td_api::make_object<td_api::sendPaymentForm>(
as_chat_id(chat_id), as_message_id(message_id), order_info_id, shipping_option_id, 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)));
} else if (op == "gpre") { } else if (op == "gpre") {
string chat_id; string chat_id;