@fabrix/spool-cart
Version:
Spool - eCommerce Spool for Fabrix
281 lines (280 loc) • 7.71 kB
TypeScript
import { FabrixModel as Model } from '@fabrix/fabrix/dist/common';
import { SequelizeResolver } from '@fabrix/spool-sequelize';
export declare class CartResolver extends SequelizeResolver {
findByIdDefault(id: any, options?: {}): any;
findOneDefault(options?: {
[key: string]: any;
}): any;
findByTokenDefault(token: any, options?: {
[key: string]: any;
}): any;
resolveByInstance(cart: any, options?: {
[key: string]: any;
}): Promise<any>;
resolveById(cart: any, options?: {
[key: string]: any;
}): any;
resolveByToken(cart: any, options?: {
[key: string]: any;
}): any;
resolveByNumber(cart: any, options?: {
[key: string]: any;
}): any;
resolveByString(cart: any, options?: {
[key: string]: any;
}): any;
resolve(cart: any, options?: {
[key: string]: any;
}): any;
}
export declare class Cart extends Model {
static readonly resolver: typeof CartResolver;
static config(app: any, Sequelize: any): {
options: {
enums: {
CART_STATUS: {
OPEN: string;
DRAFT: string;
CLOSED: string;
ABANDONED: string;
ORDERED: string;
};
};
underscored: boolean;
scopes: {
live: {
where: {
live_mode: boolean;
};
};
};
indexes: {
fields: string[];
using: string;
operator: string;
}[];
hooks: {
beforeCreate: ((cart: any, options: any) => any)[];
beforeUpdate: ((cart: any, options: any) => any)[];
beforeSave: ((cart: any, options: any) => any)[];
};
};
};
static schema(app: any, Sequelize: any): {
customer_id: {
type: any;
};
shop_id: {
type: any;
};
order_id: {
type: any;
};
billing_address_id: {
type: any;
};
shipping_address_id: {
type: any;
};
token: {
type: any;
unique: boolean;
};
status: {
type: any;
values: string[];
defaultValue: string;
};
currency: {
type: any;
defaultValue: string;
};
line_items: {
type: any;
defaultValue: any[];
};
subtotal_price: {
type: any;
defaultValue: number;
};
discounted_lines: {
type: any;
defaultValue: any[];
};
coupon_lines: {
type: any;
defaultValue: any[];
};
shipping_lines: {
type: any;
defaultValue: any[];
};
shipping_included: {
type: any;
defaultValue: boolean;
};
shipping_rate: {
type: any;
defaultValue: any[];
};
shipping_rates: {
type: any;
defaultValue: any[];
};
has_subscription: {
type: any;
defaultValue: boolean;
};
has_shipping: {
type: any;
defaultValue: boolean;
};
has_taxes: {
type: any;
defaultValue: boolean;
};
total_items: {
type: any;
defaultValue: number;
};
tax_shipping: {
type: any;
defaultValue: boolean;
};
tax_lines: {
type: any;
defaultValue: any[];
};
tax_rate: {
type: any;
defaultValue: number;
};
tax_percentage: {
type: any;
defaultValue: number;
};
taxes_included: {
type: any;
defaultValue: boolean;
};
total_discounts: {
type: any;
defaultValue: number;
};
total_coupons: {
type: any;
defaultValue: number;
};
pricing_overrides: {
type: any;
defaultValue: any[];
};
pricing_override_id: {
type: any;
};
total_overrides: {
type: any;
defaultValue: number;
};
total_line_items_price: {
type: any;
defaultValue: number;
};
total_price: {
type: any;
defaultValue: number;
};
total_due: {
type: any;
defaultValue: number;
};
total_shipping: {
type: any;
defaultValue: number;
};
total_tax: {
type: any;
defaultValue: number;
};
total_weight: {
type: any;
defaultValue: number;
};
ip: {
type: any;
};
create_ip: {
type: any;
};
update_ip: {
type: any;
};
client_details: {
type: any;
defaultValue: {
'accept_language': any;
'browser_height': any;
'browser_ip': string;
'browser_width': any;
'session_hash': any;
'user_agent': any;
};
};
reservation_time: {
type: any;
defaultValue: number;
};
reservation_time_left: {
type: any;
defaultValue: number;
};
notes: {
type: any;
};
live_mode: {
type: any;
defaultValue: any;
};
};
static associate(models: any): void;
}
export interface Cart {
resetDefaults(): any;
setLineItems(lines: any): any;
setItemDiscountedLines(item: any, discount: any, criteria: any): any;
setItemsDiscountedLines(discounts: any, criteria: any): any;
setDiscountedLines(lines: any): any;
setPricingOverrides(lines: any): any;
setCouponLines(lines: any): any;
setItemsShippingLines(items: any): any;
setShippingLines(lines: any): any;
setItemsTaxLines(items: any): any;
setTaxLines(lines: any): any;
setTotals(): any;
setLineProperties(lines: any): any;
line(data: any): any;
addLine(item: any, qty: any, properties: any, shop: any, options: any): any;
removeLine(item: any, qty: any, options: any): any;
addShipping(shipping: any, options: any): any;
removeShipping(shipping: any, options: any): any;
addTaxes(taxes: any, options: any): any;
removeTaxes(taxes: any, options: any): any;
close(status: any, save: any): any;
draft(status: any, save: any): any;
clear(): any;
ordered(order: any, save: any): any;
buildOrder(options: any): any;
calculatePricingOverrides(options: any): any;
calculateDiscounts(options: any): any;
calculateShipping(options: any): any;
calculateTaxes(options: any): any;
recalculate(options: any): any;
resolveCustomer(options: any): any;
resolveCustomerAndItemCollections(options: any): any;
resolveDiscounts(options: any): any;
getCollectionPairs(options: any): any;
resolveShippingAddress(options: any): any;
resolveBillingAddress(options: any): any;
updateShippingAddress(address: any, options: any): any;
updateBillingAddress(address: any, options: any): any;
}