Exemplo n.º 1
0
        public static eBayAPIInterfaceService eBayServiceCall(string CallName)
        {
            string endpoint = "https://api.sandbox.ebay.com/wsapi";
            string siteId   = "3";
            string appId    = AppSettingsHelper.AppID;  // use your app ID
            string devId    = AppSettingsHelper.DevID;  // use your dev ID
            string certId   = AppSettingsHelper.CertID; // use your cert ID
            string version  = "965";
            // Build the request URL
            string requestURL = endpoint
                                + "?callname=" + CallName
                                + "&siteid=" + siteId
                                + "&appid=" + appId
                                + "&version=" + version
                                + "&routing=default";

            eBayAPIInterfaceService service = new eBayAPIInterfaceService();

            // Assign the request URL to the service locator.
            service.Url = requestURL;
            // Set credentials
            service.RequesterCredentials = new CustomSecurityHeaderType();
            service.RequesterCredentials.eBayAuthToken        = AppSettingsHelper.Token; // use your token
            service.RequesterCredentials.Credentials          = new UserIdPasswordType();
            service.RequesterCredentials.Credentials.AppId    = appId;
            service.RequesterCredentials.Credentials.DevId    = devId;
            service.RequesterCredentials.Credentials.AuthCert = certId;
            return(service);
        }
