Major restructuring of product variations: - Renamed ProductVariation to ProductMultiBuy for quantity-based pricing (e.g., "3 for £25") - Added new ProductVariant model for string-based options (colors, flavors) - Complete separation of multi-buy pricing from variant selection Features implemented: - Multi-buy deals with automatic price-per-unit calculation - Product variants for colors/flavors/sizes with stock tracking - TeleBot checkout supports both multi-buys and variant selection - Shopping cart correctly calculates multi-buy bundle prices - Order system tracks selected variants and multi-buy choices - Real-time bot activity monitoring with SignalR - Public bot directory page with QR codes for Telegram launch - Admin dashboard shows multi-buy and variant metrics Technical changes: - Updated all DTOs, services, and controllers - Fixed cart total calculation for multi-buy bundles - Comprehensive test coverage for new functionality - All existing tests passing with new features Database changes: - Migrated ProductVariations to ProductMultiBuys - Added ProductVariants table - Updated OrderItems to track variants 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
60 lines
2.3 KiB
C#
60 lines
2.3 KiB
C#
namespace LittleShop.Client.Models;
|
|
|
|
public class Order
|
|
{
|
|
public Guid Id { get; set; }
|
|
public Guid? CustomerId { get; set; }
|
|
public string? IdentityReference { get; set; }
|
|
public int Status { get; set; }
|
|
public decimal TotalAmount { get; set; }
|
|
public string Currency { get; set; } = string.Empty;
|
|
public string ShippingName { get; set; } = string.Empty;
|
|
public string ShippingAddress { get; set; } = string.Empty;
|
|
public string ShippingCity { get; set; } = string.Empty;
|
|
public string ShippingPostCode { get; set; } = string.Empty;
|
|
public string ShippingCountry { get; set; } = string.Empty;
|
|
public string? Notes { get; set; }
|
|
public string? TrackingNumber { get; set; }
|
|
public List<OrderItem> Items { get; set; } = new();
|
|
public List<CryptoPayment> Payments { get; set; } = new();
|
|
public DateTime CreatedAt { get; set; }
|
|
public DateTime UpdatedAt { get; set; }
|
|
public DateTime? PaidAt { get; set; }
|
|
public DateTime? ShippedAt { get; set; }
|
|
}
|
|
|
|
public class OrderItem
|
|
{
|
|
public Guid Id { get; set; }
|
|
public Guid ProductId { get; set; }
|
|
public string? ProductName { get; set; }
|
|
public int Quantity { get; set; }
|
|
public decimal UnitPrice { get; set; }
|
|
public decimal TotalPrice { get; set; }
|
|
}
|
|
|
|
public class CreateOrderRequest
|
|
{
|
|
// Either Customer ID (for registered customers) OR Identity Reference (for anonymous)
|
|
public Guid? CustomerId { get; set; }
|
|
public string? IdentityReference { get; set; }
|
|
|
|
// Customer Information (collected at checkout for new customers)
|
|
public CreateCustomerRequest? CustomerInfo { get; set; }
|
|
|
|
public string ShippingName { get; set; } = string.Empty;
|
|
public string ShippingAddress { get; set; } = string.Empty;
|
|
public string ShippingCity { get; set; } = string.Empty;
|
|
public string ShippingPostCode { get; set; } = string.Empty;
|
|
public string ShippingCountry { get; set; } = "United Kingdom";
|
|
public string? Notes { get; set; }
|
|
public List<CreateOrderItem> Items { get; set; } = new();
|
|
}
|
|
|
|
public class CreateOrderItem
|
|
{
|
|
public Guid ProductId { get; set; }
|
|
public Guid? ProductMultiBuyId { get; set; } // Optional: if specified, use multi-buy pricing
|
|
public string? SelectedVariant { get; set; } // Optional: variant choice (color/flavor)
|
|
public int Quantity { get; set; }
|
|
} |