Class Bill
- java.lang.Object
-
- net.codecrete.qrbill.generator.Bill
-
- All Implemented Interfaces:
java.io.Serializable
public class Bill extends java.lang.Object implements java.io.SerializableQR bill data- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBill.LanguageQR bill languagestatic classBill.VersionQR bill version
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringFIELD_ACCOUNTField name of the account numberstatic java.lang.StringFIELD_ADDITIONAL_INFOField name of the additional bill informationstatic java.lang.StringFIELD_AMOUNTField name of the amountstatic java.lang.StringFIELD_CODING_TYPEField name of the QR bill's coding typestatic java.lang.StringFIELD_CREDITOR_COUNTRY_CODEField name of the creditor's country codestatic java.lang.StringFIELD_CREDITOR_HOUSE_NOField name of the creditor's house numberstatic java.lang.StringFIELD_CREDITOR_NAMEField name of the creditor's namestatic java.lang.StringFIELD_CREDITOR_POSTAL_CODEField name of the creditor's postal coddestatic java.lang.StringFIELD_CREDITOR_STREETField name of the creditor's streetstatic java.lang.StringFIELD_CREDITOR_TOWNField name of the creditor's townstatic java.lang.StringFIELD_CURRENCYField name of the currencystatic java.lang.StringFIELD_DEBTOR_COUNTRY_CODEField name of the debtor's country codestatic java.lang.StringFIELD_DEBTOR_HOUSE_NOField name of the debtor's house numberstatic java.lang.StringFIELD_DEBTOR_NAMEField name of the debtor's namestatic java.lang.StringFIELD_DEBTOR_POSTAL_CODEField name of the debtor's postal codestatic java.lang.StringFIELD_DEBTOR_STREETField name of the debtor's streetstatic java.lang.StringFIELD_DEBTOR_TOWNField name of the debtor's townstatic java.lang.StringFIELD_DUE_DATEField name of the due datestatic java.lang.StringFIELD_FINAL_CREDITOR_COUNTRY_CODEField name of the final creditor's country codestatic java.lang.StringFIELD_FINAL_CREDITOR_HOUSE_NOField name of the final creditor's house numberstatic java.lang.StringFIELD_FINAL_CREDITOR_NAMEField name of the final creditor's namestatic java.lang.StringFIELD_FINAL_CREDITOR_POSTAL_CODEField name of the final creditor's postal codestatic java.lang.StringFIELD_FINAL_CREDITOR_STREETField name of the final creditor's streetstatic java.lang.StringFIELD_FINAL_CREDITOR_TOWNField name of the final creditor's townstatic java.lang.StringFIELD_LANGUAGEField name of the QR bill's coding typestatic java.lang.StringFIELD_QR_TYPEField name of the QR code typestatic java.lang.StringFIELD_REFERENCE_NOField name of the reference numberstatic java.lang.StringFIELD_VERSIONField name of the QR bill versionstatic java.lang.StringFIELDROOT_CREDITORStart of field name of the creditor addressstatic java.lang.StringFIELDROOT_DEBTORStart of field name of the debtor's addressstatic java.lang.StringFIELDROOT_FINAL_CREDITORStart of field name of the final creditor addressstatic java.lang.StringSUBFIELD_COUNTRY_CODERelative field of an address' country codestatic java.lang.StringSUBFIELD_HOUSE_NORelative field of an address' house numberstatic java.lang.StringSUBFIELD_NAMERelative field name of an address' namestatic java.lang.StringSUBFIELD_POSTAL_CODERelative field of an address' postal codestatic java.lang.StringSUBFIELD_STREETRelative field of an address' streetstatic java.lang.StringSUBFIELD_TOWNRelative field of an address' town
-
Constructor Summary
Constructors Constructor Description Bill()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateAndSetCreditorReference(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.booleanequals(java.lang.Object o)java.lang.StringgetAccount()Gets the creditor's account number.java.lang.StringgetAdditionalInfo()Gets the additional unstructured message.java.lang.DoublegetAmount()Gets the payment amountAddressgetCreditor()Gets the creditor address.java.lang.StringgetCurrency()Gets the payment currency.AddressgetDebtor()Gets the debtor's address.java.time.LocalDategetDueDate()Gets the payment's due date.AddressgetFinalCreditor()Gets the final creditor address.Bill.LanguagegetLanguage()Gets the bill language.java.lang.StringgetReferenceNo()Gets the payment reference numberBill.VersiongetVersion()Gets the version of the QR bill standard.inthashCode()voidsetAccount(java.lang.String account)Sets the creditor's account number.voidsetAdditionalInfo(java.lang.String additionalInfo)Sets the additional unstructured message.voidsetAmount(java.lang.Double amount)Sets the payment amount.voidsetCreditor(Address creditor)Sets the creditor address.voidsetCurrency(java.lang.String currency)Sets the payment currency.voidsetDebtor(Address debtor)Sets the debtor's address.voidsetDueDate(java.time.LocalDate dueDate)Sets the payment's due date.voidsetFinalCreditor(Address finalCreditor)Sets the final creditor address.voidsetLanguage(Bill.Language language)Sets the bill languagevoidsetReferenceNo(java.lang.String referenceNo)Sets the payment reference number.voidsetVersion(Bill.Version version)Sets the version of the QR bill standard.
-
-
-
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_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
-
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
-
FIELDROOT_FINAL_CREDITOR
public static final java.lang.String FIELDROOT_FINAL_CREDITOR
Start of field name of the final creditor address- See Also:
- Constant Field Values
-
FIELD_FINAL_CREDITOR_NAME
public static final java.lang.String FIELD_FINAL_CREDITOR_NAME
Field name of the final creditor's name- See Also:
- Constant Field Values
-
FIELD_FINAL_CREDITOR_STREET
public static final java.lang.String FIELD_FINAL_CREDITOR_STREET
Field name of the final creditor's street- See Also:
- Constant Field Values
-
FIELD_FINAL_CREDITOR_HOUSE_NO
public static final java.lang.String FIELD_FINAL_CREDITOR_HOUSE_NO
Field name of the final creditor's house number- See Also:
- Constant Field Values
-
FIELD_FINAL_CREDITOR_POSTAL_CODE
public static final java.lang.String FIELD_FINAL_CREDITOR_POSTAL_CODE
Field name of the final creditor's postal code- See Also:
- Constant Field Values
-
FIELD_FINAL_CREDITOR_TOWN
public static final java.lang.String FIELD_FINAL_CREDITOR_TOWN
Field name of the final creditor's town- See Also:
- Constant Field Values
-
FIELD_FINAL_CREDITOR_COUNTRY_CODE
public static final java.lang.String FIELD_FINAL_CREDITOR_COUNTRY_CODE
Field name of the final creditor's country code- See Also:
- Constant Field Values
-
FIELD_REFERENCE_NO
public static final java.lang.String FIELD_REFERENCE_NO
Field name of the reference number- See Also:
- Constant Field Values
-
FIELD_ADDITIONAL_INFO
public static final java.lang.String FIELD_ADDITIONAL_INFO
Field name of the additional bill information- 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
-
FIELD_DUE_DATE
public static final java.lang.String FIELD_DUE_DATE
Field name of the due date- See Also:
- Constant Field Values
-
-
Method Detail
-
getLanguage
public Bill.Language getLanguage()
Gets the bill language.- Returns:
- the language
-
setLanguage
public void setLanguage(Bill.Language language)
Sets the bill language- Parameters:
language- the language
-
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.lang.Double getAmount()
Gets the payment amount- Returns:
- the amount
-
setAmount
public void setAmount(java.lang.Double amount)
Sets the payment amount.Valid values are between 0.01 and 999,999,999.99
- 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
-
getDueDate
public java.time.LocalDate getDueDate()
Gets the payment's due date.- Returns:
- the due date
-
setDueDate
public void setDueDate(java.time.LocalDate dueDate)
Sets the payment's due date.The due date is optional.
- Parameters:
dueDate- the due date
-
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.
-
getFinalCreditor
public Address getFinalCreditor()
Gets the final creditor address.- Returns:
- the final creditor address
-
setFinalCreditor
public void setFinalCreditor(Address finalCreditor)
Sets the final creditor address.The final creditor is optional. If it is not used, both setting this field to
nullor setting an address with allnullor empty values is ok.- Parameters:
finalCreditor- the final creditor address
-
getReferenceNo
public java.lang.String getReferenceNo()
Gets the payment reference number- Returns:
- the reference number
-
setReferenceNo
public void setReferenceNo(java.lang.String referenceNo)
Sets the payment reference number.The reference number is mandatory for QR IBANs, i.e. IBANs in the range CHxx30000xxxxxx through CHxx31999xxxxx.
If specified, the reference number must be either a valid QR reference (which corresponds to the form ISR reference number) or a valid creditor reference according to ISO 11649 ("RFxxxx"). Both may contain spaces for formatting.
- Parameters:
referenceNo- 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- ifrawReferencecontains invalid characters
-
getAdditionalInfo
public java.lang.String getAdditionalInfo()
Gets the additional unstructured message.- Returns:
- the additional message
-
setAdditionalInfo
public void setAdditionalInfo(java.lang.String additionalInfo)
Sets the additional unstructured message.- Parameters:
additionalInfo- the additional message
-
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
nullor setting an address with allnullor empty values is ok.- Parameters:
debtor- the debtor address
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-