Exemplo n.º 2
0
        public static void GetOrderTransactions()
        {
            string endpoint = "https://api.ebay.com/wsapi";
            string callName = "GetOrderTransactions";
            string siteId   = "2";
            string version  = "949";
            // Build the request URL
            string requestURL = endpoint
                                + "?callname=" + callName
                                + "&siteid=" + siteId
                                + "&appid=" + Settings.AppId
                                + "&version=" + version
                                + "&routing=default";
            // Create the service
            eBayAPIInterfaceService service = new eBayAPIInterfaceService();

            // Assign the request URL to the service locator.
            service.Url = requestURL;
            // Set credentials
            service.RequesterCredentials = new CustomSecurityHeaderType();
            service.RequesterCredentials.eBayAuthToken =
                "AgAAAA**AQAAAA**aAAAAA**c8WOVg**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6AAlIeiCpiLoAydj6x9nY+seQ**JiADAA**AAMAAA**sPiqCG+IiAwqtalGeoTnnESc7Br2D+btBopa9arMMDNaOfglryGRHk3tn/aXAj3p2/KmDiKSmYrg51QGFNokYSGUskmH/jjsOtKgoLyTTJZ+3CtWqeAOz/cbrYadAD8l+s6xUfnTk9mWm4BjyAfYqJ1zkNHUC5YaFTk+oaDZPZ9bE7uGjfw1cvQeX6M7TalgTSygqdVV6hOVJZ3I9UPuO66HchFTPvd4n02aZ2UfsXrcYdOpstNdjLuETQIB5tmUWo6uiCwh/r+eiWt8jIycZegb/9uRHzwEy7rW9Tk7fIpIohoBtryYRLUnMJvy9Dg4l++AhFY0yakWJsWu7VHy7eCuz+OI0Pk+E+uOQhgQRzIji96K6/AnBNV9lLiOa6CiI5MdkcrF2Z4Kr4WoxAgy+4WjoUq+PRG8eDHseFWANwOVhmY9qZJq0ulR9SNcXd8FoRiinxzx3f+lO+MgfrRcea2QKKQVoYDI69jKOQ568FVQ6Zp0ClJy9ru/L9IqB87COBLFP6Ie+Zx+2nhgj+GuARYOu2z0Z7kqx+R6H19hIYoxNncQtGi2ruzqWXG+hbFWXTlqrne8IiJr1udgK1ZxJk9FTCCKQCx0s57SXuBkyaM15y2pqC+ze43ZiLGC3wk94pWEACDNRWu4rH27RZTN+ALBoGWkVdSzGxuVfMD164ak4cAJrIiT2OX77FqnLN+MGcVbfJCAu+BREtguSzW6JmM9qHXHBI+4H/jfGruvYoIt2zg7DzMFv50i+hpnLe5F";
            // use your token
            service.RequesterCredentials.Credentials          = new UserIdPasswordType();
            service.RequesterCredentials.Credentials.AppId    = Settings.AppId;
            service.RequesterCredentials.Credentials.DevId    = Settings.DevId;
            service.RequesterCredentials.Credentials.AuthCert = Settings.CertId;
            // Make the call
            GetOrderTransactionsRequestType request = new GetOrderTransactionsRequestType();

            request.Version = "949";
            var response = service.GetOrderTransactions(request);

            Console.WriteLine(response.Timestamp);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Returns a list of the top level categories for the UK.
        /// </summary>
        public static void GetTopLevelCategories()
        {
            eBayAPIInterfaceService service = EbayCalls.eBayServiceCall("GetCategories");

            GetCategoriesRequestType request = new GetCategoriesRequestType();

            request.Version        = "949";
            request.CategorySiteID = "0"; // US
            request.LevelLimit     = 1;   // Top Level
            request.DetailLevel    = new DetailLevelCodeTypeCollection {
                DetailLevelCodeType.ReturnAll
            };
            GetCategoriesResponseType response = service.GetCategories(request);

            Console.WriteLine("=====================================");
            Console.WriteLine("Top-Level Categories");
            Console.WriteLine("=====================================");
            foreach (dynamic cat in response.CategoryArray)
            {
                Console.WriteLine("{0} - {1}", cat.CategoryID, cat.CategoryName);
            }

            // Uncomment to return sub categories

            /*Will prompt for CategoryID to return Sub categories
             * Console.WriteLine("=====================================");
             * Console.WriteLine("Please enter a Top-Level Category ID: ");
             * Console.WriteLine("=====================================");
             * var TopLevel = Console.ReadLine();
             * GetCategories2Request(TopLevel);*/
        }
Exemplo n.º 4
0
        public static void GetTopLevelCategories()
        {
            eBayAPIInterfaceService service = EbayCalls.EbayServiceCall("GetCategories");

            GetCategoriesRequestType request = new GetCategoriesRequestType();

            request.Version        = "949";
            request.CategorySiteID = "3";
            request.LevelLimit     = 1;
            request.DetailLevel    = new DetailLevelCodeTypeCollection {
                DetailLevelCodeType.ReturnAll
            };
            GetCategoriesResponseType response = service.GetCategories(request);

            Console.WriteLine("====================");
            Console.WriteLine("Top-Level Categories");
            Console.WriteLine("====================");
            foreach (dynamic cat in response.CategoryArray)
            {
                Console.WriteLine("{0} - {1}", cat.CategoryID, cat.CategoryName);
            }

            Console.WriteLine("====================");
            Console.WriteLine("Please enter a Top-Level Category ID: ");
            Console.WriteLine("====================");
            var topLevel = Console.ReadLine();

            GetLevel2Categories(topLevel);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Returns a list of Level 2 categories.
        /// </summary>
        /// <param name="TopLevel">Top level category ID</param>
        public static void GetLevel2Categories(string TopLevel)
        {
            eBayAPIInterfaceService service = EbayCalls.eBayServiceCall("GetCategories");

            GetCategoriesRequestType request = new GetCategoriesRequestType();

            request.Version        = "949";
            request.CategorySiteID = "0";
            request.LevelLimit     = 2;
            request.CategoryParent = new StringCollection {
                TopLevel
            };
            request.DetailLevel = new DetailLevelCodeTypeCollection {
                DetailLevelCodeType.ReturnAll
            };
            GetCategoriesResponseType response = service.GetCategories(request);

            Console.WriteLine("=====================================");
            Console.WriteLine("Level 2 Categories");
            Console.WriteLine("=====================================");

            foreach (dynamic cat in response.CategoryArray)
            {
                Console.WriteLine("{0} - {1}", cat.CategoryID, cat.CategoryName);
            }
        }
Exemplo n.º 6
0
        public static eBayAPIInterfaceService EbayServiceCall(string callName)
        {
            string endpoint   = "https://api.sandbox.ebay.com/wsapi";
            string siteId     = "3";
            string appId      = AppSettingsHelper.AppID;
            string devId      = AppSettingsHelper.DevID;
            string certId     = AppSettingsHelper.CertID;
            string version    = "965";
            string requestURL = endpoint
                                + "?callname" + callName
                                + "&siteid" + siteId
                                + "&appId" + appId
                                + "&version=" + version
                                + "&routing=default";

            eBayAPIInterfaceService service = new eBayAPIInterfaceService();

            service.Url = requestURL;

            service.RequesterCredentials = new CustomSecurityHeaderType();
            service.RequesterCredentials.eBayAuthToken        = AppSettingsHelper.Token;
            service.RequesterCredentials.Credentials          = new UserIdPasswordType();
            service.RequesterCredentials.Credentials.AppId    = appId;
            service.RequesterCredentials.Credentials.DevId    = devId;
            service.RequesterCredentials.Credentials.AuthCert = certId;
            return(service);
        }
Exemplo n.º 7
0
 public static void GetOrderTransactions()
 {
     string endpoint = "https://api.ebay.com/wsapi";
     string callName = "GetOrderTransactions";
     string siteId = "2";
     string version = "949";
     // Build the request URL
     string requestURL = endpoint
                         + "?callname=" + callName
                         + "&siteid=" + siteId
                         + "&appid=" + Settings.AppId
                         + "&version=" + version
                         + "&routing=default";
     // Create the service
     eBayAPIInterfaceService service = new eBayAPIInterfaceService();
     // Assign the request URL to the service locator.
     service.Url = requestURL;
     // Set credentials
     service.RequesterCredentials = new CustomSecurityHeaderType();
     service.RequesterCredentials.eBayAuthToken =
         "AgAAAA**AQAAAA**aAAAAA**c8WOVg**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6AAlIeiCpiLoAydj6x9nY+seQ**JiADAA**AAMAAA**sPiqCG+IiAwqtalGeoTnnESc7Br2D+btBopa9arMMDNaOfglryGRHk3tn/aXAj3p2/KmDiKSmYrg51QGFNokYSGUskmH/jjsOtKgoLyTTJZ+3CtWqeAOz/cbrYadAD8l+s6xUfnTk9mWm4BjyAfYqJ1zkNHUC5YaFTk+oaDZPZ9bE7uGjfw1cvQeX6M7TalgTSygqdVV6hOVJZ3I9UPuO66HchFTPvd4n02aZ2UfsXrcYdOpstNdjLuETQIB5tmUWo6uiCwh/r+eiWt8jIycZegb/9uRHzwEy7rW9Tk7fIpIohoBtryYRLUnMJvy9Dg4l++AhFY0yakWJsWu7VHy7eCuz+OI0Pk+E+uOQhgQRzIji96K6/AnBNV9lLiOa6CiI5MdkcrF2Z4Kr4WoxAgy+4WjoUq+PRG8eDHseFWANwOVhmY9qZJq0ulR9SNcXd8FoRiinxzx3f+lO+MgfrRcea2QKKQVoYDI69jKOQ568FVQ6Zp0ClJy9ru/L9IqB87COBLFP6Ie+Zx+2nhgj+GuARYOu2z0Z7kqx+R6H19hIYoxNncQtGi2ruzqWXG+hbFWXTlqrne8IiJr1udgK1ZxJk9FTCCKQCx0s57SXuBkyaM15y2pqC+ze43ZiLGC3wk94pWEACDNRWu4rH27RZTN+ALBoGWkVdSzGxuVfMD164ak4cAJrIiT2OX77FqnLN+MGcVbfJCAu+BREtguSzW6JmM9qHXHBI+4H/jfGruvYoIt2zg7DzMFv50i+hpnLe5F";
     // use your token
     service.RequesterCredentials.Credentials = new UserIdPasswordType();
     service.RequesterCredentials.Credentials.AppId = Settings.AppId;
     service.RequesterCredentials.Credentials.DevId = Settings.DevId;
     service.RequesterCredentials.Credentials.AuthCert = Settings.CertId;
     // Make the call
     GetOrderTransactionsRequestType request = new GetOrderTransactionsRequestType();
     request.Version = "949";
     var response = service.GetOrderTransactions(request);
     Console.WriteLine(response.Timestamp);
 }
Exemplo n.º 8
0
        /// <summary>
        /// Get a list of all categories and IDs
        /// This will help with setting the leaf category for you item.
        /// </summary>
        public static void GetAllCategoriesRequest()
        {
            eBayAPIInterfaceService service = EbayCalls.eBayServiceCall("GetCategories");

            GetCategoriesRequestType request = new GetCategoriesRequestType();

            request.Version        = "949";
            request.CategorySiteID = "3";
            request.DetailLevel    = new DetailLevelCodeTypeCollection {
                DetailLevelCodeType.ReturnAll
            };
            GetCategoriesResponseType response = service.GetCategories(request);

            Console.WriteLine("=====================================");
            Console.WriteLine("CategoryID - Name List");
            Console.WriteLine("=====================================");

            using (StreamWriter writetext = new StreamWriter("categories.csv"))
            {
                foreach (dynamic cat in response.CategoryArray)
                {
                    Console.WriteLine("{0} - {1}", cat.CategoryID, cat.CategoryName);
                    writetext.WriteLine("{0},\"{1}\"", cat.CategoryID, cat.CategoryName);
                }
            }
        }
Exemplo n.º 9
0
        public static void GetNewOrders()
        {
            string endpoint = "https://api.sandbox.ebay.com/wsapi";
            string callName = "GetOrders";
            string siteId   = "2";
            string version  = "949";
            // Build the request URL
            string requestURL = endpoint
                                + "?callname=" + callName
                                + "&siteid=" + siteId
                                + "&appid=" + Settings.AppId
                                + "&version=" + version
                                + "&routing=default";
            // Create the service
            eBayAPIInterfaceService service = new eBayAPIInterfaceService();

            // Assign the request URL to the service locator.
            service.Url = requestURL;
            // Set credentials
            service.RequesterCredentials = new CustomSecurityHeaderType();
            service.RequesterCredentials.eBayAuthToken =
                "AgAAAA**AQAAAA**aAAAAA**Tz2NVg**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wFk4GhDpWLqA+dj6x9nY+seQ**kKoDAA**AAMAAA**1FzOBx5mSGbycTN2Pa7AffEQ8jbDk77g27juD4aFZeTrgQs94kRZY5Bjq1ifH088RviVP/9RZ0AVnK+qEfDi2M5uiDYT5fb1b8tJ+AaQjRfYG5I30M/rkUGolkTvwL4X9glOE147yCW5GGA8PG8SRZVjJ4myeO25v86TcJmmBmpHLbbN3V/7v6w4Gcovel1jB0QC6Ae5vDRTHt0N7SxSTTFFUQ4yQiLM5CpaVxa8Rp3mTxMS4DR5OEd0MTWyA7BlWsnN2TrLVFrYarrhKOE+6BS3lPdAdHMfB9uTl5JDR1d133zU+++P+VBLguWPO0EaGxs2sJ1NAwVHlEUslApdDIXH95XQIf0d8S+QOnmQ94lJ6eyjJfTqCyPjlFxCIA+9GzCbnOJjn1+LyrzD9zQrVPejuChy9qxYxikCoRUA0GrLLMsf77TBkNnKh5cgcyHvRG1NYeM596KEhvkvVEpKKr+ajC13SNkncl4wdvjV7AIpX+6UaGxbDjbuvGtLZU72qL1SmbZgOlp/UNFC/4bBG7aViG8+OK5UiI2dKI7wX2OuKEWy1fCOXSlUi8FwiaJCtIH4Lvj8cXYb0fhZ3ODPO+zenrK8XHXbau/4mA3YRwdPiLIuZjJUzUkaHEOQu4U5dBFz3YdK+S1K72nnBRmjuvS8LmNGSnUpf9fInLKP7o4CY9arWWTJqSmitlrYBXqfy70JsIaZNvpg6TamFAv3/TAaoFbgCsE1Um/PSY3C86ZEgy9QWrCwN7pvJs4SpW3I";
            // use your token
            service.RequesterCredentials.Credentials          = new UserIdPasswordType();
            service.RequesterCredentials.Credentials.AppId    = Settings.AppId;
            service.RequesterCredentials.Credentials.DevId    = Settings.DevId;
            service.RequesterCredentials.Credentials.AuthCert = Settings.CertId;
            // Make the call
            GetOrdersRequestType request = new GetOrdersRequestType();

            request.CreateTimeFrom          = new DateTime(2015, 12, 1);
            request.CreateTimeTo            = DateTime.Now;
            request.CreateTimeFromSpecified = true;
            request.CreateTimeToSpecified   = true;
            request.DetailLevel             = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll };
            request.Version = "949";
            var response = service.GetOrders(request);

            Console.WriteLine("New orders: \n");
            foreach (var order in response.OrderArray)
            {
                if (order.CheckoutStatus.Status == CompleteStatusCodeType.Complete)
                {
                    Console.WriteLine("Order Id: {0}", order.OrderID);
                    Console.WriteLine("Amount Paid: {0:c}", order.AmountPaid.Value);
                    Console.WriteLine("Shipped Time: {0}", order.ShippedTime);
                    int itemIdex = 0;
                    foreach (var transaction in order.TransactionArray)
                    {
                        Console.WriteLine("Order Item {1}: {0}", transaction.Item.Title, itemIdex + 1);
                    }
                    Console.WriteLine();
                }
            }
        }
Exemplo n.º 10
0
        void GetEbayTime()
        {
            //create new service
            string szServerURL = "";
            string callname = "GeteBayOfficialTime";
            string devID, appID, certID, userToken;
            int    siteID;
            string version = "551";

            eBayAPIInterfaceService service = new eBayAPIInterfaceService();

            szServerURL = ConfigurationManager.AppSettings["ServerUrl"];

            devID  = ConfigurationManager.AppSettings["DevID"];
            appID  = ConfigurationManager.AppSettings["AppID"];
            certID = ConfigurationManager.AppSettings["CertID"];

            //Get the User Token to Use
            userToken = ConfigurationManager.AppSettings["UserToken"];

            //SiteID = 0  (US) - UK = 3, Canada = 2, Australia = 15, ....
            //SiteID Indicates the eBay site to associate the call with
            siteID = 0;

            service.RequesterCredentials = new CustomSecurityHeaderType();
            service.RequesterCredentials.eBayAuthToken = ConfigurationManager.AppSettings["UserToken"];    // use your token

            service.RequesterCredentials.Credentials          = new UserIdPasswordType();
            service.RequesterCredentials.Credentials.AppId    = ConfigurationManager.AppSettings["AppID"];
            service.RequesterCredentials.Credentials.DevId    = ConfigurationManager.AppSettings["DevID"];
            service.RequesterCredentials.Credentials.AuthCert = ConfigurationManager.AppSettings["CertID"];


            string requestURL = szServerURL + "?callname=" + callname + "&siteid=" + siteID
                                + "&appid=" + appID + "&version=" + version + "&routing=default";

            service.Url = requestURL;

            GeteBayOfficialTimeRequestType request = new GeteBayOfficialTimeRequestType();

            request.Version = "459";
            GeteBayOfficialTimeResponseType response = service.GeteBayOfficialTime(request);

            datepick_ebay.Value = response.Timestamp;
            datepick_ebay.Value = datepick_ebay.Value.AddHours(-7);
            label2.Text         = datepick_ebay.Value.ToString();
            //label2.Text = response.Timestamp.ToString();
        }
Exemplo n.º 11
0
        /// <summary>
        /// Add item to eBay. Once verified.
        /// </summary>
        /// <param name="item">Accepts ItemType object from VerifyAddItem method.</param>
        public static void AddItemRequest(ItemType item)
        {
            eBayAPIInterfaceService service = EbayCalls.eBayServiceCall("AddItem");

            AddItemRequestType request = new AddItemRequestType();

            request.Version       = "949";
            request.ErrorLanguage = "en_US";
            request.WarningLevel  = WarningLevelCodeType.High;
            request.Item          = item;

            AddItemResponseType response = service.AddItem(request);

            Console.WriteLine("Item Added");
            Console.WriteLine("ItemID: {0}", response.ItemID); // Item ID
        }
Exemplo n.º 12
0
        public static string ebaytime()
        {
            string endpoint = "https://api.sandbox.ebay.com/wsapi";
            string callName = "GeteBayOfficialTime";
            string siteId   = "0";
            string appId    = "Private92-3d36-4442-8881-1b52d163268"; // use your app ID
            string devId    = "301c8b78-4318-48ae-a825-84a6bde6f137"; // use your dev ID
            string certId   = "3d0c5934-c325-4a5b-a9f5-dc28cf84f13d"; // use your cert ID
            string version  = "405";

            // Build the request URL
            string requestURL = endpoint
                                + "?callname=" + callName
                                + "&siteid=" + siteId
                                + "&appid=" + appId
                                + "&version=" + version
                                + "&routing=default";

            // Create the service
            eBayAPIInterfaceService service = new eBayAPIInterfaceService();

            // Assign the request URL to the service locator.
            service.Url = requestURL;

            // Set credentials
            service.RequesterCredentials = new CustomSecurityHeaderType();
            service.RequesterCredentials.eBayAuthToken        = "AgAAAA**AQAAAA**aAAAAA**UWN5VQ**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wFk4GhDZeKpQudj6x9nY+seQ**3HoDAA**AAMAAA**2babZNpL6Q8PvLhxSkE42UeJUsJ943AV42duhbHvUj54sg2Rl59cr29Pca56Zs0NouehEBz3GbDLdn8PJbqPK6kYi1COtPiN1qUyZBOWjxvU9G977ntsLh4MijbKycskL5GV0VZj504vuZsU9swT9lrVevT3I5amBbPa5jLOwHymgFZm6UUztduvEN/7krvNebmrQbze7FYHraMkDO9lTuw02MnaAGSMutJqnhdo+aIKiguOV+oEF7BJpCJumwan3zAEFoE9yQo2/uNTGsDKdXdXTj5vlGVVD2mFKG73MO2J6CRBilSAlDHSNSWbValjlvetvGfDQBRi0cV1bqJCWmsFGLAS/sQec6fmbroyk6Cs0gS5CRnYzm9BXBiYr8TRmWl9qx3gIPA5Kgqo/AiZu3AkUOYJlwcVeAGcGTGZgRFT0gO9wTzmHfSJka76tXfSHzxO6/nKWoa71BoxhjL6qbcjD1HAiBrJoj3y1+b3JFd17L02A17kvUOfQyoS0u/VyH8cgHwL3IkP6S1KQtOLeUDD3QimMPBiTnuXEqqzqT38LreMCirrNHvNf5HzDv6ijJZmHco5y6havfiFgp+oDl/pbMeDSOi3KC47Uft2sI6+/SNyS6GpMwTdAzAEmqI0Jhau0ZkWf1egx1mNzS4AFervg+P/oi4zk6vYDUN6EK0OZu/QBJRQM+TSj6/cWsiutzd+Wtu43WfkIBGh5uTXCEXTgmAPsFoCk26tgUFEt9chwYiSiFXx5l+amTbbajff"; // use your token
            service.RequesterCredentials.Credentials          = new UserIdPasswordType();
            service.RequesterCredentials.Credentials.AppId    = appId;
            service.RequesterCredentials.Credentials.DevId    = devId;
            service.RequesterCredentials.Credentials.AuthCert = certId;

            // Make the call to GeteBayOfficialTime
            GeteBayOfficialTimeRequestType request = new GeteBayOfficialTimeRequestType();

            request.Version = "405";

            GeteBayOfficialTimeResponseType response = service.GeteBayOfficialTime(request);

            Console.WriteLine("The time at eBay headquarters in San Jose, California, USA, is:");
            Console.WriteLine(response.Timestamp);

            return("ebay time : " + response.Timestamp.ToString());
        }
Exemplo n.º 13
0
        public static GetItemResponseType GetItemRequest(string ItemID)
        {
            eBayAPIInterfaceService service = EbayCall.eBayServiceCall("GetItem");

            GetItemRequestType request = new GetItemRequestType();

            request.ItemID  = ItemID;
            request.Version = "965";
            request.IncludeItemSpecifics = true;
            request.DetailLevel          = new DetailLevelCodeTypeCollection()
            {
                DetailLevelCodeType.ItemReturnDescription
            };

            GetItemResponseType response = service.GetItem(request);

            //Console.WriteLine("=====================================");
            //Console.WriteLine("Item Iitle - {0}", response.Item.Title);
            //Console.WriteLine("Primary Category: {0}", response.Item.PrimaryCategory.CategoryName);

            //Console.WriteLine("=====================================");

            //Console.WriteLine("ItemID: {0}", response.Item.ItemID);
            //Console.WriteLine("Condition: {0}", response.Item.ConditionDisplayName);
            //Console.WriteLine("=====================================");

            //Console.WriteLine("Variation\n  +  {0}", string.Join("\n  +  ", response.Item.Variations.VariationSpecificsSet.ToArray().Select(x => x.Name + ": " + string.Join("| ", x.Value.ToArray()))));

            //Console.WriteLine("=====================================");

            //Console.WriteLine("Listing Duration: {0}", response.Item.ListingDuration);
            //Console.WriteLine("Start Price: {0} {1}", response.Item.StartPrice.Value, response.Item.Currency);
            //Console.WriteLine("Payment Type[0]: {0}", response.Item.PaymentMethods[0]);
            //Console.WriteLine("PayPal Email Address: {0}", response.Item.PayPalEmailAddress);
            //Console.WriteLine("Postal Code: {0}", response.Item.PostalCode);
            //Console.WriteLine("PictureURL:\n  +  {0}", string.Join("\n  +  ", response.Item.PictureDetails.PictureURL.ToArray()));

            //Console.WriteLine("=====================================");

            //Console.WriteLine("Item specifics\n  +  {0}", string.Join("\n  +  ", response.Item.ItemSpecifics.ToArray().Select(x => x.Name + ": " + string.Join("||", x.Value.ToArray())).ToList()));
            // ...Convert response object to JSON to see all
            return(response);
        }
Exemplo n.º 14
0
        public static void GetEbayDetailsRequest()
        {
            eBayAPIInterfaceService service = EbayCalls.EbayServiceCall("GetEbayDetails");

            GeteBayDetailsRequestType request = new GeteBayDetailsRequestType();

            request.Version    = "949";
            request.DetailName = new DetailNameCodeTypeCollection {
                DetailNameCodeType.ReturnPolicyDetails
            };

            GeteBayDetailsResponseType response = service.GeteBayDetails(request);

            Console.WriteLine("================");
            Console.WriteLine("Ebay request Details");
            Console.WriteLine("================");

            Console.WriteLine("Ack: {0}", response.Ack);
            Console.WriteLine("Version: {0}", response.Version);
            Console.WriteLine("Build: {0}", response.Build);
        }
Exemplo n.º 15
0
        public static void TestSandbox()
        {
            string endpoint = "https://api.sandbox.ebay.com/wsapi";
            string callName = "GeteBayOfficialTime";
            string siteId   = "0";
            string appId    = "KoboIncab-650b-4637-abcd-a6792d80993"; // use your app ID
            string devId    = "c81af250-3212-4e28-8d7b-bee0826266e1"; // use your dev ID
            string certId   = "d82f3fcb-303c-409b-9446-235e799f8589"; // use your cert ID
            string version  = "405";
            // Build the request URL
            string requestURL = endpoint
                                + "?callname=" + callName
                                + "&siteid=" + siteId
                                + "&appid=" + appId
                                + "&version=" + version
                                + "&routing=default";
            // Create the service
            eBayAPIInterfaceService service = new eBayAPIInterfaceService();

            // Assign the request URL to the service locator.
            service.Url = requestURL;
            // Set credentials
            service.RequesterCredentials = new CustomSecurityHeaderType();
            service.RequesterCredentials.eBayAuthToken =
                "AgAAAA**AQAAAA**aAAAAA**Tz2NVg**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wFk4GhDpWLqA+dj6x9nY+seQ**kKoDAA**AAMAAA**1FzOBx5mSGbycTN2Pa7AffEQ8jbDk77g27juD4aFZeTrgQs94kRZY5Bjq1ifH088RviVP/9RZ0AVnK+qEfDi2M5uiDYT5fb1b8tJ+AaQjRfYG5I30M/rkUGolkTvwL4X9glOE147yCW5GGA8PG8SRZVjJ4myeO25v86TcJmmBmpHLbbN3V/7v6w4Gcovel1jB0QC6Ae5vDRTHt0N7SxSTTFFUQ4yQiLM5CpaVxa8Rp3mTxMS4DR5OEd0MTWyA7BlWsnN2TrLVFrYarrhKOE+6BS3lPdAdHMfB9uTl5JDR1d133zU+++P+VBLguWPO0EaGxs2sJ1NAwVHlEUslApdDIXH95XQIf0d8S+QOnmQ94lJ6eyjJfTqCyPjlFxCIA+9GzCbnOJjn1+LyrzD9zQrVPejuChy9qxYxikCoRUA0GrLLMsf77TBkNnKh5cgcyHvRG1NYeM596KEhvkvVEpKKr+ajC13SNkncl4wdvjV7AIpX+6UaGxbDjbuvGtLZU72qL1SmbZgOlp/UNFC/4bBG7aViG8+OK5UiI2dKI7wX2OuKEWy1fCOXSlUi8FwiaJCtIH4Lvj8cXYb0fhZ3ODPO+zenrK8XHXbau/4mA3YRwdPiLIuZjJUzUkaHEOQu4U5dBFz3YdK+S1K72nnBRmjuvS8LmNGSnUpf9fInLKP7o4CY9arWWTJqSmitlrYBXqfy70JsIaZNvpg6TamFAv3/TAaoFbgCsE1Um/PSY3C86ZEgy9QWrCwN7pvJs4SpW3I";
            // use your token
            service.RequesterCredentials.Credentials          = new UserIdPasswordType();
            service.RequesterCredentials.Credentials.AppId    = appId;
            service.RequesterCredentials.Credentials.DevId    = devId;
            service.RequesterCredentials.Credentials.AuthCert = certId;
            // Make the call to GeteBayOfficialTime
            GeteBayOfficialTimeRequestType request = new GeteBayOfficialTimeRequestType();

            request.Version = "405";
            GeteBayOfficialTimeResponseType response = service.GeteBayOfficialTime(request);

            Console.WriteLine("The time at eBay headquarters in San Jose, California, USA, is:");
            Console.WriteLine(response.Timestamp);
        }
Exemplo n.º 16
0
        public static void GetItemRequest(string itemID)
        {
            eBayAPIInterfaceService service = EbayCalls.EbayServiceCall("GetItem");

            GetItemRequestType request = new GetItemRequestType();

            request.Version = "949";
            request.ItemID  = itemID;
            GetItemResponseType response = service.GetItem(request);

            Console.WriteLine("=======================");
            Console.WriteLine("Item Title - {0}", response.Item.Title);
            Console.WriteLine("=======================");

            Console.WriteLine("ItemID: {0}", response.Item.ItemID);
            Console.WriteLine("Primary Category: {0}", response.Item.PrimaryCategory);
            Console.WriteLine("Listing Duration: {0}", response.Item.ListingDuration);
            Console.WriteLine("Start Price: {0}", response.Item.StartPrice);
            Console.WriteLine("Payment Type[0]: {0}", response.Item.PaymentMethods[0]);
            Console.WriteLine("PayPal Email Address: {0}", response.Item.PayPalEmailAddress);
            Console.WriteLine("Postal Code: {0}", response.Item.PostalCode);
        }
Exemplo n.º 17
0
        /// <summary>
        /// Retrieve item details.
        /// </summary>
        /// <param name="ItemID">eBay Item ID</param>
        public static void GetItemRequest(string ItemID)
        {
            eBayAPIInterfaceService service = EbayCalls.eBayServiceCall("GetItem");

            GetItemRequestType request = new GetItemRequestType();

            request.Version = "949";
            request.ItemID  = ItemID;
            GetItemResponseType response = service.GetItem(request);

            Console.WriteLine("=====================================");
            Console.WriteLine("Item Iitle - {0}", response.Item.Title);
            Console.WriteLine("=====================================");

            Console.WriteLine("ItemID: {0}", response.Item.ItemID);
            Console.WriteLine("Primary Category: {0}", response.Item.PrimaryCategory.CategoryName);
            Console.WriteLine("Listing Duration: {0}", response.Item.ListingDuration);
            Console.WriteLine("Start Price: {0} {1}", response.Item.StartPrice.Value, response.Item.Currency);
            Console.WriteLine("Payment Type[0]: {0}", response.Item.PaymentMethods[0]);
            Console.WriteLine("PayPal Email Address: {0}", response.Item.PayPalEmailAddress);
            Console.WriteLine("Postal Code: {0}", response.Item.PostalCode);
            // ...Convert response object to JSON to see all
        }
Exemplo n.º 18
0
        /// <summary>
        /// Get features for a specific category ID
        /// </summary>
        /// <param name="CategoryID">Any CategoryID</param>
        public static void GetCategoryFeaturesRequest(string CategoryID)
        {
            eBayAPIInterfaceService service = EbayCalls.eBayServiceCall("GetCategoryFeatures");

            GetCategoryFeaturesRequestType request = new GetCategoryFeaturesRequestType();

            request.Version      = "949";
            request.WarningLevel = WarningLevelCodeType.High;
            request.CategoryID   = CategoryID;
            request.FeatureID    = new FeatureIDCodeTypeCollection {
                FeatureIDCodeType.ConditionValues,
                FeatureIDCodeType.ListingDurations,
                FeatureIDCodeType.HandlingTimeEnabled,
                FeatureIDCodeType.MaxFlatShippingCost,
                FeatureIDCodeType.PayPalRequired,
                FeatureIDCodeType.BestOfferEnabled,
                FeatureIDCodeType.ReturnPolicyEnabled
            };

            request.DetailLevel = new DetailLevelCodeTypeCollection {
                DetailLevelCodeType.ReturnAll
            };
            GetCategoryFeaturesResponseType response = service.GetCategoryFeatures(request);

            Console.WriteLine("=====================================");
            Console.WriteLine("Category Features");
            Console.WriteLine("=====================================");

            Console.WriteLine("Ack: {0}", response.Ack);
            Console.WriteLine("Version: {0}", response.Version);
            Console.WriteLine("Build: {0}", response.Build);
            Console.WriteLine("Category Version: {0}", response.CategoryVersion);
            Console.WriteLine("Update Time: {0}", response.UpdateTime);
            Console.WriteLine("Return Policy Enabled: {0}", response.SiteDefaults.ReturnPolicyEnabled);
            Console.WriteLine("PayPal Required: {0}", response.SiteDefaults.PayPalRequired);
            // ...
        }
Exemplo n.º 19
0
 public static void TestSandbox()
 {
     string endpoint = "https://api.sandbox.ebay.com/wsapi";
     string callName = "GeteBayOfficialTime";
     string siteId = "0";
     string appId = "KoboIncab-650b-4637-abcd-a6792d80993"; // use your app ID
     string devId = "c81af250-3212-4e28-8d7b-bee0826266e1"; // use your dev ID
     string certId = "d82f3fcb-303c-409b-9446-235e799f8589"; // use your cert ID
     string version = "405";
     // Build the request URL
     string requestURL = endpoint
                         + "?callname=" + callName
                         + "&siteid=" + siteId
                         + "&appid=" + appId
                         + "&version=" + version
                         + "&routing=default";
     // Create the service
     eBayAPIInterfaceService service = new eBayAPIInterfaceService();
     // Assign the request URL to the service locator.
     service.Url = requestURL;
     // Set credentials
     service.RequesterCredentials = new CustomSecurityHeaderType();
     service.RequesterCredentials.eBayAuthToken =
         "AgAAAA**AQAAAA**aAAAAA**Tz2NVg**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wFk4GhDpWLqA+dj6x9nY+seQ**kKoDAA**AAMAAA**1FzOBx5mSGbycTN2Pa7AffEQ8jbDk77g27juD4aFZeTrgQs94kRZY5Bjq1ifH088RviVP/9RZ0AVnK+qEfDi2M5uiDYT5fb1b8tJ+AaQjRfYG5I30M/rkUGolkTvwL4X9glOE147yCW5GGA8PG8SRZVjJ4myeO25v86TcJmmBmpHLbbN3V/7v6w4Gcovel1jB0QC6Ae5vDRTHt0N7SxSTTFFUQ4yQiLM5CpaVxa8Rp3mTxMS4DR5OEd0MTWyA7BlWsnN2TrLVFrYarrhKOE+6BS3lPdAdHMfB9uTl5JDR1d133zU+++P+VBLguWPO0EaGxs2sJ1NAwVHlEUslApdDIXH95XQIf0d8S+QOnmQ94lJ6eyjJfTqCyPjlFxCIA+9GzCbnOJjn1+LyrzD9zQrVPejuChy9qxYxikCoRUA0GrLLMsf77TBkNnKh5cgcyHvRG1NYeM596KEhvkvVEpKKr+ajC13SNkncl4wdvjV7AIpX+6UaGxbDjbuvGtLZU72qL1SmbZgOlp/UNFC/4bBG7aViG8+OK5UiI2dKI7wX2OuKEWy1fCOXSlUi8FwiaJCtIH4Lvj8cXYb0fhZ3ODPO+zenrK8XHXbau/4mA3YRwdPiLIuZjJUzUkaHEOQu4U5dBFz3YdK+S1K72nnBRmjuvS8LmNGSnUpf9fInLKP7o4CY9arWWTJqSmitlrYBXqfy70JsIaZNvpg6TamFAv3/TAaoFbgCsE1Um/PSY3C86ZEgy9QWrCwN7pvJs4SpW3I";
     // use your token
     service.RequesterCredentials.Credentials = new UserIdPasswordType();
     service.RequesterCredentials.Credentials.AppId = appId;
     service.RequesterCredentials.Credentials.DevId = devId;
     service.RequesterCredentials.Credentials.AuthCert = certId;
     // Make the call to GeteBayOfficialTime
     GeteBayOfficialTimeRequestType request = new GeteBayOfficialTimeRequestType();
     request.Version = "405";
     GeteBayOfficialTimeResponseType response = service.GeteBayOfficialTime(request);
     Console.WriteLine("The time at eBay headquarters in San Jose, California, USA, is:");
     Console.WriteLine(response.Timestamp);
 }
Exemplo n.º 20
0
    public SellingManagerSoldOrderType GetSaleRecordDetails(string itemID, string transactionID, string userToken)
    {
        string callname = "GetSellingManagerSaleRecord";

        #region Initialise Needed Variables

        //Get the Server to use (Sandbox or Production)
        string serverUrl = ConfigurationManager.AppSettings["TradingService"];

        //SiteID = 0  (US) - UK = 3, Canada = 2, Australia = 15, ....
        //string siteID = "0";

        eBayAPIInterfaceService service = new eBayAPIInterfaceService();
        string requestURL = serverUrl + "?callname=" + callname + "&siteid=" + siteID
                            + "&appid=" + AppID + "&version=" + version + "&routing=default";
        service.Url = requestURL;

        // Set credentials
        service.RequesterCredentials = new CustomSecurityHeaderType();
        service.RequesterCredentials.Credentials = new UserIdPasswordType();
        service.RequesterCredentials.Credentials.AppId = AppID;
        service.RequesterCredentials.Credentials.DevId = DevID;
        service.RequesterCredentials.Credentials.AuthCert = CertID;
        service.RequesterCredentials.eBayAuthToken = userToken;
        #endregion

        GetSellingManagerSaleRecordRequestType request = new GetSellingManagerSaleRecordRequestType();
        request.ItemID = itemID;
        request.TransactionID = transactionID;
        request.Version = version;
        GetSellingManagerSaleRecordResponseType response = service.GetSellingManagerSaleRecord(request);
        return response.SellingManagerSoldOrder;
    }
Exemplo n.º 21
0
    public string ReviseEbayItemTitle(string ItemId, string Title, string userToken)
    {
        string callname = "ReviseItem";

        #region Initialise Needed Variables

        //Get the Server to use (Sandbox or Production)
        string serverUrl = ConfigurationManager.AppSettings["TradingService"];

        //SiteID = 0  (US) - UK = 3, Canada = 2, Australia = 15, ....
        //string siteID = "0";

        eBayAPIInterfaceService service = new eBayAPIInterfaceService();
        string requestURL = serverUrl + "?callname=" + callname + "&siteid=" + siteID
                            + "&appid=" + AppID + "&version=" + version + "&routing=default";
        service.Url = requestURL;

        // Set credentials
        service.RequesterCredentials = new CustomSecurityHeaderType();
        service.RequesterCredentials.Credentials = new UserIdPasswordType();
        service.RequesterCredentials.Credentials.AppId = AppID;
        service.RequesterCredentials.Credentials.DevId = DevID;
        service.RequesterCredentials.Credentials.AuthCert = CertID;
        service.RequesterCredentials.eBayAuthToken = userToken;
        #endregion

        ReviseItemRequestType requestType = new ReviseItemRequestType();
        ItemType itemType = new ItemType();
        itemType.ItemID = ItemId;

        itemType.Title = Title;

        requestType.Item = itemType;
        requestType.Version = "833";

        try
        {
            ReviseItemResponseType response = service.ReviseItem(requestType);
            if (response.Ack == AckCodeType.Success || response.Ack == AckCodeType.Warning)
                return null;
            else
                return response.Errors.First().ShortMessage;
        }
        catch (Exception ex)
        {
            if (ex.Message.ToLower().Contains("auth token"))
                throw new InvalidEbayCredentialsException();
            else
                throw ex;
        }

        return "";
    }
Exemplo n.º 22
0
    public string GetUser(string userToken)
    {
        string callname = "GetUser";

        #region Initialise Needed Variables

        //Get the Server to use (Sandbox or Production)
        string serverUrl = ConfigurationManager.AppSettings["TradingService"];

        //SiteID = 0  (US) - UK = 3, Canada = 2, Australia = 15, ....
        //string siteID = "0";

        eBayAPIInterfaceService service = new eBayAPIInterfaceService();
        string requestURL = serverUrl + "?callname=" + callname + "&siteid=" + siteID
                            + "&appid=" + AppID + "&version=833&routing=default";
        service.Url = requestURL;

        // Set credentials
        service.RequesterCredentials = new CustomSecurityHeaderType();
        service.RequesterCredentials.Credentials = new UserIdPasswordType();
        service.RequesterCredentials.Credentials.AppId = AppID;
        service.RequesterCredentials.Credentials.DevId = DevID;
        service.RequesterCredentials.Credentials.AuthCert = CertID;
        service.RequesterCredentials.eBayAuthToken = userToken;
        #endregion

        GetUserRequestType request = new GetUserRequestType();
        request.Version = "833";

        try
        {
            GetUserResponseType response = service.GetUser(request);
            if (response.Ack == AckCodeType.Success)
                return response.User.UserID;
            else
                return null;
        }
        catch (Exception ex)
        {
            if (ex.Message.ToLower().Contains("auth token"))
                throw new InvalidEbayCredentialsException();
            else
                throw ex;
        }
    }
Exemplo n.º 23
0
    public List<Seller_Item> GetUserItemsList(string userToken)
    {
        string callname = "GetMyeBaySelling";

        #region Initialise Needed Variables

        string version1 = "929";
        //Get the Server to use (Sandbox or Production)
        string serverUrl = ConfigurationManager.AppSettings["TradingService"];

        //SiteID = 0  (US) - UK = 3, Canada = 2, Australia = 15, ....
        string siteID = "15";/*Updated by javed 27-11-2013 --- Previous value was 0*/

        eBayAPIInterfaceService service = new eBayAPIInterfaceService();
        string requestURL = serverUrl + "?callname=" + callname + "&siteid=" + siteID
                            + "&appid=" + AppID + "&version=" + version1 + "&routing=default";

        service.Url = requestURL;

        // Set credentials
        service.RequesterCredentials = new CustomSecurityHeaderType();
        service.RequesterCredentials.Credentials = new UserIdPasswordType();
        service.RequesterCredentials.Credentials.AppId = AppID;
        service.RequesterCredentials.Credentials.DevId = DevID;
        service.RequesterCredentials.Credentials.AuthCert = CertID;
        service.RequesterCredentials.eBayAuthToken = userToken;
        #endregion

        GetMyeBaySellingRequestType request = new GetMyeBaySellingRequestType();
        request.WarningLevel = WarningLevelCodeType.High;
        //request.EndTimeFrom = DateTime.Today;
        //request.EndTimeFromSpecified = true;
        //request.EndTimeTo = DateTime.Today.AddDays(120);
        //request.EndTimeToSpecified = true;
        request.Version = version1;
        request.DetailLevel = new DetailLevelCodeType[] { DetailLevelCodeType.ItemReturnDescription, DetailLevelCodeType.ItemReturnAttributes };
        //request.ActiveList.Pagination = new PaginationType();
        //request.ActiveList.Pagination.PageNumber = 1;
           // request.ActiveList.Pagination.PageNumberSpecified = true;
        //request.ActiveList.Pagination.EntriesPerPage = 200;
           // request.ActiveList.Pagination.EntriesPerPageSpecified = true;
        request.ActiveList.Include = true;
        request.ActiveList.DurationInDays = 1;
        request.ActiveList.Include = true;
        request.ActiveList.IncludeNotes = true;

        //request.ActiveList.Pagination.PageNumber = 1;
        //request.ActiveList.Pagination.EntriesPerPage = 200;
        //request.ActiveList.Pagination.EntriesPerPageSpecified = true;
        //request.ActiveList.Pagination.PageNumberSpecified = true;

        try
        {
            List<Seller_Item> items = new List<Seller_Item>();
            bool moreItem = true;
            while (moreItem == true)
            {
                GetMyeBaySellingResponseType response = service.GetMyeBaySelling(request);

                foreach (var s in response.ActiveList.ItemArray)
                {
                    try
                    {
                        Seller_Item si = new Seller_Item()
                        {
                            CustomLabel = s.SKU,
                            PictureURL = s.PictureDetails != null && s.PictureDetails.PictureURL != null ? s.PictureDetails.PictureURL[0] : string.Empty,
                            ItemViewURL = s.ListingDetails.ViewItemURL,
                            BinPrice = s.ListingDetails.ConvertedBuyItNowPrice.Value,
                            CurrentPrice = s.ListingDetails.ConvertedStartPrice.Value,
                            Currency = s.ListingDetails.ConvertedStartPrice.currencyID != null ? s.ListingDetails.ConvertedStartPrice.currencyID.ToString() : string.Empty,
                            EndDate = s.ListingDetails.EndTime,
                            StartDate = s.ListingDetails.StartTime,
                            ItemID = s.ItemID,
                            ItemName = s.Title,
                            IsPromoItem = s.SellingStatus.PromotionalSaleDetails != null && s.SellingStatus.PromotionalSaleDetails.StartTime.Date <= System.DateTime.Today.Date && s.SellingStatus.PromotionalSaleDetails.EndTime.Date >= System.DateTime.Today.Date ? true : false,
                            Height = s.ShippingPackageDetails.PackageDepth != null ? (decimal?)s.ShippingPackageDetails.PackageDepth.Value : null,
                            Length = s.ShippingPackageDetails.PackageLength != null ? (decimal?)s.ShippingPackageDetails.PackageLength.Value : null,
                            Width = s.ShippingPackageDetails.PackageWidth != null ? (decimal?)s.ShippingPackageDetails.PackageWidth.Value : null,
                            Weight = s.ShippingPackageDetails.WeightMajor != null ? (decimal?)s.ShippingPackageDetails.WeightMajor.Value : null,
                            WeightMinor = s.ShippingPackageDetails.WeightMinor != null ? (decimal?)s.ShippingPackageDetails.WeightMinor.Value : null,
                            CategoryID = s.PrimaryCategory.CategoryID,
                            CategoryName = s.PrimaryCategory.CategoryName,
                            Quantity = s.Quantity,
                            Discription = s.Description,
                            CountryCode = countryID,
                            CountryShortCode = countryShortID,
                            CurrentSales = s.SellingStatus.QuantitySold,
                            QuantityAvailable = s.QuantityAvailable

                        };
                        items.Add(si);

                    }
                    catch (Exception ex)
                    {
                        Logging.WriteLog(LogType.Critical, ex.ToString());
                    }
                }

                if (response.ActiveList.ItemArray.Count() == 200)
                    response.ActiveList.PaginationResult.TotalNumberOfPages += 1;
                else
                    moreItem = false;

            }

            return items;

            //List<Seller_Item> items = response.ItemArray.Select(s => new Seller_Item
            //{
            //    CustomLabel = s.SKU,
            //    //PictureURL = s.PictureDetails != null && s.PictureDetails.PictureURL != null ? s.PictureDetails.PictureURL[0] : string.Empty,
            //    //ItemViewURL = s.ListingDetails.ViewItemURL,
            //    BinPrice = s.ListingDetails.ConvertedBuyItNowPrice.Value,
            //    CurrentPrice = s.ListingDetails.ConvertedStartPrice.Value,
            //    Currency = s.ListingDetails.ConvertedStartPrice.currencyID != null ? s.ListingDetails.ConvertedStartPrice.currencyID.ToString() : string.Empty,
            //    EndDate = s.ListingDetails.EndTime,
            //    StartDate = s.ListingDetails.StartTime,
            //    ItemID = s.ItemID,
            //    ItemName = s.Title,
            //    IsPromoItem = s.SellingStatus.PromotionalSaleDetails != null && s.SellingStatus.PromotionalSaleDetails.StartTime.Date <= System.DateTime.Today.Date && s.SellingStatus.PromotionalSaleDetails.EndTime.Date >= System.DateTime.Today.Date ? true : false,
            //    Height = s.ShippingPackageDetails.PackageDepth != null ? (decimal?)s.ShippingPackageDetails.PackageDepth.Value : null,
            //    Length = s.ShippingPackageDetails.PackageLength != null ? (decimal?)s.ShippingPackageDetails.PackageLength.Value : null,
            //    Width = s.ShippingPackageDetails.PackageWidth != null ? (decimal?)s.ShippingPackageDetails.PackageWidth.Value : null,
            //    //Weight = s.ShippingPackageDetails.WeightMajor != null ? (decimal?)s.ShippingPackageDetails.WeightMajor.Value : null,
            //    //WeightMinor = s.ShippingPackageDetails.WeightMinor != null ? (decimal?)s.ShippingPackageDetails.WeightMinor.Value : null,
            //    CategoryID = s.PrimaryCategory.CategoryID,
            //    CategoryName = s.PrimaryCategory.CategoryName

            //}).ToList();

        }
        catch (Exception ex)
        {
            if (ex.Message.ToLower().Contains("auth token"))
                throw new InvalidEbayCredentialsException();
            else
                throw ex;
        }
    }
Exemplo n.º 24
0
    public GetItemShippingResponseType GetShippingCost(string userToken, string itemID)
    {
        string callname = "GetItemShipping";

        #region Initialise Needed Variables

        //Get the Server to use (Sandbox or Production)
        string serverUrl = ConfigurationManager.AppSettings["TradingService"];

        //SiteID = 0  (US) - UK = 3, Canada = 2, Australia = 15, ....
        string siteID = "15";

        eBayAPIInterfaceService service = new eBayAPIInterfaceService();
        string requestURL = serverUrl + "?callname=" + callname + "&siteid=" + siteID
                            + "&appid=" + AppID + "&version=" + version + "&routing=default";
        service.Url = requestURL;

        // Set credentials
        service.RequesterCredentials = new CustomSecurityHeaderType();
        service.RequesterCredentials.Credentials = new UserIdPasswordType();
        service.RequesterCredentials.Credentials.AppId = AppID;
        service.RequesterCredentials.Credentials.DevId = DevID;
        service.RequesterCredentials.Credentials.AuthCert = CertID;
        service.RequesterCredentials.eBayAuthToken = userToken;

        #endregion

        GetItemShippingRequestType request = new GetItemShippingRequestType();
        request.DestinationCountryCode = CountryCodeType.AU;
        request.DestinationPostalCode = "3025";
        request.ItemID = itemID;
        request.QuantitySold = 1;
        request.Version = "505";
        request.DestinationCountryCodeSpecified = true;
        request.QuantitySoldSpecified = true;

        try
        {
            GetItemShippingResponseType response = service.GetItemShipping(request);
            return response;
        }
        catch (Exception ex)
        {
            if (ex.Message.ToLower().Contains("auth token"))
                throw new InvalidEbayCredentialsException();
            else
                throw ex;
        }
    }
Exemplo n.º 25
0
    public GetMemberMessagesResponseType GetTransactionMessages(string itemID, string BuyerID, string userToken)
    {
        string callname = "GetMemberMessages";

        #region Initialise Needed Variables

        //Get the Server to use (Sandbox or Production)
        string serverUrl = ConfigurationManager.AppSettings["TradingService"];

        //SiteID = 0  (US) - UK = 3, Canada = 2, Australia = 15, ....
        //string siteID = "0";

        eBayAPIInterfaceService service = new eBayAPIInterfaceService();
        string requestURL = serverUrl + "?callname=" + callname + "&siteid=" + siteID
                            + "&appid=" + AppID + "&version=" + version + "&routing=default";
        service.Url = requestURL;

        // Set credentials
        service.RequesterCredentials = new CustomSecurityHeaderType();
        service.RequesterCredentials.Credentials = new UserIdPasswordType();
        service.RequesterCredentials.Credentials.AppId = AppID;
        service.RequesterCredentials.Credentials.DevId = DevID;
        service.RequesterCredentials.Credentials.AuthCert = CertID;
        service.RequesterCredentials.eBayAuthToken = userToken;
        #endregion

        GetMemberMessagesRequestType request = new GetMemberMessagesRequestType();
        request.MailMessageType = MessageTypeCodeType.All;
        request.MailMessageTypeSpecified = true;
        request.WarningLevel = WarningLevelCodeType.High;
        request.MessageStatus = MessageStatusTypeCodeType.Unanswered;
        request.MessageStatusSpecified = true;
        request.ItemID = itemID;
        if (BuyerID != string.Empty)
            request.SenderID = BuyerID;
        request.Version = version;

        try
        {
            GetMemberMessagesResponseType response = service.GetMemberMessages(request);
            return response;
        }
        catch (Exception ex)
        {
            if (ex.Message.ToLower().Contains("auth token"))
                throw new InvalidEbayCredentialsException();
            else
                throw ex;
        }
    }
Exemplo n.º 26
0
        /// <summary>
        /// Verify whether item is ready to be added to eBay.
        /// </summary>
        public static void VerifyAddItemRequest()
        {
            eBayAPIInterfaceService service = EbayCalls.eBayServiceCall("VerifyAddItem");

            VerifyAddItemRequestType request = new VerifyAddItemRequestType();

            request.Version       = "949";
            request.ErrorLanguage = "en_US";
            request.WarningLevel  = WarningLevelCodeType.High;

            var item = new ItemType();

            item.Title           = "My Title";
            item.Description     = "My Description";
            item.PrimaryCategory = new CategoryType
            {
                CategoryID = "11704" // Other DIY Tools
            };
            item.StartPrice = new AmountType
            {
                Value      = 7.98,
                currencyID = CurrencyCodeType.GBP
            };
            // To view ConditionIDs follow the URL
            // http://developer.ebay.com/devzone/guides/ebayfeatures/Development/Desc-ItemCondition.html#HelpingSellersChoosetheRightCondition
            item.ConditionID     = 1000;
            item.Country         = CountryCodeType.GB;
            item.Currency        = CurrencyCodeType.GBP;
            item.DispatchTimeMax = 3;
            item.ListingDuration = "Days_7";
            // Buy It Now fixed price
            item.ListingType = ListingTypeCodeType.FixedPriceItem;
            // Auction
            //item.ListingType = ListingTypeCodeType.Chinese;
            item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection
            {
                BuyerPaymentMethodCodeType.PayPal
            };
            // Default testing paypal email address
            item.PayPalEmailAddress = "*****@*****.**";
            item.PictureDetails     = new PictureDetailsType
            {
                PictureURL = new StringCollection
                {
                    "https://avatar-ssl.xboxlive.com/avatar/ii%20burg%20ii/avatar-body.png"
                }
            };
            item.PostalCode   = "YOUR POSTCODE";
            item.Quantity     = 5; // 1 If Auction
            item.ReturnPolicy = new ReturnPolicyType
            {
                ReturnsAcceptedOption = "ReturnsAccepted",
                ReturnsWithinOption   = "Days_30",
                //RefundOption = "MoneyBack",
                Description = "PLease return if unstatisfied.",
                ShippingCostPaidByOption = "Buyer"
            };
            item.ShippingDetails = new ShippingDetailsType
            {
                ShippingType           = ShippingTypeCodeType.Flat,
                ShippingServiceOptions = new ShippingServiceOptionsTypeCollection
                {
                    new ShippingServiceOptionsType {
                        ShippingServicePriority = 1,
                        // To find a shipping service follow the URL
                        // https://developer.ebay.com/devzone/xml/docs/Reference/ebay/types/ShippingServiceCodeType.html
                        ShippingService     = "UK_Parcelforce48",
                        ShippingServiceCost = new AmountType {
                            Value      = 2.50,
                            currencyID = CurrencyCodeType.GBP
                        }
                    }
                }
            };
            item.Site = SiteCodeType.UK;

            request.Item = item;

            VerifyAddItemResponseType response = service.VerifyAddItem(request);

            Console.WriteLine("ItemID: {0}", response.ItemID);

            // If item is verified, the item will be added.
            if (response.ItemID == "0")
            {
                Console.WriteLine("=====================================");
                Console.WriteLine("Add Item Verified");
                Console.WriteLine("=====================================");
                AddItemRequest(item);
            }
        }
Exemplo n.º 27
0
    public string GetSessionID()
    {
        string callname = "GetSessionID";

        #region Initialise Needed Variables

        //Get the Server to use (Sandbox or Production)
        string serverUrl = ConfigurationManager.AppSettings["TradingService"];

        //SiteID = 0  (US) - UK = 3, Canada = 2, Australia = 15, ....
        //string siteID = "0";

        eBayAPIInterfaceService service = new eBayAPIInterfaceService();
        string requestURL = serverUrl + "?callname=" + callname + "&siteid=" + siteID
                            + "&appid=" + AppID + "&version=" + version + "&routing=default";
        service.Url = requestURL;

        // Set credentials
        service.RequesterCredentials = new CustomSecurityHeaderType();
        service.RequesterCredentials.Credentials = new UserIdPasswordType();
        service.RequesterCredentials.Credentials.AppId = AppID;
        service.RequesterCredentials.Credentials.DevId = DevID;
        service.RequesterCredentials.Credentials.AuthCert = CertID;
        #endregion

        GetSessionIDRequestType request = new GetSessionIDRequestType();
        request.RuName = ConfigurationManager.AppSettings["RuName"];
        request.Version = version;
        GetSessionIDResponseType response = service.GetSessionID(request);
        return response.SessionID;
    }
Exemplo n.º 28
0
    public SellingManagerSoldOrderType[] GetPendingShipmentItems(string userToken)
    {
        string callname = "GetSellingManagerSoldListings";

        #region Initialise Needed Variables

        //Get the Server to use (Sandbox or Production)
        string serverUrl = ConfigurationManager.AppSettings["TradingService"];

        //SiteID = 0  (US) - UK = 3, Canada = 2, Australia = 15, ....
        //string siteID = "0";

        eBayAPIInterfaceService service = new eBayAPIInterfaceService();
        string requestURL = serverUrl + "?callname=" + callname + "&siteid=" + siteID
                            + "&appid=" + AppID + "&version=" + version + "&routing=default";
        service.Url = requestURL;

        // Set credentials
        service.RequesterCredentials = new CustomSecurityHeaderType();
        service.RequesterCredentials.Credentials = new UserIdPasswordType();
        service.RequesterCredentials.Credentials.AppId = AppID;
        service.RequesterCredentials.Credentials.DevId = DevID;
        service.RequesterCredentials.Credentials.AuthCert = CertID;
        service.RequesterCredentials.eBayAuthToken = userToken;
        #endregion

        GetSellingManagerSoldListingsRequestType request = new GetSellingManagerSoldListingsRequestType();
        request.Filter = new SellingManagerSoldListingsPropertyTypeCodeType[] { SellingManagerSoldListingsPropertyTypeCodeType.PaidNotShipped };
        request.Version = version;

        PaginationType pagination = new PaginationType();
        pagination.EntriesPerPage = 500;
        pagination.EntriesPerPageSpecified = true;

        request.Pagination = pagination;

        try
        {
            GetSellingManagerSoldListingsResponseType response = service.GetSellingManagerSoldListings(request);
            return response.SaleRecord;
        }
        catch (Exception ex)
        {
            if (ex.Message.ToLower().Contains("auth token"))
                throw new InvalidEbayCredentialsException();
            else
                throw ex;
        }
    }
Exemplo n.º 29
0
    public CategoryType[] GetCategories(string userToken)
    {
        string callname = "GetCategories";

        #region Initialise Needed Variables

        //Get the Server to use (Sandbox or Production)
        string serverUrl = ConfigurationManager.AppSettings["TradingService"];

        //SiteID = 0  (US) - UK = 3, Canada = 2, Australia = 15, ....
        string siteID = "15";

        eBayAPIInterfaceService service = new eBayAPIInterfaceService();
        string requestURL = serverUrl + "?callname=" + callname + "&siteid=" + siteID
                            + "&appid=" + AppID + "&version=" + version + "&routing=default";
        service.Url = requestURL;

        // Set credentials
        service.RequesterCredentials = new CustomSecurityHeaderType();
        service.RequesterCredentials.Credentials = new UserIdPasswordType();
        service.RequesterCredentials.Credentials.AppId = AppID;
        service.RequesterCredentials.Credentials.DevId = DevID;
        service.RequesterCredentials.Credentials.AuthCert = CertID;
        service.RequesterCredentials.eBayAuthToken = userToken;

        #endregion

        GetCategoriesRequestType request = new GetCategoriesRequestType();
        request.CategorySiteID = siteID;
        request.LevelLimit = 4;
        request.Version = version;
        request.ViewAllNodes = true;
        request.DetailLevel = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll };

        try
        {
            GetCategoriesResponseType response = service.GetCategories(request);
            return response.CategoryArray;
        }
        catch (Exception ex)
        {
            if (ex.Message.ToLower().Contains("auth token"))
                throw new InvalidEbayCredentialsException();
            else
                throw ex;
        }
    }
