<p>Deletes cart line.</p>
@param pRqVs request scoped vars
@param pCartLn cart line
@param pTxRules Tax Rules
@throws Exception - an exception.
426741
@Override
  public final void delLine(final Map<String, Object> pRqVs,
    final CartLn pCartLn, final TaxDestination pTxRules) throws Exception {
    AccSettings as = (AccSettings) pRqVs.get("accSet");
    TradingSettings ts = (TradingSettings) pRqVs.get("tradSet");
    pCartLn.setDisab(true);
    String[] fieldsNames = new String[] {"itsId", "itsVersion", "disab"};
    pRqVs.put("fieldsNames", fieldsNames);
    getSrvOrm().updateEntity(pRqVs, pCartLn);
    if (pTxRules != null && pCartLn.getTxCat() != null && !pTxRules
      .getSalTaxIsInvoiceBase() && !pTxRules.getSalTaxUseAggregItBas()) {
      pRqVs.put("CartItTxLnitsOwnerdeepLevel", 1);
      List<CartItTxLn> itls = getSrvOrm().retrieveListWithConditions(
          pRqVs, CartItTxLn.class, "where DISAB=0 and ITSOWNER="
            + pCartLn.getItsId());
      pRqVs.remove("CartItTxLnitsOwnerdeepLevel");
      for (CartItTxLn itl : itls) {
        if (!itl.getDisab() && itl.getItsOwner().getItsId()
          .equals(pCartLn.getItsId())) {
          itl.setDisab(true);
          getSrvOrm().updateEntity(pRqVs, itl);
        }
      }
    }
    pRqVs.remove("fieldsNames");
    makeCartTotals(pRqVs, ts, pCartLn, as, pTxRules);
  }
279444
@Override
	public void removeByG_P_A(long groupId, boolean primary, boolean active) {
		for (CommerceCurrency commerceCurrency : findByG_P_A(groupId, primary,
				active, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
			remove(commerceCurrency);
		}
	}
608778
public final void emptyCart(final Map<String, Object> pRqVs,
    final Cart pCart) throws Exception {
    String[] fieldsNames = new String[] {"itsId", "itsVersion", "disab"};
    pRqVs.put("fieldsNames", fieldsNames);
    for (CartLn l : pCart.getItems()) {
      if (!l.getDisab()) {
        l.setDisab(true);
        getSrvOrm().updateEntity(pRqVs, l);
      }
    }
    for (CartTxLn l : pCart.getTaxes()) {
      if (!l.getDisab()) {
        l.setDisab(true);
        getSrvOrm().updateEntity(pRqVs, l);
      }
    }
    for (CartTot l : pCart.getTotals()) {
      if (!l.getDisab()) {
        l.setDisab(true);
        getSrvOrm().updateEntity(pRqVs, l);
      }
    }
    pRqVs.remove("fieldsNames");
    if (pCart.getTot().compareTo(BigDecimal.ZERO) == 1) {
      pCart.setTot(BigDecimal.ZERO);
      getSrvOrm().updateEntity(pRqVs, pCart);
    }
  }
1083295
@Override
	public com.liferay.commerce.model.CommerceShippingMethod deleteCommerceShippingMethod(
		com.liferay.commerce.model.CommerceShippingMethod commerceShippingMethod)
		throws com.liferay.portal.kernel.exception.PortalException {
		return _commerceShippingMethodLocalService.deleteCommerceShippingMethod(commerceShippingMethod);
	}
772700
@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);
  }
1106508
public static com.liferay.commerce.product.model.CPDefinitionOptionRel deleteCPDefinitionOptionRel(
		com.liferay.commerce.product.model.CPDefinitionOptionRel cpDefinitionOptionRel)
		throws com.liferay.portal.kernel.exception.PortalException {
		return getService().deleteCPDefinitionOptionRel(cpDefinitionOptionRel);
	}
