Refactored namespace statement for payment.api
This commit is contained in:
parent
830314f517
commit
46dad7ac75
@ -1,16 +1,8 @@
|
|||||||
namespace Payment.API.IntegrationEvents.EventHandling
|
namespace Microsoft.eShopOnContainers.Payment.API.IntegrationEvents.EventHandling;
|
||||||
{
|
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Microsoft.Extensions.Options;
|
|
||||||
using Payment.API.IntegrationEvents.Events;
|
|
||||||
using Serilog.Context;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
public class OrderStatusChangedToStockConfirmedIntegrationEventHandler :
|
public class OrderStatusChangedToStockConfirmedIntegrationEventHandler :
|
||||||
IIntegrationEventHandler<OrderStatusChangedToStockConfirmedIntegrationEvent>
|
IIntegrationEventHandler<OrderStatusChangedToStockConfirmedIntegrationEvent>
|
||||||
{
|
{
|
||||||
private readonly IEventBus _eventBus;
|
private readonly IEventBus _eventBus;
|
||||||
private readonly PaymentSettings _settings;
|
private readonly PaymentSettings _settings;
|
||||||
private readonly ILogger<OrderStatusChangedToStockConfirmedIntegrationEventHandler> _logger;
|
private readonly ILogger<OrderStatusChangedToStockConfirmedIntegrationEventHandler> _logger;
|
||||||
@ -57,5 +49,4 @@
|
|||||||
await Task.CompletedTask;
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,11 +1,8 @@
|
|||||||
namespace Payment.API.IntegrationEvents.Events
|
namespace Microsoft.eShopOnContainers.Payment.API.IntegrationEvents.Events;
|
||||||
{
|
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
|
||||||
|
|
||||||
public record OrderPaymentFailedIntegrationEvent : IntegrationEvent
|
public record OrderPaymentFailedIntegrationEvent : IntegrationEvent
|
||||||
{
|
{
|
||||||
public int OrderId { get; }
|
public int OrderId { get; }
|
||||||
|
|
||||||
public OrderPaymentFailedIntegrationEvent(int orderId) => OrderId = orderId;
|
public OrderPaymentFailedIntegrationEvent(int orderId) => OrderId = orderId;
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,11 +1,8 @@
|
|||||||
namespace Payment.API.IntegrationEvents.Events
|
namespace Microsoft.eShopOnContainers.Payment.API.IntegrationEvents.Events;
|
||||||
{
|
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
|
||||||
|
|
||||||
public record OrderPaymentSucceededIntegrationEvent : IntegrationEvent
|
public record OrderPaymentSucceededIntegrationEvent : IntegrationEvent
|
||||||
{
|
{
|
||||||
public int OrderId { get; }
|
public int OrderId { get; }
|
||||||
|
|
||||||
public OrderPaymentSucceededIntegrationEvent(int orderId) => OrderId = orderId;
|
public OrderPaymentSucceededIntegrationEvent(int orderId) => OrderId = orderId;
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,12 +1,9 @@
|
|||||||
namespace Payment.API.IntegrationEvents.Events
|
namespace Microsoft.eShopOnContainers.Payment.API.IntegrationEvents.Events;
|
||||||
{
|
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
|
||||||
|
|
||||||
public record OrderStatusChangedToStockConfirmedIntegrationEvent : IntegrationEvent
|
public record OrderStatusChangedToStockConfirmedIntegrationEvent : IntegrationEvent
|
||||||
{
|
{
|
||||||
public int OrderId { get; }
|
public int OrderId { get; }
|
||||||
|
|
||||||
public OrderStatusChangedToStockConfirmedIntegrationEvent(int orderId)
|
public OrderStatusChangedToStockConfirmedIntegrationEvent(int orderId)
|
||||||
=> OrderId = orderId;
|
=> OrderId = orderId;
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,8 +1,8 @@
|
|||||||
namespace Payment.API
|
namespace Microsoft.eShopOnContainers.Payment.API;
|
||||||
|
|
||||||
|
public class PaymentSettings
|
||||||
{
|
{
|
||||||
public class PaymentSettings
|
|
||||||
{
|
|
||||||
public bool PaymentSucceeded { get; set; }
|
public bool PaymentSucceeded { get; set; }
|
||||||
public string EventBusConnection { get; set; }
|
public string EventBusConnection { get; set; }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,16 +1,4 @@
|
|||||||
using Microsoft.AspNetCore;
|
var configuration = GetConfiguration();
|
||||||
using Microsoft.AspNetCore.Builder;
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Payment.API;
|
|
||||||
using Serilog;
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using Azure.Identity;
|
|
||||||
using Azure.Core;
|
|
||||||
|
|
||||||
var configuration = GetConfiguration();
|
|
||||||
|
|
||||||
Log.Logger = CreateSerilogLogger(configuration);
|
Log.Logger = CreateSerilogLogger(configuration);
|
||||||
|
|
||||||
|
@ -1,26 +1,7 @@
|
|||||||
using Autofac;
|
namespace Microsoft.eShopOnContainers.Payment.API;
|
||||||
using Autofac.Extensions.DependencyInjection;
|
|
||||||
using HealthChecks.UI.Client;
|
|
||||||
using Microsoft.AspNetCore.Builder;
|
|
||||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
|
||||||
using Microsoft.Azure.ServiceBus;
|
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
|
|
||||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Payment.API.IntegrationEvents.EventHandling;
|
|
||||||
using Payment.API.IntegrationEvents.Events;
|
|
||||||
using RabbitMQ.Client;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Payment.API
|
public class Startup
|
||||||
{
|
{
|
||||||
public class Startup
|
|
||||||
{
|
|
||||||
public Startup(IConfiguration configuration)
|
public Startup(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
Configuration = configuration;
|
Configuration = configuration;
|
||||||
@ -164,10 +145,10 @@ namespace Payment.API
|
|||||||
var eventBus = app.ApplicationServices.GetRequiredService<IEventBus>();
|
var eventBus = app.ApplicationServices.GetRequiredService<IEventBus>();
|
||||||
eventBus.Subscribe<OrderStatusChangedToStockConfirmedIntegrationEvent, OrderStatusChangedToStockConfirmedIntegrationEventHandler>();
|
eventBus.Subscribe<OrderStatusChangedToStockConfirmedIntegrationEvent, OrderStatusChangedToStockConfirmedIntegrationEventHandler>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class CustomExtensionMethods
|
public static class CustomExtensionMethods
|
||||||
{
|
{
|
||||||
public static IServiceCollection AddCustomHealthCheck(this IServiceCollection services, IConfiguration configuration)
|
public static IServiceCollection AddCustomHealthCheck(this IServiceCollection services, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
var hcBuilder = services.AddHealthChecks();
|
var hcBuilder = services.AddHealthChecks();
|
||||||
@ -194,5 +175,4 @@ namespace Payment.API
|
|||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user