Reflection .NET API
Walkthrough / Log User Input and Credit Card Access / Monitor Credit Card Access
In This Topic
    Monitor Credit Card Access
    In This Topic

    You can enable the CreditCardRecognized event to fire when unredacted Primary Account Number (PAN) data (such as a credit card number) is recognized and handle this event to create logs or perform other actions required for compliance.

    When the event is enabled, it is fired when unredacted PAN data is copied from the terminal to the clipboard or to a productivity tool. For IBM systems, the event is also fired when unredacted PAN data is displayed on the screen.

    Note: This event is fired only when a PAN is copied or displayed in its entirety ("in the clear"). It is not fired when only redacted PANs are copied or displayed.

    To monitor credit card access

    1. In the Reflection Workspace Settings window, click Set Up Information Privacy.
    2. Under Primary Account Number (PAN) Redaction Rules, make sure Enable Redaction is unselected. (For  IBM terminals, if you leave Redact display data (IBM terminals only) unselected, the event fires when PAN data is typed on the screen.) 
    3. Under PCI DSS Rules, select Enable API events when PANs are viewed by the user.
    4. In Visual Studio, create a new Console Application project and add references for the following Reflection assemblies. (Depending on your version of Visual Studio, these can be found either on the .NET tab or under Assemblies | Extensions.)
      Attachmate.Reflection
      Attachmate.Reflection.Framework
      Attachmate.Reflection.Emulation.IbmHosts
      Attachmate.Reflection.Emulation.OpenSystems
    5. Replace all the code in the Program.cs file with the following code. This code gets a handle to a running instance of Reflection and determines which type of terminal is selected. Then it creates an event handler for the CredcardRecognized event, which is fired when an unredacted credit card number is displayed or saved. The event handler sends information from the CreditCardRecognized event to standard output.  
         
      Monitor Credit Card Access
      Copy Code
      using System;
      using System.Collections.Generic;
      using System.Text;
      using Attachmate.Reflection.UserInterface;
      using Attachmate.Reflection.Framework;
      using Attachmate.Reflection.Emulation.IbmHosts;
      using Attachmate.Reflection.Emulation.OpenSystems;
      using IBMCreditCardRecognizedEventArgs = Attachmate.Reflection.Emulation.IbmHosts.CreditCardRecognizedEventArgs;
      using OSCreditCardRecognizedEventArgs = Attachmate.Reflection.Emulation.OpenSystems.CreditCardRecognizedEventArgs;
      using System.IO;
      namespace SaveScreens
      {
          class Program
          {
             
              //Set up the event handlers to get the data you want to collect
              static void terminalIBM_CreditCardRecognized(object sender, IBMCreditCardRecognizedEventArgs args)
              {
      
                  Console.Write(("\n" + "Credit Card Number Viewed on Screen \n"
                  + "Date and Time: " + args.DateTime.ToString() + " \n"
                  + "Machine name: " + args.MachineName.ToString() + " \n"
                  + "User ID: " + args.UserId.ToString() + " \n"
                  + "Card number: " + args.RedactedAccountNumber + "\n"));
      
              }
      
              static void terminalOS_CreditCardRecognized(object sender, OSCreditCardRecognizedEventArgs args)
              {
                  Console.Write(("\n" + "Credit Card Number Viewed on Screen \n"
                  + "Date and Time: " + args.DateTime.ToString() + " \n"
                  + "Machine name: " + args.MachineName.ToString() + " \n"
                  + "User ID: " + args.UserId.ToString() + " \n"
                  + "Card number: " + args.RedactedAccountNumber + "\n"));
              } 
      
              static void Main(string[] args)
              {
                  //Get the last activated instance of Reflection
                  Application app = MyReflection.ActiveApplication;
      
                  //Make sure is running
                  if (app != null)
                  {
                      IFrame frame = (IFrame)app.GetObject("Frame");
                      IView view = (IView)frame.SelectedView;
      
                      //Check for the terminal type and create event handlers
                      if (view.Control.ToString() == "Attachmate.Reflection.Emulation.IbmHosts.IbmTerminal")
                      {
                          IIbmTerminal terminalIBM = (IIbmTerminal)view.Control;
                          terminalIBM.CreditCardRecognized += terminalIBM_CreditCardRecognized;
                      }
                      if (view.Control.ToString() == "Attachmate.Reflection.Emulation.OpenSystems.Terminal")
                      {
                          ITerminal terminalOS = (ITerminal)view.Control;
                          terminalOS.CreditCardRecognized += terminalOS_CreditCardRecognized;
                      }
                  }
                  else
                  {
                      Console.WriteLine("Cannot find instance of Reflection running");
                  }
                  Console.ReadKey();
              }
          }
      }
      
                              
      

    To test this project

    1. Open Reflection and then open a session document file.
    2. In Visual Studio, press F5 to run the project.
    3. On your application screen, enter a valid credit card number
    4. Verify that the data is written to the console.