public string Order(DrinkCommand command, double credits = 0) { if (command != null) { if (credits >= command.Price) { return(command.CommandString()); } return(new MessageCommand( String.Format("Missing {0} credits.", command.Price - credits) ).CommandString()); } return(null); }
public string Order(DrinkCommand command, double credits = 0) { if (command != null) { if (_beverageQuantityChecker != null && _emailNotifier != null && _beverageQuantityChecker.IsEmpty(command.GetType().ToString())) { _emailNotifier.NotifyMissingDrink(command.GetType().ToString()); return(new MessageCommand( String.Format("The drink is missing, a notification has been sent.") ).CommandString()); } else if (credits >= command.Price) { IncreaseCounter(command); IncreaseCreditCounter(command.Price); return(command.CommandString()); } return(new MessageCommand( String.Format("Missing {0} credits.", command.Price - credits) ).CommandString()); } return(null); }