@vendure/core
Version:
A modern, headless ecommerce framework
44 lines (43 loc) • 2.17 kB
TypeScript
import { ConfigurableOperation } from '@vendure/common/lib/generated-types';
import { DeepPartial } from '@vendure/common/lib/shared-types';
import { RequestContext } from '../../api/common/request-context';
import { ChannelAware, SoftDeletable } from '../../common/types/common-types';
import { LocaleString, Translatable, Translation } from '../../common/types/locale-types';
import { HasCustomFields } from '../../config/custom-field/custom-field-types';
import { ShippingCalculationResult } from '../../config/shipping-method/shipping-calculator';
import { VendureEntity } from '../base/base.entity';
import { Channel } from '../channel/channel.entity';
import { CustomShippingMethodFields } from '../custom-entity-fields';
import { Order } from '../order/order.entity';
/**
* @description
* A ShippingMethod is used to apply a shipping price to an {@link Order}. It is composed of a
* {@link ShippingEligibilityChecker} and a {@link ShippingCalculator}. For a given Order,
* the `checker` is used to determine whether this ShippingMethod can be used. If yes, then
* the ShippingMethod can be applied and the `calculator` is used to determine the price of
* shipping.
*
* @docsCategory entities
*/
export declare class ShippingMethod extends VendureEntity implements ChannelAware, SoftDeletable, HasCustomFields, Translatable {
private readonly allCheckers;
private readonly allCalculators;
constructor(input?: DeepPartial<ShippingMethod>);
deletedAt: Date | null;
code: string;
name: LocaleString;
description: LocaleString;
checker: ConfigurableOperation;
calculator: ConfigurableOperation;
fulfillmentHandlerCode: string;
channels: Channel[];
translations: Array<Translation<ShippingMethod>>;
customFields: CustomShippingMethodFields;
apply(ctx: RequestContext, order: Order): Promise<ShippingCalculationResult | undefined>;
test(ctx: RequestContext, order: Order): Promise<boolean>;
/**
* This is a fix for https://github.com/vendure-ecommerce/vendure/issues/3277,
* to prevent circular references which cause the JSON.stringify() to fail.
*/
protected toJSON(): any;
}