mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-23 15:01:45 +01:00
Merge pull request #163 from zggff/master
make OrderInfo use Option<String> instead of String. It allows teloxide to ask only one needed field of the shipping query.
This commit is contained in:
commit
53df041940
3 changed files with 9 additions and 7 deletions
|
@ -5,17 +5,17 @@ use crate::types::ShippingAddress;
|
|||
/// This object represents information about an order.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#orderinfo).
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, Default)]
|
||||
pub struct OrderInfo {
|
||||
/// User's name.
|
||||
pub name: String,
|
||||
pub name: Option<String>,
|
||||
|
||||
/// User's phone number.
|
||||
pub phone_number: String,
|
||||
pub phone_number: Option<String>,
|
||||
|
||||
/// User's email.
|
||||
pub email: String,
|
||||
pub email: Option<String>,
|
||||
|
||||
/// User's shipping address.
|
||||
pub shipping_address: ShippingAddress,
|
||||
pub shipping_address: Option<ShippingAddress>,
|
||||
}
|
||||
|
|
|
@ -35,5 +35,6 @@ pub struct PreCheckoutQuery {
|
|||
pub shipping_option_id: Option<String>,
|
||||
|
||||
/// Order info provided by the user.
|
||||
pub order_info: Option<OrderInfo>,
|
||||
#[serde(default)]
|
||||
pub order_info: OrderInfo,
|
||||
}
|
||||
|
|
|
@ -29,7 +29,8 @@ pub struct SuccessfulPayment {
|
|||
pub shipping_option_id: Option<String>,
|
||||
|
||||
/// Order info provided by the user.
|
||||
pub order_info: Option<OrderInfo>,
|
||||
#[serde(default)]
|
||||
pub order_info: OrderInfo,
|
||||
|
||||
/// Telegram payment identifier.
|
||||
pub telegram_payment_charge_id: String,
|
||||
|
|
Loading…
Reference in a new issue