add dad-mehr api gateway for test
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
namespace ServiceHost;
|
||||
namespace _0_Framework.Application;
|
||||
|
||||
public class AppSettingConfiguration
|
||||
{
|
||||
@@ -8,27 +8,34 @@ using System.Security.Principal;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace _0_Framework.Application.PaymentGateway;
|
||||
|
||||
public class AqayePardakhtPaymentGateway:IPaymentGateway
|
||||
{
|
||||
private const string Pin = "86EAF2C4D052F7D8759F";
|
||||
private static string _pin = "86EAF2C4D052F7D8759F";
|
||||
private const string AccountNumber = "AP.1042276242";
|
||||
private const string EncryptedKey = "130D2@D2923";
|
||||
|
||||
private readonly HttpClient _httpClient;
|
||||
|
||||
public AqayePardakhtPaymentGateway(IHttpClientFactory httpClientFactory)
|
||||
public AqayePardakhtPaymentGateway(IHttpClientFactory httpClientFactory,IOptions<AppSettingConfiguration> appSetting)
|
||||
{
|
||||
_httpClient = httpClientFactory.CreateClient();
|
||||
|
||||
if (appSetting.Value.Domain == ".dad-mehr.ir")
|
||||
{
|
||||
_pin = "7349F84E81AB584862D9";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task<PaymentGatewayResponse> Create(CreatePaymentGatewayRequest command,CancellationToken cancellationToken =default)
|
||||
{
|
||||
var response = await _httpClient.PostAsJsonAsync("https://panel.aqayepardakht.ir/api/v2/create", new
|
||||
{
|
||||
pin = Pin,
|
||||
pin = _pin,
|
||||
amount = command.Amount,
|
||||
callback = command.CallBackUrl,
|
||||
card_number = command.CardNumber,
|
||||
@@ -49,7 +56,7 @@ public class AqayePardakhtPaymentGateway:IPaymentGateway
|
||||
{
|
||||
var response = await _httpClient.PostAsJsonAsync("https://panel.aqayepardakht.ir/api/v2/verify", new
|
||||
{
|
||||
pin = Pin,
|
||||
pin = _pin,
|
||||
amount = command.Amount,
|
||||
transid = command.TransactionId,
|
||||
}, cancellationToken: cancellationToken);
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.PaymentGateway;
|
||||
using Company.Domain.PaymentTransactionAgg;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.PaymentGateway;
|
||||
using Company.Domain.PaymentTransactionAgg;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
@@ -15,10 +16,10 @@ public class PaymentTransactionApplication : IPaymentTransactionApplication
|
||||
private readonly IPaymentTransactionRepository _paymentTransactionRepository;
|
||||
private readonly IPaymentGateway _paymentGateway;
|
||||
|
||||
public PaymentTransactionApplication(IPaymentTransactionRepository paymentTransactionRepository,IHttpClientFactory httpClientFactory)
|
||||
public PaymentTransactionApplication(IPaymentTransactionRepository paymentTransactionRepository,IHttpClientFactory httpClientFactory, IOptions<AppSettingConfiguration> appSetting)
|
||||
{
|
||||
_paymentTransactionRepository = paymentTransactionRepository;
|
||||
_paymentGateway = new AqayePardakhtPaymentGateway(httpClientFactory);
|
||||
_paymentGateway = new AqayePardakhtPaymentGateway(httpClientFactory, appSetting);
|
||||
}
|
||||
|
||||
public async Task<List<GetPaymentTransactionListViewModel>> GetPaymentTransactionList(
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@using AccountManagement.Domain.TicketAccessAccountAgg
|
||||
@using _0_Framework.Application
|
||||
@using AccountManagement.Domain.TicketAccessAccountAgg
|
||||
@using Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@using Microsoft.Extensions.Options
|
||||
@inject _0_Framework.Application.IAuthHelper AuthHelper;
|
||||
|
||||
@@ -15,6 +15,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using System.Net.Http;
|
||||
using System.Text.Json.Serialization;
|
||||
using _0_Framework.Application.PaymentGateway;
|
||||
using Microsoft.Extensions.Options;
|
||||
using static ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk.IndexModel2;
|
||||
|
||||
namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
@@ -32,13 +33,13 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
[BindProperty]
|
||||
public IFormFile File { get; set; }
|
||||
|
||||
public IndexModel(IAndroidApkVersionApplication application, IRollCallDomainService rollCallDomainService, CompanyContext context, AccountContext accountContext, IHttpClientFactory httpClientFactory)
|
||||
public IndexModel(IAndroidApkVersionApplication application, IRollCallDomainService rollCallDomainService, CompanyContext context, AccountContext accountContext, IHttpClientFactory httpClientFactory,IOptions<AppSettingConfiguration> appSetting)
|
||||
{
|
||||
_application = application;
|
||||
_rollCallDomainService = rollCallDomainService;
|
||||
_context = context;
|
||||
_accountContext = accountContext;
|
||||
_paymentGateway = new AqayePardakhtPaymentGateway(httpClientFactory);
|
||||
_paymentGateway = new AqayePardakhtPaymentGateway(httpClientFactory, appSetting);
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
@@ -112,12 +113,12 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
|
||||
|
||||
};
|
||||
var createResponse = await _paymentGateway.CreateSandBox(command, cancellationToken);
|
||||
var createResponse = await _paymentGateway.Create(command, cancellationToken);
|
||||
|
||||
|
||||
if (createResponse.Status == "success")
|
||||
{
|
||||
return Redirect(_paymentGateway.GetStartPaySandBoxUrl(createResponse.TransactionId));
|
||||
return Redirect(_paymentGateway.GetStartPayUrl(createResponse.TransactionId));
|
||||
}
|
||||
|
||||
//TranslateCode(result?.ErrorCode);
|
||||
|
||||
Reference in New Issue
Block a user