Beispiel #1
0
        private ShippingDetailsType GetShippingDetails(int countOfArticles)
        {
            ShippingDetailsType sd = new ShippingDetailsType();

            sd.ShippingType = ShippingTypeCodeType.Flat;

            ShippingServiceOptionsType st1 = new ShippingServiceOptionsType();

            st1.ShippingService = ShippingServiceCodeType.DE_Paket.ToString();
            st1.ShippingServiceAdditionalCost = new AmountType {
                Value = 0, currencyID = CurrencyCodeType.EUR
            };
            st1.ShippingServicePriority = 1;
            st1.ShippingServiceCost     = new AmountType {
                Value = 5.95, currencyID = CurrencyCodeType.EUR
            };

            if (countOfArticles > 1)
            {
                st1.ShippingServiceCost.Value = 0;
            }

            sd.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection(new[] { st1 });
            return(sd);
        }
Beispiel #2
0
        protected static ShippingDetailsType GetShippingDetail()
        {
            ShippingDetailsType sd = new ShippingDetailsType();

            //sd.ApplyShippingDiscount = true;
            //sd.PaymentInstructions = "eBay .Net SDK test instruction.";
            //sd.ShippingRateType = ShippingRateTypeCodeType.StandardList;

            //adding domestic shipping

            ShippingServiceOptionsType domesticShipping1 = new ShippingServiceOptionsType();

            domesticShipping1.ShippingService     = ShippingServiceCodeType.ShippingMethodStandard.ToString();
            domesticShipping1.ShippingServiceCost = new AmountType {
                Value = 0, currencyID = CurrencyCodeType.USD
            };
            domesticShipping1.ShippingInsuranceCost = new AmountType {
                Value = 0, currencyID = CurrencyCodeType.USD
            };
            domesticShipping1.ShippingServicePriority = 4;
            domesticShipping1.LocalPickup             = false;
            domesticShipping1.FreeShipping            = true;
            sd.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection(new[] { domesticShipping1 });
            sd.ShippingType           = ShippingTypeCodeType.Flat;

            return(sd);
        }
Beispiel #3
0
        //set shipping information
        private ShippingDetailsType getShippingDetails()
        {
            // Shipping details.
            ShippingDetailsType sd       = new ShippingDetailsType();
            SalesTaxType        salesTax = new SalesTaxType();

            salesTax.SalesTaxPercent = 0.0825f;
            salesTax.SalesTaxState   = "CA";
            sd.ApplyShippingDiscount = true;
            AmountType at = new AmountType();

            at.Value               = 2.8;
            at.currencyID          = CurrencyCodeType.USD;
            sd.InsuranceFee        = at;
            sd.InsuranceOption     = InsuranceOptionCodeType.Optional;
            sd.PaymentInstructions = "eBay DotNet SDK test instruction.";

            // Set calculated shipping.
            sd.ShippingType = ShippingTypeCodeType.Flat;
            //
            ShippingServiceOptionsType st1 = new ShippingServiceOptionsType();

            st1.ShippingService = ShippingServiceCodeType.ShippingMethodStandard.ToString();
            at            = new AmountType();
            at.Value      = 2.0;
            at.currencyID = CurrencyCodeType.USD;
            st1.ShippingServiceAdditionalCost = at;
            at                          = new AmountType();
            at.Value                    = 1.0;
            at.currencyID               = CurrencyCodeType.USD;
            st1.ShippingServiceCost     = at;
            st1.ShippingServicePriority = 1;
            at                          = new AmountType();
            at.Value                    = 1.0;
            at.currencyID               = CurrencyCodeType.USD;
            st1.ShippingInsuranceCost   = at;

            ShippingServiceOptionsType st2 = new ShippingServiceOptionsType();

            st2.ExpeditedService = true;
            st2.ShippingService  = ShippingServiceCodeType.ShippingMethodExpress.ToString();
            at            = new AmountType();
            at.Value      = 2.0;
            at.currencyID = CurrencyCodeType.USD;
            st2.ShippingServiceAdditionalCost = at;
            at                          = new AmountType();
            at.Value                    = 1.0;
            at.currencyID               = CurrencyCodeType.USD;
            st2.ShippingServiceCost     = at;
            st2.ShippingServicePriority = 2;
            at                          = new AmountType();
            at.Value                    = 1.0;
            at.currencyID               = CurrencyCodeType.USD;
            st2.ShippingInsuranceCost   = at;

            sd.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection(new ShippingServiceOptionsType[] { st1, st2 });

            return(sd);
        }
Beispiel #4
0
        private static ShippingDetailsType getShippingDetails()
        {
            // Shipping details.
            ShippingDetailsType sd       = new ShippingDetailsType();
            SalesTaxType        salesTax = new SalesTaxType();

            salesTax.SalesTaxPercent          = 0.0825F;
            salesTax.SalesTaxPercentSpecified = true;
            salesTax.SalesTaxState            = "CA";
            sd.SalesTax                       = salesTax;
            sd.AllowPaymentEdit               = false;
            sd.AllowPaymentEditSpecified      = true;
            sd.ApplyShippingDiscount          = true;
            sd.ApplyShippingDiscountSpecified = true;
            sd.InsuranceFee                   = new AmountType();
            sd.InsuranceFee.Value             = 0.1;
            sd.InsuranceFee.currencyID        = CurrencyCodeType.USD;
            sd.InsuranceOption                = InsuranceOptionCodeType.Optional;
            sd.PaymentInstructions            = "eBay Java SDK test instruction.";
            sd.ShippingType                   = ShippingTypeCodeType.Flat;
            ShippingServiceOptionsType st1 = new ShippingServiceOptionsType();

            st1.ShippingService = ShippingServiceCodeType.USPSPriority.ToString();
            st1.ShippingServiceAdditionalCost            = new AmountType();
            st1.ShippingServiceAdditionalCost.Value      = 0.1;
            st1.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.USD;
            st1.ShippingServiceCost            = new AmountType();
            st1.ShippingServiceCost.Value      = 0.1;
            st1.ShippingServiceCost.currencyID = CurrencyCodeType.USD;

            st1.ShippingServicePriority          = 1;
            st1.ShippingServicePrioritySpecified = true;
            st1.ShippingInsuranceCost            = new AmountType();
            st1.ShippingInsuranceCost.Value      = 0.1;
            st1.ShippingInsuranceCost.currencyID = CurrencyCodeType.USD;
            ShippingServiceOptionsType st2 = new ShippingServiceOptionsType();

            st2.ExpeditedService                         = true;
            st2.ExpeditedServiceSpecified                = true;
            st2.ShippingService                          = ShippingServiceCodeType.USPSFirstClass.ToString();
            st2.ShippingServiceAdditionalCost            = new AmountType();
            st2.ShippingServiceAdditionalCost.Value      = 0.1;
            st2.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.USD;

            st2.ShippingServiceCost              = new AmountType();
            st2.ShippingServiceCost.Value        = 0.1;
            st2.ShippingServiceCost.currencyID   = CurrencyCodeType.USD;
            st2.ShippingServicePriority          = 2;
            st2.ShippingServicePrioritySpecified = true;
            st2.ShippingInsuranceCost            = new AmountType();
            st2.ShippingInsuranceCost.Value      = 0.1;
            st2.ShippingInsuranceCost.currencyID = CurrencyCodeType.USD;

            sd.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection();
            sd.ShippingServiceOptions.Add(st1);
            sd.ShippingServiceOptions.Add(st2);
            return(sd);
        }
Beispiel #5
0
        // get target ebay site, international if shipping rule country is outside target ebay site
        private void PopulateFlatRateShippingOptions(IEnumerable <ebay_shippingrule> rows)
        {
            // convert local to ebay currency enum
            var ebayCurrency = Currency.code.ToEnum <CurrencyCodeType>();

            // shipping options
            int domesticPriority      = 1;
            int internationalPriority = 1;

            foreach (var row in rows)
            {
                if (row.ebay_shippingservice.isInternational)
                {
                    var shippingOption = new InternationalShippingServiceOptionsType();
                    shippingOption.ShippingService         = row.ebay_shippingservice.servicetype;
                    shippingOption.ShippingServicePriority = internationalPriority++;

                    // shipping cost
                    shippingOption.ShippingServiceCost = new AmountType()
                    {
                        currencyID = ebayCurrency,
                        Value      = (double)row.cost
                    };

                    shippingOption.ShipToLocation = new StringCollection(row.ebay_shippingrule_locations.Select(x => x.location).ToArray());

                    shipping_international.Add(shippingOption);
                }
                else
                {
                    var shippingOption = new ShippingServiceOptionsType();
                    shippingOption.ShippingService         = row.ebay_shippingservice.servicetype;
                    shippingOption.ShippingServicePriority = domesticPriority++;

                    if (row.cost == 0)
                    {
                        shippingOption.FreeShipping = true;
                    }
                    else
                    {
                        // shipping cost
                        shippingOption.ShippingServiceCost = new AmountType()
                        {
                            currencyID = ebayCurrency,
                            Value      = (double)row.cost
                        };
                    }

                    shipping_domestic.Add(shippingOption);
                }
            }
        }
