Skip to main content

Carts

Struct Carts 

Source
pub struct Carts { /* private fields */ }

Implementations§

Source§

impl Carts

Source

pub fn instance_of<V: NapiRaw>(env: Env, value: V) -> Result<bool>

Source§

impl Carts

Source§

impl Carts

Source

pub async fn create(&self, input: CreateCartInput) -> Result<CartOutput>

Create a new cart

Source

pub async fn get(&self, id: String) -> Result<Option<CartOutput>>

Get a cart by ID

Source

pub async fn get_by_number( &self, cart_number: String, ) -> Result<Option<CartOutput>>

Get a cart by cart number

Source

pub async fn update( &self, id: String, input: UpdateCartInput, ) -> Result<CartOutput>

Update a cart

Source

pub async fn list(&self) -> Result<Vec<CartOutput>>

List all carts

Source

pub async fn for_customer(&self, customer_id: String) -> Result<Vec<CartOutput>>

List carts for a customer

Source

pub async fn delete(&self, id: String) -> Result<()>

Delete a cart

Source

pub async fn add_item( &self, cart_id: String, item: AddCartItemInput, ) -> Result<CartItemOutput>

Add an item to the cart

Source

pub async fn update_item( &self, item_id: String, input: UpdateCartItemInput, ) -> Result<CartItemOutput>

Update a cart item

Source

pub async fn remove_item(&self, item_id: String) -> Result<()>

Remove an item from the cart

Source

pub async fn get_items(&self, cart_id: String) -> Result<Vec<CartItemOutput>>

Get items in a cart

Source

pub async fn clear_items(&self, cart_id: String) -> Result<()>

Clear all items from the cart

Source

pub async fn set_shipping_address( &self, id: String, address: CartAddressInput, ) -> Result<CartOutput>

Set the shipping address

Source

pub async fn set_shipping( &self, id: String, input: SetCartShippingInput, ) -> Result<CartOutput>

Set shipping selection (address + method/carrier/amount)

Source

pub async fn set_billing_address( &self, id: String, address: CartAddressInput, ) -> Result<CartOutput>

Set the billing address

Source

pub async fn get_shipping_rates( &self, id: String, ) -> Result<Vec<ShippingRateOutput>>

Get available shipping rates

Source

pub async fn set_payment( &self, id: String, input: SetCartPaymentInput, ) -> Result<CartOutput>

Set payment method

Source

pub async fn apply_discount( &self, id: String, coupon_code: String, ) -> Result<CartOutput>

Apply a discount/coupon code

Source

pub async fn remove_discount(&self, id: String) -> Result<CartOutput>

Remove discount from cart

Source

pub async fn mark_ready_for_payment(&self, id: String) -> Result<CartOutput>

Mark cart as ready for payment

Source

pub async fn begin_checkout(&self, id: String) -> Result<CartOutput>

Begin checkout process

Source

pub async fn complete(&self, id: String) -> Result<CheckoutResultOutput>

Complete checkout and create order

Source

pub async fn cancel(&self, id: String) -> Result<CartOutput>

Cancel a cart

Source

pub async fn abandon(&self, id: String) -> Result<CartOutput>

Mark cart as abandoned

Source

pub async fn expire(&self, id: String) -> Result<CartOutput>

Mark cart as expired

Source

pub async fn reserve_inventory(&self, id: String) -> Result<CartOutput>

Reserve inventory for cart items

Source

pub async fn release_inventory(&self, id: String) -> Result<CartOutput>

Release reserved inventory for cart items

Source

pub async fn recalculate(&self, id: String) -> Result<CartOutput>

Recalculate cart totals

Source

pub async fn set_tax(&self, id: String, tax_amount: f64) -> Result<CartOutput>

Set tax amount

Source

pub async fn get_abandoned(&self) -> Result<Vec<CartOutput>>

Get abandoned carts

Source

pub async fn get_expired(&self) -> Result<Vec<CartOutput>>

Get expired carts

Source

pub async fn count(&self) -> Result<u32>

Count carts

Trait Implementations§

Source§

impl FromNapiMutRef for Carts

Source§

unsafe fn from_napi_mut_ref( env: napi_env, napi_val: napi_value, ) -> Result<&'static mut Self>

Safety Read more
Source§

impl FromNapiRef for Carts

Source§

unsafe fn from_napi_ref( env: napi_env, napi_val: napi_value, ) -> Result<&'static Self>

Safety Read more
Source§

impl FromNapiValue for &Carts

Source§

unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>

Safety Read more
Source§

fn from_unknown(value: JsUnknown) -> Result<Self, Error>

Source§

impl FromNapiValue for &mut Carts

Source§

unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>

Safety Read more
Source§

fn from_unknown(value: JsUnknown) -> Result<Self, Error>

Source§

impl ObjectFinalize for Carts

Source§

fn finalize(self, env: Env) -> Result<(), Error>

Source§

impl ToNapiValue for Carts

Source§

impl TypeName for &Carts

Source§

impl TypeName for &mut Carts

Source§

impl TypeName for Carts

Source§

impl ValidateNapiValue for &Carts

Source§

unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>

Safety Read more
Source§

impl ValidateNapiValue for &mut Carts

Source§

unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>

Safety Read more

Auto Trait Implementations§

§

impl Freeze for Carts

§

impl !RefUnwindSafe for Carts

§

impl Send for Carts

§

impl Sync for Carts

§

impl Unpin for Carts

§

impl UnsafeUnpin for Carts

§

impl !UnwindSafe for Carts

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> 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> JsValuesTupleIntoVec for T
where T: ToNapiValue,

Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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