fix checkout process of mvc app
This commit is contained in:
parent
e689cfd65e
commit
ffe2884dc4
@ -26,8 +26,6 @@ namespace Basket.API.IntegrationEvents.EventHandling
|
||||
{
|
||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||
|
||||
await _repository.DeleteBasketAsync(@event.UserId.ToString());
|
||||
}
|
||||
}
|
||||
|
@ -26,8 +26,6 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.Even
|
||||
{
|
||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||
|
||||
var userIds = _repository.GetUsers();
|
||||
|
||||
foreach (var id in userIds)
|
||||
@ -46,8 +44,6 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.Even
|
||||
|
||||
if (itemsToUpdate != null)
|
||||
{
|
||||
_logger.LogInformation("----- ProductPriceChangedIntegrationEventHandler - Updating items in basket for user: {BuyerId} ({@Items})", basket.BuyerId, itemsToUpdate);
|
||||
|
||||
foreach (var item in itemsToUpdate)
|
||||
{
|
||||
if (item.UnitPrice == oldPrice)
|
||||
|
@ -64,12 +64,10 @@ namespace Catalog.API.Grpc
|
||||
|
||||
public override async Task<PaginatedItemsResponse> GetItemsByIds(CatalogItemsRequest request, ServerCallContext context)
|
||||
{
|
||||
_logger.LogInformation("---------- GetItemsByIds request {@request}", request);
|
||||
if (!string.IsNullOrEmpty(request.Ids))
|
||||
{
|
||||
var items = await GetItemsByIdsAsync(request.Ids);
|
||||
|
||||
_logger.LogInformation("---------- GetItemsByIds items {@items}", items);
|
||||
if (!items.Any())
|
||||
{
|
||||
context.Status = new Status(StatusCode.NotFound, $"ids value invalid. Must be comma-separated list of numbers");
|
||||
@ -78,18 +76,15 @@ namespace Catalog.API.Grpc
|
||||
return this.MapToResponse(items);
|
||||
}
|
||||
|
||||
_logger.LogInformation("---------- GetItemsByIds else");
|
||||
var totalItems = await _catalogContext.CatalogItems
|
||||
.LongCountAsync();
|
||||
|
||||
_logger.LogInformation("---------- GetItemsByIds totalItems {@totalItems}", totalItems);
|
||||
var itemsOnPage = await _catalogContext.CatalogItems
|
||||
.OrderBy(c => c.Name)
|
||||
.Skip(request.PageSize * request.PageIndex)
|
||||
.Take(request.PageSize)
|
||||
.ToListAsync();
|
||||
|
||||
_logger.LogInformation("---------- GetItemsByIds itemsOnPage {@itemsOnPage}", itemsOnPage);
|
||||
/* The "awesome" fix for testing Devspaces */
|
||||
|
||||
/*
|
||||
@ -100,10 +95,8 @@ namespace Catalog.API.Grpc
|
||||
*/
|
||||
|
||||
itemsOnPage = ChangeUriPlaceholder(itemsOnPage);
|
||||
_logger.LogInformation("---------- GetItemsByIds itemsOnPage2 {@itemsOnPage}", itemsOnPage);
|
||||
|
||||
var model = this.MapToResponse(itemsOnPage, totalItems, request.PageIndex, request.PageSize);
|
||||
_logger.LogInformation("---------- GetItemsByIds model {@model}", model);
|
||||
context.Status = new Status(StatusCode.OK, string.Empty);
|
||||
|
||||
return model;
|
||||
|
@ -39,8 +39,6 @@ namespace Catalog.API.IntegrationEvents
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogInformation("----- Publishing integration event: {IntegrationEventId_published} from {AppName} - ({@IntegrationEvent})", evt.Id, Program.AppName, evt);
|
||||
|
||||
await _eventLogService.MarkEventAsInProgressAsync(evt.Id);
|
||||
_eventBus.Publish(evt);
|
||||
await _eventLogService.MarkEventAsPublishedAsync(evt.Id);
|
||||
@ -54,8 +52,6 @@ namespace Catalog.API.IntegrationEvents
|
||||
|
||||
public async Task SaveEventAndCatalogContextChangesAsync(IntegrationEvent evt)
|
||||
{
|
||||
_logger.LogInformation("----- CatalogIntegrationEventService - Saving changes and integrationEvent: {IntegrationEventId}", evt.Id);
|
||||
|
||||
//Use of an EF Core resiliency strategy when using multiple DbContexts within an explicit BeginTransaction():
|
||||
//See: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency
|
||||
await ResilientTransaction.New(_catalogContext).ExecuteAsync(async () =>
|
||||
|
@ -32,8 +32,6 @@
|
||||
{
|
||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||
|
||||
var confirmedOrderStockItems = new List<ConfirmedOrderStockItem>();
|
||||
|
||||
foreach (var orderStockItem in @event.OrderStockItems)
|
||||
|
@ -25,8 +25,6 @@
|
||||
{
|
||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||
|
||||
//we're not blocking stock/inventory
|
||||
foreach (var orderStockItem in @event.OrderStockItems)
|
||||
{
|
||||
|
@ -72,9 +72,6 @@
|
||||
{
|
||||
var newUserLocations = MapUserLocationDetails(newLocations);
|
||||
var @event = new UserLocationUpdatedIntegrationEvent(userId, newUserLocations);
|
||||
|
||||
_logger.LogInformation("----- Publishing integration event: {IntegrationEventId} from {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||
|
||||
_eventBus.Publish(@event);
|
||||
}
|
||||
|
||||
|
@ -28,8 +28,6 @@
|
||||
{
|
||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||
|
||||
var userMarketingData = await _marketingDataRepository.GetAsync(@event.UserId);
|
||||
userMarketingData = userMarketingData ??
|
||||
new MarketingData() { UserId = @event.UserId };
|
||||
|
@ -24,8 +24,6 @@ namespace Ordering.API.Application.Behaviors
|
||||
{
|
||||
var typeName = request.GetGenericTypeName();
|
||||
|
||||
_logger.LogInformation("----- Validating command {CommandType}", typeName);
|
||||
|
||||
var failures = _validators
|
||||
.Select(v => v.Validate(request))
|
||||
.SelectMany(result => result.Errors)
|
||||
|
@ -53,8 +53,6 @@
|
||||
order.AddOrderItem(item.ProductId, item.ProductName, item.UnitPrice, item.Discount, item.PictureUrl, item.Units);
|
||||
}
|
||||
|
||||
_logger.LogInformation("----- Creating Order - Order: {@Order}", order);
|
||||
|
||||
_orderRepository.Add(order);
|
||||
|
||||
return await _orderRepository.UnitOfWork
|
||||
|
@ -27,7 +27,6 @@ namespace Ordering.API.Application.DomainEventHandlers.BuyerAndPaymentMethodVeri
|
||||
public async Task Handle(BuyerAndPaymentMethodVerifiedDomainEvent buyerPaymentMethodVerifiedEvent, CancellationToken cancellationToken)
|
||||
{
|
||||
var log = _logger.CreateLogger<UpdateOrderWhenBuyerAndPaymentMethodVerifiedDomainEventHandler>();
|
||||
log.LogInformation("----- Handling BuyerAndPaymentMethodVerifiedDomainEvent - buyerPaymentMethodVerifiedEvent: {@buyerPaymentMethodVerifiedEvent}", buyerPaymentMethodVerifiedEvent);
|
||||
var orderToUpdate = await _orderRepository.GetAsync(buyerPaymentMethodVerifiedEvent.OrderId);
|
||||
orderToUpdate.SetBuyerId(buyerPaymentMethodVerifiedEvent.Buyer.Id);
|
||||
orderToUpdate.SetPaymentId(buyerPaymentMethodVerifiedEvent.Payment.Id);
|
||||
|
@ -12,7 +12,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Ordering.API.Application.DomainEventHandlers.OrderStartedEvent
|
||||
{
|
||||
public class ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler
|
||||
public class ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler
|
||||
: INotificationHandler<OrderStartedDomainEvent>
|
||||
{
|
||||
private readonly ILoggerFactory _logger;
|
||||
@ -21,8 +21,8 @@ namespace Ordering.API.Application.DomainEventHandlers.OrderStartedEvent
|
||||
private readonly IOrderingIntegrationEventService _orderingIntegrationEventService;
|
||||
|
||||
public ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler(
|
||||
ILoggerFactory logger,
|
||||
IBuyerRepository buyerRepository,
|
||||
ILoggerFactory logger,
|
||||
IBuyerRepository buyerRepository,
|
||||
IIdentityService identityService,
|
||||
IOrderingIntegrationEventService orderingIntegrationEventService)
|
||||
{
|
||||
@ -33,13 +33,13 @@ namespace Ordering.API.Application.DomainEventHandlers.OrderStartedEvent
|
||||
}
|
||||
|
||||
public async Task Handle(OrderStartedDomainEvent orderStartedEvent, CancellationToken cancellationToken)
|
||||
{
|
||||
{
|
||||
var cardTypeId = (orderStartedEvent.CardTypeId != 0) ? orderStartedEvent.CardTypeId : 1;
|
||||
var buyer = await _buyerRepository.FindAsync(orderStartedEvent.UserId);
|
||||
bool buyerOriginallyExisted = (buyer == null) ? false : true;
|
||||
|
||||
if (!buyerOriginallyExisted)
|
||||
{
|
||||
{
|
||||
buyer = new Buyer(orderStartedEvent.UserId, orderStartedEvent.UserName);
|
||||
}
|
||||
|
||||
@ -51,8 +51,8 @@ namespace Ordering.API.Application.DomainEventHandlers.OrderStartedEvent
|
||||
orderStartedEvent.CardExpiration,
|
||||
orderStartedEvent.Order.Id);
|
||||
|
||||
var buyerUpdated = buyerOriginallyExisted ?
|
||||
_buyerRepository.Update(buyer) :
|
||||
var buyerUpdated = buyerOriginallyExisted ?
|
||||
_buyerRepository.Update(buyer) :
|
||||
_buyerRepository.Add(buyer);
|
||||
|
||||
await _buyerRepository.UnitOfWork
|
||||
@ -60,7 +60,6 @@ namespace Ordering.API.Application.DomainEventHandlers.OrderStartedEvent
|
||||
|
||||
var orderStatusChangedTosubmittedIntegrationEvent = new OrderStatusChangedToSubmittedIntegrationEvent(orderStartedEvent.Order.Id, orderStartedEvent.Order.OrderStatus.Name, buyer.Name);
|
||||
await _orderingIntegrationEventService.AddAndSaveEventAsync(orderStatusChangedTosubmittedIntegrationEvent);
|
||||
|
||||
_logger.CreateLogger<ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler>()
|
||||
.LogTrace("Buyer {BuyerId} and related payment method were validated or updated for orderId: {OrderId}.",
|
||||
buyerUpdated.Id, orderStartedEvent.Order.Id);
|
||||
|
@ -37,8 +37,6 @@ namespace Ordering.API.Application.IntegrationEvents.EventHandling
|
||||
{
|
||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||
|
||||
var command = new SetAwaitingValidationOrderStatusCommand(@event.OrderId);
|
||||
|
||||
_logger.LogInformation(
|
||||
|
@ -31,8 +31,6 @@
|
||||
{
|
||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||
|
||||
var command = new CancelOrderCommand(@event.OrderId);
|
||||
|
||||
_logger.LogInformation(
|
||||
|
@ -31,8 +31,6 @@
|
||||
{
|
||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||
|
||||
var command = new SetPaidOrderStatusCommand(@event.OrderId);
|
||||
|
||||
_logger.LogInformation(
|
||||
|
@ -31,8 +31,6 @@
|
||||
{
|
||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||
|
||||
var command = new SetStockConfirmedOrderStatusCommand(@event.OrderId);
|
||||
|
||||
_logger.LogInformation(
|
||||
|
@ -30,8 +30,6 @@
|
||||
{
|
||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||
|
||||
var orderStockRejectedItems = @event.OrderStockItems
|
||||
.FindAll(c => !c.HasStock)
|
||||
.Select(c => c.ProductId)
|
||||
|
@ -35,11 +35,9 @@ namespace Ordering.API.Application.IntegrationEvents.EventHandling
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
public async Task Handle(UserCheckoutAcceptedIntegrationEvent @event)
|
||||
{
|
||||
{
|
||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||
|
||||
var result = false;
|
||||
|
||||
if (@event.RequestId != Guid.Empty)
|
||||
@ -62,11 +60,7 @@ namespace Ordering.API.Application.IntegrationEvents.EventHandling
|
||||
|
||||
result = await _mediator.Send(requestCreateOrder);
|
||||
|
||||
if (result)
|
||||
{
|
||||
_logger.LogInformation("----- CreateOrderCommand suceeded - RequestId: {RequestId}", @event.RequestId);
|
||||
}
|
||||
else
|
||||
if (!result)
|
||||
{
|
||||
_logger.LogWarning("CreateOrderCommand failed - RequestId: {RequestId}", @event.RequestId);
|
||||
}
|
||||
|
@ -45,8 +45,6 @@ namespace Ordering.API.Application.IntegrationEvents
|
||||
|
||||
foreach (var logEvt in pendingLogEvents)
|
||||
{
|
||||
_logger.LogInformation("----- Publishing integration event: {IntegrationEventId} from {AppName} - ({@IntegrationEvent})", logEvt.EventId, Program.AppName, logEvt.IntegrationEvent);
|
||||
|
||||
try
|
||||
{
|
||||
await _eventLogService.MarkEventAsInProgressAsync(logEvt.EventId);
|
||||
@ -64,8 +62,6 @@ namespace Ordering.API.Application.IntegrationEvents
|
||||
|
||||
public async Task AddAndSaveEventAsync(IntegrationEvent evt)
|
||||
{
|
||||
_logger.LogInformation("----- Enqueuing integration event {IntegrationEventId} to repository ({@IntegrationEvent})", evt.Id, evt);
|
||||
|
||||
await _eventLogService.SaveEventAsync(evt, _orderingContext.GetCurrentTransaction());
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers
|
||||
{
|
||||
var requestCancelOrder = new IdentifiedCommand<CancelOrderCommand, bool>(command, guid);
|
||||
|
||||
_logger.LogInformation(
|
||||
_logger.LogTrace(
|
||||
"----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
requestCancelOrder.GetGenericTypeName(),
|
||||
nameof(requestCancelOrder.Command.OrderNumber),
|
||||
@ -79,7 +79,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers
|
||||
{
|
||||
var requestShipOrder = new IdentifiedCommand<ShipOrderCommand, bool>(command, guid);
|
||||
|
||||
_logger.LogInformation(
|
||||
_logger.LogTrace(
|
||||
"----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
requestShipOrder.GetGenericTypeName(),
|
||||
nameof(requestShipOrder.Command.OrderNumber),
|
||||
@ -141,7 +141,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<OrderDraftDTO>> CreateOrderDraftFromBasketDataAsync([FromBody] CreateOrderDraftCommand createOrderDraftCommand)
|
||||
{
|
||||
_logger.LogInformation(
|
||||
_logger.LogTrace(
|
||||
"----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
createOrderDraftCommand.GetGenericTypeName(),
|
||||
nameof(createOrderDraftCommand.BuyerId),
|
||||
|
@ -27,7 +27,7 @@ namespace GrpcOrdering
|
||||
public override async Task<OrderDraftDTO> CreateOrderDraftFromBasketData(CreateOrderDraftCommand createOrderDraftCommand, ServerCallContext context)
|
||||
{
|
||||
_logger.LogInformation($"Begin grpc call from method {context.Method} for ordering get order draft {createOrderDraftCommand}");
|
||||
_logger.LogInformation(
|
||||
_logger.LogTrace(
|
||||
"----- Sending command: {CommandName} - {IdProperty}: {CommandId} ({@Command})",
|
||||
createOrderDraftCommand.GetGenericTypeName(),
|
||||
nameof(createOrderDraftCommand.BuyerId),
|
||||
|
@ -55,8 +55,6 @@ namespace Ordering.BackgroundTasks.Tasks
|
||||
{
|
||||
var confirmGracePeriodEvent = new GracePeriodConfirmedIntegrationEvent(orderId);
|
||||
|
||||
_logger.LogInformation("----- Publishing integration event: {IntegrationEventId} from {AppName} - ({@IntegrationEvent})", confirmGracePeriodEvent.Id, _settings.SubscriptionClientName, confirmGracePeriodEvent);
|
||||
|
||||
_eventBus.Publish(confirmGracePeriodEvent);
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O
|
||||
// Address is a Value Object pattern example persisted as EF Core 2.0 owned entity
|
||||
public Address Address { get; private set; }
|
||||
|
||||
public int? GetBuyerId => _buyerId;
|
||||
public int? GetBuyerId { get { return this._buyerId; } }
|
||||
private int? _buyerId;
|
||||
|
||||
public OrderStatus OrderStatus { get; private set; }
|
||||
@ -26,7 +26,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O
|
||||
|
||||
private string _description;
|
||||
|
||||
|
||||
|
||||
// Draft orders have this set to true. Currently we don't check anywhere the draft status of an Order, but we could do it if needed
|
||||
private bool _isDraft;
|
||||
|
||||
@ -46,7 +46,8 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O
|
||||
return order;
|
||||
}
|
||||
|
||||
protected Order() {
|
||||
protected Order()
|
||||
{
|
||||
_orderItems = new List<OrderItem>();
|
||||
_isDraft = false;
|
||||
}
|
||||
|
@ -27,10 +27,31 @@ namespace Ordering.Infrastructure.EntityConfigurations
|
||||
a.WithOwner();
|
||||
});
|
||||
|
||||
orderConfiguration.Property<DateTime>("OrderDate").IsRequired();
|
||||
orderConfiguration.Property<int?>("BuyerId").IsRequired(false);
|
||||
orderConfiguration.Property<int>("OrderStatusId").IsRequired();
|
||||
orderConfiguration.Property<int?>("PaymentMethodId").IsRequired(false);
|
||||
orderConfiguration
|
||||
.Property<int?>("_buyerId")
|
||||
.UsePropertyAccessMode(PropertyAccessMode.Field)
|
||||
.HasColumnName("BuyerId")
|
||||
.IsRequired(false);
|
||||
|
||||
orderConfiguration
|
||||
.Property<DateTime>("_orderDate")
|
||||
.UsePropertyAccessMode(PropertyAccessMode.Field)
|
||||
.HasColumnName("OrderDate")
|
||||
.IsRequired();
|
||||
|
||||
orderConfiguration
|
||||
.Property<int>("_orderStatusId")
|
||||
// .HasField("_orderStatusId")
|
||||
.UsePropertyAccessMode(PropertyAccessMode.Field)
|
||||
.HasColumnName("OrderStatusId")
|
||||
.IsRequired();
|
||||
|
||||
orderConfiguration
|
||||
.Property<int?>("_paymentMethodId")
|
||||
.UsePropertyAccessMode(PropertyAccessMode.Field)
|
||||
.HasColumnName("PaymentMethodId")
|
||||
.IsRequired(false);
|
||||
|
||||
orderConfiguration.Property<string>("Description").IsRequired(false);
|
||||
|
||||
var navigation = orderConfiguration.Metadata.FindNavigation(nameof(Order.OrderItems));
|
||||
@ -41,18 +62,21 @@ namespace Ordering.Infrastructure.EntityConfigurations
|
||||
|
||||
orderConfiguration.HasOne<PaymentMethod>()
|
||||
.WithMany()
|
||||
.HasForeignKey("PaymentMethodId")
|
||||
// .HasForeignKey("PaymentMethodId")
|
||||
.HasForeignKey("_paymentMethodId")
|
||||
.IsRequired(false)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
orderConfiguration.HasOne<Buyer>()
|
||||
.WithMany()
|
||||
.IsRequired(false)
|
||||
.HasForeignKey("BuyerId");
|
||||
// .HasForeignKey("BuyerId");
|
||||
.HasForeignKey("_buyerId");
|
||||
|
||||
orderConfiguration.HasOne(o => o.OrderStatus)
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderStatusId");
|
||||
// .HasForeignKey("OrderStatusId");
|
||||
.HasForeignKey("_orderStatusId");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,22 +22,37 @@ namespace Ordering.Infrastructure.EntityConfigurations
|
||||
orderItemConfiguration.Property<int>("OrderId")
|
||||
.IsRequired();
|
||||
|
||||
orderItemConfiguration.Property<decimal>("Discount")
|
||||
orderItemConfiguration
|
||||
.Property<decimal>("_discount")
|
||||
.UsePropertyAccessMode(PropertyAccessMode.Field)
|
||||
.HasColumnName("Discount")
|
||||
.IsRequired();
|
||||
|
||||
orderItemConfiguration.Property<int>("ProductId")
|
||||
.IsRequired();
|
||||
|
||||
orderItemConfiguration.Property<string>("ProductName")
|
||||
orderItemConfiguration
|
||||
.Property<string>("_productName")
|
||||
.UsePropertyAccessMode(PropertyAccessMode.Field)
|
||||
.HasColumnName("ProductName")
|
||||
.IsRequired();
|
||||
|
||||
orderItemConfiguration.Property<decimal>("UnitPrice")
|
||||
orderItemConfiguration
|
||||
.Property<decimal>("_unitPrice")
|
||||
.UsePropertyAccessMode(PropertyAccessMode.Field)
|
||||
.HasColumnName("UnitPrice")
|
||||
.IsRequired();
|
||||
|
||||
orderItemConfiguration.Property<int>("Units")
|
||||
orderItemConfiguration
|
||||
.Property<int>("_units")
|
||||
.UsePropertyAccessMode(PropertyAccessMode.Field)
|
||||
.HasColumnName("Units")
|
||||
.IsRequired();
|
||||
|
||||
orderItemConfiguration.Property<string>("PictureUrl")
|
||||
orderItemConfiguration
|
||||
.Property<string>("_pictureUrl")
|
||||
.UsePropertyAccessMode(PropertyAccessMode.Field)
|
||||
.HasColumnName("PictureUrl")
|
||||
.IsRequired(false);
|
||||
}
|
||||
}
|
||||
|
@ -23,27 +23,43 @@ namespace Ordering.Infrastructure.EntityConfigurations
|
||||
paymentConfiguration.Property<int>("BuyerId")
|
||||
.IsRequired();
|
||||
|
||||
paymentConfiguration.Property<string>("CardHolderName")
|
||||
paymentConfiguration
|
||||
.Property<string>("_cardHolderName")
|
||||
.UsePropertyAccessMode(PropertyAccessMode.Field)
|
||||
.HasColumnName("CardHolderName")
|
||||
.HasMaxLength(200)
|
||||
.IsRequired();
|
||||
|
||||
paymentConfiguration.Property<string>("Alias")
|
||||
paymentConfiguration
|
||||
.Property<string>("_alias")
|
||||
.UsePropertyAccessMode(PropertyAccessMode.Field)
|
||||
.HasColumnName("Alias")
|
||||
.HasMaxLength(200)
|
||||
.IsRequired();
|
||||
|
||||
paymentConfiguration.Property<string>("CardNumber")
|
||||
paymentConfiguration
|
||||
.Property<string>("_cardNumber")
|
||||
.UsePropertyAccessMode(PropertyAccessMode.Field)
|
||||
.HasColumnName("CardNumber")
|
||||
.HasMaxLength(25)
|
||||
.IsRequired();
|
||||
|
||||
paymentConfiguration.Property<DateTime>("Expiration")
|
||||
paymentConfiguration
|
||||
.Property<DateTime>("_expiration")
|
||||
.UsePropertyAccessMode(PropertyAccessMode.Field)
|
||||
.HasColumnName("Expiration")
|
||||
.HasMaxLength(25)
|
||||
.IsRequired();
|
||||
|
||||
paymentConfiguration.Property<int>("CardTypeId")
|
||||
paymentConfiguration
|
||||
.Property<int>("_cardTypeId")
|
||||
.UsePropertyAccessMode(PropertyAccessMode.Field)
|
||||
.HasColumnName("CardTypeId")
|
||||
.IsRequired();
|
||||
|
||||
paymentConfiguration.HasOne(p => p.CardType)
|
||||
.WithMany()
|
||||
.HasForeignKey("CardTypeId");
|
||||
.HasForeignKey("_cardTypeId");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositor
|
||||
.FirstOrDefaultAsync(o => o.Id == orderId);
|
||||
if (order == null)
|
||||
{
|
||||
|
||||
order = _context
|
||||
.Orders
|
||||
.Local
|
||||
|
@ -27,8 +27,6 @@ namespace Ordering.SignalrHub.IntegrationEvents
|
||||
{
|
||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||
|
||||
await _hubContext.Clients
|
||||
.Group(@event.BuyerName)
|
||||
.SendAsync("UpdatedOrderState", new { OrderId = @event.OrderId, Status = @event.OrderStatus });
|
||||
|
@ -28,8 +28,6 @@ namespace Ordering.SignalrHub.IntegrationEvents.EventHandling
|
||||
{
|
||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||
|
||||
await _hubContext.Clients
|
||||
.Group(@event.BuyerName)
|
||||
.SendAsync("UpdatedOrderState", new { OrderId = @event.OrderId, Status = @event.OrderStatus });
|
||||
|
@ -26,8 +26,6 @@ namespace Ordering.SignalrHub.IntegrationEvents.EventHandling
|
||||
{
|
||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||
|
||||
await _hubContext.Clients
|
||||
.Group(@event.BuyerName)
|
||||
.SendAsync("UpdatedOrderState", new { OrderId = @event.OrderId, Status = @event.OrderStatus });
|
||||
|
@ -28,8 +28,6 @@ namespace Ordering.SignalrHub.IntegrationEvents.EventHandling
|
||||
{
|
||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||
|
||||
await _hubContext.Clients
|
||||
.Group(@event.BuyerName)
|
||||
.SendAsync("UpdatedOrderState", new { OrderId = @event.OrderId, Status = @event.OrderStatus });
|
||||
|
@ -29,8 +29,6 @@ namespace Ordering.SignalrHub.IntegrationEvents.EventHandling
|
||||
{
|
||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||
|
||||
await _hubContext.Clients
|
||||
.Group(@event.BuyerName)
|
||||
.SendAsync("UpdatedOrderState", new { OrderId = @event.OrderId, Status = @event.OrderStatus });
|
||||
|
@ -29,8 +29,6 @@ namespace Ordering.SignalrHub.IntegrationEvents.EventHandling
|
||||
{
|
||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||
|
||||
await _hubContext.Clients
|
||||
.Group(@event.BuyerName)
|
||||
.SendAsync("UpdatedOrderState", new { OrderId = @event.OrderId, Status = @event.OrderStatus });
|
||||
|
@ -31,8 +31,6 @@
|
||||
{
|
||||
using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
|
||||
{
|
||||
_logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);
|
||||
|
||||
IntegrationEvent orderPaymentIntegrationEvent;
|
||||
|
||||
//Business feature comment:
|
||||
@ -50,8 +48,6 @@
|
||||
orderPaymentIntegrationEvent = new OrderPaymentFailedIntegrationEvent(@event.OrderId);
|
||||
}
|
||||
|
||||
_logger.LogInformation("----- Publishing integration event: {IntegrationEventId} from {AppName} - ({@IntegrationEvent})", orderPaymentIntegrationEvent.Id, Program.AppName, orderPaymentIntegrationEvent);
|
||||
|
||||
_eventBus.Publish(orderPaymentIntegrationEvent);
|
||||
|
||||
await Task.CompletedTask;
|
||||
|
@ -25,8 +25,6 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
||||
var user = User as ClaimsPrincipal;
|
||||
var token = await HttpContext.GetTokenAsync("access_token");
|
||||
|
||||
_logger.LogInformation("----- User {@User} authenticated into {AppName}", user, Program.AppName);
|
||||
|
||||
if (token != null)
|
||||
{
|
||||
ViewData["access_token"] = token;
|
||||
|
Loading…
x
Reference in New Issue
Block a user