Package com.zesped.model

Examples of com.zesped.model.CustomerAccount


    return accaccounts;
  }

  public Collection<Client> getClients() throws ElementNotFoundException, NotEnoughRightsException, DmsException, InstantiationException, IllegalAccessException {
    AtrilSession oSes = DAO.getAdminSession("BaseEditBean");
    CustomerAccount oAcc = new CustomerAccount(oSes.getDms().getDocument(getSessionAttribute("customer_account_docid")));
    Collection<Client> clients = oAcc.clients(oSes).list(oSes);
    oSes.disconnect();
    oSes.close();
    return clients;
  }
View Full Code Here


    final String role = getParam("role","");
    final String txpr = getParam("taxpayer","");

    try {
      connect();
      CustomerAccount cacc = new CustomerAccount(getSession().getDms(), getSessionAttribute("customer_account_docid"));
      if (role.length()==0 || role.equalsIgnoreCase("admin")) setAdmins(cacc.getAdmins(getSession()));
      if (role.length()==0 || role.equalsIgnoreCase("user" )) setUsers(cacc.getUsers(getSession()));
      if (role.length()==0 || role.equalsIgnoreCase("guest")) setGuests(cacc.getGuests(getSession()));
      if (txpr.length()>0) {
        taxpr = new TaxPayer(getSession().getDms(), txpr);
        filterMembersByTaxPayer(getAdmins());
        filterMembersByTaxPayer(getUsers());
        filterMembersByTaxPayer(getGuests());
View Full Code Here

    } catch (Exception e) {
      Log.out.error("BaseEditBean.getTaxPayers() Cache.getObject("+ckey+") "+e.getClass().getName()+" "+e.getMessage(), e);
    }
    if (null==taxpayers) {
        connect(getSessionAttribute("nickname"), getSessionAttribute("password"));
      CustomerAccount oAcc = new CustomerAccount(getSession().getDms().getDocument(getSessionAttribute("customer_account_docid")));
      taxpayers = oAcc.taxpayers(getSession()).list(getSession());
      for (TaxPayer oTxp : taxpayers)
        if (oTxp.getTaxId().length()>0)
          oTxp.setBusinessName(oTxp.getBusinessName()+" ("+oTxp.getTaxId()+")");
      disconnect();
      try {
View Full Code Here

    id = getParam("id");
    action = getParam("a","r").equals("f") ? "forward" : "reply";
    try {
      connect();
      setMessage(new Message(getSession().getDms(), id));
      CustomerAccount cac = new CustomerAccount(getSession().getDms(), getSessionAttribute("customer_account_docid"));
      recipients = cac.getUsers(getSession());
      disconnect();
      } catch (Exception xcpt) {
        Log.out.error(xcpt.getMessage(), xcpt);
      } finally {
        close();
View Full Code Here

      Order order = new Order();
      try {
        connect();
        AtrilSession oSes = getSession();
        Dms oDms = oSes.getDms();
        CustomerAccount cacc = new CustomerAccount(oDms, getSessionAttribute("customer_account_docid"));
        order = cacc.createOrder(oSes);
        order.put("user_id", getSessionAttribute("user_docid"));
        order.put("credits_bought", selectedProduct.getCredits());
        order.save(oSes);

        Log.out.info("Created order "+order.getString("order_id")+" for customer "+getSessionAttribute("customer_acount"));
       
        OrderLine line = order.addLine(oSes, selectedProduct);

        Log.out.info("Added order line for product "+selectedProduct.getString("product_name"));

        order.put("base_price", line.getString("base_price"));
        order.put("taxes", line.getString("taxes"));
        order.put("taxespct", line.getString("taxespct"));
        order.put("total_price", line.getString("subtotal_price"));
        order.put("currency", line.getString("currency"));
        order.save(oSes);
       
        DAO.log(oSes, order.getDocument(), Order.class, "CREATE ORDER", AtrilEvent.Level.INFO, order.getDocument().id()+";"+getSessionAttribute("customer_acount")+";"+selectedProduct.getString("product_name"));

        cacc.restoreCredits(oSes, new BigDecimal(selectedProduct.getCredits().longValue()));

        Log.out.info("Added "+selectedProduct.getCredits().toString()+" credits to customer "+getSessionAttribute("customer_acount"));
        DAO.log(oSes, cacc.getDocument(), CustomerAccount.class, "UPDATE CREDITS", AtrilEvent.Level.INFO, cacc.getDocument().id()+";"+cacc.get("credits_left"));
       
        disconnect();
        LoginInterceptor.expire(getSessionAttribute("nickname"), getSessionAttribute("password"));
        return new RedirectResolution(CaptureInvoice.class);
      } catch (Exception e) {
View Full Code Here

        }else{          
            try {
                connect();
                AtrilSession oSes = getSession();
                Dms oDms = oSes.getDms();
                CustomerAccount cacc = new CustomerAccount(oDms, getSessionAttribute("customer_account_docid"));
                setName(cacc.getString("name_billing"));
                setCif(cacc.getString("cif_billing"));
                setPhone(cacc.getString("phone_billing"));
                setMail(cacc.getString("mail_billing"));
                setAddress(cacc.getString("address_billing"));
                setPostcode(cacc.getString("postcode_billing"));
                setCountry(cacc.getString("country_billing"));
                setState(cacc.getString("state_billing"));
                setCity(cacc.getString("city_billing"));
                disconnect();
                return new ForwardResolution(FORM);
            } catch (StorageException ex) {
                 Log.out.error("EngageCredit.form() "+ex.getClass().getName()+" "+ex.getMessage(), ex);
            }
View Full Code Here

        try {

            connect();
            AtrilSession oSes = getSession();
            Dms oDms = oSes.getDms();
            CustomerAccount cacc = new CustomerAccount(oDms, getSessionAttribute("customer_account_docid"));
      oSes.commit();
     
            cacc.put("name_billing",getName());
            cacc.put("cif_billing",getCif());
            cacc.put("phone_billing",getPhone());
            cacc.put("mail_billing",getMail());
            cacc.put("address_billing",getAddress());
            cacc.put("postcode_billing",getPostcode());
            cacc.put("city_billing",getCity());
            cacc.put("state_billing",getState());
            cacc.put("country_billing",getCountry());
            cacc.save(oSes);
            oSes.commit();
     
            order = cacc.createOrder(oSes);
            order.put("user_id", getSessionAttribute("user_docid"));
            order.put("credits_bought", selectedProduct.getCredits());
            //order.save(oSes);

            Log.out.info("Created order " + order.getString("order_id") + " for customer " + getSessionAttribute("customer_acount"));

            order.put("promo_code",promo_code);
            order.put("name",name);
            order.put("cif",cif);
            order.put("phone",phone);
            order.put("mail",mail);
            order.put("address",address);
            order.put("city",city);
            order.put("state",state);
            order.put("country",country);
            order.put("postcode",postcode);
            order.put("cardnumber",cardnumber);
            order.put("cardholder",cardholder);
            order.put("expiration_month_card",expiration_month_card);
            order.put("expiration_year_card",expiration_year_card);
            order.put("cvv2",cvv2);

            order.save(oSes);
            commit();
           
            OrderLine line = order.addLine(oSes, selectedProduct);
      commit();
     
            Log.out.info("Added order line for product " + selectedProduct.getString("product_name"));

            order.put("base_price", line.getString("base_price"));
            order.put("taxes", line.getString("taxes"));
            order.put("taxespct", line.getString("taxespct"));
            order.put("total_price", line.getString("subtotal_price"));
            order.put("currency", line.getString("currency"));

            if (selectedProduct.getPrice().compareTo(BigDecimal.ZERO)==0) {
                order.put("status_number", Tpv.PAGADO);
                Long oCreditsLeft = new Long(cacc.getBigDecimal("credits_left").longValue());
                if (null == oCreditsLeft) {
                    oCreditsLeft = new Long(0l);
                }
                cacc.put("credits_left", new Long(oCreditsLeft.longValue() + selectedProduct.getCredits().longValue()));
                cacc.save(oSes);
        commit();
       
                Log.out.info("Added " + selectedProduct.getCredits().toString() + " credits to customer " + getSessionAttribute("customer_acount"));
                DAO.log(oSes, cacc.getDocument(), CustomerAccount.class, "UPDATE CREDITS", AtrilEvent.Level.INFO, cacc.getDocument().id() + ";" + cacc.get("credits_left"));

            } else {
                order.put("status_number",Tpv.PENDIENTE_PAGO);
            }
           
View Full Code Here

        try {
            connect();
            AtrilSession oSes = getSession();
            if(oSes!=null){
            Dms oDms = oSes.getDms();
            CustomerAccount cacc = new CustomerAccount(oDms, getSessionAttribute("customer_account_docid"));
            disconnect();
            return cacc.getCreditsLeft().toString().substring(0, cacc.getCreditsLeft().toString().indexOf("."));
            }
        } catch (StorageException ex) {
            Log.out.error("BaseActionBean.getCreditsleft() "+ex.getClass().getName()+" "+ex.getMessage(), ex);
        }
        return null;
View Full Code Here

        try {
            connect();
            AtrilSession oSes = getSession();
            if(oSes!=null){
            Dms oDms = oSes.getDms();
            CustomerAccount cacc = new CustomerAccount(oDms, getSessionAttribute("customer_account_docid"));
            disconnect();
            return cacc.getCreditsUsed().toString().substring(0, cacc.getCreditsUsed().toString().indexOf("."));
            }
        } catch (StorageException ex) {
            Log.out.error("BaseActionBean.getCreditsused() "+ex.getClass().getName()+" "+ex.getMessage(), ex);
        }
        return null;
View Full Code Here

    return null;
  }

  public Collection<TaxPayer> getTaxPayers() throws ElementNotFoundException, NotEnoughRightsException, DmsException, InstantiationException, IllegalAccessException {
    AtrilSession oSes = DAO.getAdminSession("EditEmployee");
    CustomerAccount oAcc = new CustomerAccount(oSes.getDms().getDocument(getSessionAttribute("customer_account_docid")));
    Collection<TaxPayer> taxpayers = oAcc.taxpayers(oSes).list(oSes);
    oSes.disconnect();
    oSes.close();
    return taxpayers;
  }
View Full Code Here

TOP

Related Classes of com.zesped.model.CustomerAccount

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.