예제 #1
0
        public void RequestEmailReminder(string phoneNumber)
        {
            var candidates = _candidateReadRepository.GetAllCandidatesWithPhoneNumber(phoneNumber);

            var verified = false;

            foreach (var candidate in candidates)
            {
                if (candidate.CommunicationPreferences.VerifiedMobile)
                {
                    verified = true;

                    _communicationService.SendMessageToCandidate(candidate.EntityId, MessageTypes.SendEmailReminder,
                                                                 new[]
                    {
                        new CommunicationToken(CommunicationTokens.CandidateMobileNumber, phoneNumber),
                        new CommunicationToken(CommunicationTokens.UserEmailAddress, candidate.RegistrationDetails.EmailAddress)
                    });
                }
            }

            if (!verified)
            {
                throw new CustomException(Domain.Entities.ErrorCodes.EntityStateError);
            }
        }