Пример #1
0
        // http://developer.ebay.com/DevZone/xml/docs/Reference/ebay/VerifyAddItem.html
        public VerifyAddItemCall VerifyAddItem(SiteCodeType siteid)
        {
            var call = new VerifyAddItemCall(api);

            call.Site = siteid;

            call.VerifyAddItem(item);

            return(call);
        }
Пример #2
0
        private void BtnVerifyAddItem_Click(object sender, System.EventArgs e)
        {
            try
            {
                TxtItemId.Text     = "";
                TxtListingFee.Text = "";

                ItemType          item    = FillItem();
                VerifyAddItemCall apicall = new VerifyAddItemCall(Context);

                // eBay Developer Technical Support Team(DTS) - Devanathan
                // Dated: 24-Feb-2016 9:33PM
                // Following If condition and for loop were commented to add a dummy image URL for bypass upload site hosting call for VerifyAddItem call

                /*
                 * if (ListPictures.Items.Count > 0)
                 * {
                 *  item.PictureDetails = new PictureDetailsType();
                 *  item.PictureDetails.PhotoDisplay = (PhotoDisplayCodeType)Enum.Parse(typeof(PhotoDisplayCodeType), CboPicDisplay.SelectedItem.ToString());
                 * }
                 *
                 * foreach (string pic in ListPictures.Items)
                 * {
                 *  apicall.PictureFileList.Add(pic);
                 * }
                 */

                // eBay Developer Technical Support Team(DTS) - Devanathan
                // Dated: 24-Feb-2016 9:33PM
                // Added the following four lines of code dummy image URL for bypass upload site hosting call for VerifyAddItem call

                item.PictureDetails = new PictureDetailsType();
                item.PictureDetails.PhotoDisplaySpecified = true;
                item.PictureDetails.PhotoDisplay          = PhotoDisplayCodeType.None;
                item.PictureDetails.PictureURL            = new StringCollection();
                item.PictureDetails.PictureURL.Add("http://i.ebayimg.com/00/s/MTAwMFgxMDAw/z/Oi4AAOSwzgRWzsz9/$_12.JPG?set_id=880000500F");


                FeeTypeCollection fees = apicall.VerifyAddItem(item);

                foreach (FeeType fee in fees)
                {
                    if (fee.Name == "ListingFee")
                    {
                        TxtListingFee.Text = fee.Fee.Value.ToString();
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #3
0
        public void AddItemFull()
        {
            if (TestData.NewItem2 != null)
            {
                (new T_120_EndItemLibrary()).EndItemFull();
                TestData.NewItem2 = null;
            }

            bool     isSucess, isSupport = true;
            string   message;
            ItemType item = ItemHelper.BuildItem();

            item.PrimaryCategory.CategoryID = CATEGORYID.ToString();
            //add Item AttributeSetArray
            //AttributeSetTypeCollection attributeSAT=GetAttributeSetCol(CATEGORYID,apiContext);
            //item.AttributeSetArray=attributeSAT;

            //check this category is custom specifics support
            FeatureIDCodeTypeCollection features = new FeatureIDCodeTypeCollection();
            FeatureIDCodeType           feature  = FeatureIDCodeType.ItemSpecificsEnabled;

            features.Add(feature);
            isSucess = UnitTests.Helper.CategoryHelper.IsSupportFeature(CATEGORYID, features, apiContext, out isSupport, out message);
            System.Console.WriteLine(message);
            Assert.IsTrue(isSucess, "there are some errors during checkging the CategoryFeatures");
            Assert.IsTrue(isSupport, "this category 104970 do not support the custom item specified any more!");
            //add CIS
            item.ItemSpecifics = getCIS();

            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.IsNotNull(fees);
            // Save the result.
            TestData.NewItem2 = item;
        }
Пример #4
0
        public void AddItemProPay()
        {
            ItemType item = ItemHelper.BuildItem();

            item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection(new BuyerPaymentMethodCodeType[] { BuyerPaymentMethodCodeType.ProPay, BuyerPaymentMethodCodeType.PayPal });
            // Execute the API.
            FeeTypeCollection fees;
            // VerifyAddItem
            VerifyAddItemCall vi = new VerifyAddItemCall(this.apiContext);

            fees = vi.VerifyAddItem(item);
            Assert.IsNotNull(fees);
            // AddItem
            AddItemCall addItem = new AddItemCall(this.apiContext);

            fees = addItem.AddItem(item);
            Assert.IsNotNull(fees);
        }
Пример #5
0
        public void AddItem()
        {
            if (TestData.NewItem != null)
            {
                (new T_120_EndItemLibrary()).EndItem();
                TestData.NewItem = null;
            }
            ItemType item = ItemHelper.BuildItem();
            // Execute the API.
            FeeTypeCollection fees;
            // VerifyAddItem
            VerifyAddItemCall vi = new VerifyAddItemCall(this.apiContext);

            fees = vi.VerifyAddItem(item);
            Assert.IsNotNull(fees);
            // AddItem
            AddItemCall addItem = new AddItemCall(this.apiContext);

            fees = addItem.AddItem(item);
            Assert.IsNotNull(fees);
            // Save the result.
            TestData.NewItem = item;
        }
Пример #6
0
        private void BtnVerifyAddItem_Click(object sender, System.EventArgs e)
        {
            try
            {
                TxtItemId.Text     = "";
                TxtListingFee.Text = "";

                ItemType          item    = FillItem();
                VerifyAddItemCall apicall = new VerifyAddItemCall(Context);
                foreach (string pic in ListPictures.Items)
                {
                    apicall.PictureFileList.Add(pic);
                }

                if (ListPictures.Items.Count > 0)
                {
                    item.PictureDetails = new PictureDetailsType();
                    item.PictureDetails.PhotoDisplay = (PhotoDisplayCodeType)Enum.Parse(typeof(PhotoDisplayCodeType), CboPicDisplay.SelectedItem.ToString());
                }

                FeeTypeCollection fees = apicall.VerifyAddItem(item);

                foreach (FeeType fee in fees)
                {
                    if (fee.Name == "ListingFee")
                    {
                        TxtListingFee.Text = fee.Fee.Value.ToString();
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #7
0
        private bool verifyAddItem(MySQLWrapper.eBayItem ebayItem)
        {
            bool          itemListing     = false;
            TextReader    tr              = new StreamReader("template.txt");
            StringBuilder htmlDescription = new StringBuilder();

            htmlDescription.Insert(0, tr.ReadToEnd());
            tr.Close();
            htmlDescription.Replace("{0}", ebayItem.Title);
            htmlDescription.Replace("{1}", ebayItem.Author);
            htmlDescription.Replace("{2}", ebayItem.Publisher);
            htmlDescription.Replace("{3}", ebayItem.publishDate);
            htmlDescription.Replace("{4}", ebayItem.Binding);
            htmlDescription.Replace("{5}", ebayItem.ISBN);
            if (ebayItem.UPC != "")
            {
                htmlDescription.Replace("{6}", "<b>UPC : </b>" + ebayItem.UPC + "</br>");
            }
            else
            {
                htmlDescription.Replace("{6}", "");
            }
            htmlDescription.Replace("{7}", ebayItem.Weight.ToString());
            htmlDescription.Replace("{8}", ebayItem.Notes);
            htmlDescription.Replace("{9}", ebayItem.Description);

            ItemType item = new ItemType();

            item.SKU             = ebayItem.SKU;
            item.Title           = ebayItem.Title;
            item.Description     = htmlDescription.ToString();
            item.Currency        = CurrencyCodeType.INR;
            item.Country         = CountryCodeType.IN;
            item.ListingType     = ListingTypeCodeType.FixedPriceItem;
            item.Quantity        = ebayItem.Quantity;
            item.Location        = eBayLister.UserSettings.Default.itemCityState;
            item.ListingDuration = getListingDuration();
            item.PrimaryCategory = new CategoryType();
            if (eBayLister.UserSettings.Default.ListInCategory.Equals("Other Books"))
            {
                item.PrimaryCategory.CategoryID = "268";
            }
            else
            {
                item.PrimaryCategory.CategoryID = "37558";
            }
            item.StartPrice            = new AmountType();
            item.StartPrice.currencyID = CurrencyCodeType.INR;
            item.StartPrice.Value      = ebayItem.Price *
                                         Convert.ToDouble(eBayLister.UserSettings.Default.ConversionRate);

            item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection();
            item.PaymentMethods.Add(BuyerPaymentMethodCodeType.PaisaPayAccepted);
            item.ShippingDetails = this.getShippingDetails();
            item.ReturnPolicy    = this.getReturnPolicy();

            string handlingTime = eBayLister.UserSettings.Default.handlingTime;

            handlingTime         = handlingTime.Remove(handlingTime.IndexOf(' '));
            item.DispatchTimeMax = Convert.ToInt32(handlingTime);

            AttributeType conditionAttribute = new AttributeType();

            conditionAttribute.attributeLabel = "Condition";
            ValTypeCollection valueCollection = new ValTypeCollection();
            ValType           valueType       = new ValType();

            if (ebayItem.bookCondition.Contains("Used"))
            {
                valueType.ValueLiteral = "Used";
            }
            else
            {
                valueType.ValueLiteral = "New";
            }
            valueCollection.Add(valueType);
            conditionAttribute.Value = valueCollection;
            item.AttributeArray      = new AttributeTypeCollection();
            item.AttributeArray.Add(conditionAttribute);

            VerifyAddItemCall apiCall = new VerifyAddItemCall(context);

            try
            {
                FeeTypeCollection fees = apiCall.VerifyAddItem(item);
                foreach (FeeType fee in fees)
                {
                    if (fee.Name == "ListingFee")
                    {
                        addLogStatus("Success!     Listing Fee : " + Convert.ToString(fee.Fee.Value));
                    }
                }
                itemListing = true;
            }
            catch (ApiException ex)
            {
                itemListing = false;
                MessageBox.Show(ex.Message);
                Console.WriteLine(ex.Message);
            }
            return(itemListing);
        }