예제 #1
0
        private OrderStatus GetOrderStatus(OrderStatusCodeType code)
        {
            OrderStatus status = OrderStatus.DRAFT;

            switch (code)
            {
            case OrderStatusCodeType.Active:
            case OrderStatusCodeType.Authenticated:
            case OrderStatusCodeType.InProcess:
                status = OrderStatus.VIEWED;
                break;

            case OrderStatusCodeType.Inactive:
                status = OrderStatus.DRAFT;
                break;

            case OrderStatusCodeType.Completed:
            case OrderStatusCodeType.Shipped:
                status = OrderStatus.SHIPPED;
                break;

            case OrderStatusCodeType.Cancelled:
            case OrderStatusCodeType.Default:
            case OrderStatusCodeType.Invalid:
            case OrderStatusCodeType.CustomCode:
            case OrderStatusCodeType.All:
                throw new ArgumentOutOfRangeException("code");
            }
            return(status);
        }
예제 #2
0
        public static int GetNumberOfItems(ApiContext apiContext,
                                           DateTime DateFrom, DateTime DateTo, bool Active = true, bool Completed = true)
        {
            eBayClass.LogManager.RecordMessage("Starting a GetNumberOfItems call");
            Blink();

            Stopwatch     s       = Stopwatch.StartNew();
            GetOrdersCall apiCall = new GetOrdersCall(apiContext);

            Blink();

            apiCall.DetailLevelList           = new DetailLevelCodeTypeCollection(new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll });
            apiCall.ApiRequest.OutputSelector = new StringCollection()
            {
                "TransactionID", "PaginationResult"
            };
            apiCall.Pagination = new PaginationType()
            {
                EntriesPerPage = 100, PageNumber = 1
            };
            TimeFilter createTime = new TimeFilter()
            {
                TimeFrom = DateFrom.Subtract(TimeDiff),
                TimeTo   = DateTo.Subtract(TimeDiff)
            };
            OrderStatusCodeType filterStatus = OrderStatusCodeType.All;

            if (Active && !Completed)
            {
                filterStatus = OrderStatusCodeType.Active;
            }
            else if (Completed && !Active)
            {
                filterStatus = OrderStatusCodeType.Completed;
            }

            OrderTypeCollection items = apiCall.GetOrders(createTime,
                                                          TradingRoleCodeType.Seller, filterStatus);

            apiContext.ApiLogManager.RecordMessage(String.Format("Getting item list - SUCCESS, page {0}", 1));
            Blink();

            eBayClass.Metrics.GenerateReport(eBayClass.LogManager.ApiLoggerList[0]);
            eBayClass.LogManager.RecordMessage("Done; ms: " + s.ElapsedMilliseconds.ToString());
            Blink();

            return(apiCall.PaginationResult.TotalNumberOfEntries);
        }
예제 #3
0
        private OrderStatus parseOrderStatus(OrderStatusCodeType orderStatus)
        {
            switch (orderStatus)
            {
            case OrderStatusCodeType.Active: return(OrderStatus.Pending);

            case OrderStatusCodeType.Inactive: return(OrderStatus.PendingAvailability);

            case OrderStatusCodeType.Completed: return(OrderStatus.Shipped);

            case OrderStatusCodeType.Cancelled: return(OrderStatus.Canceled);

            case OrderStatusCodeType.Shipped: return(OrderStatus.Shipped);

            case OrderStatusCodeType.InProcess: return(OrderStatus.PendingAvailability);

            case OrderStatusCodeType.CancelPending: return(OrderStatus.Canceled);

            default: return(OrderStatus.None);
            }
        }
