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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
Expand All @@ -8,10 +8,10 @@
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http" Version="10.0.13" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.13" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.13" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.13" />
<PackageReference Include="Microsoft.Extensions.Http" Version="10.0.14" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.14" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.14" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.14" />
</ItemGroup>
<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
Expand All @@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.11.0" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="10.0.13" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="10.0.14" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="4.0.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
10 changes: 5 additions & 5 deletions HealthMonitoring/HealthMonitoring/HealthMonitoring.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
<Content Update="hosting.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.13">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.14">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.13" />
<PackageReference Include="KurrentDB.Client" Version="1.5.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.14" />
<PackageReference Include="KurrentDB.Client" Version="1.6.1" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="7.1.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="10.0.13" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="10.0.13" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="10.0.14" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="10.0.14" />
</ItemGroup>
</Project>
32 changes: 32 additions & 0 deletions ManageServices.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

@echo off
setlocal

if /I "%~1"=="start" goto run
if /I "%~1"=="stop" goto run
if /I "%~1"=="restart" goto run

echo Usage: %~nx0 start^|stop^|restart
exit /b 1

:run
echo Managing Transaction Processing services...
echo Action: %~1
echo.

powershell.exe -NoProfile -ExecutionPolicy Bypass -Command ^
"$services = @(Get-Service -DisplayName 'Transaction Processing -*' | Sort-Object DisplayName);" ^
"if ($services.Count -eq 0) { Write-Error 'No matching services found'; exit 1 };" ^
"foreach ($svc in $services) {" ^
" try {" ^
" Write-Host ('%~1 : ' + $svc.DisplayName);" ^
" switch ('%~1') {" ^
" 'start' { if ($svc.Status -ne 'Running') { Start-Service -Name $svc.Name -ErrorAction Stop } }" ^
" 'stop' { if ($svc.Status -ne 'Stopped') { Stop-Service -Name $svc.Name -ErrorAction Stop } }" ^
" 'restart' { Restart-Service -Name $svc.Name -ErrorAction Stop }" ^
" }" ^
" } catch { Write-Warning $_.Exception.Message; $failed = $true }" ^
"};" ^
"if ($failed) { exit 1 }"

exit /b %errorlevel%
24 changes: 15 additions & 9 deletions TransactionProcessing.MerchantFileProcessor/NLog.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,22 @@
<targets>
<!-- async file wrapper with daily archive -->
<target xsi:type="AsyncWrapper" name="asyncFile" overflowAction="Discard" queueLimit="50000">
<target xsi:type="File"
name="file"
fileName="${var:logDirectory}/merchantfilebuilder.log"
layout="${var:layout}"
archiveFileName="${var:logDirectory}/merchantfilebuilder.{#####}.log"
<target name="logfile" xsi:type="File"
fileName="/home/txnproc/trace/merchantfilebuilder.json"
Comment thread
StuartFerguson marked this conversation as resolved.
Resolved
archiveFileName="/home/txnproc/trace/merchantfilebuilder.{#####}.json"
archiveAboveSize="104857600"
archiveNumbering="Sequence"
concurrentWrites="true"
keepFileOpen="false"
maxArchiveFiles="2"/>
maxArchiveFiles="2">
<layout xsi:type="JsonLayout"
includeEventProperties="true"
excludeProperties="timestampUtc">
<attribute name="timestampUtc" layout="${date:universalTime=true:format=o}" />
<attribute name="level" layout="${level:uppercase=true}" />
<attribute name="message" layout="${message}" />
<attribute name="exception" layout="${exception:format=type,method:maxInnerExceptionLevel=5:innerFormat=shortType,message,method:InnerExceptionSeparator= | }" />
</layout>
</target>
</target>

<!-- async console wrapper -->
Expand All @@ -32,7 +38,7 @@


<rules>
<logger name="Microsoft.*" minlevel="Info" writeTo="console,file" />
<logger name="*" minlevel="Info" writeTo="console,file" />
<logger name="Microsoft.*" minlevel="Info" writeTo="console,logfile" />
<logger name="*" minlevel="Info" writeTo="console,logfile" />
</rules>
</nlog>
5 changes: 3 additions & 2 deletions TransactionProcessing.MerchantFileProcessor/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,9 @@

