Skip to content

Commit

Permalink
Add support to GET_FBA_MYI_UNSUPPRESSED_INVENTORY_DATA inreport manager
Browse files Browse the repository at this point in the history
  • Loading branch information
abuzuhri committed Apr 22, 2024
1 parent 21a01e6 commit 3e7b510
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ var returnFBAOrder = reportManager.GetReturnFBAOrder(90); //GET_FBA_FULFILLMENT_
var reimbursementsOrder = reportManager.GetReimbursementsOrder(180); //GET_FBA_REIMBURSEMENTS_DATA
var feedbacks = reportManager.GetFeedbackFromDays(180); //GET_SELLER_FEEDBACK_DATA
var LedgerDetails = reportManager.GetLedgerDetailAsync(10); //GET_LEDGER_DETAIL_VIEW_DATA
var UnsuppressedInventory = reportManager.GetUnsuppressedInventoryDataAsync().ConfigureAwait(false).GetAwaiter().GetResult(); //GET_FBA_MYI_UNSUPPRESSED_INVENTORY_DATA
```


Expand Down
6 changes: 1 addition & 5 deletions Source/FikaAmazonAPI.SampleCode/ReportManagerSample.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using FikaAmazonAPI.ReportGeneration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FikaAmazonAPI.SampleCode
{
Expand All @@ -28,6 +23,7 @@ public void CallReport()
var returnFBAOrder = reportManager.GetReturnFBAOrder(90); //GET_FBA_FULFILLMENT_CUSTOMER_RETURNS_DATA
var reimbursementsOrder = reportManager.GetReimbursementsOrder(180); //GET_FBA_REIMBURSEMENTS_DATA
var feedbacks = reportManager.GetFeedbackFromDays(180); //GET_SELLER_FEEDBACK_DATA
var UnsuppressedInventory = reportManager.GetUnsuppressedInventoryDataAsync().ConfigureAwait(false).GetAwaiter().GetResult(); //GET_FBA_MYI_UNSUPPRESSED_INVENTORY_DATA
}
}
}
14 changes: 14 additions & 0 deletions Source/FikaAmazonAPI/ReportGeneration/ReportManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,20 @@ private async Task<IList<string>> GetSettlementOrderAsync(AmazonConnection amazo
}
#endregion


#region GetUnsuppressedInventoryData
public async Task<List<UnsuppressedInventoryDataRow>> GetUnsuppressedInventoryDataAsync()
{
var path = await GetUnsuppressedInventoryDatayAsync(_amazonConnection);
var report = new UnsuppressedInventoryDataReport(path, _amazonConnection.RefNumber);
return report.Data;
}
private async Task<string> GetUnsuppressedInventoryDatayAsync(AmazonConnection amazonConnection)
{
return await amazonConnection.Reports.CreateReportAndDownloadFileAsync(ReportTypes.GET_FBA_MYI_UNSUPPRESSED_INVENTORY_DATA);
}
#endregion

#region GetInventoryQty
public async Task<List<ProductAFNInventoryRow>> GetAFNInventoryQtyAsync()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using FikaAmazonAPI.ReportGeneration.ReportDataTable;
using System.Collections.Generic;

namespace FikaAmazonAPI.ReportGeneration
{
public class UnsuppressedInventoryDataReport
{
public List<UnsuppressedInventoryDataRow> Data { get; set; } = new List<UnsuppressedInventoryDataRow>();

public UnsuppressedInventoryDataReport(string path, string refNumber)
{
if (string.IsNullOrEmpty(path))
return;

var table = Table.ConvertFromCSV(path);

List<UnsuppressedInventoryDataRow> values = new List<UnsuppressedInventoryDataRow>();
foreach (var row in table.Rows)
{
values.Add(UnsuppressedInventoryDataRow.FromRow(row, refNumber));
}
Data = values;
}
}

public class UnsuppressedInventoryDataRow
{
public string SellerSku { get; set; }
public string FNSKU { get; set; }
public string ASIN { get; set; }
public string ProductName { get; set; }
public string Condition { get; set; }
public decimal? YourPrice { get; set; }
public string MfnListingExists { get; set; }
public int? MfnFulfillableQuantity { get; set; }
public string AfnListingExists { get; set; }
public int? AfnWarehouseQuantity { get; set; }
public int? AfnFulfillableQuantity { get; set; }
public int? AfnUnsellableQuantity { get; set; }
public int? AfnReservedQuantity { get; set; }
public int? AfnTotalQuantity { get; set; }
public decimal? PerUnitVolume { get; set; }
public int? AfnInboundWorkingQuantity { get; set; }
public int? AfnInboundShippedQuantity { get; set; }
public int? AfnInboundReceivingQuantity { get; set; }
public int? AfnResearchingQuantity { get; set; }
public int? AfnReservedFutureSupply { get; set; }
public int? AfnFutureSupplyBuyable { get; set; }
public string refNumber { get; set; }
public static UnsuppressedInventoryDataRow FromRow(TableRow rowData, string refNumber)
{
var row = new UnsuppressedInventoryDataRow();
row.SellerSku = rowData.GetString("sku");
row.FNSKU = rowData.GetString("fnsku");
row.ASIN = rowData.GetString("asin");
row.ProductName = rowData.GetString("product-name");
row.Condition = rowData.GetString("condition");
row.YourPrice = rowData.GetDecimal("your-price");
row.MfnListingExists = rowData.GetString("mfn-listing-exists");
row.MfnFulfillableQuantity = rowData.GetInt32("mfn-fulfillable-quantity");
row.AfnListingExists = rowData.GetString("afn-listing-exists");
row.AfnWarehouseQuantity = rowData.GetInt32("afn-warehouse-quantity");
row.AfnFulfillableQuantity = rowData.GetInt32("afn-fulfillable-quantity");
row.AfnUnsellableQuantity = rowData.GetInt32("afn-unsellable-quantity");
row.AfnReservedQuantity = rowData.GetInt32("afn-reserved-quantity");
row.AfnTotalQuantity = rowData.GetInt32("afn-total-quantity");
row.PerUnitVolume = rowData.GetDecimal("per-unit-volume");
row.AfnInboundWorkingQuantity = rowData.GetInt32("afn-inbound-working-quantity");
row.AfnInboundShippedQuantity = rowData.GetInt32("afn-inbound-shipped-quantity");
row.AfnInboundReceivingQuantity = rowData.GetInt32("afn-inbound-receiving-quantity");
row.AfnResearchingQuantity = rowData.GetInt32("afn-researching-quantity");
row.AfnReservedFutureSupply = rowData.GetInt32("afn-reserved-future-supply");
row.AfnFutureSupplyBuyable = rowData.GetInt32("afn-future-supply-buyable");
row.refNumber = refNumber;

return row;
}
}
}

0 comments on commit 3e7b510

Please sign in to comment.