use of com.stripe.model.ChargeRefundCollection in project stripe-java by stripe.
the class RefundTest method testChargeRefundUpdateApiKey.
@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");
Map<String, Object> updateParams = new HashMap<String, Object>();
updateParams.put("metadata", metadata);
refund = refund.update(updateParams, Stripe.apiKey);
assertEquals("bar", refund.getMetadata().get("foo"));
}
use of com.stripe.model.ChargeRefundCollection in project stripe-java by stripe.
the class RefundTest method testChargeRefund.
@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);
}
use of com.stripe.model.ChargeRefundCollection in project stripe-java by stripe.
the class RefundTest method testChargeRefundCreate.
@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());
}
Aggregations