Ejemplo n.º 1
0
 /** Saves the DTO data as a CreditApplication entity */
 private CreditApplication save() throws ServiceException {
   solveSelected();
   // save cart first, and only if this is a confirm insurance offer task)
   if (cart != null && task.getOrigin().equals("task.confirm.offer.call.insurance")) {
     cart.setTid(task.getTid());
     cartDAO.save(cart, true);
   }
   dto.setTid(task.getTid());
   quote.bridgeWithCart(cart, false);
   return dao.save(dto);
 }
Ejemplo n.º 2
0
  @Override
  @PostConstruct
  protected void onTaskReceive() throws ServiceException {
    try {
      super.onTaskReceive();
      if (task.getPid() == -1L) return;

      // must bypass descendants, let them initialize inside their own post constructs
      if (!this.getClass().getSimpleName().equals(TASK)) return;

      // only works with a valid PID
      dto = dao.read(task.getPid());
      super.setDto(dto);
      super.setQuote(dto);

      LookupItem jobTitle = lookupItemDAO.find(LookupItem.onCode, dto.getJobTitleCode());
      dto.setJobTitle(jobTitle);

      if (task.isSupport()) {
        // task inspector default
        xdsOnlyRequired = false;
        // look for a special support target
        if (task.getTaskTarget().equals("task.confirm.offer.xds")) {
          xdsOnlyRequired = true;
          // set it back to the real target otherwise documents won't load
          task.setTaskTarget("task.confirm.offer.call");
        }
      } else {
        xdsOnlyRequired = isSalesFlowV2_1(task) && !isCallCenterChannel(task.getPid());
      }

      // set some state
      dto.setCurrentTask(task);
      dto.setUserLink(bayfin.getUser());
      resolveLogTag(dto);
      filterSelectedSettlements(dto);
      buildOfferResponse(dto); // used for recalc
      loadBCMBundle();

      // also read in the cart data
      if (boot.findFeature("INSURANCE_CART").equals("On")) {
        cart = cartDAO.read(task.getPid());
        cart.setCurrentTask(task);
        cart.setUserLink(bayfin.getUser());
        resolveLogTag(cart);
        loadCart();
        showBanking =
            taskRules.insuredBankAccountRequired(cart.getInsuredBankAccount())
                || taskRules.insuredBankAccountRequired(cart.getOffers());
      }
      if (task.getOrigin().equals("task.confirm.offer.call.insurance")) {
        dto.setInsStandalone(true);
      }

      // now also fetch the XdsAuthenticationHIstoryLog
      fetchXdsLog(dto);
      checkXDSExistingStatus();

      // Initialize with the task associated branch details
      signingBranchCode = new Long(task.getBranchCode());

      // Search for branch name
      BranchBasedSearchRequest request = new BranchBasedSearchRequest();
      BranchSearch search = new BranchSearch();
      request.setData(search);
      GeneralSearchResponse response;
      // set
      request.setType(ESearchResultType.LIST);
      search.setSearchType(ESearchParameter.CODE);
      search.setIncludeAgentData(false);
      search.setIncludeUserData(false);
      search.setBranchCode(signingBranchCode);

      // execute
      response = bayserv.branchSearch(request);
      List<ViewBranch> branches = response.getBranchItems();
      if (branches != null && branches.size() > 0) {
        signingBranch = branches.get(0).getBranchName();
      } // end if

      dto.initialiseConfirmOfferCall();
      bindPresenceCall();

      if (pilotFlag.equals("BNW_V0")) {
        disVoiceContract = true;
        disBranchContract = false;
        dto.setContractingMethod(EContractingMethod.BRANCH);
        branchpre = true;
      } else if (info.isAppFeatureActive("CONTBRN", dto.getBranchCode().intValue())
          && dto.getRequestedProduct() != EProductType.MEDICAL
          && dto.getSubgroupType() != EEmployerType.PAYROLL
          && !isWebChannel(task.getPid())
          && !isCallCenterChannel(task.getPid())) {
        disVoiceContract = true;
        disBranchContract = false;
        dto.setContractingMethod(EContractingMethod.BRANCH);
        branchpre = true;
      } else if ((info.isAppFeatureActive("CONTVOICE", dto.getBranchCode().intValue())
              && dto.getRequestedProduct() != EProductType.MEDICAL
              && dto.getSubgroupType() != EEmployerType.PAYROLL)
          || isWebChannel(task.getPid())
          || isCallCenterChannel(task.getPid())) {
        disVoiceContract = false;
        disBranchContract = true;
        dto.setContractingMethod(EContractingMethod.VOICE);
        branchpre = false;
      } else if (info.isAppFeatureActive("CONTBOTH", dto.getBranchCode().intValue())
          && dto.getRequestedProduct() != EProductType.MEDICAL
          && dto.getSubgroupType() != EEmployerType.PAYROLL) {
        disVoiceContract = false;
        disBranchContract = false;
      } else if ((dto.getRequestedProduct() != EProductType.MEDICAL)
          && (dto.getSubgroupType() != EEmployerType.PAYROLL)) {
        if (quote.getStartRole().equals("Branch") || quote.getStartRole().equals("Agent")) {
          disVoiceContract = true;
          disBranchContract = false;
          dto.setContractingMethod(EContractingMethod.BRANCH);
          branchpre = true;
        } else {
          disVoiceContract = false;
          disBranchContract = false;
        }
      } else if ((dto.getRequestedProduct() == EProductType.MEDICAL)
          && (dto.getSubgroupType() != EEmployerType.PAYROLL)) {
        disVoiceContract = false;
        disBranchContract = true;
        dto.setContractingMethod(EContractingMethod.VOICE);
        branchpre = false;
      } else if (dto.getSubgroupType() == EEmployerType.PAYROLL) {
        disVoiceContract = true;
        disBranchContract = false;
        dto.setContractingMethod(EContractingMethod.BRANCH);
        branchpre = true;
      }

      if ((disVoiceContract == true) && (disBranchContract == true)) {
        throw new ServiceException("BAD#Error, both voice and branch contracting disabled");
      }

      if (dto.getRequestedProduct() == EProductType.MEDICAL) {
        if (dto.getSubgroupType() == EEmployerType.PAYROLL) {
          throw new Exception("Invalid product subgroup received");
        }
        dto.setContractingMethod(EContractingMethod.VOICE);
        disVoiceContract = false;
      }
      if (dto.getSubgroupType() == EEmployerType.PAYROLL) {
        disBranchContract = false;
      }
      employerName = dto.getEmployerName();

      // do not display settlements on web apps
      if (isWebChannel(task.getPid())) {
        dto.setWebChannel(true);
      }

    } catch (ServiceException e) {
      e.printStackTrace();
      popupErrorMessage(e.getError());
    } catch (Exception e) {
      e.printStackTrace();
      popupErrorMessage("Unhandled exception", e.getMessage());
    }
  }