add payment transaction
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
|
||||
namespace Company.Domain.PaymentTransactionAgg;
|
||||
|
||||
public interface IPaymentTransactionRepository:IRepository<long,PaymentTransaction>
|
||||
{
|
||||
Task<GetPaymentTransactionListViewModel> GetPaymentTransactionList(GetPaymentTransactionListSearchModel searchModel);
|
||||
}
|
||||
102
Company.Domain/PaymentTransactionAgg/PaymentTransaction.cs
Normal file
102
Company.Domain/PaymentTransactionAgg/PaymentTransaction.cs
Normal file
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
|
||||
namespace Company.Domain.PaymentTransactionAgg
|
||||
{
|
||||
/// <summary>
|
||||
/// نمایانگر یک تراکنش پرداخت شامل جزئیات طرف قرارداد، اطلاعات بانکی، وضعیت تراکنش و مبلغ.
|
||||
/// </summary>
|
||||
public class PaymentTransaction:EntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// سازنده کلاس PaymentTransaction با دریافت اطلاعات تراکنش.
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyId">شناسه طرف قرارداد</param>
|
||||
/// <param name="bankAccountHolderName">نام صاحب حساب بانکی</param>
|
||||
/// <param name="bankName">نام بانک</param>
|
||||
/// <param name="cardNumber">شماره کارت</param>
|
||||
/// <param name="shebaNumber">شماره شبا</param>
|
||||
/// <param name="accountNumber">شماره حساب بانکی</param>
|
||||
/// <param name="status">وضعیت تراکنش پرداخت</param>
|
||||
/// <param name="amount">مبلغ تراکنش</param>
|
||||
/// <param name="transactionId">شناسه یکتای تراکنش</param>
|
||||
public PaymentTransaction(
|
||||
long contractingPartyId,
|
||||
string bankAccountHolderName,
|
||||
string bankName,
|
||||
string cardNumber,
|
||||
string shebaNumber,
|
||||
string accountNumber,
|
||||
PaymentTransactionStatus status,
|
||||
double amount,
|
||||
string transactionId)
|
||||
{
|
||||
PaymentDateTime = DateTime.Now;
|
||||
ContractingPartyId = contractingPartyId;
|
||||
BankAccountHolderName = bankAccountHolderName;
|
||||
BankName = bankName;
|
||||
CardNumber = cardNumber;
|
||||
ShebaNumber = shebaNumber;
|
||||
AccountNumber = accountNumber;
|
||||
Status = status;
|
||||
Amount = amount;
|
||||
TransactionId = transactionId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ و زمان انجام پرداخت
|
||||
/// </summary>
|
||||
public DateTime PaymentDateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه طرف حساب
|
||||
/// </summary>
|
||||
public long ContractingPartyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام طرف حساب
|
||||
/// </summary>
|
||||
public string ContractingPartyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام صاحب حساب بانکی
|
||||
/// </summary>
|
||||
public string BankAccountHolderName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام بانک
|
||||
/// </summary>
|
||||
public string BankName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره کارت
|
||||
/// </summary>
|
||||
public string CardNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره شبا
|
||||
/// </summary>
|
||||
public string ShebaNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره حساب بانکی
|
||||
/// </summary>
|
||||
public string AccountNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت تراکنش پرداخت
|
||||
/// </summary>
|
||||
public PaymentTransactionStatus Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ تراکنش
|
||||
/// </summary>
|
||||
public double Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه یکتای تراکنش
|
||||
/// </summary>
|
||||
public string TransactionId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
namespace CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
|
||||
/// <summary>
|
||||
/// مدل جستجو برای دریافت لیست تراکنشهای پرداخت.
|
||||
/// شامل فیلترهایی مانند نام طرف قرارداد یا صاحب حساب، بازه تاریخ، بازه مبلغ و وضعیت تراکنش.
|
||||
/// </summary>
|
||||
public class GetPaymentTransactionListSearchModel
|
||||
{
|
||||
/// <summary>
|
||||
/// نام طرف قرارداد یا صاحب حساب بانکی جهت جستجو
|
||||
/// </summary>
|
||||
public string ContractingPartyOrAccountHolderName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ شروع بازه جستجو (به صورت رشته)
|
||||
/// </summary>
|
||||
public string FromDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ پایان بازه جستجو (به صورت رشته)
|
||||
/// </summary>
|
||||
public string ToDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// حداقل مبلغ تراکنش جهت جستجو
|
||||
/// </summary>
|
||||
public double FromAmount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// حداکثر مبلغ تراکنش جهت جستجو
|
||||
/// </summary>
|
||||
public double ToAmount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت تراکنش جهت فیلتر کردن نتایج
|
||||
/// </summary>
|
||||
public PaymentTransactionStatus? StatusEnum { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
namespace CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
|
||||
/// <summary>
|
||||
/// مدل نمایش اطلاعات هر تراکنش پرداخت در لیست تراکنشها.
|
||||
/// شامل جزئیاتی مانند تاریخ و زمان پرداخت، نام طرف حساب، اطلاعات بانکی، وضعیت و مبلغ تراکنش.
|
||||
/// </summary>
|
||||
public class GetPaymentTransactionListViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// تاریخ پرداخت
|
||||
/// </summary>
|
||||
public string PaymentDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// زمان پرداخت
|
||||
/// </summary>
|
||||
public string PaymentTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام طرف حساب
|
||||
/// </summary>
|
||||
public string ContractingPartyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام صاحب حساب بانکی
|
||||
/// </summary>
|
||||
public string BankAccountHolderName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام بانک
|
||||
/// </summary>
|
||||
public string BankName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره کارت
|
||||
/// </summary>
|
||||
public string CardNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره شبا
|
||||
/// </summary>
|
||||
public string ShebaNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره حساب بانکی
|
||||
/// </summary>
|
||||
public string AccountNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت تراکنش به صورت متنی
|
||||
/// </summary>
|
||||
public string Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت تراکنش به صورت Enum
|
||||
/// </summary>
|
||||
public PaymentTransactionStatus StatusEnum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ تراکنش
|
||||
/// </summary>
|
||||
public double Amount { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public interface IPaymentTransactionApplication
|
||||
{
|
||||
/// <summary>
|
||||
/// لیست تراکنش های پرداخت را بر اساس فیلتر مشخص شده برمی گرداند.
|
||||
/// </summary>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <returns></returns>
|
||||
Task<GetPaymentTransactionListViewModel> GetPaymentTransactionList(GetPaymentTransactionListSearchModel searchModel);
|
||||
/// <summary>
|
||||
/// ایجاد تراکنش
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> Create(CreatePaymentTransaction command);
|
||||
|
||||
}
|
||||
|
||||
public class CreatePaymentTransaction
|
||||
{
|
||||
/// <summary>
|
||||
/// شناسه طرف قرارداد
|
||||
/// </summary>
|
||||
public long ContractingPartyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام صاحب حساب بانکی
|
||||
/// </summary>
|
||||
public string BankAccountHolderName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام بانک
|
||||
/// </summary>
|
||||
public string BankName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره کارت
|
||||
/// </summary>
|
||||
public string CardNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره شبا
|
||||
/// </summary>
|
||||
public string ShebaNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره حساب بانکی
|
||||
/// </summary>
|
||||
public string AccountNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت تراکنش پرداخت
|
||||
/// </summary>
|
||||
public PaymentTransactionStatus Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ تراکنش
|
||||
/// </summary>
|
||||
public double Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه یکتای تراکنش
|
||||
/// </summary>
|
||||
public string TransactionId { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت تراکنش درگاه پرداخت
|
||||
/// </summary>
|
||||
public enum PaymentTransactionStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// تراکنش با موفقیت انجام شد.
|
||||
/// </summary>
|
||||
Success,
|
||||
|
||||
/// <summary>
|
||||
/// تراکنش با شکست مواجه شد.
|
||||
/// </summary>
|
||||
Failed
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using Company.Domain.PaymentTransactionAgg;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
public class PaymentTransactionApplication : IPaymentTransactionApplication
|
||||
{
|
||||
private readonly IPaymentTransactionRepository _paymentTransactionRepository;
|
||||
|
||||
public PaymentTransactionApplication(IPaymentTransactionRepository paymentTransactionRepository)
|
||||
{
|
||||
_paymentTransactionRepository = paymentTransactionRepository;
|
||||
}
|
||||
|
||||
public async Task<GetPaymentTransactionListViewModel> GetPaymentTransactionList(
|
||||
GetPaymentTransactionListSearchModel searchModel)
|
||||
{
|
||||
return await _paymentTransactionRepository.GetPaymentTransactionList(searchModel);
|
||||
}
|
||||
|
||||
public async Task<OperationResult> Create(CreatePaymentTransaction command)
|
||||
{
|
||||
var operationResult = new OperationResult();
|
||||
var entity = new PaymentTransaction(
|
||||
command.ContractingPartyId,
|
||||
command.BankAccountHolderName,
|
||||
command.BankName,
|
||||
command.CardNumber,
|
||||
command.ShebaNumber,
|
||||
command.AccountNumber,
|
||||
command.Status,
|
||||
command.Amount,
|
||||
command.TransactionId);
|
||||
|
||||
await _paymentTransactionRepository.CreateAsync(entity);
|
||||
await _paymentTransactionRepository.SaveChangesAsync();
|
||||
return operationResult.Succcedded();
|
||||
}
|
||||
}
|
||||
@@ -77,6 +77,7 @@ using Company.Domain.ModuleTextManagerAgg;
|
||||
using Company.Domain.OriginalTitleAgg;
|
||||
using Company.Domain.PaymentToEmployeeAgg;
|
||||
using Company.Domain.PaymentToEmployeeItemAgg;
|
||||
using Company.Domain.PaymentTransactionAgg;
|
||||
using Company.Domain.PenaltyTitle;
|
||||
using Company.Domain.PercentageAgg;
|
||||
using Company.Domain.PersonnelCodeAgg;
|
||||
@@ -178,6 +179,7 @@ public class CompanyContext : DbContext
|
||||
|
||||
public DbSet<EmployeeAuthorizeTemp> EmployeeAuthorizeTemps { get; set; }
|
||||
public DbSet<AdminMonthlyOverview> AdminMonthlyOverviews { get; set; }
|
||||
public DbSet<PaymentTransaction> PaymentTransactions{ get; set; }
|
||||
#endregion
|
||||
|
||||
#region Pooya
|
||||
|
||||
24
CompanyManagment.EFCore/Mapping/PaymentTransactionMapping.cs
Normal file
24
CompanyManagment.EFCore/Mapping/PaymentTransactionMapping.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Company.Domain.PaymentTransactionAgg;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace CompanyManagment.EFCore.Mapping;
|
||||
|
||||
public class PaymentTransactionMapping:IEntityTypeConfiguration<PaymentTransaction>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<PaymentTransaction> builder)
|
||||
{
|
||||
builder.ToTable("PaymentTransactions");
|
||||
builder.HasKey(pt => pt.id);
|
||||
|
||||
builder.Property(x => x.TransactionId).HasMaxLength(60);
|
||||
builder.Property(x => x.CardNumber).HasMaxLength(25);
|
||||
builder.Property(x => x.AccountNumber).HasMaxLength(25);
|
||||
builder.Property(x => x.BankName).HasMaxLength(50);
|
||||
builder.Property(x => x.BankAccountHolderName).HasMaxLength(255);
|
||||
builder.Property(x => x.Status).HasConversion<string>().HasMaxLength(35);
|
||||
builder.Property(x => x.ShebaNumber).HasMaxLength(30);
|
||||
builder.Property(x => x.ContractingPartyName).HasMaxLength(255);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.PaymentTransactionAgg;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class PaymentTransactionRepository:RepositoryBase<long, PaymentTransaction>,IPaymentTransactionRepository
|
||||
{
|
||||
private readonly CompanyContext _companyContext;
|
||||
public PaymentTransactionRepository(DbContext context, CompanyContext companyContext) : base(context)
|
||||
{
|
||||
_companyContext = companyContext;
|
||||
}
|
||||
|
||||
public Task<GetPaymentTransactionListViewModel> GetPaymentTransactionList(GetPaymentTransactionListSearchModel searchModel)
|
||||
{
|
||||
var query = _companyContext.PaymentTransactions.AsQueryable();
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.ContractingPartyOrAccountHolderName))
|
||||
{
|
||||
query = query.Where(x=>searchModel.ContractingPartyOrAccountHolderName.Contains(x.ContractingPartyName)||
|
||||
searchModel.ContractingPartyOrAccountHolderName.Contains(x.BankAccountHolderName));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.FromDate) && !string.IsNullOrWhiteSpace(searchModel.ToDate))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user