Fixed event service scope issue #58

Merged
khwezi merged 1 commits from payments into master 2026-06-01 23:33:12 +02:00
@@ -3,10 +3,13 @@ using LiteCharms.Features.MidrandBooks.Orders;
namespace LiteCharms.Features.MidrandBooks.Payments.Events.Handlers;
public sealed class PayfastPaymentConfirmationReceivedEventHandler(PaymentService paymentService,
HashService hashService, OrderService orderService, ILogger<PayfastPaymentConfirmationReceivedEvent> logger) :
public sealed class PayfastPaymentConfirmationReceivedEventHandler(IServiceProvider services, ILogger<PayfastPaymentConfirmationReceivedEvent> logger) :
INotificationHandler<PayfastPaymentConfirmationReceivedEvent>
{
private readonly PaymentService paymentService = services.GetRequiredService<PaymentService>();
private readonly OrderService orderService = services.GetRequiredService<OrderService>();
private readonly HashService hashService = services.GetRequiredService<HashService>();
public async ValueTask Handle(PayfastPaymentConfirmationReceivedEvent notification, CancellationToken cancellationToken)
{
var hashResult = hashService.DecodeLongIdHash(notification.Payload?.MPaymentId!);