Skip to content

Commit d2bc383

Browse files
committed
Fix return type of CustomerCardCollection.retrieve, add a test
1 parent 6ffe744 commit d2bc383

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/main/java/com/stripe/model/CustomerCardCollection.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@ public CustomerCardCollection all(Map<String, Object> params,
4343
CustomerCardCollection.class, apiKey);
4444
}
4545

46-
public CustomerCardCollection retrieve(String id)
46+
public Card retrieve(String id)
4747
throws AuthenticationException, InvalidRequestException,
4848
APIConnectionException, CardException, APIException {
4949
return retrieve(id, null);
5050
}
5151

52-
public CustomerCardCollection retrieve(String id, String apiKey) throws AuthenticationException,
52+
public Card retrieve(String id, String apiKey) throws AuthenticationException,
5353
InvalidRequestException, APIConnectionException, CardException,
5454
APIException {
5555
// TODO: URL-encode!
5656
String url = String.format("%s%s/%s", Stripe.API_BASE, this.getURL(), id);
5757
return request(RequestMethod.GET, url, null,
58-
CustomerCardCollection.class, apiKey);
58+
Card.class, apiKey);
5959
}
6060

6161
public CustomerCardCollection create(Map<String, Object> params)

src/test/java/com/stripe/StripeTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,9 @@ public void testCustomerCardAddition() throws StripeException {
366366
Customer customerAfterDefaultCardUpdate = updatedCustomer.update(updateParams);
367367
assertEquals((Integer) customerAfterDefaultCardUpdate.getCards().getData().size(), (Integer) 3);
368368
assertEquals(customerAfterDefaultCardUpdate.getDefaultCard(), addedCard.getId());
369+
370+
assertEquals(customerAfterDefaultCardUpdate.getCards().retrieve(originalDefaultCard).getId(), originalDefaultCard);
371+
assertEquals(customerAfterDefaultCardUpdate.getCards().retrieve(addedCard.getId()).getId(), addedCard.getId());
369372
}
370373

371374
@Test

0 commit comments

Comments
 (0)