public static string GetAccountStatusCode(GuestApiErrorCollection error, string currentStatusCode)
        {
            IRefreshGuestControllerTokenError guestControllerTokenRefreshError = GetGuestControllerTokenRefreshError(error);

            if (guestControllerTokenRefreshError is IRefreshParentalConsentError)
            {
                if (currentStatusCode == "ACTIVE")
                {
                    return("AWAIT_PARENT_CONSENT");
                }
            }
            else if (currentStatusCode == "AWAIT_PARENT_CONSENT")
            {
                return("ACTIVE");
            }
            return(currentStatusCode);
        }
        private QueueItem CreateRefreshQueueItem(Action <GuestControllerResult <RefreshResponse> > callback)
        {
            Action <GuestControllerResult <RefreshResponse> > failureCallback = delegate(GuestControllerResult <RefreshResponse> r)
            {
                callback(new GuestControllerResult <RefreshResponse>(success: false, r.Response, r.ResponseHeaders));
            };
            QueueItem queueItem = CreateQueueItem("/client/{client-id}/guest/refresh-auth/{refresh-token}", HttpMethod.POST, new EmptyRequest(), GuestControllerAuthenticationType.None, delegate(GuestControllerResult <RefreshResponse> r)
            {
                if (!r.Success)
                {
                    AuthenticationUnavailableEventArgs e = new AuthenticationUnavailableEventArgs();
                    this.OnAuthenticationLost(this, e);
                    failureCallback(r);
                }
                else
                {
                    GuestApiErrorCollection guestApiErrorCollection = r.Response.error;
                    RefreshData data = r.Response.data;
                    IRefreshGuestControllerTokenError refreshGuestControllerTokenError = GuestControllerErrorParser.GetGuestControllerTokenRefreshError(guestApiErrorCollection);
                    if (refreshGuestControllerTokenError is IRefreshRequiresLegalMarketingUpdateError)
                    {
                        refreshGuestControllerTokenError = null;
                        guestApiErrorCollection          = null;
                        this.OnLegalMarketingUpdateRequired(this, new LegalMarketingUpdateRequiredEventArgs());
                    }
                    if (refreshGuestControllerTokenError is IRefreshTokenGatedLocationError)
                    {
                        logger.Critical("Location gated during Guest Controller token refresh");
                        AuthenticationLostGatedCountryEventArgs e2 = new AuthenticationLostGatedCountryEventArgs();
                        this.OnAuthenticationLost(this, e2);
                        failureCallback(r);
                    }
                    else if (refreshGuestControllerTokenError is IRefreshProfileDisabledError || refreshGuestControllerTokenError is IRefreshTemporaryBanError)
                    {
                        logger.Critical("Banned during Guest Controller token refresh");
                        AccountBannedEventArgs e3 = new AccountBannedEventArgs(logger, null);
                        this.OnAuthenticationLost(this, e3);
                        failureCallback(r);
                    }
                    else if (refreshGuestControllerTokenError != null)
                    {
                        logger.Critical("Guest Controller token refresh error: " + refreshGuestControllerTokenError);
                        AuthenticationRevokedEventArgs e4 = new AuthenticationRevokedEventArgs();
                        this.OnAuthenticationLost(this, e4);
                        failureCallback(r);
                    }
                    else if (guestApiErrorCollection != null)
                    {
                        logger.Critical("Unhandled error during Guest Controller token refresh: " + JsonParser.ToJson(guestApiErrorCollection));
                        AuthenticationUnavailableEventArgs e = new AuthenticationUnavailableEventArgs();
                        this.OnAuthenticationLost(this, e);
                        failureCallback(r);
                    }
                    else if (data == null || data.token == null || data.token.access_token == null || data.token.refresh_token == null)
                    {
                        logger.Critical("Refreshing Guest Controller token returned invalid refresh data: " + JsonParser.ToJson(data));
                        AuthenticationUnavailableEventArgs e = new AuthenticationUnavailableEventArgs();
                        this.OnAuthenticationLost(this, e);
                        failureCallback(r);
                    }
                    else
                    {
                        Token token = data.token;
                        database.UpdateGuestControllerToken(token, data.etag);
                        this.OnAccessTokenChanged(this, new GuestControllerAccessTokenChangedEventArgs(token.access_token));
                        callback(r);
                    }
                }
            });

            queueItem.RefreshedAccessToken = true;
            return(queueItem);
        }