Class Payments
- java.lang.Object
-
- net.codecrete.qrbill.generator.Payments
-
public class Payments extends java.lang.ObjectField validations related to Swiss Payment standards
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringcreateISO11649Reference(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.StringcreateQRReference(java.lang.String rawReference)Creates a QR reference from a raw string by appending the checksum digit and prepending zeros to make it the correct length.static java.lang.StringformatIBAN(java.lang.String iban)Formats an IBAN or creditor reference by inserting spaces.static java.lang.StringformatQRReferenceNumber(java.lang.String refNo)Formats a QR reference number by inserting spaces.static booleanisValidIBAN(java.lang.String iban)Validates if the string is a valid IBAN numberstatic booleanisValidISO11649Reference(java.lang.String reference)Validates if the string is a valid ISO 11649 reference number.static booleanisValidQRReference(java.lang.String reference)Validates if the string is a valid QR reference.
-
-
-
Method Detail
-
isValidIBAN
public static boolean isValidIBAN(java.lang.String iban)
Validates if the string is a valid IBAN numberThe string is checked for valid characters, valid length and for a valid check digit. White space is ignored.
- Parameters:
iban- IBAN to validate- Returns:
trueif the IBAN is valid,falseotherwise
-
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:
trueif the creditor reference is valid,falseotherwise
-
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- ifrawReferencecontains 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:
trueif the reference number is valid,falseotherwise
-
createQRReference
public static java.lang.String createQRReference(java.lang.String rawReference)
Creates a QR reference from a raw string by appending the checksum digit and prepending zeros to make it the correct length.Whitespace is removed from the reference
- Parameters:
rawReference- The raw string (digits and whitespace only)- Returns:
- QR reference
- Throws:
java.lang.IllegalArgumentException- ifrawReferencecontains invalid characters
-
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
-
-