Package com.stripe.model

Examples of com.stripe.model.Plan


        this.emailSender = emailSender;
    }

    @Override
    public OrderConfirmation processOrder(Order order) throws StripeException {
        Plan plan = planCreator.createPlan(order);

        Customer customer = customerCreator.createCustormer(plan, order);

        String confirmationNumber = confirmationNumberGenerator.generateConfirmationNumber(customer);
View Full Code Here


    Recipient recipient = Recipient.create(recipientParams);
    return recipient;
  }

  static Map<String, Object> getSubscriptionParams() throws StripeException {
    Plan plan = Plan.create(getUniquePlanParams());
    Map<String, Object> subscriptionParams = new HashMap<String, Object>();
    subscriptionParams.put("plan", plan.getId());
    return subscriptionParams;
  }
View Full Code Here

    assertTrue(deletedRetrievedCustomer.getDeleted());
  }

  @Test
  public void testPlanCreate() throws StripeException {
    Plan plan = Plan.create(getUniquePlanParams());
    assertEquals(plan.getInterval(), "month");
    assertEquals(plan.getIntervalCount(), (Integer) 2);
  }
View Full Code Here

  @Test
  public void testPlanCreateWithStatementDescription() throws StripeException {
    Map<String, Object> planParamsWithStatementDescription = getUniquePlanParams();
    planParamsWithStatementDescription.put("statement_description", "Stripe");
    Plan plan = Plan.create(planParamsWithStatementDescription);
    assertEquals(plan.getStatementDescription(), "Stripe");
  }
View Full Code Here

    assertEquals(plan.getStatementDescription(), "Stripe");
  }

  @Test
  public void testPlanUpdate() throws StripeException {
    Plan createdPlan = Plan.create(getUniquePlanParams());
    Map<String, Object> updateParams = new HashMap<String, Object>();
    updateParams.put("name", "Updated Plan Name");
    Plan updatedplan = createdPlan.update(updateParams);
    assertEquals(updatedplan.getName(), "Updated Plan Name");
  }
View Full Code Here

    assertEquals(updatedplan.getName(), "Updated Plan Name");
  }

  @Test
  public void testPlanRetrieve() throws StripeException {
    Plan createdPlan = Plan.create(getUniquePlanParams());
    Plan retrievedPlan = Plan.retrieve(createdPlan.getId());
    assertEquals(createdPlan.getId(), retrievedPlan.getId());
  }
View Full Code Here

    assertEquals(Plans.size(), 1);
  }

  @Test
  public void testPlanDelete() throws StripeException {
    Plan createdPlan = Plan.create(getUniquePlanParams());
    DeletedPlan deletedPlan = createdPlan.delete();
    assertTrue(deletedPlan.getDeleted());
    assertEquals(deletedPlan.getId(), createdPlan.getId());
  }
View Full Code Here

    assertEquals(deletedPlan.getId(), createdPlan.getId());
  }

  @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());
  }
View Full Code Here

    assertEquals(customer.getSubscriptions().getData().get(0).getPlan().getId(), plan.getId());
  }

  @Test
  public void testUpdateSubscription() throws StripeException {
    Plan plan = Plan.create(getUniquePlanParams());
    Customer customer = Customer.create(defaultCustomerParams);
    Map<String, Object> subscriptionParams = new HashMap<String, Object>();
    subscriptionParams.put("plan", plan.getId());
    Subscription sub = customer.updateSubscription(subscriptionParams);
    assertEquals(sub.getPlan().getId(), plan.getId());
    assertEquals(sub.getCustomer(), customer.getId());
  }
View Full Code Here

    assertEquals(sub.getCustomer(), customer.getId());
  }

  @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");
  }
View Full Code Here

TOP

Related Classes of com.stripe.model.Plan

Copyright © 2018 www.massapicom. 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.