Esempio n. 1
0
  /**
   * Metodo que obtiene los movimientos de fondo de inversion
   *
   * @param cliente Bean de cliente
   * @param datosFondos Bean con los datos de fondos
   * @param bitacoraBean Bean de bitacora
   * @return Regresa los movimientos de fondos de inversion
   * @throws BusinessException Excepcion de negocio
   */
  public MovimientosFondosInversionBean getMovimientoFondoInversion(
      ClienteBean cliente, DatosEntradaMovimientosBean datosFondos, BitacoraBean bitacoraBean)
      throws BusinessException {

    MovimientosFondosInversionBean movimientos = new MovimientosFondosInversionBean();

    movimientos =
        MovimientosServiceReusableFunctions.txn390(datosFondos, bitacoraBean.getNombreClase());

    SantanderReferenciaService referencia =
        commonService.getReferencia(bitacoraBean.getNombreClase());
    bitacoraBean.setNumeroReferencia(referencia.getNumReferencia());
    bitacoraBean.setClaveUsuario(cliente.getClaveCliente());
    bitacoraBean.setNumeroCuenta(datosFondos.getCuenta());
    int estatus = movimientos.getCodigoStatus();
    if (estatus == 0) {
      bitacoraBean.setMensaje(
          SantanderConstantesService.MOVF + "0000CONSULTA DE MOVIMIENTOS INVERSION");
    } else {
      bitacoraBean.setMensaje(SantanderConstantesService.MOVF + estatus);
    }

    bitacoraBean.setClaveConcepto(SantanderConstantesService.CMFONDOS);
    commonService.registrarBitacora(bitacoraBean);
    if (movimientos.getMovimientosFondos() == null
        || movimientos.getMovimientosFondos().isEmpty()) {

      throw new BusinessException("MOVFON-1");
    }
    return movimientos;
  }
