Search in sources :

Example 1 with SubscriptionItemCollection

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

the class SubscriptionItemTest method testSubscriptionItemList.

@Test
public void testSubscriptionItemList() throws StripeException {
    Customer customer = Customer.create(defaultCustomerParams);
    Subscription subscription = createDefaultSubscription(customer);
    createDefaultSubscriptionItem(subscription);
    Map<String, Object> listParams = new HashMap<String, Object>();
    listParams.put("subscription", subscription.getId());
    SubscriptionItemCollection subscriptionItems = SubscriptionItem.list(listParams);
    List<SubscriptionItem> subscriptionItemsData = subscriptionItems.getData();
    assertEquals(subscriptionItemsData.size(), 2);
}
Also used : DeletedSubscriptionItem(com.stripe.model.DeletedSubscriptionItem) SubscriptionItem(com.stripe.model.SubscriptionItem) Customer(com.stripe.model.Customer) HashMap(java.util.HashMap) Subscription(com.stripe.model.Subscription) SubscriptionItemCollection(com.stripe.model.SubscriptionItemCollection) BaseStripeFunctionalTest(com.stripe.BaseStripeFunctionalTest) Test(org.junit.Test)

Aggregations

BaseStripeFunctionalTest (com.stripe.BaseStripeFunctionalTest)1 Customer (com.stripe.model.Customer)1 DeletedSubscriptionItem (com.stripe.model.DeletedSubscriptionItem)1 Subscription (com.stripe.model.Subscription)1 SubscriptionItem (com.stripe.model.SubscriptionItem)1 SubscriptionItemCollection (com.stripe.model.SubscriptionItemCollection)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1