Exemplo n.º 30
0
    public CompleteSaleResponseType UpdateShippingInfo(string itemID, string transactionID, string trackingNumber, string userToken)
    {
        string callname = "CompleteSale";

        #region Initialise Needed Variables

        //Get the Server to use (Sandbox or Production)
        string serverUrl = ConfigurationManager.AppSettings["TradingService"];

        //SiteID = 0  (US) - UK = 3, Canada = 2, Australia = 15, ....
        string siteID = "0";

        eBayAPIInterfaceService service = new eBayAPIInterfaceService();
        string requestURL = serverUrl + "?callname=" + callname + "&siteid=" + siteID
                            + "&appid=" + AppID + "&version=" + version + "&routing=default";
        service.Url = requestURL;

        // Set credentials
        service.RequesterCredentials = new CustomSecurityHeaderType();
        service.RequesterCredentials.Credentials = new UserIdPasswordType();
        service.RequesterCredentials.Credentials.AppId = AppID;
        service.RequesterCredentials.Credentials.DevId = DevID;
        service.RequesterCredentials.Credentials.AuthCert = CertID;
        service.RequesterCredentials.eBayAuthToken = userToken;
        #endregion

        CompleteSaleRequestType request = new CompleteSaleRequestType();
        request.WarningLevel = WarningLevelCodeType.High;
        request.ItemID = itemID;
        request.TransactionID = transactionID;

        ShipmentType shipment = new ShipmentType();
        ShipmentTrackingDetailsType shipmentDetails = new ShipmentTrackingDetailsType();
        shipmentDetails.ShipmentTrackingNumber = trackingNumber;
        shipmentDetails.ShippingCarrierUsed = ConfigurationManager.AppSettings["ShippingCarrier"];
        shipment.ShipmentTrackingDetails = new ShipmentTrackingDetailsType[] { shipmentDetails };
        request.Shipment = shipment;
        request.Version = version;

        try
        {
            CompleteSaleResponseType response = service.CompleteSale(request);
            return response;
        }
        catch (Exception ex)
        {
            if (ex.Message.ToLower().Contains("auth token"))
                throw new InvalidEbayCredentialsException();
            else
                throw ex;
        }
    }
