private void completeConfirmOfferFlux() throws ServiceException { // non-flow task id -1 override if (task.getTid() == -1) return; boolean xdsFailed = taskRules.xdsFailed(dto.getPid(), xdsAuthenticationLogs); dto.setReferToFraud(dto.isReferToFraud() || xdsFailed); checkFraud(dto, "fraudCO"); // Should the documents be scanned at the branch setVariable( Long.valueOf(task.getPid()).intValue(), "branchpre", String.valueOf(dto.getContractingMethod().equals(EContractingMethod.BRANCH))); // has a loan product been selected setVariable(Long.valueOf(task.getPid()).intValue(), "loanselected", "true"); // has a cellular product been selected setVariable(Long.valueOf(task.getPid()).intValue(), "cellselected", "false"); // has a cellular product been selected setVariable( Long.valueOf(task.getPid()).intValue(), "creditlifesub", String.valueOf(dto.isCreditLifeSubstitution())); // insurance offer confirmation only (send to fraud) setVariable(Long.valueOf(task.getPid()).intValue(), "insfraud", "false"); if (task.getOrigin().equals("task.confirm.offer.call.insurance")) { boolean insfraud = xdsFailed || dto.isReferToFraud(); setVariable(Long.valueOf(task.getPid()).intValue(), "insfraud", String.valueOf(insfraud)); } // Now call the workflow to complete the task if (!task.isSupport()) completeTask(task.getTid(), bayfin.getUser()); // Update Flux Task Branch Code for Branch Contracting if (dto.getContractingMethod().equals(EContractingMethod.BRANCH)) { long branchScanningTid = getTidforTask( Long.valueOf(task.getPid()).intValue(), "task.scan.branch.pre", "Scan pre-agreement"); if (branchScanningTid > 0) { if (signingBranchCode.intValue() > 0) { fluxService.updateFluxInboxBranch(branchScanningTid, signingBranchCode.intValue()); } } } }
@Override public void finish(ActionEvent event) { dto.setSigningBranchCode(new BigDecimal(signingBranchCode)); super.finish(event); // let descendants implement their own save and finish methods if (!this.getClass().getSimpleName().equals(TASK)) return; try { // don't do fraud checks for insurance stand-alone if (!dto.isInsStandalone()) runSystemFraud(dto, contructFraudSearch(dto)); // Set Presence UCID and TimeStamp if (!isXdsOnlyRequired()) { dto.setConfirmOfferCallUCID(dto.getPb().getUcId()); dto.setConfirmOfferCallTimeStamp(Calendar.getInstance().getTime()); // check docs are generated and sent (contracting only) try { if (!dto.isCreditLifeSubstitution()) { // don't check loan offer changes if doing confirm offer insurance standalone if (!task.getTaskTarget().equals("task.confirm.offer.call.insurance")) { if (dto.getContractingMethod() == EContractingMethod.BRANCH) taskRules.checkOfferChangeIsGenerated(quote.getCurrentOffer()); // TODO : Fix this, should not be disabled else if (!dto.getRequestedProduct().equals(EProductType.MEDICAL)) taskRules.checkOfferChangeIsGeneratedAndSent(quote.getCurrentOffer()); // must send it if !branchpre if (!dto.getContractingMethod().equals(EContractingMethod.BRANCH)) if (!docSent) throw new ServiceException(ErrorCodes.CVA071); } } // generates and send all required insurance stand-alone documents (if there is no AVS) if (dto.isInsStandalone()) { String skipinsavs = getVariable(ConvertUtils.asInt(dto.getPid()), "skipinsavs"); boolean sendDocsNow = true; if (skipinsavs != null) sendDocsNow = ConvertUtils.asBoolean(skipinsavs); if (sendDocsNow) { loadInsuranceDocumentsToSend(); sendSpecificDocuments(cart, task, SystemConstants.DOC_INS_CODES); } } // check av (settlements only) avBuilder.submitAV(task, dto); getAvCaches().clear(); findSettlementAvData(dto); // forced to do the logic here since AvCache is a BayServ entity so we cannot use // TaskRules boolean avsDone = true; String errorMsg = "Account verification status for AV required settlement account : "; for (ProtoAvCache item : avCaches) { if (!ValidationUtils.isIn(item.getAppStatus(), SystemConstants.AV_COMPLETED)) { String accountRef = ""; for (ProtoSettlement settlement : quote.getSettlements()) { String compare = StringUtils.right(settlement.getAccount().getAccountNumber(), 10); if (compare.equals(item.getNumber().toString())) { accountRef = settlement.getFormattedAccountNumber(); avsDone = false; break; } } errorMessage( "AVS ", errorMsg + " " + accountRef + " : " + item.getAppStatus(), ERR_GLOBAL); } } if (!avsDone) return; } catch (ServiceException e) { popupErrorMessage(e.getError()); return; } } completeConfirmOfferFlux(); if (!isXdsOnlyRequired()) { if (dto.getContractingMethod() == EContractingMethod.BRANCH && getFluxTask( quote.getPid().intValue(), "task.account.verification", new EFluxTaskStatus[] { EFluxTaskStatus.CREATED, EFluxTaskStatus.IN_PROGRESS, EFluxTaskStatus.READY, EFluxTaskStatus.SUSPENDED }) .size() <= 0 && getFluxTask( quote.getPid().intValue(), "task.employment.confirm", new EFluxTaskStatus[] { EFluxTaskStatus.CREATED, EFluxTaskStatus.IN_PROGRESS, EFluxTaskStatus.READY, EFluxTaskStatus.SUSPENDED }) .size() <= 0) { // Now send Sign at branch sms if (!dto.isInsStandalone()) { bayserv.sendMessage(MessageBuilder.buildBranchSignSms(dto)); } } } saveAndExit(); } catch (ServiceException e) { logger.error(e); e.getError().setReference(transmitErrorData(quote, TASK)); info.displayBugDialog(e.getError()); } catch (Exception e) { logger.error(e); BaseError error = quote.addError(ErrorCodes.UHE000, e); error.setReference(transmitErrorData(quote, TASK)); info.displayBugDialog(error); } }