Beispiel #6
0
        /// <summary>
        /// Set the item's shipping information
        /// </summary>
        /// <returns></returns>
        private static ShippingDetailsType createShippingDetails(eBayProductFeed eBayInfo)
        {
            // let's determine the shipping type
            var shippingType = EnumHelper.ParseEnum <ShippingTypeCodeType>(eBayInfo.ShippingType, ShippingTypeCodeType.Free);

            // create shipping details and set its shipping type
            var shippingDetails = new ShippingDetailsType();
            var serviceOption   = new ShippingServiceOptionsType();

            if (shippingType == ShippingTypeCodeType.Flat)
            {
                shippingDetails.ShippingType = ShippingTypeCodeType.Flat;

                // create the shipping service
                serviceOption.ShippingService         = eBayInfo.ShippingService;
                serviceOption.ShippingServicePriority = 1;
                serviceOption.ShippingServiceCost     = new AmountType
                {
                    currencyID = CurrencyCodeType.USD,
                    Value      = eBayInfo.ShippingServiceCost
                };
            }
            else // shipping type is free
            {
                // force it to flat but this is for free shipping
                //shippingDetails.ShippingType = ShippingTypeCodeType.Free;

                // create the shipping service and let's set the shipping cost to 0
                serviceOption.ShippingService         = ShippingServiceCodeType.ShippingMethodStandard.ToString(); // this is just arbitrary shippng service only
                serviceOption.ShippingServicePriority = 1;
                serviceOption.ShippingServiceCost     = new AmountType
                {
                    currencyID = CurrencyCodeType.USD,
                    Value      = 0 // eBayInfo.ShippingServiceCost
                };
            }

            // set the shipping service type
            shippingDetails.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection(
                new ShippingServiceOptionsType[] { serviceOption });

            return(shippingDetails);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public virtual ICollection GetShippingServiceOptions()
        {
            ShippingServiceOptionsTypeCollection ssos = new ShippingServiceOptionsTypeCollection();

            int row = this.Items.Count;
            int col = this.Items[0].SubItems.Count;

            int cnt = 0;

            for (int i = 0; i < row; i++)
            {
                ListViewItem lvi = this.Items[i];
                //ShippingService
                string text = lvi.SubItems[0].Text;
                if (text.Length > 0)
                {
                    if (!text.Equals("NotSelected"))
                    {
                        cnt++;
                        ShippingServiceOptionsType sso = new ShippingServiceOptionsType();
                        sso.ShippingService         = text;
                        sso.ShippingServicePriority = cnt;
                        ssos.Add(sso);
                        if (col > 1)
                        {
                            // ShippingServiceCost
                            text = lvi.SubItems[1].Text;
                            if (text.Length > 0)
                            {
                                sso.ShippingServiceCost = CurrencyUtility.GetAmountType(text);
                            }
                            // ShippingServiceAdditioanlCost
                            text = lvi.SubItems[2].Text;
                            if (text.Length > 0)
                            {
                                sso.ShippingServiceAdditionalCost = CurrencyUtility.GetAmountType(text);
                            }
                        }
                    }
                }
            }
            return(ssos);
        }
Beispiel #8
0
        private ShippingDetailsType getShippingDetails(String shippingService)
        {
            // Shipping details.
            SiteCodeType        site     = this.controller.ApiContext.Site;
            ShippingDetailsType sd       = new ShippingDetailsType();
            SalesTaxType        salesTax = new SalesTaxType();

            salesTax.SalesTaxPercent = 0.0825f;
            salesTax.SalesTaxState   = "CA";
            sd.ApplyShippingDiscount = true;
            AmountType at = new AmountType();

            at.Value      = 0.1;
            at.currencyID = this.getCurrencyType(site);
            //sd.InsuranceFee = at;
            //sd.InsuranceOption = InsuranceOptionCodeType.Optional;
            sd.PaymentInstructions = "eBay DotNet SDK test instruction.";

            // Set calculated shipping.
            sd.ShippingType = ShippingTypeCodeType.Flat;
            //
            ShippingServiceOptionsType st1 = new ShippingServiceOptionsType();

            st1.ShippingService = shippingService;
            at            = new AmountType();
            at.Value      = 0.1;
            at.currencyID = this.getCurrencyType(site);
            st1.ShippingServiceAdditionalCost = at;
            at                          = new AmountType();
            at.Value                    = 0.1;
            at.currencyID               = this.getCurrencyType(site);
            st1.ShippingServiceCost     = at;
            st1.ShippingServicePriority = 1;
            at                          = new AmountType();
            at.Value                    = 0.1;
            at.currencyID               = this.getCurrencyType(site);
            st1.ShippingInsuranceCost   = at;

            sd.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection(new ShippingServiceOptionsType[] { st1 });

            return(sd);
        }
Beispiel #9
0
        /// <summary>
        /// Build sample shipping details
        /// </summary>
        /// <returns>ShippingDetailsType object</returns>
        #region BuildShippingDetails
        ShippingDetailsType BuildShippingDetails()
        {
            // Shipping details
            ShippingDetailsType sd = new ShippingDetailsType();

            sd.ApplyShippingDiscount = false;
            sd.PaymentInstructions   = "eBay .Net SDK test instruction.";
            sd.ShippingType          = ShippingTypeCodeType.Flat;
            ShippingServiceOptionsType shippingOptions = new ShippingServiceOptionsType();

            shippingOptions.ShippingService = ShippingServiceCodeType.DE_StandardDispatch.ToString();
            AmountType amountType = new AmountType();

            amountType.currencyID = CurrencyCodeType.EUR;
            amountType.Value      = 0;
            shippingOptions.ShippingServiceCost           = amountType;
            shippingOptions.ShippingServiceAdditionalCost = amountType;
            sd.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection(new ShippingServiceOptionsType[] { shippingOptions });

            return(sd);
        }
Beispiel #10
0
        /// <summary>
        /// Build sample shipping details
        /// </summary>
        /// <returns>ShippingDetailsType object</returns>
        private ShippingDetailsType BuildShippingDetails()
        {
            // Shipping details
            ShippingDetailsType sd = new ShippingDetailsType();

            sd.ApplyShippingDiscount = true;
            AmountType amount = new AmountType();

            amount.Value           = 20;
            amount.currencyID      = CurrencyCodeType.AUD;
            sd.PaymentInstructions = "Please do the payment via Paypal.";

            // Shipping type and shipping service options
            sd.ShippingType = ShippingTypeCodeType.Flat;
            ShippingServiceOptionsType shippingOptions = new ShippingServiceOptionsType();

            shippingOptions.ShippingService =
                ShippingServiceCodeType.ShippingMethodStandard.ToString();

            amount            = new AmountType();
            amount.Value      = 2.0;
            amount.currencyID = CurrencyCodeType.AUD;
            shippingOptions.ShippingServiceAdditionalCost = amount;
            amount            = new AmountType();
            amount.Value      = 10;
            amount.currencyID = CurrencyCodeType.AUD;
            shippingOptions.ShippingServiceCost     = amount;
            shippingOptions.ShippingServicePriority = 1;
            amount            = new AmountType();
            amount.Value      = 1.0;
            amount.currencyID = CurrencyCodeType.AUD;
            shippingOptions.ShippingInsuranceCost = amount;

            sd.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection(
                new ShippingServiceOptionsType[] { shippingOptions }
                );

            return(sd);
        }
Beispiel #11
0
        /// <summary>
        /// Build sample shipping details
        /// </summary>
        /// <returns>ShippingDetailsType object</returns>
        static ShippingDetailsType BuildShippingDetails()
        {
            // Shipping details
            ShippingDetailsType sd = new ShippingDetailsType();

            sd.ApplyShippingDiscount = true;
            AmountType amount = new AmountType();

            amount.Value           = 2.8;
            amount.currencyID      = CurrencyCodeType.USD;
            sd.PaymentInstructions = "eBay .Net SDK test instruction.";

            // Shipping type and shipping service options
            sd.ShippingType = ShippingTypeCodeType.Flat;
            ShippingServiceOptionsType shippingOptions = new ShippingServiceOptionsType();

            shippingOptions.ShippingService =
                ShippingServiceCodeType.ShippingMethodStandard.ToString();
            amount            = new AmountType();
            amount.Value      = 2.0;
            amount.currencyID = CurrencyCodeType.USD;
            shippingOptions.ShippingServiceAdditionalCost = amount;
            amount            = new AmountType();
            amount.Value      = 1;
            amount.currencyID = CurrencyCodeType.USD;
            shippingOptions.ShippingServiceCost     = amount;
            shippingOptions.ShippingServicePriority = 1;
            amount            = new AmountType();
            amount.Value      = 1.0;
            amount.currencyID = CurrencyCodeType.USD;
            shippingOptions.ShippingInsuranceCost = amount;

            sd.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection(
                new ShippingServiceOptionsType[] { shippingOptions }
                );

            return(sd);
        }
Beispiel #12
0
        private ShippingDetailsType getShippingDetails()
        {
            ShippingDetailsType sd = new ShippingDetailsType();
            AmountType          at = new AmountType();

            sd.PaymentInstructions = eBayLister.UserSettings.Default.paymentInstructions;
            sd.ShippingType        = ShippingTypeCodeType.Flat;

            ShippingServiceOptionsType st1 = new ShippingServiceOptionsType();

            st1.ShippingService = ShippingServiceCodeType.IN_Express.ToString();

            at            = new AmountType();
            at.currencyID = CurrencyCodeType.INR;
            at.Value      = Convert.ToDouble(eBayLister.UserSettings.Default.shippingCost) *
                            Convert.ToDouble(eBayLister.UserSettings.Default.ConversionRate);
            st1.ShippingServiceCost = at;
            ShippingServiceOptionsTypeCollection serviceOptions = new ShippingServiceOptionsTypeCollection();

            serviceOptions.Add(st1);
            sd.ShippingServiceOptions = serviceOptions;
            return(sd);
        }
Beispiel #13
0
        private void AddItem()
        {
            AddFixedPriceItemRequestType req = new AddFixedPriceItemRequestType();

            req.Version = "927";
            ItemType item = new ItemType
            {
                ConditionID          = 1000,
                ConditionIDSpecified = true,
                Country                 = CountryCodeType.US,
                Currency                = CurrencyCodeType.USD,
                PostalCode              = "10007",
                Location                = "New York, NY",
                LocalListingSpecified   = true,
                InventoryTrackingMethod = InventoryTrackingMethodCodeType.SKU,
                //SKU = "PROD1234",
                Description              = "Pokemon Door Handle - gotta open em all",
                Title                    = "Pokemon stuffs",
                SubTitle                 = "Test Item",
                ListingDuration          = "Days_7",
                PaymentMethods           = new BuyerPaymentMethodCodeType[1],
                DispatchTimeMax          = 3,
                DispatchTimeMaxSpecified = true,
                Site          = SiteCodeType.US,
                SiteSpecified = true
            };

            //set the item condition depending on the value from GetCategoryFeatures
            //new

            //Basic properties of a listing

            //Track item by SKU#

            item.StartPrice = new AmountType()
            {
                currencyID = CurrencyCodeType.USD, Value = 20.00
            };


            BuyerPaymentMethodCodeType[] payments = new BuyerPaymentMethodCodeType[1];
            payments[0]             = BuyerPaymentMethodCodeType.PayPal;
            item.PaymentMethods     = payments;
            item.PayPalEmailAddress = "*****@*****.**";


            item.Country           = CountryCodeType.US;
            item.CountrySpecified  = true;
            item.Currency          = CurrencyCodeType.USD;
            item.CurrencySpecified = true;

            //Specify Shipping Services
            item.DispatchTimeMax = 3;
            item.ShippingDetails = new ShippingDetailsType();
            ShippingServiceOptionsType[] shipping = new ShippingServiceOptionsType[2];
            shipping[0] = new ShippingServiceOptionsType();
            item.ShippingDetails.ShippingServiceOptions = shipping;

            ShippingServiceOptionsType shipservice1 = new ShippingServiceOptionsType();

            shipservice1.ShippingService                = "ShippingMethodStandard";
            shipservice1.ShippingServicePriority        = 1;
            shipservice1.ShippingServiceCost            = new AmountType();
            shipservice1.ShippingServiceCost.currencyID = CurrencyCodeType.USD;
            shipservice1.ShippingServiceCost.Value      = 1.0;
            shipservice1.ShippingTimeMin                = 2;
            shipservice1.ShippingTimeMinSpecified       = true;

            shipservice1.ShippingServiceAdditionalCost            = new AmountType();
            shipservice1.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.USD;
            shipservice1.ShippingServiceAdditionalCost.Value      = 1.0;

            item.ShippingDetails.ShippingServiceOptions[0] = shipservice1;

            ShippingServiceOptionsType shipservice2 = new ShippingServiceOptionsType();

            shipservice2.ShippingService                = "AU_Express";
            shipservice2.ShippingServicePriority        = 2;
            shipservice2.ShippingServiceCost            = new AmountType();
            shipservice2.ShippingServiceCost.currencyID = CurrencyCodeType.USD;
            shipservice2.ShippingServiceCost.Value      = 4.0;

            shipservice2.ShippingServiceAdditionalCost            = new AmountType();
            shipservice2.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.USD;
            shipservice2.ShippingServiceAdditionalCost.Value      = 1.0;

            //item.ShippingDetails.ShippingServiceOptions[1] = shipservice2;

            //Specify Return Policy
            item.ReturnPolicy = new ReturnPolicyType();
            item.ReturnPolicy.ReturnsAcceptedOption = "ReturnsAccepted";

            item.Quantity              = 10;
            item.StartPrice            = new AmountType();
            item.StartPrice.currencyID = CurrencyCodeType.USD;
            item.StartPrice.Value      = 10.00;


            item.PrimaryCategory            = new CategoryType();
            item.PrimaryCategory.CategoryID = "156955";

            item.ProductListingDetails = new ProductListingDetailsType();

            //Specifying UPC as the product identifier. Other applicable product identifiers
            //include ISBN, EAN, Brand-MPN.

            item.ProductListingDetails.UPC = "753759090913";

            //If multiple product identifiers are specified, eBay uses the first one that
            //matches a product in eBay's catalog system.
            item.ProductListingDetails.BrandMPN       = new BrandMPNType();
            item.ProductListingDetails.BrandMPN.Brand = "Marvel";
            item.ProductListingDetails.BrandMPN.MPN   = "Unknown";

            //For listing to be pre-filled with product information from the catalog
            item.ProductListingDetails.IncludePrefilledItemInformation = true;

            //Include the eBay stock photo with the listing if available and use it as the gallery picture
            item.ProductListingDetails.IncludeStockPhotoURL               = true;
            item.ProductListingDetails.UseStockPhotoURLAsGallery          = true;
            item.ProductListingDetails.UseStockPhotoURLAsGallerySpecified = true;

            //If multiple prod matches found, list the item with the 1st product's information
            item.ProductListingDetails.UseFirstProduct = true;
            // List the item even if no product match found
            //item.ProductListingDetails.ListIfNoProduct = true;

            //Add pictures
            item.PictureDetails = new PictureDetailsType();

            //Specify GalleryType
            item.PictureDetails.GalleryType          = GalleryTypeCodeType.None;
            item.PictureDetails.GalleryTypeSpecified = true;
            req.Item = item;


            Service.Sales.ProductManagement.AddListing(req);
        }
Beispiel #14
0
        // todo: need to support this
        private void PopulateCalculatedShippingOptions(IEnumerable <shippingRule> rows)
        {
            // convert local to ebay currency enum
            var ebayCurrency = Currency.code.ToEnum <CurrencyCodeType>();

            // shipping options
            foreach (var entry in rows)
            {
                var ruleCountry = entry.country.ToCountry();

                // international or domestic
                bool isInternational = true;
                switch (ebay_site)
                {
                case SiteCodeType.US:
                    if (ruleCountry.code == "US")
                    {
                        isInternational = false;
                    }
                    break;

                case SiteCodeType.Malaysia:
                    if (ruleCountry.code == "MY")
                    {
                        isInternational = false;
                    }
                    break;

                default:
                    throw new NotImplementedException();
                    break;
                }

                var rule = entry;

                if (isInternational)
                {
                    var shippingOption = new InternationalShippingServiceOptionsType();
                    shippingOption.ShippingService = rule.name;
                    shippingOption.ShipToLocation  = new StringCollection(new[] { ruleCountry.code });

                    // shipping cost
                    shippingOption.ShippingServiceCost = new AmountType()
                    {
                        currencyID = ebayCurrency,
                        Value      = (double)rule.cost
                    };

                    shippingOption.ShippingServicePriority = 1;

                    shipping_international.Add(shippingOption);
                }
                else
                {
                    var shippingOption = new ShippingServiceOptionsType();
                    shippingOption.ShippingService = rule.name;

                    if (rule.cost == 0)
                    {
                        shippingOption.FreeShipping = true;
                    }
                    else
                    {
                        // shipping cost
                        shippingOption.ShippingServiceCost = new AmountType()
                        {
                            currencyID = ebayCurrency,
                            Value      = (double)rule.cost
                        };
                    }

                    shippingOption.ShippingServicePriority = 1;
                    shipping_domestic.Add(shippingOption);
                }
            }
        }
        public async Task <ItemType> PrepareItem(CommerceContext commerceContext, SellableItem sellableItem)
        {
            using (var activity = CommandActivity.Start(commerceContext, this))
            {
                //Instantiate the call wrapper class
                var apiCall = new AddFixedPriceItemCall(await GetEbayContext(commerceContext).ConfigureAwait(false));

                var item = await this._commerceCommander.Pipeline <IPrepareEbayItemPipeline>().Run(sellableItem, commerceContext.PipelineContextOptions).ConfigureAwait(false);

                item.Description = sellableItem.Description;
                item.Title       = sellableItem.DisplayName;
                item.SubTitle    = "Test Item";

                var listPricingPolicy = sellableItem.GetPolicy <ListPricingPolicy>();
                var listPrice         = listPricingPolicy.Prices.FirstOrDefault();

                item.StartPrice = new AmountType {
                    currencyID = CurrencyCodeType.USD, Value = System.Convert.ToDouble(listPrice.Amount, System.Globalization.CultureInfo.InvariantCulture)
                };

                item.ConditionID = 1000;  //new

                item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection();
                item.PaymentMethods.Add(BuyerPaymentMethodCodeType.PayPal);
                item.PaymentMethods.Add(BuyerPaymentMethodCodeType.VisaMC);
                item.PayPalEmailAddress = "*****@*****.**";
                item.PostalCode         = "98014";

                item.DispatchTimeMax = 3;
                item.ShippingDetails = new ShippingDetailsType();
                item.ShippingDetails.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection();

                item.ShippingDetails.ShippingType = ShippingTypeCodeType.Flat;

                ShippingServiceOptionsType shipservice1 = new ShippingServiceOptionsType();
                shipservice1.ShippingService                = "USPSPriority";
                shipservice1.ShippingServicePriority        = 1;
                shipservice1.ShippingServiceCost            = new AmountType();
                shipservice1.ShippingServiceCost.currencyID = CurrencyCodeType.USD;
                shipservice1.ShippingServiceCost.Value      = 5.0;

                shipservice1.ShippingServiceAdditionalCost            = new AmountType();
                shipservice1.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.USD;
                shipservice1.ShippingServiceAdditionalCost.Value      = 1.0;

                item.ShippingDetails.ShippingServiceOptions.Add(shipservice1);


                //ShippingServiceOptionsType shipservice2 = new ShippingServiceOptionsType();
                //shipservice2.ShippingService = "US_Regular";
                //shipservice2.ShippingServicePriority = 2;
                //shipservice2.ShippingServiceCost = new AmountType();
                //shipservice2.ShippingServiceCost.currencyID = CurrencyCodeType.USD;
                //shipservice2.ShippingServiceCost.Value = 1.0;

                //shipservice2.ShippingServiceAdditionalCost = new AmountType();
                //shipservice2.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.USD;
                //shipservice2.ShippingServiceAdditionalCost.Value = 1.0;

                //item.ShippingDetails.ShippingServiceOptions.Add(shipservice2);

                //item.Variations.

                item.ReturnPolicy = new ReturnPolicyType {
                    ReturnsAcceptedOption = "ReturnsAccepted"
                };

                //Add pictures
                item.PictureDetails = new PictureDetailsType();

                //Specify GalleryType
                item.PictureDetails.GalleryType          = GalleryTypeCodeType.None;
                item.PictureDetails.GalleryTypeSpecified = true;

                return(item);
            }
        }
Beispiel #16
0
        void GetSellerListOfItems()
        {
            ApiContext oContext = new ApiContext();
            int        nNumberofTotalListing  = 0;
            int        nNumberofSoldListing   = 0;
            double     nTotalAmount           = 0;
            int        nAlreadyRelistedCount  = 0;
            int        nEligibleItemForRelist = 0;
            string     szShippingType;
            string     szError        = "";
            string     szInsertString = "";

            string[] szArray             = new string[30];
            string[] szItemArray         = new string[30];
            int      nCount              = 0;
            string   szHighBidder        = "";
            string   szSubTitle          = " ";
            string   szTitle             = " ";
            string   szDescription       = " ";
            string   szSelectString      = " ";
            DateTime jddate              = new DateTime();
            string   szInventoryCategory = " ";
            string   szInventoryCamera   = " ";
            string   szInventoryLocation = " ";
            string   szInventorySource   = " ";
            DateTime jdInvShipDate       = new DateTime();
            DateTime jdListedDate        = new DateTime();
            double   dInvPrice           = 0;
            int      nQtyAvail           = 0;
            int      nQtySold            = 0;
            int      nLotSize            = 0;

            //dataGridView1.Rows.Clear();
            Cursor.Current = Cursors.WaitCursor;


            System.Data.OleDb.OleDbConnection conn_newdb = new System.Data.OleDb.OleDbConnection();

            conn_newdb.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" + "Data source= " + txtbx_dbpath.Text;
            try
            {
                conn_newdb.Open();
            }
            catch (Exception)
            {
                szError = "Failed";
            }
            /*the inventory header database connection*/
            System.Data.OleDb.OleDbConnection conn_newdb2 = new System.Data.OleDb.OleDbConnection();
            conn_newdb2.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" + "Data source= " + txtbx_InvDBPath.Text;
            try
            {
                conn_newdb2.Open();
            }
            catch (Exception)
            {
                szError = "Failed";
            }


            txtResults.Text = " ";
            // set the dev,app,cert information
            oContext.ApiCredential.ApiAccount.Developer   = ConfigurationManager.AppSettings["DevID"];
            oContext.ApiCredential.ApiAccount.Application = ConfigurationManager.AppSettings["AppID"];
            oContext.ApiCredential.ApiAccount.Certificate = ConfigurationManager.AppSettings["CertID"];

            // set the AuthToken
            oContext.ApiCredential.eBayToken = ConfigurationManager.AppSettings["UserToken"];

            // set the base SOAP URL .. use https://api.sandbox.ebay.com/wsapi for Sandbox calls
            //oContext.SoapApiServerUrl = "https://api.ebay.com/wsapi";
            oContext.SoapApiServerUrl = ConfigurationManager.AppSettings["ServerUrl"];

            // set the Site of the Context
            oContext.Site = eBay.Service.Core.Soap.SiteCodeType.US;

            // very important, let's setup the logging
            ApiLogManager oLogManager = new ApiLogManager();

            oLogManager.ApiLoggerList.Add(new eBay.Service.Util.FileLogger("GetSellerList459NETSDK.log", true, true, true));
            oLogManager.EnableLogging = true;
            oContext.ApiLogManager    = oLogManager;

            // the WSDL Version used for this SDK build
            oContext.Version = "459";

            // set the CallRetry properties
            CallRetry oCallRetry = new CallRetry();

            // set the delay between each retry to 1 millisecond
            oCallRetry.DelayTime = 1;
            // set the maximum number of retries
            oCallRetry.MaximumRetries = 3;
            // set the error codes on which to retry
            StringCollection oErrorCodes = new StringCollection();

            oErrorCodes.Add("10007"); // Internal error to the application ... general error
            oErrorCodes.Add("2");     // unsupported verb error
            oErrorCodes.Add("251");   // eBay Structured Exception ... general error
            oCallRetry.TriggerErrorCodes = oErrorCodes;
            // set the exception types on which to retry
            TypeCollection oExceptions = new TypeCollection();

            oExceptions.Add(typeof(System.Net.ProtocolViolationException));
            // the "Client found response content type of 'text/plain'" exception is of type SdkException, so let's add that to the list
            oExceptions.Add(typeof(SdkException));
            oCallRetry.TriggerExceptions = oExceptions;

            // set CallRetry back to ApiContext
            oContext.CallRetry = oCallRetry;

            // set the timeout to 2 minutes
            oContext.Timeout = 120000;

            GetSellerListCall oGetSellerListCall = new GetSellerListCall(oContext);

            // set the Version used in the call
            oGetSellerListCall.Version = oContext.Version;

            // set the Site of the call
            oGetSellerListCall.Site = oContext.Site;

            // enable the compression feature
            oGetSellerListCall.EnableCompression = true;

            // use GranularityLevel of Fine
            //oGetSellerListCall.GranularityLevel = GranularityLevelCodeType.Fine;

            oGetSellerListCall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);

            // get the first page, 200 items per page
            PaginationType oPagination = new PaginationType();

            oPagination.EntriesPerPage = 200;
            //oPagination.EntriesPerPageSpecified = true;
            oPagination.PageNumber = 1;
            //oPagination.PageNumberSpecified = true;

            oGetSellerListCall.Pagination = oPagination;

            oGetSellerListCall.UserID = txtbx_userid.Text;

            // ask for all items that are ending in the future (active items)
            //oGetSellerListCall.EndTimeFilter = new TimeFilter(DateTime.Now.AddDays(-3),DateTime.Now);
            //oGetSellerListCall.EndTimeFilter = new TimeFilter(dateTimePicker1.Value, DateTime.Now);
            oGetSellerListCall.EndTimeFilter = new TimeFilter(dateTimePicker1.Value, dateTimePicker2.Value);

            // return items that end soonest first
            oGetSellerListCall.Sort = 1;
            // see http://developer.ebay.com/DevZone/SOAP/docs/WSDL/xsd/1/element/1597.htm for Sort documentation

            try
            {
                ItemTypeCollection oItems = oGetSellerListCall.GetSellerList();
                // output some of the data
                nNumberofTotalListing = 0;
                nNumberofSoldListing  = 0;
                int pagenumber = 1;

                while (pagenumber <= oGetSellerListCall.PaginationResult.TotalNumberOfPages)
                {
                    if (pagenumber > 1)
                    {
                        oGetSellerListCall.Pagination.PageNumber = pagenumber;
                        //oGetSellerListCall.Execute();
                        oItems = oGetSellerListCall.GetSellerList();
                    }

                    foreach (ItemType oItem in oItems)
                    {
                        if (oItem.SKU != null)
                        {
                            szArray = oItem.SKU.Split(' ');
                        }
                        else
                        {
                            szArray[0] = "BLANK";
                        }
                        nQtySold  = oItem.SellingStatus.QuantitySold;
                        nQtyAvail = oItem.Quantity - nQtySold;
                        nLotSize  = oItem.LotSize;


                        szItemArray = szArray[0].Split(',');
                        szItemArray = szItemArray[0].Split('.');


                        if (oItem.SellingStatus.HighBidder != null)
                        {
                            szHighBidder = oItem.SellingStatus.HighBidder.UserID;
                        }
                        else
                        {
                            szHighBidder = " ";
                        }

                        if (oItem.SubTitle != null)
                        {
                            szSubTitle = oItem.SubTitle.Replace('\"', ' ');
                        }
                        else
                        {
                            szSubTitle = " ";
                        }

                        if (oItem.Title != null)
                        {
                            szTitle = oItem.Title.Replace('\"', ' ');
                        }
                        else
                        {
                            szTitle = " ";
                        }



                        //ShippingServiceOptionsTypeCollection shippingCol = new ShippingServiceOptionsTypeCollection();
                        //shippingCol = oItem.ShippingDetails.ShippingServiceOptions;
                        ShippingServiceOptionsType[] opt = new ShippingServiceOptionsType[10];

                        if (oItem.ShippingDetails.ShippingServiceOptions.Count == 0)
                        {
                            szShippingType = "NOTKNOWN";
                        }
                        else
                        {
                            opt[0] = oItem.ShippingDetails.ShippingServiceOptions[0];
                            if (opt[0].ShippingServiceCost == null)
                            {
                                szShippingType = "FREE";
                            }
                            else
                            {
                                if (opt[0].ShippingServiceCost.Value > 0)
                                {
                                    szShippingType = "NOT FREE";
                                }
                                else
                                {
                                    szShippingType = "FREE";
                                }
                            }
                        }

                        nNumberofTotalListing = nNumberofTotalListing + 1;
                        //oItem.ShippingDetails.ShippingServiceOptions.
                        //if (oItem.ShippingDetails.ShippingServiceOptions.IndexO == ShippingTypeCodeType.Free)
                        //if (oItem.ShippingDetails.ShippingType == ShippingTypeCodeType.Free)
                        //    szShippingType = "FREE";

                        if (oItem.SellingStatus.HighBidder != null)
                        {
                            /*if (!(chkbx_OnlyRelistOnes.Checked))
                             * {
                             *  dataGridView1.Rows.Add(oItem.ItemID, oItem.ListingType, oItem.Title, oItem.SubTitle, oItem.ListingDetails.StartTime.ToShortDateString(), oItem.ListingDetails.EndTime.ToShortDateString(), oItem.SellingStatus.CurrentPrice.Value, oItem.SellingStatus.HighBidder.UserID);
                             * }*/
                            nNumberofSoldListing = nNumberofSoldListing + 1;
                            nTotalAmount         = nTotalAmount + Convert.ToDouble(oItem.SellingStatus.CurrentPrice.Value);
                        }
                        else
                        {
                            if (oItem.ListingDetails.RelistedItemID == null)
                            {
                                //  dataGridView1.Rows.Add(oItem.ItemID, oItem.ListingType, oItem.Title, oItem.SubTitle, oItem.ListingDetails.StartTime.ToShortDateString(), oItem.ListingDetails.EndTime.ToShortDateString(), oItem.SellingStatus.CurrentPrice.Value, "DNS");
                                nEligibleItemForRelist += 1;
                            }
                            else
                            {
                                nAlreadyRelistedCount += 1;
                            }
                        }
                        /**/
                        /*Get the data from the inventory header so that we can load this main db*/
                        /*************************************************************************/
                        szSelectString = " ";
                        int outnumber = 0;
                        //jdInvShipDate = new DateTime(0);

                        if (int.TryParse(szItemArray[0].ToString(), out outnumber))
                        //if (int.TryParse(szItemArray[0].ToString()), out value)
                        {
                            szSelectString = "Select * from InventoryHeader where INVITEM = " + szItemArray[0];
                            OleDbCommand    cmd_InvMon    = new OleDbCommand(szSelectString, conn_newdb2);
                            OleDbDataReader reader_InvMon = cmd_InvMon.ExecuteReader();
                            while (reader_InvMon.Read())
                            {
                                if (reader_InvMon != null)
                                {
                                    if ((reader_InvMon["INVDATE"].ToString() != null) && reader_InvMon["INVDATE"].ToString() != " " && reader_InvMon["INVDATE"].ToString() != "")
                                    {
                                        jddate = Convert.ToDateTime(reader_InvMon["INVDATE"].ToString());
                                    }
                                    if ((reader_InvMon["INVSOLDDATE"].ToString() != null) && reader_InvMon["INVSOLDDATE"].ToString() != " " && reader_InvMon["INVSOLDDATE"].ToString() != "")
                                    {
                                        jdInvShipDate = Convert.ToDateTime(reader_InvMon["INVSOLDDATE"].ToString());
                                    }
                                    else
                                    {
                                        jdInvShipDate = Convert.ToDateTime("01/01/1974");
                                    }
                                    if ((reader_InvMon["INVLISTEDDATE"].ToString() != null) && reader_InvMon["INVLISTEDDATE"].ToString() != " " && reader_InvMon["INVLISTEDDATE"].ToString() != "")
                                    {
                                        jdListedDate = Convert.ToDateTime(reader_InvMon["INVLISTEDDATE"].ToString());
                                    }
                                    szInventoryCamera   = reader_InvMon["INVCAMERA"].ToString();
                                    szInventoryCategory = reader_InvMon["INVHEADER"].ToString();
                                    szInventoryLocation = reader_InvMon["INVLOCATION"].ToString();
                                    szInventorySource   = reader_InvMon["INVCHECKINDATE"].ToString();
                                    dInvPrice           = Convert.ToDouble(reader_InvMon["INVPRICE"].ToString());
                                }
                                break;
                            }
                        }
                        /*************************************************************************/
                        szDescription = "";
                        //szDescription = oItem.Description;
                        //szDescription = szDescription.Replace("\"", "\"\"");

                        if (CheckRecordExistence(szItemArray[0], oItem.ItemID))
                        {
                            //Update
                            szInsertString = "";
                            szInsertString = "Update EbayAnalysis Set " +
                                             "SoldDate = " + "\"" + oItem.ListingDetails.EndTime.AddHours(-7) + "\"," +
                                             "ListedDate = " + "\"" + oItem.ListingDetails.StartTime.AddHours(-7) + "\"," +
                                             "HighBidder = " + "\"" + szHighBidder + "\"," +
                                             "SoldPrice = " + oItem.SellingStatus.CurrentPrice.Value + "," +
                                             "Description = " + "\"" + szDescription + "\"," +
                                             "Category = " + "\"" + oItem.PrimaryCategory.CategoryID + "\"," +
                                             "CategoryDescription = " + "\"" + oItem.PrimaryCategory.CategoryName + "\"," +
                                             "ShippingType = " + "\"" + szShippingType + "\"," +
                                             "InventoryDate = " + "\"" + jddate + "\"," +
                                             "InventoryShipDate = " + "\"" + jdInvShipDate + "\"," +
                                             //"InventoryListedDate = " + "\"" + jdListedDate + "\"," +
                                             "InventoryCategory = " + "\"" + szInventoryCategory + "\"," +
                                             "InventoryCamera = " + "\"" + szInventoryCamera + "\"," +
                                             "InventoryLocation = " + "\"" + szInventoryLocation + "\"," +
                                             "InventorySource = " + "\"" + szInventorySource + "\"," +
                                             "InventoryPrice = " + dInvPrice + "," +
                                             "QtySold = " + nQtySold + "," +
                                             "QtyAvailable = " + nQtyAvail + "," +
                                             "LotSize = " + nLotSize +
                                             " Where ( CustomItemNumber = "
                                             + "\"" + szItemArray[0] + "\"" + "AND "
                                             + "EbayItemNumber = "
                                             + "\"" + oItem.ItemID + "\"" +
                                             ")";
                        }
                        else
                        {
                            szInsertString = "";
                            szInsertString = "insert into EbayAnalysis (" +
                                             "CustomItemNumber," +
                                             "EbayItemNumber," +
                                             "SoldDate," +
                                             "ListedDate," +
                                             "HighBidder," +
                                             "StartingPrice," +
                                             "SoldPrice," +
                                             "NumberOfDays," +
                                             "Title," +
                                             "SubTitle," +
                                             "Description," +
                                             "Category," +
                                             "CategoryDescription," +
                                             "ShippingType," +
                                             "InventoryDate," +
                                             "InventoryShipDate," +
                                             "InventoryListedDate," +
                                             "InventoryCategory," +
                                             "InventoryCamera," +
                                             "InventoryLocation," +
                                             "InventorySource," +
                                             "InventoryPrice," +
                                             "QtySold," +
                                             "QtyAvailable," +
                                             "LotSize" +
                                             ") VALUES ( "
                                             + "\"" + szItemArray[0] + "\"," +
                                             oItem.ItemID + "," +
                                             "\"" + oItem.ListingDetails.EndTime.AddHours(-7) + "\"," +
                                             "\"" + oItem.ListingDetails.StartTime.AddHours(-7) + "\"," +
                                             "\"" + szHighBidder + "\"," +
                                             oItem.StartPrice.Value + "," +
                                             oItem.SellingStatus.CurrentPrice.Value + "," +
                                             "0" + "," +
                                             "\"" + szTitle + "\"" + "," +
                                             "\"" + szSubTitle + "\"" + "," +
                                             "\"" + szDescription + "\"," +
                                             "\"" + oItem.PrimaryCategory.CategoryID + "\"," +
                                             "\"" + oItem.PrimaryCategory.CategoryName + "\"," +
                                             "\"" + szShippingType + "\"," +
                                             "\"" + jddate + "\"," +
                                             "\"" + jdInvShipDate + "\"," +
                                             "\"" + jdListedDate + "\"," +
                                             "\"" + szInventoryCategory + "\"," +
                                             "\"" + szInventoryCamera + "\"," +
                                             "\"" + szInventoryLocation + "\"," +
                                             "\"" + szInventorySource + "\"," +
                                             dInvPrice + "," +
                                             nQtySold + "," +
                                             nQtyAvail + "," +
                                             nLotSize +
                                             ")";
                        }
                        OleDbCommand cmd6 = new OleDbCommand(szInsertString, conn_newdb);
                        cmd6.ExecuteNonQuery();
                        nCount++;
                        label1.Text = nCount.ToString();
                        label1.Refresh();
                    }
                    pagenumber += 1;
                }
                conn_newdb.Close();
                conn_newdb2.Close();
                //pagenumber += 1;
            }

            catch (ApiException oApiEx)
            {
                // process exception ... pass to caller, implement retry logic here or in caller, whatever you want to do
                txtResults.Text = oApiEx.Message;
                return;
            }
            catch (SdkException oSdkEx)
            {
                // process exception ... pass to caller, implement retry logic here or in caller, whatever you want to do
                txtResults.Text = oSdkEx.Message;
                return;
            }
            catch (Exception oEx)
            {
                // process exception ... pass to caller, implement retry logic here or in caller, whatever you want to do
                txtResults.Text = oEx.Message;
                return;
            }
            Cursor.Current = Cursors.Default;
        }
