projects/congarevenuecloud/ecommerce/src/lib/modules/promotion/services/promotion.service.ts
Promotion Service defines a way to add/remove promotions to/from the cart.
import { PromotionService } from '@congarevenuecloud/ecommerce';
constructor(private promotionService: PromotionService) {}
// or
export class MyService extends AObjectService {
private promotionService: PromotionService = this.injector.get(PromotionService);
}
AObjectService
Properties |
Methods |
getAppliedPromotionForCart | ||||||||||||
getAppliedPromotionForCart(incentiveCode: string, cart: Cart)
|
||||||||||||
Method returns an observable containing an array of adjustment line items for the current cart. Example:Example :
Parameters :
Returns :
Observable<AdjustmentItem[]>
an observable containing an array of adjustment line items for the current cart. |
getAppliedPromotionForLineItem | ||||||||
getAppliedPromotionForLineItem(lineNumber: number)
|
||||||||
Method returns an observable containing an array of adjustment line items for the lineItem based on the LineNumber. Example:Example :
Parameters :
Returns :
Observable<Array<AdjustmentItem>>
an observable containing an array of adjustment line items for the lineItem based on the lineNumber. |
removeAppliedPromotion | ||||||||||||
removeAppliedPromotion(promocodes: string | string[], lineItems: Array
|
||||||||||||
Method removes the promotion from the current cart if it is already applied. Example:Example :
Parameters :
Returns :
Observable<boolean | HttpErrorResponse>
a observable<boolean | HttpErrorResponse> when the operation has completed. |
apiService |
Type : ApiService
|
Default value : this.injector.get(ApiService)
|
cartService |
Type : CartService
|
Default value : this.injector.get(CartService)
|
type |
Default value : AdjustmentItem
|