Minor refactoring
This commit is contained in:
parent
5a3a94bba6
commit
ce2083d248
@ -29,17 +29,16 @@ namespace Ordering.API.Application.Sagas
|
|||||||
OrderingContext orderingContext)
|
OrderingContext orderingContext)
|
||||||
: base(orderingContext)
|
: base(orderingContext)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Command handler which confirms that the grace period
|
/// Event handler which confirms that the grace period
|
||||||
/// has been completed and order has not been cancelled.
|
/// has been completed and order will not initially be cancelled.
|
||||||
/// If so, the process continues for validation.
|
/// Therefore, the order process continues for validation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="event">
|
/// <param name="event">
|
||||||
/// Integration command message which is sent by a saga
|
/// Integration event message which is sent by a saga scheduler
|
||||||
/// scheduler which provides the sagas that its grace
|
/// telling us that the saga's grace period has completed.
|
||||||
/// period has completed.
|
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task Handle(GracePeriodConfirmedIntegrationEvent @event)
|
public async Task Handle(GracePeriodConfirmedIntegrationEvent @event)
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
if (!context.OrderStatus.Any())
|
if (!context.OrderStatus.Any())
|
||||||
{
|
{
|
||||||
context.OrderStatus.Add(OrderStatus.Submited);
|
context.OrderStatus.Add(OrderStatus.Submitted);
|
||||||
context.OrderStatus.Add(OrderStatus.AwaitingValidation);
|
context.OrderStatus.Add(OrderStatus.AwaitingValidation);
|
||||||
context.OrderStatus.Add(OrderStatus.StockConfirmed);
|
context.OrderStatus.Add(OrderStatus.StockConfirmed);
|
||||||
context.OrderStatus.Add(OrderStatus.Paid);
|
context.OrderStatus.Add(OrderStatus.Paid);
|
||||||
|
@ -46,7 +46,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O
|
|||||||
_orderItems = new List<OrderItem>();
|
_orderItems = new List<OrderItem>();
|
||||||
_buyerId = buyerId;
|
_buyerId = buyerId;
|
||||||
_paymentMethodId = paymentMethodId;
|
_paymentMethodId = paymentMethodId;
|
||||||
_orderStatusId = OrderStatus.Submited.Id;
|
_orderStatusId = OrderStatus.Submitted.Id;
|
||||||
_orderDate = DateTime.UtcNow;
|
_orderDate = DateTime.UtcNow;
|
||||||
Address = address;
|
Address = address;
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O
|
|||||||
public void SetAwaitingValidationStatus()
|
public void SetAwaitingValidationStatus()
|
||||||
{
|
{
|
||||||
if (_orderStatusId == OrderStatus.Cancelled.Id ||
|
if (_orderStatusId == OrderStatus.Cancelled.Id ||
|
||||||
_orderStatusId != OrderStatus.Submited.Id)
|
_orderStatusId != OrderStatus.Submitted.Id)
|
||||||
{
|
{
|
||||||
StatusChangeException(OrderStatus.AwaitingValidation);
|
StatusChangeException(OrderStatus.AwaitingValidation);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
public class OrderStatus
|
public class OrderStatus
|
||||||
: Enumeration
|
: Enumeration
|
||||||
{
|
{
|
||||||
public static OrderStatus Submited = new OrderStatus(1, nameof(Submited).ToLowerInvariant());
|
public static OrderStatus Submitted = new OrderStatus(1, nameof(Submitted).ToLowerInvariant());
|
||||||
public static OrderStatus AwaitingValidation = new OrderStatus(2, nameof(AwaitingValidation).ToLowerInvariant());
|
public static OrderStatus AwaitingValidation = new OrderStatus(2, nameof(AwaitingValidation).ToLowerInvariant());
|
||||||
public static OrderStatus StockConfirmed = new OrderStatus(3, nameof(StockConfirmed).ToLowerInvariant());
|
public static OrderStatus StockConfirmed = new OrderStatus(3, nameof(StockConfirmed).ToLowerInvariant());
|
||||||
public static OrderStatus Paid = new OrderStatus(4, nameof(Paid).ToLowerInvariant());
|
public static OrderStatus Paid = new OrderStatus(4, nameof(Paid).ToLowerInvariant());
|
||||||
@ -27,7 +27,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<OrderStatus> List() =>
|
public static IEnumerable<OrderStatus> List() =>
|
||||||
new[] { Submited, AwaitingValidation, StockConfirmed, Paid, Shipped, Cancelled };
|
new[] { Submitted, AwaitingValidation, StockConfirmed, Paid, Shipped, Cancelled };
|
||||||
|
|
||||||
public static OrderStatus FromName(string name)
|
public static OrderStatus FromName(string name)
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
<a class="esh-orders-link" asp-controller="Order" asp-action="Detail" asp-route-orderId="@item.OrderNumber">Detail</a>
|
<a class="esh-orders-link" asp-controller="Order" asp-action="Detail" asp-route-orderId="@item.OrderNumber">Detail</a>
|
||||||
</section>
|
</section>
|
||||||
<section class="esh-orders-item col-xs-1">
|
<section class="esh-orders-item col-xs-1">
|
||||||
@if (item.Status.ToLower() == "submited")
|
@if (item.Status.ToLower() == "submitted")
|
||||||
{
|
{
|
||||||
<a class="esh-orders-link" asp-controller="Order" asp-action="cancel" asp-route-orderId="@item.OrderNumber">Cancel</a>
|
<a class="esh-orders-link" asp-controller="Order" asp-action="cancel" asp-route-orderId="@item.OrderNumber">Cancel</a>
|
||||||
}
|
}
|
||||||
|
@ -18,14 +18,14 @@ namespace FunctionalTests.Services.Ordering
|
|||||||
{
|
{
|
||||||
// Issue: Unable to communicate with test host process
|
// Issue: Unable to communicate with test host process
|
||||||
//[Fact]
|
//[Fact]
|
||||||
//public async Task Checkout_basket_and_check_order_status_submited()
|
//public async Task Checkout_basket_and_check_order_status_submitted()
|
||||||
//{
|
//{
|
||||||
// using (var orderServer = new OrderingScenariosBase().CreateServer())
|
// using (var orderServer = new OrderingScenariosBase().CreateServer())
|
||||||
// using (var basketServer = new BasketScenariosBase().CreateServer())
|
// using (var basketServer = new BasketScenariosBase().CreateServer())
|
||||||
// {
|
// {
|
||||||
// // Expected data
|
// // Expected data
|
||||||
// var cityExpected = $"city-{Guid.NewGuid()}";
|
// var cityExpected = $"city-{Guid.NewGuid()}";
|
||||||
// var orderStatusExpected = "submited";
|
// var orderStatusExpected = "submitted";
|
||||||
|
|
||||||
// var basketClient = basketServer.CreateIdempotentClient();
|
// var basketClient = basketServer.CreateIdempotentClient();
|
||||||
// var orderClient = orderServer.CreateIdempotentClient();
|
// var orderClient = orderServer.CreateIdempotentClient();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user