Beispiel #17
0
        private void BtnSendInvoice_Click(object sender, System.EventArgs e)
        {
            try
            {
                SendInvoiceCall apicall = new SendInvoiceCall(Context);

                TxtStatus.Text = "";
                string ItemID        = TxtItemId.Text;
                string TransactionID = TxtTransactionId.Text;

                ShippingServiceOptionsType ShippingServiceOption = new ShippingServiceOptionsType();

                ShippingServiceOption.ShippingInsuranceCost            = new AmountType();
                ShippingServiceOption.ShippingInsuranceCost.currencyID = CurrencyUtility.GetDefaultCurrencyCodeType(Context.Site);
                ShippingServiceOption.ShippingInsuranceCost.Value      = Convert.ToDouble(TxtShippingInsuranceCost.Text);

                ShippingServiceOption.ShippingService = CboShippingService.SelectedItem.ToString();

                ShippingServiceOption.ShippingServiceCost            = new AmountType();
                ShippingServiceOption.ShippingServiceCost.currencyID = CurrencyUtility.GetDefaultCurrencyCodeType(Context.Site);
                ShippingServiceOption.ShippingServiceCost.Value      = Convert.ToDouble(TxtShippingServiceCost.Text);


                ShippingServiceOption.ShippingServiceAdditionalCost = new AmountType();

                ShippingServiceOption.ShippingServiceAdditionalCost.Value      = Convert.ToDouble(TxtShippingServiceAdditionalCost.Text);
                ShippingServiceOption.ShippingServiceAdditionalCost.currencyID = CurrencyUtility.GetDefaultCurrencyCodeType(Context.Site);
                ShippingServiceOption.ShippingServicePriority = Int32.Parse(TxtShippingServicePriority.Text);

                //SaleTaxType related
                apicall.SalesTax = new SalesTaxType();
                apicall.SalesTax.SalesTaxPercent       = (float)Convert.ToDouble(TxtSalesTaxPercent.Text);
                apicall.SalesTax.SalesTaxState         = TxtSalesTaxState.Text;
                apicall.SalesTax.ShippingIncludedInTax = ChkShippingIncludedInTax.Checked;

                apicall.SalesTax.SalesTaxAmount            = new AmountType();
                apicall.SalesTax.SalesTaxAmount.currencyID = CurrencyUtility.GetDefaultCurrencyCodeType(Context.Site);
                apicall.SalesTax.SalesTaxAmount.Value      = Convert.ToDouble(TxtSalesTaxAmount.Text);


                apicall.InsuranceOption = (InsuranceOptionCodeType)Enum.Parse(typeof(InsuranceOptionCodeType), CboInsuranceOption.SelectedItem.ToString());

                apicall.InsuranceFee            = new AmountType();
                apicall.InsuranceFee.currencyID = CurrencyUtility.GetDefaultCurrencyCodeType(Context.Site);
                apicall.InsuranceFee.Value      = Convert.ToDouble(TxtInsuranceFee.Text);

                apicall.PaymentMethodsList = new BuyerPaymentMethodCodeTypeCollection();
                apicall.PaymentMethodsList.Add((BuyerPaymentMethodCodeType)Enum.Parse(typeof(BuyerPaymentMethodCodeType), CboPaymentMethod.SelectedItem.ToString()));

                apicall.PayPalEmailAddress   = TxtPayPalEmailAddress.Text;
                apicall.CheckoutInstructions = TxtCheckoutInstructions.Text;
                apicall.EmailCopyToSeller    = ChkEmailCopyToSeller.Checked;

                ShippingServiceOptionsTypeCollection ShippingServiceOptionsList = new ShippingServiceOptionsTypeCollection();
                ShippingServiceOptionsList.Add(ShippingServiceOption);

                apicall.SendInvoice(ItemID, TransactionID, ShippingServiceOptionsList);
                TxtStatus.Text = apicall.ApiResponse.Ack.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
		private void BtnSendInvoice_Click(object sender, System.EventArgs e)
		{
			try
			{
				SendInvoiceCall apicall = new SendInvoiceCall(Context);

				TxtStatus.Text = "";
				string ItemID = TxtItemId.Text;
				string TransactionID = TxtTransactionId.Text;

				ShippingServiceOptionsType ShippingServiceOption = new ShippingServiceOptionsType();
				
				ShippingServiceOption.ShippingInsuranceCost = new AmountType();
				ShippingServiceOption.ShippingInsuranceCost.currencyID = CurrencyUtility.GetDefaultCurrencyCodeType(Context.Site);
				ShippingServiceOption.ShippingInsuranceCost.Value = Convert.ToDouble(TxtShippingInsuranceCost.Text);
					
				ShippingServiceOption.ShippingService = CboShippingService.SelectedItem.ToString();

				ShippingServiceOption.ShippingServiceCost = new AmountType();
				ShippingServiceOption.ShippingServiceCost.currencyID = CurrencyUtility.GetDefaultCurrencyCodeType(Context.Site);
				ShippingServiceOption.ShippingServiceCost.Value=Convert.ToDouble(TxtShippingServiceCost.Text);

				
				ShippingServiceOption.ShippingServiceAdditionalCost = new AmountType();

				ShippingServiceOption.ShippingServiceAdditionalCost.Value=Convert.ToDouble(TxtShippingServiceAdditionalCost.Text);
				ShippingServiceOption.ShippingServiceAdditionalCost.currencyID = CurrencyUtility.GetDefaultCurrencyCodeType(Context.Site);
				ShippingServiceOption.ShippingServicePriority = Int32.Parse(TxtShippingServicePriority.Text);

				//SaleTaxType related
				apicall.SalesTax = new SalesTaxType();
				apicall.SalesTax.SalesTaxPercent = (float)Convert.ToDouble(TxtSalesTaxPercent.Text);
				apicall.SalesTax.SalesTaxState = TxtSalesTaxState.Text;
				apicall.SalesTax.ShippingIncludedInTax = ChkShippingIncludedInTax.Checked;

				apicall.SalesTax.SalesTaxAmount = new AmountType();
				apicall.SalesTax.SalesTaxAmount.currencyID = CurrencyUtility.GetDefaultCurrencyCodeType(Context.Site);
				apicall.SalesTax.SalesTaxAmount.Value = Convert.ToDouble(TxtSalesTaxAmount.Text);
				
        
				apicall.InsuranceOption = (InsuranceOptionCodeType)Enum.Parse(typeof(InsuranceOptionCodeType), CboInsuranceOption.SelectedItem.ToString());
				
				apicall.InsuranceFee = new AmountType();
				apicall.InsuranceFee.currencyID = CurrencyUtility.GetDefaultCurrencyCodeType(Context.Site);
				apicall.InsuranceFee.Value = Convert.ToDouble(TxtInsuranceFee.Text);

				apicall.PaymentMethodsList = new BuyerPaymentMethodCodeTypeCollection();
				apicall.PaymentMethodsList.Add((BuyerPaymentMethodCodeType)Enum.Parse(typeof(BuyerPaymentMethodCodeType), CboPaymentMethod.SelectedItem.ToString()));
				
				apicall.PayPalEmailAddress = TxtPayPalEmailAddress.Text;
				apicall.CheckoutInstructions = TxtCheckoutInstructions.Text;
				apicall.EmailCopyToSeller = ChkEmailCopyToSeller.Checked;

				ShippingServiceOptionsTypeCollection ShippingServiceOptionsList= new ShippingServiceOptionsTypeCollection();
				ShippingServiceOptionsList.Add(ShippingServiceOption);

				apicall.SendInvoice(ItemID, TransactionID, ShippingServiceOptionsList);
				TxtStatus.Text = apicall.ApiResponse.Ack.ToString();
			}
			catch(Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
		}
Beispiel #19
0
        private ShippingDetailsType getShippingDetails(String shippingService)
        {
            // Shipping details.
            SiteCodeType site = (SiteCodeType)Session[Global.SITE];
            ShippingDetailsType sd = new ShippingDetailsType();
            SalesTaxType salesTax = new SalesTaxType();
            salesTax.SalesTaxPercent=0.0825f;
            salesTax.SalesTaxState="CA";
            sd.ApplyShippingDiscount=true;
            AmountType at =new AmountType();
            at.Value=0.1;
            at.currencyID=Global.GetCurrencyType(site);
            sd.InsuranceFee=at;
            sd.InsuranceOption=InsuranceOptionCodeType.Optional;
            sd.PaymentInstructions="eBay DotNet SDK test instruction.";

            // Set calculated shipping.
            sd.ShippingType=ShippingTypeCodeType.Flat;
            //
            ShippingServiceOptionsType st1 = new ShippingServiceOptionsType();
            st1.ShippingService=shippingService;
            at = new AmountType();
            at.Value=0.1;
            at.currencyID=Global.GetCurrencyType(site);
            st1.ShippingServiceAdditionalCost=at;
            at = new AmountType();
            at.Value=0.1;
            at.currencyID=Global.GetCurrencyType(site);
            st1.ShippingServiceCost=at;
            st1.ShippingServicePriority=1;
            at = new AmountType();
            at.Value=0.1;
            at.currencyID=Global.GetCurrencyType(site);
            st1.ShippingInsuranceCost=at;

            sd.ShippingServiceOptions=new ShippingServiceOptionsTypeCollection(new ShippingServiceOptionsType[]{st1});

            return sd;
        }
        public async Task <ItemType> PrepareItem(CommerceContext commerceContext, SellableItem sellableItem)
        {
            ShippingServiceOptionsType shipservice1 = new ShippingServiceOptionsType
            {
                ShippingService         = "USPSPriority",
                ShippingServicePriority = 1,
                ShippingServiceCost     = new AmountType {
                    currencyID = CurrencyCodeType.USD, Value = 5.0
                }
            };

            using (CommandActivity.Start(commerceContext, this))
            {
                var item = await this._commerceCommander.Pipeline <IPrepareEbayItemPipeline>().Run(sellableItem, commerceContext.GetPipelineContextOptions());

                item.Description = sellableItem.Description;
                item.Title       = sellableItem.DisplayName;
                item.SubTitle    = "Test Item";

                var listPricingPolicy = sellableItem.GetPolicy <ListPricingPolicy>();
                var listPrice         = listPricingPolicy.Prices.FirstOrDefault();

                item.StartPrice = new AmountType {
                    currencyID = CurrencyCodeType.USD, Value = System.Convert.ToDouble(listPrice.Amount)
                };

                item.ConditionID = 1000;

                item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection
                {
                    BuyerPaymentMethodCodeType.PayPal, BuyerPaymentMethodCodeType.VisaMC
                };
                item.PayPalEmailAddress = "*****@*****.**";
                item.PostalCode         = "98014";

                item.DispatchTimeMax = 3;
                item.ShippingDetails = new ShippingDetailsType
                {
                    ShippingServiceOptions = new ShippingServiceOptionsTypeCollection(),
                    ShippingType           = ShippingTypeCodeType.Flat
                };

                shipservice1.ShippingServiceAdditionalCost = new AmountType
                {
                    currencyID = CurrencyCodeType.USD, Value = 1.0
                };

                item.ShippingDetails.ShippingServiceOptions.Add(shipservice1);

                item.ReturnPolicy = new ReturnPolicyType {
                    ReturnsAcceptedOption = "ReturnsAccepted"
                };

                // Add pictures
                item.PictureDetails = new PictureDetailsType
                {
                    GalleryType = GalleryTypeCodeType.None, GalleryTypeSpecified = true
                };

                return(item);
            }
        }
Beispiel #21
0
        /// <summary>
        /// Build a sample item
        /// </summary>
        /// <returns>ItemType object</returns>
        private ItemType BuildItem(string sneakerID)
        {
            ItemType item = new ItemType();

            // item title
            item.Title  = SQLConnect.Select("Select ShoeName from Shoe where ShoeID = '" + sneakerID + "';");
            item.ItemID = sneakerID;
            string Website     = SQLConnect.Select("Select SupplierName from Supplier, Shoe where (Supplier.SupplierID = Shoe.SupplierID) AND (Shoe.ShoeID = '" + sneakerID + "');");
            string Description = new SearchShoeInfo().GetShoeDescription(Website, item.Title, sneakerID);

            // item description
            item.Description = Description;

            string ShoeImage = new SearchShoeInfo().GetShoeImage(Website, item.Title, sneakerID, 5);

            string[] imgURL = ShoeImage.Split('\n');
            // upload photos


            eBayPictureService pictureService = new eBayPictureService(apiContext);

            pictureService.ApiContext = apiContext;
            //pictureService.
            //pictureService.ApiContext.EPSServerUrl = @"https://api.sandbox.ebay.com/wsapi";
            //pictureService.ApiContext.EPSServerUrl = @"https://api.sandbox.ebay.com/ws/api.dll";
            pictureService.ApiContext.EPSServerUrl = @"https://api.ebay.com/ws/wsapi";

            /*UploadSiteHostedPicturesRequestType request = new UploadSiteHostedPicturesRequestType();
             * request.WarningLevel = WarningLevelCodeType.High;
             * request.ExternalPictureURL = new StringCollection();
             * request.ExternalPictureURL.Add(@"https://images-eu.ssl-images-amazon.com/images/I/41qPjKzQcyL._SL75_.jpg");
             * request.PictureName = "Deva_testimage_URL";
             * request.PictureSet = PictureSetCodeType.Supersize;
             * request.PictureSetSpecified = true;
             */
            string[] pictureList = { @"C:\\Users\\Viet\\Pictures\\img.jpg", @"C:\\Users\\Viet\\Pictures\\img.jpg" };
            string[] picURLs     = pictureService.UpLoadPictureFiles(PhotoDisplayCodeType.SuperSize, pictureList);


            try {
                item.PictureDetails = new PictureDetailsType();
                //item.PictureDetails.GalleryType = GalleryTypeCodeType.None;
                item.PictureDetails.PictureURL    = new StringCollection();
                item.PictureDetails.PictureSource = PictureSourceCodeType.EPS;
                //item.PictureDetails.PhotoDisplay = PhotoDisplayCodeType.SuperSize;
                //item.PictureDetails.PhotoDisplaySpecified = true;
                foreach (string pic in picURLs)
                {
                    //item.PictureDetails.PictureURL.Add(pic);
                }
            }
            catch (ApiException e)
            {
                MessageBox.Show(e.Message);
            }


            // listing duration
            item.ListingDuration = "Days_7";
            // listing category,
            CategoryType category = new CategoryType();

            category.CategoryID  = "153008"; //CategoryID = 11104 (CookBooks) , Parent CategoryID=267(Books), 153008 (shoe)
            item.PrimaryCategory = category;

            // item quality
            item.Quantity = 1;

            // item condition, New
            item.ConditionID = 1000;

            // item specifics
            item.ItemSpecifics = buildItemSpecifics(sneakerID);
            // listing type: Auction
            item.ListingType = ListingTypeCodeType.Chinese;

            // item location and country
            item.Location = "Melbourne";
            item.Country  = CountryCodeType.AU;
            item.Currency = CurrencyCodeType.AUD;
            // listing price
            //item Start Price
            AmountType amount = new AmountType();

            amount.Value      = 20;
            amount.currencyID = CurrencyCodeType.AUD;
            item.StartPrice   = amount;

            //Console.WriteLine("Do you want to use Business policy profiles to list this item? y/n");
            String input = "n";//Console.ReadLine();

            if (input.ToLower().Equals("y"))
            {
                item.SellerProfiles = BuildSellerProfiles();
            }
            else
            {
                // payment methods
                item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection();
                item.PaymentMethods.AddRange(
                    new BuyerPaymentMethodCodeType[] { BuyerPaymentMethodCodeType.PayPal }
                    );
                // email is required if paypal is used as payment method
                item.PayPalEmailAddress = "*****@*****.**";
                item.PostalCode         = "3000";
                // handling time is required
                item.DispatchTimeMax = 1;
                // shipping details
                //item.ShippingDetails = BuildShippingDetails();
                item.ShippingDetails = new ShippingDetailsType();
                item.ShippingDetails.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection();

                // return policy
                item.ReturnPolicy = new ReturnPolicyType();
                item.ReturnPolicy.ReturnsAcceptedOption = "ReturnsAccepted";
                ShippingServiceOptionsType shipservice1 = new ShippingServiceOptionsType();
                shipservice1.ShippingService                = "AU_Regular";
                shipservice1.ShippingServicePriority        = 1;
                shipservice1.ShippingServiceCost            = new AmountType();
                shipservice1.ShippingServiceCost.currencyID = CurrencyCodeType.AUD;
                shipservice1.ShippingServiceCost.Value      = 1.0;

                shipservice1.ShippingServiceAdditionalCost            = new AmountType();
                shipservice1.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.AUD;
                shipservice1.ShippingServiceAdditionalCost.Value      = 1.0;

                item.ShippingDetails.ShippingServiceOptions.Add(shipservice1);

                ShippingServiceOptionsType shipservice2 = new ShippingServiceOptionsType();
                shipservice2.ShippingService                = "AU_Express";
                shipservice2.ShippingServicePriority        = 2;
                shipservice2.ShippingServiceCost            = new AmountType();
                shipservice2.ShippingServiceCost.currencyID = CurrencyCodeType.AUD;
                shipservice2.ShippingServiceCost.Value      = 4.0;

                shipservice2.ShippingServiceAdditionalCost            = new AmountType();
                shipservice2.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.AUD;
                shipservice2.ShippingServiceAdditionalCost.Value      = 1.0;

                item.ShippingDetails.ShippingServiceOptions.Add(shipservice2);
            }

            return(item);
        }
Beispiel #22
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public virtual ICollection GetShippingServiceOptions()
        {
            ShippingServiceOptionsTypeCollection ssos = new ShippingServiceOptionsTypeCollection();

            int row = this.Items.Count;
            int col = this.Items[0].SubItems.Count;

            int cnt = 0;
            for (int i = 0; i < row; i++)
            {
                ListViewItem lvi = this.Items[i];
                //ShippingService
                string text = lvi.SubItems[0].Text;
                if (text.Length > 0)
                {
                    if (!text.Equals("NotSelected"))
                    {
                        cnt++;
                        ShippingServiceOptionsType sso = new ShippingServiceOptionsType();
                        sso.ShippingService = text;
                        sso.ShippingServicePriority = cnt;
                        ssos.Add(sso);
                        if (col > 1)
                        {
                            // ShippingServiceCost
                            text = lvi.SubItems[1].Text;
                            if (text.Length > 0)
                            {
                                sso.ShippingServiceCost = CurrencyUtility.GetAmountType(text);
                            }
                            // ShippingServiceAdditioanlCost
                            text = lvi.SubItems[2].Text;
                            if (text.Length > 0)
                            {
                                sso.ShippingServiceAdditionalCost = CurrencyUtility.GetAmountType(text);
                            }
                        }
                    }
                }
            }
            return ssos;
        }
Beispiel #23
0
		private static ShippingDetailsType getShippingDetails()
		{
			// Shipping details.
			ShippingDetailsType sd = new ShippingDetailsType();
			SalesTaxType salesTax = new SalesTaxType();
			salesTax.SalesTaxPercent = 0.0825F;
			salesTax.SalesTaxPercentSpecified = true;
			salesTax.SalesTaxState = "CA";
			sd.SalesTax = salesTax;
			sd.AllowPaymentEdit = false;
			sd.AllowPaymentEditSpecified = true;
			sd.ApplyShippingDiscount = true;
			sd.ApplyShippingDiscountSpecified = true;
			sd.InsuranceFee = new AmountType();
			sd.InsuranceFee.Value = 0.1;
			sd.InsuranceFee.currencyID = CurrencyCodeType.USD;
			sd.InsuranceOption = InsuranceOptionCodeType.Optional;
			sd.PaymentInstructions = "eBay Java SDK test instruction.";
			sd.ShippingType = ShippingTypeCodeType.Flat;
			ShippingServiceOptionsType st1 = new ShippingServiceOptionsType();
			st1.ShippingService = ShippingServiceCodeType.USPSPriority.ToString();
			st1.ShippingServiceAdditionalCost = new AmountType();
			st1.ShippingServiceAdditionalCost.Value = 0.1;
			st1.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.USD;
			st1.ShippingServiceCost = new AmountType();
			st1.ShippingServiceCost.Value = 0.1;
			st1.ShippingServiceCost.currencyID = CurrencyCodeType.USD;

			st1.ShippingServicePriority = 1;
			st1.ShippingServicePrioritySpecified = true;
			st1.ShippingInsuranceCost = new AmountType();
			st1.ShippingInsuranceCost.Value = 0.1;
			st1.ShippingInsuranceCost.currencyID = CurrencyCodeType.USD;
			ShippingServiceOptionsType st2 = new ShippingServiceOptionsType();
			st2.ExpeditedService = true;
			st2.ExpeditedServiceSpecified = true;
			st2.ShippingService = ShippingServiceCodeType.USPSFirstClass.ToString();
			st2.ShippingServiceAdditionalCost = new AmountType();
			st2.ShippingServiceAdditionalCost.Value = 0.1;
			st2.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.USD;

			st2.ShippingServiceCost = new AmountType();
			st2.ShippingServiceCost.Value = 0.1;
			st2.ShippingServiceCost.currencyID = CurrencyCodeType.USD;
			st2.ShippingServicePriority = 2;
			st2.ShippingServicePrioritySpecified = true;
			st2.ShippingInsuranceCost = new AmountType();
			st2.ShippingInsuranceCost.Value = 0.1;
			st2.ShippingInsuranceCost.currencyID = CurrencyCodeType.USD;

			sd.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection();
			sd.ShippingServiceOptions.Add(st1);
			sd.ShippingServiceOptions.Add(st2);
			return sd;
			
		}
Beispiel #24
0
        /// <summary>
        /// Build a sample item
        /// </summary>
        /// <returns>ItemType object</returns>
        private ItemType BuildItem(string sneakerID)
        {
            ItemType item = new ItemType();

            // item title
            item.Title = SQLConnect.Select("Select ShoeName from Shoe where ShoeID = '" + sneakerID + "';");
            // item description
            item.Description = "";
            // upload description + photos
            try
            {
                string[]           imgFile        = new string[10];
                eBayPictureService pictureService = new eBayPictureService(new ApiContext());
                // pictureService.ApiContext.EPSServerUrl = @"https://api.sandbox.ebay.com/ws/api.dll";
                string[] picURLs = pictureService.UpLoadPictureFiles(PhotoDisplayCodeType.SuperSize, imgFile);
            }
            catch (Exception e)
            {
                //MessageBox.Show("Reading file Unsuccessful");
            }



            // listing duration
            item.ListingDuration = "Days_7";


            // listing category,
            CategoryType category = new CategoryType();

            category.CategoryID  = "153008"; //CategoryID = 11104 (CookBooks) , Parent CategoryID=267(Books), 153008 (shoe)
            item.PrimaryCategory = category;

            // item quality
            item.Quantity = 1;

            // item condition, New
            item.ConditionID = 1000;

            // item specifics
            item.ItemSpecifics = buildItemSpecifics(sneakerID);
            // listing type
            item.ListingType = ListingTypeCodeType.Chinese;



            // item location and country
            item.Location = "Melbourne";
            item.Country  = CountryCodeType.AU;
            item.Currency = CurrencyCodeType.AUD;
            // listing price
            //item Start Price
            AmountType amount = new AmountType();

            amount.Value      = 20;
            amount.currencyID = CurrencyCodeType.AUD;
            item.StartPrice   = amount;

            //Console.WriteLine("Do you want to use Business policy profiles to list this item? y/n");
            String input = "n";//Console.ReadLine();

            if (input.ToLower().Equals("y"))
            {
                item.SellerProfiles = BuildSellerProfiles();
            }
            else
            {
                // payment methods
                item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection();
                item.PaymentMethods.AddRange(
                    new BuyerPaymentMethodCodeType[] { BuyerPaymentMethodCodeType.PayPal }
                    );
                // email is required if paypal is used as payment method
                item.PayPalEmailAddress = "*****@*****.**";
                item.PostalCode         = "3000";
                // handling time is required
                item.DispatchTimeMax = 1;
                // shipping details
                //item.ShippingDetails = BuildShippingDetails();
                item.ShippingDetails = new ShippingDetailsType();
                item.ShippingDetails.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection();

                // return policy
                item.ReturnPolicy = new ReturnPolicyType();
                item.ReturnPolicy.ReturnsAcceptedOption = "ReturnsAccepted";
                ShippingServiceOptionsType shipservice1 = new ShippingServiceOptionsType();
                shipservice1.ShippingService                = "AU_Regular";
                shipservice1.ShippingServicePriority        = 1;
                shipservice1.ShippingServiceCost            = new AmountType();
                shipservice1.ShippingServiceCost.currencyID = CurrencyCodeType.AUD;
                shipservice1.ShippingServiceCost.Value      = 1.0;

                shipservice1.ShippingServiceAdditionalCost            = new AmountType();
                shipservice1.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.AUD;
                shipservice1.ShippingServiceAdditionalCost.Value      = 1.0;

                item.ShippingDetails.ShippingServiceOptions.Add(shipservice1);

                ShippingServiceOptionsType shipservice2 = new ShippingServiceOptionsType();
                shipservice2.ShippingService                = "AU_Express";
                shipservice2.ShippingServicePriority        = 2;
                shipservice2.ShippingServiceCost            = new AmountType();
                shipservice2.ShippingServiceCost.currencyID = CurrencyCodeType.AUD;
                shipservice2.ShippingServiceCost.Value      = 4.0;

                shipservice2.ShippingServiceAdditionalCost            = new AmountType();
                shipservice2.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.AUD;
                shipservice2.ShippingServiceAdditionalCost.Value      = 1.0;

                item.ShippingDetails.ShippingServiceOptions.Add(shipservice2);
            }



            return(item);
        }
Beispiel #25
0
        /// <summary>
        /// Build sample shipping details
        /// </summary>
        /// <returns>ShippingDetailsType object</returns>
        static ShippingDetailsType BuildShippingDetails()
        {
            // Shipping details
            ShippingDetailsType sd = new ShippingDetailsType();

            sd.ApplyShippingDiscount = true;
            AmountType amount = new AmountType();
            amount.Value = 2.8;
            amount.currencyID = CurrencyCodeType.USD;
            sd.PaymentInstructions = "eBay .Net SDK test instruction.";

            // Shipping type and shipping service options
            sd.ShippingType = ShippingTypeCodeType.Flat;
            ShippingServiceOptionsType shippingOptions = new ShippingServiceOptionsType();
            shippingOptions.ShippingService = 
                ShippingServiceCodeType.ShippingMethodStandard.ToString();
            amount = new AmountType();
            amount.Value = 2.0;
            amount.currencyID = CurrencyCodeType.USD;
            shippingOptions.ShippingServiceAdditionalCost = amount;
            amount = new AmountType();
            amount.Value = 1;
            amount.currencyID = CurrencyCodeType.USD;
            shippingOptions.ShippingServiceCost = amount;
            shippingOptions.ShippingServicePriority = 1;
            amount = new AmountType();
            amount.Value = 1.0;
            amount.currencyID = CurrencyCodeType.USD;
            shippingOptions.ShippingInsuranceCost = amount;

            sd.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection(
                new ShippingServiceOptionsType[] { shippingOptions }
                );

            return sd;
        }
Beispiel #26
0
        private ShippingDetailsType GetShippingDetails(int countOfArticles)
        {
            ShippingDetailsType sd = new ShippingDetailsType();
            sd.ShippingType = ShippingTypeCodeType.Flat;

            ShippingServiceOptionsType st1 = new ShippingServiceOptionsType();
            st1.ShippingService = ShippingServiceCodeType.DE_Paket.ToString();
            st1.ShippingServiceAdditionalCost = new AmountType { Value = 0, currencyID = CurrencyCodeType.EUR };
            st1.ShippingServicePriority = 1;
            st1.ShippingServiceCost = new AmountType { Value = 5.95, currencyID = CurrencyCodeType.EUR };

            if (countOfArticles > 1)
            {
                st1.ShippingServiceCost.Value = 0;
            }

            sd.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection(new[] { st1});
            return sd;
        }
Beispiel #27
0
        /// <summary>
        /// Build a sample item
        /// </summary>
        /// <returns>ItemType object</returns>
        private ItemType BuildItem(string sneakerID)
        {
            ItemType item = new ItemType();

            // item title
            item.Title = SQLConnect.Select("Select ShoeName from Shoe where ShoeID = '" + sneakerID + "';");
            // item description
            item.Description = "";
            // display description + photos on window form.
            //string rootPath = @"C:\Users\Viet\Documents\Visual Studio 2017\Projects\SnkrBot\target list-desc-images\";
            string rootPath = @"C:\SnkrBot\target list-desc-images";

            //string rootPath = @"C: \Users\Administrator\Desktop\target list-desc-images\";
            // scan sundirectories of rootPath
            string[] subdirectoryEntries = Directory.GetDirectories(rootPath);

            string folder = "";

            // check to find the right directory for the shoe
            foreach (string subdirectory in subdirectoryEntries)
            {
                if (subdirectory.Contains(sneakerID))
                {
                    folder = subdirectory;
                    break;
                }
            }

            try
            {
                // Only get files end .txt
                string[] txtFile = Directory.GetFiles(folder, "*.txt");
                //MessageBox.Show("The number of files .txt is" +txtFile.Length+".");
                foreach (string dir in txtFile)
                {
                    var fileStream = new FileStream(dir, FileMode.Open, FileAccess.Read);
                    using (var streamReader = new StreamReader(fileStream, Encoding.UTF8))
                    {
                        item.Description = streamReader.ReadToEnd();
                    }
                }
                // Only get files end .jpeg
                string[] imgFile = Directory.GetFiles(folder, "*.jpeg");
                //MessageBox.Show("The number of files .jpeg is" + imgFile.Length + ".");
                foreach (string dir in imgFile)
                {
                }
                //pb1.ImageLocation = imgFile[0];
                apiContext.EPSServerUrl = @"https://api.sandbox.ebay.com/ws/api.dll";
                eBayPictureService pictureService = new eBayPictureService(new ApiContext());
                // pictureService.ApiContext.EPSServerUrl = @"https://api.sandbox.ebay.com/ws/api.dll";
                string[] picURLs = pictureService.UpLoadPictureFiles(PhotoDisplayCodeType.SuperSize, imgFile);
                //To specify a Gallery Image
                item.PictureDetails = new PictureDetailsType();
                //The first picture is used for Gallery URL
                item.PictureDetails.GalleryType = GalleryTypeCodeType.Gallery;
            }
            catch (Exception e)
            {
                //MessageBox.Show("Reading file Unsuccessful");
            }



            // listing duration
            item.ListingDuration = "Days_7";


            // listing category,
            CategoryType category = new CategoryType();

            category.CategoryID  = "153008"; //CategoryID = 11104 (CookBooks) , Parent CategoryID=267(Books), 153008 (shoe)
            item.PrimaryCategory = category;

            // item quality
            item.Quantity = 1;

            // item condition, New
            item.ConditionID = 1000;

            // item specifics
            item.ItemSpecifics = buildItemSpecifics(sneakerID);
            // listing type
            item.ListingType = ListingTypeCodeType.Chinese;



            // item location and country
            item.Location = "Melbourne";
            item.Country  = CountryCodeType.AU;
            item.Currency = CurrencyCodeType.AUD;
            // listing price
            //item Start Price
            AmountType amount = new AmountType();

            amount.Value      = 20;
            amount.currencyID = CurrencyCodeType.AUD;
            item.StartPrice   = amount;

            //Console.WriteLine("Do you want to use Business policy profiles to list this item? y/n");
            String input = "n";//Console.ReadLine();

            if (input.ToLower().Equals("y"))
            {
                item.SellerProfiles = BuildSellerProfiles();
            }
            else
            {
                // payment methods
                item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection();
                item.PaymentMethods.AddRange(
                    new BuyerPaymentMethodCodeType[] { BuyerPaymentMethodCodeType.PayPal }
                    );
                // email is required if paypal is used as payment method
                item.PayPalEmailAddress = "*****@*****.**";
                item.PostalCode         = "3000";
                // handling time is required
                item.DispatchTimeMax = 1;
                // shipping details
                //item.ShippingDetails = BuildShippingDetails();
                item.ShippingDetails = new ShippingDetailsType();
                item.ShippingDetails.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection();

                // return policy
                item.ReturnPolicy = new ReturnPolicyType();
                item.ReturnPolicy.ReturnsAcceptedOption = "ReturnsAccepted";
                ShippingServiceOptionsType shipservice1 = new ShippingServiceOptionsType();
                shipservice1.ShippingService                = "AU_Regular";
                shipservice1.ShippingServicePriority        = 1;
                shipservice1.ShippingServiceCost            = new AmountType();
                shipservice1.ShippingServiceCost.currencyID = CurrencyCodeType.AUD;
                shipservice1.ShippingServiceCost.Value      = 1.0;

                shipservice1.ShippingServiceAdditionalCost            = new AmountType();
                shipservice1.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.AUD;
                shipservice1.ShippingServiceAdditionalCost.Value      = 1.0;

                item.ShippingDetails.ShippingServiceOptions.Add(shipservice1);

                ShippingServiceOptionsType shipservice2 = new ShippingServiceOptionsType();
                shipservice2.ShippingService                = "AU_Express";
                shipservice2.ShippingServicePriority        = 2;
                shipservice2.ShippingServiceCost            = new AmountType();
                shipservice2.ShippingServiceCost.currencyID = CurrencyCodeType.AUD;
                shipservice2.ShippingServiceCost.Value      = 4.0;

                shipservice2.ShippingServiceAdditionalCost            = new AmountType();
                shipservice2.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.AUD;
                shipservice2.ShippingServiceAdditionalCost.Value      = 1.0;

                item.ShippingDetails.ShippingServiceOptions.Add(shipservice2);
            }



            return(item);
        }
Beispiel #28
0
        public void AddFPItemCatalog()
        {
            //create the context
            ApiContext context = new ApiContext();

            //set the User token
            context.ApiCredential.eBayToken = "AgAAAA**AQAAAA**aAAAAA**imCbXA**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wFk4GkCZGKqQWdj6x9nY+seQ**UzUEAA**AAMAAA**MkSqad5luzLeJmNClKehjHdM+ldeDlfwYkDT4yV4I5vP2L19mrhH/FTgpJ007mmthRyAWTu9fwOAq8d7aCAVL+IQb+Aynt3NmgxJmHVruojV7fbOOkNjPCgLSUXeFIaTq+tlmr4ExLtiiArU2kFz60P2B8uVLREVDiyuYvLhZKdkNb1RADMSxGGjJBifrBCu2VgioR6tzoCKDn5FUm76FpTn6ghZ3LNgqpaNjLmXLaWFnDlGTmj2zVSfYDGVz3cFsrv8o+lA8FiqCc8v7ueSXeV0HoMt/k7+DAeeDGWpVstT91UjwgerZoPw/b2x9G7KfR6gfsgGBQ6f+YHqDeNy+4BOv++20BDiTPDD8Y7WsrmZBGY3ZCIIdBsfqVuwo6jyKHLAGnDwjGBEAsVZjCtW4Wn2j4LXzrAankErmPJn8rPmhg0MsyJ5nszkQO+JjZ5mR8BK2lYhXdhhTl/dB3+8ENZKiBnPYCV2+SZumof0j60NuFO3KoNy1bBic52aaR5XSYUIijKAXCXN2Q6sSu7TmLQ9KovV+kM8CDoIV4J0PoXQ/79HXK5POfefy+mJFzzMBCXiKHPYx7h0cwHbic2GgQXWcChf4mvLlLC5mPhHc3rAc3ujbSF1pFtRiXcrnWIshyYdC73GGk24cWmehvCwd6Edvv1BAZcNcbuHmXjlTbjRGkeC5ImlFgRH3CjbKhyByTGsc9PGrf99J1MqrfoEx/iHJMwL7Ka3inyK8dq4spOw8HWulvx5TOc7lsz+RLdc";
            //set the server url
            context.SoapApiServerUrl = "https://api.sandbox.ebay.com/wsapi";

            //enable logging
            context.ApiLogManager = new ApiLogManager();
            context.ApiLogManager.ApiLoggerList.Add(new FileLogger("log.txt", true, true, true));
            context.ApiLogManager.EnableLogging = true;

            //set the version
            context.Version = "1085";
            context.Site    = SiteCodeType.UK;

            string UPC   = "753759090913"; //Garmin nuvi 1350 GPS
            string Brand = "Garmin";
            string MPN   = "010-00782-20";

            //create the call object
            AddFixedPriceItemCall AddFPItemCall = new AddFixedPriceItemCall(context);

            AddFPItemCall.AutoSetItemUUID = true;

            //create an item object and set the properties
            ItemType item = new ItemType();

            //set the item condition depending on the value from GetCategoryFeatures
            item.ConditionID = 1000; //new

            //Basic properties of a listing
            item.Country  = CountryCodeType.GB;
            item.Currency = CurrencyCodeType.GBP;

            //Track item by SKU
            item.InventoryTrackingMethod = InventoryTrackingMethodCodeType.SKU;
            item.SKU = "PROD1234";

            item.Description     = "test - do not bid or buy";
            item.Title           = "test - do not bid or buy";
            item.SubTitle        = "Test Item";
            item.ListingDuration = "Days_7";

            item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection();
            item.PaymentMethods.Add(BuyerPaymentMethodCodeType.PayPal);
            item.PayPalEmailAddress = "*****@*****.**";
            item.PostalCode         = "2001";

            //Specify Shipping Services
            item.DispatchTimeMax = 3;
            item.ShippingDetails = new ShippingDetailsType();
            item.ShippingDetails.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection();

            ShippingServiceOptionsType shipservice1 = new ShippingServiceOptionsType();

            shipservice1.ShippingService                = "UK_Parcelforce24";
            shipservice1.ShippingServicePriority        = 1;
            shipservice1.ShippingServiceCost            = new AmountType();
            shipservice1.ShippingServiceCost.currencyID = CurrencyCodeType.GBP;
            shipservice1.ShippingServiceCost.Value      = 1.0;

            shipservice1.ShippingServiceAdditionalCost            = new AmountType();
            shipservice1.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.GBP;
            shipservice1.ShippingServiceAdditionalCost.Value      = 1.0;

            item.ShippingDetails.ShippingServiceOptions.Add(shipservice1);

            ShippingServiceOptionsType shipservice2 = new ShippingServiceOptionsType();

            shipservice2.ShippingService                = "UK_Parcelforce48";
            shipservice2.ShippingServicePriority        = 2;
            shipservice2.ShippingServiceCost            = new AmountType();
            shipservice2.ShippingServiceCost.currencyID = CurrencyCodeType.GBP;
            shipservice2.ShippingServiceCost.Value      = 4.0;

            shipservice2.ShippingServiceAdditionalCost            = new AmountType();
            shipservice2.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.GBP;
            shipservice2.ShippingServiceAdditionalCost.Value      = 1.0;

            item.ShippingDetails.ShippingServiceOptions.Add(shipservice2);

            //Specify Return Policy
            item.ReturnPolicy = new ReturnPolicyType();
            item.ReturnPolicy.ReturnsAcceptedOption = "ReturnsAccepted";

            item.Quantity              = 10;
            item.StartPrice            = new AmountType();
            item.StartPrice.currencyID = CurrencyCodeType.GBP;
            item.StartPrice.Value      = 10;

            item.PrimaryCategory            = new CategoryType();
            item.PrimaryCategory.CategoryID = "184797";

            item.ProductListingDetails = new ProductListingDetailsType();

            //Specifying UPC as the product identifier. Other applicable product identifiers
            //include ISBN, EAN, Brand-MPN.

            item.ProductListingDetails.UPC = UPC;

            //If multiple product identifiers are specified, eBay uses the first one that
            //matches a product in eBay's catalog system.
            item.ProductListingDetails.BrandMPN       = new BrandMPNType();
            item.ProductListingDetails.BrandMPN.Brand = Brand;
            item.ProductListingDetails.BrandMPN.MPN   = MPN;

            //For listing to be pre-filled with product information from the catalog
            item.ProductListingDetails.IncludePrefilledItemInformation = true;

            //Include the eBay stock photo with the listing if available and use it as the gallery picture
            item.ProductListingDetails.IncludeStockPhotoURL               = true;
            item.ProductListingDetails.UseStockPhotoURLAsGallery          = true;
            item.ProductListingDetails.UseStockPhotoURLAsGallerySpecified = true;

            //If multiple prod matches found, list the item with the 1st product's information
            item.ProductListingDetails.UseFirstProduct = true;
            // List the item even if no product match found
            item.ProductListingDetails.ListIfNoProduct = true;

            //Add pictures
            item.PictureDetails = new PictureDetailsType();

            //Specify GalleryType
            item.PictureDetails.GalleryType          = GalleryTypeCodeType.None;
            item.PictureDetails.GalleryTypeSpecified = true;

            AddFPItemCall.Item = item;

            //set the item and make the call
            AddFPItemCall.Execute();

            Console.WriteLine(AddFPItemCall.ApiResponse.Ack + " " + AddFPItemCall.ApiResponse.ItemID);
        }
Beispiel #29
0
        private ShippingDetailsType getShippingDetails()
        {
            ShippingDetailsType sd = new ShippingDetailsType();
            AmountType at = new AmountType();
            sd.PaymentInstructions = eBayLister.UserSettings.Default.paymentInstructions;
            sd.ShippingType = ShippingTypeCodeType.Flat;

            ShippingServiceOptionsType st1 = new ShippingServiceOptionsType();
            st1.ShippingService = ShippingServiceCodeType.IN_Express.ToString();

            at = new AmountType();
            at.currencyID = CurrencyCodeType.INR;
            at.Value = Convert.ToDouble(eBayLister.UserSettings.Default.shippingCost) *
                                        Convert.ToDouble(eBayLister.UserSettings.Default.ConversionRate);
            st1.ShippingServiceCost = at;
            ShippingServiceOptionsTypeCollection serviceOptions = new ShippingServiceOptionsTypeCollection();
            serviceOptions.Add(st1);
            sd.ShippingServiceOptions = serviceOptions;
            return sd;
        }
Beispiel #30
0
		//set shipping information
		private ShippingDetailsType getShippingDetails()
		{
			// Shipping details.
			ShippingDetailsType sd = new ShippingDetailsType();
			SalesTaxType salesTax = new SalesTaxType();
			salesTax.SalesTaxPercent=0.0825f;
			salesTax.SalesTaxState="CA";
			sd.ApplyShippingDiscount=true;
			AmountType at =new AmountType();
			at.Value=2.8;
			at.currencyID=CurrencyCodeType.USD;
			sd.InsuranceFee=at;
			sd.InsuranceOption=InsuranceOptionCodeType.Optional;
			sd.PaymentInstructions="eBay DotNet SDK test instruction.";

			// Set calculated shipping.
			sd.ShippingType=ShippingTypeCodeType.Flat;
			//
			ShippingServiceOptionsType st1 = new ShippingServiceOptionsType();
			st1.ShippingService=ShippingServiceCodeType.ShippingMethodStandard.ToString();
			at = new AmountType();
			at.Value=2.0;
			at.currencyID=CurrencyCodeType.USD;
			st1.ShippingServiceAdditionalCost=at;
			at = new AmountType();
			at.Value=1.0;
			at.currencyID=CurrencyCodeType.USD;
			st1.ShippingServiceCost=at;
			st1.ShippingServicePriority=1;
			at = new AmountType();
			at.Value=1.0;
			at.currencyID=CurrencyCodeType.USD;
			st1.ShippingInsuranceCost=at;

			ShippingServiceOptionsType st2 = new ShippingServiceOptionsType();
			st2.ExpeditedService=true;
			st2.ShippingService=ShippingServiceCodeType.ShippingMethodExpress.ToString();
			at = new AmountType();
			at.Value=2.0;
			at.currencyID=CurrencyCodeType.USD;
			st2.ShippingServiceAdditionalCost=at;
			at = new AmountType();
			at.Value=1.0;
			at.currencyID=CurrencyCodeType.USD;
			st2.ShippingServiceCost=at;
			st2.ShippingServicePriority=2;
			at = new AmountType();
			at.Value=1.0;
			at.currencyID=CurrencyCodeType.USD;
			st2.ShippingInsuranceCost=at;

			sd.ShippingServiceOptions=new ShippingServiceOptionsTypeCollection(new ShippingServiceOptionsType[]{st1, st2});

			return sd;
		}
Beispiel #31
0
        private void BtnAddOrder_Click(object sender, System.EventArgs e)
        {
            try
            {
                TxtOrderId.Text = "";

                AddOrderCall apicall = new AddOrderCall(Context);


                OrderType order = new OrderType();
                order.TransactionArray = new TransactionTypeCollection();
                order.ShippingDetails  = new ShippingDetailsType();
                order.PaymentMethods   = new BuyerPaymentMethodCodeTypeCollection();

                TransactionType tr1 = new TransactionType();
                tr1.Item          = new ItemType();
                tr1.Item.ItemID   = TxtItemIdOne.Text;
                tr1.TransactionID = TxtTransactionIdOne.Text;
                order.TransactionArray.Add(tr1);

                TransactionType tr2 = new TransactionType();
                tr2.Item          = new ItemType();
                tr2.Item.ItemID   = TxtItemIdTwo.Text;
                tr2.TransactionID = TxtTransactionIdTwo.Text;
                order.TransactionArray.Add(tr2);

                order.ShippingDetails.PaymentInstructions = TxtPaymentInstructions.Text;
                ShippingServiceOptionsType shpopt = new ShippingServiceOptionsType();
                shpopt.ShippingService         = CboShipSvc.SelectedItem.ToString();
                shpopt.ShippingServicePriority = 1;

                order.ShippingDetails.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection();
                shpopt.ShippingServiceCost            = new AmountType();
                shpopt.ShippingServiceCost.currencyID = CurrencyUtility.GetDefaultCurrencyCodeType(Context.Site);

                if (TxtShipCost.Text.Length > 0)
                {
                    shpopt.ShippingServiceCost.Value = Convert.ToDouble(TxtShipCost.Text);
                }
                order.ShippingDetails.ShippingServiceOptions.Add(shpopt);

                order.Total            = new AmountType();
                order.Total.currencyID = CurrencyUtility.GetDefaultCurrencyCodeType(Context.Site);
                if (TxtTotal.Text.Length > 0)
                {
                    order.Total.Value = Convert.ToDouble(TxtTotal.Text);
                }
                order.CreatingUserRole = (TradingRoleCodeType)Enum.Parse(typeof(TradingRoleCodeType), CboRole.SelectedItem.ToString());

                order.PaymentMethods.AddRange(new BuyerPaymentMethodCodeType[] { BuyerPaymentMethodCodeType.PaymentSeeDescription });

                string orderid = apicall.AddOrder(order);


                TxtOrderId.Text = orderid;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #32
0
        private void BtnAddOrder_Click(object sender, System.EventArgs e)
        {
            try
            {
                TxtOrderId.Text = "";

                AddOrderCall apicall = new AddOrderCall(Context);

                OrderType order = new OrderType();
                order.TransactionArray = new TransactionTypeCollection();
                order.ShippingDetails = new ShippingDetailsType();
                order.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection();

                TransactionType tr1 = new TransactionType();
                tr1.Item = new ItemType();
                tr1.Item.ItemID = TxtItemIdOne.Text;
                tr1.TransactionID = TxtTransactionIdOne.Text;
                order.TransactionArray.Add(tr1);

                TransactionType tr2 = new TransactionType();
                tr2.Item = new ItemType();
                tr2.Item.ItemID = TxtItemIdTwo.Text;
                tr2.TransactionID = TxtTransactionIdTwo.Text;
                order.TransactionArray.Add(tr2);

                order.ShippingDetails.PaymentInstructions = TxtPaymentInstructions.Text;
                ShippingServiceOptionsType shpopt = new ShippingServiceOptionsType();
                shpopt.ShippingService = CboShipSvc.SelectedItem.ToString();
                shpopt.ShippingServicePriority = 1;

                order.ShippingDetails.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection();
                shpopt.ShippingServiceCost = new AmountType();
                shpopt.ShippingServiceCost.currencyID = CurrencyUtility.GetDefaultCurrencyCodeType(Context.Site);

                if (TxtShipCost.Text.Length > 0)
                {
                    shpopt.ShippingServiceCost.Value = Convert.ToDouble(TxtShipCost.Text);
                }
                order.ShippingDetails.ShippingServiceOptions.Add(shpopt);

                order.Total = new AmountType();
                order.Total.currencyID = CurrencyUtility.GetDefaultCurrencyCodeType(Context.Site);
                if (TxtTotal.Text.Length > 0)
                    order.Total.Value = Convert.ToDouble(TxtTotal.Text);
                order.CreatingUserRole = (TradingRoleCodeType) Enum.Parse(typeof(TradingRoleCodeType), CboRole.SelectedItem.ToString());

                order.PaymentMethods.AddRange(new BuyerPaymentMethodCodeType[] {BuyerPaymentMethodCodeType.PaymentSeeDescription});

                string orderid = apicall.AddOrder(order);

                TxtOrderId.Text = orderid;

            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #33
0
        private void AddItem()
        {
            AddFixedPriceItemRequestType req = new AddFixedPriceItemRequestType();
            req.Version = "927";
            ItemType item = new ItemType
            {
                ConditionID = 1000,
                ConditionIDSpecified = true,
                Country = CountryCodeType.US,
                Currency = CurrencyCodeType.USD,
                PostalCode = "10007",
                Location = "New York, NY",
                LocalListingSpecified = true,
                InventoryTrackingMethod = InventoryTrackingMethodCodeType.SKU,
                //SKU = "PROD1234",
                Description = "Pokemon Door Handle - gotta open em all",
                Title = "Pokemon stuffs",
                SubTitle = "Test Item",
                ListingDuration = "Days_7",
                PaymentMethods = new BuyerPaymentMethodCodeType[1],
                DispatchTimeMax = 3,
                DispatchTimeMaxSpecified = true,
                Site = SiteCodeType.US,
                SiteSpecified = true
            };
            //set the item condition depending on the value from GetCategoryFeatures
            //new

            //Basic properties of a listing

            //Track item by SKU#

            item.StartPrice = new AmountType() {  currencyID = CurrencyCodeType.USD, Value = 20.00};

            BuyerPaymentMethodCodeType[] payments = new BuyerPaymentMethodCodeType[1];
            payments[0] = BuyerPaymentMethodCodeType.PayPal;
            item.PaymentMethods = payments;
            item.PayPalEmailAddress = "*****@*****.**";

            item.Country = CountryCodeType.US;
            item.CountrySpecified = true;
            item.Currency = CurrencyCodeType.USD;
            item.CurrencySpecified = true;

            //Specify Shipping Services
            item.DispatchTimeMax = 3;
            item.ShippingDetails = new ShippingDetailsType();
            ShippingServiceOptionsType[] shipping = new ShippingServiceOptionsType[2];
            shipping[0] = new ShippingServiceOptionsType();
            item.ShippingDetails.ShippingServiceOptions =shipping;

            ShippingServiceOptionsType shipservice1 = new ShippingServiceOptionsType();
            shipservice1.ShippingService = "ShippingMethodStandard";
            shipservice1.ShippingServicePriority = 1;
            shipservice1.ShippingServiceCost = new AmountType();
            shipservice1.ShippingServiceCost.currencyID = CurrencyCodeType.USD;
            shipservice1.ShippingServiceCost.Value = 1.0;
            shipservice1.ShippingTimeMin = 2;
            shipservice1.ShippingTimeMinSpecified = true;

            shipservice1.ShippingServiceAdditionalCost = new AmountType();
            shipservice1.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.USD;
            shipservice1.ShippingServiceAdditionalCost.Value = 1.0;

            item.ShippingDetails.ShippingServiceOptions[0] = shipservice1;

            ShippingServiceOptionsType shipservice2 = new ShippingServiceOptionsType();
            shipservice2.ShippingService = "AU_Express";
            shipservice2.ShippingServicePriority = 2;
            shipservice2.ShippingServiceCost = new AmountType();
            shipservice2.ShippingServiceCost.currencyID = CurrencyCodeType.USD;
            shipservice2.ShippingServiceCost.Value = 4.0;

            shipservice2.ShippingServiceAdditionalCost = new AmountType();
            shipservice2.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.USD;
            shipservice2.ShippingServiceAdditionalCost.Value = 1.0;

            //item.ShippingDetails.ShippingServiceOptions[1] = shipservice2;

            //Specify Return Policy
            item.ReturnPolicy = new ReturnPolicyType();
            item.ReturnPolicy.ReturnsAcceptedOption = "ReturnsAccepted";

            item.Quantity = 10;
            item.StartPrice = new AmountType();
            item.StartPrice.currencyID = CurrencyCodeType.USD;
            item.StartPrice.Value = 10.00;

            item.PrimaryCategory = new CategoryType();
            item.PrimaryCategory.CategoryID = "156955";

            item.ProductListingDetails = new ProductListingDetailsType();

            //Specifying UPC as the product identifier. Other applicable product identifiers
            //include ISBN, EAN, Brand-MPN.

            item.ProductListingDetails.UPC = "753759090913";

            //If multiple product identifiers are specified, eBay uses the first one that
            //matches a product in eBay's catalog system.
            item.ProductListingDetails.BrandMPN = new BrandMPNType();
            item.ProductListingDetails.BrandMPN.Brand = "Marvel";
            item.ProductListingDetails.BrandMPN.MPN = "Unknown";

            //For listing to be pre-filled with product information from the catalog
            item.ProductListingDetails.IncludePrefilledItemInformation = true;

            //Include the eBay stock photo with the listing if available and use it as the gallery picture
            item.ProductListingDetails.IncludeStockPhotoURL = true;
            item.ProductListingDetails.UseStockPhotoURLAsGallery = true;
            item.ProductListingDetails.UseStockPhotoURLAsGallerySpecified = true;

            //If multiple prod matches found, list the item with the 1st product's information
            item.ProductListingDetails.UseFirstProduct = true;
            // List the item even if no product match found
            //item.ProductListingDetails.ListIfNoProduct = true;

            //Add pictures
            item.PictureDetails = new PictureDetailsType();

            //Specify GalleryType
            item.PictureDetails.GalleryType = GalleryTypeCodeType.None;
            item.PictureDetails.GalleryTypeSpecified = true;
            req.Item = item;

            Service.Sales.ProductManagement.AddListing(req);
        }