57 lines
2.0 KiB
C#
57 lines
2.0 KiB
C#
using System.Collections.Generic;
|
|
using System.Net.Http;
|
|
using System.Reflection;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using _0_Framework.Application;
|
|
using _0_Framework.Application.PaymentGateway;
|
|
using Company.Domain.PaymentTransactionAgg;
|
|
using CompanyManagment.App.Contracts.PaymentTransaction;
|
|
|
|
namespace CompanyManagment.Application;
|
|
|
|
public class PaymentTransactionApplication : IPaymentTransactionApplication
|
|
{
|
|
private readonly IPaymentTransactionRepository _paymentTransactionRepository;
|
|
private readonly IPaymentGateway _paymentGateway;
|
|
|
|
public PaymentTransactionApplication(IPaymentTransactionRepository paymentTransactionRepository,IHttpClientFactory httpClientFactory)
|
|
{
|
|
_paymentTransactionRepository = paymentTransactionRepository;
|
|
_paymentGateway = new AqayePardakhtPaymentGateway(httpClientFactory);
|
|
}
|
|
|
|
public async Task<List<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,
|
|
command.ContractingPartyName);
|
|
|
|
await _paymentTransactionRepository.CreateAsync(entity);
|
|
await _paymentTransactionRepository.SaveChangesAsync();
|
|
return operationResult.Succcedded();
|
|
}
|
|
|
|
|
|
|
|
public async Task<WalletAmountResponse> GetWalletAmount(CancellationToken cancellationToken)
|
|
{
|
|
var result = await _paymentGateway.GetWalletAmount(cancellationToken);
|
|
return result;
|
|
}
|
|
} |