Package com.google.checkout

Examples of com.google.checkout.ShoppingCart


      HttpServletRequest _request) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Building CheckoutShoppingCart from HTTP Request");
    }
    CheckoutShoppingCart checkoutCart = new CheckoutShoppingCart();
    ShoppingCart cart = new ShoppingCart();
    Items items = new Items();
    // Start with 0
    int lineNum = 0;
    while (_request.getParameter(PARAM_ITEM_NAME + lineNum) != null
        && _request.getParameter(PARAM_ITEM_DESCRIPTION + lineNum) != null
        && _request.getParameter(PARAM_UNIT_PRICE + lineNum) != null
        && _request.getParameter(PARAM_QUANTITY + lineNum) != null) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Found items for line " + lineNum);
      }
      Item item = new Item();
      item.setItemName(_request.getParameter(PARAM_ITEM_NAME + lineNum));
      item.setItemDescription(_request
          .getParameter(PARAM_ITEM_DESCRIPTION + lineNum));
      UnitPrice price = new UnitPrice();
      price.setContent(new BigDecimal(_request
          .getParameter(PARAM_UNIT_PRICE + lineNum)));
      if (_request.getParameter(PARAM_UNIT_PRICE + lineNum + PARAM_DOT_CURRENCY) != null) {
        price.setCurrency(_request.getParameter(PARAM_UNIT_PRICE
            + lineNum + PARAM_DOT_CURRENCY));
      } else {
        price.setCurrency(USD);
      }
      item.setUnitPrice(price);
      item.setQuantity(Integer.parseInt(_request.getParameter(PARAM_QUANTITY
          + lineNum)));
      items.addItem(item);
      lineNum++;
    }
    cart.setItems(items);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Added " + lineNum + " items to the cart.");
    }
    checkoutCart.setShoppingCart(cart);
    CheckoutFlowSupport flowSupport = new CheckoutFlowSupport();
View Full Code Here

TOP

Related Classes of com.google.checkout.ShoppingCart

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.