Adding Field Validations to Custom Payment File Templates

You can use the following validations in your custom payment file templates:

To add field validations to custom payment file templates:

  1. Go to Payments > Setup > Payment File Templates.

  2. Click the Edit link of the template that you want to add validations to.

  3. In the Field Validator field, add the validation tags.

  4. Click Save.

Example:

Example field validation code.

To represent symbols and special characters in the parameters of validator types: invalidChars, validChars, and alpha, use the correct syntax provided below:

Symbol

Correct Syntax

&

&amp

&quot

&apos

<

&lt

>

&gt

modulo97

This check digit validation is commonly used in validating IBAN and account numbers.

Validation

Example: 123456789012

  1. Get the first 10 digits of the string, convert it to an integer, divide it by 97, and get the remainder.

    A = 1234567890 % 97

    Remainder = 02

  2. Get the last two digits of the string and convert it to an integer.

    b = 12

  3. Compare the two values, a=02 and b=12.

  4. If the values are not equal, return "Account Number is invalid."

modulo11check1

This validation is commonly called the Modulus 11 Self-Check 1.

Validation

Example: 123456789012

  1. Multiply each digit by the string length, minus the position of the digit in the string.

    1*(12-0) = 12

    2*(12-1) = 22

    3*(12-2) = 30

    4*(12-3) = 36 ...

  2. Get the sum of all the products of the computation from step 1.

    12 + 22 + 30 + 36... = 304

  3. Divide the sum by 11, and get the remainder.

    304%11 = 7

  4. If the quotient is not equal to zero, return "Account Number is invalid."

modulo11check2

This validation is commonly called the Modulus 11 Self-Check 2.

Validation

Example: 123456–1234567890

  1. The first number must contain six digits and the second number must contain ten digits, both numbers must be separated with a (-) hyphen

  2. Multiply each digit of the first number by the weighed values 10, 5, 8, 4 ,3 and 1 belonging to the Czechia payment template.

    1*10 = 10

    2*5 = 10

    3*8 = 24

    4*4 = 16

    5*3 = 15

    6*1 = 6

  3. Get the sum of all the products of the computation from step 1.

    10 + 10 + 24 + 16 + 15 + 6... = 81

  4. Multiply each digit of the second number by the weighed values 6, 3, 7, 9, 10, 5, 8, 4, 2 and 1 belonging to the Czechia payment template.

    1*6 = 6

    2*3= 6

    3*7 = 21

    4*9 = 36

    5*10 = 50

    6*5= 30

    7*8 = 56

    8*4 = 32

    9*2 = 18

    10*1 = 10

  5. Get the sum of all the products of the computation from step 4.

    6 + 6 + 21 + 36 + 50 + 30 + 56 + 32 + 18 + 10... = 265

  6. Divide the sum of first number and second number by 11, and get the remainder.

    81+265 = 346/11 = 5

  7. If the remainder is not equal to zero, then return " Enter a valid account number in this format: 123456-1234567890."

iban

IBAN is an international standard of identifying bank accounts across the globe. Modulus 97 and ISO validations are used in validating the IBAN, including the country code.

Validation

Example:

Code sample showing proper use of iban as a validator type.
  1. Check if the IBAN exists.

  2. Check if the IBAN is valid based on the following:

    1. It must not contain characters other than alphabetic characters in lowercase or uppercase (letters a to z or A to Z) and digits (numbers 0 to 9).

    2. The first two characters represent the country code. If the country code exists in the IBAN country list:

      1. Check if the length of the IBAN is equal to the length defined per country.

      2. Check if the IBAN fits the substructure of a specific country.

      3. If the country code does not exist in the country list, test if the characters are valid.

      4. If the IBAN fits the substructure of the specific country or if the test characters are valid, continue.

    3. After the country code, the first two digits must follow, and they must not be 00, 01 or 99.

    4. Perform ISO validation:

      1. Convert all lowercase letters to uppercase.

      2. Get the IBAN substring from the 5th character to the last character, and add the first four characters to the end of it.

      3. Convert the letters in the IBAN to numbers, in this manner:

        A = 10 B = 11 C = 12...

      4. Get the remainder:

        1. Group the string to produce seven characters per string.

        2. Get the first group with seven characters, divide it by 97, and get the remainder.

        3. Store the remainder.

        4. Get the next group of seven characters, add the stored remainder to it, then divide it by 97, and get the remainder.

        5. Store the remainder, and repeat the last step for the succeeding groups of seven characters.

      5. If the final remainder is equal to 1, then the IBAN passed the ISO validation.

  3. If the IBAN does not exist, or is invalid, return "IBAN code is invalid."

  4. Else, get the country code of the IBAN (the first two characters of the IBAN).

  5. Compare it to the country code entered in the parameter.

  6. If the two values are not equal, return “The International Bank Account Number (IBAN) you entered is not valid. Please enter a valid IBAN for country code: XX"

