Просмотр исходного кода

fix(core): Fix PromotionActions not passing state correctly (#1323)

Closes #1322
Hubert 4 лет назад
Родитель
Сommit
fc739c50ee
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      packages/core/src/config/promotion/promotion-action.ts

+ 2 - 2
packages/core/src/config/promotion/promotion-action.ts

@@ -309,7 +309,7 @@ export class PromotionOrderAction<
 
     /** @internal */
     execute(ctx: RequestContext, order: Order, args: ConfigArg[], state: PromotionState) {
-        const actionState = this.conditions ? pick(state, Object.keys(this.conditions)) : {};
+        const actionState = this.conditions ? pick(state, this.conditions.map(c => c.code)) : {};
         return this.executeFn(ctx, order, this.argsArrayToHash(args), actionState as ConditionState<U>);
     }
 }
@@ -340,7 +340,7 @@ export class PromotionShippingAction<
         args: ConfigArg[],
         state: PromotionState,
     ) {
-        const actionState = this.conditions ? pick(state, Object.keys(this.conditions)) : {};
+        const actionState = this.conditions ? pick(state, this.conditions.map(c => c.code)) : {};
         return this.executeFn(
             ctx,
             shippingLine,