use of com.stripe.model.InvoiceItem in project stripe-java by stripe.
the class InvoiceTest method testSendInvoice.
@Test
public void testSendInvoice() throws StripeException {
InvoiceItem invItem = InvoiceItem.create(getInvoiceItemParams());
Map<String, Object> params = new HashMap<String, Object>();
Long dueDate = (System.currentTimeMillis() / 1000) + 600;
params.put("customer", invItem.getCustomer());
params.put("billing", "send_invoice");
params.put("due_date", dueDate);
Invoice invoice = Invoice.create(params);
assertEquals("send_invoice", invoice.getBilling());
assertEquals(dueDate, invoice.getDueDate());
Map<String, Object> updateParams = new HashMap<String, Object>();
updateParams.put("paid", true);
Invoice updatedInvoice = invoice.update(updateParams);
assertTrue(updatedInvoice.getPaid());
}
use of com.stripe.model.InvoiceItem in project stripe-java by stripe.
the class InvoiceTest method testInvoiceItemDelete.
@Test
public void testInvoiceItemDelete() throws StripeException {
Customer customer = Customer.create(defaultCustomerParams);
InvoiceItem createdInvoiceItem = createDefaultInvoiceItem(customer);
DeletedInvoiceItem deletedInvoiceItem = createdInvoiceItem.delete();
assertTrue(deletedInvoiceItem.getDeleted());
assertEquals(deletedInvoiceItem.getId(), createdInvoiceItem.getId());
}
Aggregations