mirror of
https://github.com/stokebob/bnhtrade.git
synced 2026-03-19 06:27:15 +00:00
Migration from Amazon MWS to Selling Partner API
This commit is contained in:
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.Core.Test.AmazonMWS
|
||||
namespace bnhtrade.Core.Test.Amazon.MWS
|
||||
{
|
||||
public class Report
|
||||
{
|
||||
@@ -22,7 +22,6 @@ namespace bnhtrade.Core.Test.AmazonMWS
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
44
src/bnhtrade.Core/Test/Amazon/SP-API/FulfillmentInboundV0.cs
Normal file
44
src/bnhtrade.Core/Test/Amazon/SP-API/FulfillmentInboundV0.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.Core.Test.Amazon.SP_API
|
||||
{
|
||||
public class FulfillmentInboundV0
|
||||
{
|
||||
|
||||
public FulfillmentInboundV0()
|
||||
{
|
||||
GetShipmentItemsByShipmentId();
|
||||
}
|
||||
|
||||
public void GetShipmentsByDate()
|
||||
{
|
||||
var startDate = DateTime.SpecifyKind(new DateTime(2016, 01, 01), DateTimeKind.Utc);
|
||||
var endDate = DateTime.SpecifyKind(new DateTime(2017, 01, 01), DateTimeKind.Utc);
|
||||
|
||||
var result = new Data.Amazon.FulFillmentInbound.GetShipments().GetByDateRange(startDate, endDate);
|
||||
}
|
||||
public void GetShipmentsByIdList()
|
||||
{
|
||||
var list = new List<string>();
|
||||
list.Add("FBAYGWHR4");
|
||||
var result = new Data.Amazon.FulFillmentInbound.GetShipments().GetByShipmentIdList(list);
|
||||
}
|
||||
public void GetShipmentItemsByDateRange()
|
||||
{
|
||||
var startDate = DateTime.SpecifyKind(new DateTime(2016, 01, 01), DateTimeKind.Utc);
|
||||
var endDate = DateTime.SpecifyKind(new DateTime(2016, 02, 01), DateTimeKind.Utc);
|
||||
|
||||
var result = new Data.Amazon.FulFillmentInbound.GetShipmentItems().GetByDateRange(startDate, endDate);
|
||||
}
|
||||
public void GetShipmentItemsByShipmentId()
|
||||
{
|
||||
var id = "FBAYGWHR4";
|
||||
|
||||
var result = new Data.Amazon.FulFillmentInbound.GetShipmentItems().GetByShipmentId(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
38
src/bnhtrade.Core/Test/Amazon/SP-API/VariousCalls.cs
Normal file
38
src/bnhtrade.Core/Test/Amazon/SP-API/VariousCalls.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.Core.Test.Amazon.SP_API
|
||||
{
|
||||
public class VariousCalls
|
||||
{
|
||||
public VariousCalls()
|
||||
{
|
||||
GetCompetitivePrice();
|
||||
}
|
||||
|
||||
public void GetFeeEstimate()
|
||||
{
|
||||
var inst = new Data.Amazon.ProductFee.GetFeeEstimate();
|
||||
var result = inst.GetFba("B0009UBR3A", 12345, 20m);
|
||||
int i = 0;
|
||||
}
|
||||
|
||||
public void GetInventorySummary()
|
||||
{
|
||||
var skuList = new Data.Database.ReadRandomData().GetSkuNumber(75);
|
||||
var get = new Data.Amazon.FbaInventory.GetFbaInventoryInfo().GetFnsku(skuList);
|
||||
int i = 0;
|
||||
}
|
||||
|
||||
public void GetCompetitivePrice()
|
||||
{
|
||||
var asinList = new Data.Database.ReadRandomData().GetAsinNumber(30);
|
||||
//var result = new Data.Amazon.ProductPricing.GetCompetitivePricing().BySku(asinList);
|
||||
var result = new Data.Amazon.ProductPricing.GetCompetitivePricing().ByAsin(new List<string> { "B005EEQEIY" });
|
||||
int i = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,10 +22,5 @@ namespace bnhtrade.Core.Test
|
||||
var instance = new Core.Logic.Export.AmazonSettlement(sqlConnectionString);
|
||||
instance.ToInvoice();
|
||||
}
|
||||
|
||||
private void Import()
|
||||
{
|
||||
var instance = new Test.Import.Import(sqlConnectionString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,20 +25,19 @@ namespace bnhtrade.Core.Test.Export
|
||||
filestream.CopyTo(memStream);
|
||||
|
||||
var logicBit = new Core.Logic.Export.AmazonSubmitFile(sqlConnectionString);
|
||||
Model.Export.AmazonFeedSubmission kkkkkkkk;
|
||||
logicBit.SubmitInventoryLoader(memStream, out kkkkkkkk);
|
||||
logicBit.SubmitInventoryLoader(memStream);
|
||||
}
|
||||
|
||||
private void GetAmamzonFeedList()
|
||||
{
|
||||
var something = new Data.AmazonMWS.Feeds.GetFeedSubmissions();
|
||||
var somethingelse = new Data.Database.Export.ReadAmazonFeedSubmission(sqlConnectionString).GetOpenFeeds();
|
||||
List<string> idList = somethingelse.Select(x => x.FeedSubmissionId).ToList();
|
||||
//var something = new Data.AmazonMWS.Feeds.GetFeedSubmissions();
|
||||
//var somethingelse = new Data.Database.Export.ReadAmazonFeedSubmission().GetOpenFeeds();
|
||||
//List<string> idList = somethingelse.Select(x => x.FeedSubmissionId).ToList();
|
||||
}
|
||||
|
||||
private void UpdateStatusInfo()
|
||||
{
|
||||
new Core.Logic.Export.AmazonSubmitFileStatus(sqlConnectionString).UpdateStatusInfo();
|
||||
//new Core.Logic.Export.AmazonSubmitFileStatus(sqlConnectionString).UpdateStatusInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.Core.Test.Import
|
||||
{
|
||||
public class Import
|
||||
{
|
||||
private string sqlConnectionString;
|
||||
public Import(string sqlConnectionString)
|
||||
{
|
||||
this.sqlConnectionString = sqlConnectionString;
|
||||
ReadSettlementFromDatabase();
|
||||
}
|
||||
|
||||
public void ReadSettlementFromDatabase()
|
||||
{
|
||||
|
||||
var instance = new Data.Database.Import.ReadAmazonSettlement(sqlConnectionString);
|
||||
var answer = instance.BySettlementId("11796400482");
|
||||
}
|
||||
}
|
||||
}
|
||||
58
src/bnhtrade.Core/Test/Import/Report.cs
Normal file
58
src/bnhtrade.Core/Test/Import/Report.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.Core.Test.Import
|
||||
{
|
||||
public class Report
|
||||
{
|
||||
private Model.Credentials.bnhtradeDB dbCredentials;
|
||||
private string sqlConnectionString;
|
||||
private Model.Credentials.AmazonSPAPI spapiCredentials;
|
||||
|
||||
public Report(Model.Credentials.bnhtradeDB dbCredentials, Model.Credentials.AmazonSPAPI spapiCredentials)
|
||||
{
|
||||
this.dbCredentials = dbCredentials;
|
||||
this.sqlConnectionString = dbCredentials.ConnectionString;
|
||||
this.spapiCredentials = spapiCredentials;
|
||||
FBAInventoryAge();
|
||||
}
|
||||
|
||||
public void ReadSettlementFromDatabase()
|
||||
{
|
||||
|
||||
var instance = new Data.Database.Import.AmazonSettlementRead();
|
||||
var answer = instance.BySettlementId("11796400482");
|
||||
}
|
||||
|
||||
public void GetFromSPAPI()
|
||||
{
|
||||
var hhhhhjjjjj = new Core.Logic.Import.AmazonSettlement(spapiCredentials);
|
||||
hhhhhjjjjj.SyncDatabase(sqlConnectionString);
|
||||
}
|
||||
|
||||
public void GetReportDocumentByReportId()
|
||||
{
|
||||
//var lsdkjf = new bnhtrade.Core.Data.Amazon.SellingPartnerAPI.Services.ReportService(new Data.Amazon.SellingPartnerAPI.AmazonCredential())
|
||||
// .GetReportFile("902063018936");
|
||||
}
|
||||
|
||||
public void GetSettlementReport()
|
||||
{
|
||||
var setList = new List<string> { "15734813312", "14473886262", "13984682252" };
|
||||
var result = new Data.Database.Import.AmazonSettlementRead().BySettlementIdList(setList);
|
||||
}
|
||||
|
||||
public void FBAInventory()
|
||||
{
|
||||
new bnhtrade.Core.Logic.Import.AmazonFbaInventory().SyncDatabaseWithAmazon();
|
||||
}
|
||||
|
||||
public void FBAInventoryAge()
|
||||
{
|
||||
new bnhtrade.Core.Logic.Import.AmazonFbaInventoryAge().SyncDatabaseWithAmazon();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using FBAInboundServiceMWS.Model;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -54,25 +53,12 @@ namespace bnhtrade.Core.Test
|
||||
// Console.WriteLine("Qty Received: " + item.QuantityReceived);
|
||||
//}
|
||||
|
||||
var howto = new Data.Database.AmazonShipment.SetShipmentInfo(sqlConnectionString);
|
||||
var howto = new Data.Database.AmazonShipment.SetShipmentInfo();
|
||||
howto.Excecute(info);
|
||||
|
||||
var testkkkk = new Data.Database.AmazonShipment.ReadShipmentPrimaryKey(sqlConnectionString);
|
||||
var testkkkk = new Data.Database.AmazonShipment.ReadShipmentPrimaryKey();
|
||||
int pknumber = testkkkk.ByAmazonShipmentId("FBA15CJCZ12");
|
||||
Console.WriteLine("ShipmentPK: " + pknumber);
|
||||
}
|
||||
public void GetMWSInfo()
|
||||
{
|
||||
var request = new ListInboundShipmentsRequest();
|
||||
|
||||
request.LastUpdatedBefore = new DateTime(2019, 06, 21);
|
||||
request.LastUpdatedAfter = new DateTime(2019, 01, 01);
|
||||
|
||||
var task = new Data.AmazonMWS.FBAInbound.ListInboundShipments();
|
||||
task.LastUpdatedBefore = new DateTime(2019, 06, 25);
|
||||
task.LastUpdatedAfter = new DateTime(2018, 01, 01);
|
||||
var result = task.GetShipmentInfo();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace bnhtrade.Core.Test
|
||||
{
|
||||
using (SqlConnection conn = new SqlConnection(sqlConnectionString))
|
||||
{
|
||||
MiscFunction.ConsoleUpdate("Starting.....");
|
||||
UI.Console.WriteLine("Starting.....");
|
||||
conn.Open();
|
||||
|
||||
int count = 0;
|
||||
@@ -30,7 +30,7 @@ namespace bnhtrade.Core.Test
|
||||
total = (int)cmd.ExecuteScalar();
|
||||
}
|
||||
|
||||
var progress = new UI.Console.ProgressBar(total, "Processing " + total + " records...");
|
||||
var progress = new UI.ConsoleProgressBar(total, "Processing " + total + " records...");
|
||||
|
||||
using (SqlCommand cmd = new SqlCommand(@"
|
||||
SELECT * FROM tblStockJournal
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace bnhtrade.Core.Test.Sku
|
||||
public class Sku
|
||||
{
|
||||
private string sqlConnectionString;
|
||||
|
||||
public Sku(string sqlConnectionString)
|
||||
{
|
||||
this.sqlConnectionString = sqlConnectionString;
|
||||
@@ -17,6 +18,7 @@ namespace bnhtrade.Core.Test.Sku
|
||||
UpdateFbaPricing();
|
||||
|
||||
}
|
||||
|
||||
public void UpdateFbaPricing()
|
||||
{
|
||||
var instance = new bnhtrade.Core.Logic.Sku.Price.FbaPricing(sqlConnectionString);
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace bnhtrade.Core.Test.Stock
|
||||
}
|
||||
public void ReadStatusBalance()
|
||||
{
|
||||
var result = new bnhtrade.Core.Data.Database.Stock.ReadStatusTransaction(sqlConnectionString)
|
||||
var result = new bnhtrade.Core.Data.Database.Stock.ReadStatusTransaction()
|
||||
.ByStockNumber(12, 5839);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace bnhtrade.Core.Test.Stock
|
||||
idList.Add(123);
|
||||
idList.Add(333);
|
||||
idList.Add(1788);
|
||||
var result = new Data.Database.Stock.ReadStockId(sqlConnectionString).ByStockNumber(idList);
|
||||
var result = new Data.Database.Stock.ReadStockId().ByStockNumber(idList);
|
||||
}
|
||||
|
||||
public void SkuTransactionAdd()
|
||||
|
||||
Reference in New Issue
Block a user