Add seller and provider IDs to td_api::paymentForm.

This commit is contained in:
levlam 2021-04-06 01:16:57 +03:00
parent 5d0561ff7a
commit b9faeb92d0
2 changed files with 24 additions and 3 deletions

View File

@ -1349,9 +1349,18 @@ 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 @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 //@description Contains information about an invoice payment form
//@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 //@id The payment form identifier
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; //@invoice Full information of the invoice
//@url Payment form URL
//@seller_bot_user_id User identifier of the seller bot
//@payments_provider_user_id User identifier of the payment provider bot
//@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
paymentForm id:int64 invoice:invoice url:string seller_bot_user_id:int32 payments_provider_user_id:int32 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;

View File

@ -289,11 +289,23 @@ class GetPaymentFormQuery : public Td::ResultHandler {
td->contacts_manager_->on_get_users(std::move(payment_form->users_), "GetPaymentFormQuery"); td->contacts_manager_->on_get_users(std::move(payment_form->users_), "GetPaymentFormQuery");
UserId payments_provider_user_id(payment_form->provider_id_);
if (!payments_provider_user_id.is_valid()) {
LOG(ERROR) << "Receive invalid payments provider " << payments_provider_user_id;
return on_error(id, Status::Error(500, "Receive invalid payments provider identifier"));
}
UserId seller_bot_user_id(payment_form->bot_id_);
if (!seller_bot_user_id.is_valid()) {
LOG(ERROR) << "Receive invalid seller " << seller_bot_user_id;
return on_error(id, Status::Error(500, "Receive invalid seller identifier"));
}
bool can_save_credentials = bool can_save_credentials =
(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>(
payment_form->form_id_, 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_),
td->contacts_manager_->get_user_id_object(seller_bot_user_id, "paymentForm seller"),
td->contacts_manager_->get_user_id_object(payments_provider_user_id, "paymentForm provider"),
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));