Improve payment receipt.

This commit is contained in:
levlam 2021-04-06 01:00:31 +03:00
parent bb1b82731e
commit 5d0561ff7a
2 changed files with 25 additions and 7 deletions

View File

@ -1359,9 +1359,19 @@ validatedOrderInfo order_info_id:string shipping_options:vector<shippingOption>
//@description Contains the result of a payment request @success True, if the payment request was successful; otherwise the verification_url will be not empty @verification_url URL for additional payment credentials verification
paymentResult success:Bool verification_url:string = PaymentResult;
//@description Contains information about a successful payment @date Point in time (Unix timestamp) when the payment was made @payments_provider_user_id User identifier of the payment provider bot @invoice Contains information about the invoice
//@order_info Contains order information; may be null @shipping_option Chosen shipping option; may be null @credentials_title Title of the saved credentials
paymentReceipt date:int32 payments_provider_user_id:int32 invoice:invoice order_info:orderInfo shipping_option:shippingOption credentials_title:string = PaymentReceipt;
//@description Contains information about a successful payment
//@title Product title
//@param_description Product description
//@photo Product photo; may be null
//@date Point in time (Unix timestamp) when the payment was made
//@seller_bot_user_id User identifier of the seller bot
//@payments_provider_user_id User identifier of the payment provider bot
//@invoice Contains information about the invoice
//@order_info Order information; may be null
//@shipping_option Chosen shipping option; may be null
//@credentials_title Title of the saved credentials chosen by the buyer
//@tip_amount The amount of tip chosen by the buyer in the smallest units of the currency
paymentReceipt title:string description:string photo:photo date:int32 seller_bot_user_id:int32 payments_provider_user_id:int32 invoice:invoice order_info:orderInfo shipping_option:shippingOption credentials_title:string tip_amount:int53 = PaymentReceipt;
//@description File with the date it was uploaded @file The file @date Point in time (Unix timestamp) when the file was uploaded

View File

@ -457,14 +457,22 @@ class GetPaymentReceiptQuery : public Td::ResultHandler {
UserId payments_provider_user_id(payment_receipt->provider_id_);
if (!payments_provider_user_id.is_valid()) {
LOG(ERROR) << "Receive invalid payments provider " << payments_provider_user_id;
payments_provider_user_id = UserId();
return on_error(id, Status::Error(500, "Receive invalid payments provider identifier"));
}
UserId seller_bot_user_id(payment_receipt->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"));
}
auto photo = get_web_document_photo(td->file_manager_.get(), std::move(payment_receipt->photo_), dialog_id_);
promise_.set_value(make_tl_object<td_api::paymentReceipt>(
payment_receipt->date_, td->contacts_manager_->get_user_id_object(payments_provider_user_id, "paymentReceipt"),
payment_receipt->title_, payment_receipt->description_, get_photo_object(td->file_manager_.get(), photo),
payment_receipt->date_, td->contacts_manager_->get_user_id_object(seller_bot_user_id, "paymentReceipt seller"),
td->contacts_manager_->get_user_id_object(payments_provider_user_id, "paymentReceipt provider"),
convert_invoice(std::move(payment_receipt->invoice_)), convert_order_info(std::move(payment_receipt->info_)),
convert_shipping_option(std::move(payment_receipt->shipping_)),
std::move(payment_receipt->credentials_title_)));
convert_shipping_option(std::move(payment_receipt->shipping_)), std::move(payment_receipt->credentials_title_),
payment_receipt->tip_amount_));
}
void on_error(uint64 id, Status status) override {