🐛 Optimize order handling

This commit is contained in:
2025-09-09 00:51:51 +08:00
parent 8308325b73
commit 74f51036b1
5 changed files with 8 additions and 5 deletions

View File

@@ -24,8 +24,7 @@ public class OrderController(PaymentService payment, AuthService auth, AppDataba
[Authorize]
public async Task<ActionResult<Order>> 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))

View File

@@ -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,

View File

@@ -229,8 +229,6 @@ public class SubscriptionService(
return subscription;
}
public const string SubscriptionOrderIdentifier = "solian.subscription.order";
/// <summary>
/// Creates a subscription order for an unpaid or expired subscription.
/// If the subscription is active, it will extend its expiration date.