Files
CMS/src/CMSMicroservice.Infrastructure/Persistence/Configurations/UserWalletConfiguration.cs
T
masoodafar-web 2a569a024f
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m36s
feat: Implement Magic Wallet functionality
- Added ClubMembershipCycle entity and DbSet to IApplicationDbContext.
- Updated VAT rate from 9% to 10% in VatCalculator and related areas.
- Introduced Magic Wallet settings in SystemConstants.
- Enhanced UserWallet entity to support Magic Wallet features.
- Updated TransactionType enum to include Magic Wallet transactions.
- Configured UserWallet to handle Magic Wallet properties in ApplicationDbContext.
- Implemented OrmCommissionCalculationStrategy to exclude Magic Wallet users from commission calculations.
- Added Protobuf definitions for Magic Wallet methods and responses.
- Created PaymentCallbackController endpoint for handling Magic Wallet charge callbacks.
- Updated UserOrderService to manage Magic Wallet state transitions.
- Developed UserWalletService to support Magic Wallet operations.
- Created ChargeMagicWalletCommand and its handler for initiating Magic Wallet charges.
- Implemented VerifyMagicWalletChargeCommand and handler for payment verification.
- Added validation for ChargeMagicWalletCommand.
- Established ClubMembershipCycle configuration for EF Core.
- Introduced WalletMode enum to differentiate between Normal and Magic modes.
2026-02-21 19:50:28 +03:30

39 lines
1.6 KiB
C#

using CMSMicroservice.Domain.Entities;
using CMSMicroservice.Domain.Enums;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CMSMicroservice.Infrastructure.Persistence.Configurations;
//آدرس کاربر
public class UserWalletConfiguration : IEntityTypeConfiguration<UserWallet>
{
public void Configure(EntityTypeBuilder<UserWallet> builder)
{
builder.HasQueryFilter(p => !p.IsDeleted);
builder.Ignore(entity => entity.DomainEvents);
builder.HasKey(entity => entity.Id);
builder.Property(entity => entity.Id).UseIdentityColumn();
builder
.HasOne(entity => entity.User)
.WithMany(entity => entity.UserWallets)
.HasForeignKey(entity => entity.UserId)
.IsRequired(true);
builder.Property(entity => entity.Balance).IsRequired(true);
builder.Property(entity => entity.NetworkBalance).IsRequired(true);
builder.Property(entity => entity.DiscountBalance).IsRequired(true);
// Magic Wallet
builder.Property(entity => entity.WalletMode)
.IsRequired()
.HasDefaultValue(WalletMode.Normal);
builder.Property(entity => entity.MagicTotalDeposited)
.IsRequired()
.HasDefaultValue(0L);
builder.Property(entity => entity.MagicTotalCredited)
.IsRequired()
.HasDefaultValue(0L);
builder.Property(entity => entity.MagicActivatedAt).IsRequired(false);
builder.Property(entity => entity.MagicCompletedAt).IsRequired(false);
}
}