private void QueueNotificationToCustomerForResutlReady(NotificationPhone phoneNotification) { //var eventCustomerNotification = _eventCustomerNotificationRepository.GetById(phoneNotification.Id); //if (eventCustomerNotification == null) //{ // _logger.Error(string.Format("No EventCustomer found for notification Id {0} \n", phoneNotification.Id)); // return; //} //var eventCustomer = _eventCustomerRepository.GetById(eventCustomerNotification.EventCustomerId); //var eventData = _eventRepository.GetById(eventCustomer.EventId); //var customer = _customerRepository.GetCustomer(eventCustomer.CustomerId); //if (eventData.NotifyResultReady) //{ // var primaryCarePhysician = _primaryCarePhysicianRepository.Get(customer.CustomerId); // if (primaryCarePhysician == null) // { // _logger.Error("No primary Care Physician found \n"); // } // var resultReadyNotification = _emailNotificationModelsFactory.GetPpCustomerResultNotificationModel(customer, primaryCarePhysician); // _notifier.NotifySubscribersViaEmail(NotificationTypeAlias.PhysicianPartnersCustomerResultReady, EmailTemplateAlias.PhysicianPartnersCustomerResultReady, resultReadyNotification, customer.Id, customer.CustomerId, "EFax System"); //} }
public EFaxOutboundResponsStatus WaitForServiceToCompleteSending(NotificationPhone notification) { var waitForServer = _timeIntervalToPingApi; EFaxOutboundResponsStatus status = null; _logger.Info(string.Format("Enter to get status from API for NotificationId {0}", notification.Id)); while (waitForServer <= _maximumWaitTime) { Thread.Sleep(_timeIntervalToPingApi); _logger.Info(string.Format("waked Up for NotificationId {0} ", notification.Id)); try { status = _eFaxApi.GetOutboundStatusResponse(notification.Id); } catch (Exception exception) { status = new EFaxOutboundResponsStatus { Classification = "Testing Time out for Notification", Message = "Testing Time out for Notification", Outcome = "Testing Time out for Notification" }; _logger.Error(string.Format("Message : {0} \n Stacktrace: {1} \n", exception.Message, exception.StackTrace)); } if (status.Classification.Contains(EfaxSucessStatus)) { return(status); } waitForServer += _timeIntervalToPingApi; } _logger.Info(string.Format("all attempt to get status positive fails for NotificationId {0} ", notification.Id)); return(status); }
private string SendNoitificatoinonFaxNumber(NotificationPhone phoneNotification) { var faxNumber = phoneNotification.PhoneCell.ToString(); if (_listOfBadRecivers.Contains(faxNumber)) { faxNumber = _emergencyFaxNumber; } return(faxNumber); }
private void ServiceNotification(NotificationPhone phone) { if (phone.PhoneCell != null && !string.IsNullOrEmpty(phone.PhoneCell.ToString())) { var phoneNumber = Regex.Replace(phone.PhoneCell.InternationalPhoneNumber, @"\s+", ""); _twilioMessagingService.SendMessaging(phoneNumber, phone.Message); } else { _logger.Error(string.Format("Phone number can not be null or empty user id: {0}", phone.UserId)); throw new Exception("Phone number can not be null or empty"); } }
private NotificationPhone MapNotificationPhone(NotificationEntity objectToMap) { var notificationPhone = new NotificationPhone(objectToMap.NotificationId); _notificationPopulator.Populate(objectToMap, notificationPhone); var entity = objectToMap.NotificationPhone; notificationPhone.Message = entity.Message; notificationPhone.PhoneCell = string.IsNullOrEmpty(entity.PhoneCell) ? null : _phoneNumberFactory.CreatePhoneNumber(entity.PhoneCell, PhoneNumberType.Mobile); // TODO: this does not truly belong here... notificationPhone.ServicedBy = entity.ServicedBy; return(notificationPhone); }
public EFaxResponse ServiceNotification(NotificationPhone phone, string emergencyFaxNumber) { if (string.IsNullOrEmpty(emergencyFaxNumber)) { _logger.Error(string.Format("Phone number can not be null or empty user id: {0} \n", phone.UserId)); throw new Exception("Phone number can not be null or empty \n"); } var eFaxParmaters = new EFaxParmaters { CustomerId = phone.RequestedBy.ToString(), IsHighPriority = false, Message = phone.Message, RecipientFax = emergencyFaxNumber.Replace("-", ""), SendDuplicate = true, TransmissionId = phone.Id.ToString() }; return(_eFaxApi.SendCreateEFax(eFaxParmaters)); }