Skip to content

Commit bf85169

Browse files
author
ericuss
committed
partial checkin trying to fix checkout process
1 parent f1cb1b6 commit bf85169

10 files changed

Lines changed: 353 additions & 30 deletions

File tree

src/Services/Basket/Basket.API/Controllers/BasketController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public async Task<ActionResult> CheckoutAsync([FromBody]BasketCheckout basketChe
6363
basketCheckout.RequestId = (Guid.TryParse(requestId, out Guid guid) && guid != Guid.Empty) ?
6464
guid : basketCheckout.RequestId;
6565

66-
_logger.LogInformation("----- CheckoutAsync userId: {userId} ", userId);
66+
_logger.LogInformation("----- CheckoutAsync userId: {userId} ", userId);
6767

6868
var basket = await _repository.GetBasketAsync(userId);
6969

@@ -72,9 +72,9 @@ public async Task<ActionResult> CheckoutAsync([FromBody]BasketCheckout basketChe
7272
return BadRequest();
7373
}
7474

75-
_logger.LogInformation("----- CheckoutAsync basket: {@basket} ", basket);
75+
_logger.LogInformation("----- CheckoutAsync basket: {@basket} ", basket);
7676

77-
_logger.LogInformation("----- CheckoutAsync user identity: {User} ", string.Join(':', ((ClaimsIdentity)User.Identity).Claims.Select(c => c.Type + " " + c.Value)));
77+
_logger.LogInformation("----- CheckoutAsync user identity: {User} ", string.Join(':', ((ClaimsIdentity)User.Identity).Claims.Select(c => c.Type + " " + c.Value)));
7878

7979
var userName = User.FindFirst(x => x.Type == ClaimTypes.Name).Value;
8080

src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/BuyerAndPaymentMethodVerified/UpdateOrderWhenBuyerAndPaymentMethodVerifiedDomainEventHandler.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@ public UpdateOrderWhenBuyerAndPaymentMethodVerifiedDomainEventHandler(
2626
// then we can update the original Order with the BuyerId and PaymentId (foreign keys)
2727
public async Task Handle(BuyerAndPaymentMethodVerifiedDomainEvent buyerPaymentMethodVerifiedEvent, CancellationToken cancellationToken)
2828
{
29+
var log = _logger.CreateLogger<UpdateOrderWhenBuyerAndPaymentMethodVerifiedDomainEventHandler>();
30+
log.LogInformation("----- Handling BuyerAndPaymentMethodVerifiedDomainEvent - buyerPaymentMethodVerifiedEvent: {@buyerPaymentMethodVerifiedEvent}", buyerPaymentMethodVerifiedEvent);
2931
var orderToUpdate = await _orderRepository.GetAsync(buyerPaymentMethodVerifiedEvent.OrderId);
3032
orderToUpdate.SetBuyerId(buyerPaymentMethodVerifiedEvent.Buyer.Id);
3133
orderToUpdate.SetPaymentId(buyerPaymentMethodVerifiedEvent.Payment.Id);
3234

33-
_logger.CreateLogger<UpdateOrderWhenBuyerAndPaymentMethodVerifiedDomainEventHandler>()
34-
.LogTrace("Order with Id: {OrderId} has been successfully updated with a payment method {PaymentMethod} ({Id})",
35+
log.LogTrace("Order with Id: {OrderId} has been successfully updated with a payment method {PaymentMethod} ({Id})",
3536
buyerPaymentMethodVerifiedEvent.OrderId, nameof(buyerPaymentMethodVerifiedEvent.Payment), buyerPaymentMethodVerifiedEvent.Payment.Id);
3637
}
3738
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
2+
using Microsoft.AspNetCore.Hosting;
3+
using Microsoft.AspNetCore.Identity;
4+
using Microsoft.Extensions.Logging;
5+
using Microsoft.Extensions.Options;
6+
using System;
7+
using System.Collections.Generic;
8+
using System.IO;
9+
using System.IO.Compression;
10+
using System.Linq;
11+
using System.Text.RegularExpressions;
12+
using System.Threading.Tasks;
13+
using Microsoft.EntityFrameworkCore.Design;
14+
using Microsoft.EntityFrameworkCore;
15+
using Microsoft.Extensions.Configuration;
16+
17+
namespace Ordering.API.Infrastructure.Factories
18+
{
19+
public class OrderingDbContextFactory : IDesignTimeDbContextFactory<OrderingContext>
20+
{
21+
public OrderingContext CreateDbContext(string[] args)
22+
{
23+
var config = new ConfigurationBuilder()
24+
.SetBasePath(Path.Combine(Directory.GetCurrentDirectory()))
25+
.AddJsonFile("appsettings.json")
26+
.AddEnvironmentVariables()
27+
.Build();
28+
29+
var optionsBuilder = new DbContextOptionsBuilder<OrderingContext>();
30+
31+
optionsBuilder.UseSqlServer(config["ConnectionString"], sqlServerOptionsAction: o => o.MigrationsAssembly("Ordering.API"));
32+
33+
return new OrderingContext(optionsBuilder.Options);
34+
}
35+
}
36+
}

src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20190808132242_Change_Relation_Of_Orders.Designer.cs

Lines changed: 252 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Microsoft.EntityFrameworkCore.Migrations;
2+
3+
namespace Ordering.API.Infrastructure.Migrations
4+
{
5+
public partial class Change_Relation_Of_Orders : Migration
6+
{
7+
protected override void Up(MigrationBuilder migrationBuilder)
8+
{
9+
}
10+
11+
protected override void Down(MigrationBuilder migrationBuilder)
12+
{
13+
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)