Class Bill
QR bill data
Inheritance
Implements
Inherited Members
Namespace: Codecrete.SwissQRBill.Generator
Assembly: Codecrete.SwissQRBill.Core.dll
Syntax
public sealed class Bill : IEquatable<Bill>
Fields
| Improve this Doc View SourceReferenceTypeCredRef
Reference type: creditor reference (ISO 11649)
Declaration
public static readonly string ReferenceTypeCredRef
Field Value
Type | Description |
---|---|
System.String |
ReferenceTypeNoRef
Reference type: without reference.
Declaration
public static readonly string ReferenceTypeNoRef
Field Value
Type | Description |
---|---|
System.String |
ReferenceTypeQrRef
Reference type: QR reference.
Declaration
public static readonly string ReferenceTypeQrRef
Field Value
Type | Description |
---|---|
System.String |
Properties
| Improve this Doc View SourceAccount
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. |
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. |
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. |
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. |
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 |
Creditor
Gets or sets the creditor address.
Declaration
public Address Creditor { get; set; }
Property Value
Type | Description |
---|---|
Address | The creditor address. |
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. |
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. |
Format
Gets or sets the bill formatting information.
Declaration
public BillFormat Format { get; set; }
Property Value
Type | Description |
---|---|
BillFormat | The bill formatting information. |
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
| Improve this Doc View SourceReferenceType
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 |
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. |
UnstructuredMessage
Gets or sets the additional unstructured message.
Declaration
public string UnstructuredMessage { get; set; }
Property Value
Type | Description |
---|---|
System.String | The unstructured message. |
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 SourceCreateAndSetCreditorReference(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 |
|
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 |
|
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 |
|
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 |
|
Overrides
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
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 |
Remarks
The bill information property likely contains structured bill information if it starts with //S1/
.
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 |
UpdateReferenceType()
Updates the reference type by deriving it from the payment reference.
Declaration
public void UpdateReferenceType()