use of com.stripe.model.InvoiceItem in project stripe-java by stripe.
the class InvoiceTest method testInvoiceItemDeletePerCallAPIKey.
@Test
public void testInvoiceItemDeletePerCallAPIKey() throws StripeException {
Customer customer = Customer.create(defaultCustomerParams, Stripe.apiKey);
InvoiceItem createdInvoiceItem = createDefaultInvoiceItem(customer);
DeletedInvoiceItem deletedInvoiceItem = createdInvoiceItem.delete(Stripe.apiKey);
assertTrue(deletedInvoiceItem.getDeleted());
assertEquals(deletedInvoiceItem.getId(), createdInvoiceItem.getId());
}
use of com.stripe.model.InvoiceItem in project stripe-java by stripe.
the class InvoiceTest method testInvoiceItemCreatePerCallAPIKey.
@Test
public void testInvoiceItemCreatePerCallAPIKey() throws StripeException {
Customer customer = Customer.create(defaultCustomerParams, Stripe.apiKey);
InvoiceItem invoiceItem = createDefaultInvoiceItem(customer);
assertTrue(invoiceItem.getAmount() == 100);
}
use of com.stripe.model.InvoiceItem in project stripe-java by stripe.
the class InvoiceTest method testInvoiceItemRetrieve.
@Test
public void testInvoiceItemRetrieve() throws StripeException {
Customer customer = Customer.create(defaultCustomerParams);
InvoiceItem createdInvoiceItem = createDefaultInvoiceItem(customer);
InvoiceItem retrievedInvoiceItem = InvoiceItem.retrieve(createdInvoiceItem.getId());
assertEquals(createdInvoiceItem.getId(), retrievedInvoiceItem.getId());
}
use of com.stripe.model.InvoiceItem in project stripe-java by stripe.
the class InvoiceTest method testInvoiceMetadata.
@Test
public void testInvoiceMetadata() throws StripeException {
InvoiceItem invItem = InvoiceItem.create(getInvoiceItemParams());
Map<String, Object> params = new HashMap<String, Object>();
params.put("customer", invItem.getCustomer());
testMetadata(Invoice.create(params));
}
use of com.stripe.model.InvoiceItem in project stripe-java by stripe.
the class InvoiceTest method testInvoiceCreate.
@Test
public void testInvoiceCreate() throws StripeException {
Plan plan = Plan.create(getUniquePlanParams());
Customer customer = createDefaultCustomerWithPlan(plan);
Map<String, Object> invoiceItem = ImmutableMap.<String, Object>builder().put("customer", customer.getId()).put("amount", 100).put("currency", "usd").put("description", "my item").build();
InvoiceItem createdItem = InvoiceItem.create(invoiceItem);
assertEquals("my item", createdItem.getDescription());
Invoice invoice = Invoice.create(ImmutableMap.<String, Object>builder().put("description", "my invoice").put("customer", customer.getId()).build());
assertEquals("my invoice", invoice.getDescription());
}
Aggregations