Class Bill

  • All Implemented Interfaces:
    java.io.Serializable

    public class Bill
    extends java.lang.Object
    implements java.io.Serializable
    QR bill data
    See Also:
    Serialized Form
    • Field Detail

      • SUBFIELD_NAME

        public static final java.lang.String SUBFIELD_NAME
        Relative field name of an address' name
        See Also:
        Constant Field Values
      • SUBFIELD_ADDRESS_LINE_1

        public static final java.lang.String SUBFIELD_ADDRESS_LINE_1
        Relative field of an address' line 1
        See Also:
        Constant Field Values
      • SUBFIELD_ADDRESS_LINE_2

        public static final java.lang.String SUBFIELD_ADDRESS_LINE_2
        Relative field of an address' line 2
        See Also:
        Constant Field Values
      • SUBFIELD_STREET

        public static final java.lang.String SUBFIELD_STREET
        Relative field of an address' street
        See Also:
        Constant Field Values
      • SUBFIELD_HOUSE_NO

        public static final java.lang.String SUBFIELD_HOUSE_NO
        Relative field of an address' house number
        See Also:
        Constant Field Values
      • SUBFIELD_POSTAL_CODE

        public static final java.lang.String SUBFIELD_POSTAL_CODE
        Relative field of an address' postal code
        See Also:
        Constant Field Values
      • SUBFIELD_TOWN

        public static final java.lang.String SUBFIELD_TOWN
        Relative field of an address' town
        See Also:
        Constant Field Values
      • SUBFIELD_COUNTRY_CODE

        public static final java.lang.String SUBFIELD_COUNTRY_CODE
        Relative field of an address' country code
        See Also:
        Constant Field Values
      • FIELD_QR_TYPE

        public static final java.lang.String FIELD_QR_TYPE
        Field name of the QR code type
        See Also:
        Constant Field Values
      • FIELD_VERSION

        public static final java.lang.String FIELD_VERSION
        Field name of the QR bill version
        See Also:
        Constant Field Values
      • FIELD_CODING_TYPE

        public static final java.lang.String FIELD_CODING_TYPE
        Field name of the QR bill's coding type
        See Also:
        Constant Field Values
      • FIELD_LANGUAGE

        public static final java.lang.String FIELD_LANGUAGE
        Field name of the QR bill's coding type
        See Also:
        Constant Field Values
      • FIELD_CURRENCY

        public static final java.lang.String FIELD_CURRENCY
        Field name of the currency
        See Also:
        Constant Field Values
      • FIELD_AMOUNT

        public static final java.lang.String FIELD_AMOUNT
        Field name of the amount
        See Also:
        Constant Field Values
      • FIELD_ACCOUNT

        public static final java.lang.String FIELD_ACCOUNT
        Field name of the account number
        See Also:
        Constant Field Values
      • FIELD_REFERENCE

        public static final java.lang.String FIELD_REFERENCE
        Field name of the reference
        See Also:
        Constant Field Values
      • FIELDROOT_CREDITOR

        public static final java.lang.String FIELDROOT_CREDITOR
        Start of field name of the creditor address
        See Also:
        Constant Field Values
      • FIELD_CREDITOR_NAME

        public static final java.lang.String FIELD_CREDITOR_NAME
        Field name of the creditor's name
        See Also:
        Constant Field Values
      • FIELD_CREDITOR_STREET

        public static final java.lang.String FIELD_CREDITOR_STREET
        Field name of the creditor's street
        See Also:
        Constant Field Values
      • FIELD_CREDITOR_HOUSE_NO

        public static final java.lang.String FIELD_CREDITOR_HOUSE_NO
        Field name of the creditor's house number
        See Also:
        Constant Field Values
      • FIELD_CREDITOR_POSTAL_CODE

        public static final java.lang.String FIELD_CREDITOR_POSTAL_CODE
        Field name of the creditor's postal codde
        See Also:
        Constant Field Values
      • FIELD_CREDITOR_TOWN

        public static final java.lang.String FIELD_CREDITOR_TOWN
        Field name of the creditor's town
        See Also:
        Constant Field Values
      • FIELD_CREDITOR_COUNTRY_CODE

        public static final java.lang.String FIELD_CREDITOR_COUNTRY_CODE
        Field name of the creditor's country code
        See Also:
        Constant Field Values
      • FIELD_UNSTRUCTURED_MESSAGE

        public static final java.lang.String FIELD_UNSTRUCTURED_MESSAGE
        Field name of the unstructured message
        See Also:
        Constant Field Values
      • FIELD_BILL_INFORMATION

        public static final java.lang.String FIELD_BILL_INFORMATION
        Field name of the bill information
        See Also:
        Constant Field Values
      • FIELD_ALTERNATIVE_SCHEMES

        public static final java.lang.String FIELD_ALTERNATIVE_SCHEMES
        Field name of the alternative schemes
        See Also:
        Constant Field Values
      • FIELDROOT_DEBTOR

        public static final java.lang.String FIELDROOT_DEBTOR
        Start of field name of the debtor's address
        See Also:
        Constant Field Values
      • FIELD_DEBTOR_NAME

        public static final java.lang.String FIELD_DEBTOR_NAME
        Field name of the debtor's name
        See Also:
        Constant Field Values
      • FIELD_DEBTOR_STREET

        public static final java.lang.String FIELD_DEBTOR_STREET
        Field name of the debtor's street
        See Also:
        Constant Field Values
      • FIELD_DEBTOR_HOUSE_NO

        public static final java.lang.String FIELD_DEBTOR_HOUSE_NO
        Field name of the debtor's house number
        See Also:
        Constant Field Values
      • FIELD_DEBTOR_POSTAL_CODE

        public static final java.lang.String FIELD_DEBTOR_POSTAL_CODE
        Field name of the debtor's postal code
        See Also:
        Constant Field Values
      • FIELD_DEBTOR_TOWN

        public static final java.lang.String FIELD_DEBTOR_TOWN
        Field name of the debtor's town
        See Also:
        Constant Field Values
      • FIELD_DEBTOR_COUNTRY_CODE

        public static final java.lang.String FIELD_DEBTOR_COUNTRY_CODE
        Field name of the debtor's country code
        See Also:
        Constant Field Values
    • Constructor Detail

      • Bill

        public Bill()
    • Method Detail

      • getVersion

        public Bill.Version getVersion()
        Gets the version of the QR bill standard.
        Returns:
        the version
      • setVersion

        public void setVersion​(Bill.Version version)
        Sets the version of the QR bill standard.
        Parameters:
        version - the version
      • getAmount

        public java.math.BigDecimal getAmount()
        Gets the payment amount
        Returns:
        the amount
      • getAmountAsDouble

        public java.lang.Double getAmountAsDouble()
        Gets the payment amount as a Double instance
        Returns:
        the amount
      • setAmount

        public void setAmount​(java.math.BigDecimal amount)
        Sets the payment amount.

        Valid values are between 0.01 and 999,999,999.99

        Parameters:
        amount - the amount
      • setAmountFromDouble

        public void setAmountFromDouble​(java.lang.Double amount)
        Sets the payment amount from a Double solid-line-with_scissors

        The value is saved with a scale of 2.

        Parameters:
        amount - the amount
      • getCurrency

        public java.lang.String getCurrency()
        Gets the payment currency.
        Returns:
        the currency
      • setCurrency

        public void setCurrency​(java.lang.String currency)
        Sets the payment currency.

        Valid values are "CHF" and "EUR".

        Parameters:
        currency - the currency
      • getAccount

        public java.lang.String getAccount()
        Gets the creditor's account number.
        Returns:
        the account number
      • setAccount

        public void setAccount​(java.lang.String account)
        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.

        Parameters:
        account - the account number
      • getCreditor

        public Address getCreditor()
        Gets the creditor address.
        Returns:
        the creditor address
      • setCreditor

        public void setCreditor​(Address creditor)
        Sets the creditor address.
        Parameters:
        creditor - the creditor address.
      • getReference

        public java.lang.String getReference()
        Gets the payment reference
        Returns:
        the reference
      • setReference

        public void setReference​(java.lang.String reference)
        Sets the payment reference.

        The reference is mandatory for QR IBANs, i.e. IBANs in the range CHxx30000xxxxxx through CHxx31999xxxxx.

        If specified, the reference must be either a valid QR reference (which corresponds to the form ISR reference) or a valid creditor reference according to ISO 11649 ("RFxxxx"). Both may contain spaces for formatting.

        Parameters:
        reference - the payment reference number
      • createAndSetCreditorReference

        public void createAndSetCreditorReference​(java.lang.String rawReference)
        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

        Parameters:
        rawReference - The raw string
        Throws:
        java.lang.IllegalArgumentException - if rawReference contains invalid characters
      • getDebtor

        public Address getDebtor()
        Gets the debtor's address.
        Returns:
        the debtor address
      • setDebtor

        public void setDebtor​(Address debtor)
        Sets the debtor's 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.

        Parameters:
        debtor - the debtor address
      • getUnstructuredMessage

        public java.lang.String getUnstructuredMessage()
        Gets the additional unstructured message.
        Returns:
        the unstructured message
      • setUnstructuredMessage

        public void setUnstructuredMessage​(java.lang.String unstructuredMessage)
        Sets the additional unstructured message.
        Parameters:
        unstructuredMessage - the unstructured message
      • getBillInformation

        public java.lang.String getBillInformation()
        Gets the additional bill information.
        Returns:
        bill information
      • setBillInformation

        public void setBillInformation​(java.lang.String billInformation)
        Sets the additional bill information
        Parameters:
        billInformation - bill information
      • getAlternativeSchemes

        public AlternativeScheme[] getAlternativeSchemes()
        Get the alternative schemes.

        A maximum of two schemes are allowed.

        Returns:
        alternative schemes
      • setAlternativeSchemes

        public void setAlternativeSchemes​(AlternativeScheme[] alternativeSchemes)
        Sets the alternative scheme parameters.

        A maximum of two schemes with parameters are allowed.

        Parameters:
        alternativeSchemes - alternative payment scheme information
      • getFormat

        public BillFormat getFormat()
        Gets the bill format.
        Returns:
        bill format
      • setFormat

        public void setFormat​(BillFormat format)
        Sets the bill format.
        Parameters:
        format - bill format
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object