use of com.fitpay.android.api.callbacks.ResultProvidingCallback in project fitpay-android-sdk by fitpay.
the class DeviceTest2 method testCanGetDeviceById.
@Test
public void testCanGetDeviceById() throws Exception {
Device device = getTestDevice();
Device createdDevice = createDevice(user, device);
assertNotNull("device", createdDevice);
final CountDownLatch latch = new CountDownLatch(1);
ResultProvidingCallback<Device> callback = new ResultProvidingCallback<>(latch);
user.getDevice(createdDevice.getDeviceIdentifier(), callback);
latch.await(TIMEOUT, TimeUnit.SECONDS);
Device retrievedDevice = callback.getResult();
assertNotNull("device should have been retrieved", retrievedDevice);
assertEquals("device id", createdDevice.getDeviceIdentifier(), retrievedDevice.getDeviceIdentifier());
}
use of com.fitpay.android.api.callbacks.ResultProvidingCallback in project fitpay-android-sdk by fitpay.
the class TestActions method createCreditCard.
protected CreditCard createCreditCard(User user, CreditCard creditCard) throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
ResultProvidingCallback<CreditCard> callback = new ResultProvidingCallback<>(latch);
user.createCreditCard(creditCard, 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 makeDefaultCard.
protected void makeDefaultCard(CreditCard creditCard) throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
ResultProvidingCallback<Void> callback = new ResultProvidingCallback<>(latch);
creditCard.makeDefault(callback);
latch.await(TIMEOUT, TimeUnit.SECONDS);
assertEquals("make default error code", -1, callback.getErrorCode());
}
use of com.fitpay.android.api.callbacks.ResultProvidingCallback in project fitpay-android-sdk by fitpay.
the class TestActions method deleteCard.
protected void deleteCard(CreditCard creditCard) throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
ResultProvidingCallback<Void> callback = new ResultProvidingCallback<>(latch);
creditCard.deleteCard(callback);
latch.await(TIMEOUT, TimeUnit.SECONDS);
assertEquals("delete error code", -1, callback.getErrorCode());
}
use of com.fitpay.android.api.callbacks.ResultProvidingCallback 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();
}
Aggregations