public OnlineSchedulingCustomerInfoEditModel GetPaymentInfo(string guid) { var onlineRequestValidationModel = _tempcartService.ValidateOnlineRequest(guid); if (onlineRequestValidationModel.RequestStatus != OnlineRequestStatus.Valid) { return new OnlineSchedulingCustomerInfoEditModel { RequestValidationModel = onlineRequestValidationModel } } ; var tempCart = onlineRequestValidationModel.TempCart; var model = new OnlineSchedulingCustomerInfoEditModel { ProcessAndCartViewModel = _eventSchedulerService.GetOnlineCart(tempCart), EventCustomerOrderSummaryModel = _eventSchedulerService.GetEventCustomerOrderSummaryModel(guid), CustomerEditModel = new SchedulingCustomerEditModel { EnableTexting = _enableTexting }, SourceCodeApplyEditModel = _eventSchedulerService.GetSourceCodeApplied(tempCart), RequestValidationModel = onlineRequestValidationModel }; var newsletterprompt = Convert.ToBoolean(_configurationSettingRepository.GetConfigurationValue(ConfigurationSettingName.EnableNewsletterPrompt)); if (newsletterprompt && model.EventCustomerOrderSummaryModel != null && model.EventCustomerOrderSummaryModel.EventType == EventType.Retail) { model.RequestForNewsLetterDescription = _toolTipRepository.GetToolTipContentByTag(ToolTipType.OnlineNewsletterDescription); model.ShowNewsLetterPrompt = true; } model.EventCustomerOrderSummaryModel = _eventSchedulerService.GetEventCustomerOrderSummaryModel(guid); model.StateList = _stateRepository.GetAllStates().ToList().Select(x => new OrderedPair <long, string>(x.Id, x.Name)); var customer = tempCart.CustomerId.HasValue ? _customerRepository.GetCustomer(tempCart.CustomerId.Value) : null; if (customer == null && tempCart.ProspectCustomerId.HasValue && tempCart.ProspectCustomerId.Value > 0) { model.CustomerEditModel = _prospectCustomerService.GetforProspectCustomerId(tempCart.ProspectCustomerId.Value); } else if (customer != null) { model.CustomerEditModel = Mapper.Map <Customer, SchedulingCustomerEditModel>(customer); model.CustomerEditModel.ShippingAddress = Mapper.Map <Address, AddressEditModel>(customer.Address); model.CustomerEditModel.ConfirmationToEnablTexting = customer.EnableTexting; //model.CustomerEditModel.ShippingAddress.Id = tempCart.ShippingAddressId.HasValue ? tempCart.ShippingAddressId.Value : 0; } //payment if (model.PaymentEditModel == null) { model.PaymentEditModel = new PaymentEditModel { PaymentFlow = PaymentFlow.In, Amount = model.EventCustomerOrderSummaryModel.AmountDue.HasValue ? model.EventCustomerOrderSummaryModel.AmountDue.Value : 0, ShippingAddressSameAsBillingAddress = true }; } if (customer != null && ((customer.BillingAddress != null && customer.BillingAddress.StreetAddressLine1 != OnlineAddress1) || (customer.Address != null && customer.Address.StreetAddressLine1 != OnlineAddress1))) { model.PaymentEditModel.ExistingBillingAddress = Mapper.Map <Address, AddressEditModel>(customer.BillingAddress ?? customer.Address); model.PaymentEditModel.ExistingBillingAddress.Id = customer.BillingAddress != null ? customer.BillingAddress.Id : 0; model.PaymentEditModel.ExistingShippingAddress = Mapper.Map <Address, AddressEditModel>(customer.BillingAddress ?? customer.Address); model.PaymentEditModel.ExistingShippingAddress.Id = customer.Address != null ? customer.Address.Id : 0; } model.RequestForNewsLetter = model.EventCustomerOrderSummaryModel != null && model.EventCustomerOrderSummaryModel.EventType == EventType.Retail; model.PaymentEditModel.AllowedPaymentTypes = new[] { new OrderedPair <long, string>(PaymentType.CreditCard.PersistenceLayerId, PaymentType.CreditCard.Name), new OrderedPair <long, string>(PaymentType.ElectronicCheck.PersistenceLayerId, PaymentType.ElectronicCheck.Name), new OrderedPair <long, string>(PaymentType.GiftCertificate.PersistenceLayerId, PaymentType.GiftCertificate.Name) }; var payLaterOnlineRegistration = Convert.ToBoolean(_configurationSettingRepository.GetConfigurationValue(ConfigurationSettingName.PayLaterOnlineRegistration)); if (payLaterOnlineRegistration) { var payLaterOption = new[] { new OrderedPair <long, string>(PaymentType.Onsite_Value, PaymentType.PayLater_Text) }; model.PaymentEditModel.AllowedPaymentTypes = model.PaymentEditModel.AllowedPaymentTypes.Concat(payLaterOption); } var eventId = model.EventCustomerOrderSummaryModel.EventId.HasValue ? model.EventCustomerOrderSummaryModel.EventId.Value : 0; var packageId = model.SourceCodeApplyEditModel.Package != null ? model.SourceCodeApplyEditModel.Package.FirstValue : 0; var addOnTestIds = model.SourceCodeApplyEditModel.SelectedTests != null?model.SourceCodeApplyEditModel.SelectedTests.Select(st => st.FirstValue).ToArray() : null; var testCoveredByInsurance = _eligibilityService.CheckTestCoveredByinsurance(eventId, packageId, addOnTestIds); if (testCoveredByInsurance) { var insurancePaymentOption = new[] { new OrderedPair <long, string>(PaymentType.Insurance.PersistenceLayerId, PaymentType.Insurance.Name) }; model.PaymentEditModel.AllowedPaymentTypes = model.PaymentEditModel.AllowedPaymentTypes.Concat(insurancePaymentOption); } if (model.EventCustomerOrderSummaryModel.AmountDue != null && model.EventCustomerOrderSummaryModel.AmountDue > 0) { if (payLaterOnlineRegistration) { model.PaymentEditModel.Payments = new[] { new PaymentInstrumentEditModel { Amount = model.EventCustomerOrderSummaryModel.AmountDue.Value, PaymentType = Convert.ToInt32(PaymentType.Onsite_Value) } }; } else { model.PaymentEditModel.Payments = new[] { new PaymentInstrumentEditModel { Amount = model.EventCustomerOrderSummaryModel.AmountDue.Value, ChargeCard = new ChargeCardPaymentEditModel() { ChargeCard = (tempCart.ChargeCardId.HasValue && tempCart.ChargeCardId.Value > 0) ?_chargeCardRepository.GetById(tempCart.ChargeCardId.Value) :new ChargeCard() } } }; if (testCoveredByInsurance && tempCart.EligibilityId.HasValue && tempCart.EligibilityId.Value > 0 && tempCart.ChargeCardId.HasValue && tempCart.ChargeCardId.Value > 0) { var insurancePayment = new[] { new PaymentInstrumentEditModel { Insurance = new InsurancePaymentEditModel { EligibilityId = tempCart.EligibilityId.Value, ChargeCardId = tempCart.ChargeCardId.Value } } }; model.PaymentEditModel.Payments = model.PaymentEditModel.Payments.Concat(insurancePayment); } } } else { model.PaymentEditModel.ShippingAddressSameAsBillingAddress = false; } return(model); }
public OnlineCustomerPersonalInformationEditModel GetCustomerInfo(string guid) { var onlineRequestValidationModel = _tempcartService.ValidateOnlineRequest(guid); var model = new OnlineCustomerPersonalInformationEditModel { RequestValidationModel = onlineRequestValidationModel }; if (onlineRequestValidationModel.RequestStatus != OnlineRequestStatus.Valid) { return(model); } var shippingAddress = new AddressEditModel() { StreetAddressLine1 = OnlineAddress1, City = _onlineCity, StateId = _onlineStateId, CountryId = _onlineCountryId, ZipCode = _onlineZip }; model.CustomerEditModel = new SchedulingCustomerEditModel { EnableTexting = _enableTexting, EnableVoiceMail = _enableVoiceMail, ShippingAddress = shippingAddress }; var tempCart = onlineRequestValidationModel.TempCart; var customer = tempCart.CustomerId.HasValue ? _customerRepository.GetCustomer(tempCart.CustomerId.Value) : null; if (customer == null && tempCart.ProspectCustomerId.HasValue && tempCart.ProspectCustomerId.Value > 0) { model.CustomerEditModel = _prospectCustomerService.GetforProspectCustomerId(tempCart.ProspectCustomerId.Value); if (model.CustomerEditModel.ShippingAddress.StreetAddressLine1 == OnlineAddress1) { model.CustomerEditModel.ShippingAddress = shippingAddress; } } else if (customer != null) { model.CustomerEditModel = Mapper.Map <Customer, SchedulingCustomerEditModel>(customer); model.CustomerEditModel.ShippingAddress = Mapper.Map <Address, AddressEditModel>(customer.Address); model.CustomerEditModel.ConfirmationToEnablTexting = customer.EnableTexting; model.CustomerEditModel.ConfirmationToEnableVoiceMail = customer.EnableVoiceMail; } model.CustomerEditModel.EnableTexting = _enableTexting; model.CustomerEditModel.EnableVoiceMail = _enableVoiceMail; model.CustomerEditModel.MarketingSource = tempCart.MarketingSource; if (tempCart.Dob.HasValue && !model.CustomerEditModel.DateofBirth.HasValue) { model.CustomerEditModel.DateofBirth = tempCart.Dob.Value; } if (!string.IsNullOrEmpty(tempCart.Gender) && !(model.CustomerEditModel.Gender.HasValue && model.CustomerEditModel.Gender.Value > 0)) { model.CustomerEditModel.Gender = (int)((Gender)System.Enum.Parse(typeof(Gender), tempCart.Gender, true)); } if (tempCart.EventId.HasValue && tempCart.EventId.Value > 0) { var eventData = _eventRepository.GetById(tempCart.EventId.Value); if (eventData.AccountId.HasValue && eventData.AccountId.Value > 0) { var account = _corporateAccountRepository.GetbyEventId(tempCart.EventId.Value); model.CustomerEditModel.InsuranceIdLabel = (account != null && !string.IsNullOrEmpty(account.MemberIdLabel)) ? account.MemberIdLabel : string.Empty; } model.CustomerEditModel.InsuranceIdRequired = eventData.InsuranceIdRequired; var eventHospitalPartner = _hospitalPartnerRepository.GetEventHospitalPartnersByEventId(tempCart.EventId.Value); if (eventHospitalPartner != null) { model.CustomerEditModel.CaptureSsn = eventHospitalPartner.CaptureSsn; } } //model.ShippingOptions = _onlineShippingService.GetShippingOption(tempCart); return(model); }