diff --git a/src/types/order_info.rs b/src/types/order_info.rs index 72d0c10a..7f41f7a9 100644 --- a/src/types/order_info.rs +++ b/src/types/order_info.rs @@ -20,3 +20,53 @@ pub struct OrderInfo { /// User's shipping address. pub shipping_address: ShippingAddress, } + +impl OrderInfo { + pub fn new( + name: S1, + phone_number: S2, + email: S3, + shipping_address: ShippingAddress, + ) -> Self + where + S1: Into, + S2: Into, + S3: Into, + { + Self { + name: name.into(), + phone_number: phone_number.into(), + email: email.into(), + shipping_address, + } + } + + pub fn name(mut self, val: S) -> Self + where + S: Into, + { + self.name = val.into(); + self + } + + pub fn phone_number(mut self, val: S) -> Self + where + S: Into, + { + self.phone_number = val.into(); + self + } + + pub fn email(mut self, val: S) -> Self + where + S: Into, + { + self.email = val.into(); + self + } + + pub fn shipping_address(mut self, val: ShippingAddress) -> Self { + self.shipping_address = val; + self + } +}