Inheritance: IParseble
Exemplo n.º 1
0
        private void JWTValidation(string message, Action <XsollaUser, ErrorDescription> onFinishValidate = null)
        {
            string token = ParseToken(message);

            if (!string.IsNullOrEmpty(token))
            {
                ValidateToken(token, (status, recievedMessage) =>
                {
                    ErrorDescription error = CheckForErrors(status, recievedMessage, CheckTokenError);
                    XsollaUser xsollaUser  = new XsollaUser();
                    if (error == null)
                    {
                        xsollaUser = JsonUtility.FromJson <TokenJson>(recievedMessage).token_payload;
                        PlayerPrefs.SetString(XsollaConstants.Prefs_TokenExp, xsollaUser.exp);
                    }
                    if (onFinishValidate != null)
                    {
                        onFinishValidate.Invoke(xsollaUser, error);
                    }
                });
            }
            else if (onFinishValidate != null)
            {
                onFinishValidate.Invoke(new XsollaUser(), new ErrorDescription(string.Empty, "Can't parse token", Error.InvalidToken));
            }
        }
Exemplo n.º 2
0
        public IParseble Parse(JSONNode utilsNode)
        {
            user         = new XsollaUser().Parse(utilsNode [XsollaApiConst.R_USER]) as XsollaUser;
            project      = new XsollaProject().Parse(utilsNode [XsollaApiConst.R_PROJECT]) as XsollaProject;
            purchase     = new XsollaPurchase().Parse(utilsNode [XsollaApiConst.R_PURCHASE]) as XsollaPurchase;
            settings     = new XsollaSettings().Parse(utilsNode [XsollaApiConst.R_SETTINGS]) as XsollaSettings;
            translations = new XsollaTranslations().Parse(utilsNode [XsollaApiConst.R_TRANSLATIONS]) as XsollaTranslations;
            api          = new XsollaApi().Parse(utilsNode [XsollaApiConst.R_API]) as XsollaApi;

            return(this);
        }
Exemplo n.º 3
0
        public IParseble Parse(JSONNode utilsNode)
        {
            accessToken 	= utilsNode [XsollaApiConst.ACCESS_TOKEN].Value;
            user 			= new XsollaUser ().Parse (utilsNode [XsollaApiConst.R_USER]) as XsollaUser;
            project 		= new XsollaProject ().Parse (utilsNode [XsollaApiConst.R_PROJECT]) as XsollaProject;
            purchase 		= new XsollaPurchase ().Parse (utilsNode [XsollaApiConst.R_PURCHASE]) as XsollaPurchase;
            settings 		= new XsollaSettings ().Parse (utilsNode [XsollaApiConst.R_SETTINGS]) as XsollaSettings;
            translations 	= new XsollaTranslations ().Parse (utilsNode [XsollaApiConst.R_TRANSLATIONS]) as XsollaTranslations;
            api 			= new XsollaApi ().Parse (utilsNode [XsollaApiConst.R_API]) as XsollaApi;

            return this;
        }
Exemplo n.º 4
0
        public IParseble Parse(JSONNode utilsNode)
        {
            accessToken  = utilsNode [XsollaApiConst.ACCESS_TOKEN].Value;
            user         = new XsollaUser().Parse(utilsNode [XsollaApiConst.R_USER]) as XsollaUser;
            project      = new XsollaProject().Parse(utilsNode [XsollaApiConst.R_PROJECT]) as XsollaProject;
            purchase     = new XsollaPurchase().Parse(utilsNode [XsollaApiConst.R_PURCHASE]) as XsollaPurchase;
            settings     = new XsollaSettings().Parse(utilsNode [XsollaApiConst.R_SETTINGS]) as XsollaSettings;
            translations = new XsollaTranslations().Parse(utilsNode [XsollaApiConst.R_TRANSLATIONS]) as XsollaTranslations;
            api          = new XsollaApi().Parse(utilsNode [XsollaApiConst.R_API]) as XsollaApi;
            mBonus       = new XsollaBonus().Parse(utilsNode["bonus"]) as XsollaBonus;

            return(this);
        }