Exemplo n.º 1
0
 public void updatePresence(
     String agentid, String ucid, String serviceid, String phonenumber, String error) {
   try {
     if (agentid.equals("-1") || ucid.equals("-1")) {
       return;
     }
     if (dto.getPb().getUcId() != null && dto.getPb().getUcId().equals(ucid)) {
       return;
     }
     dto.getPb().setAgentId(Long.valueOf(agentid));
     dto.getPb().setUcId(ucid);
     dto.getPb().setServiceId(Long.valueOf(serviceid));
     dto.getPb().setPhoneNumber(phonenumber);
     dto.getPb().setError(error == "true");
     dto.getPb().setTid(task.getTid());
     // == Immediate save into dto for doc generation
     dto.setConfirmOfferCallUCID(dto.getPb().getUcId());
     dto.setConfirmOfferCallTimeStamp(Calendar.getInstance().getTime());
     if (!ucid.equals("BYPASS")) {
       dao.saveQuoteRecording(dto);
     }
     getRc().update("popPresence:presenceForm");
   } catch (ServiceException e) {
     popupErrorMessage(e.getError());
     dto.getPb().setUcId("-1");
     getRc().update(UI_MAIN);
   }
 }
Exemplo n.º 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);
    }
  }