change the step from paymentCallBack - set transactionId on create PaymentGateway
This commit is contained in:
@@ -50,6 +50,8 @@ public interface IPaymentTransactionApplication
|
||||
/// <param name="bankName"></param>
|
||||
/// <returns></returns>
|
||||
OperationResult SetSuccess(long paymentTransactionId, string cardNumber, string bankName);
|
||||
|
||||
Task<OperationResult> SetTransactionId(long id, string transactionId);
|
||||
}
|
||||
|
||||
public class PaymentTransactionDetailsViewModel
|
||||
|
||||
@@ -97,4 +97,12 @@ public class PaymentTransactionApplication : IPaymentTransactionApplication
|
||||
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public async Task<OperationResult> SetTransactionId(long id, string transactionId)
|
||||
{
|
||||
var paymentTransaction = _paymentTransactionRepository.Get(id);
|
||||
paymentTransaction.SetTransactionId(transactionId);
|
||||
await _paymentTransactionRepository.SaveChangesAsync();
|
||||
return new OperationResult().Succcedded();
|
||||
}
|
||||
}
|
||||
@@ -88,6 +88,7 @@ public class FinancialController : ClientBaseController
|
||||
|
||||
if (gatewayResponse.IsSuccess)
|
||||
{
|
||||
_ = await _paymentTransactionApplication.SetTransactionId(transaction.SendId, gatewayResponse.TransactionId);
|
||||
return op.Succcedded(_paymentGateway.GetStartPayUrl(gatewayResponse.TransactionId));
|
||||
}
|
||||
|
||||
|
||||
@@ -83,12 +83,7 @@ public class GeneralController : GeneralBaseController
|
||||
if (verifyRes.IsSuccess)
|
||||
{
|
||||
var setSuccessResult = _paymentTransactionApplication.SetSuccess(paymentTransactionId, cardnumber, bank);
|
||||
|
||||
if (!setSuccessResult.IsSuccedded)
|
||||
{
|
||||
return new JsonResult(setSuccessResult);
|
||||
}
|
||||
//TODO : افزودن دریافت درآمد به وضعیت مالی
|
||||
|
||||
var command = new CreateFinancialStatment()
|
||||
{
|
||||
|
||||
@@ -101,7 +96,12 @@ public class GeneralController : GeneralBaseController
|
||||
DescriptionOption = "بابت قرارداد مابین (روابط کار)",
|
||||
|
||||
};
|
||||
var result = _financialStatmentApplication.Create(command);
|
||||
_financialStatmentApplication.Create(command);
|
||||
|
||||
if (!setSuccessResult.IsSuccedded)
|
||||
{
|
||||
return new JsonResult(setSuccessResult);
|
||||
}
|
||||
return Redirect(BuildCallbackUrl(transaction.CallBackUrl, true, transaction.Id));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user