Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 13 additions & 18 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
<ItemGroup>
<PackageVersion Include="AspNetCore.HealthChecks.UI.Client" Version="9.0.0" />
<PackageVersion Include="AspNetCore.HealthChecks.Uris" Version="9.0.0" />
<PackageVersion Include="ClientProxyBase" Version="2026.10.3" />
<PackageVersion Include="ClientProxyBase" Version="2026.10.4" />
<PackageVersion Include="coverlet.collector" Version="10.1.0" />
<PackageVersion Include="HealthMonitoring.Client" Version="2026.9.4.53" />
<PackageVersion Include="HealthMonitoring.Client" Version="2026.10.1" />
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.12.0" />
<PackageVersion Include="Ductus.FluentDocker" Version="2.85.0" />
<PackageVersion Include="EventStoreProjections" Version="2023.12.3" />
<PackageVersion Include="KurrentDB.Client" Version="1.5.0" />
<PackageVersion Include="KurrentDB.Client" Version="1.6.0" />
<PackageVersion Include="Lamar" Version="16.0.0" />
<PackageVersion Include="Lamar.Microsoft.DependencyInjection" Version="16.0.0" />
<PackageVersion Include="MediatR" Version="14.2.0" />
<PackageVersion Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="11.1.0" />
<PackageVersion Include="MessagingService.IntegrationTesting.Helpers" Version="2026.9.3.155" />
<PackageVersion Include="MessagingService.IntegrationTesting.Helpers" Version="2026.10.2.156" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.13" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.13" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="10.0.13" />
Expand All @@ -29,7 +29,7 @@
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport" Version="2.5.1" />
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.23.0" />
<PackageVersion Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="10.0.2" />
<PackageVersion Include="Imposter" Version="1.0.0" />
<PackageVersion Include="Imposter" Version="1.0.3" />
<PackageVersion Include="NLog.Extensions.Logging" Version="6.2.2" />
<PackageVersion Include="NUnit" Version="5.0.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="6.3.1" />
Expand All @@ -38,20 +38,15 @@
<PackageVersion Include="Reqnroll" Version="3.3.4" />
<PackageVersion Include="Reqnroll.NUnit" Version="3.3.4" />
<PackageVersion Include="Reqnroll.Tools.MsBuild.Generation" Version="3.3.4" />
<PackageVersion Include="SecurityService.Client" Version="2026.9.3.198" />
<PackageVersion Include="SecurityService.IntegrationTesting.Helpers" Version="2026.9.3.198" />
<PackageVersion Include="Shared" Version="2026.10.3" />
<PackageVersion Include="Shared.IntegrationTesting" Version="2026.10.3" />
<PackageVersion Include="Shared.Results.Web" Version="2026.10.3" />
<PackageVersion Include="SecurityService.Client" Version="2026.10.2.200" />
<PackageVersion Include="SecurityService.IntegrationTesting.Helpers" Version="2026.10.2.200" />
<PackageVersion Include="Shared" Version="2026.10.4" />
<PackageVersion Include="Shared.IntegrationTesting" Version="2026.10.4" />
<PackageVersion Include="Shared.Results.Web" Version="2026.10.4" />
<PackageVersion Include="Shouldly" Version="4.3.0" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="10.3.0" />
<PackageVersion Include="Swashbuckle.AspNetCore.Annotations" Version="10.3.0" />
<PackageVersion Include="Swashbuckle.AspNetCore.Filters" Version="10.0.1" />
<PackageVersion Include="Swashbuckle.AspNetCore.Swagger" Version="10.3.0" />
<PackageVersion Include="Swashbuckle.AspNetCore.SwaggerGen" Version="10.3.0" />
<PackageVersion Include="Swashbuckle.AspNetCore.SwaggerUI" Version="10.3.0" />
<PackageVersion Include="TransactionProcessor.Client" Version="2026.9.3.409" />
<PackageVersion Include="TransactionProcessor.IntegrationTesting.Helpers" Version="2026.9.3.409" />
<PackageVersion Include="TransactionProcessing.ApiDefaults" Version="2026.10.4" />
<PackageVersion Include="TransactionProcessor.Client" Version="2026.10.2.411" />
<PackageVersion Include="TransactionProcessor.IntegrationTesting.Helpers" Version="2026.10.2.411" />
<PackageVersion Include="Sentry.AspNetCore" Version="6.12.1" />
<PackageVersion Include="xunit.v3" Version="4.0.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="4.0.1" />
Expand Down
28 changes: 19 additions & 9 deletions TransactionProcessorACL.BusinessLogic.Tests/MediatorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
using System.Text;
using System.Threading.Tasks;
using SimpleResults;
using Shared.General;
using Shared.Serialisation;
using TransactionProcessorACL.Testing;
using Xunit;

Expand Down Expand Up @@ -53,14 +55,21 @@ public async Task Mediator_Send_RequestHandled()
hostingEnvironment.ApplicationName.Getter().Returns("Test Application");

