createPromotion function

Promotion createPromotion (
  1. String displayName,
  2. String id,
  3. String type,
  4. String startDate,
  5. String endDate,
  6. String repeatPattern,
  7. double rate,
  8. ShoppingCategory shoppingCategory
)

Implementation

Promotion createPromotion(
    String displayName,
    String id,
    String type,
    String startDate,
    String endDate,
    String repeatPattern,
    double rate,
    ShoppingCategory shoppingCategory) {
  Promotion promo = Promotion.create();
  promo.id = id;
  promo.displayName = displayName;
  promo.startDate = startDate;
  promo.endDate = endDate;
  promo.type = type;
  promo.repeatPattern = repeatPattern;
  promo.rate = rate;
  promo.category = shoppingCategory;
  return promo;
}