|
1 |
| -using System; |
| 1 | +using FikaAmazonAPI.Utils; |
| 2 | +using System; |
2 | 3 | using System.Collections.Generic;
|
3 | 4 | using System.Threading.Tasks;
|
4 | 5 | using static FikaAmazonAPI.Utils.Constants;
|
@@ -250,25 +251,26 @@ private async Task<string> GetOrdersByOrderDateAsync(AmazonConnection amazonConn
|
250 | 251 | return await amazonConnection.Reports.CreateReportAndDownloadFileAsync(ReportTypes.GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL, fromDate, toDate);
|
251 | 252 | }
|
252 | 253 |
|
253 |
| - public List<OrderInvoicingReportRow> GetOrderInvoicingData(DateTime fromDate, DateTime toDate) => |
254 |
| - Task.Run(() => GetOrderInvoicingDataAsync(fromDate, toDate)).ConfigureAwait(false).GetAwaiter().GetResult(); |
255 |
| - public async Task<List<OrderInvoicingReportRow>> GetOrderInvoicingDataAsync(DateTime fromDate, DateTime toDate) |
| 254 | + public List<OrderInvoicingReportRow> GetOrderInvoicingData(DateTime fromDate, DateTime toDate, List<MarketPlace> marketplaces = null) => |
| 255 | + Task.Run(() => GetOrderInvoicingDataAsync(fromDate, toDate, marketplaces)).ConfigureAwait(false).GetAwaiter().GetResult(); |
| 256 | + public async Task<List<OrderInvoicingReportRow>> GetOrderInvoicingDataAsync(DateTime fromDate, DateTime toDate, List<MarketPlace> marketplaces = null) |
256 | 257 | {
|
257 | 258 | List<OrderInvoicingReportRow> list = new List<OrderInvoicingReportRow>();
|
258 | 259 | var dateList = ReportDateRange.GetDateRange(fromDate, toDate, DAY_30);
|
259 | 260 | foreach (var range in dateList)
|
260 | 261 | {
|
261 |
| - var path = await GetOrderInvoicingDataAsync(_amazonConnection, range.StartDate, range.EndDate); |
| 262 | + var path = await GetOrderInvoicingDataAsync(_amazonConnection, range.StartDate, range.EndDate, marketplaces); |
262 | 263 | OrderInvoicingReport report = new OrderInvoicingReport(path, _amazonConnection.RefNumber);
|
263 | 264 | list.AddRange(report.Data);
|
264 | 265 | }
|
265 | 266 | return list;
|
266 | 267 | }
|
267 |
| - private async Task<string> GetOrderInvoicingDataAsync(AmazonConnection amazonConnection, DateTime fromDate, DateTime toDate) |
| 268 | + |
| 269 | + private async Task<string> GetOrderInvoicingDataAsync(AmazonConnection amazonConnection, DateTime fromDate, DateTime toDate, List<MarketPlace> marketplaces = null) |
268 | 270 | {
|
269 | 271 | var options = new AmazonSpApiSDK.Models.Reports.ReportOptions();
|
270 | 272 | options.Add("ShowSalesChannel", "true");
|
271 |
| - return await amazonConnection.Reports.CreateReportAndDownloadFileAsync(ReportTypes.GET_FLAT_FILE_ORDER_REPORT_DATA_INVOICING, fromDate, toDate, options, false); |
| 273 | + return await amazonConnection.Reports.CreateReportAndDownloadFileAsync(ReportTypes.GET_FLAT_FILE_ORDER_REPORT_DATA_INVOICING, fromDate, toDate, options, false, marketplaces); |
272 | 274 | }
|
273 | 275 | #endregion
|
274 | 276 |
|
|
0 commit comments