Adjust location of classes further.

This commit is contained in:
2026-07-17 17:10:28 +02:00
parent 69cb05f389
commit 29d179a23a
21 changed files with 82 additions and 56 deletions
@@ -1,14 +1,17 @@
using FinancialApi.Application.Commands;
using FinancialApi.Application.Events;
using FinancialApi.Application.Queries;
using FinancialApi.Application.Interfaces;
using FinancialApi.Application.Models;
using FinancialApi.Domain;
using FinancialApi.Domain.Aggregates;
using FinancialApi.Domain.Entities;
using Wolverine.Persistence;
namespace FinancialApi.Application.Handlers;
public static class ApplyFeeHandler
{
public static async Task<FeePair> LoadAsync(
public static async Task<FeeContext> LoadAsync(
ApplyFeeCommand cmd,
IAccountQuery query, TimeProvider timeProvider)
{
@@ -19,7 +22,7 @@ public static class ApplyFeeHandler
throw new InvalidOperationException($"Cannot process transfer. Account(s) not found.");
}
return new FeePair(source, dest, timeProvider.GetUtcNow());
return new FeeContext(source, dest, timeProvider.GetUtcNow());
}
public static (
@@ -30,11 +33,11 @@ public static class ApplyFeeHandler
)
Handle(
ApplyFeeCommand cmd,
FeePair pair
FeeContext context
)
{
var updatedSource = pair.Source.ApplyPosting(cmd.Amount, EntryType.Debit);
var updatedRevenue = pair.Destination.ApplyPosting(cmd.Amount, EntryType.Credit);
var updatedSource = context.Source.ApplyPosting(cmd.Amount, EntryType.Debit);
var updatedRevenue = context.Destination.ApplyPosting(cmd.Amount, EntryType.Credit);
var serviceFee = 0.5m;
var lines = new List<JournalLine>
@@ -46,7 +49,7 @@ public static class ApplyFeeHandler
var journalEntry = BalancedJournal.Create(Guid.NewGuid(),
$"Service Fee Applied: {cmd.Amount} to Account {cmd.AccountId}",
pair.TimeStamp, lines);
context.TimeStamp, lines);
var @event = new FeeAppliedEvent(cmd.AccountId, cmd.Amount);