import ICart from '../../Interfaces/Cart'; import IProduct from '../../Interfaces/Product'; import Space from '../../lib/Space'; import { MarketServiceActionsEnum } from './utils'; export interface IMarketQueue { readonly spaceId: string; readonly orgId: string; readonly serviceSlug: string; readonly objectSlug: string; readonly sku: string; readonly actionCode: string; readonly marketRef?: string; readonly updateObj: object; } export declare enum MarketServiceResult { NOT_SUPPORTED = "not_supported", NOT_FOUND = "not_found", SUCCESS = "ok", ERROR = "error" } export type executeQueryFnc = (cmd: string) => Promise; export interface IMarketplaceOrigin { slug: string; label: string; } export default class BaseMarketServiceClass { protected _space: Space; protected _executeQuery: executeQueryFnc | undefined; constructor(space: Space, executeQuery?: executeQueryFnc); /** * Return the service unique slug */ getServiceSlug(): string; /** * Return marketplace origins this handler can produce (marketplace_origin). * Defaults to a single entry using getServiceSlug(); override for multi-origin handlers. */ getSupportedServices(): IMarketplaceOrigin[]; /** * Used to test the capability of the service handler * @param _action the action slug to test * @returns true or false depending of the support of the requested action */ hasCapability(_action: MarketServiceActionsEnum): boolean; /** * Request a price update for a declination * @param _product the product data * @param _sku the declination sku * @param _newValue the new price to set */ updateDeclinationPrice(_product: IProduct, _sku: string, _newValue: number): Promise; /** * Request a quantity update for a declination * @param _product the product data * @param _sku the declination sku * @param _newValue the new quantity to set */ updateDeclinationQty(_product: IProduct, _sku: string, _newValue: number): Promise; /** * Remove an item from the market * @param _product the product data * @param _sku the declination sku */ removeDeclination(_product: IProduct, _sku: string): Promise; /** * Update the invoice status on the marketplace * @param _cart the cart data */ setOrderAsShipped(_cart: ICart): Promise; /** * Update the invoice status on the marketplace * @param _cart the cart data */ acceptCancelationRequest(_cart: ICart): Promise; private escape; private escapeString; protected addToQueue(data: IMarketQueue): Promise; }