merge from CreateApiPaymentGateWay

This commit is contained in:
MahanCh
2025-07-20 14:56:19 +03:30
4 changed files with 31 additions and 3 deletions

View File

@@ -7,6 +7,8 @@ using ServiceHost.BaseControllers;
using System.Globalization;
using _0_Framework.Application.PaymentGateway;
using Microsoft.Extensions.Options;
using CompanyManagment.App.Contracts.FinancialStatment;
using CompanyManagment.App.Contracts.FinancilTransaction;
namespace ServiceHost.Controllers;
@@ -15,11 +17,13 @@ public class GeneralController : GeneralBaseController
private readonly IPaymentTransactionApplication _paymentTransactionApplication;
private readonly IPaymentGateway _paymentGateway;
private readonly IFinancialStatmentApplication _financialStatmentApplication;
public GeneralController(IPaymentTransactionApplication paymentTransactionApplication,IHttpClientFactory clientFactory,IOptions<AppSettingConfiguration> appSetting)
public GeneralController(IPaymentTransactionApplication paymentTransactionApplication,IHttpClientFactory clientFactory, IFinancialStatmentApplication financialStatmentApplication, IOptions<AppSettingConfiguration> appSetting)
{
_paymentTransactionApplication = paymentTransactionApplication;
_paymentGateway = new AqayePardakhtPaymentGateway(clientFactory, appSetting);
_financialStatmentApplication = financialStatmentApplication;
}
/// <summary>
@@ -80,12 +84,25 @@ public class GeneralController : GeneralBaseController
if (verifyRes.IsSuccess)
{
var setSuccessResult = _paymentTransactionApplication.SetSuccess(paymentTransactionId, cardnumber, bank);
//TODO : افزودن دریافت درآمد به وضعیت مالی
var command = new CreateFinancialStatment()
{
ContractingPartyId = transaction.ContractingPartyId,
TdateFa = DateTime.Now.ToFarsi(),
Deptor = 0,
Creditor = transaction.Amount,
DeptorString = "درگاه بانکی",
TypeOfTransaction = "credit",
DescriptionOption = "بابت قرارداد مابین (روابط کار)",
};
_financialStatmentApplication.Create(command);
if (!setSuccessResult.IsSuccedded)
{
return new JsonResult(setSuccessResult);
}
return Redirect(BuildCallbackUrl(transaction.CallBackUrl, true, transaction.Id));
}