Allow amateur performer profiles
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
f1c23965b2
commit
0728d2a3f7
20 changed files with 217 additions and 29 deletions
|
|
@ -38,6 +38,10 @@ public sealed class InvoicingService(ApplicationDbContext db, IPayPalTransaction
|
|||
RequirePerformer(actorId, command.InvoicePerformerId!, administrator);
|
||||
return await ResponseAsync(command, ct);
|
||||
}
|
||||
var performerProfile = await db.Performers.AsNoTracking()
|
||||
.SingleOrDefaultAsync(profile => profile.PerformerId == estimate.OwnerId, ct);
|
||||
if (string.IsNullOrWhiteSpace(performerProfile?.SIREN))
|
||||
throw new InvoiceOperationException(409, "A business registration is required to issue invoices.");
|
||||
if (command.InvoiceEstimateId.HasValue || command.AmountDue.HasValue || command.AmountPaid != 0m)
|
||||
throw new InvoiceOperationException(409, "This command already has an invoice or a balance requiring reconciliation.");
|
||||
if (command.ClientId != estimate.ClientId || command.PerformerId != estimate.OwnerId)
|
||||
|
|
|
|||
Loading…
Reference in a new issue