Search in sources :

Example 1 with BalanceTransactionCollection

use of com.stripe.model.BalanceTransactionCollection in project stripe-java by stripe.

the class BalanceTransactionTest method testBalanceTransactionRetrieval.

@Test
public void testBalanceTransactionRetrieval() throws StripeException {
    Charge.create(defaultChargeParams);
    BalanceTransactionCollection balanceTransactions = BalanceTransaction.all(null);
    assertFalse(balanceTransactions.getData().isEmpty());
    BalanceTransaction first = balanceTransactions.getData().get(0);
    assertNotNull(first.getStatus());
    HashMap<String, Object> fetchParams = new HashMap<String, Object>();
    fetchParams.put("count", 2);
    assertEquals(BalanceTransaction.all(fetchParams).getData().size(), 2);
    BalanceTransaction retrieved = BalanceTransaction.retrieve(first.getId());
    assertEquals(retrieved.getId(), first.getId());
    assertEquals(retrieved.getSource(), first.getSource());
}
Also used : BalanceTransactionCollection(com.stripe.model.BalanceTransactionCollection) HashMap(java.util.HashMap) BalanceTransaction(com.stripe.model.BalanceTransaction) BaseStripeFunctionalTest(com.stripe.BaseStripeFunctionalTest) Test(org.junit.Test)

Example 2 with BalanceTransactionCollection

use of com.stripe.model.BalanceTransactionCollection in project stripe-java by stripe.

the class BalanceTransactionTest method testList.

@Test
public void testList() throws StripeException {
    final Map<String, Object> params = new HashMap<>();
    params.put("limit", 1);
    final BalanceTransactionCollection balanceTransactions = BalanceTransaction.list(params);
    assertNotNull(balanceTransactions);
    verifyRequest(ApiResource.RequestMethod.GET, String.format("/v1/balance_transactions"), params);
}
Also used : BalanceTransactionCollection(com.stripe.model.BalanceTransactionCollection) HashMap(java.util.HashMap) Test(org.junit.jupiter.api.Test) BaseStripeTest(com.stripe.BaseStripeTest)

Aggregations

BalanceTransactionCollection (com.stripe.model.BalanceTransactionCollection)2 HashMap (java.util.HashMap)2 BaseStripeFunctionalTest (com.stripe.BaseStripeFunctionalTest)1 BaseStripeTest (com.stripe.BaseStripeTest)1 BalanceTransaction (com.stripe.model.BalanceTransaction)1 Test (org.junit.Test)1 Test (org.junit.jupiter.api.Test)1