private GetOrdersResponseType GetOrders(int?pageNumber, RequestsCounterData requestsCounter)
        {
            var req = new GetOrdersRequestType
            {
                CreateTimeFrom          = FromDate.ToUniversalTime(),
                CreateTimeFromSpecified = true,
                CreateTimeTo            = ToDate.ToUniversalTime(),
                CreateTimeToSpecified   = true,
                Pagination = new PaginationType
                {
                    EntriesPerPage          = 200,
                    EntriesPerPageSpecified = true,
                    PageNumber          = pageNumber.HasValue ? pageNumber.Value : 0,
                    PageNumberSpecified = pageNumber.HasValue
                }
            };

            req.DetailLevel                   = new[] { DetailLevelCodeType.ReturnAll };
            req.IncludeFinalValueFee          = true;
            req.IncludeFinalValueFeeSpecified = true;
            req.OrderRole            = TradingRoleCodeType.Seller;
            req.OrderRoleSpecified   = true;
            req.OrderStatus          = OrderStatusCodeType.All;
            req.OrderStatusSpecified = true;
            return(GetOrders(req, requestsCounter));
        }
Beispiel #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);
        }
Beispiel #3
0
        public OrderType[] DownloadNeweBayOrder(DateTime?fromTime, DateTime?toTime)
        {
            try
            {
                GetOrdersCall        getOrdersCall;
                GetOrdersRequestType getOrdersRequest;
                PaginationType       paging = new PaginationType();

                int totalPage;

                DetailLevelCodeTypeCollection detailLevelColl = new DetailLevelCodeTypeCollection();
                detailLevelColl.Add(DetailLevelCodeType.ReturnAll);

                List <OrderType> returnOrders = new List <OrderType>();
                foreach (var apiContext in _eBayAPIContextProvider.GetAPIContext())
                {
                    getOrdersCall              = new GetOrdersCall(apiContext);
                    getOrdersRequest           = new GetOrdersRequestType();
                    getOrdersRequest.OrderRole = TradingRoleCodeType.Seller;

                    getOrdersRequest.DetailLevel = detailLevelColl;
                    //var getOrderRequestDatetimeNow = DateTime.Now.AddMinutes(-2);
                    if (fromTime != null)
                    {
                        getOrdersRequest.CreateTimeFrom = ((DateTime)fromTime).ToUniversalTime();
                    }
                    if (toTime != null)
                    {
                        getOrdersRequest.CreateTimeTo = ((DateTime)toTime).ToUniversalTime();
                    }



                    int pageNumber = 1;
                    do
                    {
                        paging.EntriesPerPage       = 100;
                        paging.PageNumber           = pageNumber;
                        getOrdersRequest.Pagination = paging;
                        var getOrdersResponse = getOrdersCall.ExecuteRequest(getOrdersRequest) as GetOrdersResponseType;


                        if (getOrdersResponse.OrderArray != null && getOrdersResponse.OrderArray.Count > 0)
                        {
                            returnOrders.AddRange(getOrdersResponse.OrderArray.ToArray());
                        }

                        totalPage = getOrdersResponse.PaginationResult.TotalNumberOfPages;
                        pageNumber++;
                    } while (pageNumber <= totalPage);
                }

                return(returnOrders.ToArray());
            }
            catch (Exception ex)
            {
                return(default(OrderType[]));
            }
        }
