1
0
Эх сурвалжийг харах

fix(core): Correctly transition Order on Fulfillment transitions

Michael Bromley 5 жил өмнө
parent
commit
9b2c088f43

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

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