Show / Hide Table of Contents

Class Bill

QR bill data

Inheritance
System.Object
Bill
Implements
System.IEquatable<Bill>
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Codecrete.SwissQRBill.Generator
Assembly: Codecrete.SwissQRBill.Core.dll
Syntax
public sealed class Bill : IEquatable<Bill>

Fields

| Improve this Doc View Source

ReferenceTypeCredRef

Reference type: creditor reference (ISO 11649)

Declaration
public static readonly string ReferenceTypeCredRef
Field Value
Type Description
System.String
| Improve this Doc View Source

ReferenceTypeNoRef

Reference type: without reference.

Declaration
public static readonly string ReferenceTypeNoRef
Field Value
Type Description
System.String
| Improve this Doc View Source

ReferenceTypeQrRef

Reference type: QR reference.

Declaration
public static readonly string ReferenceTypeQrRef
Field Value
Type Description
System.String

Properties

| Improve this Doc View Source

Account

Gets or sets the creditor's account number.

Account numbers must be valid IBANs of a bank of Switzerland or Liechtenstein. Spaces are allowed in the account number.

Declaration
public string Account { get; set; }
Property Value
Type Description
System.String

The creditor account number.

| Improve this Doc View Source

AlternativeSchemes

Gets ors sets the alternative payment schemes.

A maximum of two schemes with parameters are allowed.

Declaration
public List<AlternativeScheme> AlternativeSchemes { get; set; }
Property Value
Type Description
System.Collections.Generic.List<AlternativeScheme>

The alternative payment schemes.

| Improve this Doc View Source

Amount

Gets or sets the payment amount.

Valid values are between 0.01 and 999,999,999.99.

Declaration
public decimal? Amount { get; set; }
Property Value
Type Description
System.Nullable<System.Decimal>

The payment amount.

| Improve this Doc View Source

BillInformation

Gets or sets the additional structured bill information.

Declaration
public string BillInformation { get; set; }
Property Value
Type Description
System.String

The structured bill information.

| Improve this Doc View Source

CharacterSet

Gets or sets the character set used for the QR bill data.

Defaults to Latin1Subset.

Until November 21, 2025, Latin1Subset is the only value that will generate QR bills accepted by all banks.

Declaration
public SpsCharacterSet CharacterSet { get; set; }
Property Value
Type Description
SpsCharacterSet
| Improve this Doc View Source

Creditor

Gets or sets the creditor address.

Declaration
public Address Creditor { get; set; }
Property Value
Type Description
Address

The creditor address.

| Improve this Doc View Source

Currency

Gets or sets the payment currency.

Valid values are "CHF" and "EUR".

Declaration
public string Currency { get; set; }
Property Value
Type Description
System.String

The payment currency.

| Improve this Doc View Source

Debtor

Gets or sets the debtor address.

The debtor is optional. If it is omitted, both setting this field to null or setting an address with all null or empty values is ok.

Declaration
public Address Debtor { get; set; }
Property Value
Type Description
Address

The debtor address.

| Improve this Doc View Source

Format

Gets or sets the bill formatting information.

Declaration
public BillFormat Format { get; set; }
Property Value
Type Description
BillFormat

The bill formatting information.

| Improve this Doc View Source

Reference

Gets or sets the creditor payment reference.

The reference is mandatory for QR IBANs, i.e. IBANs in the range CHxx30000xxxxxx through CHxx31999xxxxx. QR IBANs require a valid QR reference (numeric reference corresponding to the ISR reference format).

For non-QR IBANs, the reference is optional. If it is provided, it must be valid creditor reference according to ISO 11649 ("RFxxxx").

Both types of references may contain spaces for formatting.

Declaration
public string Reference { get; set; }
Property Value
Type Description
System.String

The creditor payment reference.

See Also
CreateAndSetCreditorReference(String)
CreateAndSetQRReference(String)
| Improve this Doc View Source

ReferenceType

Gets or sets the ype of payment reference

Declaration
public string ReferenceType { get; set; }
Property Value
Type Description
System.String

One of the constant values ReferenceTypeXxxRef

| Improve this Doc View Source

Separator

Gets or sets the line separator for the QR code data fields.

The default is Lf. There is no need to change it except for improving compatibility with a non-compliant software processing the QR code data.

Declaration
public Bill.QrDataSeparator Separator { get; set; }
Property Value
Type Description
Bill.QrDataSeparator

The line separator for the QR code data fields.

| Improve this Doc View Source

UnstructuredMessage

Gets or sets the additional unstructured message.

Declaration
public string UnstructuredMessage { get; set; }
Property Value
Type Description
System.String

The unstructured message.

| Improve this Doc View Source

Version

Gets or sets the version of the QR bill standard.

Declaration
public Bill.QrBillStandardVersion Version { get; set; }
Property Value
Type Description
Bill.QrBillStandardVersion

The QR bill standard version.

Methods

| Improve this Doc View Source

CreateAndSetCreditorReference(String)

Creates and sets 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 void CreateAndSetCreditorReference(string rawReference)
Parameters
Type Name Description
System.String rawReference

The raw reference.

Exceptions
Type Condition
System.ArgumentException

rawReference contains invalid characters.

| Improve this Doc View Source

CreateAndSetQRReference(String)

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

As the QR reference is numeric, the raw string must consist of digits and whitespace only. Whitespace is removed from the reference.

Declaration
public void CreateAndSetQRReference(string rawReference)
Parameters
Type Name Description
System.String rawReference

The raw reference.

Exceptions
Type Condition
System.ArgumentException

rawReference contains non-numeric characters or is too long.

| Improve this Doc View Source

Equals(Bill)

Determines whether the specified bill is equal to the current bill.

Declaration
public bool Equals(Bill other)
Parameters
Type Name Description
Bill other

The bill to compare with the current bill.

Returns
Type Description
System.Boolean

true if the specified object is equal to the current object; otherwise, false.

| Improve this Doc View Source

Equals(Object)

Determines whether the specified object is equal to the current object.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj

The object to compare with the current object.

Returns
Type Description
System.Boolean

true if the specified object is equal to the current object; otherwise, false.

Overrides
System.Object.Equals(System.Object)
| Improve this Doc View Source

GetHashCode()

Gets the hash code for this instance.

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32

A hash code for the current object.

Overrides
System.Object.GetHashCode()
| Improve this Doc View Source

RetrieveSwicoBillInformation()

Retrieves the Swico structured bill information from the text in bill information property.

If BillInformation contains Swico S1 bill information, the result is returned in a SwicoBillInformation instance. Minor errors in the text are silently ignored. If BillInformation does not contain Swico bill information or the text has major errors, null is returned.

Declaration
public SwicoBillInformation RetrieveSwicoBillInformation()
Returns
Type Description
SwicoBillInformation

structured bill information (or null if no Swico bill information is found)

Remarks

The bill information property likely contains structured bill information if it starts with //S1/.

| Improve this Doc View Source

SetSwicoBillInformation(SwicoBillInformation)

Sets the bill information according to Swico S1 syntax from the specified structured bill information.

Sets the BillInformation property to a value similar to //S1/10/....

Declaration
public void SetSwicoBillInformation(SwicoBillInformation billInformation)
Parameters
Type Name Description
SwicoBillInformation billInformation

structured bill information

| Improve this Doc View Source

UpdateReferenceType()

Updates the reference type by deriving it from the payment reference.

Declaration
public void UpdateReferenceType()

Implements

System.IEquatable<T>
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX