Ejemplo n.º 1
0
        private void getTokenStatus()
        {
            try
            {
                if (!validateApiAccount(Context))
                {
                    MessageBox.Show("Pleasse fill in Api Account first.");
                    return;
                }

                GetTokenStatusCall gtsc = new GetTokenStatusCall(Context);
                TokenStatusType    tst  = gtsc.GetTokenStatus();
                textBox1.Text = tst.Status.ToString();
                textBox2.Text = tst.EIASToken;
                textBox3.Text = tst.ExpirationTime.ToString();
                if (tst.Status == TokenStatusCodeType.RevokedByApp ||
                    tst.Status == TokenStatusCodeType.RevokedByeBay ||
                    tst.Status == TokenStatusCodeType.RevokedByUser)
                {
                    textBox4.Enabled = true;
                    textBox4.Text    = tst.RevocationTime.ToString();
                }
                else
                {
                    textBox4.Enabled = false;
                    textBox4.Text    = "";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Checks the token validity.
        /// </summary>
        /// <param name="token">The token.</param>
        /// <returns></returns>
        public Task <bool> CheckTokenValidity(string token)
        {
            GetTokenStatusCall tokenStatusCall = new GetTokenStatusCall(GetContext(token));

            return(Task.Run(() => {
                TokenStatusType tokenStatus = tokenStatusCall.GetTokenStatus();
                if (tokenStatus.StatusSpecified && tokenStatus.Status == TokenStatusCodeType.Active)
                {
                    return true;
                }
                return false;
            }));
        }
Ejemplo n.º 3
0
        public EbayServiceResponse <TokenStatusType> GetTokenStatus(string token)
        {
            var apiContext = CreateApiContext(apiServerUrl, ruName, appId, devId, certId, token);
            var result     = new EbayServiceResponse <TokenStatusType>();

            try
            {
                var apiCall = new GetTokenStatusCall(apiContext);
                result.Result = apiCall.GetTokenStatus();
            }
            catch (Exception ex)
            {
                result.Error = ex.Message;
            }
            return(result);
        }
Ejemplo n.º 4
0
        public EbayServiceResponse <bool> IsValidToken(string token)
        {
            var apiContext = CreateApiContext(apiServerUrl, ruName, appId, devId, certId, token);
            var result     = new EbayServiceResponse <bool>();

            try
            {
                apiContext.ApiCredential.eBayToken = token;
                var apiCall = new GetTokenStatusCall(apiContext);
                result.Result = apiCall.GetTokenStatus().ExpirationTime > DateTime.UtcNow;
            }
            catch (Exception ex)
            {
                result.Error = ex.Message;
            }
            return(result);
        }