private bool IsFeedSubmitted( IMarketplaceWebServiceFeedsReports client, string feedSubmissionId, string merchant, string mwsAuthToken ) { var response = client.GetFeedSubmissionList( new GetFeedSubmissionListRequest { FeedSubmissionIdList = new IdList { Id = new List< string > { feedSubmissionId } }, Merchant = merchant, MWSAuthToken = mwsAuthToken } ); ActionPolicies.CreateApiDelay( 2 ).Wait(); if( !response.IsSetGetFeedSubmissionListResult() ) throw new Exception( string.Format( "[amazon] IsFeedSubmitted. Seller: {0}\nResult was not received", merchant ) ); var info = response.GetFeedSubmissionListResult.FeedSubmissionInfo.FirstOrDefault( i => i.FeedSubmissionId.Equals( feedSubmissionId ) ); if( info == null ) throw new Exception( string.Format( "[amazon] IsFeedSubmitted. Seller: {0}\nSubmissionId was not found", merchant ) ); if( info.FeedProcessingStatus.Equals( "_CANCELLED_" ) ) throw new Exception( string.Format( "[amazon] IsFeedSubmitted. Seller: {0}\nThe request has been aborted due to a fatal error", merchant ) ); return info.FeedProcessingStatus.Equals( "_DONE_" ); }
public FeedsService( IMarketplaceWebServiceFeedsReports client ) { this._client = client; }
private void SubmitInventoryUpdateRequest( IMarketplaceWebServiceFeedsReports client, IEnumerable< AmazonInventoryItem > inventoryItems ) { var request = this.InitInventoryFeedRequest( inventoryItems ); var service = new FeedsService( client ); ActionPolicies.AmazonSubmitPolicy.Do( () => { service.SubmitFeed( request ); request.FeedContent.Close(); ActionPolicies.CreateApiDelay( 2 ).Wait(); } ); }