public DroppedKerbService(IVerintServiceGateway verintServiceGateway, IMailHelper mailHelper, IOptions <VerintOptions> verintOptions, IOptions <ConfirmIntegrationFormOptions> VOFConfiguration) { _verintServiceGateway = verintServiceGateway; _mailHelper = mailHelper; _verintOptions = verintOptions.Value; _VOFConfiguration = VOFConfiguration.Value; }
public static Case ToCase(this AbandonedVehicleReport model, ConfirmIntegrationFormOptions _VOFConfiguration, VerintOptions _verintOptions) { var crmCase = new Case { EventCode = _VOFConfiguration.EventId, EventTitle = _verintOptions.EventTitle, Classification = _verintOptions.Classification, RaisedByBehaviour = RaisedByBehaviourEnum.Individual, FurtherLocationInformation = model.FurtherDetails, Description = GenerateDescription(model), Customer = new Customer { Forename = model.FirstName, Surname = model.LastName, Email = model.Email, Telephone = model.Phone, Address = new Address { AddressLine1 = model.CustomersAddress.AddressLine1, AddressLine2 = model.CustomersAddress.AddressLine2, City = model.CustomersAddress.Town, Postcode = model.CustomersAddress.Postcode, UPRN = model.CustomersAddress.PlaceRef, Description = model.CustomersAddress.ToString() } } }; if (!string.IsNullOrWhiteSpace(model.StreetAddress?.PlaceRef)) { crmCase.AssociatedWithBehaviour = AssociatedWithBehaviourEnum.Street; crmCase.Street = new Street { Reference = model.StreetAddress.PlaceRef, Description = model.StreetAddress.ToString() }; } return(crmCase); }
public ConfirmIntegrationFormOptionsMapperTests() { _verintOptions = new VerintOptions { Options = new List <Option> { new Option { EventCode = 111111, Type = "pavement", ServiceCode = "HWAY", SubjectCode = "CWFD", ClassCode = "SERV" }, new Option { EventCode = 222222, Type = "home", ServiceCode = "HWAY", SubjectCode = "CWFD", ClassCode = "SERV" }, new Option { EventCode = 333333, Type = "road", ServiceCode = "HWAY", SubjectCode = "CWFD", ClassCode = "SERV" }, new Option { EventCode = 4444444, Type = "business", ServiceCode = "HWAY", SubjectCode = "CWFD", ClassCode = "SERV" } } }; _confirmAttributeFormOptions = new ConfirmAttributeFormOptions { FloodingSourceReported = new List <Config> { new Config { Type = "river", Value = "RIV" }, new Config { Type = "culverted", Value = "CULV" } }, FloodLocationInProperty = new List <Config> { new Config { Type = "cellarOrBasement", Value = "BAS" }, new Config { Type = "driveway", Value = "DRV" }, new Config { Type = "yes", Value = "GARA" }, new Config { Type = "garden", Value = "GAR" } }, CommercialOrDomestic = new List <Config> { new Config { Type = "home", Value = "DOM" }, new Config { Type = "business", Value = "COM" } } }; }
public static FloodingConfiguration ToConfig(this FloodingRequest request, ConfirmAttributeFormOptions attributesFormOptions, VerintOptions verintOptions) { var verintConfigValue = request.WhatDoYouWantToReport.Equals("flood") ? request.WhereIsTheFlood : request.WhatDoYouWantToReport; var verintConfig = verintOptions.Options.First(_ => _.Type.Equals(verintConfigValue)); var formOptions = new ConfirmFloodingIntegrationFormOptions { EventId = verintConfig.EventCode, ClassCode = verintConfig.ClassCode, ServiceCode = verintConfig.ServiceCode, SubjectCode = verintConfig.SubjectCode }; formOptions.FloodingSourceReported = attributesFormOptions.FloodingSourceReported.FirstOrDefault(_ => _.Type.Equals(request.WhereIsTheFloodingComingFrom))?.Value ?? string.Empty; formOptions.DomesticOrCommercial = attributesFormOptions.CommercialOrDomestic.FirstOrDefault(_ => _.Type.Equals(request.WhereIsTheFlood))?.Value ?? string.Empty; if (request.WhereIsTheFlood.Equals("home")) { if (request.WhereInThePropertyIsTheFlood.Equals("garage")) { formOptions.LocationOfFlooding = attributesFormOptions.FloodLocationInProperty.First(_ => _.Type.Equals(request.IsTheGarageConnectedToYourHome)).Value; } else { formOptions.LocationOfFlooding = attributesFormOptions.FloodLocationInProperty .First(_ => _.Type.Equals(request.WhereInThePropertyIsTheFlood)).Value; } } if (request.WhereIsTheFlood.Equals("business")) { if (request.IsTheFloodInsideOrOutsideProperty.Equals("inside")) { formOptions.LocationOfFlooding = attributesFormOptions.FloodLocationInProperty .First(_ => _.Type.Equals(request.WhereInThePropertyIsTheFlood)).Value; } else { formOptions.LocationOfFlooding = attributesFormOptions.FloodLocationInProperty .First(_ => _.Type.Equals("garden")).Value; } } formOptions.XCoordinate = request.Map?.Lng; formOptions.YCoordinate = request.Map?.Lat; return(new FloodingConfiguration { ConfirmIntegrationFormOptions = formOptions, VerintOption = verintConfig }); }