Search in sources :

Example 21 with ResultProvidingCallback

use of com.fitpay.android.api.callbacks.ResultProvidingCallback in project fitpay-android-sdk by fitpay.

the class TestActions method getAllCommits.

protected Collections.CommitsCollection getAllCommits(Device device, String lastCommitId) throws Exception {
    final CountDownLatch latch = new CountDownLatch(1);
    ResultProvidingCallback<Collections.CommitsCollection> callback = new ResultProvidingCallback<>(latch);
    device.getAllCommits(lastCommitId, callback);
    latch.await(TIMEOUT * 3, TimeUnit.SECONDS);
    assertEquals("get commits error code.  (message: " + callback.getErrorMessage() + ")", -1, callback.getErrorCode());
    return callback.getResult();
}
Also used : ResultProvidingCallback(com.fitpay.android.api.callbacks.ResultProvidingCallback) CountDownLatch(java.util.concurrent.CountDownLatch)

Example 22 with ResultProvidingCallback

use of com.fitpay.android.api.callbacks.ResultProvidingCallback 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();
}
Also used : ResultProvidingCallback(com.fitpay.android.api.callbacks.ResultProvidingCallback) CountDownLatch(java.util.concurrent.CountDownLatch) CreditCard(com.fitpay.android.api.models.card.CreditCard)

Example 23 with ResultProvidingCallback

use of com.fitpay.android.api.callbacks.ResultProvidingCallback in project fitpay-android-sdk by fitpay.

the class TestActions method verifyVerificationMethod.

protected VerificationMethod verifyVerificationMethod(VerificationMethod method, String verificationCode) throws Exception {
    final CountDownLatch latch = new CountDownLatch(1);
    ResultProvidingCallback<VerificationMethod> callback = new ResultProvidingCallback<>(latch);
    method.verify(verificationCode, callback);
    latch.await(TIMEOUT, TimeUnit.SECONDS);
    return callback.getResult();
}
Also used : ResultProvidingCallback(com.fitpay.android.api.callbacks.ResultProvidingCallback) VerificationMethod(com.fitpay.android.api.models.card.VerificationMethod) CountDownLatch(java.util.concurrent.CountDownLatch)

Example 24 with ResultProvidingCallback

use of com.fitpay.android.api.callbacks.ResultProvidingCallback in project fitpay-android-sdk by fitpay.

the class TestActions method getDevices.

protected Collections.DeviceCollection getDevices(User user) throws Exception {
    final CountDownLatch latch = new CountDownLatch(1);
    ResultProvidingCallback<Collections.DeviceCollection> callback = new ResultProvidingCallback<>(latch);
    user.getDevices(10, 0, callback);
    latch.await(TIMEOUT, TimeUnit.SECONDS);
    assertEquals("get devices error code.  (message: " + callback.getErrorMessage() + ")", -1, callback.getErrorCode());
    return callback.getResult();
}
Also used : ResultProvidingCallback(com.fitpay.android.api.callbacks.ResultProvidingCallback) CountDownLatch(java.util.concurrent.CountDownLatch)

Example 25 with ResultProvidingCallback

use of com.fitpay.android.api.callbacks.ResultProvidingCallback in project fitpay-android-sdk by fitpay.

the class TestActions method getUser.

protected User getUser() throws Exception {
    final CountDownLatch latch = new CountDownLatch(1);
    ResultProvidingCallback<User> callback = new ResultProvidingCallback<>(latch);
    ApiManager.getInstance().getUser(callback);
    latch.await(TIMEOUT, TimeUnit.SECONDS);
    User user = callback.getResult();
    Assert.assertNotNull(user);
    return user;
}
Also used : ResultProvidingCallback(com.fitpay.android.api.callbacks.ResultProvidingCallback) User(com.fitpay.android.api.models.user.User) CountDownLatch(java.util.concurrent.CountDownLatch)

Aggregations

ResultProvidingCallback (com.fitpay.android.api.callbacks.ResultProvidingCallback)32 CountDownLatch (java.util.concurrent.CountDownLatch)32 Test (org.junit.Test)11 CreditCard (com.fitpay.android.api.models.card.CreditCard)8 Device (com.fitpay.android.api.models.device.Device)8 User (com.fitpay.android.api.models.user.User)4 Collections (com.fitpay.android.api.models.collection.Collections)3 VerificationMethod (com.fitpay.android.api.models.card.VerificationMethod)2 OAuthToken (com.fitpay.android.api.models.security.OAuthToken)2 Ignore (org.junit.Ignore)2 Image (android.media.Image)1 Transaction (com.fitpay.android.api.models.Transaction)1 PaymentDevice (com.fitpay.android.api.models.device.PaymentDevice)1 LoginIdentity (com.fitpay.android.api.models.user.LoginIdentity)1 After (org.junit.After)1