diff --git a/iso20022-generator/generator-test/GeneratorTest.cs b/iso20022-generator/generator-test/GeneratorTest.cs index 5ab4964..bc1ddd2 100644 --- a/iso20022-generator/generator-test/GeneratorTest.cs +++ b/iso20022-generator/generator-test/GeneratorTest.cs @@ -15,7 +15,7 @@ public void InitGenerator() { UniqueDocumentId = Guid.NewGuid().ToString().Substring(0, 34), // Must be unique for the bank within 90 days ContactDetailsName = "enio AG", - ContactDetailsOther = "3.0.0", + ContactDetailsOther = "3.0.1", AutoCalculateControlSum = true // SenderBic = "ZKBKCHZZ80A" //ZKB }, @@ -29,14 +29,14 @@ public void InitGenerator() var p1 = generator.AddPaymentInfo(DateTime.Now.AddDays(10), "TRA"); generator.AddTransaction(p1, new Receiver - { - Name = "Max Kälin", - StreetName = "Dorfstrasse", - StreetNumber = "9b", - Zip = "8808", - City = "Pfäffikon", - CountryCode = "CH" - }, + { + Name = "Max Kälin", + StreetName = "Dorfstrasse", + StreetNumber = "9b", + Zip = "8808", + City = "Pfäffikon", + CountryCode = "CH" + }, new TransactionIBANandQRR { CurrencyCode = "CHF", @@ -49,14 +49,14 @@ public void InitGenerator() }); generator.AddTransaction(p1, new Receiver - { - Name = "Alpkorporation Kohlschlag", - StreetName = "Kohlschlagerstrasse", - StreetNumber = "2", - Zip = "8887", - City = "Mels", - CountryCode = "CH", - }, + { + Name = "Alpkorporation Kohlschlag", + StreetName = "Kohlschlagerstrasse", + StreetNumber = "2", + Zip = "8887", + City = "Mels", + CountryCode = "CH", + }, new TransactionIBANandQRR { CurrencyCode = "CHF", @@ -65,7 +65,7 @@ public void InitGenerator() ReferenceIdentification = "QRR Test", QRReferenceNumber = "36 63580 00000 00000 30060 03574", InstructionForDebtorAgent = "Instruction", - AdditionalRemittanceInformation = new string[] {"Auftrag vom 25.10.2022"} + AdditionalRemittanceInformation = new string[] { "Auftrag vom 25.10.2022" } }); var p2 = generator.AddPaymentInfo(DateTime.Now.AddDays(5), "TRF"); @@ -93,7 +93,7 @@ public void InitGenerator() { UniqueDocumentId = Guid.NewGuid().ToString().Substring(0, 34), // Must be unique for the bank within 90 days ContactDetailsName = "enio AG", - ContactDetailsOther = "3.0.0", + ContactDetailsOther = "3.0.1", AutoCalculateControlSum = true // SenderBic = "ZKBKCHZZ80A" //ZKB }, @@ -107,8 +107,47 @@ public void InitGenerator() var p3 = generator2.AddPaymentInfo(DateTime.Now.AddDays(10), "TRA"); generator2.AddTransaction(p3, new Receiver + { + Name = "Test Name", + StreetName = "", + StreetNumber = "", + Zip = "70372", + City = "Stuttgart", + CountryCode = "DE" + }, + new TransactionIBANandQRR { - Name = "Test Name", + CurrencyCode = "JPY", + Amount = 1117, + ReceiverIban = "CH23 0024 5245 1002 3901 K", + ReferenceIdentification = "69-10", + QRReferenceNumber = "36 63580 00000 00000 30060 03574", + InstructionForDebtorAgent = null + }); + + string ret2 = generator2.GetPain001String(); + + + var generatorph = new Pain001Generator(new Initialization() + { + UniqueDocumentId = Guid.NewGuid().ToString().Substring(0, 34), // Must be unique for the bank within 90 days + ContactDetailsName = "enio AG", + ContactDetailsOther = "3.0.1", + AutoCalculateControlSum = true + }, + new Sender() + { + SenderPartyName = "Muster AG", + SenderIban = "InitialWertInitialWert", + SenderBic = "HHHHCH22", //HBL + }); + + generatorph.Sender.SenderIban = "CH5656565656565656565"; + var ph = generatorph.AddPaymentInfo(DateTime.Now.AddDays(10), "TRA"); + + generatorph.AddTransaction(ph, new Receiver + { + Name = "Hypo AG", StreetName = "", StreetNumber = "", Zip = "70372", @@ -117,15 +156,60 @@ public void InitGenerator() }, new TransactionIBANandQRR { - CurrencyCode = "JPY", - Amount = 1117, - ReceiverIban = "CH23 0024 5245 1002 3901 K", + CurrencyCode = "CHF", + Amount = 100, + ReceiverIban = "CH0200202020202020202", ReferenceIdentification = "69-10", QRReferenceNumber = "36 63580 00000 00000 30060 03574", - InstructionForDebtorAgent = null + InstructionForDebtorAgent = "/Cost center/1/VAT/1/Project number/1/" }); - string ret2 = generator2.GetPain001String(); + generatorph.Sender.SenderIban = "CH2929292929292929292"; + var ph2 = generatorph.AddPaymentInfo(DateTime.Now.AddDays(10), "TRA"); + + generatorph.AddTransaction(ph2, new Receiver + { + Name = "Hypo AG", + StreetName = "", + StreetNumber = "", + Zip = "70372", + City = "Stuttgart", + CountryCode = "DE" + }, + new TransactionIBANandQRR + { + CurrencyCode = "CHF", + Amount = 100, + ReceiverIban = "CH0200202020202020202", + ReferenceIdentification = "69-10", + QRReferenceNumber = "36 63580 00000 00000 30060 03574", + InstructionForDebtorAgent = "/Cost center/1/VAT/1/Project number/1/" + }); + + generatorph.Sender.SenderIban = "CH0200202020202020202"; + var ph3 = generatorph.AddPaymentInfo(DateTime.Now.AddDays(10), "TRA"); + + generatorph.AddTransaction(ph3, new Receiver + { + Name = "Hypo AG", + StreetName = "", + StreetNumber = "", + Zip = "70372", + City = "Stuttgart", + CountryCode = "DE" + }, + new TransactionIBANandQRR + { + CurrencyCode = "CHF", + Amount = 200, + ReceiverIban = "CH7777777777777777777", + ReferenceIdentification = "69-10", + QRReferenceNumber = "36 63580 00000 00000 30060 03574", + InstructionForDebtorAgent = "" + }); + + string retph = generatorph.GetPain001String(); + Assert.True(true); } diff --git a/iso20022-generator/iso20022-generator/Pain001Generator.cs b/iso20022-generator/iso20022-generator/Pain001Generator.cs index 086db15..c9381ea 100644 --- a/iso20022-generator/iso20022-generator/Pain001Generator.cs +++ b/iso20022-generator/iso20022-generator/Pain001Generator.cs @@ -13,18 +13,9 @@ namespace iso20022_generator public class Pain001Generator { private Document doc = new Document(); - private GroupHeader32CH grpHdr = new GroupHeader32CH(); // Index 1.0 - private PartyIdentification32CH_NameAndId initPty = new PartyIdentification32CH_NameAndId(); // Index 1.8 - private ContactDetails2CH ctctDtls = new ContactDetails2CH(); // Index 1.8 - private PartyIdentification32CH dbtr = new PartyIdentification32CH(); // Index 2.19 - private CashAccount16CH_IdTpCcy dbtrAcct = new CashAccount16CH_IdTpCcy(); // Index 2.20 - private AccountIdentification4ChoiceCH dbtrAcctId = new AccountIdentification4ChoiceCH(); // Index 2.20 / Id - private BranchAndFinancialInstitutionIdentification4CH_BicOrClrId dbtrAgt = new BranchAndFinancialInstitutionIdentification4CH_BicOrClrId(); // Index 2.21 - private FinancialInstitutionIdentification7CH_BicOrClrId finInstnIdDbtr = new FinancialInstitutionIdentification7CH_BicOrClrId(); // Index 2.21 / Financial Institution Identification - private List pmtInfList = new List(); // Index 2.0 - private CustomerCreditTransferInitiationV03CH cstmrCdtTrfInitn = new CustomerCreditTransferInitiationV03CH(); + private GroupHeader32CH grpHdr = new GroupHeader32CH(); // Index 1.0 private Initialization initialization; public Sender Sender { get; set; } @@ -35,6 +26,7 @@ public class Pain001Generator public Pain001Generator(Initialization init, Sender sender) { initialization = init; + doc.CstmrCdtTrfInitn = cstmrCdtTrfInitn; // Level A @@ -48,9 +40,11 @@ public Pain001Generator(Initialization init, Sender sender) grpHdr.CtrlSumSpecified = true; } + PartyIdentification32CH_NameAndId initPty = new PartyIdentification32CH_NameAndId(); // Index 1.8 grpHdr.InitgPty = initPty; // Index 1.8 initPty.Nm = sender.SenderPartyName; // Index 1.8 - Name + ContactDetails2CH ctctDtls = new ContactDetails2CH(); // Index 1.8 initPty.CtctDtls = ctctDtls; // Index 1.8 - Contact Details ctctDtls.Nm = init.ContactDetailsName; // Index 1.8 - Contact Details.Name ctctDtls.Othr = init.ContactDetailsOther; // Index 1.8 - Contact Details.Other @@ -77,19 +71,26 @@ public PaymentInstructionInformation3CH AddPaymentInfo(DateTime requiredExecutio pmtInf.BtchBookg = true; // Index 2.3 pmtInf.ReqdExctnDt = requiredExecutionDate; // Index 2.17 + PartyIdentification32CH dbtr = new PartyIdentification32CH(); // Index 2.19 pmtInf.Dbtr = dbtr; dbtr.Nm = Sender.SenderPartyName; + CashAccount16CH_IdTpCcy dbtrAcct = new CashAccount16CH_IdTpCcy(); // Index 2.20 pmtInf.DbtrAcct = dbtrAcct; + AccountIdentification4ChoiceCH dbtrAcctId = new AccountIdentification4ChoiceCH(); // Index 2.20 / Id dbtrAcct.Id = dbtrAcctId; dbtrAcctId.Item = Sender.SenderIban; // Index 2.20 / Id / IBAN Bezugs-Konto + BranchAndFinancialInstitutionIdentification4CH_BicOrClrId dbtrAgt = new BranchAndFinancialInstitutionIdentification4CH_BicOrClrId(); // Index 2.21 pmtInf.DbtrAgt = dbtrAgt; // Add BIC only if is set to guarantee the compatibility to the old version + FinancialInstitutionIdentification7CH_BicOrClrId finInstnIdDbtr = new FinancialInstitutionIdentification7CH_BicOrClrId(); // Index 2.21 / Financial Institution Identification if (!string.IsNullOrEmpty(Sender.SenderBic)) // Index 2.21 + { finInstnIdDbtr.BIC = Sender.SenderBic; + } dbtrAgt.FinInstnId = finInstnIdDbtr; @@ -313,7 +314,7 @@ public string GetPain001String() /// /// Allows direct access to the generated document object. This method is not thought to - /// be used under normal conditions however your financial institude maybe requires + /// be used under normal conditions however your financial institute maybe requires /// setting some addittional properties. /// /// Document object which will be serialized to xml diff --git a/iso20022-generator/iso20022-generator/README.md b/iso20022-generator/iso20022-generator/README.md index 302b176..da6b2de 100644 --- a/iso20022-generator/iso20022-generator/README.md +++ b/iso20022-generator/iso20022-generator/README.md @@ -68,8 +68,11 @@ https://www.six-group.com/dam/download/banking-services/interbank-clearing/de/st # Version Information +## 3.0.1 (2023-04-03) +- Corrected issue with unintentionally overriding of sender information + ## 3.0.0 (2023-03-30) - Breaking Changes -- Separeted Sender information from Initialzation +- Separated Sender information from Initialzation - Changed Sender information to public property - Added README.md for nuget package and moved help documentation to this file diff --git a/iso20022-generator/iso20022-generator/entity/Initialization.cs b/iso20022-generator/iso20022-generator/entity/Initialization.cs index fc2747c..0ff5a00 100644 --- a/iso20022-generator/iso20022-generator/entity/Initialization.cs +++ b/iso20022-generator/iso20022-generator/entity/Initialization.cs @@ -7,7 +7,7 @@ public class Initialization private decimal _controlSum; private string _contactDetailsName = "iso20022-Generator / enio AG"; - private string _contactDetailsOther = "3.0.0"; + private string _contactDetailsOther = "3.0.1"; public decimal ControlSum { diff --git a/iso20022-generator/iso20022-generator/iso20022-generator.csproj b/iso20022-generator/iso20022-generator/iso20022-generator.csproj index 8d9c7f4..fc38f94 100644 --- a/iso20022-generator/iso20022-generator/iso20022-generator.csproj +++ b/iso20022-generator/iso20022-generator/iso20022-generator.csproj @@ -10,11 +10,11 @@ iso20022Generator iso20022Generator - 3.0.0 + 3.0.1 enio AG This generator library helps you building iso 20022 artifacts with the minimum amount of information you need to set up valid documents. Currently pain.001 files are only supported. - 3.0.0.0 - 3.0.0.0 + 3.0.1.0 + 3.0.1.0 LICENSE.md README.md