use of com.stripe.model.Card in project stripe-java by stripe.
the class RecipientTest method testRecipientCardDelete.
@Test
public void testRecipientCardDelete() throws StripeException {
Recipient recipient = Recipient.create(defaultRecipientParams);
Map<String, Object> creationParams = new HashMap<String, Object>();
creationParams.put("card", "tok_visa_debit");
recipient.createCard(creationParams);
Card card = recipient.getCards().getData().get(0);
DeletedCard deletedCard = card.delete();
Recipient retrievedRecipient = Recipient.retrieve(recipient.getId());
assertTrue(deletedCard.getDeleted());
assertEquals(deletedCard.getId(), card.getId());
for (Card retrievedCard : retrievedRecipient.getCards().getData()) {
assertFalse("Card was not actually deleted: " + card.getId(), card.getId().equals(retrievedCard.getId()));
}
}
use of com.stripe.model.Card in project stripe-java by stripe.
the class ChargeTest method testInvalidAddressLine1Test.
@Test
public void testInvalidAddressLine1Test() throws StripeException {
Map<String, Object> invalidChargeParams = new HashMap<String, Object>();
invalidChargeParams.putAll(defaultChargeParams);
invalidChargeParams.put("source", "tok_avsLine1Fail");
Charge charge = Charge.create(invalidChargeParams, supportedRequestOptions);
assertEquals(charge.getPaid(), true);
assertThat(charge.getSource(), instanceOf(Card.class));
Card card = (Card) charge.getSource();
assertEquals(card.getAddressLine1Check(), "fail");
}
use of com.stripe.model.Card in project stripe-java by stripe.
the class ChargeTest method testInvalidAddressZipTest.
@Test
public void testInvalidAddressZipTest() throws StripeException {
Map<String, Object> invalidChargeParams = new HashMap<String, Object>();
invalidChargeParams.putAll(defaultChargeParams);
invalidChargeParams.put("source", "tok_avsZipFail");
Charge charge = Charge.create(invalidChargeParams, supportedRequestOptions);
assertEquals(charge.getPaid(), true);
assertThat(charge.getSource(), instanceOf(Card.class));
Card card = (Card) charge.getSource();
assertEquals(card.getAddressZipCheck(), "fail");
}
use of com.stripe.model.Card in project stripe-java by stripe.
the class CountrySpecTest method testChargeCreationSourceAsCard.
@Test
public void testChargeCreationSourceAsCard() throws StripeException {
Charge charge = Charge.create(defaultChargeParams);
assertTrue(charge.getSource() instanceof Card);
assertNotNull(charge.getSource().getId());
}
Aggregations