예제 #4
0
        // http://developer.ebay.com/devzone/xml/docs/Reference/eBay/GetOrders.html
        public OrderTypeCollection GetOrders(OrderStatusCodeType type, DateTime from, DateTime to)
        {
            var call = new GetOrdersCall(api);

            call.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);

            var timeFilter = new TimeFilter {
                TimeFrom = from, TimeTo = to
            };

            var result = new OrderTypeCollection();

            bool hasMoreEntries = true;

            int count = 1;

            while (hasMoreEntries)
            {
                call.Pagination = new PaginationType
                {
                    PageNumber     = count,
                    EntriesPerPage = 200
                };

                OrderTypeCollection orders = call.GetOrders(timeFilter, TradingRoleCodeType.Seller, type);
                result.AddRange(orders);

                hasMoreEntries = call.HasMoreOrders;

                if (count++ > 10)
                {
                    break;
                }
            }

            responseXML = call.SoapResponse;

            return(result);
        }
예제 #5
0
 /// <summary>
 /// For backward compatibility with old wrappers.
 /// </summary>
 public OrderTypeCollection GetOrders(DateTime CreateTimeFrom, DateTime CreateTimeTo, TradingRoleCodeType OrderRole, OrderStatusCodeType OrderStatus)
 {
     this.OrderRole        = OrderRole;
     this.OrderStatus      = OrderStatus;
     this.CreateTimeFilter = new TimeFilter(CreateTimeFrom, CreateTimeTo);
     this.OrderIDList      = OrderIDList;
     Execute();
     return(OrderList);
 }
예제 #6
0
 /// <summary>
 /// For backward compatibility with old wrappers.
 /// </summary>
 public OrderTypeCollection GetOrders(TimeFilter CreateTimeFilter, TradingRoleCodeType OrderRole, OrderStatusCodeType OrderStatus)
 {
     this.OrderRole        = OrderRole;
     this.OrderStatus      = OrderStatus;
     this.CreateTimeFilter = CreateTimeFilter;
     this.OrderIDList      = OrderIDList;
     Execute();
     return(OrderList);
 }
