예제 #1
0
        /// <summary>
        /// Returns the access key for the account once they have granted access
        /// </summary>
        /// <param name="secretKey">Guid ID that was passed when requesting access</param>
        /// <returns></returns>
        public string FetchAccessToken(Guid secretKey)
        {
            var service = EbayServiceContext(ServiceCallType.FetchToken);
            var r       = new FetchTokenRequest
            {
                RequesterCredentials = Properties.EbayCredentials
            };

            var rt = new FetchTokenRequestType {
                Version = Properties.ServiceVersion, SecretID = secretKey.ToString()
            };

            var res = service.FetchToken(ref r.RequesterCredentials, rt);

            if (res.Errors == null)
            {
                return(res.Ack != AckCodeType.Success ? string.Empty : res.Any.First().InnerText);
            }
            foreach (var e in res.Errors)
            {
                _logger.WriteToLog(e, EventLogEntryType.Error);
            }

            return(res.Ack != AckCodeType.Success ? string.Empty : res.Any.First().InnerText);
        }
예제 #2
0
        public TokenData FetchToken()
        {
            string callname = "FetchToken";

            this.BuildService(callname);

            FetchTokenRequestType request = new FetchTokenRequestType();
            request.Version = _version;

            request.SessionID = this._currentSessionID;

            FetchTokenResponseType response = this.service.FetchToken(request);

            if (response.Ack != AckCodeType.Success)
            {
                string error = "";

                foreach (ErrorType err in response.Errors) error+= err.LongMessage;

                throw new Exception(error);
            }

            TokenData token = new TokenData();

            token.ExpirationDate = ServiceTimeZone.eBayDateTimeToUniversal(response.HardExpirationTime);
            token.Token = response.eBayAuthToken;

            return (token);
        }
예제 #3
0
        public ResultInfoTikenInfo GenerateToken(ServiceProviderDataInfoSessionId sesionId)
        {
            var req = new FetchTokenRequestType();

            req.SessionID   = sesionId.Value;
            req.DetailLevel = new[] { DetailLevelCodeType.ReturnAll };

            var rez = base.GetServiceData(Service.FetchToken, req);

            return(new ResultInfoTikenInfo(rez));
        }
예제 #4
0
        /// <summary>
        /// Returns the access key for the account once they have granted access
        /// </summary>
        /// <param name="secretKey">Guid ID that was passed when requesting access</param>
        /// <returns></returns>
        public string FetchAccessToken(Guid secretKey)
        {
            var service = EbayServiceContext(ServiceCallType.FetchToken);
            var r = new FetchTokenRequest
            {
                RequesterCredentials = Properties.EbayCredentials
            };

            var rt = new FetchTokenRequestType { Version = Properties.ServiceVersion, SecretID = secretKey.ToString() };

            var res = service.FetchToken(ref r.RequesterCredentials, rt);
            if (res.Errors == null) return res.Ack != AckCodeType.Success ? string.Empty : res.Any.First().InnerText;
            foreach (var e in res.Errors)
            {
                _logger.WriteToLog(e, EventLogEntryType.Error);
            }

            return res.Ack != AckCodeType.Success ? string.Empty : res.Any.First().InnerText;
        }
    public string FetchToken(string SessionID)
    {
        string callname = "FetchToken";

        #region Initialise Needed Variables

        //Get the Server to use (Sandbox or Production)
        string serverUrl = ConfigurationManager.AppSettings["TradingService"];

        //SiteID = 0  (US) - UK = 3, Canada = 2, Australia = 15, ....
        //string siteID = "0";

        eBayAPIInterfaceService service = new eBayAPIInterfaceService();
        string requestURL = serverUrl + "?callname=" + callname + "&siteid=" + siteID
                            + "&appid=" + AppID + "&version=" + version + "&routing=default";
        service.Url = requestURL;

        // Set credentials
        service.RequesterCredentials = new CustomSecurityHeaderType();
        service.RequesterCredentials.Credentials = new UserIdPasswordType();
        service.RequesterCredentials.Credentials.AppId = AppID;
        service.RequesterCredentials.Credentials.DevId = DevID;
        service.RequesterCredentials.Credentials.AuthCert = CertID;
        #endregion

        FetchTokenRequestType request = new FetchTokenRequestType();
        request.SessionID = SessionID;
        request.Version = version;
        FetchTokenResponseType response = service.FetchToken(request);
        return response.eBayAuthToken;
    }
예제 #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="ApiContext">The <see cref="ApiCall.ApiContext"/> for this API Call of type <see cref="ApiContext"/>.</param>
 public FetchTokenCall(ApiContext ApiContext)
 {
     ApiRequest      = new FetchTokenRequestType();
     this.ApiContext = ApiContext;
 }
예제 #7
0
 /// <summary>
 ///
 /// </summary>
 public FetchTokenCall()
 {
     ApiRequest = new FetchTokenRequestType();
 }
예제 #8
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="ApiContext">The <see cref="ApiCall.ApiContext"/> for this API Call of type <see cref="ApiContext"/>.</param>
		public FetchTokenCall(ApiContext ApiContext)
		{
			ApiRequest = new FetchTokenRequestType();
			this.ApiContext = ApiContext;
		}
예제 #9
0
		/// <summary>
		/// 
		/// </summary>
		public FetchTokenCall()
		{
			ApiRequest = new FetchTokenRequestType();
		}