Struct Coupon

Source
pub struct Coupon {
Show 27 fields pub id: i32, pub code: String, pub amount: String, pub date_created: NaiveDateTime, pub date_created_gmt: NaiveDateTime, pub date_modified: NaiveDateTime, pub date_modified_gmt: NaiveDateTime, pub discount_type: DiscountType, pub description: String, pub date_expires: Option<String>, pub date_expires_gmt: Option<String>, pub usage_count: i32, pub individual_use: bool, pub product_ids: Vec<i32>, pub excluded_product_ids: Vec<i32>, pub usage_limit: Option<i32>, pub usage_limit_per_user: Option<i32>, pub limit_usage_to_x_items: Option<i32>, pub free_shipping: bool, pub product_categories: Vec<i32>, pub excluded_product_categories: Vec<i32>, pub exclude_sale_items: bool, pub minimum_amount: String, pub maximum_amount: String, pub email_restrictions: Vec<String>, pub used_by: Vec<String>, pub meta_data: Vec<MetaData>,
}

Fields§

§id: i32

Unique identifier for the object.

§code: String

Coupon code.

§amount: String

The amount of discount. Should always be numeric, even if setting a percentage.

§date_created: NaiveDateTime

The date the coupon was created, in the site’s timezone.

§date_created_gmt: NaiveDateTime

The date the coupon was created, as GMT.

§date_modified: NaiveDateTime

The date the coupon was last modified, in the site’s timezone.

§date_modified_gmt: NaiveDateTime

The date the coupon was last modified, as GMT.

§discount_type: DiscountType

Determines the type of discount that will be applied. Options: percent, fixed_cart and fixed_product. Default is fixed_cart.

§description: String

Coupon description.

§date_expires: Option<String>

The date the coupon expires, in the site’s timezone.

§date_expires_gmt: Option<String>

The date the coupon expires, as GMT.

§usage_count: i32

Number of times the coupon has been used already.

§individual_use: bool

If true, the coupon can only be used individually. Other applied coupons will be removed from the cart. Default is false.

§product_ids: Vec<i32>

List of product IDs the coupon can be used on.

§excluded_product_ids: Vec<i32>

List of product IDs the coupon cannot be used on.

§usage_limit: Option<i32>

How many times the coupon can be used in total.

§usage_limit_per_user: Option<i32>

How many times the coupon can be used per customer.

§limit_usage_to_x_items: Option<i32>

Max number of items in the cart the coupon can be applied to.

§free_shipping: bool

If true and if the free shipping method requires a coupon, this coupon will enable free shipping. Default is false.

§product_categories: Vec<i32>

List of category IDs the coupon applies to.

§excluded_product_categories: Vec<i32>

List of category IDs the coupon does not apply to.

§exclude_sale_items: bool

If true, this coupon will not be applied to items that have sale prices. Default is false.

§minimum_amount: String

Minimum order amount that needs to be in the cart before coupon applies.

§maximum_amount: String

Maximum order amount allowed when using the coupon.

§email_restrictions: Vec<String>

List of email addresses that can use this coupon.

§used_by: Vec<String>

List of user IDs (or guest email addresses) that have used the coupon.

§meta_data: Vec<MetaData>

Meta data.

Implementations§

Source§

impl Coupon

Source

pub fn create() -> CreateCouponBuilder<NoCode, NoDiscountType, NoAmount>

Source

pub fn update() -> UpdateCouponBuilder

Trait Implementations§

Source§

impl Clone for Coupon

Source§

fn clone(&self) -> Coupon

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Coupon

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Coupon

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Coupon

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Coupon

§

impl RefUnwindSafe for Coupon

§

impl Send for Coupon

§

impl Sync for Coupon

§

impl Unpin for Coupon

§

impl UnwindSafe for Coupon

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,