void PonerDisponibleArticulo_click(object sender, EventArgs e) { GridView view = gridViewEbay; int currentRowHandle = view.FocusedRowHandle; MyEntityModel.EBAY_SEGUIMIENTO row = (MyEntityModel.EBAY_SEGUIMIENTO)view.GetRow(currentRowHandle); CredencialesEbay credencialeebay = new CredencialesEbay(); credencialeebay.cuenta = row.VENDEDOR; ItemType item = new ItemType(); ReviseFixedPriceItemCall reviseFP = new ReviseFixedPriceItemCall(credencialeebay.context); item.Quantity = 20; item.ItemID = row.ARTICULO; reviseFP.Item = item; try { reviseFP.Execute(); FuncionesEbay.fnGrabarErrorEbayArticulo(row.ARTICULO, ""); } catch (Exception ex) { FuncionesEbay.fnGrabarErrorEbayArticulo(row.ARTICULO, ex.Message); } Console.WriteLine(reviseFP.ApiResponse.Ack + " Revised SKU " + reviseFP.ItemID); }
public void ReviseFixedPriceItem() { ItemType itemTest = TestData.NewFixedPriceItem; Assert.IsNotNull(itemTest); // ReviseFixedPriceItemCall rviCall = new ReviseFixedPriceItemCall(this.apiContext); ItemType item = new ItemType(); item.ItemID = itemTest.ItemID; item.StartPrice = new AmountType(); item.StartPrice.Value = 2.89; item.StartPrice.currencyID = CurrencyCodeType.USD; rviCall.Item = item; rviCall.Execute(); // Let's wait for the server to "digest" the data. System.Threading.Thread.Sleep(1000); //check whether the call is success. Assert.IsTrue(rviCall.AbstractResponse.Ack == AckCodeType.Success || rviCall.AbstractResponse.Ack == AckCodeType.Warning, "do not success!"); // Call GetItem and then compare the startPrice. GetItemCall getItem = new GetItemCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; getItem.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); ItemType returnedItem = getItem.GetItem(itemTest.ItemID); Assert.AreEqual(returnedItem.StartPrice.Value, item.StartPrice.Value); // Update itemTest. TestData.NewFixedPriceItem = returnedItem; }
public EbayFacade() { InitializeContext(); api2call = new AddFixedPriceItemCall(Context); reviseItemCall = new ReviseFixedPriceItemCall(Context); deleteItemCall = new EndItemCall(Context); }
public bool UpdateProductWeight(string eBayID, string sku, decimal weight) { ReviseFixedPriceItemCall reviseFP = new ReviseFixedPriceItemCall(context); ItemType item = new ItemType(); item.ItemID = eBayID; item.SKU = sku; item.ShippingDetails.CalculatedShippingRate.WeightMajor.Value = weight; reviseFP.Item = item; reviseFP.Execute(); return(reviseFP.ApiResponse.Ack != AckCodeType.Failure); }
public static void UpdateInventory(string accountName, string token, string itemId, int qty, string sku, int isVariation, int soldQty, double startPrice) { ApiContext context = new ApiContext(); context.ApiCredential.eBayToken = token; context.SoapApiServerUrl = "https://api.ebay.com/wsapi"; context.ApiLogManager = new ApiLogManager(); context.ApiLogManager.ApiLoggerList.Add(new FileLogger("log.txt", false, false, false)); context.ApiLogManager.EnableLogging = true; context.Version = "861"; context.Site = SiteCodeType.US; ReviseFixedPriceItemCall reviseFixedPriceItemCall = new ReviseFixedPriceItemCall(context); ItemType item = new ItemType(); try { if (isVariation == 0) { item.ItemID = itemId; item.QuantityAvailable = qty; item.Quantity = qty; //item.StartPrice.Value = startPrice; reviseFixedPriceItemCall.Item = item; reviseFixedPriceItemCall.Execute(); } else { item.ItemID = itemId; VariationType simpleType = new VariationType(); VariationTypeCollection vtc = new VariationTypeCollection(); VariationsType vsType = new VariationsType(); simpleType.SKU = sku; simpleType.Quantity = qty; vtc.Add(simpleType); vsType.Variation = vtc; item.Variations = vsType; reviseFixedPriceItemCall.Item = item; reviseFixedPriceItemCall.Execute(); } } catch (Exception ex) { ExceptionUtility exceptionUtility = new ExceptionUtility(); exceptionUtility.CatchMethod(ex, "UpdateInventoryByReviseFixedPriceItem ", accountName + ":" + itemId + "(" + sku + ")" + " " + ex.Message.ToString(), senderEmail, messageFromPassword, messageToEmail, smtpClient, smtpPortNum); } }
private static void ReviseFixedPriceItem(string itemID, double price) { //create the context ApiContext context = new ApiContext(); //set the User token string token = AppSettingsHelper.Token; context.ApiCredential.eBayToken = token; //set the server url string endpoint = AppSettingsHelper.Endpoint; context.SoapApiServerUrl = endpoint; //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 = "817"; context.Site = SiteCodeType.US; ReviseFixedPriceItemCall reviseFP = new ReviseFixedPriceItemCall(context); ItemType item = new ItemType(); item.ItemID = itemID; //Basic (Title revision) item.StartPrice = new AmountType { Value = price, currencyID = CurrencyCodeType.USD }; reviseFP.Item = item; reviseFP.Execute(); Console.WriteLine(reviseFP.ApiResponse.Ack + " Revised ItemID " + reviseFP.ItemID); }
private void buttonEditVenta_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { decimal precio; var result = XtraInputBox.Show("Nuevo precio:", "Cambiar precio de venta (envío NO incluido)", ebay_seguimiento.PRECIO.ToString()); if (result != "") { try { precio = fnSpreciodprecio(result); ItemType item = new ItemType(); item.ItemID = ebay_seguimiento.ARTICULO; CredencialesEbay credencialeebay = new CredencialesEbay(); credencialeebay.cuenta = ebay_seguimiento.VENDEDOR; ReviseFixedPriceItemCall reviseFP = new ReviseFixedPriceItemCall(credencialeebay.context); item.StartPrice = new AmountType { currencyID = CurrencyCodeType.EUR, Value = (double)precio }; item.ItemID = ebay_seguimiento.ARTICULO; reviseFP.Item = item; try { reviseFP.Execute(); FuncionesEbay.fnGrabarErrorEbayArticulo(ebay_seguimiento.ARTICULO, ""); } catch (Exception ex) { FuncionesEbay.fnGrabarErrorEbayArticulo(ebay_seguimiento.ARTICULO, ex.Message); } Console.WriteLine(reviseFP.ApiResponse.Ack + " Revised SKU " + reviseFP.ItemID); } catch { XtraMessageBox.Show("Error en el precio", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public bool UpdateeBayItem(UpdateeBayItemRequest request) { try { if (string.IsNullOrEmpty(request.SellerID)) { throw new Exception("No Seller ID"); } var apiContext = _eBayAPIContextProvider.GetAPIContextBySellerID(request.SellerID); var reviseFixedPriceItemCall = new ReviseFixedPriceItemCall(apiContext); var deletedFields = new StringCollection(); foreach (var updateItem in request.Items) { try { reviseFixedPriceItemCall.ReviseFixedPriceItem(updateItem, deletedFields); if (reviseFixedPriceItemCall.ApiResponse.Ack == AckCodeType.Failure || reviseFixedPriceItemCall.ApiResponse.Ack == AckCodeType.PartialFailure) { if (reviseFixedPriceItemCall.ApiResponse.Errors != null && reviseFixedPriceItemCall.ApiResponse.Errors.Count > 0) { throw new Exception("SKU: " + updateItem.SKU + " Error Message: " + reviseFixedPriceItemCall.ApiResponse.Errors[0].LongMessage); } } } catch (Exception ex) { LogManager.Instance.Error("Item ID: " + updateItem.ItemID + (updateItem.SKU != null?" SKU: " + updateItem.SKU:"") + " " + ex.ToString()); } } return(true); } catch (Exception ex) { throw ex; } }
public void SubmitSingleProductReviseFeed(MarketplaceProductFeedDto productFeed, string submittedBy) { if (string.IsNullOrEmpty(productFeed.eBayProductFeed.ItemId)) { _logger.LogWarning(LogEntryType.eBayProductRevise, string.Format("Unable to sent product revise feed due no item id found for this product: {0}", productFeed.EisSKU)); return; } try { // set the log file name _context.ApiLogManager.ApiLoggerList.Add(new FileLogger(string.Format(_logDirectory, MethodBase.GetCurrentMethod().Name), false, true, true)); var apiCall = new ReviseFixedPriceItemCall(_context); // build item type var itemType = RequestHelper.CreateItemType(productFeed, _credential.eBayDescriptionTemplate); itemType.ItemID = productFeed.eBayProductFeed.ItemId; // send the request and get the fee collection var fees = apiCall.ReviseFixedPriceItem(itemType, new StringCollection()); var feeContainers = new List <ItemContainer>(); // parse the fees for revising the item if (fees != null) { foreach (FeeType fee in fees) { if (fee.Fee.Value <= 0) { continue; } var container = new ItemContainer { EisSKU = productFeed.EisSKU, ItemId = productFeed.eBayProductFeed.ItemId }; container.Fees.Add(new Fee { Name = fee.Name, Amount = fee.Fee.Value, CurrencyCode = fee.Fee.currencyID.ToString(), ActionFeedType = eBayConstants.ITEM_REVISED }); feeContainers.Add(container); } // insert the fees to database and don't update the product eBay item id logAndUpdateProductItemId(feeContainers, LogEntryType.eBayProductRevise, true); } } catch (Exception ex) { var description = string.Format("Error in submitting single product revise feed for {0} - {3}. \nError Message: {1} \nRequested by: {2}", ChannelName, EisHelper.GetExceptionMessage(ex), submittedBy, productFeed.EisSKU); _logger.Add(LogEntrySeverity.Error, LogEntryType.eBayProductRevise, description, ex.StackTrace); } }