Refactored `FinancialInvoice` to include new properties (`Description`, `PublicId`, `IsActive`) and methods for managing items and statuses. Introduced `FinancialInvoiceItem` for invoice itemization. Updated `PaymentTransaction` to reference `FinancialInvoice`. Enhanced repository and application layers with CRUD operations, advanced search functionality, and integration with contracts. Updated `CompanyContext` with `DbSet<FinancialInvoices>` and `DbSet<FinancialInvoiceItem>`. Created new database tables for `FinancialInvoices` and `FinancialInvoiceItem`, and updated relationships with `PaymentTransactions`. Added DTOs for invoice creation, editing, and searching. Registered `IFinancialInvoiceRepository` for dependency injection.
104 lines
3.1 KiB
C#
104 lines
3.1 KiB
C#
using System;
|
|
using _0_Framework.Domain;
|
|
using Company.Domain.FinancialInvoiceAgg;
|
|
using CompanyManagment.App.Contracts.PaymentTransaction;
|
|
|
|
namespace Company.Domain.PaymentTransactionAgg;
|
|
|
|
/// <summary>
|
|
/// نمایانگر یک تراکنش پرداخت شامل جزئیات طرف قرارداد، اطلاعات بانکی، وضعیت تراکنش و مبلغ.
|
|
/// </summary>
|
|
public class PaymentTransaction:EntityBase
|
|
{
|
|
/// <summary>
|
|
/// سازنده کلاس PaymentTransaction با دریافت اطلاعات تراکنش.
|
|
/// </summary>
|
|
/// <param name="contractingPartyId">شناسه طرف قرارداد</param>
|
|
/// <param name="amount">مبلغ تراکنش</param>
|
|
/// <param name="contractingPartyName"></param>
|
|
/// <param name="callBackUrl"></param>
|
|
/// <param name="gateway"></param>
|
|
public PaymentTransaction(long contractingPartyId,
|
|
double amount,
|
|
string contractingPartyName,string callBackUrl,
|
|
PaymentTransactionGateWay gateway)
|
|
{
|
|
ContractingPartyId = contractingPartyId;
|
|
Status = PaymentTransactionStatus.Pending;
|
|
Amount = amount;
|
|
ContractingPartyName = contractingPartyName;
|
|
CallBackUrl = callBackUrl;
|
|
Gateway = gateway;
|
|
}
|
|
|
|
/// <summary>
|
|
/// تاریخ و زمان انجام پرداخت
|
|
/// </summary>
|
|
public DateTime TransactionDate { get; private set; }
|
|
|
|
/// <summary>
|
|
/// شناسه طرف حساب
|
|
/// </summary>
|
|
public long ContractingPartyId { get; private set; }
|
|
|
|
/// <summary>
|
|
/// نام طرف حساب
|
|
/// </summary>
|
|
public string ContractingPartyName { get; private set; }
|
|
|
|
/// <summary>
|
|
/// نام بانک
|
|
/// </summary>
|
|
public string BankName { get; private set; }
|
|
|
|
/// <summary>
|
|
/// شماره کارت
|
|
/// </summary>
|
|
public string CardNumber { get; private set; }
|
|
|
|
/// <summary>
|
|
/// وضعیت تراکنش پرداخت
|
|
/// </summary>
|
|
public PaymentTransactionStatus Status { get; private set; }
|
|
|
|
/// <summary>
|
|
/// مبلغ تراکنش
|
|
/// </summary>
|
|
public double Amount { get; private set; }
|
|
|
|
/// <summary>
|
|
/// شناسه یکتای تراکنش
|
|
/// </summary>
|
|
public string TransactionId { get; private set; }
|
|
|
|
public string CallBackUrl { get; private set; }
|
|
public PaymentTransactionGateWay Gateway { get; private set; }
|
|
public string Rrn { get; private set; }
|
|
public string DigitalReceipt { get; private set; }
|
|
|
|
public FinancialInvoice FinancialInvoice { get; set; }
|
|
public long? FinancialInvoiceId { get; set; }
|
|
|
|
|
|
public void SetPaid(string cardNumber,string bankName,string rrn,string digitalReceipt)
|
|
{
|
|
Status = PaymentTransactionStatus.Success;
|
|
TransactionDate = DateTime.Now;
|
|
CardNumber = cardNumber;
|
|
BankName = bankName;
|
|
Rrn = rrn;
|
|
DigitalReceipt = digitalReceipt;
|
|
|
|
}
|
|
public void SetFailed()
|
|
{
|
|
Status = PaymentTransactionStatus.Failed;
|
|
TransactionDate = DateTime.Now;
|
|
}
|
|
public void SetTransactionId(string transactionId)
|
|
{
|
|
TransactionId = transactionId;
|
|
}
|
|
}
|
|
|