use of com.fitpay.android.api.models.card.CreditCard in project fitpay-android-sdk by fitpay.
the class TestActions method deactivateCard.
protected CreditCard deactivateCard(CreditCard creditCard, Reason reason) throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
ResultProvidingCallback<CreditCard> callback = new ResultProvidingCallback<>(latch);
creditCard.deactivate(reason, callback);
latch.await(TIMEOUT, TimeUnit.SECONDS);
return callback.getResult();
}
use of com.fitpay.android.api.models.card.CreditCard in project fitpay-android-sdk by fitpay.
the class TestActions method getCreditCard.
protected CreditCard getCreditCard(CreditCard creditCard) throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
ResultProvidingCallback<CreditCard> callback = new ResultProvidingCallback<>(latch);
creditCard.self(callback);
latch.await(TIMEOUT, TimeUnit.SECONDS);
assertEquals("get credit card had error code. (message: " + callback.getErrorMessage() + ")", -1, callback.getErrorCode());
return callback.getResult();
}
use of com.fitpay.android.api.models.card.CreditCard in project fitpay-android-sdk by fitpay.
the class CreditCardTest2 method canGetCardTransactions.
@Test
public void canGetCardTransactions() throws Exception {
Device device = getTestDevice();
Device createdDevice = createDevice(user, device);
assertNotNull("created device", createdDevice);
Collections.DeviceCollection devices = getDevices(user);
assertNotNull("devices collection should not be null", devices);
assertEquals("should have one device", 1, devices.getTotalResults());
String pan = "9999411111111112";
CreditCard creditCard = getTestCreditCard(pan);
CreditCard createdCard = createCreditCard(user, creditCard);
assertNotNull("card not created", createdCard);
assertEquals("card not in expected state", "ELIGIBLE", createdCard.getState());
createdCard = acceptTerms(createdCard);
createdCard = waitForActivation(createdCard);
assertEquals("post deactivation card state", "ACTIVE", createdCard.getState());
assertTrue("should be default", createdCard.isDefault());
Collections.TransactionCollection transactions = getCardTransactions(createdCard);
assertNotNull("card should have transactions", transactions);
assertTrue("card should have at least one transaction", transactions.getResults().size() > 0);
Transaction transaction = transactions.getResults().get(0);
Transaction retreivedTransaction = getTransaction(transaction);
assertEquals("should be the same transaction", transaction.getTransactionId(), retreivedTransaction.getTransactionId());
}
use of com.fitpay.android.api.models.card.CreditCard in project fitpay-android-sdk by fitpay.
the class CreditCardTest2 method testCanGetCards2.
@Test
public void testCanGetCards2() throws Exception {
Device device = getTestDevice();
Device createdDevice = createDevice(user, device);
assertNotNull("created device", createdDevice);
Collections.DeviceCollection devices = getDevices(user);
assertNotNull("devices collection should not be null", devices);
assertEquals("should have one device", 1, devices.getTotalResults());
String pan = "9999504454545450";
CreditCard creditCard = getTestCreditCard(pan);
CreditCard createdCard = createCreditCard(user, creditCard);
assertNotNull("card not created", createdCard);
pan = "9999504454545451";
creditCard = getTestCreditCard(pan);
createdCard = createCreditCard(user, creditCard);
assertNotNull("card not created", createdCard);
Collections.CreditCardCollection creditCards = getCreditCards(user);
assertNotNull("credit cards collection", creditCards);
assertEquals("number of credit cards", 2, creditCards.getTotalResults());
assertTrue("credit card id", createdCard.getCreditCardId().equals(creditCards.getResults().get(0).getCreditCardId()) || createdCard.getCreditCardId().equals(creditCards.getResults().get(1).getCreditCardId()));
}
use of com.fitpay.android.api.models.card.CreditCard in project fitpay-android-sdk by fitpay.
the class CreditCardTest2 method testAcceptTermsOnDeclinedCardDoesNothing.
@Test
public void testAcceptTermsOnDeclinedCardDoesNothing() throws Exception {
Device device = getTestDevice();
Device createdDevice = createDevice(user, device);
assertNotNull("created device", createdDevice);
Collections.DeviceCollection devices = getDevices(user);
assertNotNull("devices collection should not be null", devices);
assertEquals("should have one device", 1, devices.getTotalResults());
String pan = "9999504454545459";
CreditCard creditCard = getTestCreditCard(pan);
CreditCard createdCard = createCreditCard(user, creditCard);
assertNotNull("card not created", createdCard);
assertEquals("card not in expected state", "ELIGIBLE", createdCard.getState());
createdCard = acceptTerms(createdCard);
assertNotNull("card not successfully updated by accept terms", createdCard);
assertEquals("card state", "DECLINED", createdCard.getState());
createdCard = acceptTerms(createdCard);
assertNull("no result expected", createdCard);
}
Aggregations