785039
@Override
  public final void process(final Map<String, Object> pRqVs,
    final IRequestData pRqDt) throws Exception {
    OnlineBuyer buyer = this.buySr.getBuyr(pRqVs, pRqDt);
    if (buyer == null) {
      buyer = this.buySr.createBuyr(pRqVs, pRqDt);
    }
    String nm = pRqDt.getParameter("nm");
    String em = pRqDt.getParameter("em");
    String pw = pRqDt.getParameter("pw");
    String pwc = pRqDt.getParameter("pwc");
    long now = new Date().getTime();
    String tbn = OnlineBuyer.class.getSimpleName();
    pRqDt.setAttribute("buyr", buyer);
    if (buyer.getRegEmail() == null) { //unregistered:
      if (nm != null && pw != null && pwc != null && em != null) {
        //creating:
        if (nm.length() > 2 && pw.length() > 7 && pw.equals(pwc)
          && em.length() > 5) {
          Set<String> ndFl = new HashSet<String>();
          ndFl.add("itsId");
          pRqVs.put(tbn + "neededFields", ndFl);
          List<OnlineBuyer> brs = getSrvOrm().retrieveListWithConditions(pRqVs,
            OnlineBuyer.class, "where REGEMAIL='" + em + "'");
          pRqVs.remove(tbn + "neededFields");
          if (brs.size() == 0) {
            buyer.setItsName(nm);
            buyer.setRegisteredPassword(pw);
            buyer.setRegEmail(em);
            buyer.setLsTm(now);
            UUID buseid = UUID.randomUUID();
            buyer.setBuSeId(buseid.toString());
            if (buyer.getIsNew()) {
              this.srvOrm.insertEntity(pRqVs, buyer);
            } else {
              this.srvOrm.updateEntity(pRqVs, buyer);
            }
            pRqDt.setCookieValue("cBuyerId", buyer.getItsId().toString());
            pRqDt.setCookieValue("buSeId", buyer.getBuSeId());
          } else if (brs.size() == 1) {
            pRqDt.setAttribute("errMsg", "emBusy");
          } else {
            getLog().error(pRqVs, PrLog.class,
              "Several users with same email!: " + em);
          }
        } else {
          pRqDt.setAttribute("errMsg", "buyCrRul");
        }
      } else if (pw != null && em != null) {
        //login from new browser
        pRqVs.put(tbn + "regCustomerdeepLevel", 1);
        pRqVs.put(tbn + "taxDestplacedeepLevel", 1);
        List<OnlineBuyer> brs = getSrvOrm().retrieveListWithConditions(
          pRqVs, OnlineBuyer.class, "where REGISTEREDPASSWORD='" + pw
            + "' and REGEMAIL='" + em + "'");
        pRqVs.remove(tbn + "regCustomerdeepLevel");
        pRqVs.remove(tbn + "taxDestplacedeepLevel");
        if (brs.size() == 1) {
          //free buyer and moving its cart by fast updates:
          mkFreBuyr(pRqVs,  pRqDt, buyer, brs.get(0));
        } else if (brs.size() == 0) {
          pRqDt.setAttribute("errMsg", "wrong_em_password");
        } else {
          getLog().error(pRqVs, PrLog.class,
            "Several users with same password and email!: " + em);
        }
      } else {
        spam(pRqVs, pRqDt);
      }
    } else { //registered:
      if (now - buyer.getLsTm() < 1800000L && buyer.getBuSeId() != null) {
        //there is opened session:
        String buSeId = pRqDt.getCookieValue("buSeId");
        if (buyer.getBuSeId().equals(buSeId)) {
          //authorized requests:
          String zip = pRqDt.getParameter("zip");
          String adr1 = pRqDt.getParameter("adr1");
          if (nm != null && zip != null  && adr1 != null) {
            //change name, shipping address:
            String cnt = pRqDt.getParameter("cnt");
            String cit = pRqDt.getParameter("cit");
            String adr2 = pRqDt.getParameter("adr2");
            String phn = pRqDt.getParameter("phn");
            if (nm.length() > 2 && zip.length() > 2 && adr1.length() > 2) {
              buyer.setItsName(nm);
              buyer.setRegZip(zip);
              buyer.setRegAddress1(adr1);
              buyer.setRegAddress2(adr2);
              buyer.setRegCountry(cnt);
              buyer.setRegCity(cit);
              buyer.setRegPhone(phn);
              buyer.setLsTm(now);
              this.srvOrm.updateEntity(pRqVs, buyer);
            } else {
              pRqDt.setAttribute("errMsg", "buyEmRul");
            }
          } else if (pw != null && pwc != null) {
            //change password:
            if (pw.length() > 7 && pw.equals(pwc)) {
              buyer.setRegisteredPassword(pw);
              buyer.setLsTm(now);
              this.srvOrm.updateEntity(pRqVs, buyer);
            } else {
              pRqDt.setAttribute("errMsg", "buyPwdRul");
            }
          } else {
            //logout action:
            buyer.setLsTm(0L);
            this.srvOrm.updateEntity(pRqVs, buyer);
          }
        } else { //either spam or buyer login from other browser without logout
          spam(pRqVs, pRqDt);
        }
      } else {
        //unauthorized requests:
        if (pw != null) {
          //login action:
          if (pw.equals(buyer.getRegisteredPassword())) {
            buyer.setLsTm(now);
            UUID buseid = UUID.randomUUID();
            buyer.setBuSeId(buseid.toString());
            pRqDt.setCookieValue("buSeId", buyer.getBuSeId());
            this.srvOrm.updateEntity(pRqVs, buyer);
          } else {
            pRqDt.setAttribute("errMsg", "wrong_password");
          }
        } else {
          spam(pRqVs, pRqDt);
        }
      }
    }
    String procNm = pRqDt.getParameter("nmPrcRed");
    IProcessor proc = this.procFac.lazyGet(pRqVs, procNm);
    proc.process(pRqVs, pRqDt);
  }
