From 9f33b481fad4a19b19ab143a09f8e0e669a87f8e Mon Sep 17 00:00:00 2001 From: SamSys Date: Sun, 20 Jul 2025 12:01:28 +0400 Subject: [PATCH] Add Create transaction metod --- ServiceHost/Controllers/GeneralController.cs | 21 ++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/ServiceHost/Controllers/GeneralController.cs b/ServiceHost/Controllers/GeneralController.cs index 0fb71ed1..5964845d 100644 --- a/ServiceHost/Controllers/GeneralController.cs +++ b/ServiceHost/Controllers/GeneralController.cs @@ -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)); }