Exemplo n.º 31
0
        /// <summary>
        /// Verify whether item is ready to be added to eBay.
        ///
        /// My presets are:
        ///     NEW condition
        ///     BuyItNow fixed price
        ///     30 day duration
        ///     14-day returns w/ 20% restocking fee
        ///     payment method=PayPal
        ///     FREE shipping
        ///     buyer pays for return shipping
        /// </summary>
        public static string VerifyAddItemRequest(string title, string description, string categoryID, double price, List <string> pictureURLs)
        {
            string listedItemID = null;

            try
            {
                //pictureURLs = new List<string>(){
                //    "https://i.ebayimg.com/00/s/MTUwMFgxNTAw/z/ZJcAAOSwzE9a0Qpl/$_57.JPG",
                //    "https://i.ebayimg.com/00/s/MTUwMFgxNTAw/z/6eQAAOSwER1a0Qpn/$_57.JPG",
                //    "https://i.ebayimg.com/00/s/MTUwMFgxNTAw/z/YPIAAOSwb~Ja0Qpq/$_57.JPG",
                //    "https://i.ebayimg.com/00/s/MTUwMFgxNTAw/z/zhsAAOSwLjRa0Qps/$_57.JPG",
                //    "https://i.ebayimg.com/00/s/MTUwMFgxNTAw/z/f-8AAOSwF-Ja0Qpv/$_57.JPG",
                //    "https://i.ebayimg.com/00/s/MTUwMFgxNTAw/z/kokAAOSwbLZa0Qpy/$_57.JPG",
                //    "https://i.ebayimg.com/00/s/MTUwMFgxNTAw/z/aZkAAOSwlila0Qp0/$_57.JPG"
                //};
                eBayAPIInterfaceService service = EbayCalls.eBayServiceCall("VerifyAddItem");

                VerifyAddItemRequestType request = new VerifyAddItemRequestType();
                request.Version       = "949";
                request.ErrorLanguage = "en_US";
                request.WarningLevel  = WarningLevelCodeType.High;

                var item = new ItemType();

                item.Title           = title;
                item.Description     = description;
                item.PrimaryCategory = new CategoryType
                {
                    CategoryID = categoryID
                };
                item.StartPrice = new AmountType
                {
                    Value      = price,
                    currencyID = CurrencyCodeType.USD
                };

                // To view ConditionIDs follow the URL
                // http://developer.ebay.com/devzone/guides/ebayfeatures/Development/Desc-ItemCondition.html#HelpingSellersChoosetheRightCondition
                item.ConditionID     = 1000; // new
                item.Country         = CountryCodeType.US;
                item.Currency        = CurrencyCodeType.USD;
                item.DispatchTimeMax = 3;
                item.ListingDuration = "Days_30";
                // Buy It Now fixed price
                item.ListingType = ListingTypeCodeType.FixedPriceItem;
                // Auction
                //item.ListingType = ListingTypeCodeType.Chinese;
                item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection
                {
                    BuyerPaymentMethodCodeType.PayPal
                };
                item.AutoPay = true;    // require immediate payment
                                        // Default testing paypal email address
                item.PayPalEmailAddress = "*****@*****.**";

                item.PictureDetails            = new PictureDetailsType();
                item.PictureDetails.PictureURL = new StringCollection();
                item.PictureDetails.PictureURL.AddRange(pictureURLs.ToArray());
                item.PostalCode   = "33772";
                item.Quantity     = 1; // 1 If Auction
                item.ReturnPolicy = new ReturnPolicyType
                {
                    ReturnsAcceptedOption = "ReturnsAccepted",
                    ReturnsWithinOption   = "Days_30",
                    //RefundOption = "MoneyBack",
                    Description = "Please return if unstatisfied.",
                    ShippingCostPaidByOption = "Buyer",
                    RestockingFeeValue       = "Percent_20",
                    RestockingFeeValueOption = "Percent_20"
                };
                item.ShippingDetails = GetShippingDetail();
                item.Site            = SiteCodeType.US;

                request.Item = item;

                VerifyAddItemResponseType response = service.VerifyAddItem(request);
                Console.WriteLine("ItemID: {0}", response.ItemID);

                // If item is verified, the item will be added.
                if (response.ItemID == "0")
                {
                    Console.WriteLine("=====================================");
                    Console.WriteLine("Add Item Verified");
                    Console.WriteLine("=====================================");
                    listedItemID = AddItemRequest(item);
                }
                return(listedItemID);
            }
            catch (Exception exc)
            {
                string s = exc.Message;
                return(null);
            }
        }
