File

projects/congarevenuecloud/ecommerce/src/lib/modules/incentive/services/incentive.service.ts

Description

This service provides methods to interact with incentives, including retrieving incentives for carts and cart items, fetching incentives by ID or code, and more.

Usage

Example :
import { IncentiveService } from '@congarevenuecloud/ecommerce';

constructor(private incentiveService: IncentiveService) {}

// or

export class MyService extends AObjectService {
private incentiveService: IncentiveService = this.injector.get(IncentiveService);
}

Extends

AObjectService

Index

Properties
Methods

Methods

getIncentiveByCode
getIncentiveByCode(incentiveCodes: Array)

Retrieves a list of incentives that match the provided incentive codes.

Parameters :
Name Type Optional Description
incentiveCodes Array<string> No

List of IncentiveCodes seperated by commas

An Observable of type Array emitting a list of incentives that match the provided incentive codes.

getIncentiveById
getIncentiveById(incentiveIds: Array, cartId: string)

Method retrieves all the applicable Incentives for the incentive Ids passed.

Example:

Example :
import { IncentiveService } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';

export class MyComponent implements OnInit{
constructor(private incentiveService: IncentiveService){}

getIncentiveById(incentiveIds: string, cartId: string){
this.incentiveService.getIncentiveById(incentiveIds, cartId).subscribe({...});
}
}
Parameters :
Name Type Optional Default value Description
incentiveIds Array<String> No

string identifier of the incentiveIds to be fetched.

cartId string No this.cartService.getCurrentCartId()
  • (Optional) The ID of the cart containing cart item records. Defaults to the active cart in the application.

An Observable of type Array emitting a list of all applicable incentives for the given incentive IDs associated with the provided cart ID or the active cart ID.

getIncentivesForCart
getIncentivesForCart(cartId: string)

Method retrieves all the applicable incentives for the cart with cartitems.

Example:

Example :
import { IncentiveService } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';

export class MyComponent implements OnInit{
constructor(private incentiveService: IncentiveService){}

getIncentivesForCart(cartId:string){
this.incentiveService.getIncentivesForCart(cartId).subscribe({...});
}
}
@param cartId - (Optional) The ID of the cart containing cart item records. Defaults to the active cart in the application.
@returns An Observable of type Array<Incentive> emitting a list of applicable incentives for all cart line items associated with the provided cart ID or the active cart ID.
Parameters :
Name Type Optional Default value Description
cartId string No this.cartService.getCurrentCartId()
  • (Optional) The ID of the cart containing cart item records. Defaults to the active cart in the application.

An Observable of type Array emitting a list of applicable incentives for all cart line items associated with the provided cart ID or the active cart ID.

getIncentivesForCartItem
getIncentivesForCartItem(lineItemId: string, cartId: string)

Method retrieves all applicable incentives for a given cart item.

Example:

Example :
import { IncentiveService } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';

export class MyComponent implements OnInit{
constructor(private incentiveService: IncentiveService){}

getIncentivesForCartItem(lineItemId: string, cartId: string){
this.incentiveService.getIncentivesForCartItem(lineItemId, cartId).subscribe({...});
}
}
Parameters :
Name Type Optional Default value Description
lineItemId string No

string identifier of the cart item to fetch incentives for.

cartId string No this.cartService.getCurrentCartId()
  • (Optional) The ID of the cart containing cart item records. Defaults to the active cart in the application.

An Observable of type Array emitting a list of all applicable incentives associated with the provided cart ID or the active cart ID.

Properties

apiService
Type : ApiService
Default value : this.injector.get(ApiService)
cartService
Type : CartService
Default value : this.injector.get(CartService)
type
Default value : Incentive

results matching ""

    No results matching ""