Add customer communication system

This commit is contained in:
sysadmin
2025-08-27 18:02:39 +01:00
parent 1f7c0af497
commit eae5be3e7c
136 changed files with 14552 additions and 97 deletions

View File

@@ -37,4 +37,6 @@ public class PagedResult<T>
public int PageNumber { get; set; }
public int PageSize { get; set; }
public int TotalPages => (int)Math.Ceiling(TotalCount / (double)PageSize);
public bool HasPreviousPage => PageNumber > 1;
public bool HasNextPage => PageNumber < TotalPages;
}

View File

@@ -0,0 +1,68 @@
namespace LittleShop.Client.Models;
public class Customer
{
public Guid Id { get; set; }
public long TelegramUserId { get; set; }
public string TelegramUsername { get; set; } = string.Empty;
public string TelegramDisplayName { get; set; } = string.Empty;
public string TelegramFirstName { get; set; } = string.Empty;
public string TelegramLastName { get; set; } = string.Empty;
public string? Email { get; set; }
public string? PhoneNumber { get; set; }
public bool AllowMarketing { get; set; }
public bool AllowOrderUpdates { get; set; }
public string Language { get; set; } = "en";
public string Timezone { get; set; } = "UTC";
public int TotalOrders { get; set; }
public decimal TotalSpent { get; set; }
public decimal AverageOrderValue { get; set; }
public DateTime FirstOrderDate { get; set; }
public DateTime LastOrderDate { get; set; }
public string? CustomerNotes { get; set; }
public bool IsBlocked { get; set; }
public string? BlockReason { get; set; }
public int RiskScore { get; set; }
public int SuccessfulOrders { get; set; }
public int CancelledOrders { get; set; }
public int DisputedOrders { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
public DateTime LastActiveAt { get; set; }
public DateTime? DataRetentionDate { get; set; }
public bool IsActive { get; set; }
public string DisplayName { get; set; } = string.Empty;
public string CustomerType { get; set; } = string.Empty;
}
public class CreateCustomerRequest
{
public long TelegramUserId { get; set; }
public string TelegramUsername { get; set; } = string.Empty;
public string TelegramDisplayName { get; set; } = string.Empty;
public string TelegramFirstName { get; set; } = string.Empty;
public string TelegramLastName { get; set; } = string.Empty;
public string? Email { get; set; }
public string? PhoneNumber { get; set; }
public bool AllowMarketing { get; set; } = false;
public bool AllowOrderUpdates { get; set; } = true;
public string Language { get; set; } = "en";
public string Timezone { get; set; } = "UTC";
}
public class UpdateCustomerRequest
{
public string TelegramUsername { get; set; } = string.Empty;
public string TelegramDisplayName { get; set; } = string.Empty;
public string TelegramFirstName { get; set; } = string.Empty;
public string TelegramLastName { get; set; } = string.Empty;
public string? Email { get; set; }
public string? PhoneNumber { get; set; }
public bool AllowMarketing { get; set; }
public bool AllowOrderUpdates { get; set; }
public string Language { get; set; } = "en";
public string Timezone { get; set; } = "UTC";
public string? CustomerNotes { get; set; }
public bool IsBlocked { get; set; }
public string? BlockReason { get; set; }
}

View File

@@ -3,8 +3,9 @@ namespace LittleShop.Client.Models;
public class Order
{
public Guid Id { get; set; }
public string IdentityReference { get; set; } = string.Empty;
public string Status { get; set; } = string.Empty;
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;
@@ -34,7 +35,13 @@ public class OrderItem
public class CreateOrderRequest
{
public string IdentityReference { get; set; } = string.Empty;
// 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;

View File

@@ -4,11 +4,11 @@ public class CryptoPayment
{
public Guid Id { get; set; }
public Guid OrderId { get; set; }
public string Currency { get; set; } = string.Empty;
public int Currency { get; set; }
public string WalletAddress { get; set; } = string.Empty;
public decimal RequiredAmount { get; set; }
public decimal? PaidAmount { get; set; }
public string Status { get; set; } = string.Empty;
public int Status { get; set; }
public string? TransactionHash { get; set; }
public string? BTCPayInvoiceId { get; set; }
public string? BTCPayCheckoutUrl { get; set; }
@@ -19,5 +19,5 @@ public class CryptoPayment
public class CreatePaymentRequest
{
public string Currency { get; set; } = "BTC";
public int Currency { get; set; } = 0; // BTC = 0
}

View File

@@ -7,7 +7,7 @@ public class Product
public string? Description { get; set; }
public decimal Price { get; set; }
public decimal Weight { get; set; }
public string WeightUnit { get; set; } = string.Empty;
public int WeightUnit { get; set; }
public Guid CategoryId { get; set; }
public string? CategoryName { get; set; }
public bool IsActive { get; set; }