use of com.fitpay.android.api.models.Transaction in project fitpay-android-sdk by fitpay.
the class TestActions method getTransaction.
protected Transaction getTransaction(Transaction transaction) throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
ResultProvidingCallback<Transaction> callback = new ResultProvidingCallback<>(latch);
transaction.self(callback);
latch.await(TIMEOUT, TimeUnit.SECONDS);
assertEquals("get device transaction error code. (message: " + callback.getErrorMessage() + ")", -1, callback.getErrorCode());
return callback.getResult();
}
use of com.fitpay.android.api.models.Transaction 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());
}
Aggregations