391177
public static xen_brvpx_image delete(nitro_service client, xen_brvpx_image resource) throws Exception
	{
		resource.validate("delete");
		return ((xen_brvpx_image[]) resource.delete_resource(client))[0];
	}
387918
@Indexable(type = IndexableType.DELETE)
	@Override
	public CommerceDiscountRule deleteCommerceDiscountRule(
		CommerceDiscountRule commerceDiscountRule) throws PortalException {
		return commerceDiscountRulePersistence.remove(commerceDiscountRule);
	}
232378
@Override
  public final void process(final Map<String, Object> pRqVs,
    final IRequestData pRqDt) throws Exception {
    if (!pRqDt.getReqUrl().toString().toLowerCase().startsWith("https")) {
      throw new Exception("http not supported!!!");
    }
    OnlineBuyer buyer = this.buySr.getAuthBuyr(pRqVs, pRqDt);
    if (buyer == null) {
      String procNm = pRqDt.getParameter("nmPrcRed");
      IProcessor proc = this.procFac.lazyGet(pRqVs, procNm);
      proc.process(pRqVs, pRqDt);
      return;
    }
    SettingsAdd setAdd = (SettingsAdd) pRqVs.get("setAdd");
    try {
      this.srvDb.setIsAutocommit(false);
      this.srvDb.setTransactionIsolation(setAdd.getBkTr());
      this.srvDb.beginTransaction();
      String tbn;
      Purch pur = this.acpOrd.accept(pRqVs, pRqDt, buyer);
      this.srvCart.emptyCart(pRqVs, buyer);
      if (pur.getOrds() != null && pur.getOrds().size() > 0) {
        //checking orders with online payment:
        tbn = CustOrderTxLn.class.getSimpleName();
        pRqVs.put(tbn + "itsOwnerdeepLevel", 1);
        for (CustOrder or : pur.getOrds()) { //TODO PERFORM to IAcpOrd
          if (or.getPayMeth().equals(EPaymentMethod.PAYPAL)
            || or.getPayMeth().equals(EPaymentMethod.PAYPAL_ANY)
              || or.getPayMeth().equals(EPaymentMethod.PARTIAL_ONLINE)
                || or.getPayMeth().equals(EPaymentMethod.ONLINE)) {
            throw new Exception("It must be offline payment!!");
          }
          if (or.getTotTx().compareTo(BigDecimal.ZERO) == 1) {
            List<CustOrderTxLn> tls = getSrvOrm().retrieveListWithConditions(
              pRqVs, CustOrderTxLn.class, "where ITSOWNER=" + or.getItsId());
            or.setTaxes(tls);
          }
        }
        pRqVs.remove(tbn + "itsOwnerdeepLevel");
      }
      if (pur.getSords() != null && pur.getSords().size() > 0) {
        //checking S.E. orders with online payment:
        tbn = CuOrSeTxLn.class.getSimpleName();
        pRqVs.put(tbn + "itsOwnerdeepLevel", 1);
        for (CuOrSe or : pur.getSords()) {
          if (or.getPayMeth().equals(EPaymentMethod.PAYPAL)
            || or.getPayMeth().equals(EPaymentMethod.PAYPAL_ANY)
              || or.getPayMeth().equals(EPaymentMethod.PARTIAL_ONLINE)
                || or.getPayMeth().equals(EPaymentMethod.ONLINE)) {
            throw new Exception("It must be offline payment!!");
          }
          if (or.getTotTx().compareTo(BigDecimal.ZERO) == 1) {
            List<CuOrSeTxLn> tls = getSrvOrm().retrieveListWithConditions(
              pRqVs, CuOrSeTxLn.class, "where ITSOWNER=" + or.getItsId());
            or.setTaxes(tls);
          }
          pRqVs.remove(tbn + "itsOwnerdeepLevel");
        }
      }
      pRqDt.setAttribute("pur",  pur);
      this.srvDb.commitTransaction();
    } catch (Exception ex) {
      if (!this.srvDb.getIsAutocommit()) {
        this.srvDb.rollBackTransaction();
      }
      throw ex;
    } finally {
      this.srvDb.releaseResources();
    }
  }
