GitHub

DaffCartCouponServiceInterface

import { DaffCartCouponServiceInterface } from '@daffodil/cart/driver'

The interface responsible for applying a coupon to a cart.

interface DaffCartCouponServiceInterface<T extends DaffCart = DaffCart> {
  apply(
    cartId: T["id"]
    coupon: T["coupons"][number]
  ): Observable<Partial<T>>
  list(cartId: T["id"]): Observable<T['coupons']>
  remove(
    cartId: T["id"]
    coupon: T["coupons"][number]
  ): Observable<Partial<T>>
  removeAll(cartId: T["id"]): Observable<Partial<T>>
}

() Methods

apply
Observable<Partial<T>>

Apply a coupon to the cart and return a partial of the cart.

Parameters
ParametercartId: T["id"]
Description
Parametercoupon: T["coupons"][number]
Description
list
Observable<T['coupons']>

List coupon codes applied to a cart.

Parameters
ParametercartId: T["id"]
Description
remove
Observable<Partial<T>>

Remove a coupon from the cart and return a partial of the cart.

Parameters
ParametercartId: T["id"]
Description
Parametercoupon: T["coupons"][number]
Description
removeAll
Observable<Partial<T>>

Remove all coupons from the cart and return a partial of the cart.

Parameters
ParametercartId: T["id"]
Description