@@ -4,7 +4,9 @@ using ROLAC.API.Data;
|
||||
using ROLAC.API.DTOs.Disbursement;
|
||||
using ROLAC.API.DTOs.Shared;
|
||||
using ROLAC.API.Entities;
|
||||
using ROLAC.API.Entities.Logging;
|
||||
using ROLAC.API.Services.Disbursement;
|
||||
using ROLAC.API.Services.Logging;
|
||||
using ROLAC.API.Services.Storage;
|
||||
|
||||
namespace ROLAC.API.Services;
|
||||
@@ -15,10 +17,11 @@ public class DisbursementService : IDisbursementService
|
||||
private readonly IHttpContextAccessor _http;
|
||||
private readonly IFileStorage _storage;
|
||||
private readonly ICheckPrintService _print;
|
||||
private readonly IAuditLogger _audit;
|
||||
|
||||
public DisbursementService(AppDbContext db, IHttpContextAccessor http,
|
||||
IFileStorage storage, ICheckPrintService print)
|
||||
{ _db = db; _http = http; _storage = storage; _print = print; }
|
||||
IFileStorage storage, ICheckPrintService print, IAuditLogger audit)
|
||||
{ _db = db; _http = http; _storage = storage; _print = print; _audit = audit; }
|
||||
|
||||
// The JWT carries the user id in the "sub" claim (NameClaimType="sub"); NameIdentifier
|
||||
// is absent at runtime. Check NameIdentifier first (tests), then "sub" (real tokens).
|
||||
@@ -157,6 +160,11 @@ public class DisbursementService : IDisbursementService
|
||||
|
||||
result.Created.Add(new IssuedCheckDto
|
||||
{ CheckId = check.Id, CheckNumber = checkNumber, PayeeName = p.PayeeName, Amount = amount });
|
||||
|
||||
_audit.Write(
|
||||
AuditActions.CheckIssued, AuditCategories.Business, LogLevelEnum.Information,
|
||||
entityName: nameof(Check), entityId: check.Id.ToString(),
|
||||
summary: $"Check #{checkNumber} issued to {p.PayeeName} — {amount:C}");
|
||||
}
|
||||
|
||||
await tx.CommitAsync();
|
||||
@@ -227,6 +235,11 @@ public class DisbursementService : IDisbursementService
|
||||
}
|
||||
await _db.SaveChangesAsync();
|
||||
await tx.CommitAsync();
|
||||
|
||||
_audit.Write(
|
||||
AuditActions.CheckVoided, AuditCategories.Business, LogLevelEnum.Warning,
|
||||
entityName: nameof(Check), entityId: c.Id.ToString(),
|
||||
summary: $"Check #{c.CheckNumber} voided ({reason})");
|
||||
}
|
||||
|
||||
// ── Receipt e-signature ─────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user