Procházet zdrojové kódy

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

Closes #1322
Hubert před 4 roky
rodič
revize
fc739c50ee

+ 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,