promotion-engine
Group common behavior and functions for compara promotions
Apply promotion to offer product
VERSION 2.0
import PromotionEngine from '@comparaonline/promotion-engine';
const promotion = getSomePromotion();
const offer = getSomeOffer();
const engine = PromotionEngine.initialize(promotion);
const newProduct = engine.applyToProduct(offer.product);
The code snippet above will return a modified version of the offer product, in order to match a marketplace promotional offer.
promotion and offer object must implement Promotion and Offer interfaces, specified at @comparaonline/offers-models