public void GetMyeBayBuying() { GetMyeBayBuyingCall api = new GetMyeBayBuyingCall(this.apiContext); if (this.apiContext.SoapApiServerUrl.IndexOf("sandbox") != -1) { return; } GetMyeBayBuyingRequestType req = new GetMyeBayBuyingRequestType(); api.ApiRequest = req; ItemListCustomizationType lc = new ItemListCustomizationType(); lc.Include = true; lc.IncludeSpecified = true; lc.IncludeNotes = true; lc.IncludeNotesSpecified = true; lc.Sort = ItemSortTypeCodeType.EndTime; req.BestOfferList = lc; lc = new ItemListCustomizationType(); lc.Include = true; lc.IncludeSpecified = true; lc.IncludeNotes = true; lc.IncludeNotesSpecified = true; lc.Sort = ItemSortTypeCodeType.BidCount; req.BidList = lc; lc = new ItemListCustomizationType(); lc.Include = true; lc.IncludeSpecified = true; lc.IncludeNotes = true; lc.IncludeNotesSpecified = true; lc.Sort = ItemSortTypeCodeType.EndTime; req.LostList = lc; lc = new ItemListCustomizationType(); lc.Include = true; lc.IncludeSpecified = true; lc.IncludeNotes = true; lc.IncludeNotesSpecified = true; lc.Sort = ItemSortTypeCodeType.Price; req.WonList = lc; MyeBaySelectionType selection = new MyeBaySelectionType(); selection.Include = true; selection.IncludeSpecified = true; selection.Sort = SortOrderCodeType.Ascending; req.FavoriteSearches = selection; MyeBaySelectionType sellerSel = new MyeBaySelectionType(); sellerSel.Include = true; sellerSel.IncludeSpecified = true; sellerSel.Sort = SortOrderCodeType.Ascending; req.FavoriteSellers = sellerSel; // Make API call. api.GetMyeBayBuying(); GetMyeBayBuyingResponseType resp = api.ApiResponse; }
public void GetMyeBayBuying() { GetMyeBayBuyingCall api = new GetMyeBayBuyingCall(this.apiContext); if (this.apiContext.SoapApiServerUrl.IndexOf("sandbox") != -1) return; GetMyeBayBuyingRequestType req = new GetMyeBayBuyingRequestType(); api.ApiRequest = req; ItemListCustomizationType lc = new ItemListCustomizationType(); lc.Include = true; lc.IncludeSpecified = true; lc.IncludeNotes = true; lc.IncludeNotesSpecified = true; lc.Sort = ItemSortTypeCodeType.EndTime; req.BestOfferList = lc; lc = new ItemListCustomizationType(); lc.Include = true; lc.IncludeSpecified = true; lc.IncludeNotes = true; lc.IncludeNotesSpecified = true; lc.Sort = ItemSortTypeCodeType.BidCount; req.BidList = lc; lc = new ItemListCustomizationType(); lc.Include = true; lc.IncludeSpecified = true; lc.IncludeNotes = true; lc.IncludeNotesSpecified = true; lc.Sort = ItemSortTypeCodeType.EndTime; req.LostList = lc; lc = new ItemListCustomizationType(); lc.Include = true; lc.IncludeSpecified = true; lc.IncludeNotes = true; lc.IncludeNotesSpecified = true; lc.Sort = ItemSortTypeCodeType.Price; req.WonList = lc; MyeBaySelectionType selection = new MyeBaySelectionType(); selection.Include = true; selection.IncludeSpecified = true; selection.Sort = SortOrderCodeType.Ascending; req.FavoriteSearches = selection; MyeBaySelectionType sellerSel = new MyeBaySelectionType(); sellerSel.Include = true; sellerSel.IncludeSpecified = true; sellerSel.Sort = SortOrderCodeType.Ascending; req.FavoriteSellers = sellerSel; // Make API call. api.GetMyeBayBuying(); GetMyeBayBuyingResponseType resp = api.ApiResponse; }
/// <summary> /// /// </summary> /// <param name="ApiContext">The <see cref="ApiCall.ApiContext"/> for this API Call of type <see cref="ApiContext"/>.</param> public GetMyeBayBuyingCall(ApiContext ApiContext) { ApiRequest = new GetMyeBayBuyingRequestType(); this.ApiContext = ApiContext; }
/// <summary> /// /// </summary> public GetMyeBayBuyingCall() { ApiRequest = new GetMyeBayBuyingRequestType(); }
private bool UserWonTheItem(long itemID, int nbRetry) { Logger.CreateLog("Beginning__UserWonTheItem", itemID.ToString(), null, EnumLogLevel.INFO); string callname = "GetMyeBayBuying"; int nbPage = 0; try { this.BuildService(callname); GetMyeBayBuyingRequestType request = new GetMyeBayBuyingRequestType(); request.Version = _version; request.WonList = new ItemListCustomizationType(); request.WonList.Include = true; request.WonList.IncludeSpecified = true; request.WonList.ListingType = ListingTypeCodeType.Chinese; request.WonList.ListingTypeSpecified = true; request.WonList.DurationInDays = 1; request.WonList.DurationInDaysSpecified = true; request.WonList.Pagination = new PaginationType(); request.WonList.Pagination.EntriesPerPage = 25; request.WonList.Pagination.EntriesPerPageSpecified = true; request.WonList.Pagination.PageNumber = 1; request.WonList.Pagination.PageNumberSpecified = true; DetailLevelCodeType level = DetailLevelCodeType.ReturnAll; List<DetailLevelCodeType> l = new List<DetailLevelCodeType>(); l.Add(level); request.DetailLevel = l.ToArray(); List<string> outputs = new List<string>(); outputs.Add("WonList.OrderTransactionArray"); outputs.Add("WonList.PaginationResult"); request.OutputSelector = outputs.ToArray(); GetMyeBayBuyingResponseType response = this.service.GetMyeBayBuying(request); if (response.Ack == AckCodeType.Success) { if (response.WonList != null) nbPage = response.WonList.PaginationResult.TotalNumberOfPages; // There must be at least 1 page if (nbPage > 0) { // We loop throw the pages for (int i = 1; i <= response.WonList.PaginationResult.TotalNumberOfPages; i++) { // Dont reload if we are on the first page if (i != 1) { request.WonList.Pagination = new PaginationType(); request.WonList.Pagination.EntriesPerPage = 25; request.WonList.Pagination.EntriesPerPageSpecified = true; request.WonList.Pagination.PageNumber = i; request.WonList.Pagination.PageNumberSpecified = true; response = service.GetMyeBayBuying(request); } foreach (OrderTransactionType orderTransaction in response.WonList.OrderTransactionArray) { if (orderTransaction.Transaction != null && orderTransaction.Transaction.Item != null && orderTransaction.Transaction.Item.ItemID == itemID.ToString()) return true; if (orderTransaction.Order != null && orderTransaction.Order.TransactionArray != null) { foreach (TransactionType transaction in orderTransaction.Order.TransactionArray) { if (transaction.Item != null && transaction.Item.ItemID == itemID.ToString()) return true; } } } } } } else { string error = ""; foreach (ErrorType err in response.Errors) error += err.LongMessage + Environment.NewLine; throw new Exception(error); } } catch (Exception ex) { if (nbRetry < ServiceParametersHelper.nbAPIRetry()) this.UserWonTheItem(itemID, nbRetry + 1); else { Logger.CreateLog("Error__UserWonTheItem", itemID.ToString(), ex, EnumLogLevel.ERROR); throw ex; } } Logger.CreateLog("Ending__UserWonTheItem", itemID.ToString(), null, EnumLogLevel.INFO); return false; }
private bool IsUserWinning(Snipe snipe, int nbRetry) { Logger.CreateLog("Beginning__IsUserWinning", snipe.ItemID.ToString(), null, EnumLogLevel.INFO); string callname = "GetMyeBayBuying"; int nbPage = 0; try { this.BuildService(callname); GetMyeBayBuyingRequestType request = new GetMyeBayBuyingRequestType(); request.Version = _version; request.BidList = new ItemListCustomizationType(); request.BidList.Include = true; request.BidList.IncludeSpecified = true; request.BidList.ListingType = ListingTypeCodeType.Chinese; request.BidList.ListingTypeSpecified = true; request.BidList.Pagination = new PaginationType(); request.BidList.Pagination.EntriesPerPage = 25; request.BidList.Pagination.EntriesPerPageSpecified = true; request.BidList.Pagination.PageNumber = 1; request.BidList.Pagination.PageNumberSpecified = true; DetailLevelCodeType level = DetailLevelCodeType.ReturnAll; List<DetailLevelCodeType> l = new List<DetailLevelCodeType>(); l.Add(level); request.DetailLevel = l.ToArray(); List<string> outputs = new List<string>(); outputs.Add("BidList.ItemArray"); outputs.Add("BidList.PaginationResult"); request.OutputSelector = outputs.ToArray(); GetMyeBayBuyingResponseType response = this.service.GetMyeBayBuying(request); if (response.Ack == AckCodeType.Success) { if (response.BidList != null) nbPage = response.BidList.PaginationResult.TotalNumberOfPages; // There must be at least 1 page if (nbPage > 0) { // We loop throw the pages for (int i = 1; i <= response.BidList.PaginationResult.TotalNumberOfPages; i++) { // Dont reload if we are on the first page if (i != 1) { request.BidList.Pagination = new PaginationType(); request.BidList.Pagination.EntriesPerPage = 25; request.BidList.Pagination.EntriesPerPageSpecified = true; request.BidList.Pagination.PageNumber = i; request.WonList.Pagination.PageNumberSpecified = true; response = service.GetMyeBayBuying(request); } foreach (ItemType items in response.BidList.ItemArray) { if (items.BiddingDetails != null && items.ItemID == snipe.ItemID.ToString()) { UltimateSniper_Services.ServiceOthers otherService = new UltimateSniper_Services.ServiceOthers(); snipe.ItemLastKnownPrice = otherService.ConvertValue(items.BiddingDetails.MaxBid.Value, items.BiddingDetails.MaxBid.currencyID.ToString(), User.UserCurrency.ToString()); if (items.BiddingDetails.QuantityWon == 1) return true; else return false; } } } } } else { string error = ""; foreach (ErrorType err in response.Errors) error += err.LongMessage + Environment.NewLine; throw new Exception(error); } } catch (Exception ex) { if (nbRetry < ServiceParametersHelper.nbAPIRetry()) this.IsUserWinning(snipe, nbRetry + 1); else { Logger.CreateLog("Error__IsUserWinning", snipe.ItemID.ToString(), ex, EnumLogLevel.ERROR); throw ex; } } Logger.CreateLog("Ending__IsUserWinning", snipe.ItemID.ToString(), null, EnumLogLevel.INFO); return false; }