private void indicateNewCard() { final String method = "indicateNewCard()"; if (LOG.isInfoEnabled()) { LOG.info(method, "New card"); } TVR tvr = transaction.getTVR(); tvr.getByte2().newCard(); }
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()); } } }
private int readATC() throws ProcessingStateException, IOException { final String method = "readATC()"; try { return BinaryNumber.toInt(read(EMVTag.APPLICATION_TRANSACTION_COUNTER)); } catch (ProcessingStateException e) { if (LOG.isInfoEnabled()) { LOG.info(method, "ATC is missing"); } TVR tvr = transaction.getTVR(); tvr.getByte1().iccDataMissing(); throw e; } }
private void prerequisites() throws DataNotFoundException { final String method = "prerequisites()"; amount = BinaryNumber.toBigInteger(transaction.getData(EMVTag.AMOUNT_AUTHORISED_BINARY)); floorLimit = BinaryNumber.toBigInteger(transaction.getData(EMVTag.TERMINAL_FLOOR_LIMIT)); RandomTransactionSelectionData selectionData = transaction.getApplication().getRandomTransactionSelectionData(); targetPercentage = selectionData.getTargetPercentage(); maxTargetPercentage = selectionData.getMaxTargetPercentage(); thresholdValue = BinaryNumber.toBigInteger(selectionData.getThresholdValue()); if (thresholdValue.compareTo(floorLimit) >= 0) { if (LOG.isWarnEnabled()) { LOG.warn( method, "Threshold Value (" + thresholdValue + ") is greater or equals to floor limit (" + floorLimit + ")"); } thresholdValue = BigInteger.ZERO; } randomNumber = generateRandomNumber(); if (LOG.isDebugEnabled()) { LOG.debug( method, "Amount: " + amount + ", Floor Limit: " + floorLimit + ", Target Percentage: " + targetPercentage + ", Max Target Percentage: " + maxTargetPercentage + ", Threshold Value: " + thresholdValue + ", Random Number: " + randomNumber); } }
private byte[] read(EMVTag emvTag) throws IOException, ProcessingStateException { GetDataCommand getDataCommand = GetDataCommand.create(emvTag.getTag()); RAPDU response = transaction.getICReader().transmit(getDataCommand); new ProcessingState(response.getSW()).assertSuccessful(); return TLV.parse(response.getData()).getValue(); }
private void selectForOnlineProcessing() { TVR tvr = transaction.getTVR(); tvr.getByte4().transactionSelectedRandomlyForOnlineProcessing(); }