File

projects/congarevenuecloud/ecommerce/src/lib/modules/crm/services/account-location.service.ts

Deprecated

This service is deprecated on Conga platform. The Address-Location service allows you to organize account addresses. Addresses are a sub-resource of an Account. An account may have multiple addresses.

Usage

```typescript import { AccountLocationService, AObjectService} from '@congarevenuecloud/ecommerce'; export class MyComponent implements OnInit{ constructor( private accountLocationService: AccountLocationService) } // or export class MyService extends AObjectService { private accountLocationService: AccountLocationService = this.injector.get(AccountLocationService); } ```

Description

The Address-Location service allows you to organize account addresses. Addresses are a sub-resource of an Account. An account may have multiple addresses.

Usage

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

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

Extends

AObjectService

Index

Properties
Methods

Methods

delete
delete(recordList: Array, updateCache: boolean)

Example:

Example :
import { AccountLocationService } from '@congarevenuecloud/ecommerce';
import { AObject } from '@congarevenuecloud/core';
import { Observable } from 'rxjs/Observable';

export class MyComponent implements OnInit{

constructor(private accountLocationService: AccountLocationService){}

delete(recordList: Array<AObject>){
this.accountLocationService.delete(recordList)
.subscribe(
deletedRecordList => {...},
err => {...}
);
}
}
Parameters :
Name Type Optional Default value Description
recordList Array<AObject> No

array of records to be deleted

updateCache boolean No true

when set to true, will update cache after deleting records

Returns : Observable<Array<AObject>>

an array of records that were deleted in the process

getAccountLocations
getAccountLocations()

Fetches all the account locations for the current account in the application.

Example:

Example :
import { AccountLocationService, AccountLocation } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';

export class MyComponent implements OnInit{
accountLocationList: Array<AccountLocation>;
accountLocationList$: Observable<Array<AccountLocation>>;

constructor(private accountLocationService: AccountLocationService){}

getAccountLocations(productCode: string){
this.accountLocationService.getAccountLocations().subscribe(a => this.accountLocationList = a);
// or
this.accountLocationList$ = this.accountLocationService.getAccountLocations();
}
}
Returns : Observable<Array<AccountLocation>>

An observable of an account location array

saveLocationToAccount
saveLocationToAccount(location: AccountLocation)

Saves the account location record to the current account.

Example:

Example :
import { AccountLocationService, AccountLocation } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';

export class MyComponent implements OnInit{

constructor(private accountLocationService: AccountLocationService){}

saveAccountLocation(accountLocation: AccountLocation){
this.accountLocationService.saveLocationToAccount(accountLocation)
.subscribe(
locationId => {...},
err => {...}
);
}
}
Parameters :
Name Type Optional Description
location AccountLocation No

The AccountLocation record to save

Returns : Observable<Array<AccountLocation>>

An observable of an account location record id

setLocationAsDefault
setLocationAsDefault(location: AccountLocation)

Sets the selected address as the default address.

Example:

Example :
import { AccountLocationService, AccountLocation } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';

export class MyComponent implements OnInit{

constructor(private accountLocationService: AccountLocationService){}

setLocationAsDefault(accountLocation: AccountLocation){
this.accountLocationService.setLocationAsDefault(accountLocation)
.subscribe(
locationIdList => {...},
err => {...}
);
}
}
Parameters :
Name Type Optional Description
location AccountLocation No

The AccountLocation record to set as default

Returns : Observable<Array<AccountLocation>>

A string array of records that were updated in the process

Properties

type
Default value : AccountLocation

results matching ""

    No results matching ""