/** * Check for AVS verified required settlements when clicking the Next button on Capture & Review - * Offer page */ public void offerNextButtonClick() { solveSelected(); try { 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; taskRules.postOfferRules(quote, task); taskRules.loanCOCheckoutRules(quote); filterSelectedCellularOffers(quote); fixCurrentOffer(quote); dto.initialiseConfirmOfferCall(); getRc().execute(UI_NEXT); } catch (ServiceException e) { popupErrorMessage(e.getError()); getRc().update(UI_MAIN); } }
@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); } }
/** Creates request and response files on disk if applicable */ protected void createFiles(Req request, Rsp response) throws ServiceException { try { if (response.isLogRequest()) { if (request.getXmlData() != null) { if (!ValidationUtils.isNullOrEmpty(request.getXmlData().getXml())) { String xml = request.getXmlData().getXml(); ServiceRequest logRequest = new ServiceRequest(); if (response.getLogType().equals(ELogStrategy.LOG_TO_FILE) || response.getLogType().equals(ELogStrategy.LOG_TO_BOTH)) { String fileName = logXMLToDisk( response.getLogType(), response.getLogRoot(), EMessagePart.REQUEST, response.getUid(), xml); logRequest.setFileName(fileName); } } } } if (response.isError()) { if (response.getXmlData() != null) { if (!ValidationUtils.isNullOrEmpty(response.getXmlData().getXml())) { String xml = response.getXmlData().getXml(); ServiceError logError = new ServiceError(); if (response.getLogType().equals(ELogStrategy.LOG_TO_FILE) || response.getLogType().equals(ELogStrategy.LOG_TO_BOTH)) { String fileName = logXMLToDisk( response.getLogType(), response.getLogRoot(), EMessagePart.ERROR, response.getUid(), xml); logError.setFileName(fileName); } } } } else { if (response.isLogResponse() && request.getTargetProcess().equals(EProcessType.ONLINE)) { if (response.getXmlData() != null) { if (!ValidationUtils.isNullOrEmpty(response.getXmlData().getXml())) { String xml = response.getXmlData().getXml(); ServiceResponse logResponse = new ServiceResponse(); if (response.getLogType().equals(ELogStrategy.LOG_TO_FILE) || response.getLogType().equals(ELogStrategy.LOG_TO_BOTH)) { String fileName = logXMLToDisk( response.getLogType(), response.getLogRoot(), EMessagePart.RESPONSE, response.getUid(), xml); logResponse.setFileName(fileName); } } } } } } catch (Exception e) { throw new ServiceException(ErrorCodes.COR000, e, "Problem creating service log files"); } }