Search in sources :

Example 6 with ResultProvidingCallback

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

the class TestActions method deleteUser.

@After
public void deleteUser() throws Exception {
    if (null != this.user) {
        final CountDownLatch latch = new CountDownLatch(1);
        ResultProvidingCallback<Void> callback = new ResultProvidingCallback<>(latch);
        this.user.deleteUser(callback);
        latch.await(TIMEOUT, TimeUnit.SECONDS);
    }
}
Also used : ResultProvidingCallback(com.fitpay.android.api.callbacks.ResultProvidingCallback) CountDownLatch(java.util.concurrent.CountDownLatch) After(org.junit.After)

Example 7 with ResultProvidingCallback

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

the class TestActions method createDevice.

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

Example 8 with ResultProvidingCallback

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

the class TestActions method getCreditCards.

protected Collections.CreditCardCollection getCreditCards(User user) throws Exception {
    final CountDownLatch latch = new CountDownLatch(1);
    ResultProvidingCallback<Collections.CreditCardCollection> callback = new ResultProvidingCallback<>(latch);
    user.getCreditCards(10, 0, callback);
    latch.await(TIMEOUT, TimeUnit.SECONDS);
    assertEquals("get credit cards 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)

Example 9 with ResultProvidingCallback

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

the class TestActions method acceptTerms.

protected CreditCard acceptTerms(CreditCard creditCard) throws Exception {
    final CountDownLatch latch = new CountDownLatch(2);
    ResultProvidingCallback<CreditCard> callback = new ResultProvidingCallback<>(latch);
    creditCard.acceptTerms(callback);
    latch.await(TIMEOUT, TimeUnit.SECONDS);
    CreditCard acceptedCard = callback.getResult();
    if (acceptedCard == null) {
        return null;
    }
    TestConstants.waitSomeActionsOnServer();
    // getSelf
    ResultProvidingCallback<CreditCard> callbackSelf = new ResultProvidingCallback<>(latch);
    acceptedCard.self(callbackSelf);
    latch.await(TIMEOUT, TimeUnit.SECONDS);
    return callbackSelf.getResult();
}
Also used : ResultProvidingCallback(com.fitpay.android.api.callbacks.ResultProvidingCallback) CountDownLatch(java.util.concurrent.CountDownLatch) CreditCard(com.fitpay.android.api.models.card.CreditCard)

Example 10 with ResultProvidingCallback

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

the class TestActions method getCardTransactions.

protected Collections.TransactionCollection getCardTransactions(CreditCard card) throws Exception {
    final CountDownLatch latch = new CountDownLatch(1);
    ResultProvidingCallback<Collections.TransactionCollection> callback = new ResultProvidingCallback<>(latch);
    card.getTransactions(10, 0, callback);
    latch.await(TIMEOUT, TimeUnit.SECONDS);
    assertEquals("get device transactions 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)

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