From 78c21c7b29d366edaf7878a9d92b478a5e26cff2 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Mon, 28 Sep 2020 01:27:27 +0300 Subject: [PATCH] Fix wallet code redeeming (#1993) * Fix wallet code redeeming * Remove trailing slash --- ArchiSteamFarm/ArchiWebHandler.cs | 32 ++----------------------------- ArchiSteamFarm/Json/Steam.cs | 14 -------------- 2 files changed, 2 insertions(+), 44 deletions(-) diff --git a/ArchiSteamFarm/ArchiWebHandler.cs b/ArchiSteamFarm/ArchiWebHandler.cs index 632c832a9..8b3b4ec10 100644 --- a/ArchiSteamFarm/ArchiWebHandler.cs +++ b/ArchiSteamFarm/ArchiWebHandler.cs @@ -2131,7 +2131,7 @@ namespace ArchiSteamFarm { return null; } - const string requestValidateCode = "/account/validatewalletcode"; + const string requestValidateCode = "/account/ajaxredeemwalletcode"; // Extra entry for sessionID Dictionary data = new Dictionary(2, StringComparer.Ordinal) { { "wallet_code", key } }; @@ -2147,35 +2147,7 @@ namespace ArchiSteamFarm { return (responseValidateCode.Content.Result == EResult.OK ? EResult.Fail : responseValidateCode.Content.Result, responseValidateCode.Content.PurchaseResultDetail); } - if (responseValidateCode.Content.KeyDetails == null) { - Bot.ArchiLogger.LogNullError(nameof(responseValidateCode.Content.KeyDetails)); - - return null; - } - - if (responseValidateCode.Content.WalletCurrencyCode != responseValidateCode.Content.KeyDetails.CurrencyCode) { - const string requestCheckFunds = "/account/createwalletandcheckfunds"; - WebBrowser.ObjectResponse? responseCheckFunds = await UrlPostToJsonObjectWithSession(SteamStoreURL, requestCheckFunds, data: data).ConfigureAwait(false); - - if (responseCheckFunds?.Content == null) { - return null; - } - - if (responseCheckFunds.Content.Result != EResult.OK) { - return (responseCheckFunds.Content.Result, null); - } - } - - const string requestConfirmRedeem = "/account/confirmredeemwalletcode"; - - WebBrowser.ObjectResponse? responseConfirmRedeem = await UrlPostToJsonObjectWithSession(SteamStoreURL, requestConfirmRedeem, data: data).ConfigureAwait(false); - - if (responseConfirmRedeem?.Content == null) { - return null; - } - - // Same, returning OK EResult only if PurchaseResultDetail is NoDetail (no error occured) - return ((responseConfirmRedeem.Content.PurchaseResultDetail == EPurchaseResultDetail.NoDetail) && (responseConfirmRedeem.Content.Result == EResult.OK) ? responseConfirmRedeem.Content.Result : EResult.Fail, responseConfirmRedeem.Content.PurchaseResultDetail); + return (EResult.OK, EPurchaseResultDetail.NoDetail); } internal async Task UnpackBooster(uint appID, ulong itemID) { diff --git a/ArchiSteamFarm/Json/Steam.cs b/ArchiSteamFarm/Json/Steam.cs index 3c85d2301..040ac61c4 100644 --- a/ArchiSteamFarm/Json/Steam.cs +++ b/ArchiSteamFarm/Json/Steam.cs @@ -610,25 +610,11 @@ namespace ArchiSteamFarm.Json { [SuppressMessage("ReSharper", "ClassCannotBeInstantiated")] internal sealed class RedeemWalletResponse : EResultResponse { - [JsonProperty(PropertyName = "wallet", Required = Required.DisallowNull)] - internal readonly InternalKeyDetails? KeyDetails; - [JsonProperty(PropertyName = "detail", Required = Required.DisallowNull)] internal readonly EPurchaseResultDetail? PurchaseResultDetail; - [JsonProperty(PropertyName = "currency", Required = Required.DisallowNull)] - internal readonly ECurrencyCode? WalletCurrencyCode; - [JsonConstructor] private RedeemWalletResponse() { } - - internal sealed class InternalKeyDetails { - [JsonProperty(PropertyName = "currencycode", Required = Required.Always)] - internal readonly ECurrencyCode CurrencyCode; - - [JsonConstructor] - private InternalKeyDetails() { } - } } [SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]