use of com.fitpay.android.api.callbacks.ResultProvidingCallback in project fitpay-android-sdk by fitpay.
the class CreditCardTest2 method testCanAddCreditCard.
@Test
public void testCanAddCreditCard() 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);
verifyCardContents(creditCard, createdCard);
final CountDownLatch latch = new CountDownLatch(1);
ResultProvidingCallback<Image> callback = new ResultProvidingCallback<>(latch);
createdCard.getCardMetaData().getBrandLogo().get(0).self(callback);
latch.await(TIMEOUT, TimeUnit.SECONDS);
// TODO enable test for image retrieval
// assertEquals(-1, callback.getErrorCode());
}
use of com.fitpay.android.api.callbacks.ResultProvidingCallback in project fitpay-android-sdk by fitpay.
the class TestActions method doLogin.
protected boolean doLogin(LoginIdentity loginIdentity) throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
ResultProvidingCallback<OAuthToken> callback = new ResultProvidingCallback<>(latch);
ApiManager.getInstance().loginUser(loginIdentity, callback);
boolean completed = latch.await(TIMEOUT, TimeUnit.SECONDS);
assertTrue("login did not complete successfully", completed);
assertEquals("login error code. (message: " + callback.getErrorMessage() + ")", -1, callback.getErrorCode());
return completed;
}
use of com.fitpay.android.api.callbacks.ResultProvidingCallback in project fitpay-android-sdk by fitpay.
the class TestActions method selectVerificationMethod.
protected VerificationMethod selectVerificationMethod(VerificationMethod method) throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
ResultProvidingCallback<VerificationMethod> callback = new ResultProvidingCallback<>(latch);
method.select(callback);
latch.await(TIMEOUT, TimeUnit.SECONDS);
return callback.getResult();
}
use of com.fitpay.android.api.callbacks.ResultProvidingCallback in project fitpay-android-sdk by fitpay.
the class TestActions method declineTerms.
protected CreditCard declineTerms(CreditCard creditCard) throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
ResultProvidingCallback<CreditCard> callback = new ResultProvidingCallback<>(latch);
creditCard.declineTerms(callback);
latch.await(TIMEOUT, TimeUnit.SECONDS);
return callback.getResult();
}
use of com.fitpay.android.api.callbacks.ResultProvidingCallback in project fitpay-android-sdk by fitpay.
the class TestActions method reactivateCard.
protected CreditCard reactivateCard(CreditCard creditCard, Reason reason) throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
ResultProvidingCallback<CreditCard> callback = new ResultProvidingCallback<>(latch);
creditCard.reactivate(reason, callback);
latch.await(TIMEOUT, TimeUnit.SECONDS);
return callback.getResult();
}
Aggregations