Class ReferenceCodeHelper
java.lang.Object
ch.tocco.nice2.optional.finance.api.service.referencecode.ReferenceCodeHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
addQrrValidationNumber
(String referenceCode) Generates the validation digit at the end of the qrr reference code it is based on modulo10 recursive and theVALIDATION_LINE
static String
addScorChecksum
(String scorReference) Generates the mod 97-10 checksum of the scor reference and adds it to the reference Uses theCHARACTER_TRANSLATION_MAP
to translate non-numeric charactersstatic String
getCounter
(Entity entity) Gets the string value of "the" counter field of the given entity throws an exception if the entity does not have a singular counter fieldstatic String
getScorPrintFormat
(String scorReference) Shortens a SCOR reference by removing all leading zeros after the checksumstatic String
getScorTechnicalFormat
(String scorReference) Extends a SCOR reference to its maximum length of 25 characters this is done by adding 0 after the checksum e.g.static String
pads a string with zeros to the left throws an exception if the counterNr is longer than the given maximum length
-
Method Details
-
getCounter
Gets the string value of "the" counter field of the given entity throws an exception if the entity does not have a singular counter field -
padLeft
pads a string with zeros to the left throws an exception if the counterNr is longer than the given maximum length -
addQrrValidationNumber
Generates the validation digit at the end of the qrr reference code it is based on modulo10 recursive and theVALIDATION_LINE
- Parameters:
referenceCode
- the 26-length reference code without a validation digit- Returns:
- the 27-length reference code including the validation digit
-
addScorChecksum
Generates the mod 97-10 checksum of the scor reference and adds it to the reference Uses theCHARACTER_TRANSLATION_MAP
to translate non-numeric characters- Parameters:
scorReference
- the content of the scor reference (max 21 chars, alphanumeric, e.g. 93T9608)- Returns:
- the finalized scor reference number (e.g. RF839309608)
-
getScorTechnicalFormat
Extends a SCOR reference to its maximum length of 25 characters this is done by adding 0 after the checksum e.g. RF839309608 -> RF83000000000000009309608- Parameters:
scorReference
- a print format scor reference (e.g. RF839309608)- Returns:
- a technical format scor reference (e.g. RF83000000000000009309608)
-
getScorPrintFormat
Shortens a SCOR reference by removing all leading zeros after the checksum- Parameters:
scorReference
- a technical-format scor reference (e.g. RF83000000000000009309608)- Returns:
- a print-format scor reference (e.g. RF839309608)
-