瀏覽代碼

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

Closes #1322
Hubert 4 年之前
父節點
當前提交
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,