use of com.stripe.model.Customer in project stripe-java by stripe.
the class InvoiceTest method testInvoiceItemUpdatePerCallAPIKey.
@Test
public void testInvoiceItemUpdatePerCallAPIKey() throws StripeException {
Customer customer = Customer.create(defaultCustomerParams, Stripe.apiKey);
InvoiceItem createdInvoiceItem = createDefaultInvoiceItem(customer);
Map<String, Object> updateParams = new HashMap<String, Object>();
updateParams.put("description", "Updated Description");
updateParams.put("amount", 200);
InvoiceItem updatedInvoiceItem = createdInvoiceItem.update(updateParams, Stripe.apiKey);
assertTrue(updatedInvoiceItem.getAmount() == 200);
assertEquals(updatedInvoiceItem.getDescription(), "Updated Description");
}
use of com.stripe.model.Customer in project stripe-java by stripe.
the class InvoiceTest method testInvoiceRetrieveForCustomerPerCallAPIKey.
@Test
public void testInvoiceRetrieveForCustomerPerCallAPIKey() throws StripeException {
Plan plan = Plan.create(getUniquePlanParams(), Stripe.apiKey);
Customer customer = createDefaultCustomerWithPlan(plan);
Map<String, Object> listParams = new HashMap<String, Object>();
listParams.put("customer", customer.getId());
listParams.put("count", 1);
Invoice invoice = Invoice.all(listParams, Stripe.apiKey).getData().get(0);
assertEquals(invoice.getCustomer(), customer.getId());
}
use of com.stripe.model.Customer in project stripe-java by stripe.
the class InvoiceTest method getInvoiceItemParams.
static Map<String, Object> getInvoiceItemParams() throws StripeException {
Map<String, Object> params = new HashMap<String, Object>();
defaultCustomerParams.put("email", "test@stripe.com");
Customer customer = Customer.create(defaultCustomerParams);
params.put("amount", 100);
params.put("currency", "usd");
params.put("customer", customer.getId());
return params;
}
use of com.stripe.model.Customer in project stripe-java by stripe.
the class InvoiceTest method testInvoiceItemCreate.
// Invoice Tests:
@Test
public void testInvoiceItemCreate() throws StripeException {
Customer customer = Customer.create(defaultCustomerParams);
InvoiceItem invoiceItem = createDefaultInvoiceItem(customer);
assertTrue(invoiceItem.getAmount() == 100);
}
use of com.stripe.model.Customer in project stripe-java by stripe.
the class InvoiceTest method testInvoiceItemUpdate.
@Test
public void testInvoiceItemUpdate() throws StripeException {
Customer customer = Customer.create(defaultCustomerParams);
InvoiceItem createdInvoiceItem = createDefaultInvoiceItem(customer);
Map<String, Object> updateParams = new HashMap<String, Object>();
updateParams.put("description", "Updated Description");
updateParams.put("amount", 200);
InvoiceItem updatedInvoiceItem = createdInvoiceItem.update(updateParams);
assertTrue(updatedInvoiceItem.getAmount() == 200);
assertEquals(updatedInvoiceItem.getDescription(), "Updated Description");
}
Aggregations