Ejemplo n.º 1
0
		private ItemType FillItem()
		{
			BtnGetItem.Visible = false;

			ItemType item = new ItemType();

			// Set UP Defaults
			item.Currency = CurrencyUtility.GetDefaultCurrencyCodeType(Context.Site);
			item.Country = SiteUtility.GetCountryCodeType(Context.Site);

			item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection();
			item.PaymentMethods.AddRange(new BuyerPaymentMethodCodeType[] {BuyerPaymentMethodCodeType.PayPal});
			item.RegionID = "0";

			// Set specified values from the form
			item.Title = this.TxtTitle.Text;
			item.Description =  this.TxtDescription.Text;
	
			item.Quantity = Int32.Parse(TxtQuantity.Text, NumberStyles.None);
			item.Location = TxtLocation.Text;

			item.ListingDuration = CboDuration.SelectedItem.ToString();


			item.PrimaryCategory = new CategoryType();
			item.PrimaryCategory.CategoryID = this.TxtCategory.Text;;
			if (TxtStartPrice.Text.Length > 0)
			{
				item.StartPrice = new AmountType();
				item.StartPrice.currencyID = item.Currency;
				item.StartPrice.Value = Convert.ToDouble(this.TxtStartPrice.Text);
				
			}

			if (TxtReservePrice.Visible && TxtReservePrice.Text.Length > 0)
			{
				item.ReservePrice = new AmountType();
				item.ReservePrice.currencyID = item.Currency;
				item.ReservePrice.Value = Convert.ToDouble(this.TxtReservePrice.Text);
			}
			if (TxtBuyItNowPrice.Visible && TxtBuyItNowPrice.Text.Length > 0)
			{
				item.BuyItNowPrice = new AmountType();
				item.BuyItNowPrice.currencyID = item.Currency;
				item.BuyItNowPrice.Value = Convert.ToDouble(this.TxtBuyItNowPrice.Text);
			}

			ListingEnhancementsCodeTypeCollection enhancements = new ListingEnhancementsCodeTypeCollection();
			if (this.ChkBoldTitle.Checked)
				enhancements.Add(ListingEnhancementsCodeType.BoldTitle);
			if (this.ChkHighLight.Checked)
				enhancements.Add(ListingEnhancementsCodeType.Highlight);
				
			if (enhancements.Count > 0)
				item.ListingEnhancement = enhancements;

			item.ListingType = (ListingTypeCodeType)Enum.Parse(typeof(ListingTypeCodeType), CboListType.SelectedItem.ToString());

			if (ChkEnableBestOffer.Visible)
			{
				item.BestOfferDetails = new BestOfferDetailsType();
				item.BestOfferDetails.BestOfferEnabled = ChkEnableBestOffer.Checked;
			}

			if (TxtCategory2.Text.Length > 0)
			{
				item.SecondaryCategory = new CategoryType();
				item.SecondaryCategory.CategoryID = TxtCategory2.Text;
			}

			if (TxtPayPalEmailAddress.Text.Length > 0)
				item.PayPalEmailAddress = TxtPayPalEmailAddress.Text;

			if (TxtApplicationData.Text.Length > 0)
				item.ApplicationData = TxtApplicationData.Text;

            int condition = ((ComboxItem)CboCondition.SelectedItem).Value;
            item.ConditionID = condition;

			//add shipping information
			item.ShippingDetails=getShippingDetails();
			//add handling time
			item.DispatchTimeMax=1;
			//add policy
			item.ReturnPolicy=GetPolicyForUS();
	
			return item;
				
		}
