Show / Hide Table of Contents

Class Payments

Field validations related to Swiss Payment standards.

Inheritance
object
Payments
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Codecrete.SwissQRBill.Generator
Assembly: Codecrete.SwissQRBill.Core.dll
Syntax
public static class Payments

Methods

| Edit this page View Source

CleanValue(string, out CleaningResult)

Cleans a string value to make it viable for the Swiss Payment Standards 2018.

Unsupported characters are replaced with supported characters, either with the same character without accent (e.g. A instead of Ă), with characters of similar meaning (e.g. TM instead of ™, ij instead of ij), with a space (for unsupported whitespace characters) or with a dot.

Some valid letters can be represented either with a single Unicode code point or with two code points, e.g. the letter A with umlaut can be represented either with the single code point U+00C4 (latin capital letter A with diaeresis) or with the two code points U+0041 U+0308 (latin capital letter A, combining diaeresis). This will be detected and converted to the valid single code point form.

If value is null or the resulting string would be empty, null is returned.

Declaration
public static void CleanValue(string value, out Payments.CleaningResult result)
Parameters
Type Name Description
string value

The string value to clean.

Payments.CleaningResult result

The result to be filled with cleaned string and flag.

| Edit this page View Source

CleanedAndTrimmedText(string, SpsCharacterSet)

Returns a cleaned and trimmed text valid according to the specified character set.

Unsupported characters are replaced with supported characters, either with the same character without accent (e.g. A instead of Ă), with characters of similar meaning (e.g. TM instead of ™, ij instead of ij), with a space (for unsupported whitespace characters) or with a dot.

Leading and trailing whitespace is removed. Multiple consecutive spaces are replaced with a single whitespace.

Some valid letters can be represented either with a single Unicode code point or with two code points, e.g. the letter A with umlaut can be represented either with the single code point U+00C4 (latin capital letter A with diaeresis) or with the two code points U+0041 U+0308 (latin capital letter A, combining diaeresis). This will be detected and converted to the valid single code point form.

If text is null or the resulting string would be empty, null is returned.

The string value to clean. Character set specifying valid characters. valid text for Swiss payments
Declaration
public static string CleanedAndTrimmedText(string text, SpsCharacterSet characterSet)
Parameters
Type Name Description
string text
SpsCharacterSet characterSet
Returns
Type Description
string
| Edit this page View Source

CleanedText(string, SpsCharacterSet)

Returns a cleaned text valid according to the specified character set.

Unsupported characters are replaced with supported characters, either with the same character without accent (e.g. A instead of Ă), with characters of similar meaning (e.g. TM instead of ™, ij instead of ij), with a space (for unsupported whitespace characters) or with a dot.

Some valid letters can be represented either with a single Unicode code point or with two code points, e.g. the letter A with umlaut can be represented either with the single code point U+00C4 (latin capital letter A with diaeresis) or with the two code points U+0041 U+0308 (latin capital letter A, combining diaeresis). This will be detected and converted to the valid single code point form.

If text is null or the resulting string would be empty, null is returned.

The string value to clean. Character set specifying valid characters. valid text for Swiss payments
Declaration
public static string CleanedText(string text, SpsCharacterSet characterSet)
Parameters
Type Name Description
string text
SpsCharacterSet characterSet
Returns
Type Description
string
| Edit this page View Source

CreateIso11649Reference(string)

Creates a ISO11649 creditor reference from a raw string by prefixing the string with "RF" and the modulo 97 checksum

Whitespace is removed from the reference.

Declaration
public static string CreateIso11649Reference(string rawReference)
Parameters
Type Name Description
string rawReference

The raw reference.

Returns
Type Description
string

The created creditor reference.

Exceptions
Type Condition
ArgumentException

reference contains invalid characters.

| Edit this page View Source

CreateQRReference(string)

Creates a QR reference from a raw string by appending the checksum digit and prepending zeros to make it the correct length.

Whitespace is removed from the reference.

Declaration
public static string CreateQRReference(string rawReference)
Parameters
Type Name Description
string rawReference

The raw string (digits and whitespace only).

Returns
Type Description
string

The QR reference.

Exceptions
Type Condition
ArgumentException

The reference contains non-numeric characters or is too long

| Edit this page View Source

FormatIban(string)

Formats an IBAN or creditor reference by inserting spaces

Spaces are inserted to form groups of 4 letters/digits. If a group of less than 4 letters/digits is needed, it appears at the end.

Declaration
public static string FormatIban(string iban)
Parameters
Type Name Description
string iban

The IBAN or creditor reference without spaces.

Returns
Type Description
string

The formatted IBAN or creditor reference.

| Edit this page View Source

FormatQrReferenceNumber(string)

Formats a QR reference number by inserting spaces.

Spaces are inserted to create groups of 5 digits. If a group of less than 5 digits is needed, it appears at the start of the formatted reference number.

Declaration
public static string FormatQrReferenceNumber(string refNo)
Parameters
Type Name Description
string refNo

The reference number without white space.

Returns
Type Description
string

the formatted reference number.

| Edit this page View Source

IsQrIban(string)

Indicates if the string is a valid QR-IBAN.

QR-IBANs are IBANs with an institution ID in the range 30000 to 31999 and a country code for Switzerland or Liechtenstein. Thus, they must have the format "CH..30...", "CH..31...", "LI..30..." or "LI..31...".

Declaration
public static bool IsQrIban(string iban)
Parameters
Type Name Description
string iban

account number to check

Returns
Type Description
bool

true for valid QR-IBANs, false otherwise

| Edit this page View Source

IsValidIban(string)

Validates if the string is a valid IBAN number

The string is checked for valid characters, valid length and for a valid check digit. White space is ignored.

Declaration
public static bool IsValidIban(string iban)
Parameters
Type Name Description
string iban

The IBAN to validate.

Returns
Type Description
bool

true if the IBAN is valid, false otherwise.

| Edit this page View Source

IsValidIso11649Reference(string)

Validates if the string is a valid ISO 11649 reference number

The string is checked for valid characters, valid length and a valid check digit. White space is ignored.

Declaration
public static bool IsValidIso11649Reference(string reference)
Parameters
Type Name Description
string reference

The ISO 11649 creditor reference to validate.

Returns
Type Description
bool

true if the creditor reference is valid, false otherwise.

| Edit this page View Source

IsValidQrReference(string)

Validates if the string is a valid QR reference.

A valid QR reference is a valid ISR reference.

The string is checked for valid characters, valid length and a valid check digit. White space is ignored.

Declaration
public static bool IsValidQrReference(string reference)
Parameters
Type Name Description
string reference

The QR reference number to validate.

Returns
Type Description
bool

true if the reference number is valid, false otherwise.

| Edit this page View Source

IsValidText(string, SpsCharacterSet)

Indicates if the text consists only of characters allowed in the specified character set.

This method does not attempt to deal with accents and umlauts built from two code points. It will return false if the text contains such characters.

Declaration
public static bool IsValidText(string text, SpsCharacterSet characterSet)
Parameters
Type Name Description
string text

text to check, possibly null

SpsCharacterSet characterSet

Character set specifying valid characters.

Returns
Type Description
bool

true if the text is valid, false otherwise

  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX