diff --git a/CompanyManagment.EFCore/CompanyManagment.EFCore.csproj b/CompanyManagment.EFCore/CompanyManagment.EFCore.csproj
index 7c4c515d..7ea4c3cd 100644
--- a/CompanyManagment.EFCore/CompanyManagment.EFCore.csproj
+++ b/CompanyManagment.EFCore/CompanyManagment.EFCore.csproj
@@ -13,6 +13,7 @@
+
diff --git a/ServiceHost/Areas/AdminNew/Pages/Company/AndroidApk/Index.cshtml.cs b/ServiceHost/Areas/AdminNew/Pages/Company/AndroidApk/Index.cshtml.cs
index 4053226f..4e193b9d 100644
--- a/ServiceHost/Areas/AdminNew/Pages/Company/AndroidApk/Index.cshtml.cs
+++ b/ServiceHost/Areas/AdminNew/Pages/Company/AndroidApk/Index.cshtml.cs
@@ -21,6 +21,8 @@ using Company.Domain.InstitutionPlanAgg;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
using Microsoft.Extensions.Options;
+using Parbad;
+using Parbad.Gateway.Sepehr;
using static ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk.IndexModel2;
namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
@@ -35,6 +37,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
private readonly IPaymentGateway _paymentGateway;
private readonly ITemporaryClientRegistrationApplication _clientRegistrationApplication;
private readonly IHttpClientFactory _httpClientFactory;
+ private readonly IOnlinePayment _onlinePayment;
@@ -43,7 +46,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
public IndexModel(IAndroidApkVersionApplication application, IRollCallDomainService rollCallDomainService,
CompanyContext context, AccountContext accountContext, IHttpClientFactory httpClientFactory,
IOptions appSetting,
- ITemporaryClientRegistrationApplication clientRegistrationApplication)
+ ITemporaryClientRegistrationApplication clientRegistrationApplication, IOnlinePayment onlinePayment)
{
_application = application;
_rollCallDomainService = rollCallDomainService;
@@ -51,6 +54,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
_accountContext = accountContext;
_httpClientFactory = httpClientFactory;
_clientRegistrationApplication = clientRegistrationApplication;
+ _onlinePayment = onlinePayment;
_paymentGateway = new AqayePardakhtPaymentGateway(httpClientFactory, appSetting);
}
@@ -76,6 +80,13 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
//var notEndedRollCalls = rollCalls.Where(x => x.EndDate == null).ToList();
//RefactorAllTheRollCallsOnEsfand(endedRollCalls, notEndedRollCalls);
//CreateRewardForKebabMahdi().GetAwaiter().GetResult();
+ var result = await _onlinePayment.RequestAsync(invoices =>
+ {
+ invoices.SetAmount(10000)
+ .SetCallbackUrl("https://gozareshgir.ir/Payment/PageCallBackSaderat")
+ .UseSepehr();
+ });
+ return await result.GatewayTransporter.TransportAsync();
var httpClient = _httpClientFactory.CreateClient();
httpClient.BaseAddress = new Uri("https://sepehr.shaparak.ir/");
var terminal = 99213700;
diff --git a/ServiceHost/Program.cs b/ServiceHost/Program.cs
index 7e3431e0..f8029da6 100644
--- a/ServiceHost/Program.cs
+++ b/ServiceHost/Program.cs
@@ -30,6 +30,8 @@ using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Diagnostics;
using MongoDB.Driver;
+using Parbad.Builder;
+using Parbad.Gateway.Sepehr;
using Swashbuckle.AspNetCore.SwaggerUI;
@@ -306,11 +308,24 @@ builder.Services.AddCors(options =>
builder.Services.AddExceptionHandler();
+var sepehrTerminalId = builder.Configuration.GetValue("SepehrGateWayTerminalId");
+
+builder.Services.AddParbad().ConfigureGateways(gateways =>
+{
+ gateways.AddSepehr().WithAccounts(accounts =>
+ {
+ accounts.AddInMemory(account =>
+ {
+ account.TerminalId = sepehrTerminalId;
+ });
+ });
+});
var app = builder.Build();
app.UseCors("AllowSpecificOrigins");
+
#region Mahan
//app.UseStatusCodePagesWithRedirects("/error/{0}");
@@ -324,6 +339,7 @@ if (builder.Environment.IsDevelopment())
await tester.Test();
}
+
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
diff --git a/ServiceHost/appsettings.Development.json b/ServiceHost/appsettings.Development.json
index 5efba4b6..a749e19d 100644
--- a/ServiceHost/appsettings.Development.json
+++ b/ServiceHost/appsettings.Development.json
@@ -42,7 +42,8 @@
"SmsSettings": {
"IsTestMode": true,
"TestNumbers": [ "09116967898", "09116067106", "09114221321" ]
- }
+ },
+ "SepehrGateWayTerminalId": 99213700
}