コード例 #1
0
 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;
 }
コード例 #2
0
		public void GetItem()
		{
			bool includeCrossPromotion=true;
			bool includeItemSpecifics=true;
			bool includeTaxTable=false;
			bool includeWatchCount=true;
			ItemType item = null;

			Assert.IsNotNull(TestData.NewItem2, "Failed because no item available -- requires successful AddItem test");
			
			GetItemCall api=new GetItemCall(this.apiContext);
			
			api.IncludeCrossPromotion = includeCrossPromotion;
			api.IncludeItemSpecifics = includeItemSpecifics;
			api.IncludeTaxTable = includeTaxTable;
			api.IncludeWatchCount = includeWatchCount;
			api.ItemID = TestData.NewItem2.ItemID;
			api.Execute();

			//check whether the call is success.
			Assert.IsTrue(api.ApiResponse.Ack==AckCodeType.Success || api.ApiResponse.Ack==AckCodeType.Warning,"do not success!");
			Assert.IsNotNull(api.ApiResponse.Item);
			item = api.ApiResponse.Item;
			Assert.IsTrue(item.ItemSpecifics.Count>0,"this is no item spcifics");
			Assert.IsTrue(item.WatchCount>=0);
		}
コード例 #3
0
        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();
        }
コード例 #4
0
ファイル: EbayItemBiz.cs プロジェクト: Richmandos/ebaymaster
        // 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;
        }
コード例 #5
0
        public Product FindProduct(string productId)
        {
            var getItemCall = new GetItemCall(this.ApiContext);
            var item = getItemCall.GetItem(productId);

            var price = item.BuyItNowPrice.Value > 0 ? item.BuyItNowPrice.Value :
                item.SellingStatus.CurrentPrice.Value;

            return new Product()
            {
                Title = item.Title,
                SubTitle = item.SubTitle,
                Description = item.Description,
                BuyPrice = price,
                DepthInCm = NormalizeMeasure(item.ShippingPackageDetails.PackageDepth),
                LengthInCm = NormalizeMeasure(item.ShippingPackageDetails.PackageLength),
                WidthInCm = NormalizeMeasure(item.ShippingPackageDetails.PackageWidth),
                WeightInKg = NormalizeMeasure(item.ShippingPackageDetails.WeightMajor),
            };
        }
コード例 #6
0
ファイル: EbayAccess.cs プロジェクト: fireworm71/Gamez
        public void GetListingInfo(bool live, string id, out ListingInfo info)
        {
            ApiContext apiContext = GetApiContext(live);

            var getItem = new GetItemCall(apiContext);
            getItem.ItemID = id;
            try
            {
                getItem.Execute();
            }
            catch (Exception ex)
            {
                info = new ListingInfo();
                info.CurrentStatus = EbayStatus.Unlisted;
                return;
            }
            info = new ListingInfo();

            info.ViewUrl = getItem.ApiResponse.Item.ListingDetails.ViewItemURL;
            switch (getItem.ApiResponse.Item.SellingStatus.ListingStatus)
            {
                case ListingStatusCodeType.Active:
                    info.CurrentStatus = EbayStatus.InProgressBuyItNow;
                    break;
                case ListingStatusCodeType.Ended:
                    info.CurrentStatus = EbayStatus.Unsold;
                    break;
                case ListingStatusCodeType.Completed:
                    if (getItem.ApiResponse.Item.SellingStatus.QuantitySold > 0)
                    {
                        info.CurrentStatus = EbayStatus.Sold;
                        info.SoldPrice = getItem.ApiResponse.Item.SellingStatus.CurrentPrice.Value;
                    }
                    else
                    {
                        info.CurrentStatus = EbayStatus.Unsold;
                    }
                    break;
            }
        }
コード例 #7
0
		/// <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;
		}
