use of com.fitpay.android.api.models.card.CreditCard 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();
}
use of com.fitpay.android.api.models.card.CreditCard in project fitpay-android-sdk by fitpay.
the class TestActions method waitForActivation.
protected CreditCard waitForActivation(CreditCard card) throws Exception {
assertNotNull("no card to wait for activation on", card);
CreditCard retrievedCard = card;
for (int x = 0; x < 30; x++) {
retrievedCard = getCreditCard(retrievedCard);
if ("ACTIVE".equals(retrievedCard.getState())) {
break;
}
Thread.sleep(1000);
}
assertEquals("card never transitioned to ACTIVE state", "ACTIVE", retrievedCard.getState());
return retrievedCard;
}
use of com.fitpay.android.api.models.card.CreditCard 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();
}
use of com.fitpay.android.api.models.card.CreditCard in project fitpay-android-sdk by fitpay.
the class TestActions method getTestCreditCard.
protected CreditCard getTestCreditCard(String pan) {
String cardName = "TEST CARD";
int expYear = 2018;
int expMonth = 10;
String city = "Boulder";
String state = "CO";
String postalCode = "80302";
String countryCode = "US";
String street1 = "1035 Pearl St";
String cvv = "133";
Address address = new Address();
address.setCity(city);
address.setState(state);
address.setPostalCode(postalCode);
address.setCountryCode(countryCode);
address.setStreet1(street1);
CreditCard creditCard = new CreditCard.Builder().setCVV(cvv).setPAN(pan).setExpDate(expYear, expMonth).setAddress(address).setName(cardName).build();
return creditCard;
}
use of com.fitpay.android.api.models.card.CreditCard in project fitpay-android-sdk by fitpay.
the class CreditCardTest3 method testCanAcceptTerms.
@Test
public void testCanAcceptTerms() 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 = "9999445454545454";
CreditCard creditCard = getTestCreditCard(pan);
creditCard = createCreditCard(user, creditCard);
assertNotNull("card not created", creditCard);
assertEquals("card not in expected state", "ELIGIBLE", creditCard.getState());
// save acceptTerms
final String acceptTermsUrl = creditCard.getAcceptTermsUrl();
// get the same card but without sessionData
creditCard = getCreditCard(creditCard);
// update acceptTerms url
creditCard.setAcceptTermsUrl(acceptTermsUrl);
// accept terms
creditCard = acceptTerms(creditCard);
assertNotNull("card not successfully updated by accept terms", creditCard);
assertEquals("card state", "PENDING_VERIFICATION", creditCard.getState());
}
Aggregations