/** * Tries to create payment against review invoice. Here, instead of using the billing process to * generate a review invoice we are creating a review invoice with the help of saveLegacyInvoice * call. */ @Test public void testPayReviewInvoice() { // creating new user UserWS user = buildUser(PRANCING_PONY_ACCOUNT_TYPE); user.setId(api.createUser(user)); ItemTypeWS itemType = buildItemType(); itemType.setId(api.createItemCategory(itemType)); ItemDTOEx item = buildItem(itemType.getId(), api.getCallerCompanyId()); item.setId(api.createItem(item)); InvoiceWS invoice = buildInvoice(user.getId(), item.getId()); invoice.setIsReview(Integer.valueOf(1)); invoice.setId(api.saveLegacyInvoice(invoice)); // check if invoice is a review invoice System.out.println("Invoice is review : " + invoice.getIsReview()); assertEquals("Invoice is a review invoice", Integer.valueOf(1), invoice.getIsReview()); try { // pay for a review invoice api.payInvoice(invoice.getId()); fail("We should not be able to issue a payment against review invoice"); } catch (SessionInternalError e) { System.out.println(e.getMessage()); } // clean up api.deleteInvoice(invoice.getId()); api.deleteItem(item.getId()); api.deleteItemCategory(itemType.getId()); api.deleteUser(user.getId()); }