Creating a Journal Reversal handler.

This commit is contained in:
2026-07-15 17:29:02 +02:00
parent 0376b58a33
commit e109c1c695
7 changed files with 122 additions and 6 deletions
@@ -20,4 +20,13 @@ public record BalancedJournal
return new(new JournalEntry(id, description, createdAt, lines));
}
public static BalancedJournal CreateReversal(JournalEntry original, string reason, DateTimeOffset now)
{
var reversedLines = original.Lines.Select(l =>
l with { Type = l.Type == EntryType.Debit ? EntryType.Credit : EntryType.Debit })
.ToList();
return Create(Guid.NewGuid(), reason, now, reversedLines);
}
}