@fabrix/spool-cart
Version:
Spool - eCommerce Spool for Fabrix
205 lines (204 loc) • 5.58 kB
TypeScript
import { FabrixModel as Model } from '@fabrix/fabrix/dist/common';
import { SequelizeResolver } from '@fabrix/spool-sequelize';
export declare class DiscountUploadResolver extends SequelizeResolver {
batch(options: any, batch: any): any;
resolveByInstance(discount: any, options?: {
[key: string]: any;
}): Promise<any>;
resolveById(discount: any, options?: {
[key: string]: any;
}): any;
resolveByToken(discount: any, options?: {
[key: string]: any;
}): any;
resolveByCode(discount: any, options?: {
[key: string]: any;
}): any;
resolveByNumber(discount: any, options?: {
[key: string]: any;
}): any;
resolveByString(discount: any, options?: {
[key: string]: any;
}): any;
resolve(discount: any, options?: {
[key: string]: any;
}): any;
transformDiscounts(discounts?: any[], options?: {
[key: string]: any;
}): any;
}
export declare class Discount extends Model {
static readonly resolver: typeof DiscountUploadResolver;
static config(app: any, Sequelize: any): {
options: {
underscored: boolean;
enums: {
DISCOUNT_TYPES: {
PERCENTAGE: string;
RATE: string;
THRESHOLD: string;
SHIPPING: string;
};
DISCOUNT_STATUS: {
ENABLED: string;
DISABLED: string;
DEPLETED: string;
};
DISCOUNT_SCOPE: {
INDIVIDUAL: string;
GLOBAL: string;
};
};
scopes: {
live: {
where: {
live_mode: boolean;
};
};
expired: () => {
where: {
ends_at: {
$gte: Date;
};
};
};
active: () => {
where: {
status: string;
starts_at: {
$gte: Date;
};
ends_at: {
$lte: Date;
};
};
};
};
hooks: {
beforeValidate: ((discount: any, options: any) => void)[];
beforeCreate: ((discount: any, options: any) => void)[];
beforeUpdate: ((discount: any, options: any) => void)[];
};
};
};
static schema(app: any, Sequelize: any): {
handle: {
type: any;
allowNull: boolean;
unique: boolean;
set: (val: any) => void;
};
name: {
type: any;
};
description: {
type: any;
};
body: {
type: any;
};
body_html: {
type: any;
};
code: {
type: any;
notNull: boolean;
};
discount_scope: {
type: any;
values: string[];
defaultValue: string;
};
discount_type: {
type: any;
values: string[];
defaultValue: string;
};
discount_rate: {
type: any;
};
discount_threshold: {
type: any;
};
discount_percentage: {
type: any;
defaultValue: number;
};
discount_shipping: {
type: any;
defaultValue: number;
};
discount_product_include: {
type: any;
defaultValue: any[];
};
discount_product_exclude: {
type: any;
defaultValue: any[];
};
discount_customer_include: {
type: any;
defaultValue: any[];
};
discount_customer_exclude: {
type: any;
defaultValue: any[];
};
shipping_product_exclude: {
type: any;
defaultValue: any[];
};
tax_product_exclude: {
type: any;
defaultValue: any[];
};
ends_at: {
type: any;
};
starts_at: {
type: any;
};
status: {
type: any;
values: string[];
defaultValue: string;
};
minimum_order_amount: {
type: any;
defaultValue: number;
};
usage_limit: {
type: any;
defaultValue: number;
};
times_used: {
type: any;
defaultValue: number;
};
applies_once: {
type: any;
defaultValue: boolean;
};
applies_once_per_customer: {
type: any;
defaultValue: boolean;
};
applies_compound: {
type: any;
defaultValue: boolean;
};
live_mode: {
type: any;
defaultValue: any;
};
};
static associate(models: any): void;
}
export interface Discount {
start(): any;
stop(): any;
depleted(): any;
logUsage(orderId: any, customerId: any, price: any, options: any): any;
eligibleCustomer(customerId: any, options: any): any;
discountItem(item: any, criteria: any): any;
}