Пример #1
0
 public EbayFacade()
 {
     InitializeContext();
     api2call = new AddFixedPriceItemCall(Context);
     reviseItemCall = new ReviseFixedPriceItemCall(Context);
     deleteItemCall = new EndItemCall(Context);
 }
Пример #2
0
 public void AddFixedPriceItem()
 {
     if( TestData.NewFixedPriceItem != null )
     {
         string outMsg;
         ItemHelper.EndItem(this.apiContext, TestData.NewFixedPriceItem, out outMsg);
         TestData.NewFixedPriceItem = null;
     }
     ItemType item = ItemHelper.BuildItem();
     item.ListingType = ListingTypeCodeType.FixedPriceItem;
     // Execute the API.
     FeeTypeCollection fees;
     // VerifyAddItem
     VerifyAddFixedPriceItemCall vi = new VerifyAddFixedPriceItemCall(this.apiContext);
     fees = vi.VerifyAddFixedPriceItem(item);
     Assert.IsNotNull(fees);
     // AddItem
     AddFixedPriceItemCall ai = new AddFixedPriceItemCall(this.apiContext);
     fees = ai.AddFixedPriceItem(item);
     Assert.IsNotNull(fees);
     // Save the result.
     TestData.NewFixedPriceItem = item;
 }
Пример #3
0
        public bool NewListing(bool live, string upc, double price, string[] picFiles, string titleOverride, string description, Shipping shipping, EbayCategory ebayCategory, out string response, out string id, bool forceTitleOverride = false, 
            int lbs = 0, int oz = 0)
        {
            ApiContext apiContext = GetApiContext(live);
            bool useTitleOverride = forceTitleOverride;

            {
                var addItem = new VerifyAddFixedPriceItemCall(apiContext)
                {
                    Item = CreateItem(upc, price, titleOverride, description, shipping, ebayCategory, useTitleOverride, lbs, oz),
                    PictureFileList = new StringCollection(picFiles),
                };

                try
                {
                    addItem.Execute();
                }
                catch (Exception ex)
                {
                    useTitleOverride = true;
                }
            }
            {
                var addItem = new AddFixedPriceItemCall(apiContext)
                {
                    Item = CreateItem(upc, price, titleOverride, description, shipping, ebayCategory, useTitleOverride, lbs, oz),
                    PictureFileList = new StringCollection(picFiles),
                };

                try
                {
                    addItem.Execute();
                }
                catch (Exception ex)
                {
                    id = "-1";
                    response = ex.ToString();
                    return false;
                }
                response = "OK!";
                id = addItem.ApiResponse.ItemID;
            }

            return true;
        }