public ActionResult GetMemberProfile() { //TO DO: Get member id from database var member = Services.MemberService.GetByUsername(User.Identity.Name); string memberId = member.GetValue("yNumber").ToString(); try { SubscriberInformation subInfo = svr.GetMemberInformation(memberId); if (subInfo != null) { MembershipInformationViewModel model = svr.GetMemberInformationViewModel(subInfo); return(PartialView("MembershipInformationPartial", model)); } else { logger.Error("No information for the member was available in the WEB ODS for member id: " + memberId); return(PartialView("MembershipInformationPartial", new MembershipInformationViewModel())); } } catch (Exception ex) { logger.Error("No Member profile information for member id: " + memberId + ", because of error: " + ex.Message); return(PartialView("MembershipInformationPartial", new MembershipInformationViewModel())); } }
internal SubscriberInformation GetMemberInformation(string memberId) { HttpWebRequest req = (HttpWebRequest)WebRequest.Create(apiUri + "/MemberInformation/GetMemberInformation?memberId=" + memberId); req.ContentType = "application/json"; req.Method = "Get"; req.AllowAutoRedirect = false; HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); String output = RespsoneToString(resp); try { if (output == "null" || string.IsNullOrEmpty(output)) { return(null); } else { System.Web.Script.Serialization.JavaScriptSerializer jser = new System.Web.Script.Serialization.JavaScriptSerializer(); object obj = jser.Deserialize(output, typeof(SubscriberInformation)); SubscriberInformation result = (SubscriberInformation)obj; return(result); } } catch (Exception ex) { throw ex; } }
public void ValidateSubscriberAndProvider_ShouldReturnValidStatus() { // Arrange var dialogServiceMock = new Mock <IDialogService>(); var api = new ChewsiApi(dialogServiceMock.Object); ProviderInformation provider = GetValidProvider(); SubscriberInformation subscriber = GetValidSubscriber(); ProviderAddressInformation providerAddress = GetValidProviderAddress(); // Act ValidateSubscriberAndProviderResponse response = api.ValidateSubscriberAndProvider(provider, providerAddress, subscriber); // Assert // Validate provider Assert.IsNotNull(response.ProviderID); Assert.IsNull(response.ProviderValidationMessage); Assert.AreEqual("Valid", response.ProviderValidationStatus); // Validate subscriber Assert.AreEqual("4", response.SubscriberID); Assert.IsNull(response.SubscriberValidationMessage); Assert.AreEqual("Valid", response.SubscriberValidationStatus); Assert.AreEqual("1", response.OfficeNumber); Assert.AreEqual(true, response.ValidationPassed); }
public void ValidateSubscriberAndProvider_WhenSubscriberDataIsIncorrect_ShouldReturnSubscriberNotFoundStatus() { // Arrange var dialogServiceMock = new Mock <IDialogService>(); var api = new ChewsiApi(dialogServiceMock.Object); ProviderInformation provider = GetValidProvider(); SubscriberInformation subscriber = GetValidSubscriber(); subscriber.Id = "123456"; // API checks First Name and Chewsi Id ProviderAddressInformation providerAddress = GetValidProviderAddress(); // Act ValidateSubscriberAndProviderResponse response = api.ValidateSubscriberAndProvider(provider, providerAddress, subscriber); // Assert // Validate provider Assert.AreEqual("4074437", response.ProviderID); Assert.IsNull(response.ProviderValidationMessage); Assert.AreEqual("Valid", response.ProviderValidationStatus); // Validate subscriber Assert.IsNull(response.SubscriberID); Assert.AreEqual("Please validate that the subscriber's Chewsi ID and First Name match the information shown before proceeding. If the information does not match, the Chewsi ID may have been keyed into the practice management system incorrectly. Please ask the subscriber for their Chewsi ID to validate.", response.SubscriberValidationMessage); Assert.AreEqual("Subscriber Not Found", response.SubscriberValidationStatus); Assert.AreEqual("1", response.OfficeNumber); Assert.AreEqual(false, response.ValidationPassed); }
public void ValidateSubscriberAndProvider_WhenProviderDataIsIncorrect_ShouldReturnProviderNotFoundStatus() { // Arrange var dialogServiceMock = new Mock <IDialogService>(); var api = new ChewsiApi(dialogServiceMock.Object); ProviderInformation provider = GetValidProvider(); SubscriberInformation subscriber = GetValidSubscriber(); ProviderAddressInformation providerAddress = GetValidProviderAddress(); providerAddress.RenderingAddress1 += " test"; // Act ValidateSubscriberAndProviderResponse response = api.ValidateSubscriberAndProvider(provider, providerAddress, subscriber); // Assert // Validate provider Assert.IsNull(response.ProviderID); Assert.AreEqual("We did not find the provider for which this claim is being submitted for in the list of Chewsi registered providers. Please validate that the claim is being submitted under a provider who has already registered themselves under the Chewsi network.", response.ProviderValidationMessage); Assert.AreEqual("Provider Not Found", response.ProviderValidationStatus); // Validate subscriber Assert.AreEqual("4", response.SubscriberID); Assert.IsNull(response.SubscriberValidationMessage); Assert.AreEqual("Valid", response.SubscriberValidationStatus); //TODO Assert.AreEqual("", response.OfficeNumber); Assert.AreEqual(false, response.ValidationPassed); }
private async Task DispatchToSubscriberAsync( IDomainEvent domainEvent, ISubscribe subscriber, SubscriberInformation subscriberInformation, bool swallowException, CancellationToken cancellationToken) { _log.Verbose(() => $"Calling HandleAsync on handler '{subscriber.GetType().PrettyPrint()}' " + $"for aggregate event '{domainEvent.EventType.PrettyPrint()}'"); await _dispatchToSubscriberResilienceStrategy.BeforeHandleEventAsync( subscriber, domainEvent, cancellationToken) .ConfigureAwait(false); try { await subscriberInformation.HandleMethod( subscriber, domainEvent, cancellationToken) .ConfigureAwait(false); await _dispatchToSubscriberResilienceStrategy.HandleEventSucceededAsync( subscriber, domainEvent, cancellationToken) .ConfigureAwait(false); } catch (Exception e) when(swallowException) { _log.Error(e, $"Subscriber '{subscriberInformation.SubscriberType.PrettyPrint()}' threw " + $"'{e.GetType().PrettyPrint()}' while handling '{domainEvent.EventType.PrettyPrint()}': {e.Message}"); await _dispatchToSubscriberResilienceStrategy.HandleEventFailedAsync( subscriber, domainEvent, e, true, cancellationToken) .ConfigureAwait(false); } catch (Exception e) when(!swallowException) { await _dispatchToSubscriberResilienceStrategy.HandleEventFailedAsync( subscriber, domainEvent, e, false, cancellationToken) .ConfigureAwait(false); throw; } }
internal MembershipInformationViewModel GetMemberInformationViewModel(SubscriberInformation subInfo) { MembershipInformationViewModel model = new MembershipInformationViewModel(); model.MemberId = subInfo.MemberId; model.MemberName = subInfo.FirstName + " " + subInfo.LastName; if (!string.IsNullOrEmpty(subInfo.SSN)) { model.SSN = "XXX-XX-" + subInfo.SSN.Substring(5, 4); } model.SubscriberFlag = subInfo.SubscriberFlag; model.EnrolledAs = subInfo.SubscriberFlag == "Y" ? "Subscriber" : "Dependent"; if (!string.IsNullOrEmpty(subInfo.Gender)) { model.Gender = subInfo.Gender == "M" ? "Male" : "Female"; } if (subInfo.DOB < DateTime.Today) { model.DOB = subInfo.DOB; } if (!string.IsNullOrEmpty(subInfo.MaritalStatus)) { model.MaritalStatus = subInfo.MaritalStatus; } model.Relationship = subInfo.Relationship; model.MailingAddressLine1 = subInfo.MailingAddressLine1; model.MailingAddressLine2 = subInfo.MailingAddressLine2; model.MailingAddressLine3 = subInfo.MailingAddressLine3; model.MailingCity = subInfo.MailingCity; model.MailingState = subInfo.MailingState; if (!string.IsNullOrEmpty(subInfo.MailingZipCode)) { if (subInfo.MailingZipCode.Length > 5) { model.MailingZipCode = string.Format("{0}-{1}", subInfo.MailingZipCode.Substring(0, 5), subInfo.MailingZipCode.Substring(5)); } else { model.MailingZipCode = subInfo.MailingZipCode; } } model.PhysicalAddressLine1 = subInfo.PhysicalAddressLine1; model.PhysicalAddressLine2 = subInfo.PhysicalAddressLine2; model.PhysicalAddressLine3 = subInfo.PhysicalAddressLine3; model.PhysicalCity = subInfo.PhysicalCity; model.PhysicalState = subInfo.PhysicalState; if (!string.IsNullOrEmpty(subInfo.PhysicalZipCode)) { if (subInfo.PhysicalZipCode.Length > 5) { model.PhysicalZipCode = string.Format("{0}-{1}", subInfo.PhysicalZipCode.Substring(0, 5), subInfo.PhysicalZipCode.Substring(5)); } else { model.PhysicalZipCode = subInfo.PhysicalZipCode; } } if (!string.IsNullOrEmpty(subInfo.HomePhone)) { if (subInfo.HomePhone.Length == 10) { model.HomePhone = string.Format("{0}-{1}-{2}", subInfo.HomePhone.Substring(0, 3), subInfo.HomePhone.Substring(3, 3), subInfo.HomePhone.Substring(6, 4)); } } if (!string.IsNullOrEmpty(subInfo.MobilePhone)) { if (subInfo.MobilePhone.Length == 10) { model.MobilePhone = string.Format("{0}-{1}-{2}", subInfo.MobilePhone.Substring(0, 3), subInfo.MobilePhone.Substring(3, 3), subInfo.MobilePhone.Substring(6, 4)); } } model.EmailAddress = subInfo.EmailAddress; model.CommPreference = subInfo.CommunicationPreference; model.ClaimStatus = subInfo.Status; model.GroupName = subInfo.GroupName; model.PlanName = subInfo.PlanName; model.Market = subInfo.Market; model.CoverageStartDate = subInfo.EnrolledOn; model.MonthlyPremiumAmount = (decimal)subInfo.PremiumAmount; model.CoverageType = subInfo.CoverageType; if (subInfo.Dependents.Count > 0) { foreach (DependentInformation dep in subInfo.Dependents) { dep.Gender = dep.Gender == "M" ? "Male" : "Female"; } } model.Dependents = subInfo.Dependents; return(model); }
void OnSubscriber(SubscriberInformation user) { SetUserStatus(user.Service, user.Username, user.Status); }
void OnSubscription(SubscriberInformation subscriber) { AddSubscription(context.GetModule <UserModule>().GetExistingUser(subscriber.Service, subscriber.Username).ID, subscriber.Status); }
void OnSubscriber(SubscriberInformation subscriber) { Dispatcher.Invoke(() => AddStatus($"New Subscriber {subscriber.Username} ({subscriber.PlanName}).", Colors.DarkBlue)); }
private async Task DispatchToSubscriberAsync( IDomainEvent domainEvent, ISubscribe subscriber, SubscriberInformation subscriberInformation, bool swallowException, CancellationToken cancellationToken) { _logger.LogTrace("Calling HandleAsync on handler {SubscriberType} for aggregate event {EventType}", subscriber.GetType().PrettyPrint(), domainEvent.EventType.PrettyPrint()); await _dispatchToSubscriberResilienceStrategy.BeforeHandleEventAsync( subscriber, domainEvent, cancellationToken) .ConfigureAwait(false); try { await subscriberInformation.HandleMethod( subscriber, domainEvent, cancellationToken) .ConfigureAwait(false); await _dispatchToSubscriberResilienceStrategy.HandleEventSucceededAsync( subscriber, domainEvent, cancellationToken) .ConfigureAwait(false); } catch (Exception e) when(swallowException) { _logger.LogError( e, "Subscriber {SubscriberType} threw {ExceptionType} while handling {EventType}: {ExceptionMessage}", subscriberInformation.SubscriberType.PrettyPrint(), e.GetType().PrettyPrint(), domainEvent.EventType.PrettyPrint(), e.Message); await _dispatchToSubscriberResilienceStrategy.HandleEventFailedAsync( subscriber, domainEvent, e, true, cancellationToken) .ConfigureAwait(false); } catch (Exception e) when(!swallowException) { await _dispatchToSubscriberResilienceStrategy.HandleEventFailedAsync( subscriber, domainEvent, e, false, cancellationToken) .ConfigureAwait(false); throw; } }