def apply( self, order: Order ): """ Apply the promotion euromania. :param Order order: order """ for chips in order.chips(): chips().set_price(price=1.0) order.promotions().append('euromania')
def apply( self, order: Order ): """ Apply the promotion burrimenu. 15% hamburgers. :param Order order: order :return order: order with promotion applied """ for hamburger in order.hamburgers(): hamburger.set_price(price=hamburger.price() * (100 - 15) / 100) order.promotions().append('burrimenu')
def normalize(order: Order) -> Dict[str, Union[str, int]]: return dict( barista=order.barista() or None, hamburgers=[ HamburgerNormalizer.normalize(hamburger=hamburger) for hamburger in order.hamburgers() ], chips=[ ChipsNormalizer.normalize(chips=chips) for chips in order.chips() ], drinks=[ DrinkNormalizer.normalize(drink=drink) for drink in order.drinks() ], price=order.price(), dt_created=order.dt_created(), is_ready=order.is_ready(), promotions=order.promotions(), )
def apply(self, order: Order): order.promotions().append('jarramania')