java.lang.Object
bayern.steinbrecher.javaUtility.SepaUtility

public final class SepaUtility
extends java.lang.Object
Contains methods for checking some Sepa Direct Debit attributes.
Since:
0.1
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static java.lang.String BIC_REGEX
    The regex representing all valid BICs.
    static java.lang.String IBAN_REGEX
    Regex describing a possible valid IBAN (the checksum of the IBAN is not checked by this regex).
    static int MAX_CHAR_IBAN
    The maximum length of an IBAN.
    static int MAX_CHAR_MESSAGE_ID
    The maximum length of the message id.
    static int MAX_CHAR_NAME_FIELD
    The maximum length of the name of the party creating the SEPA Direct Debit.
    static int MAX_CHAR_PMTINFID
    The maximum length of payment information id (PmtInfId).
    static java.lang.String MESSAGE_ID_REGEX
    The regex for checking whether a message id is valid.
    static int UNIQUE_DAYS_MESSAGEID
    Holds the count of days the MessageId has to be unique.
    static int UNIQUE_MONTH_PMTINFID
    Holds the count of month the PmtInfId has to be unique.
  • Method Summary

    Modifier and Type Method Description
    static java.lang.String getSepaDate​(java.time.LocalDate date)
    Returns a String representation of the given LocalDate which is valid for SEPA Direct Debits.
    static java.lang.String getSepaDate​(java.time.LocalDateTime dateTime)
    Returns a String representation of the given LocalDateTime which is valid for SEPA Direct Debits.
    static boolean isValidBic​(java.lang.String bic)
    Checks whether the given BIC is valid.
    static boolean isValidCreditorId​(java.lang.String creditorId)
    Checks whether the given creditor id is valid.
    static boolean isValidIban​(java.lang.String iban)
    Checks whether the IBAN of the given member has a valid checksum.
    static boolean isValidMessageId​(java.lang.String messageId)
    Checks whether the given message id would be valid for being used in a Sepa Direct Debit.
    static java.util.Optional<java.lang.String> validateSepaXML​(java.lang.String xml)
    Checks whether the given String contains valid SEPA DD content.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • isValidIban

      public static boolean isValidIban​(java.lang.String iban)
      Checks whether the IBAN of the given member has a valid checksum.
      Parameters:
      iban - The IBAN to check.
      Returns:
      true only if IBAN has a valid checksum.
      See Also:
      IBAN_PATTERN
    • isValidBic

      public static boolean isValidBic​(java.lang.String bic)
      Checks whether the given BIC is valid. Currently only the length and the allowed characters are checked.
      Parameters:
      bic - The BIC to check.
      Returns:
      false only if the BIC is invalid.
      See Also:
      BIC_PATTERN
    • isValidCreditorId

      public static boolean isValidCreditorId​(java.lang.String creditorId)
      Checks whether the given creditor id is valid.
      Parameters:
      creditorId - The creditor id to check.
      Returns:
      true only if the given creditor id is valid.
    • isValidMessageId

      public static boolean isValidMessageId​(java.lang.String messageId)
      Checks whether the given message id would be valid for being used in a Sepa Direct Debit.
      Parameters:
      messageId - The message id to check.
      Returns:
      true only if the message id is valid.
    • getSepaDate

      public static java.lang.String getSepaDate​(java.time.LocalDateTime dateTime)
      Returns a String representation of the given LocalDateTime which is valid for SEPA Direct Debits.
      Parameters:
      dateTime - The date to convert.
      Returns:
      The valid representation of the given LocalDateTime.
    • getSepaDate

      public static java.lang.String getSepaDate​(java.time.LocalDate date)
      Returns a String representation of the given LocalDate which is valid for SEPA Direct Debits.
      Parameters:
      date - The date to convert.
      Returns:
      The valid representation of the given LocalDate.
    • validateSepaXML

      public static java.util.Optional<java.lang.String> validateSepaXML​(java.lang.String xml) throws org.xml.sax.SAXException, java.io.IOException
      Checks whether the given String contains valid SEPA DD content.
      Parameters:
      xml - The XML content to check.
      Returns:
      An Optional containing the error output if the XML is erroneous. If Optional.empty() is returned the XML does not contain errors but it may still contain warnings. If so these are logged.
      Throws:
      org.xml.sax.SAXException - If any parse error occurs.
      java.io.IOException - If any I/O error occurs.
      See Also:
      XMLUtility.isValidXML(java.lang.String, java.net.URL)