Ejemplo n.º 2
0
        protected void BtnAddItem_Click(object sender, System.EventArgs e)
        {
            try
            {
                AttributesMaster attrMaster = (AttributesMaster)Session[Global.ATTRIBUTES_MASTER];

                //
                ApiContext asn = (ApiContext)Session[Global.APISESSION];
                AddItemCall api = new AddItemCall(asn);

                // Create the item
                ItemType item = new ItemType();

                item.Site = (SiteCodeType)Session[Global.SITE];
                item.Country = CountryCodeType.US;

                item.ListingType = (ListingTypeCodeType)Enum.Parse(typeof(ListingTypeCodeType),this.ddlListingType.SelectedValue.ToString());
                if(item.ListingType.Equals(ListingTypeCodeType.LeadGeneration))
                {
                    item.ListingSubtype2=ListingSubtypeCodeType.ClassifiedAd;
                }
                item.Title = this.ItemTitle.Text;
                item.Description = this.Description.Text;
                item.Currency = Global.GetCurrencyType(item.Site);

                if(this.StartPrice.Text!=string.Empty)
                {
                    item.StartPrice = new AmountType();
                    item.StartPrice.currencyID = item.Currency;
                    item.StartPrice.Value = Convert.ToDouble(this.StartPrice.Text);
                }

                if(this.BuyItNowPrice.Text!=string.Empty)
                {
                    item.BuyItNowPrice = new AmountType();
                    item.BuyItNowPrice.currencyID = item.Currency;
                    item.BuyItNowPrice.Value = Convert.ToDouble(this.BuyItNowPrice.Text);
                }

                item.Quantity = Int32.Parse(this.Quantity.Text);

                item.Location = this.ItemLocation.Text;
                item.ListingDuration = this.ItemDuration.SelectedItem.Value;

                ListingEnhancementsCodeTypeCollection enhancements = new ListingEnhancementsCodeTypeCollection();
                enhancements.Add(ListingEnhancementsCodeType.BoldTitle);
                item.ListingEnhancement = enhancements;

                // Set Attributes property.
                int catID = (int)Session["CategoryId"];
                item.PrimaryCategory = new CategoryType();
                item.PrimaryCategory.CategoryID = catID.ToString();

                catID = (int)Session["Category2Id"];
                if( catID != 0 )
                {
                    item.SecondaryCategory = new CategoryType();
                    item.SecondaryCategory.CategoryID = catID.ToString();
                }

                IAttributeSetCollection itemAttributes=null;
                if(Session[Global.ITEM_ATTR_SETS]!=null)
                {
                    itemAttributes = (IAttributeSetCollection)Session[Global.ITEM_ATTR_SETS];
                    item.AttributeSetArray = attrMaster.ConvertAttributeSetArray(itemAttributes);
                }
                if (Session[Global.CUSTOME_ITEM_SPECIFIC]!=null)
                {
                    item.ItemSpecifics=(NameValueListTypeCollection)Session[Global.CUSTOME_ITEM_SPECIFIC];
                }

                // Motor
                if( this.MotorSubtitle.Text.Length > 0 )
                {
                    MotorAttributeHelper mh = new MotorAttributeHelper(item.AttributeSetArray[0]);
                    mh.Subtitle = this.MotorSubtitle.Text;
                    if( this.MotorDepositAmount.Text.Length > 0 )
                        mh.DepositAmount = Decimal.Parse(this.MotorDepositAmount.Text);
                }

                if(ddlShippingServiceDetails.SelectedItem.Value != "None")
                {
                    //add shipping information
                    item.ShippingDetails=getShippingDetails(ddlShippingServiceDetails.SelectedItem.Value);
                }
                //add handling time
                item.DispatchTimeMax=1;
                //add return policy
                if(ltlReturnPolicyEnalbed.Text!=string.Empty&&ltlReturnPolicyEnalbed.Text==RETURN_POLICY_ENABLE)
                {
                    item.ReturnPolicy=getReturnPolicy();
                }

                //get shipping locations
                item.ShipToLocations=getShppingLocations();
                //set payments
                setPaymentMethods(item);

                FeeTypeCollection fees = api.AddItem(item);

                viewItemInfo(item);
            }
            catch(Exception ex)
            {
                this.StatusText.Text = ex.Message;
                this.StatusText.Visible = true;
            }
        }
