public void Test_10070848() { string mt942 = @" :20:DEUTDEFFXXXX :25:10070848/12345670000 :28C:00000/001 :34F:EUR0, :13:1912092359 :90D:0EUR0, :90C:0EUR0, - :20:DEUTDEFFXXXX :25:00000000/DE78100708480123456700 :28C:00000/001 :34F:EURC0, :13D:1912090901+0100 :90D:0EUR0, :90C:0EUR0, - "; var result = MT940.Serialize(mt942, "123456700", false, true); Assert.Equal(2, result.Count); Assert.True(result.All(s => s.Pending)); var stmt = result[0]; Assert.Equal("DEUTDEFFXXXX", stmt.Type); Assert.Equal("10070848", stmt.BankCode); Assert.Equal("12345670000", stmt.AccountCode); Assert.Equal(new DateTime(2019, 12, 9, 23, 59, 0), stmt.CreationDate); Assert.Equal(0, stmt.CountDebit); Assert.Equal(0, stmt.AmountDebit); Assert.Equal(0, stmt.CountCredit); Assert.Equal(0, stmt.AmountCredit); Assert.Empty(stmt.SwiftTransactions); stmt = result[1]; Assert.Equal("DEUTDEFFXXXX", stmt.Type); Assert.Equal("00000000", stmt.BankCode); Assert.Equal("DE78100708480123456700", stmt.AccountCode); Assert.Equal(new DateTime(2019, 12, 9, 9, 1, 00), stmt.CreationDate); Assert.Equal(0, stmt.CountDebit); Assert.Equal(0, stmt.AmountDebit); Assert.Equal(0, stmt.CountCredit); Assert.Equal(0, stmt.AmountCredit); Assert.Empty(stmt.SwiftTransactions); }
public void Test_70051003() { string mt940 = @" :20:STARTUMSE :25:10050000/0123456789 :28C:00000/001 :60F:C190930EUR11565,61 :61:1910011001DR3393,40N029NONREF :86:116?00EINZELUEBERWEISUNG?109301?20EREF+4927411196-0000001?21K REF+4927411196?22SVWZ+RNr. 20190930001 RDat.?23 30.09.2019 KNr. C -20170100?241?30BYLADEM1FSI?31DE49700510030025617937?32GEILER KAF FEE GmbH?34997 :62F:C190930EUR8172,21 "; var result = MT940.Serialize(mt940, "123456789"); Assert.Single(result); var stmt = result[0]; Assert.Equal("STARTUMSE", stmt.Type); Assert.Equal("10050000", stmt.BankCode); Assert.Equal("123456789", stmt.AccountCode); Assert.Equal(new DateTime(2019, 09, 30), stmt.StartDate); Assert.Equal(11565.61m, stmt.StartBalance); Assert.Equal(new DateTime(2019, 09, 30), stmt.EndDate); Assert.Equal(8172.21m, stmt.EndBalance); Assert.Single(stmt.SwiftTransactions); var tx = stmt.SwiftTransactions[0]; Assert.Equal(new DateTime(2019, 09, 30), tx.ValueDate); Assert.Equal(new DateTime(2019, 09, 30), tx.InputDate); Assert.Equal(-3393.40m, tx.Amount); Assert.Equal("N029", tx.TransactionTypeId); Assert.Equal("NONREF", tx.CustomerReference); Assert.Null(tx.BankReference); Assert.Equal("116", tx.TypeCode); Assert.Equal("EINZELUEBERWEISUNG", tx.Text); Assert.Equal("9301", tx.Primanota); Assert.Equal("EREF+4927411196-0000001KREF+4927411196SVWZ+RNr. 20190930001 RDat. 30.09.2019 KNr.C- 201701001", tx.Description); Assert.Equal("4927411196-0000001", tx.EREF); Assert.Equal("4927411196", tx.KREF); Assert.Equal("RNr. 20190930001 RDat. 30.09.2019 KNr.C - 201701001", tx.SVWZ); Assert.Equal("BYLADEM1FSI", tx.BankCode); Assert.Equal("DE49700510030025617937", tx.AccountCode); Assert.Equal("GEILER KAFFEE GmbH", tx.PartnerName); Assert.Equal("997", tx.TextKeyAddition); }
public void Test_10050000() { string mt940 = @" :20:STARTUMSE :25:10050000/0123456789 :28C:00000/001 :60F:C191205EUR11565,61 :61:1912061206DR5,95NDDTNONREF :86:105?00FOLGELASTSCHRIFT?109218?20EREF+124565?21MREF+124565?22C RED+DE20ZZZ00000013480?23SVWZ+123456, BelNr. 123456?24FAX.de A?30 NOLADE21HAM?31DE71207500000060017852?32FAX.de GmbH?34992 :62F:C191206EUR11559,66 "; var result = MT940.Serialize(mt940, "123456789"); Assert.Single(result); var stmt = result[0]; Assert.Equal("STARTUMSE", stmt.Type); Assert.Equal("10050000", stmt.BankCode); Assert.Equal("123456789", stmt.AccountCode); Assert.Equal(new DateTime(2019, 12, 5), stmt.StartDate); Assert.Equal(11565.61m, stmt.StartBalance); Assert.Equal(new DateTime(2019, 12, 6), stmt.EndDate); Assert.Equal(11559.66m, stmt.EndBalance); Assert.Single(stmt.SwiftTransactions); var tx = stmt.SwiftTransactions[0]; Assert.Equal(new DateTime(2019, 12, 6), tx.ValueDate); Assert.Equal(new DateTime(2019, 12, 6), tx.InputDate); Assert.Equal(-5.95m, tx.Amount); Assert.Equal("NDDT", tx.TransactionTypeId); Assert.Equal("NONREF", tx.CustomerReference); Assert.Null(tx.BankReference); Assert.Equal("105", tx.TypeCode); Assert.Equal("FOLGELASTSCHRIFT", tx.Text); Assert.Equal("9218", tx.Primanota); Assert.Equal("EREF+124565MREF+124565CRED+DE20ZZZ00000013480SVWZ+123456, BelNr. 123456FAX.de A", tx.Description); Assert.Equal("124565", tx.EREF); Assert.Equal("124565", tx.MREF); Assert.Equal("DE20ZZZ00000013480", tx.CRED); Assert.Equal("123456, BelNr. 123456FAX.de A", tx.SVWZ); Assert.Equal("NOLADE21HAM", tx.BankCode); Assert.Equal("DE71207500000060017852", tx.AccountCode); Assert.Equal("FAX.de GmbH", tx.PartnerName); Assert.Equal("992", tx.TextKeyAddition); }
public void Test_44010046() { string mt940 = @" :20:STARTUMS :21:NONREF :25:44010046/123456789 :28C:0 :60F:C191203EUR2696,19 :61:1912031203D149,99N005NONREF :86:106?00KARTENZAHLUNG?20Referenz 654204984863570212?2119163028?22Ma ndat 174962?23Einreicher-ID DE21Z01000006?2442216?25XXXS026XXX SA TURN E//BERLIN?26/DE?27Terminal 65420498?282019-12-02T16:30:28?29 Folgenr. 03 Verfalld. 2312?30WELADEDDXXX?31DE38300500000001107713 ?32SATURN SAGT DANKE.?34011 :62F:C191209EUR2546,20 "; var result = MT940.Serialize(mt940, "123456789"); Assert.Single(result); var stmt = result[0]; Assert.Equal("STARTUMS", stmt.Type); Assert.Equal("44010046", stmt.BankCode); Assert.Equal("123456789", stmt.AccountCode); Assert.Equal(new DateTime(2019, 12, 3), stmt.StartDate); Assert.Equal(2696.19m, stmt.StartBalance); Assert.Equal(new DateTime(2019, 12, 9), stmt.EndDate); Assert.Equal(2546.20m, stmt.EndBalance); Assert.Single(stmt.SwiftTransactions); var tx = stmt.SwiftTransactions[0]; Assert.Equal(new DateTime(2019, 12, 3), tx.ValueDate); Assert.Equal(new DateTime(2019, 12, 3), tx.InputDate); Assert.Equal(-149.99m, tx.Amount); Assert.Equal("N005", tx.TransactionTypeId); Assert.Equal("NONREF", tx.CustomerReference); Assert.Null(tx.BankReference); Assert.Equal("106", tx.TypeCode); Assert.Equal("KARTENZAHLUNG", tx.Text); Assert.Null(tx.Primanota); Assert.Equal("Referenz 65420498486357021219163028Mandat 174962Einreicher-ID DE21Z0100000642216XXXS026XXX SATURN E//BERLIN/DETerminal 654204982019-12-02T16:30:28Folgenr. 03 Verfalld. 2312", tx.Description); Assert.Equal("WELADEDDXXX", tx.BankCode); Assert.Equal("DE38300500000001107713", tx.AccountCode); Assert.Equal("SATURN SAGT DANKE.", tx.PartnerName); Assert.Equal("011", tx.TextKeyAddition); }
public void Test_10070848() { string mt940 = @" :20:DEUTDEFFXXXX :25:10070848/123456789 :28C:00000/000 :60F:C191129EUR3930,41 :61:191129C66,20NMSCNONREF :86:166?20EREF+0041961450206?21SVWZ+65-489042-01 /00419614?2250206 65 -48904201 RENTE?30WELADEDDXXX?31DE90300500000072000003?32GOTHAER LEBENSVERSICHERUNG :62F:C191129EUR3996,61 "; var result = MT940.Serialize(mt940, "123456789"); Assert.Single(result); var stmt = result[0]; Assert.Equal("DEUTDEFFXXXX", stmt.Type); Assert.Equal("10070848", stmt.BankCode); Assert.Equal("123456789", stmt.AccountCode); Assert.Equal(new DateTime(2019, 11, 29), stmt.StartDate); Assert.Equal(3930.41m, stmt.StartBalance); Assert.Equal(new DateTime(2019, 11, 29), stmt.EndDate); Assert.Equal(3996.61m, stmt.EndBalance); Assert.Single(stmt.SwiftTransactions); var tx = stmt.SwiftTransactions[0]; Assert.Equal(new DateTime(2019, 11, 29), tx.ValueDate); Assert.Equal(new DateTime(2019, 11, 29), tx.InputDate); Assert.Equal(66.20m, tx.Amount); Assert.Equal("NMSC", tx.TransactionTypeId); Assert.Equal("NONREF", tx.CustomerReference); Assert.Null(tx.BankReference); Assert.Equal("166", tx.TypeCode); Assert.Null(tx.Text); Assert.Null(tx.Primanota); Assert.Equal("EREF+0041961450206SVWZ+65-489042-01 /0041961450206 65-48904201 RENTE", tx.Description); Assert.Equal("0041961450206", tx.EREF); Assert.Equal("65-489042-01 /0041961450206 65-48904201 RENTE", tx.SVWZ); Assert.Equal("WELADEDDXXX", tx.BankCode); Assert.Equal("DE90300500000072000003", tx.AccountCode); Assert.Equal("GOTHAER LEBENSVERSICHERUNG", tx.PartnerName); }
public void Test_10020890() { string mt940 = @" :20:191101 :25:10020890/123456789 :28C:12/1 :60F:C191001EUR22077,2 :61:1911011101C25,NSTONONREF//00900280012998 BANKREFCTC191101IST000002400296725 :86:152?00SEPA-Dauerauftrag?100050?20SVWZ+HVB WILLKOMMENSKONTO?30HYVE DEMM488?31DE16100208900001234567?32MUSTERMANN MAX :62F:C191101EUR22102,2 "; var result = MT940.Serialize(mt940, "123456789"); Assert.Single(result); var stmt = result[0]; Assert.Equal("191101", stmt.Type); Assert.Equal("10020890", stmt.BankCode); Assert.Equal("123456789", stmt.AccountCode); Assert.Equal(new DateTime(2019, 10, 1), stmt.StartDate); Assert.Equal(22077.20m, stmt.StartBalance); Assert.Equal(new DateTime(2019, 11, 1), stmt.EndDate); Assert.Equal(22102.20m, stmt.EndBalance); Assert.Single(stmt.SwiftTransactions); var tx = stmt.SwiftTransactions[0]; Assert.Equal(new DateTime(2019, 11, 1), tx.ValueDate); Assert.Equal(new DateTime(2019, 11, 1), tx.InputDate); Assert.Equal(25m, tx.Amount); Assert.Equal("NSTO", tx.TransactionTypeId); Assert.Equal("NONREF", tx.CustomerReference); Assert.Equal("00900280012998", tx.BankReference); Assert.Equal("BANKREFCTC191101IST000002400296725", tx.OtherInformation); Assert.Equal("152", tx.TypeCode); Assert.Equal("SEPA-Dauerauftrag", tx.Text); Assert.Equal("0050", tx.Primanota); Assert.Equal("SVWZ+HVB WILLKOMMENSKONTO", tx.Description); Assert.Equal("HVB WILLKOMMENSKONTO", tx.SVWZ); Assert.Equal("HYVEDEMM488", tx.BankCode); Assert.Equal("DE16100208900001234567", tx.AccountCode); Assert.Equal("MUSTERMANN MAX", tx.PartnerName); }
public void Test_10070124() { string mt940 = @" :20:DEUTDEFFXXXX :25:10070124/123456789 :28C:00000/000 :60F:C191204EUR89,45 :61:191204D1,00NMSCNONREF :86:116?20EREF+NOTPROVIDED?21KREF+NOTPROVIDED?22SVWZ+Geld?30BELADEBEX XX?31DE12100500000123456789?32Mustermann, Max :62F:C191204EUR88,45 "; var result = MT940.Serialize(mt940, "123456789"); Assert.Single(result); var stmt = result[0]; Assert.Equal("DEUTDEFFXXXX", stmt.Type); Assert.Equal("10070124", stmt.BankCode); Assert.Equal("123456789", stmt.AccountCode); Assert.Equal(new DateTime(2019, 12, 4), stmt.StartDate); Assert.Equal(89.45m, stmt.StartBalance); Assert.Equal(new DateTime(2019, 12, 4), stmt.EndDate); Assert.Equal(88.45m, stmt.EndBalance); Assert.Single(stmt.SwiftTransactions); var tx = stmt.SwiftTransactions[0]; Assert.Equal(new DateTime(2019, 12, 4), tx.ValueDate); Assert.Equal(new DateTime(2019, 12, 4), tx.InputDate); Assert.Equal(-1m, tx.Amount); Assert.Equal("NMSC", tx.TransactionTypeId); Assert.Equal("NONREF", tx.CustomerReference); Assert.Null(tx.BankReference); Assert.Equal("116", tx.TypeCode); Assert.Null(tx.Text); Assert.Null(tx.Primanota); Assert.Equal("EREF+NOTPROVIDEDKREF+NOTPROVIDEDSVWZ+Geld", tx.Description); Assert.Equal("NOTPROVIDED", tx.EREF); Assert.Equal("NOTPROVIDED", tx.KREF); Assert.Equal("Geld", tx.SVWZ); Assert.Equal("BELADEBEXXX", tx.BankCode); Assert.Equal("DE12100500000123456789", tx.AccountCode); Assert.Equal("Mustermann, Max", tx.PartnerName); }
public void Test_10050000() { string mt942 = @" :20:STARTDISPE :25:10050000/0123456789 :28C:00000/001 :34F:EURD826,90 :13:1911071300 :61:1911081105DR826,90NDDTNONREF :86:105?00FOLGELASTSCHRIFT?109248?20EREF+Zahlbeleg 372309853527?2 1MREF+DE00020500061000000000?220000005061316?23CRED+DE93ZZZ000000 78611?24SVWZ+Mobilfunk Kundenkonto?250012345678 Mobilfunk-Geraet? 26 00001234567890/01.11.2019?30HYVEDEMMXXX?31DE687002027006673022 69?32Telekom Deutschland GmbH?34992 :61:1911081106DR5,95NDDTNONREF :86:105?00FOLGELASTSCHRIFT?109218?20EREF+124565?21MREF+124565?22C RED+DE20ZZZ00000013480?23SVWZ+933701, BelNr. 933701?24FAX.de A?30 NOLADE21HAM?31DE71207500000060017852?32FAX.de GmbH?34992 :61:1911081107DR5,98N011NONREF :86:107?00SEPA-ELV-LASTSCHRIFT?109248?20EREF+ELV91400493 06.11 17 .5?214 ME1?22MREF+7402568179871911061754?23CRED+DE86ZZZ0000023752 6?24SVWZ+ELV91400493 06.11 17.5?254 ME1 STAR TST RHINSTRASSE?2647 ?30HELADEFFXXX?31DE39500500000096500038?32Orlen Deutschland GmbH? 34019 :90D:3EUR838,83 :90C:0EUR0,00 - "; var result = MT940.Serialize(mt942, "0123456789", false, true); Assert.Single(result); Assert.True(result.All(s => s.Pending)); var stmt = result[0]; Assert.Equal("STARTDISPE", stmt.Type); Assert.Equal("10050000", stmt.BankCode); Assert.Equal("123456789", stmt.AccountCode); Assert.Equal(new DateTime(2019, 11, 7, 13, 0, 0), stmt.CreationDate); Assert.Equal(3, stmt.CountDebit); Assert.Equal(-838.83m, stmt.AmountDebit); Assert.Equal(0, stmt.CountCredit); Assert.Equal(0, stmt.AmountCredit); Assert.Equal(3, stmt.SwiftTransactions.Count); }
/// <summary> /// Account transactions in SWIFT-format /// </summary> /// <param name="connectionDetails">ConnectionDetails object must atleast contain the fields: Url, HBCIVersion, UserId, Pin, Blz, Account, IBAN, BIC</param> /// <param name="anonymous"></param> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <returns> /// Transactions /// </returns> public async Task <HBCIDialogResult <List <SwiftStatement> > > Transactions(TanRequest tanDialog, DateTime?startDate = null, DateTime?endDate = null, bool saveMt940File = false) { var result = await InitializeConnection(); if (result.HasError) { return(result.TypedResult <List <SwiftStatement> >()); } result = await ProcessSCA(result, tanDialog); if (!result.IsSuccess) { return(result.TypedResult <List <SwiftStatement> >()); } string startDateStr = startDate?.ToString("yyyyMMdd"); string endDateStr = endDate?.ToString("yyyyMMdd"); // Success string BankCode = await Transaction.HKKAZ(this, startDateStr, endDateStr, null); result = new HBCIDialogResult(Helper.Parse_BankCode(BankCode), BankCode); if (result.HasError) { return(result.TypedResult <List <SwiftStatement> >()); } result = await ProcessSCA(result, tanDialog); if (!result.IsSuccess) { return(result.TypedResult <List <SwiftStatement> >()); } BankCode = result.RawData; var TransactionsMt940 = new StringBuilder(); var TransactionsMt942 = new StringBuilder(); Regex regex = new Regex(@"HIKAZ:.+?@\d+@(?<mt940>.+?)(\+@\d+@(?<mt942>.+?))?('{1,2}H[A-Z]{4}:\d+:\d+)", RegexOptions.Singleline); Match match = regex.Match(BankCode); if (match.Success) { TransactionsMt940.Append(match.Groups["mt940"].Value); TransactionsMt942.Append(match.Groups["mt942"].Value); } string BankCode_ = BankCode; while (BankCode_.Contains("+3040::")) { Helper.Parse_Message(this, BankCode_); string Startpoint = new Regex(@"\+3040::[^:]+:(?<startpoint>[^']+)'").Match(BankCode_).Groups["startpoint"].Value; BankCode_ = await Transaction.HKKAZ(this, startDateStr, endDateStr, Startpoint); result = new HBCIDialogResult(Helper.Parse_BankCode(BankCode_), BankCode_); if (!result.IsSuccess) { return(result.TypedResult <List <SwiftStatement> >()); } result = await ProcessSCA(result, tanDialog); if (result.HasError) { return(result.TypedResult <List <SwiftStatement> >()); } BankCode_ = result.RawData; match = regex.Match(BankCode_); if (match.Success) { TransactionsMt940.Append(match.Groups["mt940"].Value); TransactionsMt942.Append(match.Groups["mt942"].Value); } } var swiftStatements = new List <SwiftStatement>(); swiftStatements.AddRange(MT940.Serialize(TransactionsMt940.ToString(), ConnectionDetails.Account, saveMt940File)); swiftStatements.AddRange(MT940.Serialize(TransactionsMt942.ToString(), ConnectionDetails.Account, saveMt940File, true)); return(result.TypedResult(swiftStatements)); }