Skip to content

Commit

Permalink
Fix: multiple changes in transactions configruations due to lates upd…
Browse files Browse the repository at this point in the history
…ates in Amazon

Resolves #78
  • Loading branch information
anion0278 committed Apr 14, 2024
1 parent 6ff3d47 commit cdea6f5
Show file tree
Hide file tree
Showing 35 changed files with 8,011 additions and 264 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ public string TimeSeparatorOverride
get { return _timeSeparatorOverride; }
set
{
_timeSeparatorOverride = value;
if (_dataCultureInfo != null)
{
_dataCultureInfo.DateTimeFormat.TimeSeparator = TimeSeparatorOverride;
_dataCultureInfo.DateTimeFormat.TimeSeparator = _timeSeparatorOverride;
}

_timeSeparatorOverride = value;
}
}

public string NumericFormatSourceCultureName { get; set; }

private CultureInfo _dataCultureInfo;

public CultureInfo DateCultureInfo
Expand All @@ -45,7 +46,12 @@ public CultureInfo DateCultureInfo
if (_timeSeparatorOverride != null)
{
_dataCultureInfo.DateTimeFormat.TimeSeparator = _timeSeparatorOverride;
}
}
if (NumericFormatSourceCultureName != null)
{
var numbericCultureInfo = new CultureInfo(NumericFormatSourceCultureName);
_dataCultureInfo.NumberFormat = numbericCultureInfo.NumberFormat;
}
}
return _dataCultureInfo;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public IEnumerable<Transaction> ReadTransactionsFromMultipleFiles(IEnumerable<st

private IEnumerable<MarketPlaceTransactionsConfig> GetAvailableMarketplaceConfigs()
{
// TODO load only once
var mapperConfiguration = new MapperConfiguration(cfg => {
cfg.CreateMap<MarketPlaceTransactionsConfigData, MarketPlaceTransactionsConfig>();
});
Expand Down Expand Up @@ -110,7 +109,7 @@ private IEnumerable<Transaction> ReadTransactions(string fileName)
}
var validLines = lines.Skip(linesToSkip).ToList();

var transactionsDict = new Dictionary<string, string[]>();
var transactionsDict = new Dictionary<string, string[]>(StringComparer.OrdinalIgnoreCase);
for (int columnIndex = 0; columnIndex < validLines[0].Length; ++columnIndex)
{
string columnNameKey = validLines[0][columnIndex].Trim(); //tolower?
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
0740000002001353907Czech Goods s.r.o. 01111900000013280900+00000016514842+000000461730770000000494070190011300424FIO
0750000002001353908000000000000000000000000000000000000026992951669712700000000000000000000000000408-0091951-6697127000124050224
07500000020013539080000000000000000000000000000000000001062710000000000000000000000000000000000000000000000000000000000124170224
0750000002001353908000000000000000000000000000000000000026992290539393600000000000000000000000000408-2472290-5393936000124230224
0750000002001353908000000000000000000000000000000000000062002070906676300000000000000000000000000405-7042070-9066763000124260224
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
0740000002001353907Czech Goods s.r.o. 01111900000013280900+00000016514842+000000461730770000000494070190011300424FIO
07500000020013539020000000000000000000000000000000000007206310000000000000000000000000000000000000000000000000000000000124061120
0750000002001353902000000000000000000000000000000000001577872514164104100000000000000000000000000702-5224514-1641041000124151120
0750000002001353902000000000000000000000000000000000002077052965988102600000000000000000000000000702-3444965-9881026000124151120
07500000020013539020000000000000000000000000000000000000352510000000000000000000000000000000000000000000000000000000000124201120
0750000002001353902000000000000000000000000000000000002077052704294262500000000000000000000000000702-1622704-2942625000124241120
0750000002001353902000000000000000000000000000000000002077052827234343700000000000000000000000000701-7796827-2343437000124241120
0750000002001353902000000000000000000000000000000000001178982984649067200000000000000000000000000701-0090984-6490672000124261120
0750000002001353902000000000000000000000000000000000001195005698303945400000000000000000000000000702-1407698-3039454000124010224
0750000002001353902000000000000000000000000000000000002195002542046746800000000000000000000000000702-6059542-0467468000124010224
0750000002001353902000000000000000000000000000000000001195002372825940600000000000000000000000000702-7039372-8259406000124060224
0750000002001353902000000000000000000000000000000000001595002681949946300000000000000000000000000701-6390681-9499463000124060224
0750000002001353902000000000000000000000000000000000001195002238817546900000000000000000000000000702-1008238-8175469000124080224
0750000002001353902000000000000000000000000000000000000950002051013140100000000000000000000000000701-0997051-0131401000124080224
0750000002001353902000000000000000000000000000000000000950002051013140100000000000000000000000000701-0997051-0131401000124080224
0750000002001353902000000000000000000000000000000000001195002897697466900000000000000000000000000702-3416897-6974669000124110224
07500000020013539020000000000000000000000000000000000057319010000000000000000000000000000000000000000000000000000000000124120224
0750000002001353902000000000000000000000000000000000001425002173601460200000000000000000000000000702-5970173-6014602000124130224
0750000002001353902000000000000000000000000000000000001400002497863463800000000000000000000000000701-7451497-8634638000124190224
0750000002001353902000000000000000000000000000000000000975002395548026400000000000000000000000000701-5926395-5480264000124220224
0750000002001353902000000000000000000000000000000000000995002579507706300000000000000000000000000702-3541579-5077063000124250224
0750000002001353902000000000000000000000000000000000002845002605247383000000000000000000000000000701-2609605-2473830000124250224
07500000020013539020000000000000000000000000000000000091086110000000000000000000000000000000000000000000000000000000000124260224
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
0740000002001353907Czech Goods s.r.o. 01111900000013280900+00000016514842+000000461730770000000494070190011300424FIO
07500000020013539130000000000000000000000000000000000005200021514960562000000000000000000000000002151496056200000000000124090224
07500000020013539130000000000000000000000000000000000002790021514960562000000000000000000000000002151496056200000000000124230224
07500000020013539130000000000000000000000000000000000004420011607040132000000000000000000000000002160704013200000000000124270224
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
0740000002001353907Czech Goods s.r.o. 01111900000013280900+00000016514842+000000461730770000000494070190011300424FIO
07500000020013539140000000000000000000000000000000000000640910000000000000000000000000000000000000000000000000000000000124060224
0750000002001353914000000000000000000000000000000000000064222095799586500000000000000000000000000249-5935095-7995865000124110224
0750000002001353914000000000000000000000000000000000000073382804361340400000000000000000000000000249-3345804-3613404000124140224
0750000002001353914000000000000000000000000000000000000022932565422781400000000000000000000000000249-5071565-4227814000124150224
07500000020013539140000000000000000000000000000000000001414510000000000000000000000000000000000000000000000000000000000124200224
Original file line number Diff line number Diff line change
@@ -1,2 +1,42 @@
0740000002001353907Czech Goods s.r.o. 01111900000013280900+00000016514842+000000461730770000000494070190011300424FIO
07500000020013539210000000000000000000000000000000000895356611132876594000000000000000000000000000140711328765940000000124100623
07500000020013539210000000000000000000000000000000000001567625139471830000000000000000000000000007405139471830000000000124020224
07500000020013539210000000000000000000000000000000000001499123710872040000000000000000000000000002028371087204000000000124040224
07500000020013539210000000000000000000000000000000000000262520972830262000000000000000000000000007609728302620000000000124040224
07500000020013539210000000000000000000000000000000000000459722551712028000000000000000000000000000005125517120280000000124040224
07500000020013539210000000000000000000000000000000000000299922596901400000000000000000000000000008792596901400000000000124060224
07500000020013539210000000000000000000000000000000000001469427309933270000000000000000000000000002573099332700000000000124080224
07500000020013539210000000000000000000000000000000000000349924909206737000000000000000000000000002234909206737000000000124120224
07500000020013539210000000000000000000000000000000000000449921471843652000000000000000000000000008314718436520000000000124140224
07500000020013539210000000000000000000000000000000000000249923173241248000000000000000000000000003673173241248000000000124140224
07500000020013539210000000000000000000000000000000000001339523171275410000000000000000000000000009631712754100000000000124160224
07500000020013539210000000000000000000000000000000000001415521720451730000000000000000000000000007057917204517300000000124180224
07500000020013539210000000000000000000000000000000000001349625402068060000000000000000000000000006354020680600000000000124180224
07500000020013539210000000000000000000000000000000000000159929553661420000000000000000000000000006679553661420000000000124200224
07500000020013539210000000000000000000000000000000000000869722246933552000000000000000000000000003622469335520000000000124200224
07500000020013539210000000000000000000000000000000000000482027534939723000000000000000000000000006507534939723000000000124210224
07500000020013539210000000000000000000000000000000000000299929937876132000000000000000000000000008599378761320000000000124210224
07500000020013539210000000000000000000000000000000000000819922814763604000000000000000000000000001367692814763604000000124270224
07500000020013539210000000000000000000000000000000000001009629330693001000000000000000000000000006093306930010000000000124280224
07500000020013539210000000000000000000000000000000000000299923296136841000000000000000000000000007832961368410000000000124280224
07500000020013539210000000000000000000000000000000000000259921992095223000000000000000000000000000951992095223000000000124290224
07500000020013539210000000000000000000000000000000000000349026341798984000000000000000000000000001696341798984000000000124050224
07500000020013539210000000000000000000000000000000000000448028466027351000000000000000000000000002137846602735100000000124050224
07500000020013539210000000000000000000000000000000000000560027431915332000000000000000000000000009510874319153320000000124120224
07500000020013539210000000000000000000000000000000000000480025450610032000000000000000000000000000854506100320000000000124250224
07500000020013539210000000000000000000000000000000000000450024099308604000000000000000000000000001474409930860400000000124280224
07500000020013539210000000000000000000000000000000000497759823532556528000000000000000000000000003261353255652800000000124130224
07500000020013539210000000000000000000000000000000000415218221597092060000000000000000000000000009461597092060000000000124130224
07500000020013539210000000000000000000000000000000000000399020019402024000000000000000000000000002300019402024000000000124030224
07500000020013539210000000000000000000000000000000000000184528183143704000000000000000000000000009208183143704000000000124050224
07500000020013539210000000000000000000000000000000000000474026069139113000000000000000000000000002544606913911300000000124070224
07500000020013539210000000000000000000000000000000000000275528950169118000000000000000000000000001258950169118000000000124080224
07500000020013539210000000000000000000000000000000000000658521446773810000000000000000000000000008631144677381000000000124120224
07500000020013539210000000000000000000000000000000000000355522362696614000000000000000000000000005892362696614000000000124150224
07500000020013539210000000000000000000000000000000000000907529210563944000000000000000000000000002719210563944000000000124160224
07500000020013539210000000000000000000000000000000000000657528333984902000000000000000000000000004120833398490200000000124170224
07500000020013539210000000000000000000000000000000000000384527757401511000000000000000000000000002747757401511000000000124220224
07500000020013539210000000000000000000000000000000000000518525451086150000000000000000000000000005765754510861500000000124230224
07500000020013539210000000000000000000000000000000000000229020535011390000000000000000000000000009592053501139000000000124280224
07500000020013539210000000000000000000000000000000000000500024858855452000000000000000000000000001148588554520000000000124170224
07500000020013539210000000000000000000000000000000000004810020969446740000000000000000000000000001990969446740000000000124190224
07500000020013539210000000000000000000000000000000000008330029943855731000000000000000000000000002150994385573100000000124230224
19 changes: 19 additions & 0 deletions Mapp.BusinessLogic.Transactions.Tests/IntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,25 @@ public async Task ConvertTransactions_ParsesAndConvertsTransactions_AmazonMX()
await IntegrationTestBase("AmazonMX");
}

[Fact]
public async Task ConvertTransactions_ParsesAndConvertsTransactions_AmazonFR()
{
await IntegrationTestBase("AmazonFR");
}

[Fact]
public async Task ConvertTransactions_ParsesAndConvertsTransactions_AmazonSG()
{
await IntegrationTestBase("AmazonSG");
}

[Fact]
public async Task ConvertTransactions_ParsesAndConvertsTransactions_AmazonSE()
{
await IntegrationTestBase("AmazonSE");
}


[Fact]
public async Task ConvertTransactions_ParsesAndConvertsTransactions_AmazonNL()
{
Expand Down
12 changes: 12 additions & 0 deletions Mapp.BusinessLogic.Transactions.Tests/TestData/AmazonFR.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"Comprend les transactions Amazon Marketplace, Expédié par Amazon et Boutique en ligne Amazon"
"Tous les montants sont en EUR, sauf indication contraire"
"Définitions :"
"Taxes de ventes prélevées : Inclut les taxes de vente prélevées auprès des acheteurs pour les ventes de produits, l’expédition et les emballages-cadeaux."
"Frais de vente : Comprend les frais de clôture estimés et les frais de vente."
"Autres frais de transaction : Comprend les rétrofacturations de l’expédition, les retenues sur l’expédition, les frais par article et les frais de recouvrement des taxes de vente."
"Autres : Inclut les montants des transactions non liées à une commande. Pour plus d’informations, consultez les colonnes « Type » et « Description » pour chaque numéro de commande."
"date/heure","Identifiant du paiement","type","Numéro de la commande","SKU","description","quantité","site de vente","expédition","ville de la commande","état de la commande","commande postale","ventes de produits","crédits d’expédition","crédits d’emballage-cadeau","Total des réductions","taxe de ventes prélevée","Taxe Marketplace Facilitator","frais de vente","Frais pour le service Expédié par Amazon","autres frais de transaction","autres","total"
"5 févr. 2024 07:53:07 UTC","21554144692","Commande","408-0091951-6697127","55-KOH-FR2110","KOH-I-NOOR Craies pour Tableaux Noirs - Blanc (Lot de 100)","1","amazon.com.be","Vendeur","Antwerpen","","2170","16,99","10,00","0","0","0","0","-4,05","0","0","0","22,94"
"17 févr. 2024 02:42:48 UTC","21642579362","Transférer","","","Sur le compte se terminant par : 907","","","","","","","0","0","0","0","0","0","0","0","0","-106,27","-106,27"
"23 févr. 2024 07:55:37 UTC","21642579362","Commande","408-2472290-5393936","55-KOH-FR2110","KOH-I-NOOR Craies pour Tableaux Noirs - Blanc (Lot de 100)","1","amazon.com.be","Vendeur","Antwerpen","","2170","16,99","10,00","0","0","0","0","-4,05","0","0","0","22,94"
"26 févr. 2024 07:33:16 UTC","21642579362","Commande","405-7042070-9066763","623016","Tescoma Delicia Plaque à pâtisserie 40 cm x 36 cm","2","amazon.com.be","Vendeur","Bruxelles","","1190","50,00","12,00","0","0","0","0","-9,30","0","0","0","52,70"
Loading

0 comments on commit cdea6f5

Please sign in to comment.