Search in sources :

Example 6 with Plan

use of com.stripe.model.Plan in project stripe-java by stripe.

the class PlanTest method testPlanCreateWithProduct.

@Test
public void testPlanCreateWithProduct() throws StripeException {
    Plan plan = Plan.create(defaultPlanWithProductParams);
    assertEquals(plan.getInterval(), "month");
    assertEquals(plan.getIntervalCount(), (Integer) 2);
    assertEquals(plan.getNickname(), defaultPlanWithProductParams.get("nickname"));
    assertNotNull(plan.getProduct());
}
Also used : Plan(com.stripe.model.Plan) DeletedPlan(com.stripe.model.DeletedPlan) BaseStripeFunctionalTest(com.stripe.BaseStripeFunctionalTest) Test(org.junit.Test)

Example 7 with Plan

use of com.stripe.model.Plan in project stripe-java by stripe.

the class PlanTest method testPlanRetrieve.

@Test
public void testPlanRetrieve() throws StripeException {
    Plan createdPlan = Plan.create(getUniquePlanParams());
    Plan retrievedPlan = Plan.retrieve(createdPlan.getId());
    assertEquals(createdPlan.getId(), retrievedPlan.getId());
}
Also used : Plan(com.stripe.model.Plan) DeletedPlan(com.stripe.model.DeletedPlan) BaseStripeFunctionalTest(com.stripe.BaseStripeFunctionalTest) Test(org.junit.Test)

Example 8 with Plan

use of com.stripe.model.Plan in project stripe-java by stripe.

the class PlanTest method testCustomerCreateWithPlan.

@Test
public void testCustomerCreateWithPlan() throws StripeException {
    Plan plan = Plan.create(getUniquePlanParams());
    Customer customer = createDefaultCustomerWithPlan(plan);
    assertEquals(customer.getSubscriptions().getData().get(0).getPlan().getId(), plan.getId());
}
Also used : Customer(com.stripe.model.Customer) Plan(com.stripe.model.Plan) DeletedPlan(com.stripe.model.DeletedPlan) BaseStripeFunctionalTest(com.stripe.BaseStripeFunctionalTest) Test(org.junit.Test)

Example 9 with Plan

use of com.stripe.model.Plan in project stripe-java by stripe.

the class PlanTest method testPlanDelete.

@Test
public void testPlanDelete() throws StripeException {
    Plan createdPlan = Plan.create(getUniquePlanParams());
    DeletedPlan deletedPlan = createdPlan.delete();
    assertTrue(deletedPlan.getDeleted());
    assertEquals(deletedPlan.getId(), createdPlan.getId());
}
Also used : DeletedPlan(com.stripe.model.DeletedPlan) Plan(com.stripe.model.Plan) DeletedPlan(com.stripe.model.DeletedPlan) BaseStripeFunctionalTest(com.stripe.BaseStripeFunctionalTest) Test(org.junit.Test)

Example 10 with Plan

use of com.stripe.model.Plan in project stripe-java by stripe.

the class PlanTest method testPlanCreate.

@Test
public void testPlanCreate() throws StripeException {
    Plan plan = Plan.create(getUniquePlanParams());
    assertEquals(plan.getInterval(), "month");
    assertEquals(plan.getIntervalCount(), (Integer) 2);
}
Also used : Plan(com.stripe.model.Plan) DeletedPlan(com.stripe.model.DeletedPlan) BaseStripeFunctionalTest(com.stripe.BaseStripeFunctionalTest) Test(org.junit.Test)

Aggregations

Plan (com.stripe.model.Plan)34 BaseStripeFunctionalTest (com.stripe.BaseStripeFunctionalTest)31 Test (org.junit.Test)31 HashMap (java.util.HashMap)21 Customer (com.stripe.model.Customer)16 DeletedPlan (com.stripe.model.DeletedPlan)14 Subscription (com.stripe.model.Subscription)11 Invoice (com.stripe.model.Invoice)5 CustomerSubscriptionCollection (com.stripe.model.CustomerSubscriptionCollection)2 DeletedCustomer (com.stripe.model.DeletedCustomer)1 DeletedInvoiceItem (com.stripe.model.DeletedInvoiceItem)1 InvoiceItem (com.stripe.model.InvoiceItem)1 InvoiceLineItemCollection (com.stripe.model.InvoiceLineItemCollection)1 PlanTier (com.stripe.model.PlanTier)1 PlanTransformUsage (com.stripe.model.PlanTransformUsage)1 SubscriptionCollection (com.stripe.model.SubscriptionCollection)1 SubscriptionItem (com.stripe.model.SubscriptionItem)1 UsageRecord (com.stripe.model.UsageRecord)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1