File

projects/congarevenuecloud/ecommerce/src/lib/modules/constraint-rules/services/applied-rule-action-info.service.ts

Description

This service is work in progress. Constraint rules are a powerful feature when configuring products. They allow you to include, excludes, recommend, validate and replace products based on business logic.

Extends

AObjectService

Index

Properties
Methods

Methods

deleteRulesForCart
This method is deprecated.
deleteRulesForCart(cart?: Cart)

Deletes constraint rules for the given cart.

Parameters :
Name Type Optional
cart Cart Yes
Returns : Observable<any>
fetchRulesFromPrimaryCart
fetchRulesFromPrimaryCart()
fetchRulesFromSecondaryCart
fetchRulesFromSecondaryCart()
getAppliedActionsForCart
getAppliedActionsForCart(cart?: Cart)

Method retrieves the actions that are taken on a cart when the constraint rules are applied

Parameters :
Name Type Optional Description
cart Cart Yes

The cart to retrieve constraint rules for. If left blank, will use the current cart.

An observable array of AppliedRuleActionInfo

getExclusionProductActionsForCart
getExclusionProductActionsForCart()

This method can be used to fetch the list of Applied rule action info records for active cart. It returns AppliedRuleActionInfo record having constraint rule action, actionType as Exclusion.

Example:

import { AppliedRuleActionInfo, AppliedRuleActionInfoService } from '@congarevenuecloud/ecommerce';

export class MyComponent implements OnInit{
rule: Array<AppliedRuleActionInfo>;
rule$: Observable<Array<AppliedRuleActionInfo>>;

constructor(private araiService: AppliedRuleActionInfoService){}

ngOnInit(){
this.araiService.getExclusionProductActionsForCart().subscribe(rule => {rule = rule;});
// or
this.rule$ = this.araiService.getExclusionProductActionsForCart();
}
}

Observable<Array> returns an observable of Array records.

getPendingActionsForCart
getPendingActionsForCart()

This method can be used to fetch the list of Applied rule action info records for active cart. It returns applied rule action info records have pending flag as true.

Example:

import { AppliedRuleActionInfo, AppliedRuleActionInfoService } from '@congarevenuecloud/ecommerce';

export class MyComponent implements OnInit{
rule: Array<AppliedRuleActionInfo>;
rule$: Observable<Array<AppliedRuleActionInfo>>;

constructor(private araiService: AppliedRuleActionInfoService){}

ngOnInit(){
this.araiService.getPendingActionsForCart().subscribe(rule => {rule = rule;});
// or
this.rule$ = this.araiService.getPendingActionsForCart();
}
}

Observable<Array> returns an observable of Array records.

onInit
onInit()
Returns : void

Properties

appliedRuleActionSubject
Type : BehaviorSubject<Array<AppliedRuleActionInfo>>
Default value : new BehaviorSubject<Array<AppliedRuleActionInfo>>([])
type
Default value : AppliedRuleActionInfo

results matching ""

    No results matching ""