Class Payments


  • public class Payments
    extends java.lang.Object
    Field validations related to Swiss Payment standards
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String createISO11649Reference​(java.lang.String rawReference)
      Creates a ISO11649 creditor reference from a raw string by prefixing the string with "RF" and the modulo 97 checksum.
      static java.lang.String formatIBAN​(java.lang.String iban)
      Formats an IBAN or creditor reference by inserting spaces.
      static java.lang.String formatQRReferenceNumber​(java.lang.String refNo)
      Formats a QR reference number by inserting spaces.
      static boolean isValidIBAN​(java.lang.String iban)
      Validates if the string is a valid IBAN number
      static boolean isValidISO11649Reference​(java.lang.String reference)
      Validates if the string is a valid ISO 11649 reference number.
      static boolean isValidQRReference​(java.lang.String reference)
      Validates if the string is a valid QR reference.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • isValidIBAN

        public static boolean isValidIBAN​(java.lang.String iban)
        Validates if the string is a valid IBAN number

        The string is checked for valid characters, valid length and for a valid check digit. White space is ignored.

        Parameters:
        iban - IBAN to validate
        Returns:
        true if the IBAN is valid, false otherwise
      • formatIBAN

        public static java.lang.String formatIBAN​(java.lang.String iban)
        Formats an IBAN or creditor reference by inserting spaces.

        Spaces are inserted to form groups of 4 letters/digits. If a group of less than 4 letters/digits is needed, it appears at the end.

        Parameters:
        iban - IBAN or creditor reference without spaces
        Returns:
        formatted IBAN or creditor reference
      • isValidISO11649Reference

        public static boolean isValidISO11649Reference​(java.lang.String reference)
        Validates if the string is a valid ISO 11649 reference number.

        The string is checked for valid characters, valid length and a valid check digit. White space is ignored.

        Parameters:
        reference - ISO 11649 creditor reference to validate
        Returns:
        true if the creditor reference is valid, false otherwise
      • createISO11649Reference

        public static java.lang.String createISO11649Reference​(java.lang.String rawReference)
        Creates 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
        Returns:
        ISO11649 creditor reference
        Throws:
        java.lang.IllegalArgumentException - if rawReference contains invalid characters
      • isValidQRReference

        public static boolean isValidQRReference​(java.lang.String reference)
        Validates if the string is a valid QR reference.

        A valid QR reference is a valid ISR reference.

        The string is checked for valid characters, valid length and a valid check digit. White space is ignored.

        Parameters:
        reference - QR reference number to validate
        Returns:
        true if the reference number is valid, false otherwise
      • formatQRReferenceNumber

        public static java.lang.String formatQRReferenceNumber​(java.lang.String refNo)
        Formats a QR reference number by inserting spaces.

        Spaces are inserted to create groups of 5 digits. If a group of less than 5 digits is needed, it appears at the start of the formatted reference number.

        Parameters:
        refNo - reference number without white space
        Returns:
        formatted reference number