예제 #7
0
        /// <summary>
        /// Retrieves the orders for which the authenticated user is a participant, either as the buyer
        /// or the seller. <b>Also for Half.com</b>. The call returns all the
        /// orders that meet the request specifications.
        /// </summary>
        ///
        /// <param name="OrderIDList">
        /// A container for eBay order IDs. If one or more order IDs are specified in this
        /// container, no other call-specific input fields are applicable.
        ///
        /// Not applicable to Half.com.
        /// </param>
        ///
        /// <param name="CreateTimeFrom">
        /// The <b>CreateTimeFrom</b> and <b>CreateTimeTo</b> fields
        /// specify a date range for retrieving orders. The <b>CreateTimeFrom</b> field is the
        /// starting date range. All eBay orders that were created within this date range are
        /// returned in the output. The maximum date range that may be specified with the
        /// <b>CreateTimeFrom</b> and <b>CreateTimeTo</b> fields is 90
        /// days. <b>CreateTimeFrom</b>/<b>CreateTimeTo</b> date
        /// filters are ignored if the <b>NumberOfDays</b> date filter is used in the request, or if
        /// one or more order IDs are passed in the request.
        ///
        /// Applicable to Half.com.
        /// </param>
        ///
        /// <param name="CreateTimeTo">
        /// The <b>CreateTimeFrom</b> and <b>CreateTimeTo</b> fields specify a date range for retrieving
        /// orders. The <b>CreateTimeTo</b> field is the ending date range. All eBay orders that were
        /// created within this date range are returned in the output. The maximum
        /// date range that may be specified with the <b>CreateTimeFrom</b> and <b>CreateTimeTo</b> fields
        /// is 90 days. If the <b>CreateTimeFrom</b> field is used and the
        /// <b>CreateTimeTo</b> field is omitted, the "TimeTo" value defaults to the present time or
        /// to 90 days past the <b>CreateTimeFrom</b> value (if <b>CreateTimeFrom</b> value is more than 90
        /// days in the past). <b>CreateTimeFrom</b>/<b>CreateTimeTo</b> date filters are ignored if the
        /// <b>NumberOfDays</b> date filter is used in the request, or if one or more order IDs are
        /// passed in the request.
        ///
        /// <span class="tablenote"><strong>Note:</strong>
        /// If a GetOrders call is made within a few seconds after the creation of a multiple
        /// line item order, the caller runs the risk of retrieving orders that are in an
        /// inconsistent state, since the order consolidation involved in a multi-line item order
        /// may not have been completed. For
        /// this reason, it is recommended that sellers include the
        /// <b>CreateTimeTo</b> field in the call, and set its value to: <i>
        /// Current Time</i> - 2 minutes.
        ///
        /// Applicable to Half.com.
        /// </span>
        ///
        /// <param name="OrderRole">
        /// Filters the returned orders based on the role of the user. The user's role is
        /// either buyer or seller. If this field is used with a date filter, returned orders
        /// must satisfy both the date range and the OrderRole value.
        ///
        /// Applicable to eBay.com and Half.com.
        /// </param>
        ///
        /// <param name="OrderStatus">
        /// The field is used to retrieve orders that are in a specific state. If this field is used with a date filter, only orders that satisfy both the date range and the <b>OrderStatus</b> value are retrieved.
        ///
        /// For eBay orders, this field's value can be set to 'Active', 'Completed', 'Canceled' or 'Inactive' to retrieve orders in these states. The 'Shipped' value is only applicable for Half.com orders.
        ///
        /// To retrieve Half.com orders, this field's value should be set to 'Shipped', and the <b>ListingType</b> field should be included and set to 'Half'.
        ///
        /// If one or more <b>OrderID</b> values are specified through the <b>OrderIDArray</b> container, the <b>OrderStatus</b> field should not be used, and it is ignored if it is used.
        /// </param>
        ///
        /// <param name="ListingType">
        /// Specify Half to retrieve Half.com orders.
        ///
        /// <span class="tablenote"><strong>Note:</strong>
        /// Do not use this field if you are retrieving eBay orders.
        ///
        /// This field cannot be used as a listing type filter on eBay.com. If not
        /// provided, or if you specify any value other than Half, this field has
        /// no useful effect and the call retrieves eBay orders of all types. Also,
        /// you can't retrieve both eBay and Half.com orders in the same response.
        /// </span>
        /// </param>
        ///
        /// <param name="Pagination">
        /// If many orders are	available to retrieve, you may need to call GetOrders multiple times to retrieve all
        /// the data. Each result set is returned as a page of entries. Use the
        /// Pagination filters to control the maximum number of entries to
        /// retrieve per page (i.e., per call), the page number to retrieve, and
        /// other data.
        /// </param>
        ///
        /// <param name="ModTimeFrom">
        /// The ModTimeFrom and ModTimeTo fields specify a date range for retrieving
        /// existing orders that have been modified within this time window (for example,
        /// 'Incomplete' status to 'Pending' status or 'Pending' status to 'Complete' status). The
        /// ModTimeFrom field is the starting date range. All eBay orders that were last
        /// modified within this date range are returned in the output. The maximum date
        /// range that may be specified with the ModTimeFrom and ModTimeTo fields is 30
        /// days. ModTimeFrom/ModTimeTo date filters are ignored if the
        /// CreateTimeFrom/CreateTimeTo or NumberOfDays date filters are used in the
        /// request, or if one or more order IDs are passed in the request.
        ///
        /// Applicable to Half.com.
        /// </param>
        ///
        /// <param name="ModTimeTo">
        /// The ModTimeFrom and ModTimeTo fields specify a date range for retrieving
        /// existing orders that have been modified within this time window (for example,
        /// 'Incomplete' status to 'Pending' status or 'Pending' status to 'Complete'
        /// status). The ModTimeTo field is the ending date range. All eBay orders that were
        /// last modified within this date range are returned in the output. The maximum
        /// date range that may be specified with the ModTimeFrom and ModTimeTo fields is 30
        /// days. If the ModTimeFrom field is used and the ModTimeTo field is omitted, the
        /// "TimeTo" value defaults to the present time (if ModTimeFrom value is less than
        /// 30 days in the past) or to 30 days past the ModTimeFrom value.
        /// ModTimeFrom/ModTimeTo date filters are ignored if the
        /// CreateTimeFrom/CreateTimeTo or NumberOfDays date filters are used in the
        /// request, or if one or more order IDs are passed in the request.
        ///
        /// Applicable to Half.com.
        /// </param>
        ///
        /// <param name="NumberOfDays">
        /// This filter specifies the number of days (24-hour periods) in the past to search
        /// for orders. All eBay orders that were either created or modified within this
        /// period are returned in the output. This field cannot be used in conjunction with
        /// the CreateTimeFrom/CreateTimeTo or ModTimeFrom/ModTimeTo date filters. This date
        /// filter is ignored if one or more order IDs are passed in the request.
        ///
        /// Applicable to Half.com.
        /// </param>
        ///
        /// <param name="IncludeFinalValueFee">
        /// Indicates whether to include the Final Value Fee (FVF) for all Transaction objects in the
        /// response. The Final Value Fee is returned in Transaction.FinalValueFee. The Final
        /// Value Fee is assessed right after the creation of an eBay order line item.
        ///
        /// </param>
        ///
        /// <param name="SortingOrder">
        /// Specifies how orders returned by this call should be sorted (using <strong>LastModifiedTime</strong> as the sort key). A value of <code>Ascending</code> returns the earliest modified orders first, and a value of <code>Descending</code> returns the latest modified orders first.
        /// <br/><br/>
        /// Default: <code>Ascending</code>
        /// </param>
        public OrderTypeCollection GetOrders(StringCollection OrderIDList, DateTime CreateTimeFrom, DateTime CreateTimeTo, TradingRoleCodeType OrderRole, OrderStatusCodeType OrderStatus, ListingTypeCodeType ListingType, PaginationType Pagination, DateTime ModTimeFrom, DateTime ModTimeTo, int NumberOfDays, bool IncludeFinalValueFee, SortOrderCodeType SortingOrder)
        {
            this.OrderIDList          = OrderIDList;
            this.CreateTimeFrom       = CreateTimeFrom;
            this.CreateTimeTo         = CreateTimeTo;
            this.OrderRole            = OrderRole;
            this.OrderStatus          = OrderStatus;
            this.ListingType          = ListingType;
            this.Pagination           = Pagination;
            this.ModTimeFrom          = ModTimeFrom;
            this.ModTimeTo            = ModTimeTo;
            this.NumberOfDays         = NumberOfDays;
            this.IncludeFinalValueFee = IncludeFinalValueFee;
            this.SortingOrder         = SortingOrder;

            Execute();
            return(ApiResponse.OrderArray);
        }
