Package com.stripe.model

Examples of com.stripe.model.Customer


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

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


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

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

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

  @Test
  public void testInvoiceItemUpdate() throws StripeException {
    Customer customer = Customer.create(defaultCustomerParams);
    InvoiceItem createdInvoiceItem = createDefaultInvoiceItem(customer);
    Map<String, Object> updateParams = new HashMap<String, Object>();
    updateParams.put("description", "Updated Description");
    updateParams.put("amount", 200);
    InvoiceItem updatedInvoiceItem = createdInvoiceItem
View Full Code Here

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

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

  }

  @Test
  public void testInvoiceRetrieveForCustomer() throws StripeException {
    Plan plan = Plan.create(getUniquePlanParams());
    Customer customer = createDefaultCustomerWithPlan(plan);
    Map<String, Object> listParams = new HashMap<String, Object>();
    listParams.put("customer", customer.getId());
    listParams.put("count", 1);
    Invoice invoice = Invoice.all(listParams).getData().get(0);
    assertEquals(invoice.getCustomer(), customer.getId());
  }
View Full Code Here

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

  @Test
  public void testUpcomingInvoice() throws Exception {
    Customer customer = Customer.create(defaultCustomerParams);
    createDefaultInvoiceItem(customer);
    Map<String, Object> upcomingParams = new HashMap<String, Object>();
    upcomingParams.put("customer", customer.getId());
    Invoice upcomingInvoice = Invoice.upcoming(upcomingParams);
    assertFalse(upcomingInvoice.getAttempted());
  }
View Full Code Here

    assertFalse(upcomingInvoice.getAttempted());
  }

  @Test
  public void testUpcomingInvoiceLines() throws Exception {
    Customer customer = Customer.create(defaultCustomerParams);
    InvoiceItem item = createDefaultInvoiceItem(customer);
    Map<String, Object> upcomingParams = new HashMap<String, Object>();
    upcomingParams.put("customer", customer.getId());
    Invoice upcomingInvoice = Invoice.upcoming(upcomingParams);
    assertFalse(upcomingInvoice.getAttempted());

    InvoiceLineItemCollection lines = upcomingInvoice.getLines().all(null);
    assertFalse(lines.getData().isEmpty());
View Full Code Here

  @Test
  public void testCustomerCreateWithCoupon() throws StripeException {
    Coupon coupon = Coupon.create(getUniqueCouponParams());
    Map<String, Object> customerWithCouponParams = new HashMap<String, Object>();
    customerWithCouponParams.put("coupon", coupon.getId());
    Customer customer = Customer.create(customerWithCouponParams);
    assertEquals(customer.getDiscount().getCoupon().getId(), coupon.getId());

    customer.deleteDiscount();
    assertNull(Customer.retrieve(customer.getId()).getDiscount());
  }
View Full Code Here

    Charge.create(invalidChargeParams, Stripe.apiKey);
  }

  @Test
  public void testCustomerCreatePerCallAPIKey() throws StripeException {
    Customer customer = Customer.create(defaultCustomerParams,
        Stripe.apiKey);
    assertEquals(customer.getDescription(), "J Bindings Customer");
    List<Card> customerCards = customer.getCards().getData();
    assertEquals(1, customerCards.size());
    assertEquals("4242", customerCards.get(0).getLast4());
  }
View Full Code Here

    assertEquals("4242", customerCards.get(0).getLast4());
  }

  @Test
  public void testCustomerRetrievePerCallAPIKey() throws StripeException {
    Customer createdCustomer = Customer.create(defaultCustomerParams,
        Stripe.apiKey);
    Customer retrievedCustomer = Customer.retrieve(createdCustomer.getId());
    assertEquals(createdCustomer.getCreated(),
        retrievedCustomer.getCreated());
    assertEquals(createdCustomer.getId(), retrievedCustomer.getId());
  }
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.