Beispiel #4
0
        public static void GetNewOrders()
        {
            string endpoint = "https://api.sandbox.ebay.com/wsapi";
            string callName = "GetOrders";
            string siteId   = "2";
            string version  = "949";
            // Build the request URL
            string requestURL = endpoint
                                + "?callname=" + callName
                                + "&siteid=" + siteId
                                + "&appid=" + Settings.AppId
                                + "&version=" + version
                                + "&routing=default";
            // Create the service
            eBayAPIInterfaceService service = new eBayAPIInterfaceService();

            // Assign the request URL to the service locator.
            service.Url = requestURL;
            // Set credentials
            service.RequesterCredentials = new CustomSecurityHeaderType();
            service.RequesterCredentials.eBayAuthToken =
                "AgAAAA**AQAAAA**aAAAAA**Tz2NVg**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wFk4GhDpWLqA+dj6x9nY+seQ**kKoDAA**AAMAAA**1FzOBx5mSGbycTN2Pa7AffEQ8jbDk77g27juD4aFZeTrgQs94kRZY5Bjq1ifH088RviVP/9RZ0AVnK+qEfDi2M5uiDYT5fb1b8tJ+AaQjRfYG5I30M/rkUGolkTvwL4X9glOE147yCW5GGA8PG8SRZVjJ4myeO25v86TcJmmBmpHLbbN3V/7v6w4Gcovel1jB0QC6Ae5vDRTHt0N7SxSTTFFUQ4yQiLM5CpaVxa8Rp3mTxMS4DR5OEd0MTWyA7BlWsnN2TrLVFrYarrhKOE+6BS3lPdAdHMfB9uTl5JDR1d133zU+++P+VBLguWPO0EaGxs2sJ1NAwVHlEUslApdDIXH95XQIf0d8S+QOnmQ94lJ6eyjJfTqCyPjlFxCIA+9GzCbnOJjn1+LyrzD9zQrVPejuChy9qxYxikCoRUA0GrLLMsf77TBkNnKh5cgcyHvRG1NYeM596KEhvkvVEpKKr+ajC13SNkncl4wdvjV7AIpX+6UaGxbDjbuvGtLZU72qL1SmbZgOlp/UNFC/4bBG7aViG8+OK5UiI2dKI7wX2OuKEWy1fCOXSlUi8FwiaJCtIH4Lvj8cXYb0fhZ3ODPO+zenrK8XHXbau/4mA3YRwdPiLIuZjJUzUkaHEOQu4U5dBFz3YdK+S1K72nnBRmjuvS8LmNGSnUpf9fInLKP7o4CY9arWWTJqSmitlrYBXqfy70JsIaZNvpg6TamFAv3/TAaoFbgCsE1Um/PSY3C86ZEgy9QWrCwN7pvJs4SpW3I";
            // use your token
            service.RequesterCredentials.Credentials          = new UserIdPasswordType();
            service.RequesterCredentials.Credentials.AppId    = Settings.AppId;
            service.RequesterCredentials.Credentials.DevId    = Settings.DevId;
            service.RequesterCredentials.Credentials.AuthCert = Settings.CertId;
            // Make the call
            GetOrdersRequestType request = new GetOrdersRequestType();

            request.CreateTimeFrom          = new DateTime(2015, 12, 1);
            request.CreateTimeTo            = DateTime.Now;
            request.CreateTimeFromSpecified = true;
            request.CreateTimeToSpecified   = true;
            request.DetailLevel             = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll };
            request.Version = "949";
            var response = service.GetOrders(request);

            Console.WriteLine("New orders: \n");
            foreach (var order in response.OrderArray)
            {
                if (order.CheckoutStatus.Status == CompleteStatusCodeType.Complete)
                {
                    Console.WriteLine("Order Id: {0}", order.OrderID);
                    Console.WriteLine("Amount Paid: {0:c}", order.AmountPaid.Value);
                    Console.WriteLine("Shipped Time: {0}", order.ShippedTime);
                    int itemIdex = 0;
                    foreach (var transaction in order.TransactionArray)
                    {
                        Console.WriteLine("Order Item {1}: {0}", transaction.Item.Title, itemIdex + 1);
                    }
                    Console.WriteLine();
                }
            }
        }