예제 #8
0
 public OrderTypeCollection GetOrders(TimeFilter Filter, TradingRoleCodeType OrderRole, OrderStatusCodeType OrderStatus)
 {
     return(ebayGetOrdersCall.GetOrders(Filter, OrderRole, OrderStatus));
 }
예제 #9
0
 /// <summary>
 /// For backward compatibility with old wrappers.
 /// </summary>
 public OrderTypeCollection GetOrders(DateTime CreateTimeFrom, DateTime CreateTimeTo, TradingRoleCodeType OrderRole, OrderStatusCodeType OrderStatus)
 {
     this.OrderRole = OrderRole;
     this.OrderStatus = OrderStatus;
     this.CreateTimeFilter = new TimeFilter(CreateTimeFrom, CreateTimeTo);
     this.OrderIDList = OrderIDList;
     Execute();
     return OrderList;
 }
예제 #10
0
 /// <summary>
 /// For backward compatibility with old wrappers.
 /// </summary>
 public OrderTypeCollection GetOrders(TimeFilter CreateTimeFilter, TradingRoleCodeType OrderRole, OrderStatusCodeType OrderStatus)
 {
     this.OrderRole = OrderRole;
     this.OrderStatus = OrderStatus;
     this.CreateTimeFilter = CreateTimeFilter;
     this.OrderIDList = OrderIDList;
     Execute();
     return OrderList;
 }
