190 lines
7.2 KiB
C#
190 lines
7.2 KiB
C#
using _0_Framework.Application;
|
||
using CompanyManagment.App.Contracts.ContractingPartyBankAccounts;
|
||
using CompanyManagment.App.Contracts.PaymentInstrument;
|
||
using Microsoft.AspNetCore.Mvc;
|
||
using ServiceHost.BaseControllers;
|
||
|
||
namespace ServiceHost.Areas.Admin.Controllers;
|
||
|
||
public class PaymentInstrumentController:AdminBaseController
|
||
{
|
||
private readonly IPaymentInstrumentApplication _paymentInstrumentApplication;
|
||
private readonly IContractingPartyBankAccountsApplication _contractingPartyBankAccountsApplication;
|
||
|
||
public PaymentInstrumentController(IPaymentInstrumentApplication paymentInstrumentApplication, IContractingPartyBankAccountsApplication contractingPartyBankAccountsApplication)
|
||
{
|
||
_paymentInstrumentApplication = paymentInstrumentApplication;
|
||
_contractingPartyBankAccountsApplication = contractingPartyBankAccountsApplication;
|
||
}
|
||
/// <summary>
|
||
///لیست اطلاعات بانکی جاری شرکا
|
||
/// </summary>
|
||
/// <param name="searchModel"></param>
|
||
/// <returns></returns>
|
||
[HttpGet]
|
||
public async Task<ActionResult<GetPaymentInstrumentListViewModel>> List(PaymentInstrumentSearchModel searchModel)
|
||
{
|
||
var list =await _paymentInstrumentApplication.GetList(searchModel);
|
||
return list;
|
||
}
|
||
/// <summary>
|
||
/// ایجاد اطلاعات بانکی
|
||
/// </summary>
|
||
/// <param name="command"></param>
|
||
/// <returns></returns>
|
||
[HttpPost("bankAccount")]
|
||
public async Task<ActionResult<OperationResult>> CreateBankAccount([FromBody] CreateBankPaymentInstrument command)
|
||
{
|
||
var result = await _paymentInstrumentApplication.CreateBankAccount(command);
|
||
return result;
|
||
}
|
||
/// <summary>
|
||
/// ایجاد اطلاعات دستگاه پوز
|
||
/// </summary>
|
||
/// <param name="command"></param>
|
||
/// <returns></returns>
|
||
[HttpPost("pos")]
|
||
public async Task<ActionResult<OperationResult>> CreatePos([FromBody]CreatePosPaymentInstrument command)
|
||
{
|
||
var result =await _paymentInstrumentApplication.CreatePos(command);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// گرفتن عنوان ها
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("group")]
|
||
public async Task<ActionResult<List<PaymentInstrumentGroupsViewModel>>> GetGroups()
|
||
{
|
||
var result = await _paymentInstrumentApplication.GetGroup();
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// ایجاد عنوان
|
||
/// </summary>
|
||
/// <param name="command"></param>
|
||
/// <returns></returns>
|
||
[HttpPost("group")]
|
||
public async Task<ActionResult<OperationResult>> CreateGroup([FromBody]CreateBankPaymentInstrumentGroup command)
|
||
{
|
||
var result = await _paymentInstrumentApplication.CreateGroup(command);
|
||
return result;
|
||
}
|
||
/// <summary>
|
||
/// ویرایش عنوان
|
||
/// </summary>
|
||
/// <param name="command"></param>
|
||
/// <returns></returns>
|
||
[HttpPut("group")]
|
||
public async Task<ActionResult<OperationResult>> EditGroup([FromBody]EditBankPaymentInstrumentGroup command)
|
||
{
|
||
var result = await _paymentInstrumentApplication.EditGroup(command);
|
||
return result;
|
||
}
|
||
/// <summary>
|
||
/// حذف عنوان
|
||
/// </summary>
|
||
/// <param name="id"></param>
|
||
/// <returns></returns>
|
||
[HttpDelete("group/{id}")]
|
||
public async Task<ActionResult<OperationResult>> DeleteGroup(long id)
|
||
{
|
||
var result = await _paymentInstrumentApplication.DeleteGroup(id);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// دریافت لیست شناسههای دستگاه پوز به صورت رشته
|
||
/// </summary>
|
||
/// <param name="search">عبارت جستجو</param>
|
||
/// <param name="selected">مقدار انتخاب شده</param>
|
||
/// <returns>لیست شناسههای دستگاه پوز</returns>
|
||
[HttpGet("pos-terminal-id-select")]
|
||
public async Task<ActionResult<OperationResult<List<string>>>> GetPosTerminalIdSelectList(string search, string selected)
|
||
{
|
||
return await _paymentInstrumentApplication.PosTerminalIdSelectList(search, selected);
|
||
}
|
||
|
||
/// <summary>
|
||
/// دریافت لیست شمارههای شبا به صورت رشته
|
||
/// </summary>
|
||
/// <param name="search">عبارت جستجو</param>
|
||
/// <param name="selected">مقدار انتخاب شده</param>
|
||
/// <returns>لیست شمارههای شبا</returns>
|
||
[HttpGet("iban-select")]
|
||
public async Task<ActionResult<OperationResult<List<string>>>> GetIbanSelectList(string search, string selected)
|
||
{
|
||
var paymentIban = await _paymentInstrumentApplication.IbanSelectList(search, selected);
|
||
var contractingIban = await _contractingPartyBankAccountsApplication.IBanSelectList(search, selected);
|
||
|
||
var combinedList = new List<string>();
|
||
|
||
if (paymentIban.IsSuccedded)
|
||
{
|
||
combinedList.AddRange(paymentIban.Data??[]);
|
||
}
|
||
|
||
if (contractingIban.IsSuccedded)
|
||
{
|
||
combinedList.AddRange(contractingIban.Data??[]);
|
||
}
|
||
|
||
return new OperationResult<List<string>>().Succcedded(combinedList.Distinct().ToList());
|
||
}
|
||
|
||
/// <summary>
|
||
/// دریافت لیست شمارههای حساب به صورت رشته
|
||
/// </summary>
|
||
/// <param name="search">عبارت جستجو</param>
|
||
/// <param name="selected">مقدار انتخاب شده</param>
|
||
/// <returns>لیست شمارههای حساب</returns>
|
||
[HttpGet("account-number-select")]
|
||
public async Task<ActionResult<OperationResult<List<string>>>> GetAccountNumberSelectList(string search, string selected)
|
||
{
|
||
var paymentAccountNumbers = await _paymentInstrumentApplication.AccountNumberSelectList(search, selected);
|
||
var contractingAccountNumbers = await _contractingPartyBankAccountsApplication.AccountNumberSelectList(search, selected);
|
||
|
||
var combinedList = new List<string>();
|
||
|
||
if (paymentAccountNumbers.IsSuccedded)
|
||
{
|
||
combinedList.AddRange(paymentAccountNumbers.Data??[]);
|
||
}
|
||
|
||
if (contractingAccountNumbers.IsSuccedded)
|
||
{
|
||
combinedList.AddRange(contractingAccountNumbers.Data??[]);
|
||
}
|
||
|
||
return new OperationResult<List<string>>().Succcedded(combinedList.Distinct().ToList());
|
||
}
|
||
|
||
/// <summary>
|
||
/// دریافت لیست شمارههای کارت به صورت رشته
|
||
/// </summary>
|
||
/// <param name="search">عبارت جستجو</param>
|
||
/// <param name="selected">مقدار انتخاب شده</param>
|
||
/// <returns>لیست شمارههای کارت</returns>
|
||
[HttpGet("card-number-select")]
|
||
public async Task<ActionResult<OperationResult<List<string>>>> GetCardNumberSelectList(string search, string selected)
|
||
{
|
||
var paymentCardNumbers = await _paymentInstrumentApplication.CardNumberSelectList(search, selected);
|
||
var contractingCardNumbers = await _contractingPartyBankAccountsApplication.CardNumberSelectList(search, selected);
|
||
|
||
var combinedList = new List<string>();
|
||
|
||
if (paymentCardNumbers.IsSuccedded)
|
||
{
|
||
combinedList.AddRange(paymentCardNumbers.Data??[]);
|
||
}
|
||
|
||
if (contractingCardNumbers.IsSuccedded)
|
||
{
|
||
combinedList.AddRange(contractingCardNumbers.Data??[]);
|
||
}
|
||
|
||
return new OperationResult<List<string>>().Succcedded(combinedList.Distinct().ToList());
|
||
}
|
||
} |