Package com.stripe.model

Examples of com.stripe.model.Customer


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

  @Test
  public void testCustomerUpdatePerCallAPIKey() throws StripeException {
    Customer createdCustomer = Customer.create(defaultCustomerParams,
        Stripe.apiKey);
    Map<String, Object> updateParams = new HashMap<String, Object>();
    updateParams.put("description", "Updated Description");
    Customer updatedCustomer = createdCustomer.update(updateParams,
        Stripe.apiKey);
    assertEquals(updatedCustomer.getDescription(), "Updated Description");
  }
View Full Code Here


    assertEquals(updatedCustomer.getDescription(), "Updated Description");
  }

  @Test
  public void testCustomerDeletePerCallAPIKey() throws StripeException {
    Customer createdCustomer = Customer.create(defaultCustomerParams,
        Stripe.apiKey);
    DeletedCustomer deletedCustomer = createdCustomer.delete(Stripe.apiKey);
    Customer deletedRetrievedCustomer = Customer.retrieve(
        createdCustomer.getId(), Stripe.apiKey);
    assertTrue(deletedCustomer.getDeleted());
    assertEquals(deletedCustomer.getId(), createdCustomer.getId());
    assertTrue(deletedRetrievedCustomer.getDeleted());
  }
View Full Code Here

  @Test
  public void testCustomerCreateWithPlanPerCallAPIKey()
      throws StripeException {
    Plan plan = Plan.create(getUniquePlanParams(), Stripe.apiKey);
    Customer customer = createDefaultCustomerWithPlan(plan);
    assertEquals(customer.getSubscriptions().getData().get(0).getPlan().getId(), plan.getId());
  }
View Full Code Here

  }

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

  @Test
  public void testCancelSubscriptionAtPeriodEndPerCallAPIKey()
      throws StripeException {
    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

    assertEquals(canceledSubscription.getCancelAtPeriodEnd(), true);
  }

  @Test
  public void testInvoiceItemCreatePerCallAPIKey() throws StripeException {
    Customer customer = Customer.create(defaultCustomerParams,
        Stripe.apiKey);
    InvoiceItem invoiceItem = createDefaultInvoiceItem(customer);
    assertTrue(invoiceItem.getAmount() == 100);
  }
View Full Code Here

    assertTrue(invoiceItem.getAmount() == 100);
  }

  @Test
  public void testInvoiceItemRetrievePerCallAPIKey() throws StripeException {
    Customer customer = Customer.create(defaultCustomerParams,
        Stripe.apiKey);
    InvoiceItem createdInvoiceItem = createDefaultInvoiceItem(customer);
    InvoiceItem retrievedInvoiceItem = InvoiceItem.retrieve(
        createdInvoiceItem.getId(), Stripe.apiKey);
    assertEquals(createdInvoiceItem.getId(), retrievedInvoiceItem.getId());
View Full Code Here

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

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

    assertEquals(updatedInvoiceItem.getDescription(), "Updated Description");
  }

  @Test
  public void testInvoiceItemDeletePerCallAPIKey() throws StripeException {
    Customer customer = Customer.create(defaultCustomerParams,
        Stripe.apiKey);
    InvoiceItem createdInvoiceItem = createDefaultInvoiceItem(customer);
    DeletedInvoiceItem deletedInvoiceItem = createdInvoiceItem
        .delete(Stripe.apiKey);
    assertTrue(deletedInvoiceItem.getDeleted());
View Full Code Here

TOP

Related Classes of com.stripe.model.Customer

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.