use of com.fitpay.android.api.models.Relationship in project fitpay-android-sdk by fitpay.
the class Steps method acceptTerms.
public void acceptTerms() throws InterruptedException {
getDevices();
Assert.assertNotNull(currentUser);
Assert.assertNotNull(currentCard);
Assert.assertNotNull(currentDevice);
final CountDownLatch latch = new CountDownLatch(2);
final boolean[] isRequestSuccess = { false };
ApiManager.getInstance().createRelationship(currentUser.getId(), currentCard.getCreditCardId(), currentDevice.getDeviceIdentifier(), new ApiCallback<Relationship>() {
@Override
public void onSuccess(Relationship result) {
latch.countDown();
}
@Override
public void onFailure(@ResultCode.Code int errorCode, String errorMessage) {
latch.countDown();
}
});
latch.await(TIMEOUT, TimeUnit.SECONDS);
currentCard.acceptTerms(new ApiCallback<CreditCard>() {
@Override
public void onSuccess(CreditCard result) {
isRequestSuccess[0] = true;
currentCard = result;
latch.countDown();
}
@Override
public void onFailure(@ResultCode.Code int errorCode, String errorMessage) {
latch.countDown();
}
});
latch.await(TIMEOUT, TimeUnit.SECONDS);
Assert.assertNotNull(currentCard);
Assert.assertTrue(isRequestSuccess[0]);
Assert.assertEquals("PENDING_VERIFICATION", currentCard.getState());
}
Aggregations