842875
@Override
	public com.liferay.commerce.model.CommerceOrder deleteCommerceOrder(
		com.liferay.commerce.model.CommerceOrder commerceOrder)
		throws com.liferay.portal.kernel.exception.PortalException {
		return _commerceOrderLocalService.deleteCommerceOrder(commerceOrder);
	}
686959
public static com.liferay.commerce.model.CommerceOrder deleteCommerceOrder(
		com.liferay.commerce.model.CommerceOrder commerceOrder)
		throws com.liferay.portal.kernel.exception.PortalException {
		return getService().deleteCommerceOrder(commerceOrder);
	}
871806
@Override
	public void removeByG_C_P(long groupId, long commerceCountryId,
		boolean primary) {
		for (CommerceWarehouse commerceWarehouse : findByG_C_P(groupId,
				commerceCountryId, primary, QueryUtil.ALL_POS,
				QueryUtil.ALL_POS, null)) {
			remove(commerceWarehouse);
		}
	}
507132
protected final PrcDelItemFromCart<RS> lazyGetPrcDelItemFromCart(
    final Map<String, Object> pAddParam) throws Exception {
    String beanName = PrcDelItemFromCart.class.getSimpleName();
    @SuppressWarnings("unchecked")
    PrcDelItemFromCart<RS> proc = (PrcDelItemFromCart<RS>)
      this.processorsMap.get(beanName);
    if (proc == null) {
      proc = new PrcDelItemFromCart<RS>();
      proc.setSrvOrm(getSrvOrm());
      proc.setSrvShoppingCart(getSrvShoppingCart());
      proc.setProcessorsFactory(this);
      //assigning fully initialized object:
      this.processorsMap.put(beanName, proc);
      this.logger.info(null, FctBnPublicTradeProcessors.class,
        beanName + " has been created.");
    }
    return proc;
  }