예제 #11
0
        /// <summary>
        /// Retrieves the orders for which the authenticated user is a participant, either as the buyer
        /// or the seller.&nbsp;<b>Also for Half.com</b>. The call returns all the
        /// orders that meet the request specifications.
        /// </summary>
        /// 
        /// <param name="OrderIDList">
        /// A container for eBay order IDs. If one or more order IDs are specified in this
        /// container, no other call-specific input fields are applicable.
        /// 
        /// Not applicable to Half.com.
        /// </param>
        ///
        /// <param name="CreateTimeFrom">
        /// The <b>CreateTimeFrom</b> and <b>CreateTimeTo</b> fields
        /// specify a date range for retrieving orders. The <b>CreateTimeFrom</b> field is the
        /// starting date range. All eBay orders that were created within this date range are
        /// returned in the output. The maximum date range that may be specified with the
        /// <b>CreateTimeFrom</b> and <b>CreateTimeTo</b> fields is 90 
        /// days. <b>CreateTimeFrom</b>/<b>CreateTimeTo</b> date
        /// filters are ignored if the <b>NumberOfDays</b> date filter is used in the request, or if
        /// one or more order IDs are passed in the request.
        /// 
        /// Applicable to Half.com.
        /// </param>
        ///
        /// <param name="CreateTimeTo">
        /// The <b>CreateTimeFrom</b> and <b>CreateTimeTo</b> fields specify a date range for retrieving
        /// orders. The <b>CreateTimeTo</b> field is the ending date range. All eBay orders that were
        /// created within this date range are returned in the output. The maximum
        /// date range that may be specified with the <b>CreateTimeFrom</b> and <b>CreateTimeTo</b> fields
        /// is 90 days. If the <b>CreateTimeFrom</b> field is used and the
        /// <b>CreateTimeTo</b> field is omitted, the "TimeTo" value defaults to the present time or
        /// to 90 days past the <b>CreateTimeFrom</b> value (if <b>CreateTimeFrom</b> value is more than 90
        /// days in the past). <b>CreateTimeFrom</b>/<b>CreateTimeTo</b> date filters are ignored if the
        /// <b>NumberOfDays</b> date filter is used in the request, or if one or more order IDs are
        /// passed in the request.
        /// 
        /// <span class="tablenote"><strong>Note:</strong>
        /// If a GetOrders call is made within a few seconds after the creation of a multiple
        /// line item order, the caller runs the risk of retrieving orders that are in an
        /// inconsistent state, since the order consolidation involved in a multi-line item order
        /// may not have been completed. For
        /// this reason, it is recommended that sellers include the
        /// <b>CreateTimeTo</b> field in the call, and set its value to: <i>
        /// Current Time</i> - 2 minutes.
        /// 
        /// Applicable to Half.com.
        /// </param>
        ///
        /// <param name="OrderRole">
        /// Filters the returned orders based on the role of the user. The user's role is
        /// either buyer or seller. If this field is used with a date filter, returned orders
        /// must satisfy both the date range and the OrderRole value.
        /// 
        /// Applicable to eBay.com and Half.com.
        /// </param>
        ///
        /// <param name="OrderStatus">
        /// The field is used to retrieve orders that are in a specific state. If this field is used with a date filter, only orders that satisfy both the date range and the <b>OrderStatus</b> value are retrieved. 
        /// 
        /// For eBay orders, this field's value can be set to 'Active', 'Completed', 'Canceled' or 'Inactive' to retrieve orders in these states. The 'Shipped' value is only applicable for Half.com orders. 
        /// 
        /// To retrieve Half.com orders, this field's value should be set to 'Shipped', and the <b>ListingType</b> field should be included and set to 'Half'. 
        /// 
        /// If one or more <b>OrderID</b> values are specified through the <b>OrderIDArray</b> container, the <b>OrderStatus</b> field should not be used, and it is ignored if it is used. 
        /// </param>
        ///
        /// <param name="ListingType">
        /// Specify Half to retrieve Half.com orders.
        /// 
        /// <span class="tablenote"><strong>Note:</strong>
        /// Do not use this field if you are retrieving eBay orders.
        /// 
        /// This field cannot be used as a listing type filter on eBay.com. If not
        /// provided, or if you specify any value other than Half, this field has
        /// no useful effect and the call retrieves eBay orders of all types. Also,
        /// you can't retrieve both eBay and Half.com orders in the same response.
        /// </span>
        /// </param>
        ///
        /// <param name="Pagination">
        /// If many orders are	available to retrieve, you may need to call GetOrders multiple times to retrieve all
        /// the data. Each result set is returned as a page of entries. Use the
        /// Pagination filters to control the maximum number of entries to
        /// retrieve per page (i.e., per call), the page number to retrieve, and
        /// other data.
        /// </param>
        ///
        /// <param name="ModTimeFrom">
        /// The ModTimeFrom and ModTimeTo fields specify a date range for retrieving
        /// existing orders that have been modified within this time window (for example,
        /// 'Incomplete' status to 'Pending' status or 'Pending' status to 'Complete' status). The
        /// ModTimeFrom field is the starting date range. All eBay orders that were last
        /// modified within this date range are returned in the output. The maximum date
        /// range that may be specified with the ModTimeFrom and ModTimeTo fields is 30
        /// days. ModTimeFrom/ModTimeTo date filters are ignored if the
        /// CreateTimeFrom/CreateTimeTo or NumberOfDays date filters are used in the
        /// request, or if one or more order IDs are passed in the request.
        /// 
        /// Applicable to Half.com.
        /// </param>
        ///
        /// <param name="ModTimeTo">
        /// The ModTimeFrom and ModTimeTo fields specify a date range for retrieving
        /// existing orders that have been modified within this time window (for example,
        /// 'Incomplete' status to 'Pending' status or 'Pending' status to 'Complete'
        /// status). The ModTimeTo field is the ending date range. All eBay orders that were
        /// last modified within this date range are returned in the output. The maximum
        /// date range that may be specified with the ModTimeFrom and ModTimeTo fields is 30
        /// days. If the ModTimeFrom field is used and the ModTimeTo field is omitted, the
        /// "TimeTo" value defaults to the present time (if ModTimeFrom value is less than
        /// 30 days in the past) or to 30 days past the ModTimeFrom value.
        /// ModTimeFrom/ModTimeTo date filters are ignored if the
        /// CreateTimeFrom/CreateTimeTo or NumberOfDays date filters are used in the
        /// request, or if one or more order IDs are passed in the request.
        /// 
        /// Applicable to Half.com.
        /// </param>
        ///
        /// <param name="NumberOfDays">
        /// This filter specifies the number of days (24-hour periods) in the past to search
        /// for orders. All eBay orders that were either created or modified within this
        /// period are returned in the output. This field cannot be used in conjunction with
        /// the CreateTimeFrom/CreateTimeTo or ModTimeFrom/ModTimeTo date filters. This date 
        /// filter is ignored if one or more order IDs are passed in the request.
        /// 
        /// Applicable to Half.com.
        /// </param>
        ///
        /// <param name="IncludeFinalValueFee">
        /// Indicates whether to include the Final Value Fee (FVF) for all Transaction objects in the
        /// response. The Final Value Fee is returned in Transaction.FinalValueFee. The Final
        /// Value Fee is assessed right after the creation of an eBay order line item.
        /// 
        /// </param>
        ///
        /// <param name="SortingOrder">
        /// Specifies how orders returned by this call should be sorted (using <strong>LastModifiedTime</strong> as the sort key). A value of <code>Ascending</code> returns the earliest modified orders first, and a value of <code>Descending</code> returns the latest modified orders first.
        /// <br/><br/>
        /// Default: <code>Ascending</code>
        /// </param>
        ///
        public OrderTypeCollection GetOrders(StringCollection OrderIDList, DateTime CreateTimeFrom, DateTime CreateTimeTo, TradingRoleCodeType OrderRole, OrderStatusCodeType OrderStatus, ListingTypeCodeType ListingType, PaginationType Pagination, DateTime ModTimeFrom, DateTime ModTimeTo, int NumberOfDays, bool IncludeFinalValueFee, SortOrderCodeType SortingOrder)
        {
            this.OrderIDList = OrderIDList;
            this.CreateTimeFrom = CreateTimeFrom;
            this.CreateTimeTo = CreateTimeTo;
            this.OrderRole = OrderRole;
            this.OrderStatus = OrderStatus;
            this.ListingType = ListingType;
            this.Pagination = Pagination;
            this.ModTimeFrom = ModTimeFrom;
            this.ModTimeTo = ModTimeTo;
            this.NumberOfDays = NumberOfDays;
            this.IncludeFinalValueFee = IncludeFinalValueFee;
            this.SortingOrder = SortingOrder;

            Execute();
            return ApiResponse.OrderArray;
        }
