projects/congarevenuecloud/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.
import { CartItemService, AObjectService} from '@congarevenuecloud/ecommerce';
export class MyComponent implements OnInit{
constructor( private cartItemService: CartItemService)
}
// or
export class MyService extends AObjectService {
private cartItemService: CartItemService = this.injector.get(CartItemService);
}
Properties |
|
Methods |
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. Example:Example :
Parameters :
Returns :
Observable<Array<CartItem>>
an Obseravable containing the array of CartItem associated with Product |
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. Example:Example :
Parameters :
Returns :
Date
a date value representing the day of end of service of the product. |
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. Example:Example :
Parameters :
Returns :
number
number representing the selling term of the recurring product. |
Static groupItems | ||||||||
groupItems(items: Array
|
||||||||
The method takes a line item and returns the categorized line item. Example:Example :
Parameters :
Returns :
Array<ItemGroup>
|
Protected accountService |
Type : AccountService
|
Default value : this.injector.get(AccountService)
|
Protected categoryService |
Type : CategoryService
|
Default value : this.injector.get(CategoryService)
|
frequencyMap |
Type : object
|
Default value : {
'Hourly': 'hours',
'Monthly': 'months',
'Daily': 'days',
'Weekly': 'weeks',
'Quarterly': 'years',
'Half Yearly': 'years',
'Yearly': 'years',
'--None--': '--None--'
}
|
metadataService |
Type : MetadataService
|
Default value : this.injector.get(MetadataService)
|
Protected priceListService |
Type : PriceListService
|
Default value : this.injector.get(PriceListService)
|
Protected productAttributeService |
Type : ProductAttributeService
|
Default value : this.injector.get(ProductAttributeService)
|
Protected storefrontService |
Type : StorefrontService
|
Default value : this.injector.get(StorefrontService)
|
type |
Default value : CartItem
|
apiService |
Type : ApiService
|
Default value : this.injector.get(ApiService)
|