Browse Source

Added log once consuming the cancelling event

Removed the business logic and added the log to improve it in the future
pull/92/head
malik masis 5 years ago
parent
commit
cd6b3962a1
  1. 1
      services/payment/src/EShopOnAbp.PaymentService.Domain/EShopOnAbp.PaymentService.Domain.csproj
  2. 6
      services/payment/src/EShopOnAbp.PaymentService.Domain/EventHandlers/OrderCancelledEventHandler.cs

1
services/payment/src/EShopOnAbp.PaymentService.Domain/EShopOnAbp.PaymentService.Domain.csproj

@ -14,6 +14,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\ordering\src\EShopOnAbp.OrderingService.Domain.Shared\EShopOnAbp.OrderingService.Domain.Shared.csproj" />
<ProjectReference Include="..\..\..\..\shared\EShopOnAbp.Shared.Hosting\EShopOnAbp.Shared.Hosting.csproj" />
</ItemGroup>
</Project>

6
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}");
}
}
}

Loading…
Cancel
Save