Exemplo n.º 32
0
        public static void VerifyAddItemRequest()
        {
            eBayAPIInterfaceService service = EbayCalls.EbayServiceCall("verifyAddItem");

            VerifyAddItemRequestType request = new VerifyAddItemRequestType();

            request.Version       = "949";
            request.ErrorLanguage = "en_US";
            request.WarningLevel  = WarningLevelCodeType.High;

            var item = new ItemType();

            item.Title           = "My Title";
            item.Description     = "My Description";
            item.PrimaryCategory = new CategoryType {
                CategoryID = "11704"
            };
            item.StartPrice = new AmountType {
                Value = 7.98, currencyID = CurrencyCodeType.GBP
            };
            item.ConditionID     = 1000;
            item.Country         = CountryCodeType.GB;
            item.Currency        = CurrencyCodeType.GBP;
            item.DispatchTimeMax = 3;
            item.ListingDuration = "Days_7";
            item.ListingType     = ListingTypeCodeType.FixedPriceItem;
            item.PaymentMethods  = new BuyerPaymentMethodCodeTypeCollection {
                BuyerPaymentMethodCodeType.PayPal
            };
            item.PayPalEmailAddress = "testemail.gmail.com";
            item.PictureDetails     = new PictureDetailsType {
                PictureURL = new StringCollection {
                    "https://avatar-ssl.xboxlive.com/avatar/ii%20burg%20ii/avatar-body.png"
                }
            };
            item.PostalCode   = "[Enter Your PostCode]";
            item.Quantity     = 5;
            item.ReturnPolicy = new ReturnPolicyType
            {
                ReturnsAcceptedOption    = "Returns Accepted",
                ReturnsWithinOption      = "Days_30",
                RefundOption             = "MoneyBack",
                Description              = "Please feel free to return if you are not satisfied",
                ShippingCostPaidByOption = "Buyer"
            };
            item.ShippingDetails = new ShippingDetailsType
            {
                ShippingType           = ShippingTypeCodeType.Flat,
                ShippingServiceOptions = new ShippingServiceOptionsTypeCollection
                {
                    new ShippingServiceOptionsType {
                        ShippingServicePriority = 1,
                        ShippingService         = "UK_Parcelforce48",
                        ShippingServiceCost     = new AmountType {
                            Value      = 2.50,
                            currencyID = CurrencyCodeType.GBP
                        }
                    }
                }
            };
            item.Site = SiteCodeType.UK;

            request.Item = item;

            VerifyAddItemResponseType response = service.VerifyAddItem(request);

            Console.WriteLine("ItemID: {0}", response.ItemID);

            if (response.ItemID == "0")
            {
                Console.WriteLine("======================");
                Console.WriteLine("Add Item verified");
                Console.WriteLine("======================");
                AddItemRequest(item);
            }
        }