Gate prebuilt deck purchases on IsAvailableInShop flag
- Add IsAvailableInShop to the buy query so decks not marked for sale cannot be purchased directly by ID (store listing already filtered this, but the buy endpoint did not) - Remove the unconditional starter-deck block; IsAvailableInShop is now the single gate — if an admin explicitly marks a starter deck as available in shop it can be purchased like any other deck Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -41,7 +41,7 @@ internal sealed class BazaarBuyPrebuiltDeckHandler : BazaarHandlerBase, IMessage
|
||||
|
||||
var deck = await _bazaarDb.PrebuiltDecks
|
||||
.Include(d => d.Cards)
|
||||
.FirstOrDefaultAsync(d => d.Id == req.DeckId && d.IsActive
|
||||
.FirstOrDefaultAsync(d => d.Id == req.DeckId && d.IsActive && d.IsAvailableInShop
|
||||
&& (d.AvailableFrom == null || d.AvailableFrom <= now)
|
||||
&& (d.AvailableUntil == null || d.AvailableUntil >= now), ct);
|
||||
|
||||
@@ -49,11 +49,6 @@ internal sealed class BazaarBuyPrebuiltDeckHandler : BazaarHandlerBase, IMessage
|
||||
return ServerMessage.Error(message.Seq, "DECK_NOT_FOUND",
|
||||
"Prebuilt deck not found or not currently available.");
|
||||
|
||||
// Starter decks are handled by collection.select_starter_deck; not purchasable here.
|
||||
if (deck.IsStarterDeck)
|
||||
return ServerMessage.Error(message.Seq, "STARTER_DECK",
|
||||
"Starter decks must be selected during onboarding, not purchased.");
|
||||
|
||||
// ── Debit ─────────────────────────────────────────────────────────────
|
||||
var debited = await TryDebitOriginPointsAsync(_identityDb, accountId, deck.OriginPointPrice, ct);
|
||||
if (!debited)
|
||||
|
||||
Reference in New Issue
Block a user