public async Task GetReportListAsync() { RegistroUsuariosGetAllRequest requests = new RegistroUsuariosGetAllRequest { order = " Registro_de_Usuarios.Folio ASC ", where = "Registro_de_Usuarios.Correo='" + SettingsService.User.Email + "'" }; if (await CallServiceAsync <RegistroUsuariosGetAllRequest, LoginResponse>(requests, "", false) is LoginResponse responseLogin && responseLogin.Success) { var request = new GetReportListRequest { UserId = responseLogin.Folio }; if (await CallServiceAsync <GetReportListRequest, GetReportListResponse>(request, "Consultando las solicitudes...", true) is GetReportListResponse response && response.Success) { if (response.ReportList.Any()) { await GoToPageAsync <Views.ReportListPage>(response.ReportList); } else { await HudService.ShowErrorAsync("No has generado solicitudes"); } } } }
public MemoryStream GetMostRecentAutomaticallyScheduledReport(ReportType reportType) { GetReportListRequest request = new GetReportListRequest() .WithReportTypeList(new TypeList { Type = new List <string> { reportType.ToString() } }) .WithMerchant(m_sellerId); GetReportListResponse response = m_service.GetReportList(request); GetReportListResult result = response.GetReportListResult; List <ReportInfo> reportInfo = result.ReportInfo; ReportInfo mostRecentScheduledReport = reportInfo.OrderByDescending(o => o.AvailableDate).FirstOrDefault(); MemoryStream memoryStream = new MemoryStream(); if (mostRecentScheduledReport != null) { GetReportRequest reportRequest = new GetReportRequest { Merchant = m_sellerId, ReportId = mostRecentScheduledReport.ReportId, Report = memoryStream }; m_service.GetReport(reportRequest); } return(memoryStream); }
public GetReportListResult GetReportList() { nLogger.Info("GetReportRequestList start"); GetReportListRequest request = new GetReportListRequest(); request.MWSAuthToken = serviceContext.MwsAuthToken; request.Merchant = serviceContext.SellerId; GetReportListResponse response = service.GetReportList(request); return(response.GetReportListResult); }
public async Task <IActionResult> GetRecondReportList([FromBody] GetRecondReportListRequest requestDto) { var commonReportBiz = new CommonReportThemeBiz(); var approveModel = await commonReportBiz.GetReportApproveModelByGuid(requestDto.ApproveGuid); if (approveModel == null) { return(Failed(ErrorCode.DataBaseError, "无数据,请检查!")); } if (!IsRightStatusForOperation(approveModel)) { return(Failed(ErrorCode.DataBaseError, "该申请状态暂无权限查看列表,请检查!")); } var themeModel = await commonReportBiz.GetReportThemeModelByThemeGuid(approveModel.ThemeGuid); if (themeModel == null) { return(Failed(ErrorCode.DataBaseError, "无主题数据,请检查!")); } if (string.IsNullOrWhiteSpace(themeModel.SQLStr)) { return(Failed(ErrorCode.DataBaseError, "主题SQL语句为空,请检查!")); } GetReportListRequest request = new GetReportListRequest { SqlStr = themeModel.SQLStr //暂时不分页 //PageIndex = requestDto.PageIndex, //PageSize = requestDto.PageSize }; try { if (!IsRightSQLStr(request.SqlStr)) { return(Failed(ErrorCode.DataBaseError, "SQL语句有误,请检查!")); } var responseDto = commonReportBiz.GetReportList(request); if (responseDto == null) { return(Failed(ErrorCode.DataBaseError, "获取报表数据失败,请检查!")); } //foreach (var item in responseDto.CurrentPage) //{ // item.Phone = Regex.Replace(item.Phone, "(\\d{3})\\d{4}(\\d{4})", "$1****$2"); //} return(Success(responseDto)); } catch (Exception ex) { return(Failed(ErrorCode.DataBaseError, "SQL语句执行错误,请检查!")); } }
private List <ReportInfo> getReportInfoList(List <string> reportRequestIds) { var request = new GetReportListRequest { Merchant = "A12HYFEDED6DEW", ReportRequestIdList = new IdList { Id = reportRequestIds } }; var response = _amazonClient.GetReportList(request); return(response.GetReportListResult.ReportInfo); }
private void GetReportData(RequestInfo requestInfo, Stream stream) { var requestReport = new GetReportRequest(); var requestsListInfo = requestInfo.Owner; var merchant = requestsListInfo.UserId; var access = requestsListInfo.Access; var requestName = requestInfo.Name; var requestReportList = new GetReportListRequest { Merchant = merchant }; ReportInfo reportInfo = null; var respGetReportList = AmazonWaitBeforeRetryHelper.DoServiceAction( requestsListInfo.ErrorRetryingInfo, ReportGetReportListTrapForThrottling, requestName, access, requestsListInfo.RequestsCounter, () => _Service.GetReportList(requestReportList), "GetReportList"); if (respGetReportList != null && respGetReportList.IsSetGetReportListResult()) { reportInfo = respGetReportList.GetReportListResult.ReportInfo.FirstOrDefault(r => r.ReportRequestId.Equals(requestInfo.Id)); } if (reportInfo != null) { requestReport.Merchant = merchant; requestReport.ReportId = reportInfo.ReportId; requestReport.Report = stream; AmazonWaitBeforeRetryHelper.DoServiceAction( requestsListInfo.ErrorRetryingInfo, ReportGetReportTrapForThrottling, requestName, access, requestsListInfo.RequestsCounter, () => _Service.GetReport(requestReport), "GetReport"); } }
public void DoRequestReportList(List <string> requestReportIds) { var request = new GetReportListRequest { Merchant = "A12HYFEDED6DEW", ReportRequestIdList = new IdList { Id = requestReportIds } }; var response = _amazonClient.GetReportList(request); var reportInfoList = response.GetReportListResult.ReportInfo; foreach (var reportInfo in reportInfoList) { var stream = downloadReportStream(reportInfo.ReportId); // save the stream into a file saveStreamToFile(stream, string.Format("{0}_{1}", reportInfo.ReportType, reportInfo.ReportId)); } }
/// <summary> /// Get Report List /// </summary> /// <param name="request">Get Report List request</param> /// <returns>Get Report List Response from the service</returns> /// <remarks> /// returns a list of reports; by default the most recent ten reports, /// regardless of their acknowledgement status /// /// </remarks> public async Task <GetReportListResponse> GetReportList(GetReportListRequest request) { return(await Invoke <GetReportListResponse>("GetReportListResponse.xml")); }
public static void DownloadSettlementReport(MarketplaceWebService.MarketplaceWebService service, string merchantId, bool getOnlyMostRecent = false) { GetReportListRequest request = new GetReportListRequest(); request.Merchant = merchantId; TypeList reportTypes = new TypeList(); reportTypes.Type = new List <string>() { "_GET_V2_SETTLEMENT_REPORT_DATA_FLAT_FILE_V2_" }; request.ReportTypeList = reportTypes; List <Tuple <string, DateTime, DateTime> > settlemementReportsInfo = getReportsIds(service, request); if (settlemementReportsInfo.Count() == 0) { Console.WriteLine("No reports downloaded. Exiting."); return; } int selectedReport = 0; if (!getOnlyMostRecent) { Console.WriteLine("List of available reports:"); for (int i = 0; i < 3; i++) { int index = i + 1; Console.WriteLine(index + ". " + settlemementReportsInfo[i].Item2.ToShortDateString() + " - " + settlemementReportsInfo[i].Item3.ToShortDateString()); } Console.WriteLine("Select option:"); char userInput = (char)Console.Read(); Console.ReadLine(); if (userInput == '1' || userInput == '2' || userInput == '3') { switch (userInput) { case '2': selectedReport = 1; break; case '3': selectedReport = 2; break; case '1': default: selectedReport = 0; break; } } else { Console.WriteLine("Invalid option detected. Selecting most recent report as default."); //At this point selectedReport = 0; } } string reportId = settlemementReportsInfo[selectedReport].Item1; #region Downloading report GetReportRequest requestReport = new GetReportRequest(); requestReport.Merchant = merchantId; requestReport.ReportId = reportId; string amzSettlementReportPath = ConfigurationManager.AppSettings["Amz.SettlementReport.DownloadPath"]; //File path directory. Example: "C:/" string amzSettlementReportFile = amzSettlementReportPath + "amzSettlementReport-" + DateTime.Now.ToString("yyyyMMdd-HHmmss") + ".txt"; //NOTE: The invokeGetReport needs to get all the time a different file name to avoid having an MD5 error. (Problem found while developing. Solution found here: https://sellercentral.amazon.com/forums/thread.jspa?threadID=12563) requestReport.Report = File.Open(amzSettlementReportFile, FileMode.OpenOrCreate, FileAccess.ReadWrite); invokeGetReport(service, requestReport); //Added timestamp to the report filename to avoid the MD5 problem from Amazon's side. Console.WriteLine("File was downloaded to: " + amzSettlementReportFile); #endregion }
/// <summary> /// Gets the last 3 settlement reports from Amazon API /// </summary> /// <param name="service"></param> /// <param name="request"></param> /// <returns></returns> private static List <Tuple <string, DateTime, DateTime> > getReportsIds(MarketplaceWebService.MarketplaceWebService service, GetReportListRequest request) { List <Tuple <string, DateTime, DateTime> > reports = new List <Tuple <string, DateTime, DateTime> >(); //Includes the reportId, dateFrom and dateTo for a settlement report. if ((service == null) || (request == null)) { return(reports); } try { List <string> reportIds = new List <string>(); List <DateTime> availableDates = new List <DateTime>(); GetReportListResponse response = service.GetReportList(request); if (response.IsSetGetReportListResult()) { GetReportListResult getReportListResult = response.GetReportListResult; List <ReportInfo> reportInfoList = getReportListResult.ReportInfo; foreach (ReportInfo reportInfo in reportInfoList) { reportIds.Add(reportInfo.ReportId); availableDates.Add(reportInfo.AvailableDate); } } if (availableDates.Count < 4) { //We were not able to get the last 3 reports. We will try then to return the most recent one. string reportId = reportIds[0]; DateTime dateFrom = availableDates[1].AddDays(-1); //Settlement reports are available only until the next day of their period. DateTime dateTo = availableDates[0].AddDays(-1); Tuple <string, DateTime, DateTime> reportInfo = Tuple.Create(reportId, dateFrom, dateTo); reports.Add(reportInfo); } else { //We have more than 3 reports. for (int i = 0; i < 4; i++) { if (DateTime.Now.Subtract(availableDates[i]).Days > 2) //We exclude the last report if it is still open (open = haven't finished the actual period). { string reportId = reportIds[i]; DateTime dateFrom = availableDates[i + 1].AddDays(-1); //Settlement reports are available only until the next day of their period. DateTime dateTo = availableDates[i].AddDays(-1); Tuple <string, DateTime, DateTime> reportInfo = Tuple.Create(reportId, dateFrom, dateTo); reports.Add(reportInfo); } } } } catch (Exception e) { Console.WriteLine("Cannot download the list of settlement reports. Exception: " + e.Message); } return(reports); }
/// <summary> /// returns a list of reports; by default the most recent ten reports, /// regardless of their acknowledgement status /// /// </summary> /// <param name="service">Instance of MarketplaceWebService service</param> /// <param name="request">GetReportListRequest request</param> public static async Task InvokeGetReportList(MarketplaceWebService service, GetReportListRequest request) { try { GetReportListResponse response = await service.GetReportList(request); Console.WriteLine("Service Response"); Console.WriteLine("============================================================================="); Console.WriteLine(); Console.WriteLine(" GetReportListResponse"); if (response.IsSetGetReportListResult()) { Console.WriteLine(" GetReportListResult"); GetReportListResult getReportListResult = response.GetReportListResult; if (getReportListResult.IsSetNextToken()) { Console.WriteLine(" NextToken"); Console.WriteLine(" {0}", getReportListResult.NextToken); } if (getReportListResult.IsSetHasNext()) { Console.WriteLine(" HasNext"); Console.WriteLine(" {0}", getReportListResult.HasNext); } List <ReportInfo> reportInfoList = getReportListResult.ReportInfo; foreach (ReportInfo reportInfo in reportInfoList) { Console.WriteLine(" ReportInfo"); if (reportInfo.IsSetReportId()) { Console.WriteLine(" ReportId"); Console.WriteLine(" {0}", reportInfo.ReportId); } if (reportInfo.IsSetReportType()) { Console.WriteLine(" ReportType"); Console.WriteLine(" {0}", reportInfo.ReportType); } if (reportInfo.IsSetReportRequestId()) { Console.WriteLine(" ReportRequestId"); Console.WriteLine(" {0}", reportInfo.ReportRequestId); } if (reportInfo.IsSetAvailableDate()) { Console.WriteLine(" AvailableDate"); Console.WriteLine(" {0}", reportInfo.AvailableDate); } if (reportInfo.IsSetAcknowledged()) { Console.WriteLine(" Acknowledged"); Console.WriteLine(" {0}", reportInfo.Acknowledged); } if (reportInfo.IsSetAcknowledgedDate()) { Console.WriteLine(" AcknowledgedDate"); Console.WriteLine(" {0}", reportInfo.AcknowledgedDate); } } } if (response.IsSetResponseMetadata()) { Console.WriteLine(" ResponseMetadata"); ResponseMetadata responseMetadata = response.ResponseMetadata; if (responseMetadata.IsSetRequestId()) { Console.WriteLine(" RequestId"); Console.WriteLine(" {0}", responseMetadata.RequestId); } } Console.WriteLine(" ResponseHeaderMetadata"); Console.WriteLine(" RequestId"); Console.WriteLine(" " + response.ResponseHeaderMetadata.RequestId); Console.WriteLine(" ResponseContext"); Console.WriteLine(" " + response.ResponseHeaderMetadata.ResponseContext); Console.WriteLine(" Timestamp"); Console.WriteLine(" " + response.ResponseHeaderMetadata.Timestamp); } catch (MarketplaceWebServiceException 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); Console.WriteLine("ResponseHeaderMetadata: " + ex.ResponseHeaderMetadata); } }
public string GetReportLatestReport(DateTime From, DateTime To, string ReportType) { List <string> ReportList = new List <string>(); GetReportListRequest requestReport = new GetReportListRequest(); requestReport.Acknowledged = false; requestReport.AvailableFromDate = From; requestReport.AvailableToDate = To; #pragma warning disable CS0618 // Type or member is obsolete requestReport.Marketplace = api.MarketplaceId; #pragma warning restore CS0618 // Type or member is obsolete requestReport.MaxCount = 99; requestReport.Merchant = api.Merchant; List <string> reportCode = new List <string>(); reportCode.Add(ReportType); TypeList typeList = new TypeList(); typeList.Type = reportCode; requestReport.ReportTypeList = typeList; MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig(); config.ServiceURL = webService.SERVICE_URL; config.WithUserAgent(webService.USER_AGENT); MarketplaceWebServiceClient client = new MarketplaceWebServiceClient(api.AccessKey, api.SecretKey, config); GetReportListResult getReportListResult = null; getReportListResult = InvokeGetReportList(client, requestReport); if (getReportListResult != null) { if (getReportListResult.HasNext) { while (getReportListResult.HasNext) { int i = 0; if (i % 2 == 0) { Thread.Sleep(2000); } GetReportListByNextTokenRequest getReportListByNextTokenRequest = new GetReportListByNextTokenRequest(); #pragma warning disable CS0618 // Type or member is obsolete getReportListByNextTokenRequest.Marketplace = api.MarketplaceId; #pragma warning restore CS0618 // Type or member is obsolete getReportListByNextTokenRequest.Merchant = api.Merchant; getReportListByNextTokenRequest.NextToken = getReportListResult.NextToken; string ReportId = InvokeGetReportListByNextToken(client, getReportListByNextTokenRequest); ReportList.Add(ReportId); i++; } } List <ReportInfo> reportInfoList = getReportListResult.ReportInfo; if (reportInfoList.Count > 0) { foreach (ReportInfo reportInfo in reportInfoList) { ReportList.Add(reportInfo.ReportId); } } else { Console.WriteLine("No reports returned from Amazon."); throw new Exception("No reports returned from Amazon."); } } return(ReportList[0]); }
public GetReportListResult InvokeGetReportList(Operations.Reports.MarketplaceWebService client, GetReportListRequest request) { GetReportListResult getReportListResult = null; try { GetReportListResponse response = client.GetReportList(request); if (response != null) { getReportListResult = response.GetReportListResult; } } catch (MarketplaceWebServiceException 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); Console.WriteLine("ResponseHeaderMetadata: " + ex.ResponseHeaderMetadata); } return(getReportListResult); }
public IEnumerable <object> GetReportList(DateTime startDate, DateTime endDate) { var request = new GetReportListRequest { Merchant = "A12HYFEDED6DEW", AvailableFromDate = startDate, AvailableToDate = endDate, ReportTypeList = new TypeList { Type = new List <string> { "_GET_V2_SETTLEMENT_REPORT_DATA_XML_" } } }; var response = _amazonClient.GetReportList(request); var reportInfoList = response.GetReportListResult.ReportInfo; var nextToken = response.GetReportListResult.NextToken; var hasNext = response.GetReportListResult.HasNext; GetReportListByNextTokenResponse nextResponse = null; var reportCounter = 0; // pause for 2 seconds to give the Amazon MWS a little bit time to process the others Thread.Sleep(2000); // let's find the report we are interested in var reports = findReportTypes(reportInfoList); while (hasNext) { var nextRequest = new GetReportListByNextTokenRequest { Merchant = "A12HYFEDED6DEW", NextToken = nextToken }; nextResponse = _amazonClient.GetReportListByNextToken(nextRequest); reportInfoList = nextResponse.GetReportListByNextTokenResult.ReportInfo; nextToken = nextResponse.GetReportListByNextTokenResult.NextToken; hasNext = nextResponse.GetReportListByNextTokenResult.HasNext; // pause for 2 seconds, this is the restore rate for GetReportListByNextToken Thread.Sleep(2000); // find and add it to the list reports.AddRange(findReportTypes(reportInfoList)); foreach (var reportInfo in reports) { // check if the report request quota reach to 15 if (reportCounter % 15 == 0) { // if so, pause for 1 minute, this is the restore rate for GetReport Thread.Sleep(60000); } var stream = downloadReportStream(reportInfo.ReportId); // save the stream into a file saveStreamToFile(stream, string.Format("{0}_{1}", reportInfo.ReportType, reportInfo.ReportId)); reportCounter++; } // clear the reports lisst reports.Clear(); } return(null); }
public List <string> SubmitSettlementReportRequest(DateTime createdAfter, bool includeAcknowledged) { var request = new GetReportListRequest { Merchant = _merchantId, AvailableFromDate = createdAfter, AvailableToDate = DateTime.Now, ReportTypeList = new TypeList { Type = new List <string> { _SETTLEMENT_REPORT_TYPE } } }; var response = _amazonClient.GetReportList(request); var reportInfoList = response.GetReportListResult.ReportInfo; var nextToken = response.GetReportListResult.NextToken; var hasNext = response.GetReportListResult.HasNext; var reportCounter = 1; bool hasNextReport; var reportFilePaths = new List <string>(); var reportIds = new List <string>(); // pause for 2 seconds to give the Amazon MWS a little bit time to process the others Thread.Sleep(2000); do { hasNextReport = false; // download and parse the report info foreach (var reportInfo in reportInfoList) { if (!includeAcknowledged && reportInfo.Acknowledged) { continue; } // check if the report request quota reach to 15 if (reportCounter % 15 == 0) { // if so, pause for 1 minute, this is the restore rate for GetReport Thread.Sleep(60000); } var stream = downloadReportStream(reportInfo.ReportId); // save the stream into a file var filePath = saveStreamToFile(stream, string.Format("{0}{1}", reportInfo.ReportId, reportInfo.ReportType)); // add the filepath and report id to the lists reportFilePaths.Add(filePath); reportIds.Add(reportInfo.ReportId); reportCounter++; } // send another request for the next report list if (hasNext) { var nextRequest = new GetReportListByNextTokenRequest { Merchant = _merchantId, NextToken = nextToken }; var nextResponse = _amazonClient.GetReportListByNextToken(nextRequest); reportInfoList = nextResponse.GetReportListByNextTokenResult.ReportInfo; nextToken = nextResponse.GetReportListByNextTokenResult.NextToken; hasNext = nextResponse.GetReportListByNextTokenResult.HasNext; hasNextReport = reportInfoList.Any(); } } while (hasNextReport); // then let's send the acknowledgment to the Reports Ids submitReportsAcknowledgement(reportIds); return(reportFilePaths); }
/** * Samples for Marketplace Web Service functionality */ public static void Main(string [] args) { Console.WriteLine("==========================================="); Console.WriteLine("Welcome to Marketplace Web Service Samples!"); Console.WriteLine("==========================================="); Console.WriteLine("To get started:"); Console.WriteLine("==========================================="); Console.WriteLine(" - Fill in your AWS credentials"); Console.WriteLine(" - Uncomment sample you're interested in trying"); Console.WriteLine(" - Set request with desired parameters"); Console.WriteLine(" - Hit F5 to run!"); Console.WriteLine(); Console.WriteLine("==========================================="); Console.WriteLine("Samples Output"); Console.WriteLine("==========================================="); Console.WriteLine(); /************************************************************************ * Access Key ID and Secret Acess Key ID, obtained from: * http://aws.amazon.com * * IMPORTANT: Your Secret Access Key is a secret, and should be known * only by you and AWS. You should never include your Secret Access Key * in your requests to AWS. You should never e-mail your Secret Access Key * to anyone. It is important to keep your Secret Access Key confidential * to protect your account. ***********************************************************************/ String accessKeyId = "AKIAJGG4R57W4LFE5A7Q"; //"<Your AWS Access Key>"; String secretAccessKey = "+PHHi8IKHIcA15nobUDTWxGrbSLjZoHUX132lrvx"; // "<Your AWS Secret Key>"; /************************************************************************ * Instantiate Implementation of Marketplace Web Service ***********************************************************************/ MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig(); /************************************************************************ * The application name and version are included in each MWS call's * HTTP User-Agent field. These are required fields. ***********************************************************************/ const string applicationName = "eShopConnect"; //"<Your Application Name>"; const string applicationVersion = "0.01"; //"<Your Application Version>"; //MarketplaceWebService service = // new MarketplaceWebServiceClient( // accessKeyId, // secretAccessKey, // applicationName, // applicationVersion, // config); /************************************************************************ * All MWS requests must contain the seller's merchant ID and * marketplace ID. ***********************************************************************/ const string merchantId = "A2A1GVUGQMPXDX"; //"<Your Merchant ID>"; const string marketplaceId = "A1F83G8C2ARO7P"; //"<Your Marketplace ID>"; /************************************************************************ * Uncomment to configure the client instance. Configuration settings * include: * * - MWS Service endpoint URL * - Proxy Host and Proxy Port * - User Agent String to be sent to Marketplace Web Service service * ***********************************************************************/ //MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig(); //config.ProxyHost = "https://PROXY_URL"; //config.ProxyPort = 9090; // // IMPORTANT: Uncomment out the appropiate line for the country you wish // to sell in: // // United States: // config.ServiceURL = "https://mws.amazonservices.com"; // // United Kingdom: config.ServiceURL = "https://mws.amazonservices.co.uk"; // // Germany: // config.ServiceURL = "https://mws.amazonservices.de"; // // France: // config.ServiceURL = "https://mws.amazonservices.fr"; // // Japan: // config.ServiceURL = "https://mws.amazonservices.jp"; // // China: // config.ServiceURL = "https://mws.amazonservices.com.cn"; // // Canada: // config.ServiceURL = "https://mws.amazonservices.ca"; // config.SetUserAgentHeader( applicationName, applicationVersion, "C#", "<Parameter 1>", "<Parameter 2>"); MarketplaceWebService service = new MarketplaceWebServiceClient(accessKeyId, secretAccessKey, config); /************************************************************************ * Uncomment to try out Mock Service that simulates Marketplace Web Service * responses without calling Marketplace Web Service service. * * Responses are loaded from local XML files. You can tweak XML files to * experiment with various outputs during development * * XML files available under MarketplaceWebService\Mock tree * ***********************************************************************/ //MarketplaceWebService service = new MarketplaceWebServiceMock(); /************************************************************************ * Uncomment to invoke Get Report Action ***********************************************************************/ { //GetReportRequest request = new GetReportRequest(); //request.Merchant = merchantId; // request.Marketplace = marketplaceId; // Note that depending on the type of report being downloaded, a report can reach // sizes greater than 1GB. For this reason we recommend that you _always_ program to // MWS in a streaming fashion. Otherwise, as your business grows you may silently reach // the in-memory size limit and have to re-work your solution. // NOTE: Due to Content-MD5 validation, the stream must be read/write. // request.ReportId = "REPORT_ID"; // request.Report = File.Open("report.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite ); // GetReportSample.InvokeGetReport(service, request); } /************************************************************************ * Uncomment to invoke Get Report Schedule Count Action ***********************************************************************/ { //GetReportScheduleCountRequest request = new GetReportScheduleCountRequest(); //request.Merchant = merchantId; //request.Marketplace = marketplaceId; // @TODO: set additional request parameters here //GetReportScheduleCountSample.InvokeGetReportScheduleCount(service, request); } /************************************************************************ * Uncomment to invoke Get Report Request List By Next Token Action ***********************************************************************/ { // GetReportRequestListByNextTokenRequest request = new GetReportRequestListByNextTokenRequest(); // request.Merchant = merchantId; // request.Marketplace = marketplaceId; // request.NextToken = "NextToken from GetReportRequestList"; // // @TODO: set additional request parameters here // GetReportRequestListByNextTokenSample.InvokeGetReportRequestListByNextToken(service, request); } /************************************************************************ * Uncomment to invoke Update Report Acknowledgements Action ***********************************************************************/ { //UpdateReportAcknowledgementsRequest request = new UpdateReportAcknowledgementsRequest(); //request.Merchant = merchantId; //request.Marketplace = marketplaceId; //request.WithReportIdList(new IdList().WithId("REPORT_ID")); // @TODO: set additional request parameters here //UpdateReportAcknowledgementsSample.InvokeUpdateReportAcknowledgements(service, request); } /************************************************************************ * Uncomment to invoke Submit Feed Action ***********************************************************************/ { //SubmitFeedRequest request = new SubmitFeedRequest(); //request.Merchant = merchantId; //request.Marketplace = marketplaceId; // MWS exclusively offers a streaming interface for uploading your feeds. This is because // feed sizes can grow to the 1GB+ range - and as your business grows you could otherwise // silently reach the feed size where your in-memory solution will no longer work, leaving you // puzzled as to why a solution that worked for a long time suddenly stopped working though // you made no changes. For the same reason, we strongly encourage you to generate your feeds to // local disk then upload them directly from disk to MWS. //request.FeedContent = File.Open("feed.xml", FileMode.Open, FileAccess.Read); // Calculating the MD5 hash value exhausts the stream, and therefore we must either reset the // position, or create another stream for the calculation. //request.ContentMD5 = MarketplaceWebServiceClient.CalculateContentMD5(request.FeedContent); //request.FeedContent.Position = 0; //request.FeedType = "FEED_TYPE"; //SubmitFeedSample.InvokeSubmitFeed(service, request); } /************************************************************************ * Uncomment to invoke Get Report Count Action ***********************************************************************/ { // GetReportCountRequest request = new GetReportCountRequest(); // request.Merchant = merchantId; // request.Marketplace = marketplaceId; // @TODO: set additional request parameters here // GetReportCountSample.InvokeGetReportCount(service, request); } /************************************************************************ * Uncomment to invoke Get Feed Submission List By Next Token Action ***********************************************************************/ { //GetFeedSubmissionListByNextTokenRequest request = new GetFeedSubmissionListByNextTokenRequest(); //request.Merchant = merchantId; //request.Marketplace = marketplaceId; //request.NextToken = "NextToken from GetFeedSubmissionList"; // @TODO: set additional request parameters here //GetFeedSubmissionListByNextTokenSample.InvokeGetFeedSubmissionListByNextToken(service, request); } /************************************************************************ * Uncomment to invoke Cancel Feed Submissions Action ***********************************************************************/ { //CancelFeedSubmissionsRequest request = new CancelFeedSubmissionsRequest(); //request.Merchant = merchantId; //request.Marketplace = marketplaceId; // @TODO: set additional request parameters here //CancelFeedSubmissionsSample.InvokeCancelFeedSubmissions(service, request); } /************************************************************************ * Uncomment to invoke Request Report Action ***********************************************************************/ { //RequestReportRequest request = new RequestReportRequest(); //request.Merchant = merchantId; //request.Marketplace = marketplaceId; //request.ReportType = "Desired Report Type"; // @TODO: set additional request parameters here //RequestReportSample.InvokeRequestReport(service, request); } /************************************************************************ * Uncomment to invoke Get Feed Submission Count Action ***********************************************************************/ { //GetFeedSubmissionCountRequest request = new GetFeedSubmissionCountRequest(); //request.Merchant = merchantId; //request.Marketplace = marketplaceId; // @TODO: set additional request parameters here //GetFeedSubmissionCountSample.InvokeGetFeedSubmissionCount(service, request); } /************************************************************************ * Uncomment to invoke Cancel Report Requests Action ***********************************************************************/ { //CancelReportRequestsRequest request = new CancelReportRequestsRequest(); //request.Merchant = merchantId; //request.Marketplace = marketplaceId; // @TODO: set additional request parameters here //CancelReportRequestsSample.InvokeCancelReportRequests(service, request); } /************************************************************************ * Uncomment to invoke Get Report List Action ***********************************************************************/ { GetReportListRequest request = new GetReportListRequest(); request.Merchant = merchantId; request.Marketplace = marketplaceId; // @TODO: set additional request parameters here GetReportListSample.InvokeGetReportList(service, request); } /************************************************************************ * Uncomment to invoke Get Feed Submission Result Action ***********************************************************************/ { //GetFeedSubmissionResultRequest request = new GetFeedSubmissionResultRequest(); //request.Merchant = merchantId; //request.Marketplace = marketplaceId; // Note that depending on the size of the feed sent in, and the number of errors and warnings, // the result can reach sizes greater than 1GB. For this reason we recommend that you _always_ // program to MWS in a streaming fashion. Otherwise, as your business grows you may silently reach // the in-memory size limit and have to re-work your solution. // NOTE: Due to Content-MD5 validation, the stream must be read/write. //request.FeedSubmissionId = "FEED_SUBMISSION_ID"; //request.FeedSubmissionResult = File.Open("feedSubmissionResult.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite); //GetFeedSubmissionResultSample.InvokeGetFeedSubmissionResult(service, request); } /************************************************************************ * Uncomment to invoke Get Feed Submission List Action ***********************************************************************/ { //GetFeedSubmissionListRequest request = new GetFeedSubmissionListRequest(); //request.Merchant = merchantId; //request.Marketplace = marketplaceId; // @TODO: set additional request parameters here //GetFeedSubmissionListSample.InvokeGetFeedSubmissionList(service, request); } /************************************************************************ * Uncomment to invoke Get Report Request List Action ***********************************************************************/ { //GetReportRequestListRequest request = new GetReportRequestListRequest(); //request.Merchant = merchantId; //request.Marketplace = marketplaceId; // @TODO: set additional request parameters here //GetReportRequestListSample.InvokeGetReportRequestList(service, request); } /************************************************************************ * Uncomment to invoke Get Report Schedule List By Next Token Action ***********************************************************************/ { //GetReportScheduleListByNextTokenRequest request = new GetReportScheduleListByNextTokenRequest(); //request.Merchant = merchantId; //request.Marketplace = marketplaceId; //request.NextToken = "NextToken from GetReportScheduleList"; // @TODO: set additional request parameters here //GetReportScheduleListByNextTokenSample.InvokeGetReportScheduleListByNextToken(service, request); } /************************************************************************ * Uncomment to invoke Get Report List By Next Token Action ***********************************************************************/ { // GetReportListByNextTokenRequest request = new GetReportListByNextTokenRequest(); // request.Merchant = merchantId; // request.Marketplace = marketplaceId; //request.NextToken = "NextToken from GetReportList"; // @TODO: set additional request parameters here // GetReportListByNextTokenSample.InvokeGetReportListByNextToken(service, request); } /************************************************************************ * Uncomment to invoke Manage Report Schedule Action ***********************************************************************/ { //ManageReportScheduleRequest request = new ManageReportScheduleRequest(); //request.Merchant = merchantId; //request.Marketplace = marketplaceId; //request.ReportType = "Report Type"; //request.Schedule = "Schedule"; // @TODO: set additional request parameters here //ManageReportScheduleSample.InvokeManageReportSchedule(service, request); } /************************************************************************ * Uncomment to invoke Get Report Request Count Action ***********************************************************************/ { //GetReportRequestCountRequest request = new GetReportRequestCountRequest(); //request.Merchant = merchantId; //request.Marketplace = marketplaceId; // @TODO: set additional request parameters here //GetReportRequestCountSample.InvokeGetReportRequestCount(service, request); } /************************************************************************ * Uncomment to invoke Get Report Schedule List Action ***********************************************************************/ { //GetReportScheduleListRequest request = new GetReportScheduleListRequest(); //request.Merchant = merchantId; //request.Marketplace = marketplaceId; // @TODO: set additional request parameters here //GetReportScheduleListSample.InvokeGetReportScheduleList(service, request); } Console.WriteLine(); Console.WriteLine("==========================================="); Console.WriteLine("End of output. You can close this window"); Console.WriteLine("==========================================="); System.Threading.Thread.Sleep(50000); }
/// <summary> /// 预览报表列表 /// </summary> /// <param name="enumStr"></param> /// <returns></returns> public GetReportListResponse GetReportList(GetReportListRequest requestDto) { return(MySqlHelper.QueryByPage <GetReportListRequest, GetReportListResponse, GetPhoneListItemDto>(requestDto.SqlStr, requestDto)); }
/// <summary> /// Get Report List /// </summary> /// <param name="request">Get Report List request</param> /// <returns>Get Report List Response from the service</returns> /// <remarks> /// returns a list of reports; by default the most recent ten reports, /// regardless of their acknowledgement status /// /// </remarks> public GetReportListResponse GetReportList(GetReportListRequest request) { return(Invoke <GetReportListResponse>("GetReportListResponse.xml")); }
public List <SettlementReportDataItem> GetSettlementReports(string reportType, string sellerId) { try { MarketplaceWebServiceClient service = new MarketplaceWebServiceClient(accessKeyId, secretAccessKey, applicationName, applicationVersion, config); GetReportListRequest reportListRequest = new GetReportListRequest(); reportListRequest.Merchant = sellerId; reportListRequest.MWSAuthToken = mwsAuthToken; //reportListRequest.ReportRequestIdList = lstRequestID; reportListRequest.ReportTypeList = new TypeList(); reportListRequest.ReportTypeList.Type = new List <string>() { reportType }; var reportList = service.GetReportList(reportListRequest); GetReportListResult reportListResult = reportList.GetReportListResult; //TODO - Implement GetReportsListByNextToken if (reportListResult.ReportInfo.Count > 0) { for (int i = 0; i < reportListResult.ReportInfo.Count; i++) { GetReportRequest reportRequest = new GetReportRequest(); reportRequest.Merchant = sellerId; reportRequest.MWSAuthToken = mwsAuthToken; reportRequest.ReportId = reportListResult.ReportInfo[i].ReportId; string path = Path.Combine(_reportsPath, reportListResult.ReportInfo[i].ReportId + ".xml"); reportRequest.Report = File.Open(path, FileMode.OpenOrCreate, FileAccess.ReadWrite); var report = service.GetReport(reportRequest); } } //if (myListzz.Count > 0) //{ // while (myListzz[0].ReportProcessingStatus.ToString() != "_DONE_") // { // Console.WriteLine("Waiting for Report"); // //Thread.Sleep(61000); // reportRequestListResponse = // service.GetReportRequestList(reportRequestListRequest); // reportRequestListResult = // reportRequestListResponse.GetReportRequestListResult; // myListzz = reportRequestListResult.ReportRequestInfo; // } // if (myListzz[0].GeneratedReportId != null) // { // GetReportRequest reportRequest = new GetReportRequest(); // reportRequest.Merchant = sellerId; // String source = "C:\\myreport.txt"; // reportRequest.ReportId = myListzz[0].GeneratedReportId; // // reportRequest.Report = File.Open(source, FileMode.Create, FileAccess.ReadWrite); // service.GetReport(reportRequest); // } //} } catch (Exception ex) { var msg = ex.Message; } return(null); }