import { StockLocationDTO } from "../stock-location"; import { CartPropsForFulfillment, FulfillmentDTO, FulfillmentItemDTO, FulfillmentOrderDTO } from "./common"; import { CalculateShippingOptionPriceContext, CalculateShippingOptionPriceDTO, CreateShippingOptionDTO } from "./mutations"; export type FulfillmentOption = { /** * The option's ID. This ID can be an ID in the third-party system relevant * for later processing of fulfillment. * * @example express */ id: string; /** * Whether the option can be used to return items. */ is_return?: boolean; [k: string]: unknown; }; /** * A calculated shipping option price. */ export type CalculatedShippingOptionPrice = { /** * The calculated price. */ calculated_amount: number; /** * Whether the calculated price includes taxes. If enabled, Medusa will * infer the taxes from the calculated price. If false, Medusa will * add taxes to the calculated price. */ is_calculated_price_tax_inclusive: boolean; }; /** * The context for validating fulfillment data. */ export type ValidateFulfillmentDataContext = CartPropsForFulfillment & { /** * Details about the location that items are being shipped from. */ from_location: StockLocationDTO; [k: string]: unknown; }; export type CreateFulfillmentResult = { /** * Additional fulfillment data from provider */ data: Record; labels: { /** * The tracking number of the fulfillment label. */ tracking_number: string; /** * The tracking URL of the fulfillment label. */ tracking_url: string; /** * The label's URL. */ label_url: string; }[]; }; export interface IFulfillmentProvider { /** * * Return a unique identifier to retrieve the fulfillment plugin provider * @ignore */ getIdentifier(): string; /** * * Return the available fulfillment options for the given data. */ getFulfillmentOptions(): Promise; /** * * Validate the given fulfillment data. */ validateFulfillmentData(optionData: Record, data: Record, context: ValidateFulfillmentDataContext): Promise; /** * * Validate the given option. */ validateOption(data: Record): Promise; /** * * Check if the provider can calculate the fulfillment price. */ canCalculate(data: CreateShippingOptionDTO): Promise; /** * * Calculate the price for the given fulfillment option. */ calculatePrice(optionData: CalculateShippingOptionPriceDTO["optionData"], data: CalculateShippingOptionPriceDTO["data"], context: CalculateShippingOptionPriceContext): Promise; /** * * Create a fulfillment for the given data. */ createFulfillment(data: Record, items: Partial>[], order: Partial | undefined, fulfillment: Partial>): Promise; /** * * Cancel the given fulfillment. */ cancelFulfillment(fulfillment: Record): Promise; /** * * Get the documents for the given fulfillment data. */ getFulfillmentDocuments(data: Record): Promise; /** * * Create a return for the given data. */ createReturnFulfillment(fromData: Record): Promise; /** * * Get the documents for the given return data. */ retrieveDocuments(fulfillmentData: Record, documentType: string): Promise; /** * * Get the documents for the given return data. */ getReturnDocuments(data: Record): Promise; /** * * Get the documents for the given shipment data. */ getShipmentDocuments(data: Record): Promise; } //# sourceMappingURL=provider.d.ts.map