Skip to content

Commit

Permalink
feature: implement parsing from CZ paypal
Browse files Browse the repository at this point in the history
Resolves #65, #64
  • Loading branch information
anion0278 committed Apr 3, 2024
1 parent 500fdee commit fe80158
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Mapp.BusinessLogic.Invoices/Transactions/TransactionsReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ private IEnumerable<MarketPlaceTransactionsConfig> GetAvailableMarketplaceConfig
mapper.Map<MarketPlaceTransactionsConfigData, MarketPlaceTransactionsConfig>(data));

var marketPlaceIds = configs.Select(s => s.MarketPlaceId).ToList();
if (marketPlaceIds.Distinct().Count() != marketPlaceIds.Count())
{
throw new ArgumentException($"Chyba, duplicitni hodnota {nameof(marketPlaceIds)} v JSON konfiguracich!");
}
//if (marketPlaceIds.Distinct().Count() != marketPlaceIds.Count()) // commented because we now have PaypalCZ and paypal
//{
// throw new ArgumentException($"Chyba, duplicitni hodnota {nameof(marketPlaceIds)} v JSON konfiguracich!");
//}

return configs;
}
Expand Down Expand Up @@ -130,7 +130,8 @@ private IEnumerable<Transaction> ReadTransactions(string fileName)
decimal transactionTotalValue = 0;
foreach (var compColumnName in marketPlaceSetting.ValueComponentsColumnName)
{
transactionTotalValue += decimal.Parse(transactionsDict[compColumnName][index], marketPlaceSetting.DateCultureInfo);
string val = transactionsDict[compColumnName][index];
transactionTotalValue += decimal.Parse(val, marketPlaceSetting.DateCultureInfo);
}

var transactionType = ParseTransactionType(transactionsDict[marketPlaceSetting.TransactionTypeColumnName][index], marketPlaceSetting);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0740000002001353907Czech Goods s.r.o. 01111900000013280900+00000016514842+000000461730770000000494070190011300424FIO
07500000020013539210000000000000000000000000000000000895356611132876594000000000000000000000000000140711328765940000000124100623
6 changes: 6 additions & 0 deletions Mapp.BusinessLogic.Transactions.Tests/IntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ public async Task ConvertTransactions_ParsesAndConvertsTransactions_Paypal()
await IntegrationTestBase("PayPal");
}

[Fact]
public async Task ConvertTransactions_ParsesAndConvertsTransactions_PaypalCZ()
{
await IntegrationTestBase("PayPalCZ");
}

[Fact]
public async Task ConvertTransactions_ParsesAndConvertsTransactions_AmazonCA()
{
Expand Down
2 changes: 2 additions & 0 deletions Mapp.BusinessLogic.Transactions.Tests/TestData/PayPalCZ.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"Datum","Čas","Časové pásmo","Popis","Měna","Brutto ","Poplatek ","Netto","Zůstatek","ID transakce","E-mailová adresa odesílatele","Název","Název banky","Bankovní účet","Výše poštovného a balného","Daň z prodeje","ID faktury","Referenční ID transakce"
"10/6/2023","11:52:55","Europe/Prague","General Withdrawal - Bank Account","CZK","-89 535,66","0,00","-89 535,66","-89 535,66","0X14071132876594C","","","Fio banka, a.s.","3907","0,00","0,00","",""
3 changes: 3 additions & 0 deletions Mapp.UI/Mapp.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@
<None Update="Transactions Configs\TransactionsConfigAmazonUS.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Transactions Configs\TransactionsConfigPaypalCZ.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Transactions Configs\TransactionsConfigPaypal.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
39 changes: 39 additions & 0 deletions Mapp.UI/Transactions Configs/TransactionsConfigPaypalCZ.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"LinesToSkipBeforeColumnNames": 0,
"MarketPlaceId": 21,
"DistinctionPhrases": [ "Datum", "Čas", "Časové pásmo", "Popis" ],
"DateSubstring": "(.*)",
"TimeSeparatorOverride": null,
"DateCultureInfoName": "cs-CZ",
"OrderIdColumnName": "ID transakce",
"TransactionTypeColumnName": "Popis",
"DateTimeColumnNames": [
"Datum",
"Čas"
],
"ValueComponentsColumnName": [
"Brutto",
"Daň z prodeje"
],
"TransferTypeNames": [
"General Withdrawal - Bank Account"
],
"RefundTypeNames": [
"Payment Refund"
],
"OrderTypeNames": [
"eBay Auction Payment",
"Express Checkout Payment",
"General Payment",
"Mobile Payment",
"Website Payment"
],
"ServiceFeeTypeNames": [
"General Currency Conversion",
"Tax collected by partner",
"Cancellation of Hold for Dispute Resolution",
"Hold on Balance for Dispute Investigation",
"PreApproved Payment Bill User Payment"
],
"TotalPriceColumnName": "Brutto"
}

0 comments on commit fe80158

Please sign in to comment.