Example #1
0
  private Collection<CuentaTO> wrapperCuenta(
      Collection<com.bancoazteca.elite.beans.CuentaTO> cuentasOrigen) {
    Collection<CuentaTO> cuentasDestino = new ArrayList<CuentaTO>();
    for (com.bancoazteca.elite.beans.CuentaTO cuenta : cuentasOrigen) {
      CuentaTO cuentaTO = new CuentaTO();
      String subProduct = cuenta.getSubproducto();
      if (!Validator.isEmptyData(subProduct)) {
        cuentaTO.setNumero_cuenta(cuenta.getCuentaFormateada().replaceAll(" ", ""));
        cuentaTO.setCuenta_clabe(cuenta.getClabe());

        double retenido = getCantidad(cuenta.getRetenido());
        double disponible = getCantidad(cuenta.getDisponible());
        double saldoTotal = retenido + disponible;

        cuentaTO.setSaldo_retenido(String.valueOf(retenido));
        cuentaTO.setSaldo_disponible(String.valueOf(disponible));
        cuentaTO.setSaldo_total(String.valueOf(saldoTotal));

        cuentaTO.setProducto(cuenta.getDescripcion());

        cuentasDestino.add(cuentaTO);
      }
    }
    return cuentasDestino;
  }
Example #2
0
  public Response ejecucion(Session session) throws Exception {
    Response response = new Response();
    ResourceFacadeSL facadeSL = getDelegate();
    LoginResponseTO loginResponseTO = null;

    LoginRequestTO loginRequestTO = new LoginRequestTO();
    ClienteTO clienteTO = (ClienteTO) session.getAttribute(CLIENTE_TO);
    String userName = clienteTO.getUserName();
    loginRequestTO.setUser(userName);

    loginResponseTO = facadeSL.getCuentasUsuario(loginRequestTO);

    clienteTO = loginResponseTO.getClienteTO();
    clienteTO.setUserName(userName);

    CuentasTO cuentasTO = new CuentasTO();
    Collection<CuentaTO> cuentaCollectionTO = new ArrayList<CuentaTO>();

    //		Collection<com.bancoazteca.elite.beans.CuentaTO> cuentasActuales=new
    // ArrayList<com.bancoazteca.elite.beans.CuentaTO>();
    if (clienteTO.getCuentas() != null) {
      for (com.bancoazteca.elite.beans.CuentaTO cuentaEliteTO : clienteTO.getCuentas()) {
        String cuentaFormateada = cuentaEliteTO.getCuentaFormateada().replace(" ", "");

        if (isContrato(cuentaFormateada)) {
          continue;
        }

        CuentaTO cuentaTO = new CuentaTO();

        //				double retenido = getCantidad(cuentaEliteTO.getRetenido());
        //				double disponible = getCantidad(cuentaEliteTO.getDisponible());
        //				double saldoTotal = retenido + disponible;

        cuentaTO.setNumero_cuenta(cuentaFormateada);

        cuentaTO.setCuenta_clabe(cuentaEliteTO.getClabe());
        //				cuentaTO.setSaldo_retenido(String.valueOf(retenido));
        //				cuentaTO.setSaldo_disponible(String.valueOf(disponible));
        //				cuentaTO.setSaldo_total(String.valueOf(saldoTotal));
        cuentaTO.setSaldo_total(String.valueOf(cuentaEliteTO.getBalance()));
        cuentaTO.setSaldo_retenido(String.valueOf(cuentaEliteTO.getRetenido()));
        cuentaTO.setSaldo_disponible(String.valueOf(cuentaEliteTO.getDisponible()));
        cuentaTO.setProducto(cuentaEliteTO.getDescripcion());

        cuentaCollectionTO.add(cuentaTO);

        //				cuentaEliteTO.setBalance(saldoTotal);
        //				cuentasActuales.add(cuentaEliteTO);

      }
    }
    //		clienteTO.setCuentas(cuentasActuales);

    Collection<com.bancoazteca.elite.beans.CreditoTO> creditos = clienteTO.getCreditos();
    if (creditos != null) {
      Collection<com.bancoazteca.eservice.command.base.beans.CreditoTO> creditosColeccion =
          new ArrayList<com.bancoazteca.eservice.command.base.beans.CreditoTO>();
      for (com.bancoazteca.elite.beans.CreditoTO credit : clienteTO.getCreditos()) {
        com.bancoazteca.eservice.command.base.beans.CreditoTO credito_TO =
            new com.bancoazteca.eservice.command.base.beans.CreditoTO();
        credito_TO.setEstatus(credit.getEstatus());
        credito_TO.setFecha_proximo_pago(Formatter.formatoFecha(credit.getFechaProxPago()));
        credito_TO.setIndex(credit.getIndex());
        credito_TO.setNumero_credito(credit.getNumCredito());
        credito_TO.setNumero_cuenta(credit.getNumCuenta());
        credito_TO.setPagos_pendientes(credit.getPagosPendientes());
        credito_TO.setPagos_realizados(credit.getPagosRealizados());
        credito_TO.setSaldo_actual(credit.getSaldoActual());
        credito_TO.setTipo_credito(credit.getTipo());
        credito_TO.setTotal_pagos(credit.getTotalPagos());
        creditosColeccion.add(credito_TO);
      }

      cuentasTO.setColeccion_creditos(creditosColeccion);
    }

    cuentasTO.setColeccion_cuentas(cuentaCollectionTO);
    cuentasTO.setColeccion_tarjetas(obtenerTarjetas(clienteTO));

    try {
      Inversion_mercado_dineroTO inversion_mercado_dinero = getMercadoDinero(clienteTO, session);
      cuentasTO.setInversion_mercado_dinero(inversion_mercado_dinero);
    } catch (Exception e) {
      e.printStackTrace();
    }

    cuentasTO.setAlias(clienteTO.getUserName());
    cuentasTO.setEmail(clienteTO.getEmail());
    cuentasTO.setNombre_completo(clienteTO.getNombreCompleto());

    CuentasTO clasificacionCuentas = filtrarCuentas(clienteTO);
    if (clasificacionCuentas != null) {
      cuentasTO.setColeccion_cuentas(clasificacionCuentas.getColeccion_cuentas());
      cuentasTO.setColeccion_inversiones(clasificacionCuentas.getColeccion_inversiones());
    }

    session.addAttribute(CLIENTE_TO, clienteTO);
    response.addAttribute(cuentasTO);

    return response;
  }