projects/congarevenuecloud/ecommerce/src/lib/modules/order/services/order.service.ts
The order represents purchase of products. The orders are generally converted from the cart.
import { OrderService } from '@congarevenuecloud/ecommerce';
constructor(private orderService: OrderService) {}
// or
export class MyService extends AObjectService {
private orderService: OrderService = this.injector.get(OrderService);
}
AObjectService
Properties |
|
Methods |
acceptOrder | ||||||||
acceptOrder(orderId: string)
|
||||||||
This method confirms the order based on the order id passed.
Parameters :
Returns :
Observable<Order>
observable containing the confirmed order. |
convertCartToOrder | ||||||||||||||||||||
convertCartToOrder(order: Order, primaryContact?: Contact, fieldList?: Array
|
||||||||||||||||||||
Method converts the current cart into a order instance. Example:Example :
Parameters :
Returns :
Observable<Order>
an observable of the order instance that was created from the cart. |
convertOrderToCart | ||||||||
convertOrderToCart(order: Order)
|
||||||||
Method creates new cart and clones the finalized cart linked to the order, and sets the new cart as active. Example:Example :
Parameters :
Returns :
Observable<Cart>
an observable of the cart instance. |
getAllOrders | ||||||||||||||||||||||||||||||||||||||||||||||||||
getAllOrders(accountId: string, days?: number, filters?: Array<FieldFilter>, relatedRecords: string, limit: number, pageNumber: number, orderBy: string, orderDirection: "ASC" | "DESC", showErrorToaster: boolean)
|
||||||||||||||||||||||||||||||||||||||||||||||||||
The method fetches the list of orders based on the parameters passed. Example:Example :
Parameters :
Returns :
Observable<OrderResult>
An observable containing the list of orders matching the criteria with total order count. |
getMyOrder |
getMyOrder()
|
Returns :
Observable<Order>
A hot observable containing the single order instance |
getMyOrders | ||||||||||||||||||||||||||||||||||||||||||||||||||
getMyOrders(accountId: string, days?: number, filters?: Array<FieldFilter>, relatedRecords: string, limit: number, pageNumber: number, orderBy: string, orderDirection: "ASC" | "DESC", showErrorToaster: boolean)
|
||||||||||||||||||||||||||||||||||||||||||||||||||
This method is work in progress, currently returning all orders. The method fetches the list of orders based on the parameters passed. Example:Example :
Parameters :
Returns :
Observable<OrderResult>
An observable containing the list of orders matching the criteria with total order count. |
getOrder | ||||||||
getOrder(Id: string)
|
||||||||
The method fetches the order based on given order Id in parameter. Example:Example :
Parameters :
Returns :
Observable<Order>
An observable instance of order with details. |
getOrderAggregatesByStatus | ||||||||||||||||||||||||||||||
getOrderAggregatesByStatus(account?: string | Account, aggregateFields?: Array<AggregateFields>, queryFields: Array
|
||||||||||||||||||||||||||||||
This method returns an aggregate result based on order aggregate criteria.
Parameters :
Returns :
Observable<AggregateResultSet>
observable containing aggregate response. |
getOrderByName | ||||||||
getOrderByName(orderName: string)
|
||||||||
The method fetches the order details based on the order name passed.
Parameters :
Returns :
Observable<Order>
observable of the order object matching the order name. |
getOrderByQuote | ||||||||
getOrderByQuote(quoteId: string)
|
||||||||
The method fetches the order details based on the associated quote.
Parameters :
Returns :
Observable<Order>
observable of the order object associated with the quote. |
Public publish | ||||||||
publish(order: Order)
|
||||||||
The method is used to emit the state of the order.
Parameters :
Returns :
void
|
updateOrder | ||||||||||||
updateOrder(orderId: string, payload: Order)
|
||||||||||||
This method updates the order object based on the payload passed.
Parameters :
Returns :
Observable<Order>
observable containing the updated order. |
Protected accountService |
Default value : this.injector.get(AccountService)
|
cartItemService |
Default value : this.injector.get(CartItemService)
|
Protected cartService |
Default value : this.injector.get(CartService)
|
Protected ngZone |
Type : NgZone
|
Default value : this.injector.get(NgZone)
|
Protected priceListService |
Default value : this.injector.get(PriceListService)
|
type |
Default value : Order
|
Protected userService |
Default value : this.injector.get(UserService)
|