Package com.stripe.model

Examples of com.stripe.model.Customer.cancelSubscription()


  @Test
  public void testCancelSubscription() throws StripeException {
    Plan plan = Plan.create(getUniquePlanParams());
    Customer customer = createDefaultCustomerWithPlan(plan);
    assertEquals(customer.getSubscriptions().getData().get(0).getStatus(), "active");
    Subscription canceledSubscription = customer.cancelSubscription();
    assertEquals(canceledSubscription.getStatus(), "canceled");
  }

  @Test
  public void testCancelSubscriptionAtPeriodEnd() throws StripeException {
View Full Code Here


    Plan plan = Plan.create(getUniquePlanParams());
    Customer customer = createDefaultCustomerWithPlan(plan);
    assertEquals(customer.getSubscriptions().getData().get(0).getStatus(), "active");
    Map<String, Object> cancelParams = new HashMap<String, Object>();
    cancelParams.put("at_period_end", true);
    Subscription canceledSubscription = customer
        .cancelSubscription(cancelParams);
    assertEquals(canceledSubscription.getStatus(), "active");
    assertEquals(canceledSubscription.getCancelAtPeriodEnd(), true);
  }
View Full Code Here

  @Test
  public void testCancelSubscriptionPerCallAPIKey() throws StripeException {
    Plan plan = Plan.create(getUniquePlanParams(), Stripe.apiKey);
    Customer customer = createDefaultCustomerWithPlan(plan);
    assertEquals(customer.getSubscriptions().getData().get(0).getStatus(), "active");
    Subscription canceledSubscription = customer
        .cancelSubscription(Stripe.apiKey);
    assertEquals(canceledSubscription.getStatus(), "canceled");
  }

  @Test
View Full Code Here

    Plan plan = Plan.create(getUniquePlanParams(), Stripe.apiKey);
    Customer customer = createDefaultCustomerWithPlan(plan);
    assertEquals(customer.getSubscriptions().getData().get(0).getStatus(), "active");
    Map<String, Object> cancelParams = new HashMap<String, Object>();
    cancelParams.put("at_period_end", true);
    Subscription canceledSubscription = customer.cancelSubscription(
        cancelParams, Stripe.apiKey);
    assertEquals(canceledSubscription.getStatus(), "active");
    assertEquals(canceledSubscription.getCancelAtPeriodEnd(), true);
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.