bic

A SWIFT code is a standard format for Business Identifier Codes (BIC). It is a unique identification code for a particular bank.

Validation

Example: COBALULXIFS

  1. Get the derived values:

    • Bank code = first 4 characters: COBA

    • Country code = 5th and 6th characters: LU

    • Location Code = 7th and 8th characters: LX

    • Branch Code = last 3 characters: IFS

  2. Validate the derived values:

    • Bank code must start with a lowercase or uppercase letter, or a space. Other characters must all be letters or spaces.

    • Country code must exist in the valid country code list.

    • Location Code must not be equal to 00.

    • Location Code must start with a lowercase or uppercase letter, or a space, or a number. All other characters must be a letter, space or number.

    • Branch Code can be empty. But if it is existing, it must start with a lowercase or uppercase letter, or a space, or a number. All other characters must be a letter, space or a number.

routingNumber

The routing number is popularly used in the United States to identify banks for processing wire transfers and ACH transfers.

Validation

Example: 123456789

  1. Get the sum of the digits at position 0, 3 and 6.

    1 + 4 + 7 = 12

  2. Multiply by 7.

    12 * 7 = 84

  3. Get the sum of the digits at position 1, 4, and 7.

    2 + 5 + 8 = 15

  4. Multiply by 3.

    15 * 3 = 45

  5. Get the sum of digits at position 2 and 5.

    3 + 6 = 9

  6. Multiply by 9.

    9 * 9 = 81

  7. Get the total of all the products.

    84 + 45 + 81 = 210

  8. Divide the result by 10, and get the remainder.

    210%10 = 0

  9. Get the digit at position 8.

    9

  10. Compare the two values, 0 and 9.

  11. If the values are not equal, return "Routing Number is invalid."

bban

BBAN (Base Bank Account Number) is a national bank account number format typically used for domestic payments. It has a fixed length composed of alphanumeric characters. It includes the domestic bank account number, the branch number, and possibly the routing number.

Note:

Electronic Bank Payments currently supports only the HU country code for BBAN validation.

Validation

Example:

Code sample showing proper use of bban as a validator type.
  1. Check if the BBAN exists.

  2. Check if the BBAN is valid based on the following:

    1. It must not contain characters other than alphabetic characters in lowercase or uppercase (letters a to z or A to Z) and digits (numbers 0 to 9).

    2. The country code of BBAN must be existing in the BBAN country list.

    3. Check if the BBAN fits the substructure of the specific country defined in the BBAN country list.

    4. BBAN must not be all zeroes.

    5. Perform Modulo10 validation:

      1. Get derived values.

        Example: BBAN = 117 7301 6 1111101 8

        • Bank Number = first 3 characters: 117

        • Branch Number = 4th to 7th characters: 7301

        • Bank Check = 8th character: 6

        • Account Number = 9th to 15th characters: 1111101

        • Account check = last character: 8

      2. Combine the bank number and branch number.

        117+7301 = 1177301

      3. Get the sum of each digit from the previous step, and multiply it by 9, 7, 3, and 1.

        sum = (1*9) + (1*7) + (7*3) + (7*1) + (3*9) + (0*7) + (1*3)

        sum = 9 + 7 + 21 + 7 + 27 + 0 + 3

        sum = 74

      4. Get the last digit of the sum.

        4

      5. Subtract it from 10.

        10 - 4 = 6

      6. Divide it by 10, and get the remainder.

        6

      7. Compare the result with the bank check. If the result is not equal, then BBAN is invalid. If the two numbers are the same, proceed to the next step.

      8. Get the sum of each digit in the account number, multiply it by 9, 7, 3, and 1.

      9. Get the last digit of the sum, subtract it from 10, then divide it by 10, and get the remainder.

      10. Compare the result with the account check. If the two numbers are not equal, then the BBAN is invalid.

  3. If BBAN is not existing or valid, return "BBAN code is invalid."

validContent

The validContent validation is useful for text fields when you want to limit the values entered by the user.

Validation

Example:

Code sample showing proper use of validContent as a validator type.
  1. Check if the inputted string is equal to the values specified in the parameters.

  2. If the string is not equal to the values in the parameters, return “Valid values must be 00, 01 or 02."

Related Topics

General Notices