Package com.zesped.model

Examples of com.zesped.model.Order


      errors.add("selectedProduct", new LocalizableError("com.zesped.action.BuyCredits.noCreditsSpecified"))
    }
  }

  public Resolution buy() {
      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"));
View Full Code Here


       try {
      String order_id = getContext().getRequest().getParameter("order_id");
      connect();
      AtrilSession oSes = getSession();
      Dms oDms = oSes.getDms();
      Order oOrder = new Order(oDms, order_id);
      BigDecimal oStatus = oOrder.getBigDecimal("status_number");
      if (oStatus != null && (oStatus.compareTo(Tpv.PAGADO) != 0 && oStatus.compareTo(Tpv.PENDIENTE_CONFIRMACION) != 0)) {
        oOrder.getDocument().deleteWithChildren();
        oSes.commit();
      }
      disconnect();
      return new ForwardResolution("");
    } catch (StorageException ex) {
View Full Code Here

        if(order_id.length()>0){
            try {
                connect();
                AtrilSession oSes = getSession();
                Dms oDms = oSes.getDms();
                order = new Order(oDms,order_id);
                disconnect();
                return new ForwardResolution("/WEB-INF/jsp/engagecreditok.jsp");
            } catch (StorageException ex) {
                Log.out.error("EngageCredit.form() "+ex.getClass().getName()+" "+ex.getMessage(), ex);
            }
View Full Code Here

            String order_id = getContext().getRequest().getParameter("order_id");
           
            connect();
            AtrilSession oSes = getSession();
            Dms oDms = oSes.getDms();
            order = new Order(oDms,order_id);
            order.put("status_number",Tpv.PENDIENTE_CONFIRMACION);
            Date dtNow = new Date();
            order.put("pay_date", dtNow);
      order.newTransaction();
      order.put("cardnumber", cardnumber);
View Full Code Here

TOP

Related Classes of com.zesped.model.Order

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.