add payment struct

This commit is contained in:
fedechkin_alexey 2019-09-02 13:02:19 +07:00
parent c6ad316d4d
commit 3c97b34fef

View file

@ -1,4 +1,5 @@
use serde::Deserialize;
use crate::core::other::User;
#[derive(Debug, Deserialize)]
pub struct SendInvoice {
@ -25,4 +26,89 @@ pub struct SendInvoice {
disable_notification: Option<Bool>,
reply_to_message_id: Option<i64>,
reply_markup: Option<InlineKeyboardMarkup>,
}
#[derive(Debug, Deserialize)]
pub struct AnswerShippingQuery {
shipping_query_id: String,
ok: Bool,
shipping_options: Option<Vec<ShippingOption>>,
error_message: Option<String>,
}
#[derive(Debug, Deserialize)]
pub struct AnswerPreCheckoutQuery {
pre_checkout_query_id: String,
ok: Bool,
error_message: Option<String>,
}
#[derive(Debug, Deserialize)]
pub struct LabeledPrice {
label: String,
amount: i64,
}
#[derive(Debug, Deserialize)]
pub struct Invoice {
title: String,
description: String,
start_parameter: String,
currency: String,
total_amount: i64,
}
#[derive(Debug, Deserialize)]
pub struct ShippingAddress {
country_code: String,
state: String,
city: String,
street_line1: String,
street_line2: String,
post_code: String,
}
#[derive(Debug, Deserialize)]
pub struct OrderInfo {
name: String,
phone_number: String,
email: String,
shipping_address: ShippingAddress
}
#[derive(Debug, Deserialize)]
pub struct ShippingOption {
id: i64,
title: String,
prices: Vec<LabeledPrice>,
}
#[derive(Debug, Deserialize)]
pub struct SuccessfulPayment {
currency: String,
total_amount: i64,
invoice_payload: String,
shipping_option_id: Option<String>,
order_info: Option<OrderInfo>,
telegram_payment_charge_id: String,
provider_payment_charge_id: String,
}
#[derive(Debug, Deserialize)]
pub struct ShippingQuery {
id: String,
from: User,
invoice_payload: String,
shipping_address: ShippingAddress,
}
#[derive(Debug, Deserialize)]
pub struct PreCheckoutQuery {
id: String,
from: User,
currency: String,
total_amount: i64,
invoice_payload: String,
shipping_option_id: Option<String>,
order_info: Option<OrderInfo>
}