diff --git a/.gitignore b/.gitignore index a1d078e..146d1c1 100644 --- a/.gitignore +++ b/.gitignore @@ -262,4 +262,5 @@ paket-files/ # Python Tools for Visual Studio (PTVS) __pycache__/ -*.pyc \ No newline at end of file +*.pyc +/src/bnhtrade.ScheduledTasks/app.local.config diff --git a/src/bnhtrade.ComTypeLib/Product/Product.cs b/src/bnhtrade.ComTypeLib/Product/Product.cs index 452abb7..a9f0b9a 100644 --- a/src/bnhtrade.ComTypeLib/Product/Product.cs +++ b/src/bnhtrade.ComTypeLib/Product/Product.cs @@ -61,7 +61,7 @@ namespace bnhtrade.ComTypeLib public void ProductUpdateAmazonEstimateFee(ConnectionCredential sqlConnCred, object inputList) { // get com object in string array - var inputTuple = new List<(string asin, decimal priceToEstimate)>(); + var inputTuple = new Dictionary(); var getArray = new Utility.LoadComObjextIntoStringArray(); string[] stringArray = getArray.LoadComObjectIntoStringArray(inputList); @@ -72,8 +72,7 @@ namespace bnhtrade.ComTypeLib { throw new Exception("Split function failed on line: " + item); } - var tempTuple = (split[0], decimal.Parse(split[1])); - inputTuple.Add(tempTuple); + inputTuple.Add(split[0], decimal.Parse(split[1])); } new Core.Logic.Product.AmazonEstimateFee().UpdateDatabase(inputTuple); diff --git a/src/bnhtrade.ComTypeLib/bnhtrade.ComTypeLib.csproj b/src/bnhtrade.ComTypeLib/bnhtrade.ComTypeLib.csproj index 60a247a..db8b23e 100644 --- a/src/bnhtrade.ComTypeLib/bnhtrade.ComTypeLib.csproj +++ b/src/bnhtrade.ComTypeLib/bnhtrade.ComTypeLib.csproj @@ -68,12 +68,6 @@ - - - {339d7413-3da7-46ea-a55c-255a9a6b95eb} - bnhtrade.Core - - diff --git a/src/bnhtrade.Core/Data/AmazonMWS/Product/GetMyFeeEstimate.cs b/src/bnhtrade.Core/Data/AmazonMWS/Product/GetMyFeeEstimate.cs new file mode 100644 index 0000000..82d69f0 --- /dev/null +++ b/src/bnhtrade.Core/Data/AmazonMWS/Product/GetMyFeeEstimate.cs @@ -0,0 +1,88 @@ +using MarketplaceWebServiceProducts.Model; +using System; +using System.Collections.Generic; +using System.Threading; + +namespace bnhtrade.Core.Data.AmazonMWS.Product +{ + public class GetMyFeeEstimate + { + public List GetProductEstimateFee(FeesEstimateRequestList requestList) + { + var returnList = new List(); + if (requestList == null || !requestList.IsSetFeesEstimateRequest()) + { + return returnList; + } + else if (returnList.Count > 20) + { + throw new Exception("Max number of FeesEstimateRequest in one request is 20"); + } + + CredentialMws cred = new CredentialMws(); + var mwsProduct = new Data.AmazonMWS.Service();// AmazonMwsProduct(); + MarketplaceWebServiceProducts.MarketplaceWebServiceProducts service = mwsProduct.MarketplaceProducts(); + + // Create a request. + GetMyFeesEstimateRequest request = new GetMyFeesEstimateRequest(); + request.SellerId = cred.MerchantId; + request.MWSAuthToken = "example"; + //FeesEstimateRequestList requestList = new FeesEstimateRequestList(); + + //foreach (var item in itemList) + //{ + // string idType; + // if (item.IdValueIsAsin) { idType = "ASIN"; } + // else { idType = "SellerSku"; } + + // requestList.FeesEstimateRequest.Add(new FeesEstimateRequest + // { + // MarketplaceId = item.marketPlaceId, + // IdType = idType, + // IdValue = item.IdValue, + // PriceToEstimateFees = new PriceToEstimateFees + // { + // ListingPrice = new MoneyType { Amount = item.listingPrice, CurrencyCode = item.currencyCode }, + // //Shipping = new MoneyType { Amount = 3.5M, CurrencyCode = "GBP" }, + // //Points = new Points { PointsNumber = 0 } + // }, + // Identifier = "request_" + Guid.NewGuid().ToString(), + // IsAmazonFulfilled = true + // }); + //} + request.FeesEstimateRequestList = requestList; + + // define the list + GetMyFeesEstimateResult result = new GetMyFeesEstimateResult(); + //List resultList = new List(); + + try + { + int count = 0; + do + { + GetMyFeesEstimateResponse response = service.GetMyFeesEstimate(request); + if (response.IsSetGetMyFeesEstimateResult()) + { + result = response.GetMyFeesEstimateResult; + FeesEstimateResultList resultList = result.FeesEstimateResultList; + + List fees = resultList.FeesEstimateResult; + + return fees; + } + else + { + Thread.Sleep(500); + count++; + } + } while (count < 60); // 30 second timout + throw new Exception("Response timeout"); + } + catch + { + throw; + } + } + } +} diff --git a/src/bnhtrade.Core/Data/Database/Account/ReadTaxCode.cs b/src/bnhtrade.Core/Data/Database/Account/ReadTaxCode.cs index 2606a4e..6dc52ca 100644 --- a/src/bnhtrade.Core/Data/Database/Account/ReadTaxCode.cs +++ b/src/bnhtrade.Core/Data/Database/Account/ReadTaxCode.cs @@ -93,6 +93,8 @@ namespace bnhtrade.Core.Data.Database.Account return resultList; } + taxcodeList = taxcodeList.Distinct().ToList(); + whereBuilder.Innit(); whereBuilder.In("TaxCode", taxcodeList, "WHERE"); @@ -118,6 +120,8 @@ namespace bnhtrade.Core.Data.Database.Account return resultList; } + skuNumberList = skuNumberList.Distinct().ToList(); + string sql = @" SELECT tblSku.skuSkuNumber ,tblAccountTaxCode.TaxCode @@ -167,6 +171,8 @@ namespace bnhtrade.Core.Data.Database.Account return resultList; } + lineItemCode = lineItemCode.Distinct().ToList(); + string sql = @" SELECT tblAccountInvoiceLineItem.ItemCode ,tblAccountTaxCode.TaxCode diff --git a/src/bnhtrade.Core/Data/Database/Constants.cs b/src/bnhtrade.Core/Data/Database/Constants.cs index 73011f4..9f02df3 100644 --- a/src/bnhtrade.Core/Data/Database/Constants.cs +++ b/src/bnhtrade.Core/Data/Database/Constants.cs @@ -33,9 +33,28 @@ namespace bnhtrade.Core.Data.Database return "Amazon.co.uk"; } - public static int GetProductConditionIdNew() + /// + /// Returns the sql table ID for a condition type + /// + public enum SkuCondition { - return 10; + New = 10, + LikeNew = 11, + VeryGood = 12, + Good = 13, + Acceptable = 14, + // add the rest as needed + } + + /// + /// Returns the sql table ID for a stock status type + /// + public enum StockStatusType + { + FbaInventoryActive = 3, + FbaShipment = 4, + FbaShippingPlan = 5, + // add the rest as needed } } } diff --git a/src/bnhtrade.Core/Data/Database/Product/ReadProduct.cs b/src/bnhtrade.Core/Data/Database/Product/ReadProduct.cs index 8c3a6ff..60db15a 100644 --- a/src/bnhtrade.Core/Data/Database/Product/ReadProduct.cs +++ b/src/bnhtrade.Core/Data/Database/Product/ReadProduct.cs @@ -11,6 +11,7 @@ namespace bnhtrade.Core.Data.Database.Product { private List filterByAsin; private List filterByProductId; + private Data.Database.SqlWhereBuilder sqlWhereBuilder = new SqlWhereBuilder(); public ReadProduct() { @@ -157,6 +158,7 @@ namespace bnhtrade.Core.Data.Database.Product } } } + return returnList; } diff --git a/src/bnhtrade.Core/Data/Database/Product/UpdateAmazonFeeEstimate.cs b/src/bnhtrade.Core/Data/Database/Product/UpdateAmazonFeeEstimate.cs new file mode 100644 index 0000000..16ebc4b --- /dev/null +++ b/src/bnhtrade.Core/Data/Database/Product/UpdateAmazonFeeEstimate.cs @@ -0,0 +1,130 @@ +using MarketplaceWebServiceProducts.Model; +using System; +using System.Collections.Generic; +using System.Data.SqlClient; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace bnhtrade.Core.Data.Database.Product +{ + public class UpdateAmazonFeeEstimate : Connection + { + public UpdateAmazonFeeEstimate(string sqlConnectionString) : base(sqlConnectionString) + { + } + + public void ByFeesEstimateResult(FeesEstimateResult updateItem) + { + ByFeesEstimateResult(new List { updateItem }); + } + + public void ByFeesEstimateResult(List updateList) + { + foreach (var item in updateList) + { + bool isSellerSku = false; + if (item.FeesEstimateIdentifier.IdType == "SellerSKU") + { + isSellerSku = true; + } + else if (item.FeesEstimateIdentifier.IdType != "ASIN") + { + // Amazon have updated API to include other identifiers? + throw new Exception( + "New FeesEstimateIdentifier encountered/unsupported of type '" + item.FeesEstimateIdentifier + "'."); + } + + string asin = item.FeesEstimateIdentifier.IdValue; + bool isAmazonFulfilled = item.FeesEstimateIdentifier.IsAmazonFulfilled; + DateTime timeOfFeeEstimation = item.FeesEstimate.TimeOfFeesEstimation; + decimal totalFeeEstimate = item.FeesEstimate.TotalFeesEstimate.Amount; + string currencyCode = item.FeesEstimate.TotalFeesEstimate.CurrencyCode; + decimal priceToEstimateFeeListingPrice = item.FeesEstimateIdentifier.PriceToEstimateFees.ListingPrice.Amount; + decimal priceToEstimateFeeShipping = 0; + if (item.FeesEstimateIdentifier.PriceToEstimateFees.Shipping != null) + { priceToEstimateFeeShipping = item.FeesEstimateIdentifier.PriceToEstimateFees.Shipping.Amount; } + decimal priceToEstimateFeePoints = 0; + if (item.FeesEstimateIdentifier.PriceToEstimateFees.Points != null) + { priceToEstimateFeePoints = item.FeesEstimateIdentifier.PriceToEstimateFees.Points.PointsMonetaryValue.Amount; } + + decimal referralFee = 0m; + decimal variableClosingFee = 0m; + decimal fulfillmentFees = 0m; + decimal perItemFee = 0m; + decimal otherFee_Exception = 0m; + + FeeDetailList feeDetailList = item.FeesEstimate.FeeDetailList; + List feeDetail = feeDetailList.FeeDetail; + foreach (FeeDetail feeDetailItem in feeDetail) + { + if (feeDetailItem.FeeType == "AmazonReferralFee" || feeDetailItem.FeeType == "ReferralFee") + { referralFee = feeDetailItem.FinalFee.Amount; } + else if (feeDetailItem.FeeType == "VariableClosingFee") + { variableClosingFee = feeDetailItem.FinalFee.Amount; } + else if (feeDetailItem.FeeType == "PerItemFee") + { perItemFee = feeDetailItem.FinalFee.Amount; } + else if (feeDetailItem.FeeType == "FBAFees" || feeDetailItem.FeeType == "FulfillmentFees") + { fulfillmentFees = feeDetailItem.FinalFee.Amount; } + else + { otherFee_Exception = otherFee_Exception + feeDetailItem.FinalFee.Amount; } + + } + + // build sql statement + string sqlProductId; + if (isSellerSku) + { + sqlProductId = "(SELECT tblSku.skuProductID FROM tblSku INNER JOIN tblProduct ON tblSku.skuProductID = tblProduct.prdProductID WHERE tblProduct.prdAmazonASIN = @asin)"; + } + else + { + sqlProductId = "(SELECT prdProductID FROM tblProduct WHERE prdAmazonASIN = @asin)"; + } + + string sql = @" + UPDATE tblAmazonFeeEstimate SET + IsAmazonFulfilled=@isAmazonFulfilled, TimeOfFeeEstimation=@timeOfFeeEstimation, + TotalFeeEstimate=@totalFeeEstimate, PriceToEstimateFeeListingPrice=@priceToEstimateFeeListingPrice, + PriceToEstimateFeeShipping=@priceToEstimateFeeShipping, PriceToEstimateFeePoints=@priceToEstimateFeePoints, + ReferralFee=@referralFee, VariableClosingFee=@variableClosingFee, PerItemFee=@perItemFee, FBAFee=@fbaFee, + OtherFee_Exception=@otherFee_Exception, currencyCode=CurrencyCode + WHERE ProductID = " + sqlProductId + @" + IF @@ROWCOUNT = 0 + INSERT INTO tblAmazonFeeEstimate ( + ProductID, IsAmazonFulfilled, TimeOfFeeEstimation, TotalFeeEstimate, PriceToEstimateFeeListingPrice, + PriceToEstimateFeeShipping, PriceToEstimateFeePoints, ReferralFee, VariableClosingFee, PerItemFee, FBAFee, + OtherFee_Exception, CurrencyCode + ) VALUES ( + " + sqlProductId + @", @isAmazonFulfilled, @timeOfFeeEstimation, @totalFeeEstimate, @priceToEstimateFeeListingPrice, + @priceToEstimateFeeShipping, @priceToEstimateFeePoints, @referralFee, @variableClosingFee, @perItemFee, @fbaFee, + @otherFee_Exception, @currencyCode + ) + "; + + using (SqlConnection sqlConn = new SqlConnection(sqlConnectionString)) + { + sqlConn.Open(); + using (SqlCommand sqlCommand = new SqlCommand(sql, sqlConn)) + { + sqlCommand.Parameters.AddWithValue("@asin", asin); + sqlCommand.Parameters.AddWithValue("@isAmazonFulfilled", isAmazonFulfilled); + sqlCommand.Parameters.AddWithValue("@timeOfFeeEstimation", timeOfFeeEstimation); + sqlCommand.Parameters.AddWithValue("@totalFeeEstimate", totalFeeEstimate); + sqlCommand.Parameters.AddWithValue("@priceToEstimateFeeListingPrice", priceToEstimateFeeListingPrice); + sqlCommand.Parameters.AddWithValue("@priceToEstimateFeeShipping", priceToEstimateFeeShipping); + sqlCommand.Parameters.AddWithValue("@priceToEstimateFeePoints", priceToEstimateFeePoints); + sqlCommand.Parameters.AddWithValue("@referralFee", referralFee); + sqlCommand.Parameters.AddWithValue("@variableClosingFee", variableClosingFee); + sqlCommand.Parameters.AddWithValue("@perItemFee", perItemFee); + sqlCommand.Parameters.AddWithValue("@fbaFee", fulfillmentFees); + sqlCommand.Parameters.AddWithValue("@otherFee_Exception", otherFee_Exception); + sqlCommand.Parameters.AddWithValue("@currencyCode", currencyCode); + + sqlCommand.ExecuteNonQuery(); + } + } + } + } + } +} diff --git a/src/bnhtrade.Core/Data/Database/SqlWhereBuilder.cs b/src/bnhtrade.Core/Data/Database/SqlWhereBuilder.cs index 4c63918..502cc8b 100644 --- a/src/bnhtrade.Core/Data/Database/SqlWhereBuilder.cs +++ b/src/bnhtrade.Core/Data/Database/SqlWhereBuilder.cs @@ -50,6 +50,8 @@ namespace bnhtrade.Core.Data.Database return; } + var distinctList = orValueList.Distinct().ToList(); + string sqlWhere = @" "; @@ -61,7 +63,7 @@ namespace bnhtrade.Core.Data.Database sqlWhere += " " + columnReference + " IN ( "; var paramters = new Dictionary(); - int listCount = orValueList.Count(); + int listCount = distinctList.Count(); for (int i = 0; i < listCount; i++, parameterCount++) { if (i > 0) @@ -71,7 +73,7 @@ namespace bnhtrade.Core.Data.Database string param = "@parameter" + parameterCount; sqlWhere += param; - paramters.Add(param, orValueList[i]); + paramters.Add(param, distinctList[i]); } sqlWhere += " )"; diff --git a/src/bnhtrade.Core/Logic/Export/AmazonSubmitFile.cs b/src/bnhtrade.Core/Logic/Export/AmazonSubmitFile.cs index 7e5890e..0963170 100644 --- a/src/bnhtrade.Core/Logic/Export/AmazonSubmitFile.cs +++ b/src/bnhtrade.Core/Logic/Export/AmazonSubmitFile.cs @@ -12,13 +12,11 @@ namespace bnhtrade.Core.Logic.Export { public class AmazonSubmitFile { - private string sqlConnectionString; private Logic.Utilities.StringCheck stringCheck = new Logic.Utilities.StringCheck(); private Log.LogEvent log = new Log.LogEvent(); - public AmazonSubmitFile(string sqlConnectionString) + public AmazonSubmitFile() { - this.sqlConnectionString = sqlConnectionString; } public void SubmitInventoryLoader(MemoryStream stream) diff --git a/src/bnhtrade.Core/Logic/Product/GetCompetitivePrice.cs b/src/bnhtrade.Core/Logic/Product/GetCompetitivePrice.cs index ce09983..e931420 100644 --- a/src/bnhtrade.Core/Logic/Product/GetCompetitivePrice.cs +++ b/src/bnhtrade.Core/Logic/Product/GetCompetitivePrice.cs @@ -9,17 +9,29 @@ namespace bnhtrade.Core.Logic.Product public class GetCompetitivePrice { private Dictionary competitivePrices; - private int newConditionId = Data.Database.Constants.GetProductConditionIdNew(); - private string sqlConnectionString; + private int newConditionId = (int)Data.Database.Constants.SkuCondition.New; private Data.Database.Product.ReadCompetitivePrice read; private List productIdList; private List conditionIdList; private Data.Database.Product.ReadCompetitivePrice dbRead; private Dictionary newConditionMultipier; - public GetCompetitivePrice(string sqlConnectionString) + public GetCompetitivePrice() { - this.sqlConnectionString = sqlConnectionString; + // was poart of a fba repricing feature, that, for now, is being abandoned + throw new NotImplementedException(); + + + + + + + + + + + + dbRead = new Data.Database.Product.ReadCompetitivePrice(); newConditionMultipier = new Dictionary(); } diff --git a/src/bnhtrade.Core/Logic/Sku/GetSkuInfo.cs b/src/bnhtrade.Core/Logic/Sku/GetSkuInfo.cs index fd9c102..4129443 100644 --- a/src/bnhtrade.Core/Logic/Sku/GetSkuInfo.cs +++ b/src/bnhtrade.Core/Logic/Sku/GetSkuInfo.cs @@ -8,15 +8,13 @@ namespace bnhtrade.Core.Logic.Sku { public class GetSkuInfo { - private string sqlConnectionString; private Data.Database.Sku.ReadSku dbSkuInfo; private Logic.Product.GetProductInfo getProductInfo; private Logic.Sku.GetSkuConditionInfo getConditionInfo; private Logic.Account.GetTaxCodeInfo getTaxCodeInfo; - public GetSkuInfo(string sqlConnection) + public GetSkuInfo() { - this.sqlConnectionString = sqlConnection; Init(); } diff --git a/src/bnhtrade.Core/Logic/Sku/Price/FbaPricing.cs b/src/bnhtrade.Core/Logic/Sku/Price/FbaPricing.cs index 081fcac..7c20b9f 100644 --- a/src/bnhtrade.Core/Logic/Sku/Price/FbaPricing.cs +++ b/src/bnhtrade.Core/Logic/Sku/Price/FbaPricing.cs @@ -13,11 +13,10 @@ namespace bnhtrade.Core.Logic.Sku.Price { public class FbaPricing { - private string sqlConnectionString; private bnhtrade.Core.Logic.Log.LogEvent log = new Log.LogEvent(); string err = "FbaPricing Error: "; private string marginSchemeTaxCode = Data.Database.Constants.GetMarginSchemeTaxCode(); - private int newConditionId = Data.Database.Constants.GetProductConditionIdNew(); + private int newConditionId = (int)Data.Database.Constants.SkuCondition.New; private List skuInfo; private Dictionary competitivePrices; DateTime newTimeStamp = DateTime.UtcNow; @@ -28,7 +27,25 @@ namespace bnhtrade.Core.Logic.Sku.Price public FbaPricing(string sqlConnectionString) { - this.sqlConnectionString = sqlConnectionString; + // was part of a fba repricing feature, that, for now, is being abandoned + throw new NotImplementedException(); + + + + + + + + + + + + + + + + + taxCalc = new Account.TaxCalculation(); newTimeStamp = DateTime.UtcNow; marginSchemeMargin = taxCalc.GetMarginMultiplier(newTimeStamp); @@ -45,11 +62,14 @@ namespace bnhtrade.Core.Logic.Sku.Price string orderChannel = Data.Database.Constants.GetOrderChannelAmazonUk(); ; // may in future enable other order channels // get SKU quantities in stock on FBA - var statusTypeList = new List { 3, 4 }; + var statusTypeList = new List(); + statusTypeList.Add((int)Data.Database.Constants.StockStatusType.FbaInventoryActive); + statusTypeList.Add((int)Data.Database.Constants.StockStatusType.FbaShipment); + var fbaSkuStock = new Logic.Stock.GetStatusTypeBalance().BySku(statusTypeList); // retrive SKU info - var getSku = new Logic.Sku.GetSkuInfo(sqlConnectionString); + var getSku = new Logic.Sku.GetSkuInfo(); var skuInfoDict = getSku.ConvertToDictionary(getSku.BySkuNumber(fbaSkuStock.Keys.ToList())); @@ -65,7 +85,7 @@ namespace bnhtrade.Core.Logic.Sku.Price - // get current sku base pricing details (stock quantity, competative price, VAT info, etc.) + // pull current sku base pricing details (stock quantity, competative price, VAT info, etc.) from the database skuInfo = new Data.Database.Sku.Price.ReadParameter().Execute(); if (skuInfo == null || !skuInfo.Any()) { @@ -78,18 +98,18 @@ namespace bnhtrade.Core.Logic.Sku.Price var loader = new List(); var crDictionary = new Dictionary(); - // open needed classes + // instanlise needed classes var readAge = new Data.Database.Import.AmazonFbaInventoryAgeRead(); - // get current db pricing + // get current pricing from database var dbDictionary = new Data.Database.Sku.Price.ReadPricingDetail().ReadDictionary(skuInfo.Select(o => o.SkuNumber).ToList(), orderChannel); // get required competivie prices - var readComp = new Logic.Product.GetCompetitivePrice(sqlConnectionString); + var readComp = new Logic.Product.GetCompetitivePrice(); readComp.EstimatePrice = true; var compPrices = readComp.Execute(skuInfo); - // loop through skus returnd from stock query + // loop through sku pricing returned from database for (int i = 0; i < skuInfo.Count(); i++) { var existing = skuInfo[i]; @@ -122,7 +142,7 @@ namespace bnhtrade.Core.Logic.Sku.Price cr.InventoryAgeMax = invAge.Value.MaxAge; // get minimum prices - cr.UnitMinPriceCost = GetMinPriceCost(i); + cr.UnitMinPriceCost = GetPriceBreakEven(i); cr.UnitMinPriceProfit = GetMinPriceProfit(i); cr.UnitPurchaseCost = skuInfo[i].UnitCostAverage; @@ -224,12 +244,17 @@ namespace bnhtrade.Core.Logic.Sku.Price } } + private Dictionary GetSkuPricingInfo() + { + throw new NotImplementedException(); + } + /// /// Get the minimum sale price to break even. /// /// /// - private decimal GetMinPriceCost(int i) + private decimal GetPriceBreakEven(int i) { decimal costPrice = skuInfo[i].UnitCostAverage; decimal agentFeeFixed = skuInfo[i].AgentFeeFixed; @@ -353,7 +378,7 @@ namespace bnhtrade.Core.Logic.Sku.Price lastPriceUpdate = new DateTime(lastPriceUpdate.Year, lastPriceUpdate.Month, lastPriceUpdate.Day); DateTime today = new DateTime(newTimeStamp.Year, newTimeStamp.Month, newTimeStamp.Day); - // will only update once on tue, wed or thurs each week. + // will only update once on tue, wed or thurs each week. <------- Why??? don't know what my reasoning was for this if (today.DayOfWeek == DayOfWeek.Tuesday || today.DayOfWeek == DayOfWeek.Wednesday || today.DayOfWeek == DayOfWeek.Thursday) { if (today > lastPriceUpdate.AddDays(3)) @@ -432,8 +457,8 @@ namespace bnhtrade.Core.Logic.Sku.Price csv.WriteRecords(exportList); } - // submit file to database and amazon mws - var submit = new Logic.Export.AmazonSubmitFile(sqlConnectionString); + // submit file to database and amazon + var submit = new Logic.Export.AmazonSubmitFile(); return; // remove after testing diff --git a/src/bnhtrade.Core/Model/Sku/Price/SkuPriceParameter.cs b/src/bnhtrade.Core/Model/SKU/Price/SkuPriceParameter.cs similarity index 99% rename from src/bnhtrade.Core/Model/Sku/Price/SkuPriceParameter.cs rename to src/bnhtrade.Core/Model/SKU/Price/SkuPriceParameter.cs index 987feea..cff9873 100644 --- a/src/bnhtrade.Core/Model/Sku/Price/SkuPriceParameter.cs +++ b/src/bnhtrade.Core/Model/SKU/Price/SkuPriceParameter.cs @@ -50,4 +50,4 @@ namespace bnhtrade.Core.Model.Sku.Price public decimal PriceMinProfit { get; set; } } -} +} \ No newline at end of file diff --git a/src/bnhtrade.Core/Logic/Sku/Price/SkuRepriceInfo.cs b/src/bnhtrade.Core/Model/SKU/Price/SkuRepriceInfo.cs similarity index 99% rename from src/bnhtrade.Core/Logic/Sku/Price/SkuRepriceInfo.cs rename to src/bnhtrade.Core/Model/SKU/Price/SkuRepriceInfo.cs index 2db80d2..3e608f2 100644 --- a/src/bnhtrade.Core/Logic/Sku/Price/SkuRepriceInfo.cs +++ b/src/bnhtrade.Core/Model/SKU/Price/SkuRepriceInfo.cs @@ -50,4 +50,4 @@ namespace bnhtrade.Core.Model.Sku.Price public decimal PriceMinProfit { get; set; } } -} \ No newline at end of file +} diff --git a/src/bnhtrade.Core/Test/AmazonMWS/Report.cs b/src/bnhtrade.Core/Test/AmazonMWS/Report.cs new file mode 100644 index 0000000..c67c3d5 --- /dev/null +++ b/src/bnhtrade.Core/Test/AmazonMWS/Report.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace bnhtrade.Core.Test.AmazonMWS +{ + public class Report + { + private string sqlConnectionString; + public Report(string sqlConnectionString) + { + this.sqlConnectionString = sqlConnectionString; + + // method you want to start here + GetRport(); + + } + public void GetRport() + { + string mwsReportEnum = "_GET_FBA_FULFILLMENT_INVENTORY_RECEIPTS_DATA_"; + DateTime start = new DateTime(2020, 10, 01); + DateTime finish = new DateTime(2020, 11, 03); + var result = new bnhtrade.Core.AmazonReport().GetMwsReportByPeriod(mwsReportEnum, start, finish, 12, 30); + } + } +} diff --git a/src/bnhtrade.Core/Test/Export/Export.cs b/src/bnhtrade.Core/Test/Export/Export.cs index 2918851..21db05b 100644 --- a/src/bnhtrade.Core/Test/Export/Export.cs +++ b/src/bnhtrade.Core/Test/Export/Export.cs @@ -24,7 +24,7 @@ namespace bnhtrade.Core.Test.Export var memStream = new MemoryStream(); filestream.CopyTo(memStream); - var logicBit = new Core.Logic.Export.AmazonSubmitFile(sqlConnectionString); + var logicBit = new Core.Logic.Export.AmazonSubmitFile(); logicBit.SubmitInventoryLoader(memStream); } diff --git a/src/bnhtrade.Core/Test/Sku/Sku.cs b/src/bnhtrade.Core/Test/Sku/Sku.cs index 9fa378b..b7701f0 100644 --- a/src/bnhtrade.Core/Test/Sku/Sku.cs +++ b/src/bnhtrade.Core/Test/Sku/Sku.cs @@ -15,7 +15,7 @@ namespace bnhtrade.Core.Test.Sku this.sqlConnectionString = sqlConnectionString; // method you want to start here - UpdateFbaPricing(); + GetSkuInfo(); } @@ -24,5 +24,14 @@ namespace bnhtrade.Core.Test.Sku var instance = new bnhtrade.Core.Logic.Sku.Price.FbaPricing(sqlConnectionString); instance.Update(); } + + public void GetSkuInfo() + { + var inst = new bnhtrade.Core.Logic.Sku.GetSkuInfo(); + inst.IncludeConditionInfo = true; + inst.IncludeProductInfo = true; + inst.IncludeTaxCodeInfo = true; + var ldskjflkdsa = inst.BySkuNumber("001234-10"); + } } } diff --git a/src/bnhtrade.Core/bnhtrade.Core.csproj b/src/bnhtrade.Core/bnhtrade.Core.csproj index 818edaf..89bc102 100644 --- a/src/bnhtrade.Core/bnhtrade.Core.csproj +++ b/src/bnhtrade.Core/bnhtrade.Core.csproj @@ -222,7 +222,6 @@ - @@ -280,6 +279,7 @@ +