use of com.stripe.model.Charge in project stripe-java by stripe.
the class ChargeTest method testChargeRetrieveWithBalanceTransaction.
@Test
public void testChargeRetrieveWithBalanceTransaction() throws StripeException {
Charge createdCharge = Charge.create(defaultChargeParams);
Map<String, Object> retrieveParams = new HashMap<String, Object>();
retrieveParams.put("expand[]", "balance_transaction");
Charge retrievedCharge = Charge.retrieve(createdCharge.getId(), retrieveParams, supportedRequestOptions);
// Check basics
assertEquals(retrievedCharge.getCreated(), retrievedCharge.getCreated());
assertEquals(retrievedCharge.getId(), retrievedCharge.getId());
// Check expanded BT
assertEquals(retrievedCharge.getBalanceTransactionObject().getId(), createdCharge.getBalanceTransaction());
}
use of com.stripe.model.Charge in project stripe-java by stripe.
the class ChargeTest method testChargeExpandBalanceTransaction.
@Test
public void testChargeExpandBalanceTransaction() throws StripeException {
Map<String, Object> createParams = defaultChargeParams;
createParams.put("expand[]", "balance_transaction");
Charge createdCharge = Charge.create(createParams);
assertEquals(createdCharge.getBalanceTransactionObject().getId(), createdCharge.getBalanceTransaction());
Map<String, Object> retrieveParams = new HashMap<String, Object>();
retrieveParams.put("expand[]", "balance_transaction");
Charge retrievedCharge = Charge.retrieve(createdCharge.getId(), retrieveParams, null);
assertEquals(retrievedCharge.getBalanceTransactionObject().getId(), retrievedCharge.getBalanceTransaction());
}
use of com.stripe.model.Charge in project stripe-java by stripe.
the class ChargeTest method testChargeRefundPerCallAPIKey.
@Test
public void testChargeRefundPerCallAPIKey() throws StripeException {
Charge createdCharge = Charge.create(defaultChargeParams, Stripe.apiKey);
Charge refundedCharge = createdCharge.refund(Stripe.apiKey);
assertTrue(refundedCharge.getRefunded());
}
use of com.stripe.model.Charge in project stripe-java by stripe.
the class ChargeTest method testChargeCreatePerCallAPIKey.
@Test
public void testChargeCreatePerCallAPIKey() throws StripeException {
Charge createdCharge = Charge.create(defaultChargeParams, Stripe.apiKey);
assertFalse(createdCharge.getRefunded());
}
use of com.stripe.model.Charge in project stripe-java by stripe.
the class ChargeTest method testChargeRetrievePerCallAPIKey.
@Test
public void testChargeRetrievePerCallAPIKey() throws StripeException {
Charge createdCharge = Charge.create(defaultChargeParams, Stripe.apiKey);
Charge retrievedCharge = Charge.retrieve(createdCharge.getId(), Stripe.apiKey);
assertEquals(createdCharge.getCreated(), retrievedCharge.getCreated());
assertEquals(createdCharge.getId(), retrievedCharge.getId());
}
Aggregations