Ejemplo n.º 3
0
        //list to eBay
        private void addItem()
        {
            try
            {
                //
                ApiContext  apiContext = this.controller.ApiContext;
                AddItemCall api        = new AddItemCall(apiContext);

                // Create the item
                ItemType item = new ItemType();

                item.Site    = apiContext.Site;
                item.Country = CountryCodeType.US;

                item.ListingType = (ListingTypeCodeType)Enum.Parse(typeof(ListingTypeCodeType), (this.listingTypeComboBox.SelectedItem as ListItem).Value);
                if (item.ListingType.Equals(ListingTypeCodeType.LeadGeneration))
                {
                    item.ListingSubtype2 = ListingSubtypeCodeType.ClassifiedAd;
                }
                item.Title       = this.titleTextBox.Text;
                item.Description = this.descriptionTextBox.Text;
                item.Currency    = this.getCurrencyType(item.Site);

                if (this.startPriceTextBox.Text != string.Empty)
                {
                    item.StartPrice            = new AmountType();
                    item.StartPrice.currencyID = item.Currency;
                    item.StartPrice.Value      = Convert.ToDouble(this.startPriceTextBox.Text);
                }

                if (this.binTextBox.Text != string.Empty)
                {
                    item.BuyItNowPrice            = new AmountType();
                    item.BuyItNowPrice.currencyID = item.Currency;
                    item.BuyItNowPrice.Value      = Convert.ToDouble(this.binTextBox.Text);
                }

                item.Quantity = Int32.Parse(this.quantityTextBox.Text);

                item.Location        = this.locationTextBox.Text;
                item.ListingDuration = (this.durationComboBox.SelectedItem as ListItem).Value;

                ListingEnhancementsCodeTypeCollection enhancements = new ListingEnhancementsCodeTypeCollection();
                enhancements.Add(ListingEnhancementsCodeType.BoldTitle);
                item.ListingEnhancement = enhancements;


                // Set Item Condtion
                ConditionEnabledCodeType condition = this.controller.CategoryFacade.ConditionEnabled;
                if (condition == ConditionEnabledCodeType.Enabled ||
                    condition == ConditionEnabledCodeType.Required)
                {
                    ListItem li          = this.conditionComboBox.SelectedItem as ListItem;
                    int      conditionId = int.Parse(li.Value);
                    item.ConditionID = conditionId;
                }

                // Set Attributes property.
                item.PrimaryCategory            = new CategoryType();
                item.PrimaryCategory.CategoryID = this.controller.CategoryFacade.CategoryID;

                if (this.controller.CategoryFacade.ItemSpecificEnabled == ItemSpecificsEnabledCodeType.Enabled &&
                    this.controller.CategoryFacade.ItemSpecificsCache != null)
                {
                    item.ItemSpecifics = this.controller.CategoryFacade.ItemSpecificsCache;
                }

                // Motor
                if (this.controller.ApiContext.Site == SiteCodeType.eBayMotors &&
                    this.subTitleTextBox.Text.Length > 0)
                {
                    MotorAttributeHelper mh = new MotorAttributeHelper(item.AttributeSetArray[0]);
                    mh.Subtitle = this.subTitleTextBox.Text;
                    if (this.depositAmountTextBox.Text.Length > 0)
                    {
                        mh.DepositAmount = Decimal.Parse(this.depositAmountTextBox.Text);
                    }
                }

                if ((this.shippingServiceComboBox.SelectedItem as ListItem).Value != "None")
                {
                    //add shipping information
                    item.ShippingDetails = getShippingDetails((this.shippingServiceComboBox.SelectedItem as ListItem).Value);
                }

                //add handling time
                item.DispatchTimeMax = 1;

                SellerProfilesType sellerProfile = new SellerProfilesType();
                //add return policy
                if (this.controller.CategoryFacade.ReturnPolicyEnabled)
                {
                    if (this.controller.CategoryFacade.ReturnPolicyProfileCache != null)
                    {
                        sellerProfile.SellerReturnProfile = this.controller.CategoryFacade.ReturnPolicyProfileCache;
                    }
                    else if (this.controller.CategoryFacade.ReturnPolicyCache != null)
                    {
                        item.ReturnPolicy = this.controller.CategoryFacade.ReturnPolicyCache;
                    }
                }
                if (paymentProfileIdTextBox.Text != "" || paymentProfileNameTextBox.Text != "")
                {
                    sellerProfile.SellerPaymentProfile = new SellerPaymentProfileType();
                    if (this.paymentProfileIdTextBox.Text != "")
                    {
                        sellerProfile.SellerPaymentProfile.PaymentProfileID          = Int64.Parse(paymentProfileIdTextBox.Text);
                        sellerProfile.SellerPaymentProfile.PaymentProfileIDSpecified = true;
                    }
                    sellerProfile.SellerPaymentProfile.PaymentProfileName = paymentProfileNameTextBox.Text;
                }
                if (shippingProfileIdTextBox.Text != "" || shippingProfileNameTextBox.Text != "")
                {
                    sellerProfile.SellerShippingProfile = new SellerShippingProfileType();
                    if (this.shippingProfileIdTextBox.Text != "")
                    {
                        sellerProfile.SellerShippingProfile.ShippingProfileID          = Int64.Parse(shippingProfileIdTextBox.Text);
                        sellerProfile.SellerShippingProfile.ShippingProfileIDSpecified = true;
                    }
                    sellerProfile.SellerShippingProfile.ShippingProfileName = shippingProfileNameTextBox.Text;
                }

                //get shipping locations
                item.ShipToLocations = getShppingLocations();
                //set payments
                setPaymentMethods(item);
                // set seller profiles
                item.SellerProfiles = sellerProfile;

                FeeTypeCollection fees = api.AddItem(item);

                viewItemInfo(item);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 4
0
        //list to eBay
        private void addItem()
        {

            try
            {
                //
                ApiContext apiContext = this.controller.ApiContext;
                AddItemCall api = new AddItemCall(apiContext);

                // Create the item
                ItemType item = new ItemType();

                item.Site = apiContext.Site;
                item.Country = CountryCodeType.US;

                item.ListingType = (ListingTypeCodeType)Enum.Parse(typeof(ListingTypeCodeType), (this.listingTypeComboBox.SelectedItem as ListItem).Value);
                if (item.ListingType.Equals(ListingTypeCodeType.LeadGeneration))
                {
                    item.ListingSubtype2 = ListingSubtypeCodeType.ClassifiedAd;
                }
                item.Title = this.titleTextBox.Text;
                item.Description = this.descriptionTextBox.Text;
                item.Currency = this.getCurrencyType(item.Site);

                if (this.startPriceTextBox.Text != string.Empty)
                {
                    item.StartPrice = new AmountType();
                    item.StartPrice.currencyID = item.Currency;
                    item.StartPrice.Value = Convert.ToDouble(this.startPriceTextBox.Text);
                }

                if (this.binTextBox.Text != string.Empty)
                {
                    item.BuyItNowPrice = new AmountType();
                    item.BuyItNowPrice.currencyID = item.Currency;
                    item.BuyItNowPrice.Value = Convert.ToDouble(this.binTextBox.Text);
                }

                item.Quantity = Int32.Parse(this.quantityTextBox.Text);

                item.Location = this.locationTextBox.Text;
                item.ListingDuration = (this.durationComboBox.SelectedItem as ListItem).Value;

                ListingEnhancementsCodeTypeCollection enhancements = new ListingEnhancementsCodeTypeCollection();
                enhancements.Add(ListingEnhancementsCodeType.BoldTitle);
                item.ListingEnhancement = enhancements;


                // Set Item Condtion
                ConditionEnabledCodeType condition = this.controller.CategoryFacade.ConditionEnabled;
                if (condition == ConditionEnabledCodeType.Enabled ||
                    condition == ConditionEnabledCodeType.Required)
                {
                    ListItem li = this.conditionComboBox.SelectedItem as ListItem;
                    int conditionId = int.Parse(li.Value);
                    item.ConditionID = conditionId;
                }

                // Set Attributes property.
                item.PrimaryCategory = new CategoryType();
                item.PrimaryCategory.CategoryID = this.controller.CategoryFacade.CategoryID;
                
                if (this.controller.CategoryFacade.ItemSpecificEnabled == ItemSpecificsEnabledCodeType.Enabled &&
                    this.controller.CategoryFacade.ItemSpecificsCache != null)
                {
                    item.ItemSpecifics = this.controller.CategoryFacade.ItemSpecificsCache;
                }

                // Motor
                if (this.controller.ApiContext.Site == SiteCodeType.eBayMotors &&
                    this.subTitleTextBox.Text.Length > 0)
                {
                    MotorAttributeHelper mh = new MotorAttributeHelper(item.AttributeSetArray[0]);
                    mh.Subtitle = this.subTitleTextBox.Text;
                    if (this.depositAmountTextBox.Text.Length > 0)
                        mh.DepositAmount = Decimal.Parse(this.depositAmountTextBox.Text);
                }

                if ((this.shippingServiceComboBox.SelectedItem as ListItem).Value != "None")
                {
                    //add shipping information
                    item.ShippingDetails = getShippingDetails((this.shippingServiceComboBox.SelectedItem as ListItem).Value);
                }

                //add handling time
                item.DispatchTimeMax = 1;

                SellerProfilesType sellerProfile = new SellerProfilesType();
                //add return policy
                if (this.controller.CategoryFacade.ReturnPolicyEnabled)
                {
                    if (this.controller.CategoryFacade.ReturnPolicyProfileCache != null)
                    {
                        sellerProfile.SellerReturnProfile = this.controller.CategoryFacade.ReturnPolicyProfileCache;
                    }
                    else if (this.controller.CategoryFacade.ReturnPolicyCache != null)
                    {
                        item.ReturnPolicy = this.controller.CategoryFacade.ReturnPolicyCache;
                    }
                }
                if (paymentProfileIdTextBox.Text != "" || paymentProfileNameTextBox.Text != "")
                {
                    sellerProfile.SellerPaymentProfile = new SellerPaymentProfileType();
                    if (this.paymentProfileIdTextBox.Text != "")
                    {
                        sellerProfile.SellerPaymentProfile.PaymentProfileID = Int64.Parse(paymentProfileIdTextBox.Text);
                        sellerProfile.SellerPaymentProfile.PaymentProfileIDSpecified = true;
                    }
                    sellerProfile.SellerPaymentProfile.PaymentProfileName = paymentProfileNameTextBox.Text;
                }
                if (shippingProfileIdTextBox.Text != "" || shippingProfileNameTextBox.Text != "")
                {
                    sellerProfile.SellerShippingProfile = new SellerShippingProfileType();
                    if (this.shippingProfileIdTextBox.Text != "")
                    {
                        sellerProfile.SellerShippingProfile.ShippingProfileID = Int64.Parse(shippingProfileIdTextBox.Text);
                        sellerProfile.SellerShippingProfile.ShippingProfileIDSpecified = true;
                    }
                    sellerProfile.SellerShippingProfile.ShippingProfileName = shippingProfileNameTextBox.Text;
                }

                //get shipping locations
                item.ShipToLocations = getShppingLocations();
                //set payments
                setPaymentMethods(item);
                // set seller profiles
                item.SellerProfiles = sellerProfile;

                FeeTypeCollection fees = api.AddItem(item);

                viewItemInfo(item);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

        }
Ejemplo n.º 5
0
        private ItemType FillItem()
        {
            BtnGetItem.Visible = false;

            ItemType item = new ItemType();

            // Set UP Defaults
            item.Currency = CurrencyUtility.GetDefaultCurrencyCodeType(Context.Site);
            item.Country  = SiteUtility.GetCountryCodeType(Context.Site);

            item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection();
            item.PaymentMethods.AddRange(new BuyerPaymentMethodCodeType[] { BuyerPaymentMethodCodeType.PayPal });
            item.RegionID = "0";

            // Set specified values from the form
            item.Title       = this.TxtTitle.Text;
            item.Description = this.TxtDescription.Text;

            item.Quantity = Int32.Parse(TxtQuantity.Text, NumberStyles.None);
            item.Location = TxtLocation.Text;

            item.ListingDuration = CboDuration.SelectedItem.ToString();


            item.PrimaryCategory            = new CategoryType();
            item.PrimaryCategory.CategoryID = this.TxtCategory.Text;;
            if (TxtStartPrice.Text.Length > 0)
            {
                item.StartPrice            = new AmountType();
                item.StartPrice.currencyID = item.Currency;
                item.StartPrice.Value      = Convert.ToDouble(this.TxtStartPrice.Text);
            }

            if (TxtReservePrice.Visible && TxtReservePrice.Text.Length > 0)
            {
                item.ReservePrice            = new AmountType();
                item.ReservePrice.currencyID = item.Currency;
                item.ReservePrice.Value      = Convert.ToDouble(this.TxtReservePrice.Text);
            }
            if (TxtBuyItNowPrice.Visible && TxtBuyItNowPrice.Text.Length > 0)
            {
                item.BuyItNowPrice            = new AmountType();
                item.BuyItNowPrice.currencyID = item.Currency;
                item.BuyItNowPrice.Value      = Convert.ToDouble(this.TxtBuyItNowPrice.Text);
            }

            ListingEnhancementsCodeTypeCollection enhancements = new ListingEnhancementsCodeTypeCollection();

            if (this.ChkBoldTitle.Checked)
            {
                enhancements.Add(ListingEnhancementsCodeType.BoldTitle);
            }
            if (this.ChkHighLight.Checked)
            {
                enhancements.Add(ListingEnhancementsCodeType.Highlight);
            }

            if (enhancements.Count > 0)
            {
                item.ListingEnhancement = enhancements;
            }

            item.ListingType = (ListingTypeCodeType)Enum.Parse(typeof(ListingTypeCodeType), CboListType.SelectedItem.ToString());

            if (ChkEnableBestOffer.Visible)
            {
                item.BestOfferDetails = new BestOfferDetailsType();
                item.BestOfferDetails.BestOfferEnabled = ChkEnableBestOffer.Checked;
            }

            if (TxtCategory2.Text.Length > 0)
            {
                item.SecondaryCategory            = new CategoryType();
                item.SecondaryCategory.CategoryID = TxtCategory2.Text;
            }

            if (TxtPayPalEmailAddress.Text.Length > 0)
            {
                item.PayPalEmailAddress = TxtPayPalEmailAddress.Text;
            }

            if (TxtApplicationData.Text.Length > 0)
            {
                item.ApplicationData = TxtApplicationData.Text;
            }

            int condition = ((ComboxItem)CboCondition.SelectedItem).Value;

            item.ConditionID = condition;

            //add shipping information
            item.ShippingDetails = getShippingDetails();
            //add handling time
            item.DispatchTimeMax = 1;
            //add policy
            item.ReturnPolicy = GetPolicyForUS();

            return(item);
        }
Ejemplo n.º 6
0
        public static ItemType CreateItemType(MarketplaceProductFeedDto productFeed, string eBayDescriptionTemplate)
        {
            try
            {
                var item = new ItemType();

                // set-up the defaults
                item.Currency          = CurrencyCodeType.USD;
                item.CurrencySpecified = true;
                item.Country           = CountryCodeType.US;
                item.CountrySpecified  = true;

                item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection();
                item.PaymentMethods.AddRange(new BuyerPaymentMethodCodeType[] { BuyerPaymentMethodCodeType.PayPal });
                item.PayPalEmailAddress = _payPalEmailAddress;
                item.AutoPay            = productFeed.eBayProductFeed.IsRequireAutoPayment;
                item.RegionID           = "0";

                // set the specified values from the passed objects
                item.SKU   = productFeed.EisSKU;
                item.Title = productFeed.eBayProductFeed.Title;
                item.InventoryTrackingMethod          = InventoryTrackingMethodCodeType.SKU;
                item.InventoryTrackingMethodSpecified = true;

                // init the item description from the template
                if (!string.IsNullOrEmpty(eBayDescriptionTemplate))
                {
                    item.Description = getParsedeBayDescriptionTemplate(productFeed, eBayDescriptionTemplate);
                }
                else
                {
                    item.Description = productFeed.eBayProductFeed.Description;
                }

                if (!string.IsNullOrEmpty(productFeed.eBayProductFeed.SubTitle))
                {
                    item.SubTitle = productFeed.eBayProductFeed.SubTitle;
                }

                // set the product quantity if its more than ZERO
                if (productFeed.eBayInventoryFeed.InventoryQuantity > 0)
                {
                    item.Quantity          = productFeed.eBayInventoryFeed.InventoryQuantity;
                    item.QuantitySpecified = true;
                }

                // set the product's category
                item.PrimaryCategory            = new CategoryType();
                item.PrimaryCategory.CategoryID = productFeed.eBayProductFeed.CategoryId != null
                    ? productFeed.eBayProductFeed.CategoryId.ToString() : productFeed.ProductType.EbaySubCategoryCode;

                // set the product's condion
                item.ConditionID          = productFeed.eBayProductFeed.Condition_; // 1000 - New, 3000 - Used
                item.ConditionIDSpecified = true;
                item.Location             = productFeed.eBayProductFeed.Location;   // should be the postal code

                if (!string.IsNullOrEmpty(productFeed.UPC))
                {
                    item.ProductListingDetails = new ProductListingDetailsType
                    {
                        UPC = productFeed.UPC,
                    };
                }

                // set the listing type for this product
                item.ListingType          = EnumHelper.ParseEnum <ListingTypeCodeType>(productFeed.eBayProductFeed.ListType); // should we explicitly set to FixedPriceItem
                item.ListingTypeSpecified = true;
                item.ListingDuration      = productFeed.eBayProductFeed.Duration;

                // set its start and reserver price for the Auction listing type
                if (productFeed.eBayProductFeed.ListType == ListingTypeCodeType.Auction.ToString())
                {
                    item.StartPrice = new AmountType
                    {
                        currencyID = CurrencyCodeType.USD,
                        Value      = (double)productFeed.eBayInventoryFeed.StartPrice
                    };
                    item.BuyItNowPrice = new AmountType
                    {
                        currencyID = CurrencyCodeType.USD,
                        Value      = (double)productFeed.eBayInventoryFeed.BinPrice
                    };
                    item.ReservePrice = new AmountType
                    {
                        currencyID = CurrencyCodeType.USD,
                        Value      = (double)productFeed.eBayInventoryFeed.ReservePrice
                    };
                }
                else
                {
                    // otherwise,it's a fixed price item, we will use the BinPrice/BuyItNowPrice for its StartPrice
                    item.StartPrice = new AmountType
                    {
                        currencyID = CurrencyCodeType.USD,
                        Value      = (double)productFeed.eBayInventoryFeed.BinPrice
                    };
                }

                // add the product images
                if (productFeed.ImageUrls.Any())
                {
                    // set the picture details type
                    item.PictureDetails             = new PictureDetailsType();
                    item.PictureDetails.GalleryType = GalleryTypeCodeType.None;

                    item.PictureDetails.PictureURL = new StringCollection();
                    for (var index = 0; index < productFeed.ImageUrls.Count; index++)
                    {
                        var imageUrl = productFeed.ImageUrls[index];
#if DEBUG
                        imageUrl = "https://d1wj636tbzfwwf.cloudfront.net/static/images/studios/homepage/stories-brandon-1.jpg";
#endif
                        item.PictureDetails.PictureURL.Add(imageUrl);
                    }
                }

                // add the product enhancements
                var enhancements = new ListingEnhancementsCodeTypeCollection();
                if (productFeed.eBayProductFeed.IsBoldTitle)
                {
                    enhancements.Add(ListingEnhancementsCodeType.BoldTitle);
                }

                if (enhancements.Count > 0)
                {
                    item.ListingEnhancement = enhancements;
                }

                item.DispatchTimeMax = productFeed.eBayProductFeed.DispatchTimeMax;

                // add the item shipping information
                item.ShippingDetails = createShippingDetails(productFeed.eBayProductFeed);

                // add the policy for the item
                item.ReturnPolicy = createPolicyForUS(productFeed.eBayProductFeed);

                return(item);
            }
            catch (Exception)
            {
                return(null);
            }
        }