Skip to content

Commit

Permalink
Separation of Sender information - Breaking Change
Browse files Browse the repository at this point in the history
- Separeted Sender information from Initialzation
- Changed Sender information to public property
- Added README.md for nuget package and moved help documentation to this file
  • Loading branch information
ThomasEnioKohler committed Mar 30, 2023
1 parent a202cee commit 5f35745
Show file tree
Hide file tree
Showing 8 changed files with 202 additions and 107 deletions.
26 changes: 16 additions & 10 deletions iso20022-generator/generator-test/GeneratorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,17 @@ public void InitGenerator()
var generator = new Pain001Generator(new Initialization()
{
UniqueDocumentId = Guid.NewGuid().ToString().Substring(0, 34), // Must be unique for the bank within 90 days
SenderPartyName = "enio AG",
SenderIban = "CH90 8136 1000 0338 6282 8",
SenderBic = "CRESCHZZ80A", //CS
ContactDetailsName = "enio AG",
ContactDetailsOther = "2.1.0",
ContactDetailsOther = "3.0.0",
AutoCalculateControlSum = true
// SenderBic = "ZKBKCHZZ80A" //ZKB
});
},
new Sender()
{
SenderPartyName = "enio AG",
SenderIban = "CH90 8136 1000 0338 6282 8",
SenderBic = "CRESCHZZ80A", //CS
});

var p1 = generator.AddPaymentInfo(DateTime.Now.AddDays(10), "TRA");

Expand Down Expand Up @@ -89,14 +92,17 @@ public void InitGenerator()
var generator2 = new Pain001Generator(new Initialization()
{
UniqueDocumentId = Guid.NewGuid().ToString().Substring(0, 34), // Must be unique for the bank within 90 days
SenderPartyName = "enio AG",
SenderIban = "CH90 8136 1000 0338 6282 8",
SenderBic = "CRESCHZZ80A", //CS
ContactDetailsName = "enio AG",
ContactDetailsOther = "2.1.0",
ContactDetailsOther = "3.0.0",
AutoCalculateControlSum = true
// SenderBic = "ZKBKCHZZ80A" //ZKB
});
},
new Sender()
{
SenderPartyName = "enio AG",
SenderIban = "CH90 8136 1000 0338 6282 8",
SenderBic = "CRESCHZZ80A", //CS
});

var p3 = generator2.AddPaymentInfo(DateTime.Now.AddDays(10), "TRA");

Expand Down
53 changes: 0 additions & 53 deletions iso20022-generator/iso20022-generator/Help.md

This file was deleted.

14 changes: 14 additions & 0 deletions iso20022-generator/iso20022-generator/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Iso20022 Generator ist licensed under the Apache License

Copyright (c) .NET Foundation. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use
these files except in compliance with the License. You may obtain a copy of the
License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
14 changes: 8 additions & 6 deletions iso20022-generator/iso20022-generator/Pain001Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ public class Pain001Generator

private CustomerCreditTransferInitiationV03CH cstmrCdtTrfInitn = new CustomerCreditTransferInitiationV03CH();
private Initialization initialization;
public Sender Sender { get; set; }

/// <summary>
/// Initializes a new generator which allows creating ISO20022-pain.001 files.
/// </summary>
/// <param name="init">Object with all the required information for setting up a new transaction document.</param>
public Pain001Generator(Initialization init)
public Pain001Generator(Initialization init, Sender sender)
{
initialization = init;
doc.CstmrCdtTrfInitn = cstmrCdtTrfInitn;
Expand All @@ -49,10 +50,11 @@ public Pain001Generator(Initialization init)

grpHdr.InitgPty = initPty; // Index 1.8

initPty.Nm = init.SenderPartyName; // Index 1.8 - Name
initPty.Nm = sender.SenderPartyName; // Index 1.8 - Name
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
Sender=sender;
}