Beispiel #5
0
        public static void GetOrders()
        {
            string endpoint = "https://api.ebay.com/wsapi";
            string callName = "GetOrders";
            // site id: https://developer.ebay.com/DevZone/merchandising/docs/Concepts/SiteIDToGlobalID.html
            string siteId  = "2";
            string version = "949";
            // Build the request URL
            string requestURL = endpoint
                                + "?callname=" + callName
                                + "&siteid=" + siteId
                                + "&appid=" + Settings.AppId
                                + "&version=" + version
                                + "&routing=default";
            // Create the service
            eBayAPIInterfaceService service = new eBayAPIInterfaceService();

            // Assign the request URL to the service locator.
            service.Url = requestURL;
            // Set credentials
            service.RequesterCredentials = new CustomSecurityHeaderType();
            service.RequesterCredentials.eBayAuthToken =
                "AgAAAA**AQAAAA**aAAAAA**c8WOVg**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6AAlIeiCpiLoAydj6x9nY+seQ**JiADAA**AAMAAA**sPiqCG+IiAwqtalGeoTnnESc7Br2D+btBopa9arMMDNaOfglryGRHk3tn/aXAj3p2/KmDiKSmYrg51QGFNokYSGUskmH/jjsOtKgoLyTTJZ+3CtWqeAOz/cbrYadAD8l+s6xUfnTk9mWm4BjyAfYqJ1zkNHUC5YaFTk+oaDZPZ9bE7uGjfw1cvQeX6M7TalgTSygqdVV6hOVJZ3I9UPuO66HchFTPvd4n02aZ2UfsXrcYdOpstNdjLuETQIB5tmUWo6uiCwh/r+eiWt8jIycZegb/9uRHzwEy7rW9Tk7fIpIohoBtryYRLUnMJvy9Dg4l++AhFY0yakWJsWu7VHy7eCuz+OI0Pk+E+uOQhgQRzIji96K6/AnBNV9lLiOa6CiI5MdkcrF2Z4Kr4WoxAgy+4WjoUq+PRG8eDHseFWANwOVhmY9qZJq0ulR9SNcXd8FoRiinxzx3f+lO+MgfrRcea2QKKQVoYDI69jKOQ568FVQ6Zp0ClJy9ru/L9IqB87COBLFP6Ie+Zx+2nhgj+GuARYOu2z0Z7kqx+R6H19hIYoxNncQtGi2ruzqWXG+hbFWXTlqrne8IiJr1udgK1ZxJk9FTCCKQCx0s57SXuBkyaM15y2pqC+ze43ZiLGC3wk94pWEACDNRWu4rH27RZTN+ALBoGWkVdSzGxuVfMD164ak4cAJrIiT2OX77FqnLN+MGcVbfJCAu+BREtguSzW6JmM9qHXHBI+4H/jfGruvYoIt2zg7DzMFv50i+hpnLe5F";
            // use your token
            service.RequesterCredentials.Credentials          = new UserIdPasswordType();
            service.RequesterCredentials.Credentials.AppId    = Settings.AppId;
            service.RequesterCredentials.Credentials.DevId    = Settings.DevId;
            service.RequesterCredentials.Credentials.AuthCert = Settings.CertId;
            // Make the call
            GetOrdersRequestType request = new GetOrdersRequestType();

            request.CreateTimeFrom          = new DateTime(2015, 12, 1);
            request.CreateTimeTo            = DateTime.Now;
            request.CreateTimeFromSpecified = true;
            request.CreateTimeToSpecified   = true;
            request.DetailLevel             = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll };
            request.Version = "949";
            var response = service.GetOrders(request);

            Console.WriteLine(response.Timestamp);
            foreach (var order in response.OrderArray)
            {
                Console.WriteLine(order.TransactionArray.Length);
                foreach (var transaction in order.TransactionArray)
                {
                    Console.WriteLine("Item Id: {0}", transaction.Item.ItemID);
                    Console.WriteLine("LineItem Id: {0}", transaction.OrderLineItemID);
                }
            }
        }
Beispiel #6
0
        public void SyncOrders(StringCollection orderIds)
        {
            GetOrdersRequestType request = new GetOrdersRequestType();

            request.OrderStatus = OrderStatusCodeType.All;
            request.Pagination  = new PaginationType();
            request.Pagination.EntriesPerPage = 100;
            request.Pagination.PageNumber     = 1;
            request.DetailLevel = new DetailLevelCodeTypeCollection();
            request.DetailLevel.Add(DetailLevelCodeType.ReturnAll);
            request.OrderIDArray = orderIds;


            ProcessOrderData(ExecuteGetOrders(request));
        }
