feat(invoicing): connect signed estimates and verified payment receipts

Freeze invoice totals and parties, record offline receipts and verify completed PayPal transactions. Protect idempotence and concurrent balance updates; add migration, API client, documentation and tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Paul Schneider 2026-10-19 20:29:08 +01:00
commit 2dcbcd35b3
Signed by: notazof
GPG key ID: AD4B9B545FBD7D12
37 changed files with 6686 additions and 12 deletions

View file

@ -61,6 +61,22 @@ namespace Yavsc.Models
builder.Entity<NominativeServiceCommand>()
.Property(command => command.AmountPaid)
.HasDefaultValue(0m);
builder.Entity<NominativeServiceCommand>()
.Property(command => command.PaymentRevision)
.HasDefaultValue(Guid.Empty);
builder.Entity<NominativeServiceCommand>()
.HasOne<Estimate>().WithMany()
.HasForeignKey(command => command.InvoiceEstimateId)
.OnDelete(DeleteBehavior.Restrict);
builder.Entity<NominativeServiceCommand>()
.HasIndex(command => command.InvoiceEstimateId).IsUnique();
builder.Entity<InvoicePayment>()
.HasIndex(payment => new { payment.Source, payment.ReferenceScope, payment.Reference })
.IsUnique();
builder.Entity<InvoicePayment>()
.HasOne(payment => payment.Command).WithMany()
.HasForeignKey(payment => payment.CommandId)
.OnDelete(DeleteBehavior.Restrict);
builder.Entity<ResourceUsageRecord>(entity =>
{
@ -358,6 +374,7 @@ namespace Yavsc.Models
public DbSet<BlogTag> TagsDomain { get; set; }
public DbSet<EstimateTemplate> EstimateTemplates { get; set; }
public DbSet<InvoicePayment> InvoicePayments { get; set; }
public DbSet<Contact> Contact { get; set; }