ServiceRegistry services = new ServiceRegistry();
Startup s = new Startup(hostingEnvironment.Instance());
Startup.Configuration = this.SetupMemoryConfiguration();

this.AddTestRegistrations(services, hostingEnvironment.Instance());
s.ConfigureContainer(services);

IConfigurationRoot configuration = this.SetupMemoryConfiguration();
ConfigurationReader.Initialise(configuration);

this.AddTestRegistrations(services, hostingEnvironment.Instance(), configuration);
services.IncludeRegistry(new TransactionProcessorACL.Bootstrapper.MiddlewareRegistry(configuration));
services.IncludeRegistry(new TransactionProcessorACL.Bootstrapper.ApplicationServiceRegistry());
services.IncludeRegistry(new TransactionProcessorACL.Bootstrapper.ClientRegistry());
services.IncludeRegistry(new TransactionProcessorACL.Bootstrapper.MediatorRegistry(configuration));
services.IncludeRegistry(new TransactionProcessorACL.Bootstrapper.MiscRegistry());
services.IncludeRegistry(new TransactionProcessorACL.Bootstrapper.SerialiserRegistry());

using Container container = new(services);
StringSerialiser.Initialise(container.GetRequiredService<IStringSerialiser>());
List<String> errors = new List<String>();
IMediator mediator = Startup.Container.GetService<IMediator>();
IMediator mediator = container.GetService<IMediator>();
foreach (IBaseRequest baseRequest in this.Requests)
{
try
Expand Down Expand Up @@ -92,15 +101,16 @@ private IConfigurationRoot SetupMemoryConfiguration()
}

