Class SwicoBillInformation
- java.lang.Object
-
- net.codecrete.qrbill.generator.SwicoBillInformation
-
public class SwicoBillInformation extends java.lang.ObjectBill information (according to Swico S1) for automated processing of invoices.Swico S1 (see http://swiss-qr-invoice.org/downloads/qr-bill-s1-syntax-de.pdf) is one of the supported standards for adding structured billing information to a QR bill (in the field StrdBkgInf).
All properties of this bean are optional.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSwicoBillInformation.PaymentConditionPayment condition detail: a tuple of discount and validity in days.static classSwicoBillInformation.RateDetailVAT rate detail: a tuple of VAT rate and amount.
-
Constructor Summary
Constructors Constructor Description SwicoBillInformation()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SwicoBillInformationdecodeText(java.lang.String text)Decodes the text of structured billing information and creates aSwicoBillInformationinstance.java.lang.StringencodeAsText()Encodes this bill information as a single text string suitable to be added to a Swiss QR bill.booleanequals(java.lang.Object o)java.lang.StringgetCustomerReference()Gets the customer reference.java.time.LocalDategetDueDate()Gets the payment due date.java.time.LocalDategetInvoiceDate()Gets the invoice date.java.lang.StringgetInvoiceNumber()Gets the invoice number.java.util.List<SwicoBillInformation.PaymentCondition>getPaymentConditions()Gets the payment conditions.java.time.LocalDategetVatDate()Gets the date when the goods or service were supplied.java.time.LocalDategetVatEndDate()Gets the end date of the period when the service was supplied (e.g.java.util.List<SwicoBillInformation.RateDetail>getVatImportTaxes()Gets the list of VAT import taxes.java.lang.StringgetVatNumber()Gets the invoicing party's VAT number.java.math.BigDecimalgetVatRate()Gets the VAT rate in case the same rate applies to the entire invoice.java.util.List<SwicoBillInformation.RateDetail>getVatRateDetails()Gets a list of VAT rates.java.time.LocalDategetVatStartDate()Gets the start date of the period when the service was supplied (e.g.inthashCode()voidsetCustomerReference(java.lang.String customerReference)Sets the customer reference.voidsetInvoiceDate(java.time.LocalDate invoiceDate)Sets the invoice date.voidsetInvoiceNumber(java.lang.String invoiceNumber)Sets the invoice number.voidsetPaymentConditions(java.util.List<SwicoBillInformation.PaymentCondition> paymentConditions)Sets the payment conditions.voidsetVatDate(java.time.LocalDate vatDate)Sets the date when the goods or service were supplied.voidsetVatEndDate(java.time.LocalDate vatEndDate)Sets the end date of the period when the service was supplied (e.g.voidsetVatImportTaxes(java.util.List<SwicoBillInformation.RateDetail> vatImportTaxes)Sets the list of VAT import taxes.voidsetVatNumber(java.lang.String vatNumber)Sets the invoicing party's VAT number.voidsetVatRate(java.math.BigDecimal vatRate)Sets the VAT rate in case the same rate applies to the entire invoice.voidsetVatRateDetails(java.util.List<SwicoBillInformation.RateDetail> vatRateDetails)Sets a list of VAT rates.voidsetVatStartDate(java.time.LocalDate vatStartDate)Sets the start date of the period when the service was supplied (e.g.java.lang.StringtoString()
-
-
-
Method Detail
-
getInvoiceNumber
public java.lang.String getInvoiceNumber()
Gets the invoice number.- Returns:
- the invoice number
-
setInvoiceNumber
public void setInvoiceNumber(java.lang.String invoiceNumber)
Sets the invoice number.- Parameters:
invoiceNumber- the invoice number
-
getInvoiceDate
public java.time.LocalDate getInvoiceDate()
Gets the invoice date.- Returns:
- the invoice date
-
setInvoiceDate
public void setInvoiceDate(java.time.LocalDate invoiceDate)
Sets the invoice date.- Parameters:
invoiceDate- the invoice date
-
getCustomerReference
public java.lang.String getCustomerReference()
Gets the customer reference.- Returns:
- the customer reference
-
setCustomerReference
public void setCustomerReference(java.lang.String customerReference)
Sets the customer reference.- Parameters:
customerReference- the customer reference
-
getVatNumber
public java.lang.String getVatNumber()
Gets the invoicing party's VAT number.The number is supplied without any prefix, white space, separator or suffix, i.e. "106017086" instead of "CHE-106.017.086 MWST".
- Returns:
- the VAT number
-
setVatNumber
public void setVatNumber(java.lang.String vatNumber)
Sets the invoicing party's VAT number.The number is supplied without any prefix, white space, separator or suffix, i.e. "106017086" instead of "CHE-106.017.086 MWST".
- Parameters:
vatNumber- the VAT number
-
getVatDate
public java.time.LocalDate getVatDate()
Gets the date when the goods or service were supplied.If this VAT date is given, VAT start and end date must be
null.- Returns:
- the VAT date
-
setVatDate
public void setVatDate(java.time.LocalDate vatDate)
Sets the date when the goods or service were supplied.If this VAT date is set, VAT start and end date must be
null.- Parameters:
vatDate- the VAT date
-
getVatStartDate
public java.time.LocalDate getVatStartDate()
Gets the start date of the period when the service was supplied (e.g. a subscription).If this VAT start date is given, the VAT end date must all be given and the VAT date must be
null.- Returns:
- the VAT start date
-
setVatStartDate
public void setVatStartDate(java.time.LocalDate vatStartDate)
Sets the start date of the period when the service was supplied (e.g. a subscription).If this VAT start date is given, the VAT end date must also be given and the VAT date must be
null.- Parameters:
vatStartDate- the VAT start date
-
getVatEndDate
public java.time.LocalDate getVatEndDate()
Gets the end date of the period when the service was supplied (e.g. a subscription).If this VAT end date is given, the VAT start date must also be given and the VAT date must be
null.- Returns:
- the VAT end date
-
setVatEndDate
public void setVatEndDate(java.time.LocalDate vatEndDate)
Sets the end date of the period when the service was supplied (e.g. a subscription).If this VAT end date is given, the VAT start date must also be given and the VAT date must be
null.- Parameters:
vatEndDate- the VAT end date
-
getVatRate
public java.math.BigDecimal getVatRate()
Gets the VAT rate in case the same rate applies to the entire invoice.If different rates apply to invoice line items, this property is
nullandgetVatRateDetails()is used instead.- Returns:
- the VAT rate (in percent)
-
setVatRate
public void setVatRate(java.math.BigDecimal vatRate)
Sets the VAT rate in case the same rate applies to the entire invoice.If different rates apply to invoice line items, this property is
nullandsetVatRateDetails(List)is used instead.- Parameters:
vatRate- the VAT rate (in percent)
-
getVatRateDetails
public java.util.List<SwicoBillInformation.RateDetail> getVatRateDetails()
Gets a list of VAT rates.Each element in the list is a tuple of VAT rate and amount. It indicates that the specified VAT rate applies to the specified net amount (partial amount) of the invoice.
If a single VAT rate applies to the entire invoice, this list is
nullandgetVatRate()is used instead.Example: If the list contained (8, 1000), (2.5, 51.8), (7.7, 250) for an invoice in CHF, a VAT rate of 8% would apply to CHF 1000.00, 2.5% for CHF 51.80 and 7.7% for CHF 250.00.
- Returns:
- the list of VAT rate/amount tuples
-
setVatRateDetails
public void setVatRateDetails(java.util.List<SwicoBillInformation.RateDetail> vatRateDetails)
Sets a list of VAT rates.Each element in the list is a tuple of VAT rate and amount. It indicates that the specified VAT rate applies to the specified net amount (partial amount) of the invoice.
If a single VAT rate applies to the entire invoice, this list is
nullandsetVatRate(BigDecimal)is used instead.Example: If the list contained (8, 1000), (2.5, 51.8), (7.7, 250) for an invoice in CHF, a VAT rate of 8% would apply to CHF 1000.00, 2.5% for CHF 51.80 and 7.7% for CHF 250.00.
- Parameters:
vatRateDetails- the list of VAT rate/amount tuples
-
getVatImportTaxes
public java.util.List<SwicoBillInformation.RateDetail> getVatImportTaxes()
Gets the list of VAT import taxes.Each element in the list is a tuple of VAT rate and VAT amount. It indicates that the specified VAT rate was applied and resulted in the specified tax amount.
Example: If the list contained (7.7, 48.37), (2.5, 12.4) for an invoice in CHF, a VAT rate of 7.7% has been applied to a part of the items resulting in CHF 48.37 in tax and a rate of 2.5% has been applied to another part of the items resulting in CHF 12.40 in tax.
- Returns:
- the list of VAT rate/amount tuples
-
setVatImportTaxes
public void setVatImportTaxes(java.util.List<SwicoBillInformation.RateDetail> vatImportTaxes)
Sets the list of VAT import taxes.Each element in the list is a tuple of VAT rate and VAT amount. It indicates that the specified VAT rate was applied and resulted in the specified tax amount.
Example: If the list contained (7.7, 48.37), (2.5, 12.4) for an invoice in CHF, a VAT rate of 7.7% has been applied to a part of the items resulting in CHF 48.37 in tax and a rate of 2.5% has been applied to another part of the items resulting in CHF 12.40 in tax.
- Parameters:
vatImportTaxes- the list of VAT rate/amount tuples
-
getPaymentConditions
public java.util.List<SwicoBillInformation.PaymentCondition> getPaymentConditions()
Gets the payment conditions.Each element in the list is a tuple of a payment discount and a deadline (in days from the invoice date).
If the list contained (2, 10), (0, 60), a discount of 2% applies if the payment is made by 10 days after invoice data. The payment is due 60 days after invoice date.
- Returns:
- the list of discount/days tuples
-
setPaymentConditions
public void setPaymentConditions(java.util.List<SwicoBillInformation.PaymentCondition> paymentConditions)
Sets the payment conditions.Each element in the list is a tuple of a payment discount and a deadline (in days from the invoice date).
If the list contained (2, 10), (0, 60), a discount of 2% applies if the payment is made by 10 days after invoice data. The payment is due 60 days after invoice date.
- Parameters:
paymentConditions- the list of discount/days tuples
-
getDueDate
public java.time.LocalDate getDueDate()
Gets the payment due date.The due date is calculated from the invoice date and the payment condition with a discount of 0.
- Returns:
- the due date (or
nullif the invoice date or the relevant payment condition is missing)
-
encodeAsText
public java.lang.String encodeAsText()
Encodes this bill information as a single text string suitable to be added to a Swiss QR bill.- Returns:
- the encoded text
-
decodeText
public static SwicoBillInformation decodeText(java.lang.String text)
Decodes the text of structured billing information and creates aSwicoBillInformationinstance.- Parameters:
text- he structured billing information encoded according to Swico S1 syntax.- Returns:
- the decoded billing information
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-