@Test public void setParamsTest() { cart.setCartId("76") .Products().add("pdtid") .setCategory1("cat") .setCategory2("chap1") .setQuantity(2) .setUnitPriceTaxFree(6.0) .setDiscountTaxIncluded(4) .setDiscountTaxFree(4) .setPromotionalCode("promo") .setUnitPriceTaxIncluded(7.0); cart.setParams(); assertEquals(8, buffer.getVolatileParams().size()); assertEquals(1, buffer.getVolatileParams().get("idcart").getValues().size()); assertEquals("76", buffer.getVolatileParams().get("idcart").getValues().get(0).execute()); assertEquals(1, buffer.getVolatileParams().get("pdt1").getValues().size()); assertEquals("cat::chap1::pdtid", buffer.getVolatileParams().get("pdt1").getValues().get(0).execute()); assertEquals(1, buffer.getVolatileParams().get("qte1").getValues().size()); assertEquals("2", buffer.getVolatileParams().get("qte1").getValues().get(0).execute()); assertEquals(1, buffer.getVolatileParams().get("mtht1").getValues().size()); assertEquals("6.0", buffer.getVolatileParams().get("mtht1").getValues().get(0).execute()); assertEquals(1, buffer.getVolatileParams().get("mt1").getValues().size()); assertEquals("7.0", buffer.getVolatileParams().get("mt1").getValues().get(0).execute()); assertEquals(1, buffer.getVolatileParams().get("dscht1").getValues().size()); assertEquals("4.0", buffer.getVolatileParams().get("dscht1").getValues().get(0).execute()); assertEquals(1, buffer.getVolatileParams().get("dsc1").getValues().size()); assertEquals("4.0", buffer.getVolatileParams().get("dsc1").getValues().get(0).execute()); assertEquals(1, buffer.getVolatileParams().get("pcode1").getValues().size()); assertEquals("promo", buffer.getVolatileParams().get("pcode1").getValues().get(0).execute()); }
@Override void setParams() { tracker.setParam(Hit.HitParam.CartId.stringValue(), cartId); if (products != null && productsList != null) { ParamOption encoding = new ParamOption().setEncode(true); int length = productsList.size(); for (int i = 0; i < length; i++) { Product p = productsList.get(i); tracker.setParam("pdt" + (i + 1), p.buildProductName(), encoding); if (p.getQuantity() > -1) { tracker.setParam("qte" + (i + 1), p.getQuantity()); } if (p.getUnitPriceTaxFree() > -1) { tracker.setParam("mtht" + (i + 1), p.getUnitPriceTaxFree()); } if (p.getUnitPriceTaxIncluded() > -1) { tracker.setParam("mt" + (i + 1), p.getUnitPriceTaxIncluded()); } if (p.getDiscountTaxFree() > -1) { tracker.setParam("dscht" + (i + 1), p.getDiscountTaxFree()); } if (p.getDiscountTaxIncluded() > -1) { tracker.setParam("dsc" + (i + 1), p.getDiscountTaxIncluded()); } if (p.getPromotionalCode() != null) { tracker.setParam("pcode" + (i + 1), p.getPromotionalCode(), encoding); } } } }
Cart extends BusinessObject { @Override void setParams() { tracker.setParam(Hit.HitParam.CartId.stringValue(), cartId); if (products != null && productsList != null) { ParamOption encoding = new ParamOption().setEncode(true); int length = productsList.size(); for (int i = 0; i < length; i++) { Product p = productsList.get(i); tracker.setParam("pdt" + (i + 1), p.buildProductName(), encoding); if (p.getQuantity() > -1) { tracker.setParam("qte" + (i + 1), p.getQuantity()); } if (p.getUnitPriceTaxFree() > -1) { tracker.setParam("mtht" + (i + 1), p.getUnitPriceTaxFree()); } if (p.getUnitPriceTaxIncluded() > -1) { tracker.setParam("mt" + (i + 1), p.getUnitPriceTaxIncluded()); } if (p.getDiscountTaxFree() > -1) { tracker.setParam("dscht" + (i + 1), p.getDiscountTaxFree()); } if (p.getDiscountTaxIncluded() > -1) { tracker.setParam("dsc" + (i + 1), p.getDiscountTaxIncluded()); } if (p.getPromotionalCode() != null) { tracker.setParam("pcode" + (i + 1), p.getPromotionalCode(), encoding); } } } } }
Cart extends BusinessObject { @Override void setParams() { tracker.setParam(Hit.HitParam.CartId.stringValue(), cartId); if (products != null && productsList != null) { ParamOption encoding = new ParamOption().setEncode(true); int length = productsList.size(); for (int i = 0; i < length; i++) { Product p = productsList.get(i); tracker.setParam("pdt" + (i + 1), p.buildProductName(), encoding); if (p.getQuantity() > -1) { tracker.setParam("qte" + (i + 1), p.getQuantity()); } if (p.getUnitPriceTaxFree() > -1) { tracker.setParam("mtht" + (i + 1), p.getUnitPriceTaxFree()); } if (p.getUnitPriceTaxIncluded() > -1) { tracker.setParam("mt" + (i + 1), p.getUnitPriceTaxIncluded()); } if (p.getDiscountTaxFree() > -1) { tracker.setParam("dscht" + (i + 1), p.getDiscountTaxFree()); } if (p.getDiscountTaxIncluded() > -1) { tracker.setParam("dsc" + (i + 1), p.getDiscountTaxIncluded()); } if (p.getPromotionalCode() != null) { tracker.setParam("pcode" + (i + 1), p.getPromotionalCode(), encoding); } } } } Cart(Tracker tracker); }
Cart extends BusinessObject { @Override void setParams() { tracker.setParam(Hit.HitParam.CartId.stringValue(), cartId); if (products != null && productsList != null) { ParamOption encoding = new ParamOption().setEncode(true); int length = productsList.size(); for (int i = 0; i < length; i++) { Product p = productsList.get(i); tracker.setParam("pdt" + (i + 1), p.buildProductName(), encoding); if (p.getQuantity() > -1) { tracker.setParam("qte" + (i + 1), p.getQuantity()); } if (p.getUnitPriceTaxFree() > -1) { tracker.setParam("mtht" + (i + 1), p.getUnitPriceTaxFree()); } if (p.getUnitPriceTaxIncluded() > -1) { tracker.setParam("mt" + (i + 1), p.getUnitPriceTaxIncluded()); } if (p.getDiscountTaxFree() > -1) { tracker.setParam("dscht" + (i + 1), p.getDiscountTaxFree()); } if (p.getDiscountTaxIncluded() > -1) { tracker.setParam("dsc" + (i + 1), p.getDiscountTaxIncluded()); } if (p.getPromotionalCode() != null) { tracker.setParam("pcode" + (i + 1), p.getPromotionalCode(), encoding); } } } } Cart(Tracker tracker); Products Products(); String getCartId(); Cart setCartId(String cartId); Cart set(String cartId); Cart unset(); void send(); }
Cart extends BusinessObject { @Override void setParams() { tracker.setParam(Hit.HitParam.CartId.stringValue(), cartId); if (products != null && productsList != null) { ParamOption encoding = new ParamOption().setEncode(true); int length = productsList.size(); for (int i = 0; i < length; i++) { Product p = productsList.get(i); tracker.setParam("pdt" + (i + 1), p.buildProductName(), encoding); if (p.getQuantity() > -1) { tracker.setParam("qte" + (i + 1), p.getQuantity()); } if (p.getUnitPriceTaxFree() > -1) { tracker.setParam("mtht" + (i + 1), p.getUnitPriceTaxFree()); } if (p.getUnitPriceTaxIncluded() > -1) { tracker.setParam("mt" + (i + 1), p.getUnitPriceTaxIncluded()); } if (p.getDiscountTaxFree() > -1) { tracker.setParam("dscht" + (i + 1), p.getDiscountTaxFree()); } if (p.getDiscountTaxIncluded() > -1) { tracker.setParam("dsc" + (i + 1), p.getDiscountTaxIncluded()); } if (p.getPromotionalCode() != null) { tracker.setParam("pcode" + (i + 1), p.getPromotionalCode(), encoding); } } } } Cart(Tracker tracker); Products Products(); String getCartId(); Cart setCartId(String cartId); Cart set(String cartId); Cart unset(); void send();  }