Class EbicsFileName
Holds the information of a file name structured according to the recommendations for EBICS files inside of a ZIP container.
Inheritance
Implements
Inherited Members
Namespace: Subsembly.EBICS
Assembly: Subsembly.EBICS.Core.dll
Syntax
public class EbicsFileName : IComparable<EbicsFileName>
Remarks
This implementation is based on the DK specification "Datenformate" which lays out the
structured format of a file name of XML files contained in a ZIP container as
JJJJ-MM-TT_CCC_X...X.xml
. This includes the creation date JJJJ-MM-TT
,
and the order type CCC
, separated by underscores. Depending on the order type
additional information X...X
may follow.
For account related files the additional information contains an account specification
as JJJJ-MM-TT_CCC_K...K_WWW_AAAAAA_X...X.xml
. Including an account K...K
,
a currency WWW
, a sequence identifier AAAAAA
, and optional additional
information X...X
.
In either case the file type suffix may be different than .xml
.
Some example file names from the DK specification:
2018-01-08_C53_DE87200500001234567890_EUR_000001.xml
2018-01-08_C53_20050000.1234567890_EUR_000001.xml
2018-01-08_C53_BANKDEFF123.1234567890_EUR_000001.xml
2018-01-08_C86_BANKDEFFXXX_KUNDEABC000001.xml
2018-01-08_BKA_DE87200500001234567890_EUR_000021.pdf
2018-02-23_BKI_DE87200500001234567890_EUR_000001_WPA.pdf
2020-11-06_C53_DE70720500000002168235_EUR_20-00118.xml
Some real world examples:
2021-03-11_C53_70040041.0664453800EUR_EUR_054305.xml
2021-03-30_C53_DE29201304005005001184_EUR_314441.xml
2021-03-31_BKA_DE29201304005005001184_EUR_000002_KA0114800638.pdf
Some swiss real world examples, which obviously do not follow these rules at all:
2021031113628496_6300CAMT053_2021031200223147_0.XML
2021022213472694_6300CAMT053_2021022300320003_0.XML
The EbicsFileSpooler uses this basic format for payment initiation files stored in its BOX_OUTBOX, too. The structure is according to:
2021-02-07_CCT_X...X.xml
2021-02-07_CDD_X...X.xml
2021-02-07_CIP_X...X.xml
2021-02-07_AZV_X...X.dta
The date part must match the creation date inside of the payment initiation xml.
The X...X part should match the message identification element inside of the payment
initiation xml. The order type is always the "plain" order type and never the
container or SRZ order type. These would be generated on the fly during transmission.
An actual file system file that a EbicsFileName references, may have its content encrypted by the EbicsFileSpooler. If so, the actual file system file name has an additional ENCRYPTEDFILENAMESUFFIX appended to it. See IsEncrypted.
A file may be marked as hidden by prefixing it with a single dot. Hidden files are not returned by directory queries, except when explicitly asked for.
Now (04.10.2022-) also parses "Aareal-style" EBICS-FileNames. So far we identified the following pattern:
Währung: always "EUR" by definition Datum: yyyyMMdd EKO -> synonym for "BKA" Auszugsnummer -> SequenceID Blattnummer -> AdditionalInfo Sample(s): E0055343_B20220729_EKO_00000110244_DE70720500000002168235_00023_01.pdf<Partner?>_B<Datum>_EKO_<?>_<IBAN>_<Auszugsnummer>_<Blattnummer>.pdf
Constructors
EbicsFileName(String, Boolean, Boolean)
Declaration
public EbicsFileName(string sFileName, bool fIsHidden = false, bool fIsEncrypted = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | sFileName | The file name with file type suffix, but usually without path and without ENCRYPTEDFILENAMESUFFIX or other decoration. These are added automatically, when needed. |
System.Boolean | fIsHidden | If the instance shall refer to a hidden file, that is, a file with a leading dot,
then this must be |
System.Boolean | fIsEncrypted | If the instance shall refer to an encrypted file, that is, a file with the
additional ENCRYPTEDFILENAMESUFFIX, then this must be |
Remarks
If the given sFileName
includes a leading dot, then it is
removed and fIsHidden
is assumed to be true
, regardless
of the actual parameter value.
If the given sFileName
includes the
ENCRYPTEDFILENAMESUFFIX, then it is removed and
fIsEncrypted
is assumed to be true
, regardless of the
actual parameter value.
Fields
ENCRYPTEDFILENAMESUFFIX
This additional suffix is appended to the original file name when the file content is encrypted by the file spooler.
Declaration
public const string ENCRYPTEDFILENAMESUFFIX = ".cryptd"
Field Value
Type | Description |
---|---|
System.String |
Properties
Account
Optional account specification, if included in the file name. This is null
if not present in the file name.
Declaration
public EbicsAccountInfo Account { get; }
Property Value
Type | Description |
---|---|
EbicsAccountInfo |
Remarks
The account specification always includes an account currency.
AdditionalInfo
Declaration
public string[] AdditionalInfo { get; }
Property Value
Type | Description |
---|---|
System.String[] |
ByteSize
Optional size of the file in bytes. This is zero, if it is not known.
Declaration
public long ByteSize { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
Date
The mandatory creation date part from the file name.
Declaration
public DateTime Date { get; }
Property Value
Type | Description |
---|---|
System.DateTime |
Remarks
This is always a valid date and is never DateTime.MinValue.
FileName
The complete file name with file type suffix (usually .xml
), but without any
file system path information, and without additional suffixes.
Declaration
public string FileName { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
This is never null
or an empty string. This file name does not include the
ENCRYPTEDFILENAMESUFFIX, even when the file system file it was
created from, did include this suffix.
See Also
FileNameWithoutSuffix
Declaration
public string FileNameWithoutSuffix { get; }
Property Value
Type | Description |
---|---|
System.String |
FileSystemFileName
The complete file system file name.
Declaration
public string FileSystemFileName { get; }
Property Value
Type | Description |
---|---|
System.String |
IsEncrypted
Flag that indicates that the actual file system file is encrypted by the spooler.
Declaration
public bool IsEncrypted { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
The value is derived from the presence of the ENCRYPTEDFILENAMESUFFIX by the ParseFileName(String, EbicsFileNameStyle) method.
IsHidden
File was prefixed with a single dot.
Declaration
public bool IsHidden { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
OrderType
The mandatory order type part from the file name.
Declaration
public string OrderType { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
This is never null, or empty, or an invalid order type specification.
SequenceID
Declaration
public string SequenceID { get; }
Property Value
Type | Description |
---|---|
System.String |
Suffix
The file name suffix including the period ".". This is the real file type suffix and never ENCRYPTEDFILENAMESUFFIX, even when the file system file it was created from, did include this suffix.
Declaration
public string Suffix { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
BuildFileName(SepaDocument, String, String, String[])
Creates a correct EBICS file name for a given CAMT document.
Declaration
public static EbicsFileName BuildFileName(SepaDocument aCamtDocument, string sOrderType, string sSuffix, string[] vsAdditionalInfo = null)
Parameters
Type | Name | Description |
---|---|---|
SepaDocument | aCamtDocument | The CAMT document to create an EBICS file name for. This must not be |
System.String | sOrderType | |
System.String | sSuffix | The file name extension including the leading dot character. This must be provided. Lower case characters are recommended. |
System.String[] | vsAdditionalInfo | Optional AdditionalInfo to be added to the filename. |
Returns
Type | Description |
---|---|
EbicsFileName |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The parameter |
System.ArgumentException | The document did not contain a single Statement element. |
BuildFileName(SepaDocument, String[])
Creates a correct EBICS file name for a given CAMT document.
Declaration
public static EbicsFileName BuildFileName(SepaDocument aDocument, string[] vsAdditionalInfo = null)
Parameters
Type | Name | Description |
---|---|---|
SepaDocument | aDocument | The PAIN or CAMT document to create an EBICS file name for. This must not be
|
System.String[] | vsAdditionalInfo | Optional AdditionalInfo to be added to the filename. |
Returns
Type | Description |
---|---|
EbicsFileName |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The parameter |
System.ArgumentException | The document did not contain a single Statement element. |
BuildFileName(DateTime, String, EbicsAccountInfo, String, String[], String)
Declaration
public static EbicsFileName BuildFileName(DateTime tDate, string sOrderType, EbicsAccountInfo aAccount, string sSequenceID, string[] vsAdditionalInfo, string sSuffix)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | tDate | The file creation date. This should match any creation date data field that might be contained inside of the file referenced. |
System.String | sOrderType | The base order type that would be used to transfer this file. This must not be
|
EbicsAccountInfo | aAccount | Optional account specification. May be |
System.String | sSequenceID | Sequence ID to make this file unique for the given |
System.String[] | vsAdditionalInfo | Optional additional info fields appended at the end of the file name. May be
|
System.String | sSuffix | The file name extension including the leading dot character. This must be provided. Lower case characters are recommended. |
Returns
Type | Description |
---|---|
EbicsFileName |
BuildFileName(DateTime, String, String[], String)
Declaration
public static EbicsFileName BuildFileName(DateTime tDate, string sOrderType, string[] vsAdditionalInfo, string sSuffix)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | tDate | |
System.String | sOrderType | |
System.String[] | vsAdditionalInfo | |
System.String | sSuffix | Value for the file name Suffix. |
Returns
Type | Description |
---|---|
EbicsFileName |
Clone()
Creates a duplicate of this file name.
Declaration
public EbicsFileName Clone()
Returns
Type | Description |
---|---|
EbicsFileName |
CompareTo(EbicsFileName)
Declaration
public int CompareTo(EbicsFileName aOtherFileName)
Parameters
Type | Name | Description |
---|---|---|
EbicsFileName | aOtherFileName |
Returns
Type | Description |
---|---|
System.Int32 |
ParseFileName(String, EbicsFileNameStyle)
Declaration
public static EbicsFileName ParseFileName(string sFileName, EbicsFileNameStyle nFileNameStyle = EbicsFileNameStyle.Unknown)
Parameters
Type | Name | Description |
---|---|---|
System.String | sFileName | The file name to be parsed. If this contains path information, it is removed before parsing. If this file name has the additional ENCRYPTEDFILENAMESUFFIX, then it will be removed and the flag IsEncrypted will be set in the returned EbicsFileName. |
EbicsFileNameStyle | nFileNameStyle | Indicates whether account information is expected in the file name, or not. If Unknown, then an assumption is made based on the order type extracted from the file name. |
Returns
Type | Description |
---|---|
EbicsFileName |
Remarks
Now (04.10.2022-) also parses "Aareal-Style" EBICS-FileNames (see class documentation for details).
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | |
System.ArgumentException | The given |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |