From cd6b3962a1dc5c3c042cb817895be2ef15ea6e6b Mon Sep 17 00:00:00 2001 From: malik masis Date: Wed, 16 Mar 2022 10:25:01 +0300 Subject: [PATCH] Added log once consuming the cancelling event Removed the business logic and added the log to improve it in the future --- .../EShopOnAbp.PaymentService.Domain.csproj | 1 + .../EventHandlers/OrderCancelledEventHandler.cs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/services/payment/src/EShopOnAbp.PaymentService.Domain/EShopOnAbp.PaymentService.Domain.csproj b/services/payment/src/EShopOnAbp.PaymentService.Domain/EShopOnAbp.PaymentService.Domain.csproj index a1af97d7..c87f3bb4 100644 --- a/services/payment/src/EShopOnAbp.PaymentService.Domain/EShopOnAbp.PaymentService.Domain.csproj +++ b/services/payment/src/EShopOnAbp.PaymentService.Domain/EShopOnAbp.PaymentService.Domain.csproj @@ -14,6 +14,7 @@ + diff --git a/services/payment/src/EShopOnAbp.PaymentService.Domain/EventHandlers/OrderCancelledEventHandler.cs b/services/payment/src/EShopOnAbp.PaymentService.Domain/EventHandlers/OrderCancelledEventHandler.cs index 9f1d781f..a4e3837c 100644 --- a/services/payment/src/EShopOnAbp.PaymentService.Domain/EventHandlers/OrderCancelledEventHandler.cs +++ b/services/payment/src/EShopOnAbp.PaymentService.Domain/EventHandlers/OrderCancelledEventHandler.cs @@ -1,9 +1,10 @@ using EShopOnAbp.OrderingService.Orders; using EShopOnAbp.PaymentService.PaymentRequests; +using Serilog; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.EventBus.Distributed; -using Volo.Abp.Uow; + namespace EShopOnAbp.PaymentService.EventHandlers { @@ -16,11 +17,10 @@ namespace EShopOnAbp.PaymentService.EventHandlers _paymentRepository = paymenRepository; } - [UnitOfWork] public async Task HandleEventAsync(OrderCancelledEto eventData) { var payment = await _paymentRepository.GetAsync(eventData.Buyer.BuyerId.GetValueOrDefault()); - await _paymentRepository.DeleteAsync(payment); + Log.Information($"Cancelled the order: {payment.OrderId} payment:{payment.Id}"); } } }