private void AddTestRegistrations(ServiceRegistry services,
IWebHostEnvironment hostingEnvironment)
IWebHostEnvironment hostingEnvironment,
IConfiguration configuration)
{
services.AddLogging();
DiagnosticListener diagnosticSource = new DiagnosticListener(hostingEnvironment.ApplicationName);
services.AddSingleton<DiagnosticSource>(diagnosticSource);
services.AddSingleton<DiagnosticListener>(diagnosticSource);
services.AddSingleton<IWebHostEnvironment>(hostingEnvironment);
services.AddSingleton<IHostEnvironment>(hostingEnvironment);
services.AddSingleton<IConfiguration>(Startup.Configuration);
services.AddSingleton(configuration);

services.OverrideServices(s => { s.AddSingleton<ITransactionProcessorACLApplicationService, DummyTransactionProcessorACLApplicationService>(); });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
using SimpleResults;
using TransactionProcessorACL.BusinessLogic.Requests;
using TransactionProcessorACL.BusinessLogic.Services;
using TransactionProcessorACL.Models;
using TransactionProcessorACL.DataTransferObjects.Requests;
using TransactionProcessorACL.Models;

namespace TransactionProcessorACL.BusinessLogic.RequestHandlers;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ public async Task<Result<MerchantDailyPerformanceSummaryResponse>> GetMerchantDa
if (apiResponse.IsFailed)
return ResultHelpers.CreateFailure(apiResponse);

MerchantDailyPerformanceSummaryResponse response = new MerchantDailyPerformanceSummaryResponse {
MerchantDailyPerformanceSummaryResponse response = new() {
Metrics = apiResponse.Data.Metrics.Select(m => new MetricItem { Category = m.Category, Description = m.Description, Title = m.Title, Value = m.Value }).ToList(),
DrillDownTransactions = apiResponse.Data.DrillDownTransactions.Select(d => new DrillDownTransaction {
Amount = d.Amount,
Expand Down Expand Up @@ -466,7 +466,7 @@ public async Task<Result<MerchantTransactionMixSummaryResponse>> GetMerchantTran
if (apiResponse.IsFailed)
return ResultHelpers.CreateFailure(apiResponse);

MerchantTransactionMixSummaryResponse response = new MerchantTransactionMixSummaryResponse() {
MerchantTransactionMixSummaryResponse response = new() {
Breakdown = Enum.Parse<Models.TransactionMixBreakdown>(apiResponse.Data.Breakdown.ToString()),
Measure = Enum.Parse<Models.TransactionMixMeasure>(apiResponse.Data.Measure.ToString()),
FromDate = apiResponse.Data.FromDate,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
using System;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;

namespace TransactionProcessorACL.DataTransferObjects.Requests;

[ExcludeFromCodeCoverage]
public class MerchantDailyPerformanceSummaryRequest
{
[Description("Reporting identifier of the merchant to summarize.")]
public int MerchantReportingId { get; set; }

[Description("Inclusive start of the reporting date/time range.")]
public DateTime StartDate { get; set; }

[Description("Inclusive end of the reporting date/time range.")]
public DateTime EndDate { get; set; }

[Description("Client application version used by the version check when supplied in the JSON request body.")]
public String ApplicationVersion { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
using System;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;

namespace TransactionProcessorACL.DataTransferObjects.Requests;

[ExcludeFromCodeCoverage]
public class MerchantTransactionMixSummaryRequest
{
[Description("Reporting identifier of the merchant to summarize.")]
public int MerchantReportingId { get; set; }

[Description("Inclusive start of the reporting date/time range.")]
public DateTime StartDate { get; set; }

[Description("Inclusive end of the reporting date/time range.")]
public DateTime EndDate { get; set; }

[Description("Numeric grouping dimension: 1=TransactionType, 2=Product, 3=Operator, 4=Status.")]
public TransactionMixBreakdown Breakdown { get; set; }

[Description("Numeric measure: 1=Count, 2=Value.")]
public TransactionMixMeasure Measure { get; set; }

[Description("Client application version used by the version check when supplied in the JSON request body.")]
public String ApplicationVersion { get; set; }

[Description("Maximum number of ranked groups to return. Defaults to 5.")]
public int TopN { get; set; } = 5;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,25 @@
{
using System;
using System.Diagnostics.CodeAnalysis;
using System.ComponentModel;

[ExcludeFromCodeCoverage]
public class OperatorTotalRequest
{
#region Properties

[Description("Contract for this operator's totals.")]
public Guid ContractId { get; set; }

[Description("Operator whose transactions are included in these totals.")]
public Guid OperatorId { get; set; }

[Description("Transaction count for this operator and contract.")]
public Int32 TransactionCount { get; set; }

[Description("Transaction value for this operator and contract.")]
public Decimal TransactionValue { get; set; }

#endregion
}
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
using System;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;

namespace TransactionProcessorACL.DataTransferObjects.Requests;

[ExcludeFromCodeCoverage]
public class RecentActivityReceiptSearchRequest
{
[Description("Client application version used by the version check when supplied in the JSON request body.")]
public string ApplicationVersion { get; set; }

[Description("Reporting identifier of the merchant to search.")]
public int MerchantReportingId { get; set; }

[Description("Date whose transaction activity should be searched.")]
public DateTime ReportDate { get; set; }

[Description("Optional text used to filter matching transactions or receipts.")]
public string? SearchText { get; set; }

[Description("One-based page number. Defaults to 1.")]
public int PageNumber { get; set; } = 1;

[Description("Maximum number of results per page. Defaults to 5.")]
public int PageSize { get; set; } = 5;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.ComponentModel;

[ExcludeFromCodeCoverage]
public class ReconciliationRequestMessage : TransactionRequestMessage
{
[Description("Optional reconciliation totals broken down by operator and contract.")]
public List<OperatorTotalRequest> OperatorTotals { get; set; }

[Description("Total number of transactions in the reconciliation period.")]
public Int32 TransactionCount { get; set; }

[Description("Total monetary value of transactions in the reconciliation period.")]
public Decimal TransactionValue { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
using System.Diagnostics.CodeAnalysis;
using System.ComponentModel;

namespace TransactionProcessorACL.DataTransferObjects.Requests;

[ExcludeFromCodeCoverage]
public class ResendReceiptRequestMessage
{
[Description("Transaction reference or receipt reference for the receipt to resend. Required.")]
public string Reference { get; set; }

[Description("Valid email address to receive the receipt. Required.")]
public string RecipientEmailAddress { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,25 @@
{
using System;
using System.Diagnostics.CodeAnalysis;
using System.ComponentModel;

[ExcludeFromCodeCoverage]
public class SaleTransactionRequestMessage : TransactionRequestMessage
{
#region Properties

[Description("Contract under which the sale is processed.")]
public Guid ContractId { get; set; }

[Description("Operator who performed the sale.")]
public Guid OperatorId { get; set; }

[Description("Optional email address for the customer receipt.")]
public String CustomerEmailAddress { get; set; }

[Description("Product being sold under the selected contract.")]
public Guid ProductId { get; set; }

#endregion
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,34 @@
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;

[ExcludeFromCodeCoverage]
public class TransactionRequestMessage
{
#region Properties

[Description("Estate identifier from the transaction context. The API derives the authoritative estate from the access token.")]
public Guid EstateId { get; set; }
[Description("Merchant identifier from the transaction context. The API derives the authoritative merchant from the access token.")]
public Guid MerchantId { get; set; }

[Description("Client application version. The API version check is performed using the applicationVersion query parameter or the application_version JSON field.")]
public String ApplicationVersion { get; set; }

[Description("Identifier of the device that initiated the transaction.")]
public String DeviceIdentifier { get; set; }

[Description("Date and time when the transaction occurred.")]
public DateTime TransactionDateTime { get; set; }

[Description("Client supplied transaction reference or number.")]
public String TransactionNumber { get; set; }

[Description("Optional string key/value metadata associated with the request.")]
public Dictionary<String,String> AdditionalRequestMetadata { get; set; }

#endregion
}
}
}
Loading
Loading