diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a48cc11fc5..c2814dcd13 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,7 +20,7 @@ resources: - repository: das-platform-building-blocks type: github name: SkillsFundingAgency/das-platform-building-blocks - ref: refs/tags/0.4.34 + ref: refs/tags/0.4.61 endpoint: SkillsFundingAgency steps: diff --git a/src/SFA.DAS.EAS.Api/App_Start/WebApiConfig.cs b/src/SFA.DAS.EAS.Api/App_Start/WebApiConfig.cs index 51a3dfe7c8..1b559241d5 100644 --- a/src/SFA.DAS.EAS.Api/App_Start/WebApiConfig.cs +++ b/src/SFA.DAS.EAS.Api/App_Start/WebApiConfig.cs @@ -30,7 +30,6 @@ public static void Register(HttpConfiguration config) c.AddRegistry(); c.AddRegistry(); c.AddRegistry(); - c.AddRegistry(); c.AddRegistry(); c.AddRegistry(); c.AddRegistry(); @@ -40,7 +39,6 @@ public static void Register(HttpConfiguration config) c.AddRegistry(); c.AddRegistry(); c.AddRegistry(); - c.AddRegistry(); c.AddRegistry(); c.AddRegistry(); c.AddRegistry(); diff --git a/src/SFA.DAS.EAS.Support.Infrastructure/SFA.DAS.EAS.Support.Infrastructure.csproj b/src/SFA.DAS.EAS.Support.Infrastructure/SFA.DAS.EAS.Support.Infrastructure.csproj index 31758b167c..6602873c91 100644 --- a/src/SFA.DAS.EAS.Support.Infrastructure/SFA.DAS.EAS.Support.Infrastructure.csproj +++ b/src/SFA.DAS.EAS.Support.Infrastructure/SFA.DAS.EAS.Support.Infrastructure.csproj @@ -67,10 +67,9 @@ - - + + - @@ -114,7 +113,7 @@ 1.2.1 - 2.1.1 + 2.3.0 4.7.1 diff --git a/src/SFA.DAS.EAS.Support.Infrastructure/Services/LevyTokenHttpClientMaker.cs b/src/SFA.DAS.EAS.Support.Infrastructure/Services/LevyTokenHttpClientMaker.cs index d2db84c140..73dfc572d8 100644 --- a/src/SFA.DAS.EAS.Support.Infrastructure/Services/LevyTokenHttpClientMaker.cs +++ b/src/SFA.DAS.EAS.Support.Infrastructure/Services/LevyTokenHttpClientMaker.cs @@ -1,31 +1,25 @@ using HMRC.ESFA.Levy.Api.Client; using SFA.DAS.EAS.Support.Infrastructure.Settings; using SFA.DAS.TokenService.Api.Client; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net.Http; -using System.Text; using System.Threading.Tasks; namespace SFA.DAS.EAS.Support.Infrastructure.Services { public class LevyTokenHttpClientMaker: ILevyTokenHttpClientFactory { - private readonly IHmrcApiBaseUrlConfig _hmrcApiBaseUrlConfig; - private readonly ITokenServiceApiClientConfiguration _levySubmissionsApiConfiguration; + private readonly IHmrcApiClientConfiguration _hmrcApiBaseUrlConfig; + private readonly ITokenServiceApiClient _tokenServiceApiClient; - public LevyTokenHttpClientMaker(ITokenServiceApiClientConfiguration levySubmissionsApiConfiguration, IHmrcApiBaseUrlConfig hmrcApiBaseUrlConfig) + public LevyTokenHttpClientMaker(ITokenServiceApiClient tokenServiceApiClient, IHmrcApiClientConfiguration hmrcApiBaseUrlConfig) { _hmrcApiBaseUrlConfig = hmrcApiBaseUrlConfig; - _levySubmissionsApiConfiguration = levySubmissionsApiConfiguration; + _tokenServiceApiClient = tokenServiceApiClient; } public async Task GetLevyHttpClient() { - var tokenService = new TokenServiceApiClient(_levySubmissionsApiConfiguration); - var tokenResult = await tokenService.GetPrivilegedAccessTokenAsync(); - var httpclient = ApprenticeshipLevyApiClient.CreateHttpClient(tokenResult.AccessCode, _hmrcApiBaseUrlConfig.HmrcApiBaseUrl); + var tokenResult = await _tokenServiceApiClient.GetPrivilegedAccessTokenAsync(); + var httpclient = ApprenticeshipLevyApiClient.CreateHttpClient(tokenResult.AccessCode, _hmrcApiBaseUrlConfig.ApiBaseUrl); return new ApprenticeshipLevyApiClient(httpclient); } diff --git a/src/SFA.DAS.EAS.Support.Infrastructure/Settings/HmrcApiBaseUrlConfig.cs b/src/SFA.DAS.EAS.Support.Infrastructure/Settings/HmrcApiBaseUrlConfig.cs deleted file mode 100644 index 944b3bef23..0000000000 --- a/src/SFA.DAS.EAS.Support.Infrastructure/Settings/HmrcApiBaseUrlConfig.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SFA.DAS.EAS.Support.Infrastructure.Settings -{ - public class HmrcApiBaseUrlConfig: IHmrcApiBaseUrlConfig - { - [JsonRequired] - public string HmrcApiBaseUrl { get; set; } - } -} diff --git a/src/SFA.DAS.EAS.Support.Infrastructure/Settings/HmrcApiClientConfiguration.cs b/src/SFA.DAS.EAS.Support.Infrastructure/Settings/HmrcApiClientConfiguration.cs new file mode 100644 index 0000000000..2dced523df --- /dev/null +++ b/src/SFA.DAS.EAS.Support.Infrastructure/Settings/HmrcApiClientConfiguration.cs @@ -0,0 +1,10 @@ +using Newtonsoft.Json; + +namespace SFA.DAS.EAS.Support.Infrastructure.Settings +{ + public class HmrcApiClientConfiguration : IHmrcApiClientConfiguration + { + [JsonRequired] + public string ApiBaseUrl { get; set; } + } +} diff --git a/src/SFA.DAS.EAS.Support.Infrastructure/Settings/IHmrcApiBaseUrlConfig.cs b/src/SFA.DAS.EAS.Support.Infrastructure/Settings/IHmrcApiBaseUrlConfig.cs deleted file mode 100644 index c969dbcaa5..0000000000 --- a/src/SFA.DAS.EAS.Support.Infrastructure/Settings/IHmrcApiBaseUrlConfig.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace SFA.DAS.EAS.Support.Infrastructure.Settings -{ - public interface IHmrcApiBaseUrlConfig - { - string HmrcApiBaseUrl { get; set; } - } -} \ No newline at end of file diff --git a/src/SFA.DAS.EAS.Support.Infrastructure/Settings/IHmrcApiClientConfiguration.cs b/src/SFA.DAS.EAS.Support.Infrastructure/Settings/IHmrcApiClientConfiguration.cs new file mode 100644 index 0000000000..a574e0baf1 --- /dev/null +++ b/src/SFA.DAS.EAS.Support.Infrastructure/Settings/IHmrcApiClientConfiguration.cs @@ -0,0 +1,7 @@ +namespace SFA.DAS.EAS.Support.Infrastructure.Settings +{ + public interface IHmrcApiClientConfiguration + { + string ApiBaseUrl { get; set; } + } +} \ No newline at end of file diff --git a/src/SFA.DAS.EAS.Support.Infrastructure/Settings/ILevySubmissionsSettings.cs b/src/SFA.DAS.EAS.Support.Infrastructure/Settings/ILevySubmissionsSettings.cs index ef9ed1b5ae..604ff0d3be 100644 --- a/src/SFA.DAS.EAS.Support.Infrastructure/Settings/ILevySubmissionsSettings.cs +++ b/src/SFA.DAS.EAS.Support.Infrastructure/Settings/ILevySubmissionsSettings.cs @@ -1,16 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using SFA.DAS.TokenService.Api.Client; namespace SFA.DAS.EAS.Support.Infrastructure.Settings { public interface ILevySubmissionsSettings { - LevySubmissionsApiConfiguration LevySubmissionsApiConfig { get; set; } + TokenServiceApiClientConfiguration TokenServiceApi { get; set; } - HmrcApiBaseUrlConfig HmrcApiBaseUrlSetting { get; set; } + HmrcApiClientConfiguration HmrcApi { get; set; } } diff --git a/src/SFA.DAS.EAS.Support.Infrastructure/Settings/LevySubmissionsApiConfiguration.cs b/src/SFA.DAS.EAS.Support.Infrastructure/Settings/LevySubmissionsApiConfiguration.cs deleted file mode 100644 index 24266d5475..0000000000 --- a/src/SFA.DAS.EAS.Support.Infrastructure/Settings/LevySubmissionsApiConfiguration.cs +++ /dev/null @@ -1,23 +0,0 @@ -using SFA.DAS.TokenService.Api.Client; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Cryptography.X509Certificates; -using System.Text; -using System.Threading.Tasks; - -namespace SFA.DAS.EAS.Support.Infrastructure.Settings -{ - public class LevySubmissionsApiConfiguration : ITokenServiceApiClientConfiguration - { - public string ApiBaseUrl { get; set; } - - public string ClientId { get; set; } - - public string ClientSecret { get; set; } - - public string IdentifierUri { get; set; } - - public string Tenant { get; set; } - } -} diff --git a/src/SFA.DAS.EAS.Support.Infrastructure/Settings/LevySubmissionsSettings.cs b/src/SFA.DAS.EAS.Support.Infrastructure/Settings/LevySubmissionsSettings.cs index a43cd87681..7290de31eb 100644 --- a/src/SFA.DAS.EAS.Support.Infrastructure/Settings/LevySubmissionsSettings.cs +++ b/src/SFA.DAS.EAS.Support.Infrastructure/Settings/LevySubmissionsSettings.cs @@ -1,17 +1,13 @@ using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using SFA.DAS.TokenService.Api.Client; namespace SFA.DAS.EAS.Support.Infrastructure.Settings { - public class LevySubmissionsSettings: ILevySubmissionsSettings + public class LevySubmissionsSettings : ILevySubmissionsSettings { - [JsonRequired] public LevySubmissionsApiConfiguration LevySubmissionsApiConfig { get; set; } + [JsonRequired] public TokenServiceApiClientConfiguration TokenServiceApi { get; set; } - [JsonRequired] public HmrcApiBaseUrlConfig HmrcApiBaseUrlSetting { get; set; } + [JsonRequired] public HmrcApiClientConfiguration HmrcApi { get; set; } } diff --git a/src/SFA.DAS.EAS.Support.Web.Tests/Configuration/WebConfigurationTesting.cs b/src/SFA.DAS.EAS.Support.Web.Tests/Configuration/WebConfigurationTesting.cs index c9854a7df6..db4759ab59 100644 --- a/src/SFA.DAS.EAS.Support.Web.Tests/Configuration/WebConfigurationTesting.cs +++ b/src/SFA.DAS.EAS.Support.Web.Tests/Configuration/WebConfigurationTesting.cs @@ -5,6 +5,7 @@ using SFA.DAS.EAS.Support.Infrastructure.Settings; using SFA.DAS.EAS.Support.Web.Configuration; using SFA.DAS.Support.Shared.SiteConnection; +using SFA.DAS.TokenService.Api.Client; using System; using System.IO; @@ -35,18 +36,15 @@ public void Setup() }, LevySubmission = new LevySubmissionsSettings { - HmrcApiBaseUrlSetting = new HmrcApiBaseUrlConfig - { - HmrcApiBaseUrl ="--- configuration value goes here ---" - }, - LevySubmissionsApiConfig = new LevySubmissionsApiConfiguration + HmrcApi = new HmrcApiClientConfiguration + { + ApiBaseUrl = "--- configuration value goes here ---" + }, + TokenServiceApi = new TokenServiceApiClientConfiguration { ApiBaseUrl = "", - ClientId = "", - ClientSecret = "", - IdentifierUri = "", - Tenant = "" - } + ClientSecret = "" + } }, HashingService = new HashingServiceConfig { diff --git a/src/SFA.DAS.EAS.Support.Web/DependencyResolution/DefaultRegistry.cs b/src/SFA.DAS.EAS.Support.Web/DependencyResolution/DefaultRegistry.cs index c226e62fef..9008f3d7da 100644 --- a/src/SFA.DAS.EAS.Support.Web/DependencyResolution/DefaultRegistry.cs +++ b/src/SFA.DAS.EAS.Support.Web/DependencyResolution/DefaultRegistry.cs @@ -36,13 +36,12 @@ public class DefaultRegistry : Registry public DefaultRegistry() { - Scan( - scan => - { - scan.TheCallingAssembly(); - scan.WithDefaultConventions(); - scan.With(new ControllerConvention()); - }); + Scan(s => + { + s.TheCallingAssembly(); + s.WithDefaultConventions(); + s.With(new ControllerConvention()); + }); WebConfiguration configuration = GetConfiguration(); diff --git a/src/SFA.DAS.EAS.Support.Web/DependencyResolution/InfrastuctureRegistry.cs b/src/SFA.DAS.EAS.Support.Web/DependencyResolution/InfrastuctureRegistry.cs index 322b897f90..e011856ecf 100644 --- a/src/SFA.DAS.EAS.Support.Web/DependencyResolution/InfrastuctureRegistry.cs +++ b/src/SFA.DAS.EAS.Support.Web/DependencyResolution/InfrastuctureRegistry.cs @@ -1,6 +1,4 @@ -using System.Diagnostics.CodeAnalysis; -using System.Web; -using SFA.DAS.EAS.Account.Api.Client; +using SFA.DAS.EAS.Account.Api.Client; using SFA.DAS.EAS.Support.Infrastructure.DependencyResolution; using SFA.DAS.EAS.Support.Infrastructure.Services; using SFA.DAS.EAS.Support.Infrastructure.Settings; @@ -9,7 +7,8 @@ using SFA.DAS.NLog.Logger; using SFA.DAS.TokenService.Api.Client; using StructureMap; -using StructureMap.Configuration.DSL; +using System.Diagnostics.CodeAnalysis; +using System.Web; namespace SFA.DAS.EAS.Support.Web.DependencyResolution { @@ -39,26 +38,22 @@ public InfrastuctureRegistry() For().Use(); - For().Use(string.Empty, (ctx) => + For().Use(string.Empty, (ctx) => { - return ctx.GetInstance().LevySubmission.HmrcApiBaseUrlSetting; + return ctx.GetInstance().LevySubmission.HmrcApi; }); + For().Use(); For().Use(string.Empty, (ctx) => { - return ctx.GetInstance().LevySubmission.LevySubmissionsApiConfig; + return ctx.GetInstance().LevySubmission.TokenServiceApi; }); - For().Use(string.Empty, (ctx) => { var hashServiceconfig = ctx.GetInstance().HashingService; return new HashingService.HashingService(hashServiceconfig.AllowedCharacters, hashServiceconfig.Hashstring); }); - } - - - } } \ No newline at end of file diff --git a/src/SFA.DAS.EAS.Web/DependencyResolution/IoC.cs b/src/SFA.DAS.EAS.Web/DependencyResolution/IoC.cs index e6e2192f3b..3d6d0ff3b0 100644 --- a/src/SFA.DAS.EAS.Web/DependencyResolution/IoC.cs +++ b/src/SFA.DAS.EAS.Web/DependencyResolution/IoC.cs @@ -1,38 +1,36 @@ -using SFA.DAS.Activities.Client; -using SFA.DAS.EAS.Application.DependencyResolution; -using StructureMap; +using SFA.DAS.Activities.Client; +using SFA.DAS.EAS.Application.DependencyResolution; +using StructureMap; using SFA.DAS.Authorization.DependencyResolution.StructureMap; -namespace SFA.DAS.EAS.Web.DependencyResolution -{ - public static class IoC - { - public static IContainer Initialize() - { - return new Container(c => - { - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - }); - } - } +namespace SFA.DAS.EAS.Web.DependencyResolution +{ + public static class IoC + { + public static IContainer Initialize() + { + return new Container(c => + { + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + }); + } + } } \ No newline at end of file diff --git a/src/SFA.DAS.EmployerAccounts.Api/App_Start/WebApiConfig.cs b/src/SFA.DAS.EmployerAccounts.Api/App_Start/WebApiConfig.cs index 7aff5bd4a6..cda7461bc3 100644 --- a/src/SFA.DAS.EmployerAccounts.Api/App_Start/WebApiConfig.cs +++ b/src/SFA.DAS.EmployerAccounts.Api/App_Start/WebApiConfig.cs @@ -1,55 +1,54 @@ -using System.Net.Http.Headers; -using System.Web.Http; -using System.Web.Http.ExceptionHandling; -using SFA.DAS.Authorization.DependencyResolution.StructureMap; -using SFA.DAS.Authorization.WebApi.Extensions; -using SFA.DAS.EmployerAccounts.Api.DependencyResolution; -using SFA.DAS.EmployerAccounts.Api.ExceptionLoggers; -using SFA.DAS.EmployerAccounts.Data; -using SFA.DAS.EmployerAccounts.DependencyResolution; +using System.Net.Http.Headers; +using System.Web.Http; +using System.Web.Http.ExceptionHandling; +using SFA.DAS.Authorization.DependencyResolution.StructureMap; +using SFA.DAS.Authorization.WebApi.Extensions; +using SFA.DAS.EmployerAccounts.Api.DependencyResolution; +using SFA.DAS.EmployerAccounts.Api.ExceptionLoggers; +using SFA.DAS.EmployerAccounts.Data; +using SFA.DAS.EmployerAccounts.DependencyResolution; using SFA.DAS.UnitOfWork.EntityFramework.StructureMap; using SFA.DAS.UnitOfWork.NServiceBus.DependencyResolution.StructureMap; using SFA.DAS.UnitOfWork.NServiceBus.Features.ClientOutbox.DependencyResolution.StructureMap; using SFA.DAS.UnitOfWork.WebApi.Extensions; -using SFA.DAS.Validation.WebApi; -using WebApi.StructureMap; - -namespace SFA.DAS.EmployerAccounts.Api -{ - public static class WebApiConfig - { - public static void Register(HttpConfiguration config) - { - config.Filters.AddUnitOfWorkFilter(); - config.Filters.Add(new ValidateModelStateFilter()); - config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html")); - config.MapHttpAttributeRoutes(); - config.Services.Add(typeof(IExceptionLogger), new ErrorLogger()); - config.Services.UseAuthorizationModelBinder(); - config.Filters.AddAuthorizationFilter(); - config.Filters.AddUnauthorizedAccessExceptionFilter(); - - config.UseStructureMap(c => - { - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry>(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - }); - } - } -} +using SFA.DAS.Validation.WebApi; +using WebApi.StructureMap; + +namespace SFA.DAS.EmployerAccounts.Api +{ + public static class WebApiConfig + { + public static void Register(HttpConfiguration config) + { + config.Filters.AddUnitOfWorkFilter(); + config.Filters.Add(new ValidateModelStateFilter()); + config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html")); + config.MapHttpAttributeRoutes(); + config.Services.Add(typeof(IExceptionLogger), new ErrorLogger()); + config.Services.UseAuthorizationModelBinder(); + config.Filters.AddAuthorizationFilter(); + config.Filters.AddUnauthorizedAccessExceptionFilter(); + + config.UseStructureMap(c => + { + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry>(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + }); + } + } +} diff --git a/src/SFA.DAS.EmployerAccounts.MessageHandlers.TestHarness/DependencyResolution/IoC.cs b/src/SFA.DAS.EmployerAccounts.MessageHandlers.TestHarness/DependencyResolution/IoC.cs index d690befb3e..b5779fc65f 100644 --- a/src/SFA.DAS.EmployerAccounts.MessageHandlers.TestHarness/DependencyResolution/IoC.cs +++ b/src/SFA.DAS.EmployerAccounts.MessageHandlers.TestHarness/DependencyResolution/IoC.cs @@ -1,34 +1,33 @@ -using SFA.DAS.EmployerAccounts.Data; -using SFA.DAS.EmployerAccounts.DependencyResolution; +using SFA.DAS.EmployerAccounts.Data; +using SFA.DAS.EmployerAccounts.DependencyResolution; using SFA.DAS.UnitOfWork.EntityFramework.StructureMap; using SFA.DAS.UnitOfWork.NServiceBus.DependencyResolution.StructureMap; -using StructureMap; - -namespace SFA.DAS.EmployerAccounts.MessageHandlers.TestHarness.DependencyResolution -{ - public static class IoC - { - public static IContainer Initialize() - { - return new Container(c => - { - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry>(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - }); - } - } -} +using StructureMap; + +namespace SFA.DAS.EmployerAccounts.MessageHandlers.TestHarness.DependencyResolution +{ + public static class IoC + { + public static IContainer Initialize() + { + return new Container(c => + { + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry>(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + }); + } + } +} diff --git a/src/SFA.DAS.EmployerAccounts.MessageHandlers/DependencyResolution/IoC.cs b/src/SFA.DAS.EmployerAccounts.MessageHandlers/DependencyResolution/IoC.cs index 07e040fae9..f3dcd49188 100644 --- a/src/SFA.DAS.EmployerAccounts.MessageHandlers/DependencyResolution/IoC.cs +++ b/src/SFA.DAS.EmployerAccounts.MessageHandlers/DependencyResolution/IoC.cs @@ -1,37 +1,36 @@ -using SFA.DAS.EmployerAccounts.Data; -using SFA.DAS.EmployerAccounts.DependencyResolution; -using SFA.DAS.EmployerAccounts.ReadStore.DependencyResolution; +using SFA.DAS.EmployerAccounts.Data; +using SFA.DAS.EmployerAccounts.DependencyResolution; +using SFA.DAS.EmployerAccounts.ReadStore.DependencyResolution; using SFA.DAS.UnitOfWork.EntityFramework.StructureMap; using SFA.DAS.UnitOfWork.NServiceBus.DependencyResolution.StructureMap; -using StructureMap; - -namespace SFA.DAS.EmployerAccounts.MessageHandlers.DependencyResolution -{ - public static class IoC - { - public static IContainer Initialize() - { - return new Container(c => - { - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry>(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - }); - } - } +using StructureMap; + +namespace SFA.DAS.EmployerAccounts.MessageHandlers.DependencyResolution +{ + public static class IoC + { + public static IContainer Initialize() + { + return new Container(c => + { + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry>(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + }); + } + } } \ No newline at end of file diff --git a/src/SFA.DAS.EmployerAccounts.TestCommon/SFA.DAS.EmployerAccounts.TestCommon.csproj b/src/SFA.DAS.EmployerAccounts.TestCommon/SFA.DAS.EmployerAccounts.TestCommon.csproj index 70267a89c1..daca9b834b 100644 --- a/src/SFA.DAS.EmployerAccounts.TestCommon/SFA.DAS.EmployerAccounts.TestCommon.csproj +++ b/src/SFA.DAS.EmployerAccounts.TestCommon/SFA.DAS.EmployerAccounts.TestCommon.csproj @@ -177,7 +177,7 @@ 1.0.183 - 1.0.16 + 1.0.30 3.0.0.63765 diff --git a/src/SFA.DAS.EmployerAccounts.Web.UnitTests/Controllers/TransferConnectionInvitationsControllerTests/WhenISubmitTheApprovedTransferConnectionInvitationPage.cs b/src/SFA.DAS.EmployerAccounts.Web.UnitTests/Controllers/TransferConnectionInvitationsControllerTests/WhenISubmitTheApprovedTransferConnectionInvitationPage.cs index 8b85e26067..9e0019058c 100644 --- a/src/SFA.DAS.EmployerAccounts.Web.UnitTests/Controllers/TransferConnectionInvitationsControllerTests/WhenISubmitTheApprovedTransferConnectionInvitationPage.cs +++ b/src/SFA.DAS.EmployerAccounts.Web.UnitTests/Controllers/TransferConnectionInvitationsControllerTests/WhenISubmitTheApprovedTransferConnectionInvitationPage.cs @@ -39,7 +39,7 @@ public void ThenIShouldBeRedirectedToTheApprenticesPageIfIChoseOption1() var result = _controller.Approved(_viewModel) as RedirectResult; Assert.That(result, Is.Not.Null); - Assert.That(result.Url, Is.EqualTo($"/accounts/{AccountHashedId}/apprentices/home")); + Assert.That(result.Url, Is.EqualTo($"/{AccountHashedId}")); } [Test] diff --git a/src/SFA.DAS.EmployerAccounts.Web/Controllers/TransferConnectionInvitationsController.cs b/src/SFA.DAS.EmployerAccounts.Web/Controllers/TransferConnectionInvitationsController.cs index 30c7004690..849a81f728 100644 --- a/src/SFA.DAS.EmployerAccounts.Web/Controllers/TransferConnectionInvitationsController.cs +++ b/src/SFA.DAS.EmployerAccounts.Web/Controllers/TransferConnectionInvitationsController.cs @@ -174,7 +174,7 @@ public ActionResult Approved(ApprovedTransferConnectionInvitationViewModel model switch (model.Choice) { case "GoToApprenticesPage": - return Redirect(Url.EmployerCommitmentsAction("apprentices/home")); + return Redirect(Url.EmployerCommitmentsV2Action(string.Empty)); case "GoToHomepage": return RedirectToAction("Index", "EmployerTeam"); default: diff --git a/src/SFA.DAS.EmployerAccounts.Web/Extensions/UrlHelperExtensions.cs b/src/SFA.DAS.EmployerAccounts.Web/Extensions/UrlHelperExtensions.cs index 24795cb3ed..2a9b816ecc 100644 --- a/src/SFA.DAS.EmployerAccounts.Web/Extensions/UrlHelperExtensions.cs +++ b/src/SFA.DAS.EmployerAccounts.Web/Extensions/UrlHelperExtensions.cs @@ -14,14 +14,6 @@ public static string EmployerAccountsAction(this UrlHelper helper, string path) return AccountAction(helper, baseUrl, path); } - public static string EmployerCommitmentsAction(this UrlHelper helper, string path) - { - var configuration = DependencyResolver.Current.GetService(); - var baseUrl = configuration.EmployerCommitmentsBaseUrl; - - return AccountAction(helper, baseUrl, path); - } - public static string EmployerCommitmentsV2Action(this UrlHelper helper, string path) { var configuration = DependencyResolver.Current.GetService(); diff --git a/src/SFA.DAS.EmployerAccounts.Web/SFA.DAS.EmployerAccounts.Web.csproj b/src/SFA.DAS.EmployerAccounts.Web/SFA.DAS.EmployerAccounts.Web.csproj index a2b12f8377..a810d99a95 100644 --- a/src/SFA.DAS.EmployerAccounts.Web/SFA.DAS.EmployerAccounts.Web.csproj +++ b/src/SFA.DAS.EmployerAccounts.Web/SFA.DAS.EmployerAccounts.Web.csproj @@ -132,7 +132,7 @@ 1.0.5 - 1.0.16 + 1.0.30 1.1.79 diff --git a/src/SFA.DAS.EmployerAccounts/Configuration/ConfigurationKeys.cs b/src/SFA.DAS.EmployerAccounts/Configuration/ConfigurationKeys.cs index 528bba85e0..a599bae1c2 100644 --- a/src/SFA.DAS.EmployerAccounts/Configuration/ConfigurationKeys.cs +++ b/src/SFA.DAS.EmployerAccounts/Configuration/ConfigurationKeys.cs @@ -4,7 +4,6 @@ public static class ConfigurationKeys { public const string EmployerAccounts = "SFA.DAS.EmployerAccounts"; public const string Features = "SFA.DAS.EmployerApprenticeshipsService.FeaturesV2"; - public const string TokenServiceApiClient = "SFA.DAS.TokenServiceApiClient"; public const string TasksApi = "SFA.DAS.Tasks.Api"; public const string ReferenceDataApiClient = "SFA.DAS.ReferenceDataApiClient"; public const string NotificationsApiClient = "SFA.DAS.EmployerAccounts.Notifications"; diff --git a/src/SFA.DAS.EmployerAccounts/Configuration/EmployerAccountsConfiguration.cs b/src/SFA.DAS.EmployerAccounts/Configuration/EmployerAccountsConfiguration.cs index a0a7e5479e..7f7149e36e 100644 --- a/src/SFA.DAS.EmployerAccounts/Configuration/EmployerAccountsConfiguration.cs +++ b/src/SFA.DAS.EmployerAccounts/Configuration/EmployerAccountsConfiguration.cs @@ -2,6 +2,7 @@ using SFA.DAS.EAS.Account.Api.Client; using SFA.DAS.Hmrc.Configuration; using SFA.DAS.Messaging.AzureServiceBus.StructureMap; +using SFA.DAS.TokenService.Api.Client; using System; namespace SFA.DAS.EmployerAccounts.Configuration @@ -14,7 +15,7 @@ public class EmployerAccountsConfiguration : ITopicMessagePublisherConfiguration public string DatabaseConnectionString { get; set; } public string EmployerAccountsBaseUrl { get; set; } public string EmployerCommitmentsBaseUrl { get; set; } - public string EmployerCommitmentsV2BaseUrl { get; set; } + public string EmployerCommitmentsV2BaseUrl { get; set; } public string EmployerFinanceBaseUrl { get; set; } public string EmployerIncentivesBaseUrl { get; set; } public string EmployerPortalBaseUrl { get; set; } @@ -42,6 +43,7 @@ public class EmployerAccountsConfiguration : ITopicMessagePublisherConfiguration public string RedisConnectionString { get; set; } public bool CanSkipRegistrationSteps { get; set; } public AccountApiConfiguration AccountApi { get; set; } + public TokenServiceApiClientConfiguration TokenServiceApi { get; set; } public UserAornPayeLockConfiguration UserAornPayeLock { get; set; } public string ZenDeskHelpCentreUrl { get; set; } public string ReportTrainingProviderEmailAddress { get; set; } diff --git a/src/SFA.DAS.EmployerAccounts/Configuration/TokenServiceApiClientConfiguration.cs b/src/SFA.DAS.EmployerAccounts/Configuration/TokenServiceApiClientConfiguration.cs deleted file mode 100644 index 45c4895de8..0000000000 --- a/src/SFA.DAS.EmployerAccounts/Configuration/TokenServiceApiClientConfiguration.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Configuration; -using System.Security.Cryptography.X509Certificates; -using SFA.DAS.TokenService.Api.Client; - -namespace SFA.DAS.EmployerAccounts.Configuration -{ - public class TokenServiceApiClientConfiguration : ITokenServiceApiClientConfiguration - { - public string ApiBaseUrl { get; set; } - public string ClientId { get; set; } - public string ClientSecret { get; set; } - public string IdentifierUri { get; set; } - public string Tenant { get; set; } - } -} \ No newline at end of file diff --git a/src/SFA.DAS.EmployerAccounts/DependencyResolution/TokenServiceRegistry.cs b/src/SFA.DAS.EmployerAccounts/DependencyResolution/TokenServiceRegistry.cs index ac54f5a88e..18d43d0638 100644 --- a/src/SFA.DAS.EmployerAccounts/DependencyResolution/TokenServiceRegistry.cs +++ b/src/SFA.DAS.EmployerAccounts/DependencyResolution/TokenServiceRegistry.cs @@ -1,8 +1,6 @@ -using SFA.DAS.AutoConfiguration; -using SFA.DAS.EmployerAccounts.Configuration; +using SFA.DAS.EmployerAccounts.Configuration; using SFA.DAS.TokenService.Api.Client; using StructureMap; -using TokenServiceApiClientConfiguration = SFA.DAS.EmployerAccounts.Configuration.TokenServiceApiClientConfiguration; namespace SFA.DAS.EmployerAccounts.DependencyResolution { @@ -11,7 +9,7 @@ public class TokenServiceRegistry : Registry public TokenServiceRegistry() { For().Use(c => c.GetInstance()); - For().Use(c => c.GetInstance().Get(ConfigurationKeys.TokenServiceApiClient)).Singleton(); + For().Use(c => c.GetInstance().TokenServiceApi).Singleton(); } } } \ No newline at end of file diff --git a/src/SFA.DAS.EmployerAccounts/SFA.DAS.EmployerAccounts.csproj b/src/SFA.DAS.EmployerAccounts/SFA.DAS.EmployerAccounts.csproj index dc988f6976..c7d19e07d8 100644 --- a/src/SFA.DAS.EmployerAccounts/SFA.DAS.EmployerAccounts.csproj +++ b/src/SFA.DAS.EmployerAccounts/SFA.DAS.EmployerAccounts.csproj @@ -40,7 +40,7 @@ - + @@ -64,7 +64,7 @@ - + diff --git a/src/SFA.DAS.EmployerApprenticeshipsService.Application/DependencyResolution/ExecutionPoliciesRegistry.cs b/src/SFA.DAS.EmployerApprenticeshipsService.Application/DependencyResolution/ExecutionPoliciesRegistry.cs deleted file mode 100644 index 87c7769541..0000000000 --- a/src/SFA.DAS.EmployerApprenticeshipsService.Application/DependencyResolution/ExecutionPoliciesRegistry.cs +++ /dev/null @@ -1,14 +0,0 @@ -using SFA.DAS.Hmrc.ExecutionPolicy; -using StructureMap; - -namespace SFA.DAS.EAS.Application.DependencyResolution -{ - public class ExecutionPoliciesRegistry : Registry - { - public ExecutionPoliciesRegistry() - { - For().Use().Named(HmrcExecutionPolicy.Name).SelectConstructor(() => new HmrcExecutionPolicy(null)); - Policies.Add(new ExecutionPolicyPolicy()); - } - } -} \ No newline at end of file diff --git a/src/SFA.DAS.EmployerApprenticeshipsService.Application/DependencyResolution/TokenServiceRegistry.cs b/src/SFA.DAS.EmployerApprenticeshipsService.Application/DependencyResolution/TokenServiceRegistry.cs deleted file mode 100644 index afb2dd9332..0000000000 --- a/src/SFA.DAS.EmployerApprenticeshipsService.Application/DependencyResolution/TokenServiceRegistry.cs +++ /dev/null @@ -1,17 +0,0 @@ -using SFA.DAS.AutoConfiguration; -using SFA.DAS.EAS.Domain.Configuration; -using SFA.DAS.TokenService.Api.Client; -using StructureMap; -using TokenServiceApiClientConfiguration = SFA.DAS.EAS.Domain.Configuration.TokenServiceApiClientConfiguration; - -namespace SFA.DAS.EAS.Application.DependencyResolution -{ - public class TokenServiceRegistry : Registry - { - public TokenServiceRegistry() - { - For().Use(c => c.GetInstance()); - For().Use(c => c.GetInstance().Get(ConfigurationKeys.TokenServiceApi)).Singleton(); - } - } -} \ No newline at end of file diff --git a/src/SFA.DAS.EmployerApprenticeshipsService.Application/SFA.DAS.EAS.Application.csproj b/src/SFA.DAS.EmployerApprenticeshipsService.Application/SFA.DAS.EAS.Application.csproj index 0a62285b7c..482dbe57bb 100644 --- a/src/SFA.DAS.EmployerApprenticeshipsService.Application/SFA.DAS.EAS.Application.csproj +++ b/src/SFA.DAS.EmployerApprenticeshipsService.Application/SFA.DAS.EAS.Application.csproj @@ -71,7 +71,6 @@ - @@ -82,7 +81,6 @@ - @@ -235,9 +233,6 @@ 1.0.183 - - 1.0.16 - 3.0.0.63765 diff --git a/src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/ConfigurationKeys.cs b/src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/ConfigurationKeys.cs index 2e0185e5f7..326a16cfe2 100644 --- a/src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/ConfigurationKeys.cs +++ b/src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/ConfigurationKeys.cs @@ -11,7 +11,6 @@ public static class ConfigurationKeys public const string NotificationsApiClient = "SFA.DAS.EmployerApprenticeshipsService.Notifications"; public const string CommitmentsApiClient = "SFA.DAS.CommitmentsAPI"; public const string Features = "SFA.DAS.EmployerApprenticeshipsService.FeaturesV2"; - public const string TokenServiceApi = "SFA.DAS.TokenServiceApiClient"; public const string AuditApi = "SFA.DAS.AuditApiClient"; } } diff --git a/src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/EmployerApprenticeshipsServiceConfiguration.cs b/src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/EmployerApprenticeshipsServiceConfiguration.cs index 4f194cc334..f32ed785ad 100644 --- a/src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/EmployerApprenticeshipsServiceConfiguration.cs +++ b/src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/EmployerApprenticeshipsServiceConfiguration.cs @@ -1,32 +1,33 @@ using System.Collections.Generic; using SFA.DAS.Messaging.AzureServiceBus.StructureMap; +using SFA.DAS.TokenService.Api.Client; namespace SFA.DAS.EAS.Domain.Configuration { public class EmployerApprenticeshipsServiceConfiguration : ITopicMessagePublisherConfiguration, ITopicMessageSubscriberConfiguration - { + { public string AllowedHashstringCharacters { get; set; } public ApprenticeshipInfoServiceConfiguration ApprenticeshipInfoService { get; set; } public CompaniesHouseConfiguration CompaniesHouse { get; set; } public string DashboardUrl { get; set; } public string DatabaseConnectionString { get; set; } - public string EmployerAccountsBaseUrl { get; set; } - public string EmployerCommitmentsBaseUrl { get; set; } - public string EmployerFinanceBaseUrl { get; set; } - public string EmployerPortalBaseUrl { get; set; } - public string EmployerProjectionsBaseUrl { get; set; } - public string EmployerRecruitBaseUrl { get; set; } + public string EmployerAccountsBaseUrl { get; set; } + public string EmployerCommitmentsBaseUrl { get; set; } + public string EmployerFinanceBaseUrl { get; set; } + public string EmployerPortalBaseUrl { get; set; } + public string EmployerProjectionsBaseUrl { get; set; } + public string EmployerRecruitBaseUrl { get; set; } public EventsApiClientConfiguration EventsApi { get; set; } public string Hashstring { get; set; } public IdentityServerConfiguration Identity { get; set; } - public IdProcessorConfiguration IdProcessor { get; set; } + public IdProcessorConfiguration IdProcessor { get; set; } public string MessageServiceBusConnectionString { get; set; } - public string NServiceBusLicense { get; set; } + public string NServiceBusLicense { get; set; } public string PublicAllowedHashstringCharacters { get; set; } - public string PublicAllowedAccountLegalEntityHashstringCharacters { get; set; } - public string PublicAllowedAccountLegalEntityHashstringSalt { get; set; } + public string PublicAllowedAccountLegalEntityHashstringCharacters { get; set; } + public string PublicAllowedAccountLegalEntityHashstringSalt { get; set; } public string PublicHashstring { get; set; } - public string ServiceBusConnectionString { get; set; } + public string ServiceBusConnectionString { get; set; } public Dictionary ServiceBusConnectionStrings { get; set; } public EmployerAccountsApiConfiguration EmployerAccountsApi { get; set; } } diff --git a/src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/TokenServiceApiClientConfiguration.cs b/src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/TokenServiceApiClientConfiguration.cs deleted file mode 100644 index 631a4a7f95..0000000000 --- a/src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/TokenServiceApiClientConfiguration.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Configuration; -using System.Security.Cryptography.X509Certificates; -using SFA.DAS.TokenService.Api.Client; - -namespace SFA.DAS.EAS.Domain.Configuration -{ - public class TokenServiceApiClientConfiguration : ITokenServiceApiClientConfiguration - { - public string ApiBaseUrl { get; set; } - public string ClientId { get; set; } - public string ClientSecret { get; set; } - public string IdentifierUri { get; set; } - public string Tenant { get; set; } - public string DatabaseConnectionString { get; set; } - public string ServiceBusConnectionString { get; set; } - public string MessageServiceBusConnectionString { get; set; } - } -} \ No newline at end of file diff --git a/src/SFA.DAS.EmployerApprenticeshipsService.Domain/SFA.DAS.EAS.Domain.csproj b/src/SFA.DAS.EmployerApprenticeshipsService.Domain/SFA.DAS.EAS.Domain.csproj index 10c46cae69..ddc0c73d7d 100644 --- a/src/SFA.DAS.EmployerApprenticeshipsService.Domain/SFA.DAS.EAS.Domain.csproj +++ b/src/SFA.DAS.EmployerApprenticeshipsService.Domain/SFA.DAS.EAS.Domain.csproj @@ -68,7 +68,6 @@ - @@ -260,7 +259,7 @@ 1.8.44 - 2.1.1 + 2.3.0 9.0.13 diff --git a/src/SFA.DAS.EmployerFinance.AcceptanceTests/DependencyResolution/IoC.cs b/src/SFA.DAS.EmployerFinance.AcceptanceTests/DependencyResolution/IoC.cs index d29671a3ab..8d2e1369f8 100644 --- a/src/SFA.DAS.EmployerFinance.AcceptanceTests/DependencyResolution/IoC.cs +++ b/src/SFA.DAS.EmployerFinance.AcceptanceTests/DependencyResolution/IoC.cs @@ -1,42 +1,42 @@ -using SFA.DAS.EmployerFinance.Data; -using SFA.DAS.EmployerFinance.DependencyResolution; +using SFA.DAS.EmployerFinance.Data; +using SFA.DAS.EmployerFinance.DependencyResolution; using SFA.DAS.UnitOfWork.DependencyResolution.StructureMap; using SFA.DAS.UnitOfWork.EntityFramework.StructureMap; using SFA.DAS.UnitOfWork.NServiceBus.DependencyResolution.StructureMap; using SFA.DAS.UnitOfWork.NServiceBus.Features.ClientOutbox.DependencyResolution.StructureMap; -using StructureMap; - -namespace SFA.DAS.EmployerFinance.AcceptanceTests.DependencyResolution -{ - public static class IoC - { - public static IContainer Initialize() - { - return new Container(c => - { - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry>(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - }); - } - } +using StructureMap; + +namespace SFA.DAS.EmployerFinance.AcceptanceTests.DependencyResolution +{ + public static class IoC + { + public static IContainer Initialize() + { + return new Container(c => + { + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry>(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + }); + } + } } \ No newline at end of file diff --git a/src/SFA.DAS.EmployerFinance.AcceptanceTests/SFA.DAS.EmployerFinance.AcceptanceTests.csproj b/src/SFA.DAS.EmployerFinance.AcceptanceTests/SFA.DAS.EmployerFinance.AcceptanceTests.csproj index dc00e16ea6..79f87a8d19 100644 --- a/src/SFA.DAS.EmployerFinance.AcceptanceTests/SFA.DAS.EmployerFinance.AcceptanceTests.csproj +++ b/src/SFA.DAS.EmployerFinance.AcceptanceTests/SFA.DAS.EmployerFinance.AcceptanceTests.csproj @@ -19,7 +19,7 @@ - + diff --git a/src/SFA.DAS.EmployerFinance.Api/App_Start/WebApiConfig.cs b/src/SFA.DAS.EmployerFinance.Api/App_Start/WebApiConfig.cs index 1fad9781ad..5ced00c1b6 100644 --- a/src/SFA.DAS.EmployerFinance.Api/App_Start/WebApiConfig.cs +++ b/src/SFA.DAS.EmployerFinance.Api/App_Start/WebApiConfig.cs @@ -1,57 +1,56 @@ -using System.Net.Http.Headers; -using System.Web.Http; -using System.Web.Http.ExceptionHandling; -using SFA.DAS.Authorization.DependencyResolution.StructureMap; -using SFA.DAS.Authorization.WebApi.Extensions; -using SFA.DAS.EmployerFinance.Api.DependencyResolution; -using SFA.DAS.EmployerFinance.Api.ExceptionLoggers; -using SFA.DAS.EmployerFinance.Data; -using SFA.DAS.EmployerFinance.DependencyResolution; +using System.Net.Http.Headers; +using System.Web.Http; +using System.Web.Http.ExceptionHandling; +using SFA.DAS.Authorization.DependencyResolution.StructureMap; +using SFA.DAS.Authorization.WebApi.Extensions; +using SFA.DAS.EmployerFinance.Api.DependencyResolution; +using SFA.DAS.EmployerFinance.Api.ExceptionLoggers; +using SFA.DAS.EmployerFinance.Data; +using SFA.DAS.EmployerFinance.DependencyResolution; using SFA.DAS.UnitOfWork.EntityFramework.StructureMap; using SFA.DAS.UnitOfWork.NServiceBus.DependencyResolution.StructureMap; using SFA.DAS.UnitOfWork.NServiceBus.Features.ClientOutbox.DependencyResolution.StructureMap; using SFA.DAS.UnitOfWork.WebApi.Extensions; -using SFA.DAS.Validation.WebApi; -using WebApi.StructureMap; - -namespace SFA.DAS.EmployerFinance.Api -{ - public static class WebApiConfig - { - public static void Register(HttpConfiguration config) - { - config.Filters.AddUnitOfWorkFilter(); - config.Filters.Add(new ValidateModelStateFilter()); - config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html")); - config.MapHttpAttributeRoutes(); - config.Services.Add(typeof(IExceptionLogger), new ErrorLogger()); - config.Services.UseAuthorizationModelBinder(); - config.Filters.AddAuthorizationFilter(); - config.Filters.AddUnauthorizedAccessExceptionFilter(); - - config.UseStructureMap(c => - { - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry>(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - c.AddRegistry(); - }); - } - } -} +using SFA.DAS.Validation.WebApi; +using WebApi.StructureMap; + +namespace SFA.DAS.EmployerFinance.Api +{ + public static class WebApiConfig + { + public static void Register(HttpConfiguration config) + { + config.Filters.AddUnitOfWorkFilter(); + config.Filters.Add(new ValidateModelStateFilter()); + config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html")); + config.MapHttpAttributeRoutes(); + config.Services.Add(typeof(IExceptionLogger), new ErrorLogger()); + config.Services.UseAuthorizationModelBinder(); + config.Filters.AddAuthorizationFilter(); + config.Filters.AddUnauthorizedAccessExceptionFilter(); + + config.UseStructureMap(c => + { + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry>(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + c.AddRegistry(); + }); + } + } +} diff --git a/src/SFA.DAS.EmployerFinance.Web/DependencyResolution/IoC.cs b/src/SFA.DAS.EmployerFinance.Web/DependencyResolution/IoC.cs index 3109e3f79c..b28617d4b9 100644 --- a/src/SFA.DAS.EmployerFinance.Web/DependencyResolution/IoC.cs +++ b/src/SFA.DAS.EmployerFinance.Web/DependencyResolution/IoC.cs @@ -32,15 +32,14 @@ public static IContainer Initialize() c.AddRegistry(); c.AddRegistry(); c.AddRegistry(); - c.AddRegistry(); c.AddRegistry(); c.AddRegistry(); c.AddRegistry(); c.AddRegistry(); c.AddRegistry(); c.AddRegistry(); - c.AddRegistry(); - }); - } - } + c.AddRegistry(); + }); + } + } } \ No newline at end of file diff --git a/src/SFA.DAS.EmployerFinance.Web/Extensions/UrlHelperExtensions.cs b/src/SFA.DAS.EmployerFinance.Web/Extensions/UrlHelperExtensions.cs index eb75d74ca2..f2aec7fe5a 100644 --- a/src/SFA.DAS.EmployerFinance.Web/Extensions/UrlHelperExtensions.cs +++ b/src/SFA.DAS.EmployerFinance.Web/Extensions/UrlHelperExtensions.cs @@ -19,14 +19,6 @@ public static string EmployerAccountsAction(this UrlHelper helper, string contro var baseUrl = configuration.EmployerAccountsBaseUrl; return includedAccountId ? Action(baseUrl, PathWithHashedAccountId(helper, controller, path)) : Action(baseUrl, $"{controller}/{path}"); - } - - public static string EmployerCommitmentsAction(this UrlHelper helper, string path) - { - var configuration = DependencyResolver.Current.GetService(); - var baseUrl = configuration.EmployerCommitmentsBaseUrl; - - return AccountAction(helper, baseUrl, path); } public static string LevyTransfersMatchingAccountAction(this UrlHelper helper, string path) diff --git a/src/SFA.DAS.EmployerFinance/Configuration/ConfigurationKeys.cs b/src/SFA.DAS.EmployerFinance/Configuration/ConfigurationKeys.cs index 12b33ae77e..e727e762f5 100644 --- a/src/SFA.DAS.EmployerFinance/Configuration/ConfigurationKeys.cs +++ b/src/SFA.DAS.EmployerFinance/Configuration/ConfigurationKeys.cs @@ -9,6 +9,5 @@ public static class ConfigurationKeys public const string CommitmentsApiClient = "SFA.DAS.CommitmentsAPI"; public const string NotificationsApiClient = "SFA.DAS.Notifications"; public const string PaymentsApiClient = "SFA.DAS.PaymentsAPI"; - public const string TokenServiceApiClient = "SFA.DAS.TokenServiceApiClient"; } } diff --git a/src/SFA.DAS.EmployerFinance/Configuration/EmployerFinanceConfiguration.cs b/src/SFA.DAS.EmployerFinance/Configuration/EmployerFinanceConfiguration.cs index b0dffe4503..fbd4ad298f 100644 --- a/src/SFA.DAS.EmployerFinance/Configuration/EmployerFinanceConfiguration.cs +++ b/src/SFA.DAS.EmployerFinance/Configuration/EmployerFinanceConfiguration.cs @@ -3,6 +3,7 @@ using SFA.DAS.EmployerFinance.Api.Client; using SFA.DAS.Hmrc.Configuration; using SFA.DAS.Messaging.AzureServiceBus.StructureMap; +using SFA.DAS.TokenService.Api.Client; namespace SFA.DAS.EmployerFinance.Configuration { @@ -36,10 +37,9 @@ public class EmployerFinanceConfiguration : ITopicMessagePublisherConfiguration public string RedisConnectionString { get; set; } public virtual int FundsExpiryPeriod { get; set; } public AccountApiConfiguration AccountApi { get; set; } - + public TokenServiceApiClientConfiguration TokenServiceApi { get; set; } public CommitmentsApiV2ClientConfiguration CommitmentsApi { get; set; } public PaymentsApiClientConfiguration PaymentsEventsApi { get; set; } - public string ReservationsBaseUrl { get; set; } public string ZenDeskHelpCentreUrl { get; set; } public string ZenDeskSnippetKey { get; set; } diff --git a/src/SFA.DAS.EmployerFinance/Configuration/TokenServiceApiClientConfiguration.cs b/src/SFA.DAS.EmployerFinance/Configuration/TokenServiceApiClientConfiguration.cs deleted file mode 100644 index 50bc683f59..0000000000 --- a/src/SFA.DAS.EmployerFinance/Configuration/TokenServiceApiClientConfiguration.cs +++ /dev/null @@ -1,16 +0,0 @@ -using SFA.DAS.TokenService.Api.Client; - -namespace SFA.DAS.EmployerFinance.Configuration -{ - public class TokenServiceApiClientConfiguration : ITokenServiceApiClientConfiguration - { - public string ApiBaseUrl { get; set; } - public string ClientId { get; set; } - public string ClientSecret { get; set; } - public string IdentifierUri { get; set; } - public string Tenant { get; set; } - - public string DatabaseConnectionString { get; set; } - public string ServiceBusConnectionString { get; set; } - } -} \ No newline at end of file diff --git a/src/SFA.DAS.EmployerFinance/DependencyResolution/TokenServiceRegistry.cs b/src/SFA.DAS.EmployerFinance/DependencyResolution/TokenServiceRegistry.cs index 8b0f2c2ca2..246514f844 100644 --- a/src/SFA.DAS.EmployerFinance/DependencyResolution/TokenServiceRegistry.cs +++ b/src/SFA.DAS.EmployerFinance/DependencyResolution/TokenServiceRegistry.cs @@ -1,8 +1,6 @@ -using SFA.DAS.AutoConfiguration; -using SFA.DAS.EmployerFinance.Configuration; +using SFA.DAS.EmployerFinance.Configuration; using SFA.DAS.TokenService.Api.Client; using StructureMap; -using TokenServiceApiClientConfiguration = SFA.DAS.EmployerFinance.Configuration.TokenServiceApiClientConfiguration; namespace SFA.DAS.EmployerFinance.DependencyResolution { @@ -11,7 +9,7 @@ public class TokenServiceRegistry : Registry public TokenServiceRegistry() { For().Use(c => c.GetInstance()); - For().Use(c => c.GetInstance().Get(ConfigurationKeys.TokenServiceApiClient)).Singleton(); + For().Use(c => c.GetInstance().TokenServiceApi).Singleton(); } } } \ No newline at end of file diff --git a/src/SFA.DAS.EmployerFinance/SFA.DAS.EmployerFinance.csproj b/src/SFA.DAS.EmployerFinance/SFA.DAS.EmployerFinance.csproj index 0f4301d26f..9b8a062ecb 100644 --- a/src/SFA.DAS.EmployerFinance/SFA.DAS.EmployerFinance.csproj +++ b/src/SFA.DAS.EmployerFinance/SFA.DAS.EmployerFinance.csproj @@ -37,7 +37,7 @@ - + @@ -49,7 +49,7 @@ - +