예제 #1
0
 void perform() {
   final String method = "perform()";
   try {
     prerequisites();
     if (amount.compareTo(thresholdValue) < 0) {
       randomSelection();
     } else {
       biasedRandomSelection();
     }
   } catch (DataNotFoundException e) {
     if (LOG.isErrorEnabled()) {
       LOG.error(method, "Data not found: " + e.getEMVTag(), e);
     }
   }
 }
예제 #2
0
 void doVelocityChecking() {
   final String method = "doVelocityChecking()";
   try {
     int lowerLimit =
         BinaryNumber.toInt(transaction.getData(EMVTag.LOWER_CONSECUTIVE_OFFLINE_LIMIT));
     int upperLimit =
         BinaryNumber.toInt(transaction.getData(EMVTag.UPPER_CONSECUTIVE_OFFLINE_LIMIT));
     int lastOnlineATC = readLastOnlineATC();
     if (lastOnlineATC == 0) {
       indicateNewCard();
     }
     int atc = readATC();
     if (LOG.isInfoEnabled()) {
       LOG.info(method, "ATC: " + atc + ", Last Online ATC: " + lastOnlineATC);
     }
     int consecutiveOffline = atc - lastOnlineATC;
     TVR tvr = transaction.getTVR();
     if (consecutiveOffline > lowerLimit) {
       tvr.getByte4().lowerConsecutiveOfflineLimitExceeded();
     }
     if (consecutiveOffline > upperLimit) {
       tvr.getByte4().upperConsecutiveOfflineLimitExceeded();
     }
   } catch (IOException e) {
     if (LOG.isErrorEnabled()) {
       LOG.error(method, "Error reading data from ICC", e);
     }
   } catch (ProcessingStateException e) {
     if (LOG.isErrorEnabled()) {
       LOG.error(method, "Error reading data from ICC", e);
     }
     TVR tvr = transaction.getTVR();
     tvr.getByte4().lowerConsecutiveOfflineLimitExceeded();
     tvr.getByte4().upperConsecutiveOfflineLimitExceeded();
   } catch (DataNotFoundException e) {
     if (LOG.isDebugEnabled()) {
       LOG.debug(method, "Data not found: " + e.getEMVTag());
     }
   }
 }