public PaymentInstructionInformation3CH AddPaymentInfo(DateTime requiredExecutionDate, string paymentMethod = "TRA")
Expand All @@ -77,17 +79,17 @@ public PaymentInstructionInformation3CH AddPaymentInfo(DateTime requiredExecutio
pmtInf.ReqdExctnDt = requiredExecutionDate; // Index 2.17
pmtInf.Dbtr = dbtr;

dbtr.Nm = initialization.SenderPartyName;
dbtr.Nm = Sender.SenderPartyName;

pmtInf.DbtrAcct = dbtrAcct;
dbtrAcct.Id = dbtrAcctId;
dbtrAcctId.Item = initialization.SenderIban; // Index 2.20 / Id / IBAN Bezugs-Konto
dbtrAcctId.Item = Sender.SenderIban; // Index 2.20 / Id / IBAN Bezugs-Konto

pmtInf.DbtrAgt = dbtrAgt;

// Add BIC only if is set to guarantee the compatibility to the old version
if (!string.IsNullOrEmpty(initialization.SenderBic)) // Index 2.21
finInstnIdDbtr.BIC = initialization.SenderBic;
if (!string.IsNullOrEmpty(Sender.SenderBic)) // Index 2.21
finInstnIdDbtr.BIC = Sender.SenderBic;

dbtrAgt.FinInstnId = finInstnIdDbtr;

Expand Down
120 changes: 120 additions & 0 deletions iso20022-generator/iso20022-generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
The iso20022-generator is a c# library which helps you generating iso 20022 artifacts with the minimum amount of information you need to set up valid documents.

What you can do at the moment:
- Currently the creation of pain.001 files is the only thing the library can do.
- The file can contain multiple transactions to different receivers.
- You can add multiple payment information records with multiple transactions each. Each with its different execution date.
- Swiss QR with reference number (QRR). Use IBANandQRR transaction type and set QRReferenceNumber property.

Limitations:
- Although the iso20022 is a standard definition it looks as there are a lot of excess to this standard in the world. The library was mainly built for communication with swiss banks. To be precise the library was successfully tested against the test environments from the following banks: Raiffeisen Bank Schweiz, Credit Suisse, UBS and Zürcher Kantonalbank

Usage:
have a look into the happy test file

# Schemas and Examples
## Kunde-Bank-Meldungen

https://www.six-group.com/de/products-services/banking-services/standardization/iso-payments.html

# Swiss Payment Standards 2021
## Schweizer Business Rules für Zahlungen und Cash Management für Kunde-Bank-Meldungen
Version 2.10, gültig per 19. November 2021

https://www.six-group.com/dam/download/banking-services/interbank-clearing/de/standardization/iso/swiss-recommendations/archives/business-rules/business-rules.pdf

# Swiss Payment Standards 2021

## Schweizer Implementation Guidelines für Kunde-Bank-Meldungen für Überweisungen im Zahlungsverkehr

### Customer Credit Transfer Initiation (pain.001)

Version 1.11, gültig per 19. November 2021

https://www.six-group.com/dam/download/banking-services/interbank-clearing/de/standardization/iso/swiss-recommendations/archives/implementation-guidelines-ct/implementation-guidelines-ct.pdf

# Swiss Payment Standards 2021
## Swiss Implementation Guidelines for Customer-Bank Messages Credit Transfer (Payment Transactions)

### Customer Credit Transfer Initiation (pain.001)

Version 1.11, with effect from 19 November 2021
https://www.six-group.com/dam/download/banking-services/interbank-clearing/en/standardization/iso/swiss-recommendations/implementation-guidelines-ct.pdf

# ISO 20022 Payments

## Schweizer Implementation Guidelines für Kunde-Bank-Meldungen für SEPA-Lastschriften

### Customer Direct Debit Initiation (pain.008)

https://www.six-group.com/dam/download/banking-services/interbank-clearing/de/standardization/iso/swiss-recommendations/archives/implementation-guidelines-sdd/implementation-guidelines-sdd_v2_5_1.pdf

# Payment Types

![Paymenttypes](Assets/zahlungsarten.png)

# Zahlungsarten

![Paymenttypes](Assets/paymenttypes.png)

## Implemented and tested

| Description | Type | Implementation | Local Instrument |
|:---|:---|:---|:---|
| ESR - orange with reference number -> !!!!obsolete!!!!| 1 | TransactionESR | CH01 |
| ES - red no reference number -> !!!!obsolete!!!!| 2.1 | TransactionES | CH02 |
| IBAN/QRR | 3 | TransactionIBANandQRR | |
| IBAN/SCOR | 3 | TransactionIBANandSCOR | |


# Version Information
## 3.0.0 (2023-03-30) - Breaking Changes
- Separeted Sender information from Initialzation
- Changed Sender information to public property
- Added README.md for nuget package and moved help documentation to this file

## 2.1.1 (2023-03-24)
Corrected null pointer exception on missing additional remittance information

## 2.1.0 (2022-11-22)
Added possibility to change contact detail and contact detail other values (Index 1.8)
- Added configuration for payment method (TFA, TRA, CHK, ....) (Index 2.2)
- Removed field PaymentType -> obsolete
- Added additional remittance information field for QRR transaction
- Added unstructured remittance information for IBAN
- Removed ESR and ES transactions -> obsolete
- Added configuration for control sum field (Index 1.7)
- Added AutoCalculateControlSum field

## 2.0.0 (2022-10-12)
- Added InstructionForDebtorAgent Index 2.85
- Updated help

## 1.6.1 (2022-10-15)
- Added IBAN and SCOR transaction. Allow empty address and receiver name
- Bump NuGet.CommandLine from 4.9.5 to 4.9.6

## 1.6.0 (2022-10-15)
- Added QR with Reference

## 1.4.0 (2022-10-14)
- Extended generator to add more than one payment info record including the feature to use a different required execution date per payment info

## 1.4.0 (2022-10-12)
- Implementation of ESR and ES 1, introduced transactions for each implementation
- FIX: Implemenetation of required BIC Code for PostFinance support

## 1.3.0 (2021-12-02)
- Fixed issue with amount in payment file

## 1.1.0 (2021-11-02)
- Fixed issue with setting property Street-Number (StrtNm, 2.79)

## 1.0.0 (2021-10-15)
- Initial release

# Links

- [License](LICENSE.md)
- [Homepage enio AG](https://www.enio.ch)
- [Releases](https://github.com/enioag/iso20022-generator/releases)
31 changes: 2 additions & 29 deletions iso20022-generator/iso20022-generator/entity/Initialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,10 @@ namespace iso20022_generator.entity
{
public class Initialization
{
private string _senderIban;
private string _senderBic = "";

private decimal _controlSum;
private string _contactDetailsName = "iso20022-Generator / enio AG";
private string _contactDetailsOther = "2.1.0";

public string SenderPartyName { get; set; }

public string SenderIban
{
get => _senderIban;
set
{
if (string.IsNullOrWhiteSpace(value))
throw new ArgumentException("Sender IBAN cannot be null or whitespace.", nameof(value));
if (value.Length < 20)
throw new ArgumentException("Sender IBAN is to short", nameof(value));
_senderIban = value.Replace(" ", "");
}
}

public string SenderBic
{
get => _senderBic;
set
{
if (value.Length > 11)
throw new ArgumentException("Sender BIC is to long", nameof(value));
_senderBic = value;
}
}
private string _contactDetailsOther = "3.0.0";

public decimal ControlSum
{
Expand Down
35 changes: 35 additions & 0 deletions iso20022-generator/iso20022-generator/entity/Sender.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;

namespace iso20022_generator.entity
{
public class Sender
{
private string _senderIban;
private string _senderBic = "";
public string SenderPartyName { get; set; }

public string SenderIban
{
get => _senderIban;
set
{
if (string.IsNullOrWhiteSpace(value))
throw new ArgumentException("Sender IBAN cannot be null or whitespace.", nameof(value));
if (value.Length < 20)
throw new ArgumentException("Sender IBAN is to short", nameof(value));
_senderIban = value.Replace(" ", "");
}
}

public string SenderBic
{
get => _senderBic;
set
{
if (value.Length > 11)
throw new ArgumentException("Sender BIC is to long", nameof(value));
_senderBic = value;
}
}
}
}
16 changes: 7 additions & 9 deletions iso20022-generator/iso20022-generator/iso20022-generator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
<PackageLicenseUrl></PackageLicenseUrl>
<PackageId>iso20022Generator</PackageId>
<Product>iso20022Generator</Product>
<Version>2.1.1</Version>
<Version>3.0.0</Version>
<Copyright>enio AG</Copyright>
<Description>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.</Description>
<AssemblyVersion>2.1.1.0</AssemblyVersion>
<FileVersion>2.1.0.0</FileVersion>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<FileVersion>3.0.0.0</FileVersion>
<PackageLicenseFile>license.txt</PackageLicenseFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

<ItemGroup>
Expand All @@ -25,11 +26,8 @@
</PackageReference>
</ItemGroup>

<ItemGroup>
<None Include="..\license.txt">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>
<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>

</Project>

0 comments on commit 5f35745

Please sign in to comment.