feat: Add ClearCart command and response, implement CancelOrder command with validation, and enhance DeliveryStatus and User models

This commit is contained in:
masoodafar-web
2025-12-02 03:30:36 +03:30
parent 25fc73ae28
commit 78606cc5cc
100 changed files with 12925 additions and 8137 deletions
@@ -35,6 +35,11 @@ public class ClubMembership : BaseAuditableEntity
/// </summary>
public long TotalEarned { get; set; }
/// <summary>
/// نحوه خرید پکیج که منجر به فعالسازی باشگاه شد
/// </summary>
public PackagePurchaseMethod PurchaseMethod { get; set; }
/// <summary>
/// UserClubFeature Collection Navigation Reference
/// </summary>
@@ -85,6 +85,21 @@ public class UserCommissionPayout : BaseAuditableEntity
/// </summary>
public string? RejectionReason { get; set; }
/// <summary>
/// شماره مرجع بانک (بعد از واریز موفق)
/// </summary>
public string? BankReferenceId { get; set; }
/// <summary>
/// کد پیگیری بانکی
/// </summary>
public string? BankTrackingCode { get; set; }
/// <summary>
/// دلیل خطا در پرداخت (اگر ناموفق باشد)
/// </summary>
public string? PaymentFailureReason { get; set; }
/// <summary>
/// CommissionPayoutHistory Collection Navigation Reference
/// </summary>
@@ -0,0 +1,59 @@
using CMSMicroservice.Domain.Enums;
namespace CMSMicroservice.Domain.Entities;
/// <summary>
/// قرارداد وام دایا
/// </summary>
public class DayaLoanContract : BaseAuditableEntity
{
/// <summary>
/// شناسه کاربر
/// </summary>
public long UserId { get; set; }
/// <summary>
/// User Navigation Property
/// </summary>
public virtual User User { get; set; }
/// <summary>
/// کد ملی
/// </summary>
public string NationalCode { get; set; }
/// <summary>
/// شماره قرارداد دایا
/// </summary>
public string? ContractNumber { get; set; }
/// <summary>
/// وضعیت وام
/// </summary>
public DayaLoanStatus Status { get; set; }
/// <summary>
/// آیا پردازش شده است؟ (شارژ کیف پول انجام شده)
/// </summary>
public bool IsProcessed { get; set; }
/// <summary>
/// تاریخ آخرین استعلام
/// </summary>
public DateTime? LastCheckDate { get; set; }
/// <summary>
/// تاریخ پردازش
/// </summary>
public DateTime? ProcessedDate { get; set; }
/// <summary>
/// شناسه تراکنش (بعد از پردازش)
/// </summary>
public long? TransactionId { get; set; }
/// <summary>
/// Transaction Navigation Property
/// </summary>
public virtual Transactions? Transaction { get; set; }
}
@@ -8,6 +8,8 @@ public class User : BaseAuditableEntity
public string? LastName { get; set; }
//شماره موبایل
public string Mobile { get; set; }
//ایمیل
public string? Email { get; set; }
//کد ملی
public string? NationalCode { get; set; }
//آدرس آواتار
@@ -54,6 +56,21 @@ public class User : BaseAuditableEntity
/// </summary>
public NetworkLeg? LegPosition { get; set; }
/// <summary>
/// آیا اعتبار دایا را دریافت کرده است؟
/// </summary>
public bool HasReceivedDayaCredit { get; set; }
/// <summary>
/// تاریخ دریافت اعتبار دایا
/// </summary>
public DateTime? DayaCreditReceivedAt { get; set; }
/// <summary>
/// نحوه خرید پکیج طلایی (برای جلوگیری از خرید مجدد)
/// </summary>
public PackagePurchaseMethod PackagePurchaseMethod { get; set; } = PackagePurchaseMethod.None;
// ============= Navigation Properties =============
//UserAddress Collection Navigation Reference
@@ -80,4 +97,6 @@ public class User : BaseAuditableEntity
public virtual ICollection<NetworkWeeklyBalance>? NetworkWeeklyBalances { get; set; }
//UserCommissionPayout Collection Navigation Reference
public virtual ICollection<UserCommissionPayout>? CommissionPayouts { get; set; }
//DayaLoanContract Collection Navigation Reference
public virtual ICollection<DayaLoanContract>? DayaLoanContracts { get; set; }
}
@@ -14,6 +14,10 @@ public class UserWalletChangeLog : BaseAuditableEntity
public long CurrentNetworkBalance { get; set; }
//تغییر موجودی شبکه
public long ChangeNerworkValue { get; set; }
//موجودی جاری تخفیف
public long CurrentDiscountBalance { get; set; }
//تغییر موجودی تخفیف
public long ChangeDiscountValue { get; set; }
//افزایشی؟
public bool IsIncrease { get; set; }
//شناسه ارجاع
@@ -25,8 +25,13 @@ public enum CommissionPayoutStatus
/// </summary>
Withdrawn = 3,
/// <summary>
/// خطا در پرداخت بانکی
/// </summary>
PaymentFailed = 4,
/// <summary>
/// لغو شده
/// </summary>
Cancelled = 4
Cancelled = 5
}
@@ -0,0 +1,22 @@
namespace CMSMicroservice.Domain.Enums;
/// <summary>
/// وضعیت وام دایا
/// </summary>
public enum DayaLoanStatus
{
/// <summary>
/// در انتظار دریافت وام (خرید انجام شده، قرارداد امضا شده، درخواست وام ثبت شده)
/// </summary>
PendingReceive = 0,
/// <summary>
/// وام دریافت شده (در آینده اضافه می‌شود)
/// </summary>
Received = 1,
/// <summary>
/// رد شده (در آینده اضافه می‌شود)
/// </summary>
Rejected = 2,
}
@@ -13,5 +13,7 @@ public enum DeliveryStatus
Delivered = 3,
// مرجوع شده
Returned = 4,
// لغو شده
Cancelled = 5,
}
@@ -0,0 +1,22 @@
namespace CMSMicroservice.Domain.Enums;
/// <summary>
/// نحوه خرید پکیج طلایی توسط کاربر
/// </summary>
public enum PackagePurchaseMethod
{
/// <summary>
/// هنوز پکیج خریداری نکرده
/// </summary>
None = 0,
/// <summary>
/// از طریق وام دایا
/// </summary>
DayaLoan = 1,
/// <summary>
/// از طریق پرداخت مستقیم درگاه بانکی
/// </summary>
DirectPurchase = 2
}
@@ -0,0 +1,13 @@
namespace CMSMicroservice.Domain.Events;
public class CancelOrderEvent : BaseEvent
{
public CancelOrderEvent(UserOrder order, string reason)
{
Order = order;
CancelReason = reason;
}
public UserOrder Order { get; }
public string CancelReason { get; }
}
@@ -0,0 +1,11 @@
namespace CMSMicroservice.Domain.Events;
public class ClearCartEvent : BaseEvent
{
public ClearCartEvent(UserCarts item)
{
Item = item;
}
public UserCarts Item { get; }
}
@@ -0,0 +1,15 @@
namespace CMSMicroservice.Domain.Events;
public class DayaLoanApprovedEvent : BaseEvent
{
public DayaLoanApprovedEvent(User user, Transactions transaction, string contractNumber)
{
User = user;
Transaction = transaction;
ContractNumber = contractNumber;
}
public User User { get; }
public Transactions Transaction { get; }
public string ContractNumber { get; }
}
@@ -0,0 +1,13 @@
namespace CMSMicroservice.Domain.Events;
public class RefundTransactionEvent : BaseEvent
{
public RefundTransactionEvent(Transactions refundTransaction, Transactions originalTransaction)
{
RefundTransaction = refundTransaction;
OriginalTransaction = originalTransaction;
}
public Transactions RefundTransaction { get; }
public Transactions OriginalTransaction { get; }
}
@@ -0,0 +1,11 @@
namespace CMSMicroservice.Domain.Events;
public class VerifyTransactionEvent : BaseEvent
{
public VerifyTransactionEvent(Transactions item)
{
Item = item;
}
public Transactions Item { get; }
}