Search in sources :

Example 11 with Device

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;
}
Also used : PaymentDevice(com.fitpay.android.api.models.device.PaymentDevice) Device(com.fitpay.android.api.models.device.Device)

Example 12 with Device

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();
}
Also used : ResultProvidingCallback(com.fitpay.android.api.callbacks.ResultProvidingCallback) PaymentDevice(com.fitpay.android.api.models.device.PaymentDevice) Device(com.fitpay.android.api.models.device.Device) CountDownLatch(java.util.concurrent.CountDownLatch)

Example 13 with Device

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());
}
Also used : Device(com.fitpay.android.api.models.device.Device) Collections(com.fitpay.android.api.models.collection.Collections) CreditCard(com.fitpay.android.api.models.card.CreditCard) Test(org.junit.Test)

Example 14 with Device

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());
}
Also used : Device(com.fitpay.android.api.models.device.Device) Collections(com.fitpay.android.api.models.collection.Collections) Test(org.junit.Test)

Example 15 with Device

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());
}
Also used : ResultProvidingCallback(com.fitpay.android.api.callbacks.ResultProvidingCallback) Device(com.fitpay.android.api.models.device.Device) Collections(com.fitpay.android.api.models.collection.Collections) CountDownLatch(java.util.concurrent.CountDownLatch) Test(org.junit.Test)

Aggregations

Device (com.fitpay.android.api.models.device.Device)39 Test (org.junit.Test)28 Collections (com.fitpay.android.api.models.collection.Collections)22 CreditCard (com.fitpay.android.api.models.card.CreditCard)19 CountDownLatch (java.util.concurrent.CountDownLatch)15 PaymentDevice (com.fitpay.android.api.models.device.PaymentDevice)9 ResultProvidingCallback (com.fitpay.android.api.callbacks.ResultProvidingCallback)8 Commit (com.fitpay.android.api.models.device.Commit)3 ApiCallback (com.fitpay.android.api.callbacks.ApiCallback)2 UserStreamEvent (com.fitpay.android.api.models.UserStreamEvent)2 User (com.fitpay.android.api.models.user.User)2 UserEventStreamListener (com.fitpay.android.api.sse.UserEventStreamListener)2 SyncRequest (com.fitpay.android.paymentdevice.models.SyncRequest)2 Activity (android.app.Activity)1 Image (android.media.Image)1 ApiManager (com.fitpay.android.api.ApiManager)1 SyncInitiator (com.fitpay.android.api.enums.SyncInitiator)1 Transaction (com.fitpay.android.api.models.Transaction)1 Reason (com.fitpay.android.api.models.card.Reason)1 VerificationMethod (com.fitpay.android.api.models.card.VerificationMethod)1