public async Task RedeemRewardAsync(string userPhoneNumber, int rewardId) { var returnValue = await _rewardRedemptionRepository.RedeemRewardAsync(userPhoneNumber, rewardId); switch (returnValue) { case -10: throw new NotFoundException($"Consumer user with phone number {userPhoneNumber} not found."); case -20: throw new BadRequestException("Consumer user has 0 reward points."); case -30: throw new BadRequestException("Consumer user does not meet the minimum member level required for this reward."); case -40: throw new BadRequestException("Consumer user does not have enough points for this reward."); case -50: throw new NotFoundException($"Reward with ID {rewardId} not found."); } var user = await _consumerUserRepository.GetConsumerUserByPhoneNumberAsync(userPhoneNumber); var reward = await _rewardRepository.GetByIdAsync(rewardId); var backgroundTask = _mockBackgroundTaskFactory.CreateMockRewardRedemptionEmailTask( user.EmailAddress, reward.Title, reward.PointsRequired); _backgroundTaskQueue.QueueBackgroundWorkItem(backgroundTask); }