예제 #12
0
        public static List <Transaction> GetOrders(IGetOrdersCall AGetOrdersCall,
                                                   DateTime DateFrom, DateTime DateTo, bool Active = true, bool Completed = true,
                                                   bool MinimumOutput = false)
        {
            AGetOrdersCall.ApiContext.ApiLogManager.RecordMessage("Starting a GetOrders call " + (MinimumOutput ? "with minimum output" : "with normal output"));
            Blink();

            Stopwatch s = Stopwatch.StartNew();

            AGetOrdersCall.DetailLevelList = new DetailLevelCodeTypeCollection(new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll });
            AGetOrdersCall.ApiContext.ApiLogManager.RecordMessage(String.Format("Getting item list - START, page {0}", 1));
            Blink();

            TimeFilter createTime = new TimeFilter()
            {
                TimeFrom = DateFrom.Subtract(TimeDiff),
                TimeTo   = DateTo.Subtract(TimeDiff)
            };

            if (MinimumOutput)
            {
                AGetOrdersCall.ApiRequest.OutputSelector = new StringCollection(new string[] { "TransactionID", "PaginationResult", "SellingManagerSalesRecordNumber", "ItemID", "CreatedTime" });
            }

            OrderStatusCodeType filterStatus = OrderStatusCodeType.All;

            if (Active && !Completed)
            {
                filterStatus = OrderStatusCodeType.Active;
            }
            else if (Completed && !Active)
            {
                filterStatus = OrderStatusCodeType.Completed;
            }

            int Page = 1;
            List <Transaction> res = new List <Transaction>();

            do
            {
                AGetOrdersCall.Pagination = new PaginationType()
                {
                    EntriesPerPage = 200, PageNumber = Page
                };
                OrderTypeCollection items = AGetOrdersCall.GetOrders(createTime,
                                                                     TradingRoleCodeType.Seller, filterStatus);
                Blink();

                AGetOrdersCall.ApiContext.ApiLogManager.RecordMessage(String.Format("Getting item list - SUCCESS, page {0}", Page));
                Blink();

                foreach (OrderType i in items)
                {
                    foreach (TransactionType j in i.TransactionArray)
                    {
                        res.Add(new Transaction()
                        {
                            OrderID     = i.OrderID, TransactionId = j.TransactionID,
                            ItemID      = j.Item.ItemID, SellingManagerRecordNumber = j.ShippingDetails.SellingManagerSalesRecordNumber,
                            CreatedTime = i.CreatedTime, OrderStatus = i.OrderStatus
                        });

                        AGetOrdersCall.ApiContext.ApiLogManager.RecordMessage(String.Format("TransactionID {0}\tItem ID{1}\tCreated on {2}",
                                                                                            i.OrderID, j.Item.ItemID, i.CreatedTime));
                    }
                }
                Blink();

                Page++;
            } while (Page <= AGetOrdersCall.PaginationResult.TotalNumberOfPages);

            eBayClass.Metrics.GenerateReport(eBayClass.LogManager.ApiLoggerList[0]);
            eBayClass.LogManager.RecordMessage("Done; ms: " + s.ElapsedMilliseconds.ToString());
            Blink();

            return(res);
        }
