projects/apttus/ecommerce/src/lib/modules/cart/services/cart-item.service.ts
Cart Item service returns the selling term and the end date of a recurring product.
Properties |
|
Methods |
| addCartItems | ||||||
addCartItems(cartItems: Array
|
||||||
|
Parameters :
Returns :
Observable<Array<CartItem>>
|
| getCartItem | ||||||
getCartItem(cartItemId: string)
|
||||||
|
Parameters :
Returns :
Observable<any>
|
| getCartItemsForAsset | ||||||||||||
getCartItemsForAsset(cartItem: CartItem, context?: Cart)
|
||||||||||||
|
Method will generate the default cart items for a given asset.
Parameters :
Returns :
Observable<Array<CartItem>>
|
| getCartItemsForCart | ||||||||||||
getCartItemsForCart(cartId: string, lineType?: "Product/Service" | "Option" | "Misc")
|
||||||||||||
|
This method returns cart line items based on the cart id and line type passed.
Parameters :
Returns :
Observable<Array<CartItem>>
An observable containing the array of cart line items of a given line type, for a given cart. |
| getCartItemsForProduct | |||||||||||||||||||||||||||||||||||||||||||||
getCartItemsForProduct(product: Product, quantity: number, cart?: Cart, cartItems?: Array
|
|||||||||||||||||||||||||||||||||||||||||||||
|
Method gets the cart items for a given product. A bundle product with option groups populated must be passed in to retrieve related option cart items.
Parameters :
Returns :
Observable<Array<CartItem>>
|
| getEndDate | ||||||||||||||||
getEndDate(purchaseDate: Date, term: number, frequency: "Hourly" | "Daily" | "Weekly" | "Monthly" | "Quarterly" | "Half Yearly" | "Yearly" | "--None--")
|
||||||||||||||||
|
This method returns the end date of a recurring product based on its start date and the selling frequency.
Parameters :
Returns :
Date
a date value representing the day of end of service of the product. |
| getNextPrimaryLineNumber | ||||||
getNextPrimaryLineNumber(cartItems: Array
|
||||||
|
Parameters :
Returns :
any
|
| getReadableTerm | |||||||||
getReadableTerm(term: number, frequency: "Hourly" | "Daily" | "Weekly" | "Monthly" | "Quarterly" | "Half Yearly" | "Yearly" | "One Time" | "--None--")
|
|||||||||
|
Parameters :
Returns :
string
|
| getTerm | ||||||||||||||||
getTerm(startDate: moment.Moment, endDate: moment.Moment, frequency: "Hourly" | "Daily" | "Weekly" | "Monthly" | "Quarterly" | "Half Yearly" | "Yearly" | "--None--")
|
||||||||||||||||
|
This method is used to calculate selling term of the recurring product based on its start date, end date and the selling frequency.
Parameters :
Returns :
number
number representing the selling term of the recurring product. |
| getOptionsForItem | ||||||||||||
getOptionsForItem(item: CartItem | AssetLineItem | QuoteLineItem | OrderLineItem, relatedTo?: Cart | Order | Quote)
|
||||||||||||
|
Method takes a line item and returns the full list of line items related to it. Can be any line item within the bundle.
Parameters :
Returns :
Observable<Array<CartItem | AssetLineItem | QuoteLineItem | OrderLineItem>>
|
| Static groupItems | ||||||
groupItems(items: Array
|
||||||
|
Parameters :
Returns :
Array<ItemGroup>
|
| Protected accountService |
Type : AccountService
|
Default value : this.injector.get(AccountService)
|
| frequencyMap |
Type : object
|
Default value : {
'Hourly': 'hours',
'Monthly': 'months',
'Daily': 'days',
'Weekly': 'weeks',
'Quarterly': 'years',
'Half Yearly': 'years',
'Yearly': 'years',
'--None--': '--None--'
}
|
| Protected priceListService |
Type : PriceListService
|
Default value : this.injector.get(PriceListService)
|
| Protected productAttributeValueService |
Type : ProductAttributeValueService
|
Default value : this.injector.get(ProductAttributeValueService)
|
| Protected storefrontService |
Type : StorefrontService
|
Default value : this.injector.get(StorefrontService)
|
| type |
Default value : CartItem
|