Rename OrderingIntegrationEvent service methods
Remove clean basket instruction from SPA client
This commit is contained in:
parent
393b47fa93
commit
00f7226f30
@ -39,11 +39,11 @@ namespace Ordering.API.Application.DomainEventHandlers.BuyerAndPaymentMethodVeri
|
||||
// Using a local transaction to achieve atomicity between original Ordering database operation and
|
||||
// the IntegrationEventLog. Only saving event if order has been successfully persisted to db
|
||||
await _orderingIntegrationEventService
|
||||
.SaveEventAsync(orderStartedIntegrationEvent);
|
||||
.SaveEventAndOrderingContextChangesAsync(orderStartedIntegrationEvent);
|
||||
|
||||
// Publish ordering integration event and mark it as published
|
||||
await _orderingIntegrationEventService
|
||||
.PublishAsync(orderStartedIntegrationEvent);
|
||||
.PublishThroughEventBusAsync(orderStartedIntegrationEvent);
|
||||
|
||||
_logger.CreateLogger(nameof(UpdateOrderWhenBuyerAndPaymentMethodVerifiedDomainEventHandler))
|
||||
.LogTrace($"Order with Id: {buyerPaymentMethodVerifiedEvent.OrderId} has been successfully updated with a payment method id: { buyerPaymentMethodVerifiedEvent.Payment.Id }");
|
||||
|
@ -8,7 +8,7 @@ namespace Ordering.API.IntegrationEvents
|
||||
{
|
||||
public interface IOrderingIntegrationEventService
|
||||
{
|
||||
Task SaveEventAsync(IntegrationEvent evt);
|
||||
Task PublishAsync(IntegrationEvent evt);
|
||||
Task SaveEventAndOrderingContextChangesAsync(IntegrationEvent evt);
|
||||
Task PublishThroughEventBusAsync(IntegrationEvent evt);
|
||||
}
|
||||
}
|
||||
|
@ -28,13 +28,13 @@ namespace Ordering.API.IntegrationEvents
|
||||
_eventLogService = _integrationEventLogServiceFactory(_orderingContext.Database.GetDbConnection());
|
||||
}
|
||||
|
||||
public async Task PublishAsync(IntegrationEvent evt)
|
||||
public async Task PublishThroughEventBusAsync(IntegrationEvent evt)
|
||||
{
|
||||
_eventBus.Publish(evt);
|
||||
await _eventLogService.MarkEventAsPublishedAsync(evt);
|
||||
}
|
||||
|
||||
public async Task SaveEventAsync(IntegrationEvent evt)
|
||||
public async Task SaveEventAndOrderingContextChangesAsync(IntegrationEvent evt)
|
||||
{
|
||||
//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
|
||||
|
@ -18,7 +18,7 @@ export class OrdersNewComponent implements OnInit {
|
||||
private errorReceived: Boolean;
|
||||
private order: IOrder;
|
||||
|
||||
constructor(private service: OrdersService, fb: FormBuilder, private router: Router, private basketEvents: BasketWrapperService) {
|
||||
constructor(private service: OrdersService, fb: FormBuilder, private router: Router) {
|
||||
// Obtain user profile information
|
||||
this.order = service.mapBasketAndIdentityInfoNewOrder();
|
||||
this.newOrderForm = fb.group({
|
||||
@ -54,10 +54,7 @@ export class OrdersNewComponent implements OnInit {
|
||||
return Observable.throw(errMessage);
|
||||
})
|
||||
.subscribe(res => {
|
||||
// this will emit an observable. Basket service is subscribed to this observable, and will react deleting the basket for the current user.
|
||||
this.basketEvents.orderCreated();
|
||||
|
||||
this.router.navigate(['orders']);
|
||||
this.router.navigate(['orders']);
|
||||
});
|
||||
this.errorReceived = false;
|
||||
this.isOrderProcessing = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user