Package com.stripe.model

Examples of com.stripe.model.Charge


    assertEquals(1, retrievedBalance.getAvailable().size());
  }

  @Test
  public void testChargeCreate() throws StripeException {
    Charge createdCharge = Charge.create(defaultChargeParams);
    assertFalse(createdCharge.getRefunded());
  }
View Full Code Here


    Map<String, Object> chargeWithStatementDescriptionParams = new HashMap<String, Object>();
    chargeWithStatementDescriptionParams.putAll(defaultChargeParams);
    chargeWithStatementDescriptionParams.put("description", "hahaha1234");
    chargeWithStatementDescriptionParams.put("statement_description", "Stripe");

    Charge createdCharge = Charge.create(chargeWithStatementDescriptionParams);
    assertEquals("Stripe", createdCharge.getStatementDescription());
  }
View Full Code Here

    assertEquals(retrieved.getSource(), first.getSource());
  }

  @Test
  public void testChargeRetrieve() throws StripeException {
    Charge createdCharge = Charge.create(defaultChargeParams);
    Charge retrievedCharge = Charge.retrieve(createdCharge.getId());
    assertEquals(createdCharge.getCreated(), retrievedCharge.getCreated());
    assertEquals(createdCharge.getId(), retrievedCharge.getId());
  }
View Full Code Here

    }
  }

  @Test
  public void testChargeRefund() throws StripeException {
    Charge createdCharge = Charge.create(defaultChargeParams);
    Charge refundedCharge = createdCharge.refund();
    assertTrue(refundedCharge.getRefunded());
    ChargeRefundCollection refunds = refundedCharge.getRefunds();
    assertTrue(refunds.getData() instanceof List);
    assertEquals(1, refunds.getData().size());
    assertTrue(refunds.getData().get(0) instanceof Refund);
  }
View Full Code Here

    assertTrue(refunds.getData().get(0) instanceof Refund);
  }

  @Test
  public void testChargeRefundUpdateApiKey() throws StripeException {
    Charge createdCharge = Charge.create(defaultChargeParams);
    ChargeRefundCollection refunds = createdCharge.refund().getRefunds();
    Refund refund = refunds.getData().get(0);

    Map<String, String> metadata = new HashMap<String, String>();
    metadata.put("foo", "bar");
View Full Code Here

    assertEquals("bar", refund.getMetadata().get("foo"));
  }

  @Test
  public void testChargeRefundCreate() throws StripeException {
    Charge ch = Charge.create(defaultChargeParams);
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("amount", 10);
    ChargeRefundCollection refunds = ch.getRefunds();
    Refund created = refunds.create(params);
    Refund retrieved = ch.getRefunds().retrieve(created.getId());
    assertEquals(created.getId(), retrieved.getId());
  }
View Full Code Here

    assertEquals(created.getId(), retrieved.getId());
  }

  @Test
  public void testChargeRefundCreateApiKey() throws StripeException {
    Charge ch = Charge.create(defaultChargeParams);
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("amount", 10);
    Refund created = ch.getRefunds().create(params, Stripe.apiKey);
    Refund retrieved = ch.getRefunds().retrieve(created.getId(), Stripe.apiKey);
    assertEquals(created.getId(), retrieved.getId());
  }
View Full Code Here

  }

  @Test
  public void testChargeRefundListAndRetrieve()
      throws StripeException {
    Charge ch = Charge.create(defaultChargeParams);
    ch = ch.refund();
    Map<String, Object> listParams = new HashMap<String, Object>();
    listParams.put("count", 1);
    Refund created = ch.getRefunds().all(listParams).getData().get(0);
    Refund retrieved = ch.getRefunds().retrieve(created.getId());
    assertEquals(created.getId(), retrieved.getId());
  }
View Full Code Here


  @Test
  public void testChargeRefundListAndRetrievePerCallAPIKey()
      throws StripeException {
    Charge ch = Charge.create(defaultChargeParams);
    ch = ch.refund();
    Map<String, Object> listParams = new HashMap<String, Object>();
    listParams.put("count", 1);
    Refund created = ch.getRefunds().all(listParams,
        Stripe.apiKey).getData().get(0);
    Refund retrieved = ch.getRefunds().retrieve(created.getId(), Stripe.apiKey);
    assertEquals(created.getId(), retrieved.getId());
  }
View Full Code Here

  @Test
  public void testChargeCapture() throws StripeException {
    Map<String, Object> options = new HashMap<String, Object>(defaultChargeParams);
    options.put("capture", false);

    Charge created = Charge.create(options);
    assertFalse(created.getCaptured());

    Charge captured = created.capture();
    assertTrue(captured.getCaptured());
  }
View Full Code Here

TOP

Related Classes of com.stripe.model.Charge

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.