Skip to content

Commit ffa6da2

Browse files
authored
Merge pull request #658 from RakshaChoudhary/UpdateProductReport
2 parents e1a0238 + 0088acd commit ffa6da2

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

Source/FikaAmazonAPI/ReportGeneration/ProductsReport.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace FikaAmazonAPI.ReportGeneration
77
public class ProductsReport
88
{
99
public List<ProductsRow> Data { get; set; } = new List<ProductsRow>();
10-
public ProductsReport(string path, string refNumber, Encoding encoding = default)
10+
public ProductsReport(string path, Encoding encoding = default)
1111
{
1212
if (string.IsNullOrEmpty(path))
1313
return;
@@ -17,7 +17,7 @@ public ProductsReport(string path, string refNumber, Encoding encoding = default
1717
List<ProductsRow> values = new List<ProductsRow>();
1818
foreach (var row in table.Rows)
1919
{
20-
values.Add(ProductsRow.FromRow(row, refNumber));
20+
values.Add(ProductsRow.FromRow(row));
2121
}
2222
Data = values;
2323
}
@@ -144,7 +144,7 @@ public class ProductsRow
144144
public string refNumber { get; set; }
145145
public string MerchantShippingGroup { get; set; }
146146

147-
public static ProductsRow FromRow(TableRow rowData, string refNumber)
147+
public static ProductsRow FromRow(TableRow rowData)
148148
{
149149
var row = new ProductsRow();
150150
row.ItemName = rowData.GetString("item-name");

Source/FikaAmazonAPI/ReportGeneration/ReportManager.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,20 +186,20 @@ private async Task<string> GetInventoryAgingAsync(AmazonConnection amazonConnect
186186
#endregion
187187

188188
#region Products
189-
public List<ProductsRow> GetProducts() =>
190-
Task.Run(() => GetProductsAsync()).ConfigureAwait(false).GetAwaiter().GetResult();
191-
public async Task<List<ProductsRow>> GetProductsAsync()
189+
public List<ProductsRow> GetProducts(List<MarketPlace> marketplaces = null) =>
190+
Task.Run(() => GetProductsAsync(marketplaces)).ConfigureAwait(false).GetAwaiter().GetResult();
191+
public async Task<List<ProductsRow>> GetProductsAsync(List<MarketPlace> marketplaces = null, CancellationToken cancellationToken = default)
192192
{
193-
var path = await GetProductsAsync(_amazonConnection);
194-
ProductsReport report = new ProductsReport(path, _amazonConnection.RefNumber);
193+
var path = await GetProductsAsync(_amazonConnection, marketplaces, cancellationToken);
194+
ProductsReport report = new ProductsReport(path);
195195
return report.Data;
196196
}
197-
private async Task<string> GetProductsAsync(AmazonConnection amazonConnection)
197+
private async Task<string> GetProductsAsync(AmazonConnection amazonConnection, List<MarketPlace> marketplaces = null, CancellationToken cancellationToken = default)
198198
{
199-
return await amazonConnection.Reports.CreateReportAndDownloadFileAsync(ReportTypes.GET_MERCHANT_LISTINGS_ALL_DATA);
199+
return await amazonConnection.Reports.CreateReportAndDownloadFileAsync(ReportTypes.GET_MERCHANT_LISTINGS_ALL_DATA, marketplaces: marketplaces, cancellationToken: cancellationToken);
200200
}
201201
#endregion
202-
202+
203203
#region Categories
204204

205205
public List<CategoriesRow> GetCategories()

Source/FikaAmazonAPI/Services/ReportService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ public async Task<string> CreateReportAndDownloadFileAsync(ReportTypes reportTyp
285285

286286
parameters.marketplaceIds = new MarketplaceIds();
287287

288-
if (marketplaces == null)
288+
if (marketplaces == null || marketplaces.Count() == 0)
289289
{
290290
parameters.marketplaceIds.Add(AmazonCredential.MarketPlace.ID);
291291
}

0 commit comments

Comments
 (0)