@Override
  public final void process(final Map<String, Object> pRqVs,
    final IRequestData pRqDt) throws Exception {
    TradingSettings ts = (TradingSettings) pRqVs.get("tradSet");
    Cart cart = this.srvCart.getShoppingCart(pRqVs, pRqDt, true, false);
    CartLn cartLn = null;
    String lnIdStr = pRqDt.getParameter("lnId");
    String quantStr = pRqDt.getParameter("quant");
    String avQuanStr = pRqDt.getParameter("avQuan");
    String unStepStr = pRqDt.getParameter("unStep");
    BigDecimal quant = new BigDecimal(quantStr);
    BigDecimal avQuan = new BigDecimal(avQuanStr);
    if (quant.compareTo(avQuan) == 1) {
      quant = avQuan;
    }
    BigDecimal unStep = new BigDecimal(unStepStr);
    String itIdStr = pRqDt.getParameter("itId");
    String itTypStr = pRqDt.getParameter("itTyp");
    Long itId = Long.valueOf(itIdStr);
    AccSettings as = (AccSettings) pRqVs.get("accSet");
    TaxDestination txRules = this.srvCart
      .revealTaxRules(pRqVs, cart, as);
    EShopItemType itTyp = EShopItemType.class.
      getEnumConstants()[Integer.parseInt(itTypStr)];
    boolean redoPr = false;
    if (lnIdStr != null) { //change quantity
      Long lnId = Long.valueOf(lnIdStr);
      cartLn = findCartItemById(cart, lnId);
    } else { //add
      redoPr = true;
      String uomIdStr = pRqDt.getParameter("uomId");
      Long uomId = Long.valueOf(uomIdStr);
      for (CartLn ci : cart.getItems()) {
        //check for duplicate cause "weird" but accepted request
        if (!ci.getDisab() && ci.getItTyp().equals(itTyp)
          && ci.getItId().equals(itId)) {
          cartLn = ci;
          break;
        }
      }
      if (cartLn == null) {
        for (CartLn ci : cart.getItems()) {
          if (ci.getDisab()) {
            cartLn = ci;
            cartLn.setDisab(false);
            cartLn.setForc(false);
            cartLn.setSeller(null);
            cartLn.setTxCat(null);
            cartLn.setTxDsc(null);
            break;
          }
        }
      }
      if (cartLn == null) {
        cartLn = createCartItem(cart);
      }
      UnitOfMeasure uom = new UnitOfMeasure();
      uom.setItsId(uomId);
      cartLn.setUom(uom);
      cartLn.setItId(itId);
      cartLn.setItTyp(itTyp);
    }
    if (!cartLn.getForc()) {
      cartLn.setAvQuan(avQuan);
      cartLn.setQuant(quant);
      cartLn.setUnStep(unStep);
      BigDecimal amount = cartLn.getPrice().multiply(cartLn.getQuant()).
        setScale(as.getPricePrecision(), as.getRoundingMode());
      if (ts.getTxExcl()) {
        cartLn.setSubt(amount);
      } else {
        cartLn.setTot(amount);
      }
      this.srvCart.makeCartLine(pRqVs, cartLn, as, ts, txRules, redoPr, true);
      this.srvCart.makeCartTotals(pRqVs, ts, cartLn, as, txRules);
      this.srvCart.hndCartChan(pRqVs, cart, txRules);
    }
    if (txRules != null) {
      pRqDt.setAttribute("txRules", txRules);
    }
    redir(pRqVs, pRqDt);
  }
@ Override public final void process ( final Map < String , Object > pRqVs , final IRequestData pRqDt ) throws Exception { TradingSettings ts = ( TradingSettings ) pRqVs . get ( "tradSet" ) ; Cart cart = this . srvCart . getShoppingCart ( pRqVs , pRqDt , true , false ) ; CartLn cartLn = null ; String lnIdStr = pRqDt . getParameter ( "lnId" ) ; String quantStr = pRqDt . getParameter ( "quant" ) ; String avQuanStr = pRqDt . getParameter ( "avQuan" ) ; String unStepStr = pRqDt . getParameter ( "unStep" ) ; BigDecimal quant = new BigDecimal ( quantStr ) ; BigDecimal avQuan = new BigDecimal ( avQuanStr ) ; if ( quant . compareTo ( avQuan ) == 1 ) { quant = avQuan ; } BigDecimal unStep = new BigDecimal ( unStepStr ) ; String itIdStr = pRqDt . getParameter ( "itId" ) ; String itTypStr = pRqDt . getParameter ( "itTyp" ) ; Long itId = Long . valueOf ( itIdStr ) ; AccSettings as = ( AccSettings ) pRqVs . get ( "accSet" ) ; TaxDestination txRules = this . srvCart . revealTaxRules ( pRqVs , cart , as ) ; EShopItemType itTyp = EShopItemType . class . getEnumConstants ( ) [ Integer . parseInt ( itTypStr ) ] ; boolean redoPr = false ; if ( lnIdStr != null ) { Long lnId = Long . valueOf ( lnIdStr ) ; cartLn = findCartItemById ( cart , lnId ) ; } else { redoPr = true ; String uomIdStr = pRqDt . getParameter ( "uomId" ) ; Long uomId = Long . valueOf ( uomIdStr ) ; for ( CartLn ci : cart . getItems ( ) ) { if ( ! ci . getDisab ( ) && ci . getItTyp ( ) . equals ( itTyp ) && ci . getItId ( ) . equals ( itId ) ) { cartLn = ci ; break ; } } if ( cartLn == null ) { for ( CartLn ci : cart . getItems ( ) ) { if ( ci . getDisab ( ) ) { cartLn = ci ; cartLn . setDisab ( false ) ; cartLn . setForc ( false ) ; cartLn . setSeller ( null ) ; cartLn . setTxCat ( null ) ; cartLn . setTxDsc ( null ) ; break ; } } } if ( cartLn == null ) { cartLn = createCartItem ( cart ) ; } UnitOfMeasure uom = new UnitOfMeasure ( ) ; uom . setItsId ( uomId ) ; cartLn . setUom ( uom ) ; cartLn . setItId ( itId ) ; cartLn . setItTyp ( itTyp ) ; } if ( ! cartLn . getForc ( ) ) { cartLn . setAvQuan ( avQuan ) ; cartLn . setQuant ( quant ) ; cartLn . setUnStep ( unStep ) ; BigDecimal amount = cartLn . getPrice ( ) . multiply ( cartLn . getQuant ( ) ) . setScale ( as . getPricePrecision ( ) , as . getRoundingMode ( ) ) ; if ( ts . getTxExcl ( ) ) { cartLn . setSubt ( amount ) ; } else { cartLn . setTot ( amount ) ; } this . srvCart . makeCartLine ( pRqVs , cartLn , as , ts , txRules , redoPr , true ) ; this . srvCart . makeCartTotals ( pRqVs , ts , cartLn , as , txRules ) ; this . srvCart . hndCartChan ( pRqVs , cart , txRules ) ; } if ( txRules != null ) { pRqDt . setAttribute ( "txRules" , txRules ) ; } redir ( pRqVs , pRqDt ) ; }
<p>Process entity request.</p>
@param pRqVs request scoped vars
@param pRqDt Request Data
@throws Exception - an exception