Class SwicoBillInformation

java.lang.Object
net.codecrete.qrbill.generator.SwicoBillInformation

public class SwicoBillInformation extends Object
Bill information (according to Swico S1) for automated processing of invoices.

Swico S1 (see Syntaxdefinition S1) 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.

  • Constructor Details

    • SwicoBillInformation

      public SwicoBillInformation()
      Creates a new instance with null values.
  • Method Details

    • getInvoiceNumber

      public String getInvoiceNumber()
      Gets the invoice number.
      Returns:
      the invoice number
    • setInvoiceNumber

      public void setInvoiceNumber(String invoiceNumber)
      Sets the invoice number.
      Parameters:
      invoiceNumber - the invoice number
    • getInvoiceDate

      public LocalDate getInvoiceDate()
      Gets the invoice date.
      Returns:
      the invoice date
    • setInvoiceDate

      public void setInvoiceDate(LocalDate invoiceDate)
      Sets the invoice date.
      Parameters:
      invoiceDate - the invoice date
    • getCustomerReference

      public String getCustomerReference()
      Gets the customer reference.
      Returns:
      the customer reference
    • setCustomerReference

      public void setCustomerReference(String customerReference)
      Sets the customer reference.
      Parameters:
      customerReference - the customer reference
    • getVatNumber

      public 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(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 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(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 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(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 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(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 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 null and getVatRateDetails() is used instead.

      Returns:
      the VAT rate (in percent)
    • setVatRate

      public void setVatRate(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 null and setVatRateDetails(List) is used instead.

      Parameters:
      vatRate - the VAT rate (in percent)
    • getVatRateDetails

      public 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 null and getVatRate() 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(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 null and setVatRate(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 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(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 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(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 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 null if the invoice date or the relevant payment condition is missing)
    • encodeAsText

      public 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(String text)
      Decodes the text of structured billing information and creates a SwicoBillInformation instance.
      Parameters:
      text - he structured billing information encoded according to Swico S1 syntax.
      Returns:
      the decoded billing information
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object