Add Create transaction metod

This commit is contained in:
SamSys
2025-07-20 12:01:28 +04:00
parent a177d6063d
commit 9f33b481fa

View File

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