GitHub

DaffProductFacadeInterface

Type

import { DaffProductFacadeInterface } from '@daffodil/product/state'

A facade for getting state about a particular product.

interface DaffProductFacadeInterface<T extends DaffProduct = DaffProduct> {
  getProduct(id: T["id"]): any
  getPrice(id: T["id"]): any
  hasDiscount(id: T["id"]): any
  getDiscountAmount(id: T["id"]): any
  getDiscountedPrice(id: T["id"]): any
  getDiscountPercent(id: T["id"]): any
  isOutOfStock(id: T["id"]): any
}

() Methods

getProduct
any

Get a product.

Parameters
Parameterid: T["id"]
Description

a product id

getPrice
any

Get the original price for a product.

Parameters
Parameterid: T["id"]
Description

a product id

hasDiscount
any

Whether a particular product has a discount.

Parameters
Parameterid: T["id"]
Description

a product id

getDiscountAmount
any

Get the discount amount of a product.

Parameters
Parameterid: T["id"]
Description

a product id

getDiscountedPrice
any

Get the discounted price for a product.

Parameters
Parameterid: T["id"]
Description

a product id

getDiscountPercent
any

Get the discount percent of a product.

Parameters
Parameterid: T["id"]
Description

a product id

isOutOfStock
any

Whether a product is out of stock.

Parameters
Parameterid: T["id"]
Description

a product id