Пример #1
0
  private InvoiceWS buildInvoice(Integer userId, Integer itemId) {
    InvoiceWS invoice = new InvoiceWS();
    invoice.setUserId(userId);
    invoice.setNumber("800" + System.currentTimeMillis());
    invoice.setTotal("15");
    invoice.setToProcess(1);
    invoice.setBalance("15");
    invoice.setCurrencyId(CURRENCY_USD);
    invoice.setDueDate(new Date());
    invoice.setPaymentAttempts(1);
    invoice.setInProcessPayment(1);
    invoice.setCarriedBalance("0");

    InvoiceLineDTO invoiceLineDTO = new InvoiceLineDTO();
    invoiceLineDTO.setAmount("15");
    invoiceLineDTO.setDescription("line desc");
    invoiceLineDTO.setItemId(itemId);
    invoiceLineDTO.setPercentage(1);
    invoiceLineDTO.setPrice("15");
    invoiceLineDTO.setQuantity("1");
    invoiceLineDTO.setSourceUserId(userId);

    invoice.setInvoiceLines(new InvoiceLineDTO[] {invoiceLineDTO});
    return invoice;
  }
Пример #2
0
 private ItemTypeWS buildItemType() {
   ItemTypeWS type = new ItemTypeWS();
   type.setDescription("Invoice, Item Type:" + System.currentTimeMillis());
   type.setOrderLineTypeId(1); // items
   type.setAllowAssetManagement(0); // does not manage assets
   type.setOnePerCustomer(false);
   type.setOnePerOrder(false);
   return type;
 }
Пример #3
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;
 }
Пример #4
0
 private Integer getOrCreateOrderChangeStatusApply(JbillingAPI api) {
   OrderChangeStatusWS[] statuses = api.getOrderChangeStatusesForCompany();
   for (OrderChangeStatusWS status : statuses) {
     if (status.getApplyToOrder().equals(ApplyToOrder.YES)) {
       return status.getId();
     }
   }
   // there is no APPLY status in db so create one
   OrderChangeStatusWS apply = new OrderChangeStatusWS();
   String status1Name = "APPLY: " + System.currentTimeMillis();
   OrderChangeStatusWS status1 = new OrderChangeStatusWS();
   status1.setApplyToOrder(ApplyToOrder.YES);
   status1.setDeleted(0);
   status1.setOrder(1);
   status1.addDescription(
       new InternationalDescriptionWS(Constants.LANGUAGE_ENGLISH_ID, status1Name));
   return api.createOrderChangeStatus(apply);
 }