591213
public final Cart retrCart(final Map<String, Object> pRqVs,
    final OnlineBuyer pBuyr, final boolean pForEmpty) throws Exception {
    Cart cart = getSrvOrm().retrieveEntityById(pRqVs, Cart.class, pBuyr);
    if (cart != null) {
      Set<String> ndFlDe = null;
      Set<String> ndFlNm = null;
      Set<String> ndFlDc = null;
      if (!pForEmpty) {
        ndFlNm = new HashSet<String>();
        ndFlNm.add("itsId");
        ndFlNm.add("itsName");
        ndFlDc = new HashSet<String>();
        ndFlDc.add("seller");
        pRqVs.put("UnitOfMeasureneededFields", ndFlNm);
        pRqVs.put("DebtorCreditorneededFields", ndFlNm);
        pRqVs.put("SeSellerneededFields", ndFlDc);
        pRqVs.put("CartLntxCatdeepLevel", 1);
        pRqVs.put("CartLnseldeepLevel", 3);
        pRqVs.put("CartLnitsOwnerdeepLevel", 1);
      } else {
        ndFlDe = new HashSet<String>();
        ndFlDe.add("itsId");
        ndFlDe.add("itsVersion");
        pRqVs.put("CartLnneededFields", ndFlDe);
      }
      cart.setItems(getSrvOrm().retrieveListWithConditions(pRqVs,
        CartLn.class, "where ITSOWNER=" + cart.getBuyer().getItsId()));
      for (CartLn clt : cart.getItems()) {
        clt.setItsOwner(cart);
      }
      if (!pForEmpty) {
        pRqVs.remove("CartLnitsOwnerdeepLevel");
        pRqVs.remove("CartLntxCatdeepLevel");
        pRqVs.remove("CartLnseldeepLevel");
        pRqVs.remove("UnitOfMeasureneededFields");
        pRqVs.put("TaxneededFields", ndFlNm);
        pRqVs.put("CartTxLnseldeepLevel", 4);
        pRqVs.put("CartTxLnitsOwnerdeepLevel", 1);
      } else {
        pRqVs.remove("CartLnneededFields");
        pRqVs.put("CartTxLnneededFields", ndFlDe);
      }
      cart.setTaxes(getSrvOrm().retrieveListWithConditions(pRqVs,
        CartTxLn.class, "where ITSOWNER=" + cart.getBuyer().getItsId()));
      for (CartTxLn ctl : cart.getTaxes()) {
        ctl.setItsOwner(cart);
      }
      if (!pForEmpty) {
        pRqVs.remove("CartTxLnitsOwnerdeepLevel");
        pRqVs.remove("TaxneededFields");
        pRqVs.remove("CartTxLnseldeepLevel");
        pRqVs.put("CartTotseldeepLevel", 4);
        pRqVs.put("CartTotitsOwnerdeepLevel", 1);
      } else {
        pRqVs.remove("CartTxLnneededFields");
        pRqVs.put("CartTotneededFields", ndFlDe);
      }
      cart.setTotals(getSrvOrm().retrieveListWithConditions(pRqVs,
        CartTot.class, "where ITSOWNER=" + cart.getBuyer().getItsId()));
      for (CartTot cttl : cart.getTotals()) {
        cttl.setItsOwner(cart);
      }
      if (!pForEmpty) {
        pRqVs.remove("CartTotitsOwnerdeepLevel");
        pRqVs.remove("DebtorCreditorneededFields");
        pRqVs.remove("SeSellerneededFields");
        pRqVs.remove("CartTotseldeepLevel");
      } else {
        pRqVs.remove("CartTotneededFields");
      }
      cart.setBuyer(pBuyr);
    }
    return cart;
  }
1359515
public static void deleteQueueMapping(DbConn cnx, int id)
    {
        QueryResult qr = cnx.runUpdate("dp_delete_by_id", id);
        if (qr.nbUpdated != 1)
        {
            cnx.setRollbackOnly();
            throw new JqmAdminApiUserException("no item with ID " + id);
        }
    }
1164611
@Override
  public final TaxDestination revealTaxRules(final Map<String, Object> pRqVs,
    final Cart pCart, final AccSettings pAs) throws Exception {
    if (pCart.getBuyer().getRegCustomer() == null) {
      //copy buyer info into non-persistable customer.
      pCart.getBuyer().setRegCustomer(new DebtorCreditor());
      pCart.getBuyer().getRegCustomer()
        .setIsForeigner(pCart.getBuyer().getForeig());
      pCart.getBuyer().getRegCustomer()
        .setRegZip(pCart.getBuyer().getRegZip());
      pCart.getBuyer().getRegCustomer()
        .setTaxDestination(pCart.getBuyer().getTaxDest());
    }
    TaxDestination txRules = null;
    if (pAs.getIsExtractSalesTaxFromSales()
      && !pCart.getBuyer().getRegCustomer().getIsForeigner()) {
      if (pCart.getBuyer().getRegCustomer().getTaxDestination() != null) {
        //override tax method:
        txRules = pCart.getBuyer().getRegCustomer().getTaxDestination();
      } else {
        txRules = new TaxDestination();
        txRules.setSalTaxIsInvoiceBase(pAs.getSalTaxIsInvoiceBase());
        txRules.setSalTaxUseAggregItBas(pAs.getSalTaxUseAggregItBas());
        txRules.setSalTaxRoundMode(pAs.getSalTaxRoundMode());
      }
    }
    return txRules;
  }