Package com.stripe.model

Examples of com.stripe.model.InvoiceItem


  @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


  @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);
    InvoiceItem updatedInvoiceItem = createdInvoiceItem.update(
        updateParams, Stripe.apiKey);
    assertTrue(updatedInvoiceItem.getAmount() == 200);
    assertEquals(updatedInvoiceItem.getDescription(), "Updated Description");
  }
View Full Code Here

  @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());
    assertEquals(deletedInvoiceItem.getId(), createdInvoiceItem.getId());
  }
View Full Code Here

    testMetadata(InvoiceItem.create(getInvoiceItemParams()));
  }

  @Test
  public void testInvoiceMetadata() throws StripeException {
    InvoiceItem invItem = InvoiceItem.create(getInvoiceItemParams());
    Map<String,Object> params = new HashMap<String,Object>();
    params.put("customer", invItem.getCustomer());
    testMetadata(Invoice.create(params));
  }
View Full Code Here

  }

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

  }

  @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

  }

  @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
        .update(updateParams);
    assertTrue(updatedInvoiceItem.getAmount() == 200);
    assertEquals(updatedInvoiceItem.getDescription(), "Updated Description");
  }
View Full Code Here

  }

  @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 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());
    assertEquals(item.getId(), lines.getData().get(0).getId());

    Map<String, Object> fetchParams = new HashMap<String, Object>();
    fetchParams.put("starting_after", item.getId());
    InvoiceLineItemCollection linesAfterFirst = upcomingInvoice.getLines().all(fetchParams);
    assertTrue(linesAfterFirst.getData().isEmpty());
  }
View Full Code Here

  @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

TOP

Related Classes of com.stripe.model.InvoiceItem

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.