コード例 #1
0
ファイル: OrderLineWS.java プロジェクト: Rahman14354/billing
  @Override
  public String toString() {

    return "OrderLineWS{"
        + "id="
        + id
        + ", amount='"
        + amount
        + '\''
        + ", quantity='"
        + quantity
        + '\''
        + ", price='"
        + price
        + '\''
        + ", deleted="
        + deleted
        + ", description='"
        + description
        + '\''
        + ", useItem="
        + useItem
        + ", isPercentage="
        + isPercentage
        + ", itemId="
        + itemId
        + ", typeId="
        + typeId
        + ", parentLineId="
        + (parentLine != null ? parentLine.getId() : null)
        + ", metaFields="
        + ((metaFields == null) ? "null" : Arrays.asList(metaFields))
        + '}';
  }
コード例 #2
0
ファイル: WSTest.java プロジェクト: Rahman14354/billing
  public OrderWS buildOrder(int userId, List<Integer> itemIds, BigDecimal linePrice) {
    OrderWS order = new OrderWS();
    order.setUserId(userId);
    order.setBillingTypeId(Constants.ORDER_BILLING_POST_PAID);
    order.setPeriod(ORDER_PERIOD_ONCE); // once
    order.setCurrencyId(CURRENCY_USD);
    order.setActiveSince(new Date());
    order.setProrateFlag(Boolean.FALSE);

    ArrayList<OrderLineWS> lines = new ArrayList<OrderLineWS>(itemIds.size());
    for (int i = 0; i < itemIds.size(); i++) {
      OrderLineWS nextLine = new OrderLineWS();
      nextLine.setTypeId(Constants.ORDER_LINE_TYPE_ITEM);
      nextLine.setDescription("Order line: " + i);
      nextLine.setItemId(itemIds.get(i));
      nextLine.setQuantity(1);
      nextLine.setPrice(linePrice);
      nextLine.setAmount(nextLine.getQuantityAsDecimal().multiply(linePrice));

      lines.add(nextLine);
    }
    order.setOrderLines(lines.toArray(new OrderLineWS[lines.size()]));
    return order;
  }