use of com.stripe.model.BalanceTransaction in project stripe-java by stripe.
the class RefundTest method testChargeRefundListWithExpand.
@Test
public void testChargeRefundListWithExpand() throws StripeException {
Charge ch = Charge.create(defaultChargeParams);
ch = ch.refund();
List<String> expandList = new LinkedList<String>();
expandList.add("data.balance_transaction");
expandList.add("data.balance_transaction.source");
expandList.add("data.charge");
Map<String, Object> listParams = new HashMap<String, Object>();
listParams.put("charge", ch.getId());
listParams.put("count", 1);
listParams.put("expand", expandList);
Refund refund = Refund.list(listParams).getData().get(0);
Charge expCharge = refund.getChargeObject();
assertNotNull(expCharge);
assertEquals(ch.getId(), expCharge.getId());
BalanceTransaction expBT = refund.getBalanceTransactionObject();
assertNotNull(expBT);
Refund expRefundInBT = (Refund) expBT.getSourceObject();
assertEquals(refund.getId(), expRefundInBT.getId());
}
use of com.stripe.model.BalanceTransaction 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());
}
Aggregations