use of com.fitpay.android.api.models.device.Device in project fitpay-android-sdk by fitpay.
the class TestActions method getPoorlyDeviceTestSmartStrapDevice.
public Device getPoorlyDeviceTestSmartStrapDevice() {
String manufacturerName = "X111";
String deviceName = "TEST_DEVICE";
String firmwareRevision = "111.111";
String hardwareRevision = "1.1.1";
String modelNumber = "AB111";
String serialNumber = "1111AB";
String softwareRevision = "1.1.1";
String systemId = "0x111AA";
String oSName = "A1111";
String licenseKey = "aaaaaa-1111-1111-1111-111111111111";
String bdAddress = "bbbbbb-1111-1111-1111-111111111111";
long pairingTs = System.currentTimeMillis();
String stringTimestamp = TimestampUtils.getISO8601StringForTime(pairingTs);
String secureElementId = "cccccc-1111-1111-1111-1111111111";
Device newDevice = new Device.Builder().setDeviceType(DeviceTypes.SMART_STRAP).setDeviceName(deviceName).build();
return newDevice;
}
use of com.fitpay.android.api.models.device.Device 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();
}
use of com.fitpay.android.api.models.device.Device 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());
}
use of com.fitpay.android.api.models.device.Device in project fitpay-android-sdk by fitpay.
the class DeviceTest2 method testCanDevicesWhenOnlyOneInCollection.
@Test
public void testCanDevicesWhenOnlyOneInCollection() throws Exception {
Device device = getTestDevice();
Device createdDevice = createDevice(user, device);
assertNotNull("device", createdDevice);
Collections.DeviceCollection devices = getDevices(user);
assertNotNull("retrieved devices", devices);
assertEquals("number of devices", 1, devices.getTotalResults());
Device firstDevice = devices.getResults().get(0);
assertNotNull("first device", firstDevice);
assertEquals("device id", createdDevice.getDeviceIdentifier(), firstDevice.getDeviceIdentifier());
}
use of com.fitpay.android.api.models.device.Device in project fitpay-android-sdk by fitpay.
the class DeviceTest2 method testCanGetDeviceFromCollection.
@Test
public void testCanGetDeviceFromCollection() throws Exception {
Device device = getTestDevice();
Device createdDevice = createDevice(user, device);
assertNotNull("device", createdDevice);
Collections.DeviceCollection devices = getDevices(user);
assertNotNull("retrieved devices", devices);
assertEquals("number of devices", 1, devices.getTotalResults());
Device firstDevice = devices.getResults().get(0);
assertNotNull("first device", firstDevice);
final CountDownLatch latch4 = new CountDownLatch(1);
ResultProvidingCallback<Device> callback4 = new ResultProvidingCallback<>(latch4);
createdDevice.self(callback4);
latch4.await(TIMEOUT, TimeUnit.SECONDS);
Device retrievedDevice = callback4.getResult();
assertNotNull("retrieved device", retrievedDevice);
assertEquals("device id", firstDevice.getDeviceIdentifier(), retrievedDevice.getDeviceIdentifier());
}
Aggregations