diff --git a/CompanyManagment.App.Contracts/PaymentTransaction/IPaymentTransactionApplication.cs b/CompanyManagment.App.Contracts/PaymentTransaction/IPaymentTransactionApplication.cs
index 8564d7f5..3e86b7cf 100644
--- a/CompanyManagment.App.Contracts/PaymentTransaction/IPaymentTransactionApplication.cs
+++ b/CompanyManagment.App.Contracts/PaymentTransaction/IPaymentTransactionApplication.cs
@@ -50,6 +50,8 @@ public interface IPaymentTransactionApplication
///
///
OperationResult SetSuccess(long paymentTransactionId, string cardNumber, string bankName);
+
+ Task SetTransactionId(long id, string transactionId);
}
public class PaymentTransactionDetailsViewModel
diff --git a/CompanyManagment.Application/PaymentTransactionApplication.cs b/CompanyManagment.Application/PaymentTransactionApplication.cs
index 29089379..be20b840 100644
--- a/CompanyManagment.Application/PaymentTransactionApplication.cs
+++ b/CompanyManagment.Application/PaymentTransactionApplication.cs
@@ -102,4 +102,12 @@ public class PaymentTransactionApplication : IPaymentTransactionApplication
return op.Succcedded();
}
+
+ public async Task SetTransactionId(long id, string transactionId)
+ {
+ var paymentTransaction = _paymentTransactionRepository.Get(id);
+ paymentTransaction.SetTransactionId(transactionId);
+ await _paymentTransactionRepository.SaveChangesAsync();
+ return new OperationResult().Succcedded();
+ }
}
\ No newline at end of file
diff --git a/ServiceHost/Areas/Client/Controllers/FinancialController.cs b/ServiceHost/Areas/Client/Controllers/FinancialController.cs
index 48325d12..93d93adf 100644
--- a/ServiceHost/Areas/Client/Controllers/FinancialController.cs
+++ b/ServiceHost/Areas/Client/Controllers/FinancialController.cs
@@ -89,6 +89,7 @@ public class FinancialController : ClientBaseController
if (gatewayResponse.IsSuccess)
{
+ _ = await _paymentTransactionApplication.SetTransactionId(transaction.SendId, gatewayResponse.TransactionId);
return op.Succcedded(_paymentGateway.GetStartPayUrl(gatewayResponse.TransactionId));
}
diff --git a/ServiceHost/Controllers/GeneralController.cs b/ServiceHost/Controllers/GeneralController.cs
index 426824f9..b0de2b45 100644
--- a/ServiceHost/Controllers/GeneralController.cs
+++ b/ServiceHost/Controllers/GeneralController.cs
@@ -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 appSetting)
+ public GeneralController(IPaymentTransactionApplication paymentTransactionApplication,IHttpClientFactory clientFactory, IFinancialStatmentApplication financialStatmentApplication, IOptions appSetting)
{
_paymentTransactionApplication = paymentTransactionApplication;
_paymentGateway = new AqayePardakhtPaymentGateway(clientFactory, appSetting);
+ _financialStatmentApplication = financialStatmentApplication;
}
///
@@ -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));
}