FulfillmentService
FulfillmentService
Contains methods relating to Fulfillment entities.
Signature
class FulfillmentService {
constructor(connection: TransactionalConnection, fulfillmentStateMachine: FulfillmentStateMachine, eventBus: EventBus, configService: ConfigService, customFieldRelationService: CustomFieldRelationService)
async create(ctx: RequestContext, orders: Order[], items: OrderItem[], handler: ConfigurableOperationInput) => Promise<Fulfillment | InvalidFulfillmentHandlerError | CreateFulfillmentError>;
async getOrderItemsByFulfillmentId(ctx: RequestContext, id: ID) => Promise<OrderItem[]>;
async getFulfillmentLineSummary(ctx: RequestContext, id: ID) => Promise<Array<{ orderLine: OrderLine; quantity: number }>>;
async getFulfillmentsByOrderLineId(ctx: RequestContext, orderLineId: ID) => Promise<Array<{ fulfillment: Fulfillment; orderItemIds: Set<ID> }>>;
async getFulfillmentByOrderItemId(ctx: RequestContext, orderItemId: ID) => Promise<Fulfillment | undefined>;
async transitionToState(ctx: RequestContext, fulfillmentId: ID, state: FulfillmentState) => Promise<
| {
fulfillment: Fulfillment;
orders: Order[];
fromState: FulfillmentState;
toState: FulfillmentState;
}
| FulfillmentStateTransitionError
>;
getNextStates(fulfillment: Fulfillment) => ReadonlyArray<FulfillmentState>;
}
Members
constructor
(connection: TransactionalConnection, fulfillmentStateMachine: FulfillmentStateMachine, eventBus: EventBus, configService: ConfigService, customFieldRelationService: CustomFieldRelationService) => FulfillmentService
create
(ctx: RequestContext, orders: Order[], items: OrderItem[], handler: ConfigurableOperationInput) => Promise<Fulfillment | InvalidFulfillmentHandlerError | CreateFulfillmentError>
getOrderItemsByFulfillmentId
(ctx: RequestContext, id: ID) => Promise<OrderItem[]>
getFulfillmentLineSummary
(ctx: RequestContext, id: ID) => Promise<Array<{ orderLine: OrderLine; quantity: number }>>
getFulfillmentsByOrderLineId
(ctx: RequestContext, orderLineId: ID) => Promise<Array<{ fulfillment: Fulfillment; orderItemIds: Set<ID> }>>
getFulfillmentByOrderItemId
(ctx: RequestContext, orderItemId: ID) => Promise<Fulfillment | undefined>
transitionToState
(ctx: RequestContext, fulfillmentId: ID, state: FulfillmentState) => Promise<
| {
fulfillment: Fulfillment;
orders: Order[];
fromState: FulfillmentState;
toState: FulfillmentState;
}
| FulfillmentStateTransitionError
>
getNextStates
(fulfillment: Fulfillment) => ReadonlyArray<FulfillmentState>