using System;
using eBay.Service.Call;
using eBay.Service.Core.Sdk;
using eBay.Service.Util;
using eBay.Service.Core.Soap;
namespace Trading_Samples
{
public class Revise
{
static void Main(string[] args)
{
Revise test = new Revise();
test.ReviseInventoryStatus();
}
//ReviseInventoryStatus
private void ReviseInventoryStatus()
{
//create the context
ApiContext context = new ApiContext();
//set the User token
context.ApiCredential.eBayToken = "Your token";
//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 = "673";
context.Site = SiteCodeType.Australia;
ReviseInventoryStatusCall ris = new ReviseInventoryStatusCall(context);
//RIS is a light-weight call that allows you to revise price and/qty of 4 SKUs at a time
ris.InventoryStatuList = new InventoryStatusTypeCollection();
AmountType atUp = new AmountType();
atUp.currencyID = CurrencyCodeType.AUD;
atUp.Value = 75;
AmountType atDown = new AmountType();
atDown.currencyID = CurrencyCodeType.AUD;
atDown.Value = 25;
InventoryStatusType InvStatus1 = new InventoryStatusType();
//Assumption item is listed with InventoryTrackingMethod = SKU. This SKU could be the SKU of a regular fixed price item
//or the SKU of one of the variations of a multi-variations item
InvStatus1.SKU = "1359";
//Revising price and qty
InvStatus1.StartPrice = atDown;
InvStatus1.Quantity = 20;
ris.InventoryStatuList.Add(InvStatus1);
InventoryStatusType InvStatus2 = new InventoryStatusType();
InvStatus2.SKU = "9013";
InvStatus2.StartPrice = atUp;
InvStatus2.Quantity = 20;
ris.InventoryStatuList.Add(InvStatus2);
//Revising price only
InventoryStatusType InvStatus3 = new InventoryStatusType();
InvStatus3.SKU = "1724";
InvStatus3.StartPrice = atDown;
ris.InventoryStatuList.Add(InvStatus3);
//Revising qty only
InventoryStatusType InvStatus4 = new InventoryStatusType();
InvStatus4.SKU = "4539";
InvStatus4.Quantity = 20;
ris.InventoryStatuList.Add(InvStatus4);
ris.Execute();
Console.WriteLine(ris.ApiResponse.Ack);
}
}
}
|