Skip to content

Commit

Permalink
fix(core): Correct cancellation logic with custom Order process
Browse files Browse the repository at this point in the history
Fixes #1104
  • Loading branch information
michaelbromley committed Oct 5, 2021
1 parent 861ef29 commit b8448c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/service/services/order.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ export class OrderService {

private async cancelOrderById(ctx: RequestContext, input: CancelOrderInput) {
const order = await this.getOrderOrThrow(ctx, input.orderId);
if (order.state === 'AddingItems' || order.state === 'ArrangingPayment') {
if (order.active) {
return true;
} else {
const lines: OrderLineInput[] = order.lines.map(l => ({
Expand Down Expand Up @@ -1055,7 +1055,7 @@ export class OrderService {
if (!idsAreEqual(order.id, input.orderId)) {
return new MultipleOrderError();
}
if (order.state === 'AddingItems' || order.state === 'ArrangingPayment') {
if (order.active) {
return new CancelActiveOrderError(order.state);
}
const fullOrder = await this.findOne(ctx, order.id);
Expand Down

0 comments on commit b8448c1

Please sign in to comment.