コード例 #8
0
		private void BtnGetItem_Click(object sender, System.EventArgs e)
		{
			try
			{
				TxtTitle.Text = "";
				TxtCategory.Text = "";
				TxtCategory2.Text = "";
				TxtCurrentPrice.Text = "";
				TxtBuyItNowPrice.Text = "";
				TxtBidCount.Text = "";
				TxtHighBidder.Text = "";
				TxtStartTime.Text = "";
				TxtEndTime.Text =  "";
				TxtQuantity.Text = "";
				TxtQuantitySold.Text = "";
				LblItemIdResult.Text = "";
				TxtCategory2Id.Text = "";
				TxtCategoryId.Text = "";

				Context.CallRetry = GetCallRetry();
				
				GetItemCall apicall = new GetItemCall(Context);
				apicall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);
				fetchedItem = apicall.GetItem(TxtItemId.Text);

				// Set values from the item returned
				TxtTitle.Text = fetchedItem.Title;
				TxtCategory.Text = fetchedItem.PrimaryCategory.CategoryName;
				TxtCategoryId.Text = fetchedItem.PrimaryCategory.CategoryID;
					
				if (fetchedItem.SecondaryCategory != null)
				{
					TxtCategory2.Text = fetchedItem.SecondaryCategory.CategoryName;
					TxtCategory2Id.Text = fetchedItem.SecondaryCategory.CategoryID;
				}

				TxtCurrentPrice.Text = fetchedItem.SellingStatus.CurrentPrice.Value.ToString();
				TxtBuyItNowPrice.Text = fetchedItem.BuyItNowPrice.Value.ToString();
				TxtBidCount.Text = fetchedItem.SellingStatus.BidCount.ToString();

				if (fetchedItem.SellingStatus.HighBidder != null)
					TxtHighBidder.Text = fetchedItem.SellingStatus.HighBidder.UserID;

				TxtStartTime.Text = fetchedItem.ListingDetails.StartTime.ToString();
				TxtEndTime.Text =  fetchedItem.ListingDetails.EndTime.ToString();
				TxtQuantity.Text = fetchedItem.Quantity.ToString();
				TxtQuantitySold.Text = fetchedItem.SellingStatus.QuantitySold.ToString();

				TxtBestOfferCount.Text = "0";
				TxtBestOfferEnabled.Text = "False";
				if (fetchedItem.BestOfferDetails != null)
				{
					TxtBestOfferCount.Text = fetchedItem.BestOfferDetails.BestOfferCount.ToString();
					TxtBestOfferEnabled.Text = fetchedItem.BestOfferDetails.BestOfferEnabled.ToString();
				}

				if (fetchedItem.PayPalEmailAddress != null)
					TxtPayPalEmailAddress.Text = fetchedItem.PayPalEmailAddress.ToString();

				if (fetchedItem.ApplicationData != null)
					TxtApplicationData.Text = fetchedItem.ApplicationData.ToString();

				if (fetchedItem.ProductListingDetails != null)
					TxtProductID.Text = fetchedItem.ProductListingDetails.ProductID;

				TxtPictureURL.Text = "";	
				if (fetchedItem.PictureDetails != null)
				{
					StringCollection PictureURLs = fetchedItem.PictureDetails.PictureURL;
					string PictureURL = "";
					for (int i = 0; PictureURLs != null && i < PictureURLs.Count; i++)
					{
						PictureURL += PictureURLs[i] + ",";
					}
					TxtPictureURL.Text = PictureURL;
				} 
				TxtSite.Text = fetchedItem.Site.ToString();

				
				TxtListType.Text = fetchedItem.ListingType.ToString();
				mItemID = fetchedItem.ItemID;
				LblItemIdResult.Text = "Item Id:  " + fetchedItem.ItemID;
				
				if (LblItemIdResult.Text.Length > 0)
				{
					BtnRelistItem.Visible = true;
					BtnReviseItem.Visible = true;
					BtnEndItem.Visible = true;
				}
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message);
			}

		}
コード例 #9
0
ファイル: Program.cs プロジェクト: msaleh/HRM
        static ItemType GetItembySku(string sku)
        {
            ItemType fetchedItem = null;
            var apiContext = eBayServiceSettingHelper.GetApiContext();
            GetItemCall apicall = new GetItemCall(apiContext);
            apicall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);
            try
            {
                fetchedItem = apicall.GetItem(null, false, false, false, false, sku, sku, null, null, false);
            }
            catch { }
            return fetchedItem;

            # region "Old way"
            //var apiContext = eBayServiceSettingHelper.GetApiContext();

               // GetSellerListCall apicall = new GetSellerListCall(apiContext);
               // apicall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);

               // //Pagination is required
               // apicall.Pagination = new PaginationType();
               // apicall.Pagination.PageNumber = 1;
               // apicall.Pagination.EntriesPerPage = 200;

               // ItemTypeCollection sellerlist = apicall.GetSellerList();
               // var item = (from x in sellerlist.ToArray() where x.SKU == sku select x).Single();

            // return item;
            # endregion
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: msaleh/HRM
 static ItemType GetItembyId(string itemId)
 {
     var apiContext = eBayServiceSettingHelper.GetApiContext();
     GetItemCall apicall = new GetItemCall(apiContext);
     apicall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);
     var fetchedItem = apicall.GetItem(itemId);
     return fetchedItem;
 }
コード例 #11
0
ファイル: eBayApi.cs プロジェクト: jaskirat-danits/oswebshop
		/// <summary>
		/// get an item
		/// </summary>
		/// <param name="itemId"></param>
		/// <param name="metrics"></param>
		/// <returns></returns>
		public static ItemType GetItem(string itemId, CallMetricsTable metrics) 
		{
			Debug.Assert(itemId != null);
			Debug.Assert(itemId.Length > 0);

			try 
			{
				ApiContext ctx = GetContext();
				ctx.EnableMetrics = true;
				ctx.CallMetricsTable = metrics;
				GetItemCall call = new GetItemCall(ctx);
				call.Site = SiteCodeType.US;

				ItemType item = call.GetItem(itemId);
				return CheckForErrors("GetItem", call) ? item : null;
			}
			catch (Exception e) {
				ShowException("GetItem(" + itemId + ")", e);
				return null;
			}
		}
