Skip to main content

SqliteCartRepository

Struct SqliteCartRepository 

Source
pub struct SqliteCartRepository { /* private fields */ }
Available on crate feature sqlite only.
Expand description

SQLite implementation of CartRepository

Implementations§

Trait Implementations§

Source§

impl CartRepository for SqliteCartRepository

Source§

fn create(&self, input: CreateCart) -> Result<Cart>

Create a new cart/checkout session
Source§

fn get(&self, id: CartId) -> Result<Option<Cart>>

Get cart by ID
Source§

fn get_by_number(&self, cart_number: &str) -> Result<Option<Cart>>

Get cart by cart number
Source§

fn update(&self, id: CartId, input: UpdateCart) -> Result<Cart>

Update a cart
Source§

fn list(&self, filter: CartFilter) -> Result<Vec<Cart>>

List carts with filter
Source§

fn for_customer(&self, customer_id: CustomerId) -> Result<Vec<Cart>>

Get carts for a customer
Source§

fn delete(&self, id: CartId) -> Result<()>

Delete a cart (or mark as cancelled)
Source§

fn add_item(&self, cart_id: CartId, item: AddCartItem) -> Result<CartItem>

Add item to cart
Source§

fn update_item(&self, item_id: Uuid, input: UpdateCartItem) -> Result<CartItem>

Update a cart item (quantity, etc)
Source§

fn remove_item(&self, item_id: Uuid) -> Result<()>

Remove item from cart
Source§

fn get_items(&self, cart_id: CartId) -> Result<Vec<CartItem>>

Get items for a cart
Source§

fn clear_items(&self, cart_id: CartId) -> Result<()>

Clear all items from cart
Source§

fn set_shipping_address(&self, id: CartId, address: CartAddress) -> Result<Cart>

Set shipping address
Source§

fn set_billing_address(&self, id: CartId, address: CartAddress) -> Result<Cart>

Set billing address
Source§

fn set_shipping(&self, id: CartId, shipping: SetCartShipping) -> Result<Cart>

Set shipping method
Source§

fn get_shipping_rates(&self, _id: CartId) -> Result<Vec<ShippingRate>>

Get available shipping rates for cart
Source§

fn set_payment(&self, id: CartId, payment: SetCartPayment) -> Result<Cart>

Set payment method/token
Source§

fn set_x402_payment( &self, id: CartId, payment: SetCartX402Payment, ) -> Result<Cart>

Set x402 payment method (stablecoin)
Source§

fn complete_with_x402( &self, id: CartId, payee_address: &str, ) -> Result<X402CheckoutResult>

Complete checkout with x402 payment Returns PaymentRequired if no intent exists, IntentCreated if awaiting signature, AwaitingSettlement if signed but not settled, or Completed if settled
Source§

fn apply_discount(&self, id: CartId, coupon_code: &str) -> Result<Cart>

Apply coupon/discount code
Source§

fn remove_discount(&self, id: CartId) -> Result<Cart>

Remove discount
Source§

fn mark_ready_for_payment(&self, id: CartId) -> Result<Cart>

Mark cart as ready for payment (validates all requirements met)
Source§

fn begin_checkout(&self, id: CartId) -> Result<Cart>

Begin checkout/payment process
Source§

fn complete(&self, id: CartId) -> Result<CheckoutResult>

Complete checkout (creates order, returns checkout result). Read more
Source§

fn complete_settled_externally(&self, id: CartId) -> Result<CheckoutResult>

Complete checkout for a cart whose payment was settled outside the engine (ACP, external PSP). Explicitly opts in to minting an order that is Confirmed + Paid with no engine-side payment record.
Source§

fn cancel(&self, id: CartId) -> Result<Cart>

Cancel a cart
Source§

fn abandon(&self, id: CartId) -> Result<Cart>

Mark cart as abandoned
Source§

fn expire(&self, id: CartId) -> Result<Cart>

Expire a cart
Source§

fn reserve_inventory(&self, id: CartId) -> Result<Cart>

Reserve inventory for cart items
Source§

fn release_inventory(&self, id: CartId) -> Result<Cart>

Release inventory reservations
Source§

fn recalculate(&self, id: CartId) -> Result<Cart>

Recalculate cart totals
Source§

fn set_tax(&self, id: CartId, tax_amount: Decimal) -> Result<Cart>

Set tax amount
Source§

fn get_abandoned(&self) -> Result<Vec<Cart>>

Get abandoned carts (for recovery campaigns)
Source§

fn get_expired(&self) -> Result<Vec<Cart>>

Get expired carts
Source§

fn count(&self, filter: CartFilter) -> Result<u64>

Count carts matching filter
Source§

fn create_batch(&self, inputs: Vec<CreateCart>) -> Result<BatchResult<Cart>>

Create multiple carts - partial success allowed
Source§

fn create_batch_atomic(&self, inputs: Vec<CreateCart>) -> Result<Vec<Cart>>

Create multiple carts - atomic (all-or-nothing)
Source§

fn update_batch( &self, updates: Vec<(CartId, UpdateCart)>, ) -> Result<BatchResult<Cart>>

Update multiple carts - partial success allowed
Source§

fn update_batch_atomic( &self, updates: Vec<(CartId, UpdateCart)>, ) -> Result<Vec<Cart>>

Update multiple carts - atomic (all-or-nothing)
Source§

fn delete_batch(&self, ids: Vec<CartId>) -> Result<BatchResult<CartId>>

Delete multiple carts - partial success allowed
Source§

fn delete_batch_atomic(&self, ids: Vec<CartId>) -> Result<()>

Delete multiple carts - atomic (all-or-nothing)
Source§

fn get_batch(&self, ids: Vec<CartId>) -> Result<Vec<Cart>>

Get multiple carts by ID
Source§

impl Debug for SqliteCartRepository

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> 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