Пример #1
0
        public string[] UploadSelfHostedImages(PhotoDisplayCodeType photoDisplay, string[] pictureFileList)
        {
            var service    = EbayServiceContext(ServiceCallType.UploadSiteHostedPictures);
            var request    = new UploadSiteHostedPicturesRequestType();
            var arrayLists = new ArrayList();
            var strArrays  = pictureFileList;

            foreach (var str in strArrays)
            {
                if (photoDisplay == PhotoDisplayCodeType.PicturePack || photoDisplay == PhotoDisplayCodeType.SuperSize)
                {
                    request.PictureSet = PictureSetCodeType.Supersize;
                }

                request.PictureName        = str;
                request.PictureData        = new Base64BinaryType();
                request.ExternalPictureURL = pictureFileList;

                SetupRequestType <UploadSiteHostedPicturesRequestType>(request);
                var credentials = Properties.EbayCredentials;
                var apicall     = service.UploadSiteHostedPictures(ref credentials, request);
                arrayLists.Add(apicall.SiteHostedPictureDetails.FullURL);
                if (apicall.Errors == null)
                {
                    continue;
                }
                foreach (var e in apicall.Errors.ToArray())
                {
                    _logger.WriteToLog(e, EventLogEntryType.Error);
                }
            }

            return((string[])arrayLists.ToArray(typeof(string)));
        }
Пример #2
0
        /// <summary>
        /// Returns the order information for the listed orderIDS
        /// </summary>
        /// <param name="orderIds"></param>
        /// <returns></returns>
        public GetOrdersResponseType GetOrderDetails(string[] orderIds)
        {
            var service = EbayServiceContext(ServiceCallType.GetOrders);
            var request = new GetOrdersRequestType
            {
                OrderIDArray = orderIds
            };

            SetupRequestType <GetOrdersRequestType>(request);
            var credentials = Properties.EbayCredentials;
            var apicall     = service.GetOrders(ref credentials, request);

            if (apicall.Errors != null)
            {
                foreach (var e in apicall.Errors.ToArray())
                {
                    _logger.WriteToLog(e, EventLogEntryType.Error);
                }
            }
            if ((apicall.Ack == AckCodeType.Success || apicall.Ack == AckCodeType.Warning))
            {
                return(apicall);
            }
            return(null);
        }
Пример #3
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);
        }
Пример #4
0
        /// <summary>
        /// Submit an update to an Item
        /// </summary>
        /// <param name="request">Request construct to submit</param>
        /// <returns></returns>
        public bool UpdateListing(EbayListingUpdateRequest request)
        {
            var service = EbayServiceContext(ServiceCallType.CompleteSale);
            var req     = request.RequestType;

            SetupRequestType <CompleteSaleRequestType>(req);
            var credentials = Properties.EbayCredentials;
            var apicall     = service.CompleteSale(ref credentials, req);

            if (apicall.Errors == null)
            {
                return(apicall.Ack == AckCodeType.Success || apicall.Ack == AckCodeType.Warning);
            }
            foreach (var e in apicall.Errors.ToArray())
            {
                _logger.WriteToLog(e, EventLogEntryType.Error);
            }
            return(apicall.Ack == AckCodeType.Success || apicall.Ack == AckCodeType.Warning);
        }