fix(gift): wire reward_type is UserGoodsType integer, not legacy 1/4/9 encoding

Replace WireRewardTypeToUserGoodsType switch with a validating identity cast backed
by GiftRewardTypes.IsSupported. Wire type 1 is RedEther (UserGoodsType.RedEther),
not Crystal (UserGoodsType.Crystal=2); the old switch silently granted the wrong
wallet for every tutorial-completion claim. Update all 5 GiftControllerTests assertions
and 1 TutorialFlowEndToEndTests assertion to expect RedEther instead of Crystals.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-09 20:45:49 -04:00
parent 366a71688d
commit b2a5b69423
3 changed files with 24 additions and 21 deletions

View File

@@ -85,7 +85,8 @@ public class TutorialFlowEndToEndTests
Assert.That(receiveResp.StatusCode, Is.EqualTo(HttpStatusCode.OK));
var midCurrency = await factory.GetViewerCurrencyAsync(viewerId);
Assert.That(midCurrency.Crystals - preCurrency.Crystals, Is.EqualTo(400UL));
// Tutorial gift 71478626 has reward_type=1 — that's RedEther per UserGoods.Type, not Crystal.
Assert.That(midCurrency.RedEther - preCurrency.RedEther, Is.EqualTo(400UL));
Assert.That(midCurrency.Rupees - preCurrency.Rupees, Is.EqualTo(100UL));
// gift_receive should also have advanced the tutorial step to 41 server-side.