diff --git a/CallbackHandler.IntegrationTests/Features/BankDepositCallback.feature b/CallbackHandler.IntegrationTests/Features/BankDepositCallback.feature index 372fdd3..e0446d6 100644 --- a/CallbackHandler.IntegrationTests/Features/BankDepositCallback.feature +++ b/CallbackHandler.IntegrationTests/Features/BankDepositCallback.feature @@ -32,13 +32,9 @@ Given I create the following api scopes | MerchantName | AddressLine1 | Town | Region | PostalCode | Country | ContactName | EmailAddress | EstateName | | Test Merchant 1 | Address Line 1 | TestTown | Test Region | TE57 1NG | United Kingdom | Test Contact 1 | testcontact1@merchant1.co.uk | Test Estate 1 | -Scenario Outline: Process a Bank Deposit Callback +Scenario: Process a Bank Deposit Callback Given I have the following Bank Deposit Callbacks | Amount | DateTime | DepositId | HostIdentifier | SortCode | AccountNumber | | 100.00 | Today | 6AE04AFC-D7F8-4936-A3A2-DCA177CAA106 | DC4A7DDA-45A1-4D5B-8D46-21FA99A3868E | 11-22-33 | 12345678 | When I send the requests to the callback handler for deposits - Then the deposit records are recorded - -Examples: -| APIVersion | -| 1 | \ No newline at end of file + Then the deposit records are recorded \ No newline at end of file diff --git a/CallbackHandler.IntegrationTests/Shared/SharedSteps.cs b/CallbackHandler.IntegrationTests/Shared/SharedSteps.cs index 87171b8..4935bdb 100644 --- a/CallbackHandler.IntegrationTests/Shared/SharedSteps.cs +++ b/CallbackHandler.IntegrationTests/Shared/SharedSteps.cs @@ -61,13 +61,12 @@ public async Task GivenIHaveTheFollowingBankDepositCallbacks(DataTable table) [When(@"I send the requests to the callback handler for deposits")] public async Task WhenISendTheRequestsToTheCallbackHandlerForDeposits() { - String apiVersion = ScenarioContext.ScenarioInfo.Arguments["APIVersion"].ToString(); - + using HttpClient client = new(); foreach (var testingContextDeposit in this.TestingContext.Deposits) { String requestUri = - $"http://localhost:{this.TestingContext.DockerHelper.GetCallbackHandlerPort()}/api/v{apiVersion}/callbacks"; + $"http://localhost:{this.TestingContext.DockerHelper.GetCallbackHandlerPort()}/api/callbacks"; HttpRequestMessage msg = new(HttpMethod.Post, requestUri); var payload = StringSerialiser.Serialise(testingContextDeposit); @@ -88,12 +87,11 @@ public async Task WhenISendTheRequestsToTheCallbackHandlerForDeposits() { [Then("the deposit records are recorded")] public async Task ThenTheDepositRecordsAreRecorded() { - String apiVersion = ScenarioContext.ScenarioInfo.Arguments["APIVersion"].ToString(); using HttpClient client = new(); foreach (var sentCallback in this.TestingContext.SentCallbacks) { String requestUri = - $"http://localhost:{this.TestingContext.DockerHelper.GetCallbackHandlerPort()}/api/v{apiVersion}/callbacks/{sentCallback.Key}"; + $"http://localhost:{this.TestingContext.DockerHelper.GetCallbackHandlerPort()}/api/callbacks/{sentCallback.Key}"; HttpRequestMessage msg = new(HttpMethod.Get, requestUri); var response = await client.SendAsync(msg); response.StatusCode.ShouldBe(HttpStatusCode.OK); diff --git a/CallbackHandler/Endpoints/CallbackEndpoints.cs b/CallbackHandler/Endpoints/CallbackEndpoints.cs index 72c81d7..4fffce7 100644 --- a/CallbackHandler/Endpoints/CallbackEndpoints.cs +++ b/CallbackHandler/Endpoints/CallbackEndpoints.cs @@ -1,6 +1,4 @@ -using Asp.Versioning; -using Asp.Versioning.Builder; -using CallbackHandler.DataTransferObjects; +using CallbackHandler.DataTransferObjects; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing; @@ -10,18 +8,16 @@ namespace CallbackHandler.Endpoints { public static class CallbackEndpoints { + private const string BaseRoute = "/api/callbacks"; + public static IEndpointRouteBuilder MapCallbackEndpoints(this IEndpointRouteBuilder endpoints) { - IVersionedEndpointRouteBuilder api = endpoints.NewVersionedApi("Callbacks"); - RouteGroupBuilder group = api - .MapGroup("/api/v{version:apiVersion}/callbacks") - .WithTags("Callbacks") - .HasApiVersion(new ApiVersion(1.0)); + RouteGroupBuilder group = endpoints.MapGroup(BaseRoute).WithTags("Callbacks"); group.MapPost("/", Handlers.CallbackHandlers.RecordCallback) .WithName("RecordCallback") .WithSummary("Receive a deposit callback") - .WithDescription("Accepts a deposit notification from the transaction processor, records it, and returns the identifier assigned to the callback. Use that identifier with GetCallback to retrieve the recorded message.") + .WithDescription("Accepts a deposit notification from an external bank, records it, and returns the identifier assigned to the callback. Use that identifier with GetCallback to retrieve the recorded message.") .Accepts("application/json") .Produces(StatusCodes.Status200OK) .Produces(StatusCodes.Status400BadRequest)