コード例 #12
0
		public void RelistItem()
		{
			Assert.IsNotNull(TestData.EndedItem);
			//
			RelistItemCall rviCall = new RelistItemCall(this.apiContext);
			ItemType item = new ItemType();
			item.ItemID = TestData.EndedItem.ItemID;
			item.StartPrice = new AmountType(); 
			item.StartPrice.Value = 1.98; 
			item.StartPrice.currencyID = CurrencyCodeType.USD;
			//StringCollection modList = new StringCollection();
			//modList.Add("item.startPrice");
			//ModifiedFieldType[] mfList = eBayUtil.CopyModifiedList(modList, null);
			//rviCall.ModifiedFields = mfList;


            //verify first
            VerifyRelistItemCall vriCall = new VerifyRelistItemCall(this.apiContext);
            vriCall.Item = item;
            vriCall.Execute();
            FeeTypeCollection fees = vriCall.FeeList;
            Assert.IsNotNull(fees);

            GetItemCall getItem1 = new GetItemCall(this.apiContext);
            DetailLevelCodeType[] detailLevels1 = new DetailLevelCodeType[] {
			DetailLevelCodeType.ReturnAll
			};
            getItem1.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels1);
            ItemType returnedItem1 = getItem1.GetItem(item.ItemID);
            // Make sure it's relisted.
            /*
            Assert.AreEqual(returnedItem.ListingDetails.getRelistedItemID().Value,
            TestData.EndedItem);
            */
            Assert.AreNotEqual(returnedItem1.StartPrice.Value, item.StartPrice.Value);

            
            rviCall.Item = item;
            rviCall.RelistItem(item);

			// Let's wait for the server to "digest" the data.
			System.Threading.Thread.Sleep(1000);
			// Call GetItem and then compare the startPrice.
			GetItemCall getItem2 = new GetItemCall(this.apiContext);
			DetailLevelCodeType[] detailLevels2 = new DetailLevelCodeType[] {
			DetailLevelCodeType.ReturnAll
			};
			getItem2.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels2);
			ItemType returnedItem2 = getItem2.GetItem(item.ItemID);
			// Make sure it's relisted.
			/*
			Assert.AreEqual(returnedItem.ListingDetails.getRelistedItemID().Value,
			TestData.EndedItem);
			*/
			Assert.AreEqual(returnedItem2.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();
		
		}
コード例 #13
0
        private StoreProductSearchModel ConvertSearchItemToSearchItemModel(SearchItem searchItem)
        {
            StoreProductSearchModel searchProductModel = new StoreProductSearchModel();

            searchProductModel.StoreProductId = searchItem.itemId;
            searchProductModel.ProductTitle = searchItem.title;
            searchProductModel.StoreProductVariantSearchModels = new List<StoreProductVariantSearchModel>();

            searchProductModel.ImageUrl = searchItem.galleryURL;

            if (searchItem.productId != null)
            {
                searchProductModel.StoreProductId1 = searchItem.productId.Value;
            }

            //searchProductModel.unitPrice = searchItem.unitPrice.quantity,

            GetItemCall itemCall = new GetItemCall(eBayContext);

            itemCall.ItemID = searchItem.itemId;

            itemCall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);

            itemCall.Execute();

            if (itemCall.ApiResponse.Ack != AckCodeType.Failure)
            {

                ItemType item = itemCall.Item;

                if (item != null)
                {
                    if (item.Variations != null && item.Variations.Variation != null && item.Variations.Variation.Count > 0)
                    {
                        VariationsType variation = item.Variations;

                        VariationTypeCollection variationCollection = variation.Variation;

                        string pictureAttributeName = variation.Pictures[0].VariationSpecificName;

                        Dictionary<string, string> imageCollection = GetAllImages(variation);

                        foreach (VariationType vitem in variationCollection)
                        {
                            StoreProductVariantSearchModel searchVariant = new StoreProductVariantSearchModel()
                            {
                                ProductVariantTitle = vitem.VariationTitle,
                                SellerVariantSKU = vitem.SKU,
                                Price = (decimal)vitem.StartPrice.Value,
                            };

                            searchVariant.ProductVariantAttributes = new Dictionary<string, string>();

                            if (vitem.VariationSpecifics != null && vitem.VariationSpecifics.Count > 0)
                            {
                                NameValueListTypeCollection variationSpecifics = vitem.VariationSpecifics;

                                foreach (NameValueListType spec in variationSpecifics)
                                {
                                    if(spec.Name == pictureAttributeName)
                                    {
                                        if(imageCollection.ContainsKey(spec.Value[0]))
                                        {
                                            searchVariant.productVariantImageUrl = imageCollection[spec.Value[0]];
                                        }
                                    }

                                    searchVariant.ProductVariantAttributes.Add(spec.Name, string.Join(";", spec.Value.ToArray()));

                                }

                            }

                            searchProductModel.StoreProductVariantSearchModels.Add(searchVariant);
                        }
                    }
                }

            }

            return searchProductModel;
        }