Esempio n. 2
0
  /**
   * Metodo que obtiene los movimientos de la tarjeta de credito
   *
   * @param cliente Bean de cliente
   * @param datosTarjeta Bien de los datos de la tarjeta
   * @param bitacoraBean Bean de bitacora
   * @return Regresa los movimeintos de las tarjetas de credito
   * @throws BusinessException Excepcion de negocio
   */
  public MovimientosTarjetasCreditoBean getMovimientoTarjetacredito(
      ClienteBean cliente, DatosEntradaMovimientosBean datosTarjeta, BitacoraBean bitacoraBean)
      throws BusinessException {

    Validator.valida(cliente, CLAVE_MODULO_MOVIMIENTO_TARJETA);
    String tramaDiasInhabil;
    String diasInhabiles[];
    TramaDiasInhabiles tramaSiasInhabiles = new TramaDiasInhabiles();
    tramaDiasInhabil = tramaSiasInhabiles.getTramaDiasInhabiles();
    diasInhabiles = SantanderUtileriasService.desentrama(tramaDiasInhabil, '|');

    MovimientosTarjetasCreditoBean movimientoTarjetaBean = null;

    String[] fechas = null;

    if (StringUtils.equals(datosTarjeta.getTipoOperacion(), "Fechas")) {

      fechas = new String[4];
      fechas[3] = tramaDiasInhabil;
      fechas[0] = MovimientosServiceReusableFunctions.AnteriorDiaHabil(2, diasInhabiles);
      fechas[2] = MovimientosServiceReusableFunctions.AnteriorDiaHabil(1, diasInhabiles);
      fechas[1] = MovimientosServiceReusableFunctions.InicioDelMes(fechas[2]);

      if (cliente.getTarjetas() == null) {
        throw new BusinessException("MOVT-MT-2");
      }
      movimientoTarjetaBean = new MovimientosTarjetasCreditoBean();
      if (StringUtils.equals(datosTarjeta.getCuenta(), "-1")) {
        movimientoTarjetaBean.setFechas(fechas);
        movimientoTarjetaBean.setCuenta(datosTarjeta.getCuenta());
        return movimientoTarjetaBean;
      } else {
        boolean esTarjetaTitular = false;
        Iterator itera = (Iterator) cliente.getTarjetas().iterator();
        while (itera.hasNext()) {
          TarjetaBean tarjetaPropia = (TarjetaBean) itera.next();

          if (tarjetaPropia.getNumeroTarjeta().equals(datosTarjeta.getCuenta())) {
            if (tarjetaPropia.getParticipacion().equals("TI")) {
              esTarjetaTitular = true;
              break;
            }
          }
        }
        log.debug("VALOR DE TITULAR****** " + esTarjetaTitular);
        if (!esTarjetaTitular) { // si NO es Titular - SE DESPLEGARAN
          // EXTRACTOS
          SantanderReferenciaService referencia =
              commonService.getReferencia(bitacoraBean.getNombreClase());

          MovimientosBean extractos =
              MovimientosServiceReusableFunctions.obtenerExtractoTarjetasPAMPA(
                  datosTarjeta.getCuenta(), bitacoraBean.getNombreClase(), referencia);
          if (Integer.parseInt(extractos.getMensajeStatus()) != 0) {
            throw new BusinessException("MOVIMIENTOS");
          } else {
            movimientoTarjetaBean = new MovimientosTarjetasCreditoBean();
            movimientoTarjetaBean.setExtractos(extractos);
            movimientoTarjetaBean.setCuenta(datosTarjeta.getCuenta());
            movimientoTarjetaBean.setFechas(fechas);
          }

        } else { // si ES Titular - SE DESPLEGARAN FECHAS

          movimientoTarjetaBean = new MovimientosTarjetasCreditoBean();
          movimientoTarjetaBean.setCuenta(datosTarjeta.getCuenta());
          movimientoTarjetaBean.setFechas(fechas);
        }
        return movimientoTarjetaBean;
      }
    }

    if (StringUtils.equals(datosTarjeta.getTipoOperacion(), "TarjetaCredito")) {

      boolean aurizado = false;
      movimientoTarjetaBean = new MovimientosTarjetasCreditoBean();
      try {
        Iterator itera = (Iterator) cliente.getTarjetas().iterator();

        while (itera.hasNext()) {
          TarjetaBean tarjeta = (TarjetaBean) itera.next();
          if (tarjeta.getNumeroTarjeta().equalsIgnoreCase(datosTarjeta.getCuenta())) {
            aurizado = true;
            break;
          }
        }
        log.debug("VALOR de autorizado*********** " + aurizado);
        if (!aurizado) {
          log.debug("Se trato de hacer una operacion invalida...");
          throw new BusinessException("MOVT-MT-3");
        }
      } catch (Exception e) {
        throw new BusinessException("MOVIMIENTOS");
      }

      MovimientosFinalesContainerBean movimientosTarjeta = null;

      log.debug("entro en obtener movimientos***********");
      boolean estaBloqueada =
          MovimientosServiceReusableFunctions.ServicioValidaBloqueo(
              datosTarjeta.getCuenta(), bitacoraBean.getNombreClase());
      SantanderReferenciaService referencia =
          commonService.getReferencia(bitacoraBean.getNombreClase());
      log.debug("Valor de bloqueada********" + estaBloqueada);
      if (!estaBloqueada) {
        // String tasaAnualizada = null;
        log.debug("ENTRO en !esBloquedada");
        if (StringUtils.equals(datosTarjeta.getDespliega(), "extractos")) {

          log.debug("ENTro en extractos!!!!!");
          movimientosTarjeta =
              MovimientosServiceReusableFunctions.obtenerMovimientosExtracto(
                  datosTarjeta.getNumeroExtracto(),
                  datosTarjeta.getExtracto().getMonedaExtracto(),
                  datosTarjeta.getCuenta(),
                  datosTarjeta.getExtracto().getTasaAnualizada(),
                  bitacoraBean,
                  String.valueOf(referencia.getNumReferencia()));
          log.debug("MOVIMIENTOS TARJETA" + movimientosTarjeta.toString());

        } else { // Si viene de Fechas consulta por MPV3
          log.debug("Sin extractos!!!!!");
          movimientosTarjeta =
              MovimientosServiceReusableFunctions.obtenerMovsTarjetaPAMPA(
                  datosTarjeta.getFechaHistorica(),
                  datosTarjeta.getFecha(),
                  datosTarjeta.getCuenta(),
                  bitacoraBean,
                  String.valueOf(referencia.getNumReferencia())); // PAMPAIII
        }
      }

      if (movimientosTarjeta.getListaMovimientos() == null) {
        throw new BusinessException("MOVT-MT-3");
      }
      if (estaBloqueada) {
        throw new BusinessException("MOVT-MT-4");
      }

      bitacoraBean.setNumeroReferencia(referencia.getNumReferencia());
      bitacoraBean.setNumeroCuenta(datosTarjeta.getCuenta());
      String mensajeStatus = SantanderConstantesService.MOVT; // +
      // movimientosTarjeta.getMensajeStatus().substring(4);
      bitacoraBean.setMensaje(mensajeStatus);
      bitacoraBean.setClaveUsuario(cliente.getClaveCliente());
      commonService.registrarBitacora(bitacoraBean);

      movimientoTarjetaBean.setMovimientos(movimientosTarjeta);
      movimientoTarjetaBean.setCuenta(datosTarjeta.getCuenta());
      movimientoTarjetaBean.setFechaHistorica(datosTarjeta.getFechaHistorica());
      movimientoTarjetaBean.setFecha(datosTarjeta.getFecha());
    }
    if (movimientoTarjetaBean == null) {
      throw new BusinessException("MOVIMIENTOS");
    }
    return movimientoTarjetaBean;
  }