75 lines
2.8 KiB
C#
75 lines
2.8 KiB
C#
using _0_Framework.Application;
|
|
using _0_Framework.Application.PaymentGateway;
|
|
using CompanyManagment.App.Contracts.PaymentTransaction;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
using Microsoft.Extensions.Options;
|
|
using System.Net.Http;
|
|
|
|
namespace ServiceHost.Pages.CallBack
|
|
{
|
|
[IgnoreAntiforgeryToken]
|
|
public class IndexModel : PageModel
|
|
{
|
|
private readonly IPaymentTransactionApplication _paymentTransactionApplication;
|
|
private readonly IPaymentGateway _paymentGateway;
|
|
|
|
|
|
public IndexModel(IPaymentTransactionApplication paymentTransactionApplication, IHttpClientFactory httpClientFactory, IOptions<AppSettingConfiguration> appSetting)
|
|
{
|
|
_paymentTransactionApplication = paymentTransactionApplication;
|
|
_paymentGateway = new AqayePardakhtPaymentGateway(httpClientFactory, appSetting);
|
|
}
|
|
|
|
public void OnGet(string? transid, string? cardnumber, string? tracking_number, string status)
|
|
{
|
|
if (string.IsNullOrEmpty(cardnumber) || string.IsNullOrEmpty(tracking_number))
|
|
{
|
|
ViewData["message"] = "پرداخت ناموفق بوده است";
|
|
return;
|
|
}
|
|
else if (status == "1")
|
|
{
|
|
ViewData["message"] = "پرداخت موفق بوده است";
|
|
return;
|
|
|
|
}
|
|
}
|
|
public async Task OnPost(string? transid, string? cardnumber, string? tracking_number, string bank, string invoice_id, string? status)
|
|
{
|
|
//var command = new CreatePaymentTransaction()
|
|
//{
|
|
// CardNumber = cardnumber,
|
|
// Amount = 10000,
|
|
// BankAccountHolderName = "تست",
|
|
// ShebaNumber = "",
|
|
// TransactionId = transid,
|
|
// ContractingPartyId = 0,
|
|
// ContractingPartyName = "نام طرف حساب",
|
|
// AccountNumber = "",
|
|
// BankName = "سامان"
|
|
|
|
//};
|
|
//if (string.IsNullOrEmpty(cardnumber) || string.IsNullOrEmpty(tracking_number))
|
|
//{
|
|
// ViewData["message"] = "پرداخت ناموفق بوده است";
|
|
// command.Status = PaymentTransactionStatus.Failed;
|
|
//}
|
|
//else if (status == "1")
|
|
//{
|
|
// ViewData["message"] = "پرداخت موفق بوده است";
|
|
// command.Status = PaymentTransactionStatus.Success;
|
|
|
|
//}
|
|
//else
|
|
//{
|
|
// ViewData["message"] = "پرداخت ناموفق بوده است";
|
|
// command.Status = PaymentTransactionStatus.Failed;
|
|
//}
|
|
|
|
//_paymentTransactionApplication.Create(command);
|
|
|
|
}
|
|
}
|
|
}
|