Example #1
0
 private ItemDTOEx buildItem(Integer itemTypeId, Integer priceModelCompanyId) {
   ItemDTOEx item = new ItemDTOEx();
   long millis = System.currentTimeMillis();
   String name = String.valueOf(millis) + new Random().nextInt(10000);
   item.setDescription("Payment, Product:" + name);
   item.setPriceModelCompanyId(priceModelCompanyId);
   item.setPrice(new BigDecimal("10"));
   item.setNumber("PYM-PROD-" + name);
   item.setAssetManagementEnabled(0);
   Integer typeIds[] = new Integer[] {itemTypeId};
   item.setTypes(typeIds);
   return item;
 }
  public static ItemDTOEx createPercentageItem(
      Integer entityId,
      BigDecimal percentage,
      Integer currencyID,
      Integer itemType,
      String description) {
    ItemDTOEx item = new ItemDTOEx();
    item.setNumber(String.valueOf(new Date().getTime()));
    item.setEntityId(entityId);
    item.setDescription(
        "Percentage Item: " + description + ServerConstants.SINGLE_SPACE + new Date().getTime());
    item.setCurrencyId(currencyID);
    item.setTypes(new Integer[] {itemType});

    return item;
  }
 /**
  * To create a product without calling the createItem API.
  *
  * @param entityId
  * @param cost
  * @param currencyID
  * @param itemType
  * @return ItemDTOEx
  */
 public static ItemDTOEx createItem(
     Integer entityId,
     BigDecimal cost,
     Integer currencyID,
     Integer itemType,
     String description,
     Date startDate) {
   ItemDTOEx item = new ItemDTOEx();
   item.setNumber(String.valueOf(new Date().getTime()));
   item.setEntityId(entityId);
   item.setDescription(description + ServerConstants.SINGLE_SPACE + new Date().getTime());
   item.setCurrencyId(currencyID);
   item.setTypes(new Integer[] {itemType});
   item.setPrices(setItemPrice(cost, startDate, entityId, currencyID));
   return item;
 }