8 changed files with 98 additions and 8 deletions
@ -1,7 +1,11 @@ |
|||
namespace EShopOnAbp.OrderingService.Orders |
|||
using System; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Orders |
|||
{ |
|||
public class UpdateOrderDto |
|||
{ |
|||
public int OrderStatusId { get; set; } |
|||
public Guid PaymentRequestId { get; set; } |
|||
public string PaymentRequestStatus { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Volo.Abp.Domain.Entities.Events.Distributed; |
|||
using Volo.Abp.EventBus; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Orders; |
|||
|
|||
[EventName("EShopOnAbp.Order.Cancelled")] |
|||
public class OrderCancelledEto : EtoBase |
|||
{ |
|||
public Guid OrderId { get; set; } |
|||
public int OrderNo { get; set; } |
|||
public DateTime OrderDate { get; set; } |
|||
public BuyerEto Buyer { get; set; } |
|||
public List<OrderItemEto> Items { get; set; } = new(); |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
using EShopOnAbp.OrderingService.Orders; |
|||
using EShopOnAbp.PaymentService.PaymentRequests; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.EventBus.Distributed; |
|||
using Volo.Abp.Uow; |
|||
|
|||
namespace EShopOnAbp.PaymentService.EventHandlers |
|||
{ |
|||
public class OrderCancelledEventHandler : IDistributedEventHandler<OrderCancelledEto>, ITransientDependency |
|||
{ |
|||
private readonly IPaymentRequestRepository _paymentRepository; |
|||
|
|||
public OrderCancelledEventHandler(IPaymentRequestRepository paymenRepository) |
|||
{ |
|||
_paymentRepository = paymenRepository; |
|||
} |
|||
|
|||
[UnitOfWork] |
|||
public async Task HandleEventAsync(OrderCancelledEto eventData) |
|||
{ |
|||
var payment = await _paymentRepository.GetAsync(eventData.Buyer.BuyerId.GetValueOrDefault()); |
|||
await _paymentRepository.DeleteAsync(payment); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue