51f0021e27
- Added customerId to guest booking requests for better identification. - Implemented new endpoints for managing booking invoices and dashboard summaries. - Created BookingInvoice and BookingDashboardSummary DTOs to support new features. - Updated Booking and BookingInvoice models to include payment method and timestamps. - Enhanced BookingService to handle invoice creation upon payment confirmation. - Modified BookingRepository to support CRUD operations for BookingInvoice. - Updated TenantDbContext to include BookingInvoice DbSet and relevant configurations. - Improved error handling and validation for booking completion and payment processes.
45 lines
1.7 KiB
C#
45 lines
1.7 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace Fitness_core_BE.Models
|
|
{
|
|
/// <summary>A snapshot receipt generated the moment a Booking's payment is recorded (either
|
|
/// via MarkGuestBookingPaid or the Complete checkout flow) -- deliberately NOT a live join to
|
|
/// Booking/Facility, so it stays stable and printable even if the booking is later reassigned,
|
|
/// rescheduled, or the facility renamed. Purpose-built for bookings and kept entirely separate
|
|
/// from CustomerInvoice, which is hardwired to the membership/subscription domain
|
|
/// (FKCustomerSubscriptionId is required there) and has no concept of a one-off booking
|
|
/// charge.</summary>
|
|
public class BookingInvoice
|
|
{
|
|
[Key]
|
|
public Guid BookingInvoiceId { get; set; }
|
|
|
|
public Guid FKBookingId { get; set; }
|
|
[ForeignKey(nameof(FKBookingId))]
|
|
public Booking? Booking { get; set; }
|
|
|
|
public Guid FKClientId { get; set; }
|
|
[ForeignKey(nameof(FKClientId))]
|
|
public Client Client { get; set; }
|
|
|
|
public decimal Amount { get; set; }
|
|
|
|
/// <summary>"Cash" | "Bank".</summary>
|
|
[MaxLength(20)]
|
|
public string PaymentMethod { get; set; } = "Cash";
|
|
|
|
[MaxLength(200)]
|
|
public string GuestName { get; set; } = string.Empty;
|
|
[MaxLength(32)]
|
|
public string? GuestPhone { get; set; }
|
|
|
|
[MaxLength(128)]
|
|
public string FacilityName { get; set; } = string.Empty;
|
|
public DateTime BookingStartTime { get; set; }
|
|
public DateTime BookingEndTime { get; set; }
|
|
|
|
public DateTime IssuedAt { get; set; } = DateTime.UtcNow;
|
|
}
|
|
}
|