Browse Source

fix(core): Correctly transition Order on Fulfillment transitions

Michael Bromley 5 years ago
parent
commit
9b2c088f43
1 changed files with 2 additions and 2 deletions
  1. 2 2
      packages/core/src/service/services/order.service.ts

+ 2 - 2
packages/core/src/service/services/order.service.ts

@@ -493,7 +493,7 @@ export class OrderService {
         const transitionOrderIfStateAvailable = (state: OrderState) =>
             nextOrderStates.includes(state) && this.transitionToState(ctx, order.id, state);
 
-        if (fromState === 'Pending' && toState === 'Shipped') {
+        if (toState === 'Shipped') {
             const orderWithFulfillment = await this.getOrderWithFulfillments(ctx, order.id);
             if (orderItemsAreShipped(orderWithFulfillment)) {
                 await transitionOrderIfStateAvailable('Shipped');
@@ -501,7 +501,7 @@ export class OrderService {
                 await transitionOrderIfStateAvailable('PartiallyShipped');
             }
         }
-        if (fromState === 'Shipped' && toState === 'Delivered') {
+        if (toState === 'Delivered') {
             const orderWithFulfillment = await this.getOrderWithFulfillments(ctx, order.id);
             if (orderItemsAreDelivered(orderWithFulfillment)) {
                 await transitionOrderIfStateAvailable('Delivered');