// startprice = starting price for auctions, selling price for fixeditems public ItemType BuildItem(SiteCodeType site, ListingTypeCodeType listingType, string title, string description, CurrencyCodeType currency, double?buynowPrice, double startPrice, double?reservePrice, string location, CountryCodeType country, int categoryid, int quantity, int?conditionID, ReturnsAccepted returns, string listingDuration, string refund_policy, string return_within, int dispatch_time, string paypal_email) { item = new ItemType(); item.Site = site; // item title item.Title = title; // item description // append powered by tradelr if (description.IndexOf("http://wwww.tradelr.com/Content/img/tradelr.png") == -1) { item.Description = string.Format("{0}<p> </p><p><center><img src='http://wwww.tradelr.com/Content/img/tradelr.png' /><div>powered by <a target='_blank' href='http://www.tradelr.com'>tradelr</a></div></center></p>", description); } else { item.Description = description; } // http://developer.ebay.com/DevZone/xml/docs/Reference/ebay/types/ListingTypeCodeType.html item.ListingType = listingType; // prices item.Currency = currency; item.StartPrice = new AmountType { Value = startPrice, currencyID = currency }; if (buynowPrice.HasValue) { item.BuyItNowPrice = new AmountType { Value = buynowPrice.Value, currencyID = currency }; } if (reservePrice.HasValue) { item.ReservePrice = new AmountType() { Value = reservePrice.Value, currencyID = currency }; } // listing duration item.ListingDuration = listingDuration; // item location and country item.Location = location; item.Country = country; // listing category, Photography Software var category = new CategoryType(); category.CategoryID = categoryid.ToString(); item.PrimaryCategory = category; // item quality item.Quantity = quantity; // payment methods item.PaymentMethods = paymentOptions; // email is required if paypal is used as payment method item.PayPalEmailAddress = paypal_email; // http://developer.ebay.com/devzone/finding/callref/Enums/conditionIdList.html if (conditionID.HasValue) { item.ConditionID = conditionID.Value; } item.DispatchTimeMax = dispatch_time; // return policy var policy = new ReturnPolicyType { ReturnsAcceptedOption = returns.ToString(), ShippingCostPaidByOption = "Buyer" }; if (returns == ReturnsAccepted.ReturnsAccepted) { policy.Refund = refund_policy; policy.ReturnsWithinOption = return_within; } item.ReturnPolicy = policy; return(item); }
// startprice is only for auction listings so it will be null for fixedprice items public void BuildItem(product p, int categoryid, int quantity, int?condition, ReturnsAccepted returns, string duration, string refund_policy, string return_within, bool ebay_includeAddress, long shippingprofile, int dispatch_time, bool autorelist, ListingType listingType, decimal?startPrice, decimal?buynowPrice, decimal?reservePrice) { InitValues(p, 1, sd); ebayProduct.categoryid = categoryid; ebayProduct.quantity = quantity; ebayProduct.condition = condition; ebayProduct.returnPolicy = returns.ToString(); ebayProduct.duration = duration; ebayProduct.refundPolicy = refund_policy; ebayProduct.returnWithin = return_within; ebayProduct.includeAddress = ebay_includeAddress; ebayProduct.profileid = shippingprofile; ebayProduct.dispatchTime = dispatch_time; ebayProduct.listingType = listingType.ToString(); ebayProduct.autorelist = autorelist; ebayProduct.startPrice = startPrice; ebayProduct.buynowPrice = buynowPrice; ebayProduct.reservePrice = reservePrice; service.BuildItem(ebay_site, listingType.ToString().ToEnum <ListingTypeCodeType>(), productname, Description, Currency.code.ToEnum <CurrencyCodeType>(), buynowPrice.HasValue ? (double)buynowPrice.Value : (double?)null, (double)(startPrice.HasValue ? startPrice.Value : SellingPrice), reservePrice.HasValue ? (double)reservePrice.Value : (double?)null, Country.name, Country.code.ToEnum <CountryCodeType>(), categoryid, quantity, condition, returns, duration, refund_policy, return_within, dispatch_time, sd.GetPaypalID()); PaypalID = sd.GetPaypalID(); // add address if (ebay_includeAddress) { var o = sd.organisation; service.AddSellerContactDetails(o.city.HasValue ? o.MASTERcity.name : "", o.name, Country.GetCountry(o.country.Value).code.ToEnum <CountryCodeType>(), o.address, o.phone, o.postcode, o.state.ToStateName(o.country.HasValue ? o.country.Value.ToString() : "")); } // add photos AddProductPhotos(p); // add variants (if any) AddProductVariants(p); // add shipping methods AddShippingDetails(p, shippingprofile); // add payment methods foreach (var entry in sd.paymentMethods) { var method = entry.method.ToEnum <PaymentMethod>(); AddPaymentOptions(method); } }