vk-io
Version:
Modern VK API SDK for Node.js
123 lines (122 loc) • 3.29 kB
TypeScript
import { Context, ContextFactoryOptions, ContextDefaultState } from './context';
import { IMarketAttachmentPayload, MarketAttachment } from '../attachments';
import { kSerializeData } from '../../utils/constants';
export type MarketOrderContextType = 'market_order';
export type MarketOrderContextSubType = 'market_order_new' | 'market_order_edit';
export interface IMarketOrderContextPayload {
id: number;
group_id: number;
user_id: number;
display_order_id: number;
variants_grouping_id: number;
is_main_variant: boolean;
property_values: {
variant_id: number;
variant_name: string;
property_name: string;
}[];
cart_quantity: number;
status: 0 | 1 | 2 | 3 | 4 | 5 | 6;
total_price: {
amount: string;
currency: {
id: number;
name: string;
};
text: string;
};
comment: string;
preview_order_items: IMarketAttachmentPayload[];
delivery: {
address: string;
type: string;
track_number: string;
track_link: string;
delivery_point: object;
};
recipient: {
name: string;
phone: string;
display_text: string;
};
date: number;
}
export type MarketOrderContextOptions<S> = ContextFactoryOptions<IMarketOrderContextPayload, S>;
export declare class MarketOrderContext<S = ContextDefaultState> extends Context<IMarketOrderContextPayload, S, MarketOrderContextType, MarketOrderContextSubType> {
previewOrderItems: MarketAttachment[];
constructor(options: MarketOrderContextOptions<S>);
/**
* Checks if the variation is the primary one.
*/
get isMainVariant(): boolean;
/**
* Returns the order identifier
*/
get id(): number;
/**
* Returns the group identifier
*/
get groupId(): number;
/**
* Returns the user identifier
*/
get userId(): number;
/**
* Returns the order number consisting of the customer identifier and the order identifier.
*/
get displayOrderId(): number;
/**
* Returns the identifier of the variation group
*/
get variantsGroupingId(): number;
/**
* Returns the properties of a variant
*/
get propertyValues(): IMarketOrderContextPayload['property_values'];
/**
* Returns the number of items in the cart
*/
get cartQuantity(): number;
/**
* Returns order status
*
* `0` - New
*
* `1` - Agreed
*
* `2` - Going
*
* `3` - Delivered
*
* `4` - Completed
*
* `5` - Canceled
*
* `6` - Returned
*/
get status(): number;
/**
* Returns the total order value.
*/
get totalPrice(): IMarketOrderContextPayload['total_price'];
/**
* Returns a comment for the order
*/
get commentText(): string;
/**
* Returns shipping information
*/
get delivery(): IMarketOrderContextPayload['delivery'];
/**
* Returns customer information
*/
get recipient(): IMarketOrderContextPayload['recipient'];
/**
* Returns the date when this order was created
*/
get createdAt(): number;
/**
* Returns the custom data
*/
[kSerializeData](): object;
}