Data Type to Search for Payment Card Numbers with Specific BIN Ranges

GLASS Studio Visual Builder mode RANGE, MAP, NOCASE, CONTEXT & APPLY, CHECK, BOUND, TIMES, REQUIRE

Overview

Imagine you are tasked to use GLASS Studio to create a custom GLASS data type that searches for 16-digit Mastercard payment card numbers. But you are only interested in payment card numbers with specific bank identification number (BIN) ranges that are issued by the company EZ-Link Pte Ltd.

In this tutorial, you will go through the steps to build and test the payment card number data type in Visual Builder mode. The resulting GLASS expression can then be deployed as a Custom Data Type in Enterprise Recon.

Prerequisites

This tutorial assumes that you have:

  • A valid set of Ground Labs customer portal credentials to log in to GLASS Studio.

  • Working knowledge of Enterprise Recon.
  • A reasonable understanding of what a data type is.

Data Type Requirements

We will also make the following assumptions regarding the data type, along with the structure and format of company email addresses.

  1. The data type should be 16-digit Mastercard payment card numbers that start with the BIN ranges below:
    • 27145600 to 27145601, and
    • 53497220.
  2. The last (16th) digit in the payment card number is computed from all the other digits in the number using the Luhn check algorithm.
  3. The payment card numbers are straight 16-digit strings in the following format:
    • NNNNNNNNNNNNNNNN
  4. Valid payment card numbers can be preceded immediately by non-digits (^0-9), and followed immediately by non-alphanumeric (^0-9a-zA-Z) characters.
  5. At least one of these (case-insensitive) context keywords must be found before a payment card number for it to be returned as a match:
    • EZ Link
    • EZ-Link
    • card number
  6. Some examples of payment card numbers (sans context) that we expect to match:
    • 2714560022446682
    • 2714560133557799
    • 5349722063748592

Mastercard payment card number requirements

Part 1 - Specific BIN Ranges for Payment Card Number

You will start by defining the specific BIN ranges for payment card numbers that you are interested in searching for.

  1. Launch GLASS Studio.
  2. In the start screen, select New Visual Builder Project +.
  3. Click on the Map icon in the GLASS Studio playground to open the MAPS dialog and click on .
  4. In the New Map dialog:
    • Key in EZLINK_BIN_RANGES in the Map Name field.

    • In the field below, key in the following BIN ranges. Remember to press the Enter key after typing each BIN range to add the keys to the namespace.

      • 27145600-27145601
      • 53497220
  5. Click Save Map and then Close the MAPS dialog.

Namespace with the BIN ranges of interest

Part 2 - First Eight Digits of Payment Card Number

Next, we will build the first eight digits of the payment card number, which should fall within the BIN ranges defined in Part 1.

  1. Select Start with RANGE.
  2. In the Select a keyword dropdown, select Digit.
  3. Check the Repeat Character/Octet option.
  4. Select the first radio button and key in 8 in the Times field.
  5. In the Add Pattern Rules pane, click on Require.
  6. Select the checkbox next to EZLINK_BIN_RANGES.
  7. Click Close.

First eight digits of payment card number with REQUIRE rules

Part 3 - Last Eight Digits of Payment Card Number

In Part 3, you will add the second component that defines the last eight digits of the straight 16-digit payment card number.

  1. Hover over and click on the + button at the top right corner of the first RANGE component.
  2. Select RANGE.
  3. In the Select a keyword dropdown, select Digit.
  4. Check the Repeat Character/Octet option.
  5. Select the first radio button and key in 8 in the Times field.
  6. Click Close.

Last eight digits of straight payment card number

Part 4 - Luhn Checksum Algorithm

In Part 4, you will add the Luhn checksum algorithm to validate the payment card number so that only 16-digit strings that pass the checksum will be reported as a match.

  1. Left click anywhere in the GROUP component.
  2. (Optional) In the Group Name field, key in EZLINK_PAYMENT_CARD_STRAIGHT.
  3. In the Add Pattern Rules pane of the group form, click on Check.
  4. Select the LUHNCHKSUM algorithm from the list of built-in check modules.

Luhn checksum for straight payment card number

Part 5 - Boundary Rules

In Part 5, you will be adding boundary rules for the whole expression.

Using the BOUND operator, you can reduce the number of potential false positive matches by only reporting payment card number matches if they are only preceded by non-digits, and followed immediately by non-alphanumberic characters.

  1. In the Add Pattern Rules pane of the group form, click on Bound.
  2. For the Left option, in the Select a keyword dropdown, select Non-Digit.
  3. For the Right option, in the Select a keyword dropdown, select Non-Alnum.
  4. Click Close.

Boundary rules for straight payment card number

Part 6 - Defining Context Keywords and Rules

Now that we have built out the base pattern and rules for the payment card numbers, we will add context rules so that the GLASS engine only returns matches if specific keywords are found within the vicinity of these numbers.

  1. Click on the Context icon in the GLASS Studio playground to open the CONTEXT dialog.
  2. (Optional) In the CONTEXT dialog, hover over the Name field and click on the Edit icon.
  3. Key in EZLINK_PAYMENT_CARD_CONTEXT and click Save.
  4. Click on to add a context rule.
  5. In the Rule Details page, select Require and Before.
  6. Click on Next to continue.
  7. In the Add Map 1 of 2 page:
    • Key in EZLINK_PAYMENT_CARD_CONTEXT_KEYWORDS in the Map Name field.
    • In the field below, key in the following context keywords. Remember to press the Enter key after typing each value to add the keys to the namespace.
      • 'EZ Link'
      • 'EZ-Link'
      • 'card number'
    • Check the No Case option.
    • Click Save Map.
  8. In the Add Map 2 of 2 page, check that the radio button next to EZLINK_PAYMENT_CARD_CONTEXT_KEYWORDS is selected.
  9. Click on Next to continue.
  10. (Optional) In the Advanced page, key in 32 in the Search distance field.
  11. Click on Next to continue.
  12. In the Confirm page, review the configured context rule. Click on Confirm to save the context rules.
  13. Click Close.

Context rules for straight payment card number

🎉 Congratulations! You have now fulfilled all the data type requirements and built a working data type that will match 16-digit straight numbers that start with specific BIN ranges and are validated as payment card numbers using the Luhn checksum algorithm.

Part 7 - Testing the Pattern for 16-digit Payment Card Numbers

1
2
3
4
5
EZ Link:2714560022446682
<random filler text to add ~32 bytes gap>
card number is 2714560133557799
<random filler text to add ~32 bytes gap>
5349722063748592
  1. Copy the sample data provided above and paste it in the Enter test data: pane.
  2. Click Test.

Payment card number test sample data straight digits only

You should expect to see the results indicating 2 MATCHES FOUND for the payment card number 2714560022446682 and 2714560133557799.

5349722063748592 on line 5 will not match as no required context keywords (as defined in Part 6) are found within 32 bytes before the payment card number.

Part 8 - Using the Custom Pattern in Enterprise Recon

Now that you have tested the data type, click on the Copy to clipboard copy button to copy the (generated) GLASS code, which can now be deployed as a Custom Data Type in Enterprise Recon.

Payment card number copy GLASS code straight number