@Override public Transition executeAction(final OrderProcessModel process) { LOG.info("Process: " + process.getCode() + " in step " + getClass()); ServicesUtil.validateParameterNotNull(process, "Process can not be null"); ServicesUtil.validateParameterNotNull(process.getOrder(), "Order can not be null"); final double scoreLimit = Double.parseDouble( Config.getParameter( HybrisTestFulfilmentProcessConstants.EXTENSIONNAME + ".fraud.scoreLimitExternal")); final double scoreTolerance = Double.parseDouble( Config.getParameter( HybrisTestFulfilmentProcessConstants.EXTENSIONNAME + ".fraud.scoreToleranceExternal")); final OrderModel order = process.getOrder(); final FraudServiceResponse response = getFraudService().recognizeOrderSymptoms(getProviderName(), order); final double score = response.getScore(); if (score < scoreLimit) { final FraudReportModel fraudReport = createFraudReport(providerName, response, order, FraudStatus.OK); final OrderHistoryEntryModel historyEntry = createHistoryLog(providerName, order, FraudStatus.OK, null); order.setFraudulent(Boolean.FALSE); order.setPotentiallyFraudulent(Boolean.FALSE); order.setStatus(OrderStatus.FRAUD_CHECKED); modelService.save(fraudReport); modelService.save(historyEntry); modelService.save(order); return Transition.OK; } else if (score < scoreLimit + scoreTolerance) { final FraudReportModel fraudReport = createFraudReport(providerName, response, order, FraudStatus.CHECK); final OrderHistoryEntryModel historyEntry = createHistoryLog(providerName, order, FraudStatus.CHECK, fraudReport.getCode()); order.setFraudulent(Boolean.FALSE); order.setPotentiallyFraudulent(Boolean.TRUE); order.setStatus(OrderStatus.FRAUD_CHECKED); modelService.save(fraudReport); modelService.save(historyEntry); modelService.save(order); return Transition.POTENTIAL; } else { final FraudReportModel fraudReport = createFraudReport(providerName, response, order, FraudStatus.FRAUD); final OrderHistoryEntryModel historyEntry = createHistoryLog(providerName, order, FraudStatus.FRAUD, fraudReport.getCode()); order.setFraudulent(Boolean.TRUE); order.setPotentiallyFraudulent(Boolean.FALSE); order.setStatus(OrderStatus.FRAUD_CHECKED); modelService.save(fraudReport); modelService.save(historyEntry); modelService.save(order); return Transition.FRAUD; } }