File

projects/congarevenuecloud/ecommerce/src/lib/modules/abo/services/asset.service.ts

Description

This service is a work in progress.

Assets are the products own by customer and a user may wish to renew/terminate/update existing assets.

  • Usage

Example :
import { AssetService, AObjectService} from '@congarevenuecloud/ecommerce';

export class MyComponent implements OnInit{
constructor( private assetService: AssetService)
}
// or
export class MyService extends AObjectService {
private assetService: AssetService = this.injector.get(AssetService);
}

Extends

AObjectService

Index

Properties
Methods

Methods

Public amendAssets
amendAssets(assetId: string | Array)

The primary method to amend the existing assets.

Example:

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

export class MyComponent implements OnInit{
lineItemMap: Array<any>;
lineItemMap$: Observable<Array<any>>;

constructor(private assetService: AssetService){}

ngOnInit(){
this.assetService.amendAssets(assetIds: Array<string>)subscribe(lineItemMap => {...});
// or
this.lineItemMap$ = this.assetService.amendAssets(assetIds: Array<string>);
}
}
Parameters :
Name Type Optional Description
assetId string | Array<string> No

id of the asset or assets whose configuration is to be amended.

Returns : Observable<Array<AssetLineItemExtended>>

returns an observable list of asset line item records.

Public cancelAssets
cancelAssets(assetIds: Array, cancelDate: Date)

The primary method to terminate the existing assets.

Example:

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

export class MyComponent implements OnInit{
lineItemMap: Array<any>;
lineItemMap$: Observable<Array<any>>;

constructor(private assetService: AssetService){}

ngOnInit(){
this.assetService.cancelAssets(assetIds: Array<string>, cancelDate: Date)subscribe(lineItemMap => {...});
// or
this.lineItemMap$ = this.assetService.cancelAssets(assetIds: Array<string>, cancelDate: Date);
}
}
Parameters :
Name Type Optional Description
assetIds Array<string> No

list of asset ids to terminate

cancelDate Date No

cancel date for asset termination

Returns : Observable<Array<CartItem>>

Observable<Array> an observable list of line items of the cart.

getAssetAggregates
getAssetAggregates(account?: Account, aggregateFields?: Array<AggregateFields>, queryFields: Array, groupByFields: Array, filterList: Array<FieldFilter>)

This method returns an aggregate result based on asset aggregate criteria.

Parameters :
Name Type Optional Default value Description
account Account Yes

instance of account object.

aggregateFields Array<AggregateFields> Yes

list of AggregateFields used in query.

queryFields Array<string> No []

list of fields to be part of the query response.

groupByFields Array<string> No []

list of fields to be part of the group by clauses.

filterList Array<FieldFilter> No []

list of FieldFilter objects representing the filters to be applied.

observable containing aggregate response.

Public getAssetLineItemsforProducts
getAssetLineItemsforProducts(productList: Array<Product> | Array<string>, memoizeOptions: MemoizeOptions)
Decorators :
@MemoizeWithHash()

This method can be used to get the asset line items for given set of products. ABO must be enabled in the storefront to get asset line item records.

Example:

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

export class MyComponent implements OnInit{
assetLineItems: Array<AssetLineItem>;
assetLineItems$: Observable<Array<AssetLineItem>>;

constructor(private assetService: AssetService){}

ngOnInit(){
this.assetService.getAssetLineItemsforProducts(products: Array<Product>).subscribe(assetLineItems => {...});
// or
this.assetLineItems$ = this.assetService.getAssetLineItemsforProducts(products: Array<Product>);
}
}
Parameters :
Name Type Optional Default value Description
productList Array<Product> | Array<string> No

list of product records or list of product id's as string value.

memoizeOptions MemoizeOptions No null

an optional parameter to specify memoization options using MemoizeOptions interface. Defaults to null.

Returns : Observable<Array<AssetLineItemExtended>>

returns an observable list of asset line item records.

Public incrementAssets
incrementAssets(incrementAssetDOs: Array)

The primary method to increment the existing assets.

Example:

Example :
import { AssetService, IncrementAssetDO, IncrementLineAction } from '@congarevenuecloud/ecommerce';

export class MyComponent implements OnInit{
lineItemMap: Array<any>;
lineItemMap$: Observable<Array<any>>;

constructor(private assetService: AssetService){}

ngOnInit(){
this.assetService.incrementAssets(incrementAssetDO: Array<IncrementAssetDO>)subscribe(lineItemMap => {...});
// or
this.lineItemMap$ = this.assetService.incrementAssets(incrementAssetDO: Array<IncrementAssetDO>);
}
}
Parameters :
Name Type Optional Description
incrementAssetDOs Array<IncrementAssetDO> No

list of increment asset data objects for incrementing the existing assets

Returns : Observable<Array<CartItem>>

an observable list of cart line items records.

Public renewAssets
renewAssets(assetIds: Array, renewEndDate: Date, renewTerm: number, farthestAssetEndDate: boolean)

The primary method to renew the existing assets.

Example:

Example :
import { AssetService, AssetLineItemExtended } from '@congarevenuecloud/ecommerce';

export class MyComponent implements OnInit{
lineItemMap: Array<AssetLineItemExtended>;
lineItemMap$: Observable<Array<AssetLineItemExtended>>;

constructor(private assetService: AssetService){}

ngOnInit(){
this.assetService.renewAssets(assetIds: Array<string>, renewEndDate: Date, renewTerm: number, cartId: string, farthestAssetEndDate: boolean)subscribe(lineItemMap => {...});
// or
this.lineItemMap$ = this.assetService.renewAssets(assetIds: Array<string>, renewEndDate: Date, renewTerm: number, cartId: string, farthestAssetEndDate: boolean);
}
}
Parameters :
Name Type Optional Description
assetIds Array<string> No

list of asset ids to renew

renewEndDate Date No

renew end date for asset renewal

renewTerm number No

renew term for asset renewal

farthestAssetEndDate boolean No

farthest asset end date for asset renewal

Returns : Observable<Array<CartItem>>

Observable<Array> an observable list of line items of the cart.

Properties

Protected accountService
Default value : this.injector.get(AccountService)
apiService
Type : ApiService
Default value : this.injector.get(ApiService)
storefrontService
Type : StorefrontService
Default value : this.injector.get(StorefrontService)
type
Default value : AssetLineItemExtended

results matching ""

    No results matching ""