zeroframework/Services/DeviceCenter/ZeroFramework.DeviceCenter.Application/IntegrationEvents/EventHandling/Ordering/OrderPaymentSucceededIntegrationEventHandler.cs
2023-12-05 17:22:48 +08:00

18 lines
790 B
C#

using MediatR;
using ZeroFramework.DeviceCenter.Application.Commands.Ordering;
using ZeroFramework.DeviceCenter.Application.IntegrationEvents.Events.Ordering;
using ZeroFramework.EventBus.Abstractions;
namespace ZeroFramework.DeviceCenter.Application.IntegrationEvents.EventHandling.Ordering
{
public class OrderPaymentSucceededIntegrationEventHandler(IMediator mediator) : IIntegrationEventHandler<OrderPaymentSucceededIntegrationEvent>
{
private readonly IMediator _mediator = mediator ?? throw new ArgumentNullException(nameof(mediator));
public async Task HandleAsync(OrderPaymentSucceededIntegrationEvent @event)
{
var command = new SetPaidOrderStatusCommand(@event.OrderId);
await _mediator.Send(command);
}
}
}