Search in sources :

Example 16 with Customer

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");
}
Also used : InvoiceItem(com.stripe.model.InvoiceItem) DeletedInvoiceItem(com.stripe.model.DeletedInvoiceItem) Customer(com.stripe.model.Customer) HashMap(java.util.HashMap) BaseStripeFunctionalTest(com.stripe.BaseStripeFunctionalTest) Test(org.junit.Test)

Example 17 with Customer

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());
}
Also used : Invoice(com.stripe.model.Invoice) Customer(com.stripe.model.Customer) HashMap(java.util.HashMap) Plan(com.stripe.model.Plan) BaseStripeFunctionalTest(com.stripe.BaseStripeFunctionalTest) Test(org.junit.Test)

Example 18 with Customer

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;
}
Also used : HashMap(java.util.HashMap) Customer(com.stripe.model.Customer)

Example 19 with Customer

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);
}
Also used : InvoiceItem(com.stripe.model.InvoiceItem) DeletedInvoiceItem(com.stripe.model.DeletedInvoiceItem) Customer(com.stripe.model.Customer) BaseStripeFunctionalTest(com.stripe.BaseStripeFunctionalTest) Test(org.junit.Test)

Example 20 with Customer

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");
}
Also used : InvoiceItem(com.stripe.model.InvoiceItem) DeletedInvoiceItem(com.stripe.model.DeletedInvoiceItem) Customer(com.stripe.model.Customer) HashMap(java.util.HashMap) BaseStripeFunctionalTest(com.stripe.BaseStripeFunctionalTest) Test(org.junit.Test)

Aggregations

Customer (com.stripe.model.Customer)65 Test (org.junit.Test)63 BaseStripeFunctionalTest (com.stripe.BaseStripeFunctionalTest)60 HashMap (java.util.HashMap)40 DeletedCustomer (com.stripe.model.DeletedCustomer)24 ExternalAccount (com.stripe.model.ExternalAccount)16 Plan (com.stripe.model.Plan)16 Subscription (com.stripe.model.Subscription)15 DeletedExternalAccount (com.stripe.model.DeletedExternalAccount)13 DeletedInvoiceItem (com.stripe.model.DeletedInvoiceItem)10 InvoiceItem (com.stripe.model.InvoiceItem)10 Invoice (com.stripe.model.Invoice)7 Card (com.stripe.model.Card)6 DeletedSubscriptionItem (com.stripe.model.DeletedSubscriptionItem)5 SubscriptionItem (com.stripe.model.SubscriptionItem)5 BaseStripeTest (com.stripe.BaseStripeTest)3 BankAccount (com.stripe.model.BankAccount)3 DeletedBankAccount (com.stripe.model.DeletedBankAccount)3 ExternalAccountCollection (com.stripe.model.ExternalAccountCollection)3 Coupon (com.stripe.model.Coupon)2