public void ReviseFixedPriceItem() { ItemType itemTest = TestData.NewFixedPriceItem; Assert.IsNotNull(itemTest); // ReviseFixedPriceItemCall rviCall = new ReviseFixedPriceItemCall(this.apiContext); ItemType item = new ItemType(); item.ItemID = itemTest.ItemID; item.StartPrice = new AmountType(); item.StartPrice.Value = 2.89; item.StartPrice.currencyID = CurrencyCodeType.USD; rviCall.Item = item; rviCall.Execute(); // Let's wait for the server to "digest" the data. System.Threading.Thread.Sleep(1000); //check whether the call is success. Assert.IsTrue(rviCall.AbstractResponse.Ack==AckCodeType.Success || rviCall.AbstractResponse.Ack==AckCodeType.Warning,"do not success!"); // Call GetItem and then compare the startPrice. GetItemCall getItem = new GetItemCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; getItem.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); ItemType returnedItem = getItem.GetItem(itemTest.ItemID); Assert.AreEqual(returnedItem.StartPrice.Value, item.StartPrice.Value); // Update itemTest. TestData.NewFixedPriceItem = returnedItem; }
// // GetMyMessages // Returns information about the threaded messages sent to a user's My Messages mailbox. // http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/GetMyMessages.html // For maximum efficiency, make sure your application can first call GetMyMessages // with DetailLevel set to ReturnHeaders. // // With a detail level of ReturnHeaders or ReturnMessages, // GetMyMessages only accepts 10 unique message ID values, per request. // // GetMemberMessages // http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/GetMemberMessages.html // You can get all the messages sent within a specific time range // by providing StartCreationTime and EndCreationTime in your request. // Or you can specify an item's ItemID to get messages about an item. // After calling GetMemberMessages, inspect the children of the MemberMessages container. // For instance, if you want to know whether a message was previously answered, inspect the MessageStatus field. public static StringCollection GetAllMessageIds(AccountType account, DateTime startTime, DateTime endTime) { GetMyMessagesCall getMyMessageApiCall = new GetMyMessagesCall(account.SellerApiContext); getMyMessageApiCall.StartTime = startTime; getMyMessageApiCall.EndTime = endTime; DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnHeaders }; getMyMessageApiCall.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); StringCollection msgIds = new StringCollection(); for (int folderId = 0; folderId <= 1; folderId++) { getMyMessageApiCall.FolderID = folderId; getMyMessageApiCall.GetMyMessages(); MyMessagesMessageTypeCollection messages = getMyMessageApiCall.MessageList; foreach (MyMessagesMessageType msg in messages) { msgIds.Add(msg.MessageID); } } return(msgIds); } // GetAllMessageIds
public void GetProductSearchPageFull() { Assert.IsNotNull(TestData.Category2CS2); //here comes out hard code. //the category should be children books category. Assert.IsTrue((string.Compare(TestData.Category2CS2.CategoryID,childrenBookCategory,true)==0)); Int32Collection attributeSets = new Int32Collection(); CategoryType category = TestData.Category2CS2; Assert.Greater(category.CharacteristicsSets.Count,0); for(int i=0; i< category.CharacteristicsSets.Count;i++) { attributeSets.Add(category.CharacteristicsSets[i].AttributeSetID); } Assert.Greater(attributeSets.Count,0); GetProductSearchPageCall api = new GetProductSearchPageCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); api.AttributeSetIDList = attributeSets; api.Execute(); //check whether the call is success. Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning,"the call is failure!"); Assert.IsNotNull(api.ApiResponse.ProductSearchPage); Assert.Greater(api.ApiResponse.ProductSearchPage.Count,0); //the children category's SearchCharacteristicsSet property has value. Assert.IsNotNull(api.ApiResponse.ProductSearchPage[0].SearchCharacteristicsSet); Assert.Greater(api.ApiResponse.ProductSearchPage[0].SearchCharacteristicsSet.Characteristics.Count,0); //cache the children's mapping data. TestData.ProductSearchPages2 = api.ApiResponse.ProductSearchPage; }
public void AddToItemDescription() { string message, description, itemID, originalDes; ItemType item; bool isSuccess; Assert.IsNotNull(TestData.NewItem2, "Failed because no item available -- requires successful AddItem test"); AddToItemDescriptionCall api = new AddToItemDescriptionCall(this.apiContext); itemID = TestData.NewItem2.ItemID; originalDes = TestData.NewItem2.Description; description = "SDK appended text."; DetailLevelCodeTypeCollection detailLevel = new DetailLevelCodeTypeCollection(); DetailLevelCodeType type = DetailLevelCodeType.ReturnAll; detailLevel.Add(type); api.DetailLevelList = detailLevel; // Make API call. api.AddToItemDescription(itemID, description); System.Threading.Thread.Sleep(3000); //check whether the call is success. Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning, "do not success!"); isSuccess = ItemHelper.GetItem(TestData.NewItem2, this.apiContext, out message, out item); Assert.IsTrue(isSuccess, message); Assert.IsTrue(message == string.Empty, message); Assert.IsNotNull(item.Description, "the item description is null"); Assert.Greater(item.Description.Length, originalDes.Length); }
public void ReviseFixedPriceItem() { ItemType itemTest = TestData.NewFixedPriceItem; Assert.IsNotNull(itemTest); // ReviseFixedPriceItemCall rviCall = new ReviseFixedPriceItemCall(this.apiContext); ItemType item = new ItemType(); item.ItemID = itemTest.ItemID; item.StartPrice = new AmountType(); item.StartPrice.Value = 2.89; item.StartPrice.currencyID = CurrencyCodeType.USD; rviCall.Item = item; rviCall.Execute(); // Let's wait for the server to "digest" the data. System.Threading.Thread.Sleep(1000); //check whether the call is success. Assert.IsTrue(rviCall.AbstractResponse.Ack == AckCodeType.Success || rviCall.AbstractResponse.Ack == AckCodeType.Warning, "do not success!"); // Call GetItem and then compare the startPrice. GetItemCall getItem = new GetItemCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; getItem.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); ItemType returnedItem = getItem.GetItem(itemTest.ItemID); Assert.AreEqual(returnedItem.StartPrice.Value, item.StartPrice.Value); // Update itemTest. TestData.NewFixedPriceItem = returnedItem; }
public void GetAdFormatLeads() { ItemType itemTest = TestData.NewItem; Assert.IsNotNull(itemTest); // GetAdFormatLeadsCall api = new GetAdFormatLeadsCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); api.ItemID = itemTest.ItemID; // Negative test. ApiException gotException = null; try { api.GetAdFormatLeads(api.ItemID); } catch (ApiException ex) { gotException = ex; } Assert.IsNotNull(gotException); Assert.AreEqual(gotException.Errors[0].ErrorCode, "580"); }
public void GetProductSearchPage() { Assert.IsNotNull(TestData.Category2CS); // Int32Collection l = new Int32Collection(); for(int i = 0; i < TestData.Category2CS.Count; i++ ) { CategoryType c = TestData.Category2CS[i]; if( c.ProductSearchPageAvailableSpecified && c.ProductSearchPageAvailable && c.CharacteristicsSets != null && c.CharacteristicsSets.Count > 0 ) { l.Add(c.CharacteristicsSets[0].AttributeSetID); break; } } // GetProductSearchPageCall api = new GetProductSearchPageCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); api.AttributeSetIDList = l; // Make API call. ProductSearchPageTypeCollection searchPages = api.GetProductSearchPage(); Assert.IsNotNull(searchPages); Assert.IsTrue(searchPages.Count > 0); TestData.ProductSearchPages = searchPages; }
public void GetCategories() { bool isValid=true; GetCategoriesCall api = new GetCategoriesCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); api.LevelLimit = 1; api.ViewAllNodes = true; api.Timeout = 300000; // CategoryTypeCollection cats = api.GetCategories(); //check whether the call is success. Assert.IsTrue(api.ApiResponse.Ack==AckCodeType.Success || api.ApiResponse.Ack==AckCodeType.Warning,"do not success!"); Assert.IsNotNull(cats); Assert.IsTrue(cats.Count > 0); //the return category's level must be 1. foreach(CategoryType category in cats) { if(category.CategoryLevel!=1) { isValid=false; break; } } Assert.IsTrue(isValid,"the return value is not valid"); // Save the result. TestData.Categories = cats; }
public void GetCategories() { bool isValid = true; GetCategoriesCall api = new GetCategoriesCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); api.LevelLimit = 1; api.ViewAllNodes = true; api.Timeout = 300000; // CategoryTypeCollection cats = api.GetCategories(); //check whether the call is success. Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning, "do not success!"); Assert.IsNotNull(cats); Assert.IsTrue(cats.Count > 0); //the return category's level must be 1. foreach (CategoryType category in cats) { if (category.CategoryLevel != 1) { isValid = false; break; } } Assert.IsTrue(isValid, "the return value is not valid"); // Save the result. TestData.Categories = cats; }
// Given a time period specified by startDate and endDate, returns all the order ids created in that period. public static StringCollection GetAllOrderIds(AccountType account, DateTime startDate, DateTime endDate) { if (account.SellerApiContext == null) { return(null); } TimeFilter timeFilter = new TimeFilter(); timeFilter.TimeFrom = startDate; timeFilter.TimeTo = endDate; GetOrdersCall getOrdersApiCall = new GetOrdersCall(account.SellerApiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnSummary }; getOrdersApiCall.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); getOrdersApiCall.GetOrders(timeFilter, TradingRoleCodeType.Seller, OrderStatusCodeType.All); StringCollection orderIds = new StringCollection(); foreach (OrderType order in getOrdersApiCall.OrderList) { orderIds.Add(order.OrderID); } return(orderIds); }
public void GetCategory2CS() { GetCategory2CSCall api = new GetCategory2CSCall(this.apiContext); // Return version only DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); api.CategoryID = "279"; //Children's Book //api.CategoryID = "64355"; //Cell Phones api.Timeout = 300000; string message=string.Empty; // Make API call. CategoryTypeCollection cats = api.GetCategory2CS(); Assert.IsNotNull(cats); Assert.IsNotNull(api.AttributeSystemVersionResponse); int ver = Int32.Parse(api.AttributeSystemVersionResponse); Assert.IsTrue(ver > 0); Assert.IsNotNull(api.SiteWideCharacteristicList); TestData.Category2CS = cats; IAttributesMaster attrMaster = new AttributesMaster(); ICategoryCSProvider catCSDownLoader = new CategoryCSDownloader(apiContext); attrMaster.CategoryCSProvider = catCSDownLoader; int[] catIds = catCSDownLoader.GetSiteWideCharSetsAttrIds("48514"); Assert.IsNotNull(catIds); }
public void GetSellerList() { Assert.IsNotNull(TestData.NewItem, "Failed because no item available -- requires successful AddItem test"); // GetSellerListCall gsl = new GetSellerListCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; gsl.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); // Time filter System.DateTime calTo = System.DateTime.Now.AddHours(1); System.DateTime calFrom = System.DateTime.Now.AddHours(-2); TimeFilter tf = new TimeFilter(calFrom, calTo); gsl.EndTimeFilter = tf; // Pagination PaginationType pt = new PaginationType(); pt.EntriesPerPage = 100; pt.EntriesPerPageSpecified = true; pt.PageNumber = 1; pt.PageNumberSpecified = true; gsl.Pagination = pt; // gsl.Execute(); ItemTypeCollection items = gsl.ApiResponse.ItemArray; Assert.IsNotNull(items); Assert.IsTrue(items.Count > 0); ItemType foundItem = findItem(items, TestData.NewItem.ItemID); Assert.IsNotNull(foundItem, "item not found"); }
public void GetSellerList() { Assert.IsNotNull(TestData.NewItem, "Failed because no item available -- requires successful AddItem test"); // GetSellerListCall gsl = new GetSellerListCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; gsl.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); // Time filter System.DateTime calTo = System.DateTime.Now.AddHours(10); System.DateTime calFrom = System.DateTime.Now.AddHours(-20); TimeFilter tf = new TimeFilter(calFrom, calTo); gsl.EndTimeFilter = tf; // Pagination PaginationType pt = new PaginationType(); pt.EntriesPerPage = 100; pt.EntriesPerPageSpecified = true; pt.PageNumber = 1; pt.PageNumberSpecified = true; gsl.Pagination = pt; // gsl.Execute(); ItemTypeCollection items = gsl.ApiResponse.ItemArray; Assert.IsNotNull(items); Assert.IsTrue(items.Count > 0); ItemType foundItem = findItem(items, TestData.NewItem.ItemID); Assert.IsNotNull(foundItem, "item not found"); }
} // GetAllOrders public static bool GetBuyerFeedbackLeft(AccountType account, String buyerId, String orderId) { //bool sellerLeftFeedback = false; //bool buyerLeftFeedback = false; GetFeedbackCall getFeedbackApiCall = new GetFeedbackCall(account.SellerApiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; getFeedbackApiCall.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); getFeedbackApiCall.OrderLineItemID = orderId; try { FeedbackDetailTypeCollection feedbacks = getFeedbackApiCall.GetFeedback(); foreach (FeedbackDetailType feedback in feedbacks) { //if (feedback.CommentingUser == account.ebayAccount) // sellerLeftFeedback = true; if (feedback.CommentingUser == buyerId) { return(true); } } } catch (System.Exception ex) { Logger.WriteSystemLog(String.Format("GetFeedback failed with error msg={0}", ex.Message)); Logger.WriteSystemLog(String.Format("Transaction with BuyerId={0} maybe happened more than 90 days.", buyerId)); return(true); } return(false); }
/// <summary> /// can not get a category accordling to my function. ///otherwise ,there is an effeciency problem. ///so, Comment it. /// </summary> //[Test] public void GetAdFormatLeadsFull() { TestData.AdFormatItem = addAdFormatItem(); ItemType item = TestData.AdFormatItem; Assert.IsNotNull(item); // GetAdFormatLeadsCall api = new GetAdFormatLeadsCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); string itemID = item.ItemID; bool ncludeMemberMessages = true; MessageStatusTypeCodeType status = MessageStatusTypeCodeType.Unanswered; DateTime startCreationTime = DateTime.Now.AddDays(-1); DateTime endCreationTime = DateTime.Now; AdFormatLeadTypeCollection adFormat = api.GetAdFormatLeads(itemID, status, ncludeMemberMessages, startCreationTime, endCreationTime); //check whether the call is success. Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning, "do not success!"); Assert.IsNotNull(adFormat); }
public void GetCategoryFeatures() { GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); api.LevelLimit = 1; api.ViewAllNodes = true; // Make API call. CategoryFeatureTypeCollection features = api.GetCategoryFeatures(); //check whether the call is success. Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success,"the call is failure!"); Assert.IsNotNull(features); Assert.IsTrue(features.Count > 0); Assert.IsNotNull(api.ApiResponse.CategoryVersion); // Testing GetCategoryFeaturesHelper this.apiContext.Site = SiteCodeType.Austria; GetCategoryFeaturesHelper helper = new GetCategoryFeaturesHelper(this.apiContext); Assert.IsTrue(helper.hasCategoryFeatures(SiteCodeType.Austria)); this.apiContext.Site = SiteCodeType.China; helper.loadCategoryFeatures(this.apiContext); Assert.IsTrue(helper.hasCategoryFeatures(SiteCodeType.Austria)); Assert.IsTrue(helper.hasCategoryFeatures(SiteCodeType.China)); this.apiContext.Site = SiteCodeType.US; helper.loadCategoryFeatures(this.apiContext); Assert.IsTrue(helper.hasCategoryFeatures(SiteCodeType.Austria)); Assert.IsTrue(helper.hasCategoryFeatures(SiteCodeType.China)); Assert.IsTrue(helper.hasCategoryFeatures(SiteCodeType.US)); // FeatureDefinitionsType USFeatures = helper.getSiteFeatures(SiteCodeType.US); Assert.IsNotNull(USFeatures); System.Console.WriteLine(USFeatures.ToString()); }
public void GetCategoryListings() { GetCategoryListingsCall api = new GetCategoryListingsCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); //api.CategoryID = "37906"; api.CategoryID = "279"; api.ItemTypeFilter = ItemTypeFilterCodeType.AllItems; api.Currency = CurrencyCodeType.USD; api.OrderBy = CategoryListingsOrderCodeType.SortByPriceAsc; // Pagination PaginationType pt = new PaginationType(); pt.EntriesPerPage = 50; pt.EntriesPerPageSpecified = true; pt.PageNumber = 1; pt.PageNumberSpecified = true; api.Pagination = pt; // Make API call. ItemTypeCollection items = api.GetCategoryListings(api.CategoryID); //check whether the call is success. Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning,"the call is failure!"); Assert.IsNotNull(items); Assert.IsTrue(items.Count > 0); TestData.CategoryListings = items; }
public void RelistFixedPriceItem() { Assert.IsNotNull(TestData.EndedFixedPriceItem); // RelistFixedPriceItemCall rviCall = new RelistFixedPriceItemCall(this.apiContext); ItemType item = new ItemType(); item.ItemID = TestData.EndedFixedPriceItem.ItemID; item.StartPrice = new AmountType(); item.StartPrice.Value = 1.98; item.StartPrice.currencyID = CurrencyCodeType.USD; rviCall.RelistFixedPriceItem(item, null); // Let's wait for the server to "digest" the data. System.Threading.Thread.Sleep(1000); // Call GetItem and then compare the startPrice. GetItemCall getItem = new GetItemCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; getItem.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); ItemType returnedItem = getItem.GetItem(item.ItemID); // Make sure it's relisted. /* Assert.AreEqual(returnedItem.ListingDetails.getRelistedItemID().Value, TestData.EndedItem); */ Assert.AreEqual(returnedItem.StartPrice.Value, item.StartPrice.Value); // End the new created item. EndItemCall api = new EndItemCall(this.apiContext); // Set the item to be ended. api.ItemID = item.ItemID; api.EndingReason = EndReasonCodeType.NotAvailable; api.Execute(); }
} // GetMyActiveListing public static string GetMyEbaySelling(AccountType account) { if (account.SellerApiContext == null) { return(null); } GetMyeBaySellingCall getMyeBaySellingApiCall = new GetMyeBaySellingCall(account.SellerApiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnSummary }; getMyeBaySellingApiCall.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); getMyeBaySellingApiCall.SellingSummary = new eBay.Service.Core.Soap.ItemListCustomizationType(); getMyeBaySellingApiCall.SellingSummary.Include = true; getMyeBaySellingApiCall.ActiveList = new eBay.Service.Core.Soap.ItemListCustomizationType(); getMyeBaySellingApiCall.ActiveList.Include = true; getMyeBaySellingApiCall.ActiveList.IncludeNotes = true; getMyeBaySellingApiCall.ActiveList.ListingType = ListingTypeCodeType.FixedPriceItem; getMyeBaySellingApiCall.ActiveList.Pagination = new PaginationType(); getMyeBaySellingApiCall.ActiveList.Pagination.EntriesPerPage = 10; getMyeBaySellingApiCall.ActiveList.Pagination.PageNumber = 1; getMyeBaySellingApiCall.GetMyeBaySelling(); AmountType amountLimitRemaining = getMyeBaySellingApiCall.Summary.AmountLimitRemaining; long quantityLimitRemaining = getMyeBaySellingApiCall.Summary.QuantityLimitRemaining; PaginatedItemArrayType paginatedItemArray = getMyeBaySellingApiCall.ActiveListReturn; return(null); }
public void GetAdFormatLeads() { ItemType itemTest = TestData.NewItem; Assert.IsNotNull(itemTest); // GetAdFormatLeadsCall api = new GetAdFormatLeadsCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); api.ItemID = itemTest.ItemID; // Negative test. ApiException gotException = null; try { api.GetAdFormatLeads(api.ItemID); } catch(ApiException ex) { gotException = ex; } Assert.IsNotNull(gotException); Assert.AreEqual(gotException.Errors[0].ErrorCode, "580"); }
/// <summary> /// set basic info for GetCategoryFeaturesCall /// </summary> /// <param name="api"></param> private static void setBasicInfo(ref GetCategoryFeaturesCall api) { DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.Site = SiteCodeType.US; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); }
public void GetDescriptionTemplates() { GetDescriptionTemplatesCall api = new GetDescriptionTemplatesCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); api.Execute(); Assert.IsNotNull(api.ApiResponse.DescriptionTemplate); }
/// <summary> /// init the call /// </summary> /// <param name="api"></param> private static void setBasicInfo(ref GetCategoriesCall api) { //set basic info to the call api.CategorySiteID = Convert.ToString(0); DetailLevelCodeTypeCollection detailLevel = new DetailLevelCodeTypeCollection(); DetailLevelCodeType type = DetailLevelCodeType.ReturnAll; detailLevel.Add(type); api.DetailLevelList = detailLevel; }
} // GetAllMessageByIds // Get all messages between buyers and sellers. public static bool GetAllMessages(AccountType account, DateTime startTime, DateTime endTime) { GetMyMessagesCall getMyMessageApiCall = new GetMyMessagesCall(account.SellerApiContext); getMyMessageApiCall.StartTime = startTime; getMyMessageApiCall.EndTime = endTime; DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnHeaders }; getMyMessageApiCall.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); getMyMessageApiCall.GetMyMessages(); MyMessagesMessageTypeCollection messages = getMyMessageApiCall.MessageList; foreach (MyMessagesMessageType msg in messages) { string msgId = msg.MessageID; GetMyMessagesCall getMyMessageApiCall2 = new GetMyMessagesCall(account.SellerApiContext); StringCollection msgIds = new StringCollection(); msgIds.Add(msgId); getMyMessageApiCall2.MessageIDList = msgIds; detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnMessages }; getMyMessageApiCall2.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); getMyMessageApiCall2.GetMyMessages(); MyMessagesMessageType msg2 = getMyMessageApiCall2.MessageList[0]; EbayMessageType ebayMsg = new EbayMessageType(); ebayMsg.EbayMessageId = msgId; ebayMsg.SellerName = account.ebayAccount; ebayMsg.MessageType = msg2.MessageType.ToString(); ebayMsg.QuestionType = msg2.QuestionType.ToString(); ebayMsg.IsRead = msg2.Read; ebayMsg.IsReplied = msg2.Replied; ebayMsg.IsResponseEnabled = msg2.ResponseDetails != null ? msg2.ResponseDetails.ResponseEnabled : false; ebayMsg.ResponseURL = msg2.ResponseDetails != null ? msg2.ResponseDetails.ResponseURL : ""; ebayMsg.UserResponseDate = msg2.ResponseDetails != null ? msg2.ResponseDetails.UserResponseDate : DateTime.MinValue; ebayMsg.ReceiveDate = msg2.ReceiveDate; ebayMsg.RecipientUserId = msg2.RecipientUserID; ebayMsg.Sender = msg2.Sender; ebayMsg.Subject = msg2.Subject; ebayMsg.IsHighPriority = msg2.HighPriority; ebayMsg.Content = msg2.Content; ebayMsg.Text = msg2.Text; ebayMsg.ExternalMessageId = msg2.ExternalMessageID; ebayMsg.FolderId = msg2.Folder != null ? msg2.Folder.FolderID : -1; ebayMsg.ItemID = msg2.ItemID; ebayMsg.ItemTitle = msg2.ItemTitle; ebayMsg.ItemEndTime = msg2.ItemEndTime; ebayMsg.ListingStatus = msg2.ListingStatus.ToString(); EbayMessageDAL.InsertOneMessage(ebayMsg); } return(true); } // GetAllMessages
public void GetTaxTable() { GetTaxTableCall api = new GetTaxTableCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); // Make API call. TestData.TaxTable = api.GetTaxTable(); }
// Ebay API: GetItem // http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/GetItem.html // Use this call to retrieve the data for a single item listed on an eBay site public static bool GetEbayItem(AccountType account) { GetItemCall getItemApiCall = new GetItemCall(account.SellerApiContext); getItemApiCall.ItemID = "130824387148"; DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnSummary }; getItemApiCall.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); ItemType itemType = getItemApiCall.GetItem("130824387148"); return true; }
public void GetUser() { GetUserCall api = new GetUserCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); UserType user = api.GetUser(); Assert.IsNotNull(user.Email); Assert.IsNotNull(user.EIASToken); userType = user; }
public void GetCategoryFeaturesFull() { GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnSummary }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); api.Execute(); //check whether the call is success. Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning,"the call is failure!"); Assert.IsNotNull(api.ApiResponse.FeatureDefinitions); }
public void GetCategoryFeaturesFull() { GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnSummary }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); api.Execute(); //check whether the call is success. Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning, "the call is failure!"); Assert.IsNotNull(api.ApiResponse.FeatureDefinitions); }
// Ebay API: GetItem // http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/GetItem.html // Use this call to retrieve the data for a single item listed on an eBay site public static bool GetEbayItem(AccountType account) { GetItemCall getItemApiCall = new GetItemCall(account.SellerApiContext); getItemApiCall.ItemID = "130824387148"; DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnSummary }; getItemApiCall.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); ItemType itemType = getItemApiCall.GetItem("130824387148"); return(true); }
public void GetCategoryMappings() { GetCategoryMappingsCall api = new GetCategoryMappingsCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); // Make API call. api.GetCategoryMappings(); //check whether the call is success. Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning,"the call is failure!"); CategoryMappingTypeCollection mappings = api.ApiResponse.CategoryMapping; Assert.IsNotNull(mappings); Assert.IsTrue(mappings.Count > 0); }
public void GetMessagePreferences() { GetUserCall userApi = new GetUserCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] {DetailLevelCodeType.ReturnAll}; userApi.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); UserType user = userApi.GetUser(); Assert.IsNotNull(user.Email); Assert.IsNotNull(user.EIASToken); GetMessagePreferencesCall api = new GetMessagePreferencesCall(this.apiContext); api.Site = SiteCodeType.US; // ASQPreferencesType resp = api.GetMessagePreferences(user.UserID, true); Assert.IsNotNull(resp); Console.WriteLine("T_100_GetMessagesPreferencesLibrary: " + resp.ToString()); }
private ItemType addAdFormatItem() { ItemType item = ItemHelper.BuildItem(); GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); api.LevelLimit = 10; api.ViewAllNodes = true; bool viewAllNodes = true; bool isSuccess; CategoryTypeCollection categories; string message; //get an item which supports the Ad-format isSuccess = CategoryHelper.GetAdFormatCategory(this.apiContext, 1, out categories, out message); Assert.IsTrue(isSuccess, message); Assert.IsNotNull(categories); Assert.Greater(categories.Count, 0); Assert.IsTrue(categories[0].CategoryID != string.Empty); item.PrimaryCategory.CategoryID = categories[0].CategoryID; // get the list duration value according to the category CategoryFeatureTypeCollection features = api.GetCategoryFeatures(item.PrimaryCategory.CategoryID, api.LevelLimit, viewAllNodes, null, true); Assert.IsNotNull(features); Assert.Greater(features.Count, 0); Assert.IsNotNull(features[0].ListingDuration); Assert.Greater(features[0].ListingDuration.Count, 0); //modify item property to adapt the AdFormatItem item.ListingType = ListingTypeCodeType.AdType; item.ListingDuration = features[0].ListingDuration[0].Value.ToString(); // Execute the API. FeeTypeCollection fees; // AddItem AddItemCall addItem = new AddItemCall(this.apiContext); fees = addItem.AddItem(item); Assert.IsNotNull(fees); // Save the result. return(item); }
public void GetCategoryMappings() { GetCategoryMappingsCall api = new GetCategoryMappingsCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); // Make API call. api.GetCategoryMappings(); //check whether the call is success. Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning, "the call is failure!"); CategoryMappingTypeCollection mappings = api.ApiResponse.CategoryMapping; Assert.IsNotNull(mappings); Assert.IsTrue(mappings.Count > 0); }
public void GetSellerListFull() { Assert.IsNotNull(TestData.NewItem2, "Failed because no item available -- requires successful AddItem test"); GetSellerListCall gsl = new GetSellerListCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; //specify information gsl.AdminEndedItemsOnly = false; gsl.CategoryID = int.Parse(TestData.NewItem2.PrimaryCategory.CategoryID); gsl.StartTimeFrom = DateTime.Now.AddDays(-2); gsl.StartTimeTo = DateTime.Now.AddDays(1); //gsl.GranularityLevel=GranularityLevelCodeType.Fine;//if specify GranularityLevel, the DetailLevelList is ignored. gsl.IncludeWatchCount = true; gsl.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); // Pagination PaginationType pt = new PaginationType(); pt.EntriesPerPage = 100; pt.EntriesPerPageSpecified = true; pt.PageNumber = 1; pt.PageNumberSpecified = true; gsl.Pagination = pt; gsl.Sort = 1; //descending sort // gsl.Execute(); //check whether the call is success. Assert.IsTrue(gsl.AbstractResponse.Ack == AckCodeType.Success || gsl.AbstractResponse.Ack == AckCodeType.Warning, "do not success!"); ItemTypeCollection items = gsl.ApiResponse.ItemArray; Assert.IsNotNull(items); Assert.IsTrue(items.Count > 0); ItemType foundItem = findItem(items, TestData.NewItem2.ItemID); Assert.IsNotNull(foundItem, "item not found"); ItemType item = items[0]; Assert.IsNotNull(item.HitCount); Assert.IsNotNull(gsl.ApiResponse.PaginationResult); Assert.IsNotNull(gsl.ApiResponse.Seller); }
public void GetAttributesCS() { GetAttributesCSCall api = new GetAttributesCSCall(this.apiContext); // Return version number only. DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnSummary }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); // Make API call. String csXml = api.GetAttributesCS(); //check whether the call is success. Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning,"the call is failure!"); Assert.IsNull(csXml); Assert.IsNotNull(api.AttributeVersionResult); int ver = Int32.Parse(api.AttributeVersionResult); Assert.IsTrue(ver > 0); }
public void GetAttributesXSL() { GetAttributesXSLCall api = new GetAttributesXSLCall(this.apiContext); // Return version number only. DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); // Make API call. XSLFileTypeCollection files = api.GetAttributesXSL(); //check whether the call is success. Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning,"the call is failure!"); Assert.IsNotNull(files); Assert.IsTrue(files.Count > 0); Assert.IsNotNull(files[0].FileName); Assert.IsNotNull(files[0].FileVersion); Assert.IsNotNull(files[0].FileContent); }
public void GetMessagePreferences() { GetUserCall userApi = new GetUserCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; userApi.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); UserType user = userApi.GetUser(); Assert.IsNotNull(user.Email); Assert.IsNotNull(user.EIASToken); GetMessagePreferencesCall api = new GetMessagePreferencesCall(this.apiContext); api.Site = SiteCodeType.US; // ASQPreferencesType resp = api.GetMessagePreferences(user.UserID, true); Assert.IsNotNull(resp); Console.WriteLine("T_100_GetMessagesPreferencesLibrary: " + resp.ToString()); }
public void GetCategoryFeaturesFull2() { GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); FeatureIDCodeTypeCollection features = new FeatureIDCodeTypeCollection(); FeatureIDCodeType feature = FeatureIDCodeType.BestOfferEnabled; features.Add(feature); api.FeatureIDList = features; api.CategoryID = COOKBOOKSCATEGORYID; api.Execute(); //check whether the call is success. Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning, "the call is failure!"); Assert.IsNotNull(api.ApiResponse.FeatureDefinitions); Assert.AreEqual(api.ApiResponse.Category[0].CategoryID, COOKBOOKSCATEGORYID); }
public void GetSellerListFull() { Assert.IsNotNull(TestData.NewItem2, "Failed because no item available -- requires successful AddItem test"); GetSellerListCall gsl = new GetSellerListCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; //specify information gsl.AdminEndedItemsOnly=false; gsl.CategoryID=int.Parse(TestData.NewItem2.PrimaryCategory.CategoryID); gsl.StartTimeFrom=DateTime.Now.AddDays(-2); gsl.StartTimeTo=DateTime.Now.AddDays(1); //gsl.GranularityLevel=GranularityLevelCodeType.Fine;//if specify GranularityLevel, the DetailLevelList is ignored. gsl.IncludeWatchCount=true; gsl.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); // Pagination PaginationType pt = new PaginationType(); pt.EntriesPerPage = 100; pt.EntriesPerPageSpecified = true; pt.PageNumber = 1; pt.PageNumberSpecified = true; gsl.Pagination = pt; gsl.Sort=1;//descending sort // gsl.Execute(); //check whether the call is success. Assert.IsTrue(gsl.AbstractResponse.Ack==AckCodeType.Success || gsl.AbstractResponse.Ack==AckCodeType.Warning,"do not success!"); ItemTypeCollection items = gsl.ApiResponse.ItemArray; Assert.IsNotNull(items); Assert.IsTrue(items.Count > 0); ItemType foundItem = findItem(items, TestData.NewItem2.ItemID); Assert.IsNotNull(foundItem, "item not found"); ItemType item=items[0]; Assert.IsNotNull(item.HitCount); Assert.IsNotNull(gsl.ApiResponse.PaginationResult); Assert.IsNotNull(gsl.ApiResponse.Seller); }
private void SyncNameRecommendationTypes() { GetCategorySpecificsCall api = new GetCategorySpecificsCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); eBay.Service.Core.Soap.StringCollection strCol = new eBay.Service.Core.Soap.StringCollection(); strCol.Add(this.CategoryID); api.CategoryIDList = strCol; api.Execute(); NameRecommendationTypeCollection nameRecommendationTypes = null; if ((api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning) && api.ApiResponse.Recommendations != null && api.ApiResponse.Recommendations.Count > 0) { nameRecommendationTypes = api.ApiResponse.Recommendations[0].NameRecommendation; } this.nameRecommendationTypes = nameRecommendationTypes; }
// // GetAccount // http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/GetAccount.html // public static string GetAccount(AccountType account) { if (account.SellerApiContext == null) { return(null); } GetAccountCall getAccountApiCall = new GetAccountCall(account.SellerApiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnSummary }; getAccountApiCall.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); getAccountApiCall.AccountEntrySortType = AccountEntrySortTypeCodeType.AccountEntryCreatedTimeAscending; // AccountHistorySelection // - BetweenSpecifiedDates, BeginDate/EndDate must be used. // - CustomCode // - LastInvoice // - SpecifiedInvoice, InvoiceDate must be used. getAccountApiCall.AccountHistorySelection = AccountHistorySelectionCodeType.LastInvoice; getAccountApiCall.BeginDate = new System.DateTime(2012, 10, 30); getAccountApiCall.EndDate = DateTime.Now; getAccountApiCall.ExcludeBalance = false; getAccountApiCall.ExcludeSummary = false; getAccountApiCall.Pagination = new eBay.Service.Core.Soap.PaginationType(); getAccountApiCall.Pagination.PageNumber = 1; getAccountApiCall.Pagination.EntriesPerPage = 10; getAccountApiCall.Version = "705"; getAccountApiCall.StartTimeFilter = new eBay.Service.Core.Soap.TimeFilter(); getAccountApiCall.StartTimeFilter.TimeFrom = new System.DateTime(2012, 10, 30); getAccountApiCall.StartTimeFilter.TimeTo = DateTime.Now; //AccountHistorySelectionCodeType accountHistorySelectionCodeType = AccountHistorySelectionCodeType.BetweenSpecifiedDates; getAccountApiCall.GetAccount(AccountHistorySelectionCodeType.LastInvoice); AccountEntriesType accountEntriesType = getAccountApiCall.AccountEntries; AccountSummaryType accountSummary = getAccountApiCall.AccountSummary; return(null); }
public void SetUserNotes() { Assert.IsNotNull(TestData.NewItem2, "Failed because no item available -- requires successful AddItem test"); SetUserNotesCall api = new SetUserNotesCall(this.apiContext); api.Action = SetUserNotesActionCodeType.AddOrUpdate; api.ItemID = TestData.NewItem2.ItemID; api.NoteText = "Notes for eBay SDK sanity test."; DetailLevelCodeTypeCollection detailLevel = new DetailLevelCodeTypeCollection(); DetailLevelCodeType type = DetailLevelCodeType.ReturnAll; detailLevel.Add(type); api.DetailLevelList = detailLevel; // Make API call. api.Execute(); System.Threading.Thread.Sleep(3000); //check whether the call is success. //eBayNotes can not get by calling GetItemCall. Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning, "do not success!"); }
public void GetCategoryFeatures() { GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); api.LevelLimit = 1; api.ViewAllNodes = true; // Make API call. CategoryFeatureTypeCollection features = api.GetCategoryFeatures(); //check whether the call is success. Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success, "the call is failure!"); Assert.IsNotNull(features); Assert.IsTrue(features.Count > 0); Assert.IsNotNull(api.ApiResponse.CategoryVersion); // Testing GetCategoryFeaturesHelper this.apiContext.Site = SiteCodeType.Austria; GetCategoryFeaturesHelper helper = new GetCategoryFeaturesHelper(this.apiContext); Assert.IsTrue(helper.hasCategoryFeatures(SiteCodeType.Austria)); this.apiContext.Site = SiteCodeType.China; helper.loadCategoryFeatures(this.apiContext); Assert.IsTrue(helper.hasCategoryFeatures(SiteCodeType.Austria)); Assert.IsTrue(helper.hasCategoryFeatures(SiteCodeType.China)); this.apiContext.Site = SiteCodeType.US; helper.loadCategoryFeatures(this.apiContext); Assert.IsTrue(helper.hasCategoryFeatures(SiteCodeType.Austria)); Assert.IsTrue(helper.hasCategoryFeatures(SiteCodeType.China)); Assert.IsTrue(helper.hasCategoryFeatures(SiteCodeType.US)); // FeatureDefinitionsType USFeatures = helper.getSiteFeatures(SiteCodeType.US); Assert.IsNotNull(USFeatures); System.Console.WriteLine(USFeatures.ToString()); }
public void RelistFixedPriceItem() { Assert.IsNotNull(TestData.EndedFixedPriceItem); // RelistFixedPriceItemCall rviCall = new RelistFixedPriceItemCall(this.apiContext); ItemType item = new ItemType(); item.ItemID = TestData.EndedFixedPriceItem.ItemID; item.StartPrice = new AmountType(); item.StartPrice.Value = 1.98; item.StartPrice.currencyID = CurrencyCodeType.USD; rviCall.RelistFixedPriceItem(item, null); // Let's wait for the server to "digest" the data. System.Threading.Thread.Sleep(1000); // Call GetItem and then compare the startPrice. GetItemCall getItem = new GetItemCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; getItem.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); ItemType returnedItem = getItem.GetItem(item.ItemID); // Make sure it's relisted. /* * Assert.AreEqual(returnedItem.ListingDetails.getRelistedItemID().Value, * TestData.EndedItem); */ Assert.AreEqual(returnedItem.StartPrice.Value, item.StartPrice.Value); // End the new created item. EndItemCall api = new EndItemCall(this.apiContext); // Set the item to be ended. api.ItemID = item.ItemID; api.EndingReason = EndReasonCodeType.NotAvailable; api.Execute(); }
/// <summary> /// can not get a category accordling to my function. ///otherwise ,there is an effeciency problem. ///so, Comment it. /// </summary> //[Test] public void GetAdFormatLeadsFull() { TestData.AdFormatItem = addAdFormatItem(); ItemType item = TestData.AdFormatItem; Assert.IsNotNull(item); // GetAdFormatLeadsCall api = new GetAdFormatLeadsCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll}; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); string itemID = item.ItemID; bool ncludeMemberMessages=true; MessageStatusTypeCodeType status= MessageStatusTypeCodeType.Unanswered; DateTime startCreationTime = DateTime.Now.AddDays(-1); DateTime endCreationTime = DateTime.Now; AdFormatLeadTypeCollection adFormat= api.GetAdFormatLeads(itemID,status, ncludeMemberMessages,startCreationTime,endCreationTime); //check whether the call is success. Assert.IsTrue(api.ApiResponse.Ack==AckCodeType.Success || api.ApiResponse.Ack==AckCodeType.Warning,"do not success!"); Assert.IsNotNull(adFormat); }
public void GetUserPreferences() { GetUserPreferencesCall api = new GetUserPreferencesCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); api.ShowBidderNoticePreferences = true; api.ShowCombinedPaymentPreferences = true; api.ShowCrossPromotionPreferences = true; api.ShowEndOfAuctionEmailPreferences = true; api.ShowSellerFavoriteItemPreferences = true; api.ShowSellerPaymentPreferences = true; // Make API call. api.Execute(); Assert.IsNotNull(api.ApiResponse.BidderNoticePreferences); Assert.IsNotNull(api.ApiResponse.CombinedPaymentPreferences); Assert.IsNotNull(api.ApiResponse.CrossPromotionPreferences); Assert.IsNotNull(api.ApiResponse.EndOfAuctionEmailPreferences); Assert.IsNotNull(api.ApiResponse.SellerPaymentPreferences); Assert.IsNotNull(api.ApiResponse.SellerPaymentPreferences); TestData.UserPreferencesResponse = (GetUserPreferencesResponseType)api.ApiResponse; }
// // GetAccount // http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/GetAccount.html // public static string GetAccount(AccountType account) { if (account.SellerApiContext == null) return null; GetAccountCall getAccountApiCall = new GetAccountCall(account.SellerApiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnSummary }; getAccountApiCall.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); getAccountApiCall.AccountEntrySortType = AccountEntrySortTypeCodeType.AccountEntryCreatedTimeAscending; // AccountHistorySelection // - BetweenSpecifiedDates, BeginDate/EndDate must be used. // - CustomCode // - LastInvoice // - SpecifiedInvoice, InvoiceDate must be used. getAccountApiCall.AccountHistorySelection = AccountHistorySelectionCodeType.LastInvoice; getAccountApiCall.BeginDate = new System.DateTime(2012, 10, 30); getAccountApiCall.EndDate = DateTime.Now; getAccountApiCall.ExcludeBalance = false; getAccountApiCall.ExcludeSummary = false; getAccountApiCall.Pagination = new eBay.Service.Core.Soap.PaginationType(); getAccountApiCall.Pagination.PageNumber = 1; getAccountApiCall.Pagination.EntriesPerPage = 10; getAccountApiCall.Version = "705"; getAccountApiCall.StartTimeFilter = new eBay.Service.Core.Soap.TimeFilter(); getAccountApiCall.StartTimeFilter.TimeFrom = new System.DateTime(2012, 10, 30); getAccountApiCall.StartTimeFilter.TimeTo = DateTime.Now; //AccountHistorySelectionCodeType accountHistorySelectionCodeType = AccountHistorySelectionCodeType.BetweenSpecifiedDates; getAccountApiCall.GetAccount(AccountHistorySelectionCodeType.LastInvoice); AccountEntriesType accountEntriesType = getAccountApiCall.AccountEntries; AccountSummaryType accountSummary = getAccountApiCall.AccountSummary; return null; }
/// <summary> /// get an item. /// </summary> /// <param name="itemGet"></param> /// <param name="apiContext"></param> /// <param name="message"></param> /// <param name="itemOut"></param> /// <returns></returns> public static bool GetItem(ItemType itemGet, ApiContext apiContext, out string message, out ItemType itemOut) { message = string.Empty; itemOut = null; bool includeCrossPromotion = true; bool includeItemSpecifics = true; bool includeTaxTable = true; bool includeWatchCount = true; try { GetItemCall api = new GetItemCall(apiContext); DetailLevelCodeType detaillevel = DetailLevelCodeType.ReturnAll; api.DetailLevelList = new DetailLevelCodeTypeCollection(new DetailLevelCodeType[] { detaillevel }); itemOut = api.GetItem(itemGet.ItemID, includeWatchCount, includeCrossPromotion, includeItemSpecifics, includeTaxTable, null, null, null, null, false); if (itemOut == null) { message = "do not get the item"; } if (itemOut.ItemID != itemGet.ItemID) { message = "the item getted is not the same as item wanted"; } } catch (Exception e) { message = e.Message; return(false); } return(true); }
/// <summary> /// set basic info for GetCategoryFeaturesCall /// </summary> /// <param name="api"></param> private static void setBasicInfo(ref GetCategoryFeaturesCall api) { DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.Site=SiteCodeType.US; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); }
public void AddItemFull3() { bool isSucess,isProductSearchPageAvailable; bool existing=false,isbnExisting=false; string message; Int32Collection attributes=new Int32Collection(); CategoryTypeCollection categories=null; CharacteristicsSetTypeCollection characteristics=null; ItemType item= ItemHelper.BuildItem(); //check whether the category is catalog enabled. isSucess=CategoryHelper.IsCatagoryEnabled(this.apiContext,PSPACATEGORYID.ToString(),CategoryEnableCodeType.ProductSearchPageAvailable,out isProductSearchPageAvailable,out message); Assert.IsTrue(isSucess,message); Assert.IsTrue(isProductSearchPageAvailable,message); isSucess=CategoryHelper.IsCatagoryEnabled(this.apiContext,PSPACATEGORYID.ToString(),CategoryEnableCodeType.CatalogEnabled,out isProductSearchPageAvailable,out message); Assert.IsTrue(isSucess,message); Assert.IsTrue(isProductSearchPageAvailable,message); //modify item information approporiately. item.PrimaryCategory.CategoryID=PSPACATEGORYID.ToString(); item.Description = "check whether the item can be added by GetProductSearchPage method way,This is a test item created by eBay SDK SanityTest."; //get characters information using GetCategory2CSCall GetCategory2CSCall csCall=new GetCategory2CSCall(this.apiContext); DetailLevelCodeTypeCollection levels=new DetailLevelCodeTypeCollection(); DetailLevelCodeType level=new DetailLevelCodeType(); level=DetailLevelCodeType.ReturnAll; levels.Add(level); csCall.DetailLevelList=levels; csCall.CategoryID=PSPACATEGORYID.ToString(); csCall.Execute(); //check whether the call is success. Assert.IsTrue(csCall.AbstractResponse.Ack==AckCodeType.Success || csCall.AbstractResponse.Ack==AckCodeType.Warning,"do not success!"); Assert.IsNotNull(csCall.ApiResponse.MappedCategoryArray); Assert.Greater(csCall.ApiResponse.MappedCategoryArray.Count,0); categories=csCall.ApiResponse.MappedCategoryArray; foreach(CategoryType category in categories) { if(string.Compare(category.CategoryID,PSPACATEGORYID)==0) { characteristics=category.CharacteristicsSets; existing= true; break; } } //confirm that the category was in the mapping category. Assert.IsTrue(existing,PSPACATEGORYID+" do not exist in the mapping category"); Assert.IsNotNull(characteristics); Assert.Greater(characteristics.Count,0); foreach(CharacteristicsSetType characteristic in characteristics) { attributes.Add(characteristic.AttributeSetID); } //confirm that there is real attributeset in the mapping category. Assert.AreEqual(attributes.Count,1);//there is only one AttributeSetID in the category 279. GetProductSearchPageCall searchPageCall=new GetProductSearchPageCall(this.apiContext); searchPageCall.AttributeSetIDList=attributes; DetailLevelCodeTypeCollection levels2=new DetailLevelCodeTypeCollection(); DetailLevelCodeType level2=new DetailLevelCodeType(); level2=DetailLevelCodeType.ReturnAll; levels2.Add(level2); searchPageCall.DetailLevelList=levels2; searchPageCall.Execute(); //check whether the call is success. Assert.IsTrue(searchPageCall.ApiResponse.Ack==AckCodeType.Success || searchPageCall.ApiResponse.Ack==AckCodeType.Warning,"do not success!"); Assert.AreEqual(searchPageCall.ApiResponse.ProductSearchPage.Count,1);//for the input attributeset id is only one. Assert.IsNotNull(searchPageCall.ApiResponse.ProductSearchPage[0].SearchCharacteristicsSet);//for the input attributeset id is only one. Assert.IsNotNull(searchPageCall.ApiResponse.ProductSearchPage[0].SearchCharacteristicsSet.Characteristics); Assert.Greater(searchPageCall.ApiResponse.ProductSearchPage[0].SearchCharacteristicsSet.Characteristics.Count,0); //check the isbn-13 attribute id exists and its value has not been changed. CharacteristicTypeCollection chs = searchPageCall.ApiResponse.ProductSearchPage[0].SearchCharacteristicsSet.Characteristics; foreach(CharacteristicType charactersic in chs) { //check whether the isbn attribute can be used if(charactersic.AttributeID==ISBN13ATTRIBUTEID && (string.Compare(charactersic.Label.Name,"ISBN-13",true)==0)) { isbnExisting=true; break; } } Assert.IsTrue(isbnExisting,"the isbn attribute id is not existing or has been changed!"); //using GetProductSearchResults call to find products. ProductSearchType productSearch=new ProductSearchType(); productSearch.AttributeSetID=attributes[0]; SearchAttributesTypeCollection searchAttributes=new SearchAttributesTypeCollection(); SearchAttributesType searchAttribute=new SearchAttributesType(); searchAttribute.AttributeID=ISBN13ATTRIBUTEID; ValTypeCollection vals=new ValTypeCollection(); ValType val=new ValType(); val.ValueLiteral=ISBN; vals.Add(val); searchAttribute.ValueList=vals; searchAttributes.Add(searchAttribute); productSearch.SearchAttributes=searchAttributes; GetProductSearchResultsCall searchResultsCall=new GetProductSearchResultsCall(this.apiContext); searchResultsCall.ProductSearchList=new ProductSearchTypeCollection(new ProductSearchType[]{productSearch}); searchResultsCall.Execute(); //check whether the call is success. Assert.IsTrue(searchResultsCall.ApiResponse.Ack==AckCodeType.Success || searchResultsCall.ApiResponse.Ack==AckCodeType.Warning,"do not success!"); Assert.Greater(searchResultsCall.ApiResponse.ProductSearchResult.Count,0); Assert.AreEqual(int.Parse(searchResultsCall.ApiResponse.ProductSearchResult[0].NumProducts),1); Assert.Greater(searchResultsCall.ApiResponse.ProductSearchResult[0].AttributeSet.Count,0); Assert.Greater(searchResultsCall.ApiResponse.ProductSearchResult[0].AttributeSet[0].ProductFamilies.Count,0); Assert.IsFalse(searchResultsCall.ApiResponse.ProductSearchResult[0].AttributeSet[0].ProductFamilies[0].hasMoreChildren); Assert.IsNotNull(searchResultsCall.ApiResponse.ProductSearchResult[0].AttributeSet[0].ProductFamilies[0].ParentProduct.productID); string productID=searchResultsCall.ApiResponse.ProductSearchResult[0].AttributeSet[0].ProductFamilies[0].ParentProduct.productID; ProductListingDetailsType plist=new ProductListingDetailsType(); plist.ProductID=productID; plist.IncludePrefilledItemInformation=true; plist.IncludeStockPhotoURL=true; item.ProductListingDetails=plist; FeeTypeCollection fees; VerifyAddItemCall vi = new VerifyAddItemCall(apiContext); fees = vi.VerifyAddItem(item); Assert.IsNotNull(fees); AddItemCall addItemCall = new AddItemCall(apiContext);; fees = addItemCall.AddItem(item); //check whether the call is success. Assert.IsTrue(addItemCall.AbstractResponse.Ack==AckCodeType.Success || addItemCall.AbstractResponse.Ack==AckCodeType.Warning,"do not success!"); Assert.IsTrue(item.ItemID!=string.Empty); Assert.IsNotNull(fees); //caution check ItemType itemOut; isSucess=ItemHelper.GetItem(item,this.apiContext,out message, out itemOut); Assert.IsTrue(isSucess,message); Assert.IsNotNull(itemOut,"Item is null"); Assert.Greater(itemOut.AttributeSetArray.Count,0); Assert.Greater(itemOut.AttributeSetArray[0].Attribute.Count,0); Assert.Greater(itemOut.AttributeSetArray[0].Attribute[0].Value.Count,0); }
// // GetMyMessages // Returns information about the threaded messages sent to a user's My Messages mailbox. // http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/GetMyMessages.html // For maximum efficiency, make sure your application can first call GetMyMessages // with DetailLevel set to ReturnHeaders. // // With a detail level of ReturnHeaders or ReturnMessages, // GetMyMessages only accepts 10 unique message ID values, per request. // // GetMemberMessages // http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/GetMemberMessages.html // You can get all the messages sent within a specific time range // by providing StartCreationTime and EndCreationTime in your request. // Or you can specify an item's ItemID to get messages about an item. // After calling GetMemberMessages, inspect the children of the MemberMessages container. // For instance, if you want to know whether a message was previously answered, inspect the MessageStatus field. public static StringCollection GetAllMessageIds(AccountType account, DateTime startTime, DateTime endTime) { GetMyMessagesCall getMyMessageApiCall = new GetMyMessagesCall(account.SellerApiContext); getMyMessageApiCall.StartTime = startTime; getMyMessageApiCall.EndTime = endTime; DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnHeaders }; getMyMessageApiCall.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); StringCollection msgIds = new StringCollection(); for (int folderId = 0; folderId <= 1; folderId++) { getMyMessageApiCall.FolderID = folderId; getMyMessageApiCall.GetMyMessages(); MyMessagesMessageTypeCollection messages = getMyMessageApiCall.MessageList; foreach (MyMessagesMessageType msg in messages) { msgIds.Add(msg.MessageID); } } return msgIds; }
public static List<EbayMessageType> GetAllMessageByIds(AccountType account, StringCollection msgIds) { List<EbayMessageType> messageList = new List<EbayMessageType>(); if (msgIds.Count > 10) { Logger.WriteSystemLog("[GetAllMessageByIds]: can only get at most 10 messages once."); return messageList; } GetMyMessagesCall getMyMessageApiCall = new GetMyMessagesCall(account.SellerApiContext); getMyMessageApiCall.MessageIDList = msgIds; DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnMessages }; getMyMessageApiCall.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); getMyMessageApiCall.GetMyMessages(); MyMessagesMessageTypeCollection messages = getMyMessageApiCall.MessageList; foreach (MyMessagesMessageType msg in messages) { // See if this message has already existed. String msgId = msg.MessageID; EbayMessageType tmpEbayMsg = EbayMessageDAL.GetOneMessage(msgId); if (tmpEbayMsg != null && tmpEbayMsg.EbayMessageId != "") { Logger.WriteSystemLog(string.Format("[GetAllMessageByIds]: message with id={0} has already existed, skip and continue.", msgId)); continue; } EbayMessageType ebayMsg = new EbayMessageType(); ebayMsg.EbayMessageId = msg.MessageID; ebayMsg.SellerName = account.ebayAccount; ebayMsg.MessageType = msg.MessageType.ToString(); ebayMsg.QuestionType = msg.QuestionType.ToString(); ebayMsg.IsRead = msg.Read; ebayMsg.IsReplied = msg.Replied; ebayMsg.IsResponseEnabled = msg.ResponseDetails != null ? msg.ResponseDetails.ResponseEnabled : false; ebayMsg.ResponseURL = msg.ResponseDetails != null ? msg.ResponseDetails.ResponseURL : ""; ebayMsg.UserResponseDate = msg.ResponseDetails != null ? msg.ResponseDetails.UserResponseDate : DateTime.MinValue; ebayMsg.ReceiveDate = msg.ReceiveDate; //ebayMsg.RecipientUserId = msg.RecipientUserID; ebayMsg.RecipientUserId = msg.SendToName; ebayMsg.Sender = msg.Sender; ebayMsg.Subject = msg.Subject; ebayMsg.IsHighPriority = msg.HighPriority; // The message body. Plain text. ebayMsg.Content = msg.Content; // This field contains message content, and can contain a threaded message. // Max length: 2 megabytes in size. ebayMsg.Text = msg.Text; ebayMsg.ExternalMessageId = msg.ExternalMessageID; ebayMsg.FolderId = msg.Folder != null ? msg.Folder.FolderID : -1; ebayMsg.ItemID = msg.ItemID; ebayMsg.ItemTitle = msg.ItemTitle; ebayMsg.ItemEndTime = msg.ItemEndTime; ebayMsg.ListingStatus = msg.ListingStatus.ToString(); messageList.Add(ebayMsg); } return messageList; }
public static string GetMyEbaySelling(AccountType account) { if (account.SellerApiContext == null) return null; GetMyeBaySellingCall getMyeBaySellingApiCall = new GetMyeBaySellingCall(account.SellerApiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnSummary }; getMyeBaySellingApiCall.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); getMyeBaySellingApiCall.SellingSummary = new eBay.Service.Core.Soap.ItemListCustomizationType(); getMyeBaySellingApiCall.SellingSummary.Include = true; getMyeBaySellingApiCall.ActiveList = new eBay.Service.Core.Soap.ItemListCustomizationType(); getMyeBaySellingApiCall.ActiveList.Include = true; getMyeBaySellingApiCall.ActiveList.IncludeNotes = true; getMyeBaySellingApiCall.ActiveList.ListingType = ListingTypeCodeType.FixedPriceItem; getMyeBaySellingApiCall.ActiveList.Pagination = new PaginationType(); getMyeBaySellingApiCall.ActiveList.Pagination.EntriesPerPage = 10; getMyeBaySellingApiCall.ActiveList.Pagination.PageNumber = 1; getMyeBaySellingApiCall.GetMyeBaySelling(); AmountType amountLimitRemaining = getMyeBaySellingApiCall.Summary.AmountLimitRemaining; long quantityLimitRemaining = getMyeBaySellingApiCall.Summary.QuantityLimitRemaining; PaginatedItemArrayType paginatedItemArray = getMyeBaySellingApiCall.ActiveListReturn; return null; }
// // GetMyeBaySelling // Use this call to return information from the All Selling section of the authenticated user's My eBay account. // http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/GetMyeBaySelling.html // public static List<EbayActiveListingType> GetMyActiveListing(AccountType account) { if (account.SellerApiContext == null) { Logger.WriteSystemLog("Invalid API context in GetMyActiveListing."); return null; } GetMyeBaySellingCall getMyeBaySellingApiCall = new GetMyeBaySellingCall(account.SellerApiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; getMyeBaySellingApiCall.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); getMyeBaySellingApiCall.SellingSummary = new eBay.Service.Core.Soap.ItemListCustomizationType(); getMyeBaySellingApiCall.SellingSummary.Include = true; getMyeBaySellingApiCall.ActiveList = new eBay.Service.Core.Soap.ItemListCustomizationType(); getMyeBaySellingApiCall.ActiveList.Include = true; getMyeBaySellingApiCall.ActiveList.IncludeNotes = true; //getMyeBaySellingApiCall.ActiveList.ListingType = ListingTypeCodeType.FixedPriceItem; getMyeBaySellingApiCall.ActiveList.Pagination = new PaginationType(); getMyeBaySellingApiCall.ActiveList.Pagination.EntriesPerPage = 25; // max 200 default 25 getMyeBaySellingApiCall.ActiveList.Pagination.PageNumber = 1; //getMyeBaySellingApiCall.BidList = new ItemListCustomizationType(); //getMyeBaySellingApiCall.BidList.Include = true; //getMyeBaySellingApiCall.BidList.Pagination = new PaginationType(); //getMyeBaySellingApiCall.BidList.Pagination.EntriesPerPage = 25; //getMyeBaySellingApiCall.BidList.Pagination.PageNumber = 1; getMyeBaySellingApiCall.GetMyeBaySelling(); AmountType amountLimitRemaining = getMyeBaySellingApiCall.Summary.AmountLimitRemaining; long quantityLimitRemaining = getMyeBaySellingApiCall.Summary.QuantityLimitRemaining; PaginatedItemArrayType paginatedItemArray = getMyeBaySellingApiCall.ActiveListReturn; if (paginatedItemArray == null || paginatedItemArray.ItemArray == null) return null; List<EbayActiveListingType> activeListings = new List<EbayActiveListingType>(); foreach (ItemType item in paginatedItemArray.ItemArray) { EbayActiveListingType activeListing = new EbayActiveListingType(); activeListing.ListId = 0; // to be set activeListing.SellerName = account.ebayAccount; activeListing.ItemID = StringUtil.GetSafeString(item.ItemID); activeListing.Title = StringUtil.GetSafeString(item.Title); if (item.ListingTypeSpecified) { if (ListingTypeCodeType.FixedPriceItem == item.ListingType) activeListing.ListingType = "FixedPriceItem"; else if (ListingTypeCodeType.Auction == item.ListingType || ListingTypeCodeType.Chinese == item.ListingType) activeListing.ListingType = "Auction"; else activeListing.ListingType = "Unknown"; } else { activeListing.ListingType = "Unknown"; } if (item.PictureDetails != null) activeListing.GalleryURL = StringUtil.GetSafeString(item.PictureDetails.GalleryURL); else activeListing.GalleryURL = ""; if (item.BiddingDetails != null) { activeListing.QuantityBid = StringUtil.GetSafeInt(item.BiddingDetails.QuantityBid); if (item.BiddingDetails.MaxBid != null) activeListing.MaxBid = StringUtil.GetSafeDouble(item.BiddingDetails.MaxBid.Value); else activeListing.MaxBid = 0.0; } else { activeListing.QuantityBid = 0; activeListing.MaxBid = 0.0; } if (item.StartPrice!=null) { activeListing.StartPrice = StringUtil.GetSafeDouble(item.StartPrice.Value); } else { activeListing.StartPrice = 0.0; } if (item.BuyItNowPrice != null) { activeListing.BuyItNowPrice = StringUtil.GetSafeDouble(item.BuyItNowPrice.Value); activeListing.CurrencyID = StringUtil.GetSafeString(item.BuyItNowPrice.currencyID); } else { activeListing.BuyItNowPrice = 0.0; activeListing.CurrencyID = ""; } if (item.ListingDetails != null) { activeListing.StartTime = StringUtil.GetSafeDateTime(item.ListingDetails.StartTime); activeListing.EndTime = StringUtil.GetSafeDateTime(item.ListingDetails.EndTime); activeListing.ViewItemURL = StringUtil.GetSafeString(item.ListingDetails.ViewItemURL); } activeListing.ListDuration = StringUtil.GetSafeInt(StringUtil.GetSafeListDurationDays(item.ListingDuration)); activeListing.PrivateListing = StringUtil.GetSafeBool(item.PrivateListing); activeListing.Quantity = StringUtil.GetSafeInt(item.Quantity); activeListing.QuantityAvailable = StringUtil.GetSafeInt(item.QuantityAvailable); if (item.SellingStatus != null) { if (item.SellingStatus.ListingStatus == ListingStatusCodeType.Active) activeListing.SellingStatus = "Active"; else if (item.SellingStatus.ListingStatus == ListingStatusCodeType.Completed) activeListing.SellingStatus = "Completed"; else if (item.SellingStatus.ListingStatus == ListingStatusCodeType.Ended) activeListing.SellingStatus = "Ended"; else activeListing.SellingStatus = "Unknown"; if (item.SellingStatus.BidCountSpecified) activeListing.BidCount = item.SellingStatus.BidCount; else activeListing.BidCount = 0; if (item.SellingStatus.BidderCountSpecified) activeListing.BidderCount = (int)item.SellingStatus.BidderCount; else activeListing.BidderCount = 0; if (item.SellingStatus.CurrentPrice != null) activeListing.CurrentPrice = item.SellingStatus.CurrentPrice.Value; else activeListing.CurrentPrice = 0.0; } else { activeListing.SellingStatus = "Unknown"; } activeListing.SKU = StringUtil.GetSafeString(item.SKU); activeListing.TimeLeft = StringUtil.GetSafeString(item.TimeLeft); activeListing.WatchCount = StringUtil.GetSafeInt(item.WatchCount); activeListings.Add(activeListing); } Logger.WriteSystemLog(string.Format("Successfully called GetMyActiveListing, returns {0} entries", activeListings.Count)); return activeListings; }
// Get all messages between buyers and sellers. public static bool GetAllMessages(AccountType account, DateTime startTime, DateTime endTime) { GetMyMessagesCall getMyMessageApiCall = new GetMyMessagesCall(account.SellerApiContext); getMyMessageApiCall.StartTime = startTime; getMyMessageApiCall.EndTime = endTime; DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnHeaders }; getMyMessageApiCall.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); getMyMessageApiCall.GetMyMessages(); MyMessagesMessageTypeCollection messages = getMyMessageApiCall.MessageList; foreach (MyMessagesMessageType msg in messages) { string msgId = msg.MessageID; GetMyMessagesCall getMyMessageApiCall2 = new GetMyMessagesCall(account.SellerApiContext); StringCollection msgIds = new StringCollection(); msgIds.Add(msgId); getMyMessageApiCall2.MessageIDList = msgIds; detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnMessages }; getMyMessageApiCall2.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); getMyMessageApiCall2.GetMyMessages(); MyMessagesMessageType msg2 = getMyMessageApiCall2.MessageList[0]; EbayMessageType ebayMsg = new EbayMessageType(); ebayMsg.EbayMessageId = msgId; ebayMsg.SellerName = account.ebayAccount; ebayMsg.MessageType = msg2.MessageType.ToString(); ebayMsg.QuestionType = msg2.QuestionType.ToString(); ebayMsg.IsRead = msg2.Read; ebayMsg.IsReplied = msg2.Replied; ebayMsg.IsResponseEnabled = msg2.ResponseDetails != null ? msg2.ResponseDetails.ResponseEnabled : false; ebayMsg.ResponseURL = msg2.ResponseDetails != null ? msg2.ResponseDetails.ResponseURL : ""; ebayMsg.UserResponseDate = msg2.ResponseDetails != null ? msg2.ResponseDetails.UserResponseDate : DateTime.MinValue; ebayMsg.ReceiveDate = msg2.ReceiveDate; ebayMsg.RecipientUserId = msg2.RecipientUserID; ebayMsg.Sender = msg2.Sender; ebayMsg.Subject = msg2.Subject; ebayMsg.IsHighPriority = msg2.HighPriority; ebayMsg.Content = msg2.Content; ebayMsg.Text = msg2.Text; ebayMsg.ExternalMessageId = msg2.ExternalMessageID; ebayMsg.FolderId = msg2.Folder != null ? msg2.Folder.FolderID : -1; ebayMsg.ItemID = msg2.ItemID; ebayMsg.ItemTitle = msg2.ItemTitle; ebayMsg.ItemEndTime = msg2.ItemEndTime; ebayMsg.ListingStatus = msg2.ListingStatus.ToString(); EbayMessageDAL.InsertOneMessage(ebayMsg); } return true; }