예제 #13
0
        /// <summary>
        /// Retrieves the orders for which the authenticated user is a participant, either as
        /// the buyer or the seller. The call returns all the orders that meet the request
        /// specifications.
        /// </summary>
        /// 
        /// <param name="OrderIDList">
        /// A set of orders to retrieve.
        /// 
        /// Not applicable to Half.com.
        /// </param>
        ///
        /// <param name="CreateTimeFrom">
        /// The starting date of the date range for the orders to retrieve.
        /// 
        /// Applicable to Half.com.
        /// </param>
        ///
        /// <param name="CreateTimeTo">
        /// The ending date of the date range for the orders to retrieve.
        /// 
        /// Applicable to Half.com.
        /// </param>
        ///
        /// <param name="OrderRole">
        /// Filters orders based on the role of the user making the GetOrders request.
        /// 
        /// Not applicable to Half.com.
        /// </param>
        ///
        /// <param name="OrderStatus">
        /// Filters the returned orders by order status (Active or Completed).
        /// To retrieve orders with a status of Inactive or Cancelled, you must
        /// specify the order IDs (OrderIDArray.OrderID). When you specify
        /// OrderIDArray.OrderID, no other filters are used.
        /// 
        /// For Half.com, you can get some, but not all orders.
        /// Orders on Half.com have different order status values from
        /// eBay orders. When you set ListingType to Half, set OrderStatus
        /// to Shipped. Otherwise, GetOrders may return incomplete information
        /// or have indeterminate results.
        /// </param>
        ///
        /// <param name="ListingType">
        /// Specify Half to retrieve Half.com orders.
        /// 
        /// <span class="tablenote"><strong>Note:</strong>
        /// Do not use this field if you are retrieving eBay orders.
        /// 
        /// This field cannnot be used as a listing type filter on eBay.com. If not
        /// provided, or if you specify any value other than Half, this field has
        /// no useful effect and the call retrieves eBay orders of all types. Also,
        /// you can't retrieve both eBay and Half.com orders in the same response.
        /// </span>
        /// </param>
        ///
        /// <param name="Pagination">
        /// Not applicable to eBay.com. Applicable to Half.com. If many orders are
        /// available, you may need to call GetOrders multiple times to retrieve all
        /// the data. Each result set is returned as a page of entries. Use this
        /// Pagination information to indicate the maximum number of entries to
        /// retrieve per page (i.e., per call), the page number to retrieve, and
        /// other data.
        /// </param>
        ///
        public OrderTypeCollection GetOrders(StringCollection OrderIDList, DateTime CreateTimeFrom, DateTime CreateTimeTo, TradingRoleCodeType OrderRole, OrderStatusCodeType OrderStatus, ListingTypeCodeType ListingType, PaginationType Pagination)
        {
            this.OrderIDList = OrderIDList;
            this.CreateTimeFrom = CreateTimeFrom;
            this.CreateTimeTo = CreateTimeTo;
            this.OrderRole = OrderRole;
            this.OrderStatus = OrderStatus;
            this.ListingType = ListingType;
            this.Pagination = Pagination;

            Execute();
            return ApiResponse.OrderArray;
        }