@apihawk/billia-sdk
Version:
The ApiHawk Billia SDK
86 lines • 3.41 kB
TypeScript
import { ApiHawkConnectorService, IApihawkSession } from '@apihawk/connector';
import { BilliaSDKServiceBase } from '../lib/billia-sdk-service-base';
import { IRestPaginationQuery, IRestPaginatedResource } from '../types/common';
import { BilliaSDKCatalog } from './billia-sdk-catalog';
import { IOrderDetails, IOrderLineItemDetailed, IOrderLineItemSimple, IOrderNote, IOrdersListFetchOptions } from './billia-sdk-orders.types';
import { BilliaSDKPayment } from './billia-sdk-payment';
export declare class BilliaSDKOrders extends BilliaSDKServiceBase {
private paymentService;
private catalogService;
constructor(api: ApiHawkConnectorService, paymentService: BilliaSDKPayment, catalogService: BilliaSDKCatalog);
/**
* Lists purchases made by the user. Each purchase contains the nested order lines.
*
* @param session user session
* @param query pagination query
* @param options additional options
*/
getOrders(session: IApihawkSession, query?: IRestPaginationQuery, options?: IOrdersListFetchOptions): Promise<IRestPaginatedResource<IOrderDetails>>;
/**
* Fetches an order (purchase) by its ID.
*
* @param session user session
* @param orderId the ID of the order
*/
getOrderById(session: IApihawkSession, orderId: number): Promise<IOrderDetails>;
/**
* Cancels a whole purchase which may consist of multiple order lines (products).
*
* @param session user session
* @param orderId the ID of the order line
*/
cancelOrder(session: IApihawkSession, orderId: number): Promise<IOrderLineItemSimple[]>;
/**
* Cancels the purchase of a single order line (product).
*
* @param session user session
* @param orderLineId the ID of the order line
*/
cancelOrderLine(session: IApihawkSession, orderLineId: number): Promise<IOrderLineItemSimple>;
/**
* Gets detailed information about the order lines (product options) of a order.
*
* @param session user session
* @param orderId the order ID
*/
getOrderLines(session: IApihawkSession, orderId: number): Promise<IOrderLineItemDetailed[]>;
/**
* Fetches a list of purchases which contain unpaid order lines.
*
* @param session - user session
*/
getUnpaidPurchases(session: IApihawkSession): Promise<IRestPaginatedResource<IOrderDetails>>;
/**
* Lists all the notes associated with a purchase.
* @param session user session
* @param orderId order ID
*/
getOrderNotes(session: IApihawkSession, orderId: number): Promise<IOrderNote[]>;
/**
* Flattens bundle items which are part of the purchase's ordered items.
*/
private _transformOrderLines;
private getOrderOverview;
/**
* Calculates the type of an order
* by iterating over the types of its nested order lines.
*
* @param order - order
*/
private calculateOrderType;
/**
* Calculates the status of an order
* by iterating over the statuses of its nested order lines.
*
* @param order - order record
*/
private calculateOrderStatus;
/**
* Calculates the payment status of an order
* by iterating over the statuses of its nested order lines.
*
* @param order - order details
*/
private calculatePaymentStatus;
}
//# sourceMappingURL=billia-sdk-orders.d.ts.map