feat: add Transaction service with UnitsByTransStateList and PayCosts
This commit is contained in:
@@ -16,12 +16,8 @@ namespace Complex.Application.Services.TransactionServices
|
|||||||
{
|
{
|
||||||
public interface ITransactionService
|
public interface ITransactionService
|
||||||
{
|
{
|
||||||
/*
|
ResultDto<List<TransactionDto>> UnitsByTransStateList(Guid complexId, Guid? UnitId, CommonRequestDto commonRequestDto);
|
||||||
گزارش پرداختی های یک واحد
|
ResultDto PayCosts(List<long> UnitCostIds, Guid UnitId, long Amount, string UserPhone, string Description);
|
||||||
گزارش وضعیت پرداخت واحدهای یک مجتمع
|
|
||||||
ثبت یک تراکنش شارژ
|
|
||||||
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TransactionService : ITransactionService
|
public class TransactionService : ITransactionService
|
||||||
|
|||||||
50
Complex.EndPoint/Controllers/TransactionController.cs
Normal file
50
Complex.EndPoint/Controllers/TransactionController.cs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
using Complex.Application.Common;
|
||||||
|
using Complex.Application.Services.TransactionServices;
|
||||||
|
using Complex.Common.Dto;
|
||||||
|
using Complex.EndPoint.Utility;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace Complex.EndPoint.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[ApiVersion("1")]
|
||||||
|
[Route("api/v{version:apiVersion}/[controller]/[action]")]
|
||||||
|
[Authorize]
|
||||||
|
public class TransactionController : Controller
|
||||||
|
{
|
||||||
|
private readonly ITransactionService _transactionService;
|
||||||
|
|
||||||
|
public TransactionController(ITransactionService transactionService)
|
||||||
|
{
|
||||||
|
_transactionService = transactionService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public ResultDto<List<TransactionDto>> TransactionsList(TransactionListRequest request)
|
||||||
|
{
|
||||||
|
return _transactionService.UnitsByTransStateList(request.ComplexId, request.UnitId, request.CommonRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public ResultDto PayCosts(PayCostsRequest request)
|
||||||
|
{
|
||||||
|
return _transactionService.PayCosts(request.UnitCostIds, request.UnitId, request.Amount, User.GetUserId(), request.Description);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TransactionListRequest
|
||||||
|
{
|
||||||
|
public Guid ComplexId { get; set; }
|
||||||
|
public Guid? UnitId { get; set; }
|
||||||
|
public CommonRequestDto CommonRequest { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PayCostsRequest
|
||||||
|
{
|
||||||
|
public List<long> UnitCostIds { get; set; }
|
||||||
|
public Guid UnitId { get; set; }
|
||||||
|
public long Amount { get; set; }
|
||||||
|
public string? Description { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user