Пример #1
0
  @Override
  public void reject(ActionEvent event) {
    try {
      resolveFluxTags(dto);
      dto.getNotes().add(super.baseReject());

      if (!this.getClass().getSimpleName().equals(TASK)) return;

      // insurance offer confirm reject
      setVariable(Long.valueOf(task.getPid()).intValue(), "insfraud", "false");

      if (!task.isSupport()) {
        setVariable(Long.valueOf(task.getPid()).intValue(), "branchpre", "false");
        setVariable(Long.valueOf(task.getPid()).intValue(), "loanselected", "false");
        setVariable(Long.valueOf(task.getPid()).intValue(), "cellselected", "false");
        setVariable(Long.valueOf(task.getPid()).intValue(), "fraudCO", "false");
        setVariable(Long.valueOf(task.getPid()).intValue(), "creditlifesub", "false");
        setVariable(Long.valueOf(task.getPid()).intValue(), "reject", "true");
        rejectTask(task.getTid(), bayfin.getUser());
      }
      quote.setProcessStatus(EProcessState.REJECTED);
      sendMessage(MessageBuilder.prepareRejectAllSMS(dto));
      saveAndExit();

    } catch (ServiceException e) {
      errorMessage(e.getError(), ERR_GLOBAL);
    } catch (Exception e) {
      showThatsNotGood(dto, new ServiceException(ErrorCodes.UHE000, e), TASK);
    }
  }
Пример #2
0
  @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);
    }
  }