Beispiel #7
0
        public static void GetOrders()
        {
            string endpoint = "https://api.ebay.com/wsapi";
            string callName = "GetOrders";
            // site id: https://developer.ebay.com/DevZone/merchandising/docs/Concepts/SiteIDToGlobalID.html
            string siteId = "2";
            string version = "949";
            // Build the request URL
            string requestURL = endpoint
                                + "?callname=" + callName
                                + "&siteid=" + siteId
                                + "&appid=" + Settings.AppId
                                + "&version=" + version
                                + "&routing=default";
            // Create the service
            eBayAPIInterfaceService service = new eBayAPIInterfaceService();
            // Assign the request URL to the service locator.
            service.Url = requestURL;
            // Set credentials
            service.RequesterCredentials = new CustomSecurityHeaderType();
            service.RequesterCredentials.eBayAuthToken =
                "AgAAAA**AQAAAA**aAAAAA**c8WOVg**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6AAlIeiCpiLoAydj6x9nY+seQ**JiADAA**AAMAAA**sPiqCG+IiAwqtalGeoTnnESc7Br2D+btBopa9arMMDNaOfglryGRHk3tn/aXAj3p2/KmDiKSmYrg51QGFNokYSGUskmH/jjsOtKgoLyTTJZ+3CtWqeAOz/cbrYadAD8l+s6xUfnTk9mWm4BjyAfYqJ1zkNHUC5YaFTk+oaDZPZ9bE7uGjfw1cvQeX6M7TalgTSygqdVV6hOVJZ3I9UPuO66HchFTPvd4n02aZ2UfsXrcYdOpstNdjLuETQIB5tmUWo6uiCwh/r+eiWt8jIycZegb/9uRHzwEy7rW9Tk7fIpIohoBtryYRLUnMJvy9Dg4l++AhFY0yakWJsWu7VHy7eCuz+OI0Pk+E+uOQhgQRzIji96K6/AnBNV9lLiOa6CiI5MdkcrF2Z4Kr4WoxAgy+4WjoUq+PRG8eDHseFWANwOVhmY9qZJq0ulR9SNcXd8FoRiinxzx3f+lO+MgfrRcea2QKKQVoYDI69jKOQ568FVQ6Zp0ClJy9ru/L9IqB87COBLFP6Ie+Zx+2nhgj+GuARYOu2z0Z7kqx+R6H19hIYoxNncQtGi2ruzqWXG+hbFWXTlqrne8IiJr1udgK1ZxJk9FTCCKQCx0s57SXuBkyaM15y2pqC+ze43ZiLGC3wk94pWEACDNRWu4rH27RZTN+ALBoGWkVdSzGxuVfMD164ak4cAJrIiT2OX77FqnLN+MGcVbfJCAu+BREtguSzW6JmM9qHXHBI+4H/jfGruvYoIt2zg7DzMFv50i+hpnLe5F";
            // use your token
            service.RequesterCredentials.Credentials = new UserIdPasswordType();
            service.RequesterCredentials.Credentials.AppId = Settings.AppId;
            service.RequesterCredentials.Credentials.DevId = Settings.DevId;
            service.RequesterCredentials.Credentials.AuthCert = Settings.CertId;
            // Make the call
            GetOrdersRequestType request = new GetOrdersRequestType();
            request.CreateTimeFrom = new DateTime(2015, 12, 1);
            request.CreateTimeTo = DateTime.Now;
            request.CreateTimeFromSpecified = true;
            request.CreateTimeToSpecified = true;
            request.DetailLevel = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll };
            request.Version = "949";
            var response = service.GetOrders(request);
            Console.WriteLine(response.Timestamp);
            foreach (var order in response.OrderArray)
            {
                Console.WriteLine(order.TransactionArray.Length);
                foreach (var transaction in order.TransactionArray)
                {
                    Console.WriteLine("Item Id: {0}", transaction.Item.ItemID);
                    Console.WriteLine("LineItem Id: {0}", transaction.OrderLineItemID);

                }
            }
        }
Beispiel #8
0
        private OrderTypeCollection ExecuteGetOrders(GetOrdersRequestType request)
        {
            GetOrdersCall call = new GetOrdersCall(_marketplace.GetApiContext());

            GetOrdersResponseType response = call.ExecuteRequest(request) as GetOrdersResponseType;

            while (request.Pagination.PageNumber < response.PaginationResult.TotalNumberOfPages)
            {
                request.Pagination.PageNumber++;

                GetOrdersResponseType additionalResponse = call.ExecuteRequest(request) as GetOrdersResponseType;

                response.OrderArray.AddRange(additionalResponse.OrderArray);
            }

            return(response.OrderArray);
        }
