File

projects/apttus/ecommerce/src/lib/modules/pricing/services/price.service.ts

Description

Client-side pricing engine for retrieving price for various points in the ecommerce application. NOTE: It is not guarunteed that this service will always return accurate pricing for a given cart. You should always call cartService.priceCart(...) to trigger the server-side pricing engine to get the final price of a given cart. There are also pipes provided that wrap this service to provide pricing within a template (i.e. ProductPricePipe, OrderPricePipe, CartPricePipe etc...)

Index

Properties
Methods

Constructor

constructor(priceListService: PriceListService, cartService: CartService, priceMatrixService: PriceMatrixService, metadataService: MetadataService, localCurrencyPipe: LocalCurrencyPipe, productAttributeValueService: ProductAttributeValueService, storefrontService: StorefrontService)
Parameters :
Name Type Optional
priceListService PriceListService No
cartService CartService No
priceMatrixService PriceMatrixService No
metadataService MetadataService No
localCurrencyPipe LocalCurrencyPipe No
productAttributeValueService ProductAttributeValueService No
storefrontService StorefrontService No

Methods

Static adjustValue
adjustValue(adjustmentAmount: number, adjustmentType: string, amount: number)

Method calcuates the adjustment amount for a line item based on its adjustment type.

Parameters :
Name Type Optional Description
adjustmentAmount number No

numeric value representing the adjustment amount on line item.

adjustmentType string No

string value representing the type of adjustment.

amount number No

numeric value representing the price on line item. The price can be list price, base price etc.

Returns : number

a numberic value representing the adjustment amount.

getAssetLineItemPrice
getAssetLineItemPrice(assetLineItem: AssetLineItem)
Parameters :
Name Type Optional Description
assetLineItem AssetLineItem No

the instance of the asset line item to return the price for

Returns : Observable<Price>

a hot observable containing the price of the asset line item

getAttributePriceForProduct
getAttributePriceForProduct(product: Product, attribute: ProductAttribute, attributeValue: any)

Method returns a price for a given attribute and its value on a product

Parameters :
Name Type Optional Description
product Product No

the instance of the product that the attribute is associated with

attribute ProductAttribute No

the instance of the attribute to calculate the adjustment for

attributeValue any No

The value of the attribute to calculate the price for

Returns : Observable<Price>

a hot observable containing the price of a given attribute value

getCartPrice
getCartPrice(cart$?: Observable | Cart)

Method returns the price for a given cart. If the first parameter is left blank, it will return the price for the current cart.

Parameters :
Name Type Optional Description
cart$ Observable<Cart> | Cart Yes

An optional parameter of the cart to calculate the price for. Can be an observable or a Cart instance. If left blank, will return the price for the current cart.

Returns : Observable<Price>

A hot observable containing the price of the given cart

getLineItemPrice
getLineItemPrice(itemList: Array | CartItem | AssetLineItem | QuoteLineItem | OrderLineItem, options?: Array)

Method returns a price instance for a given cart item. If the price for the item has already been calculated, it will not do client side calculation.

Parameters :
Name Type Optional
itemList Array<CartItem | AssetLineItem | OrderLineItem | QuoteLineItem> | CartItem | AssetLineItem | QuoteLineItem | OrderLineItem No
options Array<AssetLineItem | QuoteLineItem | OrderLineItem> Yes
Returns : Observable<Price>

A hot observable containing the price of the given cart item.

getOptionAdjustmentPrice
getOptionAdjustmentPrice(option: ProductOptionComponent, quantity: number)

Method is used to retrieve the price of an option for a given product

Parameters :
Name Type Optional Default value Description
option ProductOptionComponent No

the instance of the product option component to calculate the adjustment amount for

quantity number No 1

the quantity of options to get the price for

Returns : Observable<Price>

a hot observable containing the price of the given option

getOrderLineItemPrice
getOrderLineItemPrice(orderLI: OrderLineItem)

Method returns price for a given OrderLineItem instance.

Parameters :
Name Type Optional
orderLI OrderLineItem No
Returns : Observable<Price>

a hot observable containing the price of the LineItem

getOrderPrice
getOrderPrice(order: Order)

Method returns a price for a given order instance.

Parameters :
Name Type Optional Description
order Order No

the instance of the order to return a price for

Returns : Observable<Price>

a hot observable containing the price of the order

getProductPrice
getProductPrice(product: Product, quantity: number, term: number, attributeValue?: ProductAttributeValue, bundle: boolean, chargeType?: ChargeType)

Method is used to retrieve the price for a given product.

Parameters :
Name Type Optional Default value Description
product Product No

the instance of the product to return the price for

quantity number No 1

the number of product items to calculate

term number No 1
attributeValue ProductAttributeValue Yes
bundle boolean No false
chargeType ChargeType Yes
Returns : Observable<Price>

a hot observable containing the price instance for the given product

getQuoteLineItemPrice
getQuoteLineItemPrice(quoteLI: QuoteLineItem)

Method returns a NetPrice for a given QuoteLineItem instance.

Parameters :
Name Type Optional
quoteLI QuoteLineItem No
Returns : Observable<Price>

a hot observable containing the price of the QuoteLineItem

getQuotePrice
getQuotePrice(quote: Quote)

Method returns a price for a given Quote instance.

Parameters :
Name Type Optional Description
quote Quote No

the instance of the Quote to return a price for

Returns : Observable<Price>

a hot observable containing the price of the Quote

getRollupItemPrice
getRollupItemPrice(item: CartItem | AssetLineItem | QuoteLineItem | OrderLineItem)
Parameters :
Name Type Optional
item CartItem | AssetLineItem | QuoteLineItem | OrderLineItem No
Returns : Observable<Price>

Properties

cartPending
Type : boolean
Default value : false
matrixData
Type : object
Default value : {}
previousCartPrice
Type : Price
Default value : null
queryKey
Type : string
Default value : null
queryList
Type : Array<PriceListItem>

result-matching ""

    No results matching ""