diff --git a/DysonNetwork.Pass/Startup/BroadcastEventHandler.cs b/DysonNetwork.Pass/Startup/BroadcastEventHandler.cs index 333ced1..a885809 100644 --- a/DysonNetwork.Pass/Startup/BroadcastEventHandler.cs +++ b/DysonNetwork.Pass/Startup/BroadcastEventHandler.cs @@ -39,6 +39,7 @@ public class BroadcastEventHandler( if (order is null) { logger.LogWarning("Order with ID {OrderId} not found.", evt.OrderId); + await nats.PublishAsync(PaymentOrderEventBase.Type, msg.Data, cancellationToken: stoppingToken); continue; } @@ -49,6 +50,7 @@ public class BroadcastEventHandler( catch (Exception ex) { logger.LogError(ex, "Error processing payment order event for order {OrderId}", evt?.OrderId); + await nats.PublishAsync(PaymentOrderEventBase.Type, msg.Data, cancellationToken: stoppingToken); } } } diff --git a/DysonNetwork.Pass/Wallet/OrderController.cs b/DysonNetwork.Pass/Wallet/OrderController.cs index 6444394..089b6fb 100644 --- a/DysonNetwork.Pass/Wallet/OrderController.cs +++ b/DysonNetwork.Pass/Wallet/OrderController.cs @@ -24,8 +24,7 @@ public class OrderController(PaymentService payment, AuthService auth, AppDataba [Authorize] public async Task> PayOrder(Guid id, [FromBody] PayOrderRequest request) { - if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser || - HttpContext.Items["CurrentSession"] is not AuthSession currentSession) return Unauthorized(); + if (HttpContext.Items["CurrentUser"] is not Account.Account currentUser) return Unauthorized(); // Validate PIN code if (!await auth.ValidatePinCode(currentUser.Id, request.PinCode)) diff --git a/DysonNetwork.Pass/Wallet/PaymentService.cs b/DysonNetwork.Pass/Wallet/PaymentService.cs index d9813b6..a3b551c 100644 --- a/DysonNetwork.Pass/Wallet/PaymentService.cs +++ b/DysonNetwork.Pass/Wallet/PaymentService.cs @@ -282,7 +282,7 @@ public class PaymentService( await NotifyOrderPaid(order, payerWallet, order.PayeeWallet); - await nats.PublishAsync(PaymentOrderEvent.Type, JsonSerializer.SerializeToUtf8Bytes(new PaymentOrderEvent + await nats.PublishAsync(PaymentOrderEventBase.Type, JsonSerializer.SerializeToUtf8Bytes(new PaymentOrderEvent { OrderId = order.Id, WalletId = payerWallet.Id, diff --git a/DysonNetwork.Pass/Wallet/SubscriptionService.cs b/DysonNetwork.Pass/Wallet/SubscriptionService.cs index 8f5747e..77b0154 100644 --- a/DysonNetwork.Pass/Wallet/SubscriptionService.cs +++ b/DysonNetwork.Pass/Wallet/SubscriptionService.cs @@ -229,8 +229,6 @@ public class SubscriptionService( return subscription; } - public const string SubscriptionOrderIdentifier = "solian.subscription.order"; - /// /// Creates a subscription order for an unpaid or expired subscription. /// If the subscription is active, it will extend its expiration date. diff --git a/DysonNetwork.Sphere/Startup/BroadcastEventHandler.cs b/DysonNetwork.Sphere/Startup/BroadcastEventHandler.cs index 583294b..a74e11f 100644 --- a/DysonNetwork.Sphere/Startup/BroadcastEventHandler.cs +++ b/DysonNetwork.Sphere/Startup/BroadcastEventHandler.cs @@ -63,11 +63,15 @@ public class BroadcastEventHandler( break; } + default: + await nats.PublishAsync(PaymentOrderEventBase.Type, msg.Data, cancellationToken: stoppingToken); + break; } } catch (Exception ex) { logger.LogError(ex, "Error processing payment order event for order {OrderId}", evt?.OrderId); + await nats.PublishAsync(PaymentOrderEventBase.Type, msg.Data, cancellationToken: stoppingToken); } }