diff --git a/TestHosts/TestHosts/Controllers/DeveloperController.cs b/TestHosts/TestHosts/Controllers/DeveloperController.cs index 05bb129..9dc5749 100644 --- a/TestHosts/TestHosts/Controllers/DeveloperController.cs +++ b/TestHosts/TestHosts/Controllers/DeveloperController.cs @@ -18,7 +18,7 @@ namespace TestHosts.Controllers public class DeveloperController : ControllerBase { private readonly IDbContextResolver ContextResolver; - private const String PataPawaReadModelKey = "PataPawaReadModel"; + public DeveloperController(IDbContextResolver contextResolver) { this.ContextResolver = contextResolver; } @@ -27,7 +27,7 @@ public DeveloperController(IDbContextResolver contextResolver) [Route("patapawaprepay/createuser")] public async Task CreatePrepayUser([FromBody] CreatePatapawaPrePayUser request, CancellationToken cancellationToken){ - using ResolvedDbContext? resolvedContext = this.ContextResolver.Resolve(PataPawaReadModelKey); + using ResolvedDbContext? resolvedContext = this.ContextResolver.Resolve(Constants.PataPawaReadModelConfig); Guid userId = Guid.NewGuid(); @@ -57,7 +57,7 @@ await resolvedContext.Context.PrePayUsers.AddAsync(new PrePayUser [Route("patapawaprepay/adduserdebt")] public async Task AddUserDebt([FromBody] AddPatapawaPrePayUserDebt request, CancellationToken cancellationToken) { - using ResolvedDbContext? resolvedContext = this.ContextResolver.Resolve(PataPawaReadModelKey); + using ResolvedDbContext? resolvedContext = this.ContextResolver.Resolve(Constants.PataPawaReadModelConfig); PrePayUser user = await resolvedContext.Context.PrePayUsers.SingleOrDefaultAsync(u => u.UserName == request.UserName, cancellationToken); @@ -75,7 +75,7 @@ public async Task AddUserDebt([FromBody] AddPatapawaPrePayUserDeb [HttpPost] [Route("patapawaprepay/createmeter")] public async Task CreatePrepayMeter([FromBody] CreatePatapawaPrePayMeter request, CancellationToken cancellationToken){ - using ResolvedDbContext? resolvedContext = this.ContextResolver.Resolve(PataPawaReadModelKey); + using ResolvedDbContext? resolvedContext = this.ContextResolver.Resolve(Constants.PataPawaReadModelConfig); Guid meterId = Guid.NewGuid(); @@ -101,7 +101,7 @@ await resolvedContext.Context.PrePayMeters.AddAsync(new PrePayMeter public async Task CreateHostConfiguration([FromBody] CreatePataPawaPostPayBill request, CancellationToken cancellationToken) { - using ResolvedDbContext? resolvedContext = this.ContextResolver.Resolve(PataPawaReadModelKey); + using ResolvedDbContext? resolvedContext = this.ContextResolver.Resolve(Constants.PataPawaReadModelConfig); Guid billIdentifier = Guid.NewGuid(); diff --git a/TestHosts/TestHosts/Database/PataPawa/PataPawaContext.cs b/TestHosts/TestHosts/Database/PataPawa/PataPawaContext.cs index ad15faa..22e556c 100644 --- a/TestHosts/TestHosts/Database/PataPawa/PataPawaContext.cs +++ b/TestHosts/TestHosts/Database/PataPawa/PataPawaContext.cs @@ -9,13 +9,12 @@ namespace TestHosts.Database.PataPawa public class PataPawaContext : DbContext { private readonly String ConnectionString; - private const String PataPawaReadModelKey = "PataPawaReadModel"; public PataPawaContext() { // This is the migration connection string // Get connection string from configuration. - this.ConnectionString = ConfigurationReader.GetConnectionString(PataPawaReadModelKey); + this.ConnectionString = ConfigurationReader.GetConnectionString(Constants.PataPawaReadModelConfig); } public PataPawaContext(String connectionString) diff --git a/TestHosts/TestHosts/Program.cs b/TestHosts/TestHosts/Program.cs index f7b6b2a..74c9a62 100644 --- a/TestHosts/TestHosts/Program.cs +++ b/TestHosts/TestHosts/Program.cs @@ -1,164 +1,150 @@ - using CoreWCF; - using CoreWCF.Configuration; - using CoreWCF.Description; - using HealthChecks.UI.Client; - using Microsoft.AspNetCore.Builder; - using Microsoft.AspNetCore.Diagnostics.HealthChecks; - using Microsoft.AspNetCore.Hosting; - using Microsoft.Extensions.Configuration; - using Microsoft.Extensions.DependencyInjection; - using Microsoft.Extensions.Diagnostics.HealthChecks; - using Microsoft.Extensions.Hosting; - using Microsoft.Extensions.Hosting.WindowsServices; - using Microsoft.Extensions.Logging; - using NLog; - using NLog.Web; - using Shared.EntityFramework; - using Shared.Extensions; - using Shared.General; - using Shared.Middleware; - using System; - using System.IO; - using System.Reflection; - using System.Security; - using Microsoft.EntityFrameworkCore; - using Newtonsoft.Json; - using Newtonsoft.Json.Serialization; - using Sentry.Extensibility; - using Shared.Logger.TennantContext; - using TestHosts; - using TestHosts.Common; - using TestHosts.Database.PataPawa; - using TestHosts.Database.TestBank; - using TestHosts.SoapServices; - using LogLevel = Microsoft.Extensions.Logging.LogLevel; - - const String PataPawaReadModelKey = "PataPawaReadModel"; - const String TestBankReadModelKey = "TestBankReadModel"; +using CoreWCF; +using CoreWCF.Configuration; +using CoreWCF.Description; +using HealthChecks.UI.Client; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Diagnostics.HealthChecks; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Diagnostics.HealthChecks; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Hosting.WindowsServices; +using Microsoft.Extensions.Logging; +using NLog; +using NLog.Web; +using Shared.EntityFramework; +using Shared.Extensions; +using Shared.General; +using Shared.Middleware; +using System; +using System.IO; +using System.Reflection; +using System.Security; +using Microsoft.EntityFrameworkCore; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using Sentry.Extensibility; +using Shared.Logger.TennantContext; +using TestHosts; +using TestHosts.Common; +using TestHosts.Database.PataPawa; +using TestHosts.Database.TestBank; +using TestHosts.SoapServices; +using ILogger = Microsoft.Extensions.Logging.ILogger; +using LogLevel = Microsoft.Extensions.Logging.LogLevel; + + try { - WebApplicationBuilder builder = WebApplication.CreateBuilder(new WebApplicationOptions { Args = args, ContentRootPath = AppContext.BaseDirectory }); - - // ---------------------------------------------------------------------- - // Load custom hosting configuration (your existing hosting.json setup) - // ---------------------------------------------------------------------- - FileInfo fi = new FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location); - builder.Configuration.SetBasePath(fi.Directory!.FullName).AddJsonFile("hosting.json", optional: false, reloadOnChange: true).AddJsonFile("hosting.development.json", optional: true, reloadOnChange: true) - .AddJsonFile("/home/txnproc/config/appsettings.json", true, true) - .AddJsonFile($"/home/txnproc/config/appsettings.{builder.Environment.EnvironmentName}.json", optional: true) - .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) - .AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json", optional: true, reloadOnChange: true) - .AddEnvironmentVariables(); - - ConfigurationReader.Initialise(builder.Configuration); - // ---------------------------------------------------------------------- - // Configure Windows Service mode - // ---------------------------------------------------------------------- - if (WindowsServiceHelpers.IsWindowsService()) - builder.Host.UseWindowsService(); - - // ---------------------------------------------------------------------- - // Configure Kestrel - // ---------------------------------------------------------------------- - builder.WebHost.ConfigureKestrel(options => { options.AllowSynchronousIO = true; }); + WebApplicationBuilder builder = WebApplication.CreateBuilder(new WebApplicationOptions { Args = args, ContentRootPath = AppContext.BaseDirectory }); + + // ---------------------------------------------------------------------- + // Load custom hosting configuration (your existing hosting.json setup) + // ---------------------------------------------------------------------- + FileInfo fi = new FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location); + builder.Configuration.SetBasePath(fi.Directory!.FullName).AddJsonFile("hosting.json", optional: false, reloadOnChange: true).AddJsonFile("hosting.development.json", optional: true, reloadOnChange: true).AddJsonFile("/home/txnproc/config/appsettings.json", true, true).AddJsonFile($"/home/txnproc/config/appsettings.{builder.Environment.EnvironmentName}.json", optional: true).AddJsonFile("appsettings.json", optional: true, reloadOnChange: true).AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json", optional: true, reloadOnChange: true).AddEnvironmentVariables(); + + ConfigurationReader.Initialise(builder.Configuration); + // ---------------------------------------------------------------------- + // Configure Windows Service mode + // ---------------------------------------------------------------------- + if (WindowsServiceHelpers.IsWindowsService()) + builder.Host.UseWindowsService(); + + // ---------------------------------------------------------------------- + // Configure Kestrel + // ---------------------------------------------------------------------- + builder.WebHost.ConfigureKestrel(options => { options.AllowSynchronousIO = true; }); // ---------------------------------------------------------------------- // Configure Sentry // ---------------------------------------------------------------------- var sentrySection = ConfigurationReader.GetValueOrDefault("SentryConfiguration", "Dsn", "N/A"); - if (sentrySection != "N/A") - { - // Replace the condition below if you intended to only enable Sentry in certain environments. - if (builder.Environment.IsDevelopment() == false) - { - builder.WebHost.UseSentry(o => - { - o.Dsn = sentrySection; - o.SendDefaultPii = true; - o.MaxRequestBodySize = RequestSize.Always; - o.CaptureBlockingCalls = ConfigurationReader.GetValueOrDefault("SentryConfiguration", "CaptureBlockingCalls", false); - o.IncludeActivityData = ConfigurationReader.GetValueOrDefault("SentryConfiguration", "IncludeActivityData", false); - o.Release = Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "unknown"; - }); - } + if (sentrySection != "N/A") { + // Replace the condition below if you intended to only enable Sentry in certain environments. + if (builder.Environment.IsDevelopment() == false) { + builder.WebHost.UseSentry(o => { + o.Dsn = sentrySection; + o.SendDefaultPii = true; + o.MaxRequestBodySize = RequestSize.Always; + o.CaptureBlockingCalls = ConfigurationReader.GetValueOrDefault("SentryConfiguration", "CaptureBlockingCalls", false); + o.IncludeActivityData = ConfigurationReader.GetValueOrDefault("SentryConfiguration", "IncludeActivityData", false); + o.Release = Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "unknown"; + }); } + } // ---------------------------------------------------------------------- // Configure NLog // ---------------------------------------------------------------------- string nlogConfigFilename = "nlog.config"; - if (builder.Environment.IsDevelopment()) { - String devFile = Path.Combine(builder.Environment.ContentRootPath, "nlog.development.config"); - if (File.Exists(devFile)) - nlogConfigFilename = "nlog.development.config"; - } + if (builder.Environment.IsDevelopment()) { + String devFile = Path.Combine(builder.Environment.ContentRootPath, "nlog.development.config"); + if (File.Exists(devFile)) + nlogConfigFilename = "nlog.development.config"; + } - LogManager.Setup().LoadConfigurationFromFile(Path.Combine(builder.Environment.ContentRootPath, nlogConfigFilename)); - builder.Logging.ClearProviders(); - builder.Host.UseNLog(); - -// ---------------------------------------------------------------------- -// Add application and framework services -// ---------------------------------------------------------------------- - builder.Services.AddControllers().AddNewtonsoftJson(options => - { - options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; - options.SerializerSettings.TypeNameHandling = TypeNameHandling.None; - options.SerializerSettings.Formatting = Formatting.Indented; - options.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc; - options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); - }); - builder.Services.AddHealthChecks().AddSqlServer(connectionString: ConfigurationReader.GetConnectionString("HealthCheck"), - healthQuery: "SELECT 1;", - name: "Read Model Server", - failureStatus: HealthStatus.Degraded, - tags: new[] { "db", "sql", "sqlserver" }); ; - builder.Services.AddServiceModelServices().AddServiceModelMetadata(); - - builder.Services.AddSingleton(typeof(IDbContextResolver<>), typeof(DbContextResolver<>)); - if (builder.Environment.IsEnvironment("IntegrationTest") || builder.Configuration.GetValue("ServiceOptions:UseInMemoryDatabase") == true) - { - builder.Services.AddDbContext(builder => builder.UseInMemoryDatabase(TestBankReadModelKey)); - builder.Services.AddDbContext(builder => builder.UseInMemoryDatabase(PataPawaReadModelKey)); + LogManager.Setup().LoadConfigurationFromFile(Path.Combine(builder.Environment.ContentRootPath, nlogConfigFilename)); + builder.Logging.ClearProviders(); + builder.Host.UseNLog(); - } - else - { - String testBankConnectionString = ConfigurationReader.GetConnectionString(TestBankReadModelKey); - builder.Services.AddDbContext(builder => builder.UseSqlServer(testBankConnectionString)); + // ---------------------------------------------------------------------- + // Add application and framework services + // ---------------------------------------------------------------------- + builder.Services.AddControllers().AddNewtonsoftJson(options => { + options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; + options.SerializerSettings.TypeNameHandling = TypeNameHandling.None; + options.SerializerSettings.Formatting = Formatting.Indented; + options.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc; + options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); + }); + builder.Services.AddHealthChecks().AddSqlServer(connectionString: ConfigurationReader.GetConnectionString("HealthCheck"), healthQuery: "SELECT 1;", name: "Read Model Server", failureStatus: HealthStatus.Degraded, tags: new[] { "db", "sql", "sqlserver" }); + + builder.Services.AddServiceModelServices().AddServiceModelMetadata(); + + builder.Services.AddSingleton(typeof(IDbContextResolver<>), typeof(DbContextResolver<>)); + if (builder.Environment.IsEnvironment("IntegrationTest") || builder.Configuration.GetValue("ServiceOptions:UseInMemoryDatabase") == true) { + builder.Services.AddDbContext(builder => builder.UseInMemoryDatabase(Constants.TestBankReadModelConfig)); + builder.Services.AddDbContext(builder => builder.UseInMemoryDatabase(Constants.PataPawaReadModelConfig)); - String pataPawaConnectionString = ConfigurationReader.GetConnectionString(PataPawaReadModelKey); - builder.Services.AddDbContext(builder => builder.UseSqlServer(pataPawaConnectionString)); - } - builder.Services.AddScoped(x => new TenantContext()); - builder.Services.AddSingleton(); + } + else { + String testBankConnectionString = ConfigurationReader.GetConnectionString(Constants.TestBankReadModelConfig); + builder.Services.AddDbContext(builder => builder.UseSqlServer(testBankConnectionString)); + + String pataPawaConnectionString = ConfigurationReader.GetConnectionString(Constants.PataPawaReadModelConfig); + builder.Services.AddDbContext(builder => builder.UseSqlServer(pataPawaConnectionString)); + } + + builder.Services.AddScoped(x => new TenantContext()); + builder.Services.AddSingleton(); // Add your background hosted service builder.Services.AddHostedService(provider => { - IDbContextResolver contextResolver = provider.GetRequiredService>(); - return new PendingPrePaymentProcessor(contextResolver); - }); + IDbContextResolver contextResolver = provider.GetRequiredService>(); + return new PendingPrePaymentProcessor(contextResolver); + }); -// Database initialization will now be handled by a hosted service - builder.Services.AddHostedService(); + // Database initialization will now be handled by a hosted service + builder.Services.AddHostedService(); - builder.Services.AddScoped(x => new TenantContext()); - builder.Services.AddSingleton(); - builder.Services.AddMvc(); + builder.Services.AddScoped(x => new TenantContext()); + builder.Services.AddSingleton(); + builder.Services.AddMvc(); - builder.Services.AddServiceModelServices().AddServiceModelMetadata(); - builder.Services.AddSingleton(); - builder.Services.AddSingleton(); + builder.Services.AddServiceModelServices().AddServiceModelMetadata(); + builder.Services.AddSingleton(); + builder.Services.AddSingleton(); - bool logRequests = ConfigurationReader.GetValueOrDefault("MiddlewareLogging", "LogRequests", true); - bool logResponses = ConfigurationReader.GetValueOrDefault("MiddlewareLogging", "LogResponses", true); - LogLevel middlewareLogLevel = ConfigurationReader.GetValueOrDefault("MiddlewareLogging", "MiddlewareLogLevel", LogLevel.Warning); + bool logRequests = ConfigurationReader.GetValueOrDefault("MiddlewareLogging", "LogRequests", true); + bool logResponses = ConfigurationReader.GetValueOrDefault("MiddlewareLogging", "LogResponses", true); + LogLevel middlewareLogLevel = ConfigurationReader.GetValueOrDefault("MiddlewareLogging", "MiddlewareLogLevel", LogLevel.Warning); - RequestResponseMiddlewareLoggingConfig config = - new RequestResponseMiddlewareLoggingConfig(middlewareLogLevel, logRequests, logResponses); + RequestResponseMiddlewareLoggingConfig config = new RequestResponseMiddlewareLoggingConfig(middlewareLogLevel, logRequests, logResponses); - builder.Services.AddSingleton(config); + builder.Services.AddSingleton(config); // ---------------------------------------------------------------------- // Build the app @@ -166,55 +152,60 @@ WebApplication app = builder.Build(); // Create a scoped logger and assign it - using (var scope = app.Services.CreateScope()) - { - var loggerFactory = scope.ServiceProvider.GetRequiredService(); - var loggerObject = loggerFactory.CreateLogger("AppStartup"); - Shared.Logger.Logger.Initialise(loggerObject); - } - -// ---------------------------------------------------------------------- -// Middleware pipeline -// ---------------------------------------------------------------------- - if (app.Environment.IsDevelopment()) { - app.UseDeveloperExceptionPage(); - } + using (IServiceScope scope = app.Services.CreateScope()) { + ILoggerFactory loggerFactory = scope.ServiceProvider.GetRequiredService(); + ILogger loggerObject = loggerFactory.CreateLogger("AppStartup"); + Shared.Logger.Logger.Initialise(loggerObject); + } + + // ---------------------------------------------------------------------- + // Middleware pipeline + // ---------------------------------------------------------------------- + if (app.Environment.IsDevelopment()) { + app.UseDeveloperExceptionPage(); + } -// Custom middleware - app.UseMiddleware(); - app.AddRequestResponseLogging(); - app.AddExceptionHandler(); + // Custom middleware + app.UseMiddleware(); + app.AddRequestResponseLogging(); + app.AddExceptionHandler(); - app.UseRouting(); + app.UseRouting(); -// ---------------------------------------------------------------------- -// Endpoints -// ---------------------------------------------------------------------- - app.MapControllers(); + // ---------------------------------------------------------------------- + // Endpoints + // ---------------------------------------------------------------------- + app.MapControllers(); - app.MapHealthChecks("health", new HealthCheckOptions { Predicate = _ => true, ResponseWriter = Shared.HealthChecks.HealthCheckMiddleware.WriteResponse }); + app.MapHealthChecks("health", new HealthCheckOptions { Predicate = _ => true, ResponseWriter = Shared.HealthChecks.HealthCheckMiddleware.WriteResponse }); - app.MapHealthChecks("healthui", new HealthCheckOptions { Predicate = _ => true, ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse }); + app.MapHealthChecks("healthui", new HealthCheckOptions { Predicate = _ => true, ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse }); -// ---------------------------------------------------------------------- -// CoreWCF setup -// ---------------------------------------------------------------------- - app.UseServiceModel(builder => { builder.AddService(options => { options.DebugBehavior.IncludeExceptionDetailInFaults = true; }).AddServiceEndpoint(new BasicHttpBinding(), "/PataPawaPostPayService/basichttp"); }); + // ---------------------------------------------------------------------- + // CoreWCF setup + // ---------------------------------------------------------------------- + app.UseServiceModel(builder => { builder.AddService(options => { options.DebugBehavior.IncludeExceptionDetailInFaults = true; }).AddServiceEndpoint(new BasicHttpBinding(), "/PataPawaPostPayService/basichttp"); }); - ServiceMetadataBehavior metadataBehavior = app.Services.GetRequiredService(); - metadataBehavior.HttpGetEnabled = true; + ServiceMetadataBehavior metadataBehavior = app.Services.GetRequiredService(); + metadataBehavior.HttpGetEnabled = true; -// ---------------------------------------------------------------------- -// Start the application -// ---------------------------------------------------------------------- - app.Run(); + // ---------------------------------------------------------------------- + // Start the application + // ---------------------------------------------------------------------- + app.Run(); - Shared.Logger.Logger.LogWarning("Application started successfully"); + Shared.Logger.Logger.LogWarning("Application started successfully"); } - catch (Exception ex) { - Shared.Logger.Logger.LogError("Application stopped due to exception", ex); - throw; - } - finally { - LogManager.Shutdown(); - } +catch (Exception ex) { + Shared.Logger.Logger.LogError("Application stopped due to exception", ex); + throw; +} +finally { + LogManager.Shutdown(); +} + + +public static class Constants { + public static readonly String PataPawaReadModelConfig = "PataPawaReadModel"; + public static readonly String TestBankReadModelConfig = "TestBankReadModel"; +} \ No newline at end of file diff --git a/TestHosts/TestHosts/SoapServices/PataPawaPostPayService.cs b/TestHosts/TestHosts/SoapServices/PataPawaPostPayService.cs index 59adf4c..450b790 100644 --- a/TestHosts/TestHosts/SoapServices/PataPawaPostPayService.cs +++ b/TestHosts/TestHosts/SoapServices/PataPawaPostPayService.cs @@ -12,7 +12,7 @@ namespace TestHosts.SoapServices; public class PataPawaPostPayService : IPataPawaPostPayService { private readonly IDbContextResolver ContextResolver; - private const String PataPawaReadModelKey = "PataPawaReadModel"; + #region Constructors public PataPawaPostPayService(IDbContextResolver contextResolver) { @@ -26,7 +26,7 @@ public PataPawaPostPayService(IDbContextResolver contextResolve public LoginResponse Login(String username, String password) { // Check if we have an api key - using ResolvedDbContext? resolvedContext = this.ContextResolver.Resolve(PataPawaReadModelKey); + using ResolvedDbContext? resolvedContext = this.ContextResolver.Resolve(Constants.PataPawaReadModelConfig); PostPaidAccount account = PataPawaPostPayService.GetPostPaidAccount(username, resolvedContext.Context); if (account == null) { @@ -67,7 +67,7 @@ public ProcessBillResponse ProcessBill(String username, String mobile_no, String customer_name, Decimal amount) { - using ResolvedDbContext? resolvedContext = this.ContextResolver.Resolve(PataPawaReadModelKey); + using ResolvedDbContext? resolvedContext = this.ContextResolver.Resolve(Constants.PataPawaReadModelConfig); PostPaidAccount account = GetAccount(username, api_key, resolvedContext.Context); if (account == null) { return new ProcessBillResponse { @@ -102,7 +102,7 @@ public ProcessBillResponse ProcessBill(String username, public VerifyResponse VerifyAccount(String username, String api_key, String account_no) { - using ResolvedDbContext? resolvedContext = this.ContextResolver.Resolve(PataPawaReadModelKey); + using ResolvedDbContext? resolvedContext = this.ContextResolver.Resolve(Constants.PataPawaReadModelConfig); PostPaidAccount account = PataPawaPostPayService.GetAccount(username, api_key, resolvedContext.Context); if (account == null) { return new VerifyResponse {