protected override void SetupAccountSettings() { base.SetupAccountSettings(); base.SetupAccountSettings(); Account = AccountEnum.AmzJk529; _sellerId = AccountSettingsConfigSection.Jk529_sellerId.Value; _client = new FBAInventoryServiceMWSClient( AccountSettingsConfigSection.Jk529_accessKey.Value, AccountSettingsConfigSection.Jk529_secretKey.Value, AppName, AppVersion, new FBAInventoryServiceMWSConfig { ServiceURL = AmzServiceUrl }); ; }
public void syn(Shop shop) { if (shop.InventoryQueryStartDateTime == null) { shop.InventoryQueryStartDateTime = AppConstant.inventoryQueryStartDateTime; } if (inventoryQueryStartDateTime == null) { this.inventoryQueryStartDateTime = shop.InventoryQueryStartDateTime.Value; } this.sellerId = shop.SellerId; this.mwsAuthToken = shop.MwsAuthToken; shopId = shop.Id; shopMarketplaceId = shop.ShopMarketplaceId; FBAInventoryServiceMWSConfig config = new FBAInventoryServiceMWSConfig(); config.ServiceURL = serviceURL; client = new FBAInventoryServiceMWSClient(accessKey, secretKey, appName, appVersion, config); doSyn(); inventoryQueryStartDateTime = DateTime.Now.AddMinutes(-5); ShopService.updateInventoryQueryStartDateTime(shop.Id, inventoryQueryStartDateTime.Value); }
public SellerInventorySupplyList() { /************************************************************************ * Access Key ID and Secret Acess Key ID, obtained from: * http://mws.amazon.com ***********************************************************************/ String accessKeyId = "AKIAJ2IS6ZEEGQPJV7WA"; String secretAccessKey = "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"; /************************************************************************ * Marketplace and Seller IDs are required parameters for all * MWS calls. ***********************************************************************/ /************************************************************************ * The application name and version are included in each MWS call's * HTTP User-Agent field. These are required fields. ***********************************************************************/ const string applicationName = "<Your Application Name>"; const string applicationVersion = "<Your Application Version or Build Number or Release Date>"; /************************************************************************ * Uncomment to try advanced configuration options. Available options are: * * - Proxy Host and Proxy Port * - MWS Service endpoint URL * - User Agent String to be sent to FBA Inventory Service MWS service * ***********************************************************************/ FBAInventoryServiceMWSConfig config = new FBAInventoryServiceMWSConfig(); //config.ProxyHost = "https://PROXY_URL"; //config.ProxyPort = 9090; // // IMPORTANT: Uncomment out the appropiate line for the country you wish // to sell in: // // US config.ServiceURL = MWSServer.Properties.Settings.Default["US_ServiceURL"].ToString(); //config.ServiceURL = "https://mws.amazonservices.com/FulfillmentInventory/2010-10-01/"; // UK // config.ServiceURL = "https://mws.amazonservices.co.uk/FulfillmentInventory/2010-10-01/"; // Germany // config.ServiceURL = "https://mws.amazonservices.de/FulfillmentInventory/2010-10-01/"; // France // config.ServiceURL = "https://mws.amazonservices.fr/FulfillmentInventory/2010-10-01/"; // Japan // config.ServiceURL = "https://mws.amazonservices.jp/FulfillmentInventory/2010-10-01/"; // China // config.ServiceURL = "https://mws.amazonservices.com.cn/FulfillmentInventory/2010-10-01/"; // ProxyPort=-1 ; MaxErrorRetry=3 config.SetUserAgentHeader( applicationName, applicationVersion, "C#", "-1", "3"); /************************************************************************ * Instantiate Implementation of FBA Inventory Service MWS ***********************************************************************/ service = new FBAInventoryServiceMWSClient( accessKeyId, secretAccessKey, applicationName, applicationVersion, config); }
public DataSet InvokeListInventorySupply(FBAInventoryServiceMWS.FBAInventoryServiceMWS service, ListInventorySupplyRequest request) { try { ListInventorySupplyResponse response = service.ListInventorySupply(request); DebugLogHandler.DebugLogHandler.WriteLog(_sLogPath, _sClass, "InvokeListInventorySupply() reponse:" + response.ToXML()); if (response.IsSetListInventorySupplyResult()) { ListInventorySupplyResult listInventorySupplyResult = response.ListInventorySupplyResult; if (listInventorySupplyResult.IsSetInventorySupplyList()) { InventorySupplyList inventorySupplyList = listInventorySupplyResult.InventorySupplyList; List <InventorySupply> memberList = inventorySupplyList.member; foreach (InventorySupply member in memberList) { int InboundCount = 0; int InStockCount = 0; int TransferCount = 0; //Console.WriteLine(" member"); DataRow InventoryRow = InventorySupplyTable.NewRow(); InventoryRow["FNSKU"] = "N/A"; InventoryRow["SellerSKU"] = "N/A"; InventoryRow["ASIN"] = "N/A"; InventoryRow["Inbound"] = InboundCount; InventoryRow["InStock"] = InStockCount; InventoryRow["Transfer"] = TransferCount; if (member.IsSetSellerSKU()) { InventoryRow["SellerSKU"] = member.SellerSKU; //Console.WriteLine(" SellerSKU"); //Console.WriteLine(" {0}", member.SellerSKU); } if (member.IsSetFNSKU()) { InventoryRow["FNSKU"] = member.FNSKU; //Console.WriteLine(" FNSKU"); //Console.WriteLine(" {0}", member.FNSKU); } if (member.IsSetASIN()) { InventoryRow["ASIN"] = member.ASIN; //Console.WriteLine(" ASIN"); // Console.WriteLine(" {0}", member.ASIN); } if (member.IsSetCondition()) { //Console.WriteLine(" Condition"); //Console.WriteLine(" {0}", member.Condition); } if (member.IsSetTotalSupplyQuantity()) { //InventoryRow["TotalSupplyQuantity"] = member.TotalSupplyQuantity; //Console.WriteLine(" TotalSupplyQuantity"); //Console.WriteLine(" {0}", member.TotalSupplyQuantity); } if (member.IsSetInStockSupplyQuantity()) { //InventoryRow["InStockSupplyQuantity"] = member.InStockSupplyQuantity; //Console.WriteLine(" InStockSupplyQuantity"); //Console.WriteLine(" {0}", member.InStockSupplyQuantity); } if (member.IsSetEarliestAvailability()) { //Console.WriteLine(" EarliestAvailability"); Timepoint earliestAvailability = member.EarliestAvailability; if (earliestAvailability.IsSetTimepointType()) { //Console.WriteLine(" TimepointType"); //Console.WriteLine(" {0}", earliestAvailability.TimepointType); } if (earliestAvailability.IsSetDateTime()) { //Console.WriteLine(" DateTime"); //Console.WriteLine(" {0}", earliestAvailability.DateTime); } } if (member.IsSetSupplyDetail()) { //Console.WriteLine(" SupplyDetail"); InventorySupplyDetailList supplyDetail = member.SupplyDetail; List <InventorySupplyDetail> member1List = supplyDetail.member; foreach (InventorySupplyDetail member1 in member1List) { //Console.WriteLine(" member"); if (member1.IsSetQuantity()) { if (member1.SupplyType == "InStock") { InStockCount += Int32.Parse(member1.Quantity.ToString()); } if (member1.SupplyType == "Inbound") { InboundCount += Int32.Parse(member1.Quantity.ToString()); } if (member1.SupplyType == "Transfer") { TransferCount = Int32.Parse(member.TotalSupplyQuantity.ToString()) - Int32.Parse(member1.Quantity.ToString()); } //InventoryRow[member1.SupplyType] = member1.Quantity; //Console.WriteLine(" Quantity"); //Console.WriteLine(" {0}", member1.Quantity); } if (member1.IsSetSupplyType()) { //Console.WriteLine(" SupplyType"); //Console.WriteLine(" {0}", member1.SupplyType); } if (member1.IsSetEarliestAvailableToPick()) { //Console.WriteLine(" EarliestAvailableToPick"); //Timepoint earliestAvailableToPick = member1.EarliestAvailableToPick; //if (earliestAvailableToPick.IsSetTimepointType()) //{ // Console.WriteLine(" TimepointType"); // Console.WriteLine(" {0}", earliestAvailableToPick.TimepointType); //} //if (earliestAvailableToPick.IsSetDateTime()) //{ // Console.WriteLine(" DateTime"); // Console.WriteLine(" {0}", earliestAvailableToPick.DateTime); //} } if (member1.IsSetLatestAvailableToPick()) { //Console.WriteLine(" LatestAvailableToPick"); //Timepoint latestAvailableToPick = member1.LatestAvailableToPick; //if (latestAvailableToPick.IsSetTimepointType()) //{ // Console.WriteLine(" TimepointType"); // Console.WriteLine(" {0}", latestAvailableToPick.TimepointType); //} //if (latestAvailableToPick.IsSetDateTime()) //{ // Console.WriteLine(" DateTime"); // Console.WriteLine(" {0}", latestAvailableToPick.DateTime); //} } } }//end of foreach member1 list InventoryRow["Inbound"] = InboundCount; InventoryRow["InStock"] = InStockCount; InventoryRow["Transfer"] = TransferCount; InventorySupplyTable.Rows.Add(InventoryRow); } // end of foreach member list } if (listInventorySupplyResult.IsSetNextToken()) { //Console.WriteLine(" NextToken"); //Console.WriteLine(" {0}", listInventorySupplyResult.NextToken); ListInventorySupplyByNextTokenRequest nextTokenRequest = new ListInventorySupplyByNextTokenRequest(); nextTokenRequest.SellerId = request.SellerId; nextTokenRequest.Marketplace = request.Marketplace; nextTokenRequest.NextToken = listInventorySupplyResult.NextToken; InvokeListInventorySupplyByNextToken(service, nextTokenRequest); } } if (response.IsSetResponseMetadata()) { Console.WriteLine(" ResponseMetadata"); ResponseMetadata responseMetadata = response.ResponseMetadata; if (responseMetadata.IsSetRequestId()) { //Console.WriteLine(" RequestId"); //Console.WriteLine(" {0}", responseMetadata.RequestId); } } } catch (FBAInventoryServiceMWSException ex) { Console.WriteLine("Caught Exception: " + ex.Message); Console.WriteLine("Response Status Code: " + ex.StatusCode); Console.WriteLine("Error Code: " + ex.ErrorCode); Console.WriteLine("Error Type: " + ex.ErrorType); Console.WriteLine("Request ID: " + ex.RequestId); Console.WriteLine("XML: " + ex.XML); DebugLogHandler.DebugLogHandler.WriteLog(_sLogPath, _sClass, "Caught Exception: " + ex.Message); DebugLogHandler.DebugLogHandler.WriteLog(_sLogPath, _sClass, "Response Status Code: " + ex.StatusCode); DebugLogHandler.DebugLogHandler.WriteLog(_sLogPath, _sClass, "Error Code: " + ex.ErrorCode); DebugLogHandler.DebugLogHandler.WriteLog(_sLogPath, _sClass, "Error Type: " + ex.ErrorType); DebugLogHandler.DebugLogHandler.WriteLog(_sLogPath, _sClass, "Request ID: " + ex.RequestId); DebugLogHandler.DebugLogHandler.WriteLog(_sLogPath, _sClass, "XML: " + ex.XML); } return(InventorySupplyDataSet); }