Beispiel #9
0
        private GetOrdersResponseType GetOrders(int?pageNumber, RequestsCounterData requestsCounter)
        {
            var req = new GetOrdersRequestType
            {
                NumberOfDays          = _ParamsDataInfoGetOrdersSimple.CountDays,
                NumberOfDaysSpecified = true,
                Pagination            = new PaginationType
                {
                    EntriesPerPage          = 200,
                    EntriesPerPageSpecified = true,
                    PageNumber          = pageNumber.HasValue ? pageNumber.Value : 0,
                    PageNumberSpecified = pageNumber.HasValue
                }
            };

            return(GetOrders(req, requestsCounter));
        }
Beispiel #10
0
        public void SyncOrdersByModifiedTime(DateTime from, DateTime to)
        {
            GetOrdersRequestType request = new GetOrdersRequestType();

            request.OrderStatus = OrderStatusCodeType.All;
            request.Pagination  = new PaginationType();
            request.Pagination.EntriesPerPage = 100;
            request.Pagination.PageNumber     = 1;
            request.DetailLevel = new DetailLevelCodeTypeCollection();
            request.DetailLevel.Add(DetailLevelCodeType.ReturnAll);

            request.ModTimeFromSpecified = true;
            request.ModTimeToSpecified   = true;
            request.ModTimeFrom          = from;
            request.ModTimeTo            = to;

            ProcessOrderData(ExecuteGetOrders(request));
        }
Beispiel #11
0
        private GetOrdersResponseType GetOrders(DateTime fromDate, DateTime toDate, int?pageNumber, RequestsCounterData requestsCounter)
        {
            var req = new GetOrdersRequestType
            {
                ModTimeFrom          = fromDate.ToUniversalTime(),
                ModTimeFromSpecified = true,
                ModTimeTo            = toDate.ToUniversalTime(),
                ModTimeToSpecified   = true,
                Pagination           = new PaginationType
                {
                    EntriesPerPage          = 200,
                    EntriesPerPageSpecified = true,
                    PageNumber          = pageNumber.HasValue ? pageNumber.Value : 0,
                    PageNumberSpecified = pageNumber.HasValue
                }
            };

            return(GetOrders(req, requestsCounter));
        }
Beispiel #12
0
        public GetOrdersResponseType GetOrders(GetOrdersRequestType request, RequestsCounterData requestsCounter)
        {
            var details = string.Empty;

            if (request.NumberOfDaysSpecified)
            {
                details = string.Format("Num od Days: {0}", request.NumberOfDays);
            }
            else if (request.ModTimeFromSpecified)
            {
                details = string.Format("[ {0} - {1} ]", request.ModTimeFrom, request.ModTimeTo);
            }
            else if (request.CreateTimeFromSpecified)
            {
                details = string.Format("[ {0} - {1} ]", request.CreateTimeFrom, request.CreateTimeTo);
            }

            var response = base.GetServiceData(Service.GetOrders, request);

            requestsCounter.IncrementRequests("GetOrders", details);
            return(response);
        }
 protected GetOrdersResponseType GetOrders(GetOrdersRequestType req, RequestsCounterData requestsCounter)
 {
     return(DataProvider.GetOrders(req, requestsCounter));
 }
Beispiel #14
0
 /// <summary>
 /// 
 /// </summary>
 public GetOrdersCall()
 {
     ApiRequest = new GetOrdersRequestType();
 }
Beispiel #15
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;
 }
Beispiel #16
0
 /// <summary>
 ///
 /// </summary>
 public GetOrdersCall()
 {
     ApiRequest = new GetOrdersRequestType();
 }
Beispiel #17
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="ApiContext">The <see cref="ApiCall.ApiContext"/> for this API Call of type <see cref="ApiContext"/>.</param>
 public GetOrdersCall(ApiContext ApiContext)
 {
     ApiRequest      = new GetOrdersRequestType();
     this.ApiContext = ApiContext;
 }
Beispiel #18
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="ApiContext">The <see cref="ApiCall.ApiContext"/> for this API Call of type <see cref="ApiContext"/>.</param>
 public GetOrdersCall(ApiContext ApiContext)
 {
     ApiRequest = new GetOrdersRequestType();
     this.ApiContext = ApiContext;
 }