using (var scope = app.Services.CreateScope())
{
var startupLogger = scope.ServiceProvider.GetRequiredService<Microsoft.Extensions.Logging.ILogger<Program>>();
SharedLogger.Initialise(startupLogger);
LogManager.Setup().LoadConfigurationFromFile("NLog.config");
NLog.Logger logger = LogManager.GetLogger("merchantfileprocessor");
SharedLogger.Initialise(logger, "merchantfileprocessor");

var serialiser = scope.ServiceProvider.GetRequiredService<IStringSerialiser>();
StringSerialiser.Initialise(serialiser);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FileProcessor.Client" Version="2026.10.2.179" />
<PackageReference Include="HealthMonitoring.Client" Version="2026.10.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.13" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="10.0.13" />
<PackageReference Include="FileProcessor.Client" Version="2026.10.3.184" />
<PackageReference Include="HealthMonitoring.Client" Version="2026.10.2.55" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.14" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="10.0.14" />
<PackageReference Include="NLog.Extensions.Logging" Version="6.2.2" />
<PackageReference Include="SecurityService.Client" Version="2026.10.2.200" />
<PackageReference Include="Shared" Version="2026.10.4" />
<PackageReference Include="Shared.Logger" Version="2026.10.4" />
<PackageReference Include="Shared.Results" Version="2026.10.4" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="10.0.13" />
<PackageReference Include="TransactionProcessor.Client" Version="2026.10.2.411" />
<PackageReference Include="SecurityService.Client" Version="2026.10.3.207" />
<PackageReference Include="Shared" Version="2026.11.2" />
<PackageReference Include="Shared.Logger" Version="2026.11.2" />
<PackageReference Include="Shared.Results" Version="2026.11.2" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="10.0.14" />
<PackageReference Include="TransactionProcessor.Client" Version="2026.10.3.427" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="9.0.0" />
</ItemGroup>

Expand Down
5 changes: 3 additions & 2 deletions TransactionProcessing.MerchantPos/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@
var db = scope.ServiceProvider.GetRequiredService<MerchantDbContext>();
await db.Database.EnsureCreatedAsync();

var diLogger = scope.ServiceProvider.GetRequiredService<Microsoft.Extensions.Logging.ILogger<Program>>();
Shared.Logger.Logger.Initialise(diLogger);
LogManager.Setup().LoadConfigurationFromFile("NLog.config");
NLog.Logger dilogger = LogManager.GetLogger("MerchantPOS");
Shared.Logger.Logger.Initialise(dilogger, "MerchantPOS");

var serialiser = scope.ServiceProvider.GetRequiredService<IStringSerialiser>();
StringSerialiser.Initialise(serialiser);
Expand Down
21 changes: 11 additions & 10 deletions TransactionProcessing.MerchantPos/Runtime/ApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using TransactionProcessorACL.DataTransferObjects.Responses;
using OperatorTotalRequest = TransactionProcessorACL.DataTransferObjects.OperatorTotalRequest;
using TransactionProcessing.MerchantPos.Persistence;
using TransactionProcessor.DataTransferObjects.Responses.Merchant;

namespace TransactionProcessing.MerchantPos.Runtime;

Expand Down Expand Up @@ -88,7 +89,7 @@ public async Task<Result> SendLogon(MerchantConfig cfg,
Int32 transactionNumber,
CancellationToken cancellationToken) {

LogonTransactionRequestMessage logonTransactionRequest = new() { ApplicationVersion = cfg.ApplicationVersion, DeviceIdentifier = cfg.DeviceIdentifier, TransactionDateTime = DateTime.Now, TransactionNumber = transactionNumber.ToString("D4") };
LogonTransactionRequestMessage logonTransactionRequest = new() { ApplicationVersion = cfg.ApplicationVersion, DeviceIdentifier = cfg.DeviceIdentifier, TransactionDateTime = DateTime.UtcNow, TransactionNumber = transactionNumber.ToString("D4") };

Result<LogonTransactionResponseMessage> result = await this.SendTransactionRequest<LogonTransactionRequestMessage, LogonTransactionResponseMessage>(logonTransactionRequest, "api/logontransactions", token, cancellationToken);

Expand Down Expand Up @@ -218,8 +219,8 @@ public async Task<Result> SendDeposit(MerchantConfig cfg,
CancellationToken cancellationToken) {
var result = await this.TransactionProcessorClient.MakeMerchantDeposit(token.AccessToken, cfg.EstateId, cfg.MerchantId, new MakeMerchantDepositRequest {
Amount = amount,
DepositDateTime = DateTime.Now,
Reference = $"AutoDeposit{DateTime.Now:yyyy-MM-dd}"
DepositDateTime = DateTime.UtcNow,
Reference = $"AutoDeposit{DateTime.UtcNow:yyyy-MM-dd}"
}, cancellationToken);

if (result.IsFailed) {
Expand All @@ -237,7 +238,7 @@ public async Task<Result> SendReconciliation(MerchantConfig cfg,
ReconciliationRequestMessage reconciliationRequest = new ReconciliationRequestMessage
{
ApplicationVersion = cfg.ApplicationVersion,
TransactionDateTime = DateTime.Now,
TransactionDateTime = DateTime.UtcNow,
DeviceIdentifier = cfg.DeviceIdentifier,
TransactionCount = totals.Sum(t=> t.TotalCount),
TransactionValue = totals.Sum(t => t.Total),
Expand Down Expand Up @@ -285,7 +286,7 @@ private async Task<Result<List<SaleTransactionRequestMessage>>> BuildBillPayment
ApplicationVersion = cfg.ApplicationVersion,
DeviceIdentifier = cfg.DeviceIdentifier,
ContractId = product.ContractId,
TransactionDateTime = DateTime.Now,
TransactionDateTime = DateTime.UtcNow,
TransactionNumber = transactionNumber.ToString("D4")
};

Expand All @@ -305,7 +306,7 @@ private async Task<Result<List<SaleTransactionRequestMessage>>> BuildBillPayment
ApplicationVersion = cfg.ApplicationVersion,
DeviceIdentifier = cfg.DeviceIdentifier,
ContractId = product.ContractId,
TransactionDateTime = DateTime.Now,
TransactionDateTime = DateTime.UtcNow,
TransactionNumber = transactionNumber.ToString("D4")
};

Expand Down Expand Up @@ -343,7 +344,7 @@ private Result<List<SaleTransactionRequestMessage>> BuildMobileSaleTransactionRe
ApplicationVersion = cfg.ApplicationVersion,
DeviceIdentifier = cfg.DeviceIdentifier,
ContractId = product.ContractId,
TransactionDateTime = DateTime.Now,
TransactionDateTime = DateTime.UtcNow,
TransactionNumber = transactionNumber.ToString("D4")
};

Expand All @@ -365,7 +366,7 @@ private Result<List<SaleTransactionRequestMessage>> BuildVoucherTransactionReque
ApplicationVersion = cfg.ApplicationVersion,
DeviceIdentifier = cfg.DeviceIdentifier,
ContractId = product.ContractId,
TransactionDateTime = DateTime.Now,
TransactionDateTime = DateTime.UtcNow,
TransactionNumber = transactionNumber.ToString("D4")
};

Expand Down Expand Up @@ -408,7 +409,7 @@ private String BuildRequestUrl(String route) {

var body = new
{
due_date = DateTime.Now.AddDays(1),
due_date = DateTime.UtcNow.AddDays(1),
amount = billAmount,
account_number = accountNumber,
account_name = $"Test Account {accountNumber}"
Expand All @@ -431,7 +432,7 @@ private String BuildRequestUrl(String route) {
String baseAddress = this.SettingsStore.Current.ApiConfiguration.TestHost;
var body = new
{
due_date = DateTime.Now.AddDays(1),
due_date = DateTime.UtcNow.AddDays(1),
meter_number = meterNumber,
customer_name = $"Customer {meterNumber}"
};
Expand Down
6 changes: 3 additions & 3 deletions TransactionProcessing.MerchantPos/Runtime/MerchantRuntime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private async Task RunMainLoop(MerchantConfig cfg,
while (!token.IsCancellationRequested) {
Merchant merchant = await this.Repository.GetMerchant(cfg.MerchantId)
?? throw new InvalidOperationException($"Merchant {cfg.MerchantId} was not found.");
DateTime currentTime = DateTime.Now;
DateTime currentTime = DateTime.UtcNow;
Comment thread
StuartFerguson marked this conversation as resolved.
Resolved
MerchantResponse merchantConfig = cfg.Merchant
?? throw new InvalidOperationException($"Merchant details were not loaded for {cfg.MerchantName}.");
(TimeSpan openingTime, TimeSpan closingTime) = GetTradingHours(cfg, merchantConfig, currentTime);
Expand All @@ -178,7 +178,7 @@ private async Task RunMainLoop(MerchantConfig cfg,
continue;
}

DateTime now = DateTime.Now;
DateTime now = DateTime.UtcNow;
if (merchant.LastLogonDateTime.Date != now.Date)
{
Result tokenResult = await this.GetUserToken(cfg, token);
Expand Down Expand Up @@ -323,7 +323,7 @@ private async Task DoReconciliation(MerchantConfig cfg, CancellationToken cancel
await ApiClient.SendReconciliation(cfg, userToken, totals, cancellationToken);

// Clear totals
await this.Repository.UpdateLastEndOfDay(cfg.MerchantId, cfg.MerchantName, DateTime.Now);
await this.Repository.UpdateLastEndOfDay(cfg.MerchantId, cfg.MerchantName, DateTime.UtcNow);
await Repository.ClearTotals(cfg.MerchantId);

this.Metrics.SetLastEndOfDay(cfg.MerchantId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
<None Include="appsettings.development.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="HealthMonitoring.Client" Version="2026.10.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="10.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.13" />
<PackageReference Include="HealthMonitoring.Client" Version="2026.10.2.55" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="10.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.14" />
<PackageReference Include="NLog.Web.AspNetCore" Version="6.2.2" />
<PackageReference Include="SecurityService.Client" Version="2026.10.2.200" />
<PackageReference Include="Shared" Version="2026.10.4" />
<PackageReference Include="Shared.Logger" Version="2026.10.4" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="10.0.13" />
<PackageReference Include="TransactionProcessor.Client" Version="2026.10.2.411" />
<PackageReference Include="TransactionProcessorACL.DataTransferObjects" Version="2026.10.2.162" />
<PackageReference Include="SecurityService.Client" Version="2026.10.3.207" />
<PackageReference Include="Shared" Version="2026.11.2" />
<PackageReference Include="Shared.Logger" Version="2026.11.2" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="10.0.14" />
<PackageReference Include="TransactionProcessor.Client" Version="2026.10.3.427" />
<PackageReference Include="TransactionProcessorACL.DataTransferObjects" Version="2026.10.3.166" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="9.0.0" />
</ItemGroup>
<ItemGroup>
Expand Down
20 changes: 13 additions & 7 deletions TransactionProcessing.MerchantPos/nlog.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@
<targets>
<!-- async file wrapper with daily archive -->
<target xsi:type="AsyncWrapper" name="asyncFile" overflowAction="Discard" queueLimit="50000">
<target xsi:type="File"
name="file"
fileName="/home/txnproc/trace/merchantpos.log"
layout="${date:format=dd/MM/yyyy HH\:mm\:ss.ffff} | ${level} |${mdlc:CorrelationId:fallback=NO-ID}| ${callsite:className=true} | ${message} | ${exception:format=type,method:maxInnerExceptionLevel=5:innerFormat=shortType,message,method:InnerExceptionSeparator= | }"
archiveFileName="/home/txnproc/trace/merchantpos.{#####}.log"
<target name="logfile" xsi:type="File"
fileName="/home/txnproc/trace/merchantpos.json"
archiveFileName="/home/txnproc/trace/merchantpos.{#####}.json"
archiveAboveSize="104857600"
archiveNumbering="Sequence"
concurrentWrites="true"
keepFileOpen="false"
maxArchiveFiles="2"/>
maxArchiveFiles="2">
<layout xsi:type="JsonLayout"
includeEventProperties="true"
excludeProperties="timestampUtc">
<attribute name="timestampUtc" layout="${date:universalTime=true:format=o}" />
<attribute name="level" layout="${level:uppercase=true}" />
<attribute name="message" layout="${message}" />
<attribute name="exception" layout="${exception:format=type,method:maxInnerExceptionLevel=5:innerFormat=shortType,message,method:InnerExceptionSeparator= | }" />
</layout>
</target>
</target>

<!-- async console wrapper -->
Expand Down
Loading
Loading