Search in sources :

Example 1 with PaymentProductDirectoryResponse

use of com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentProductDirectoryResponse in project connect-sdk-client-android by Ingenico-ePayments.

the class GetPaymentProductDirectoryTest method testGetPaymentProductDirectoryAsyncTaskWithInvalidRequest.

/**
 * Test that an invalid request for a PaymentProductDirectory will return, but will not contain a PaymentProductDirectoryResponse
 */
@Test
public void testGetPaymentProductDirectoryAsyncTaskWithInvalidRequest() throws InterruptedException {
    initializeInValidMocksAndSession();
    final CountDownLatch waitForAsyncTaskCallBack = new CountDownLatch(1);
    Listener listener = new Listener(waitForAsyncTaskCallBack);
    // Create the PaymentProductDirectoryAsyncTask and start the test by running execute
    PaymentProductDirectoryAsyncTask paymentProductDirectoryAsyncTask = new PaymentProductDirectoryAsyncTask("809", CurrencyCode.EUR, CountryCode.NL, getContext(), getCommunicator(), listener);
    paymentProductDirectoryAsyncTask.execute();
    // Test that the response is received within 'ASYNCTASK_CALLBACK_TEST_TIMEOUT_SEC' seconds
    assertTrue(waitForAsyncTaskCallBack.await(ASYNCTASK_CALLBACK_TEST_TIMEOUT_SEC, TimeUnit.SECONDS));
    // Retrieve the paymentProductDirectoryResponse from the listener and validate it has the correct fields
    PaymentProductDirectoryResponse paymentProductDirectoryResponse = listener.getPaymentProductDirectoryResponse();
    assertNull(paymentProductDirectoryResponse);
}
Also used : PaymentProductDirectoryAsyncTask(com.globalcollect.gateway.sdk.client.android.sdk.asynctask.PaymentProductDirectoryAsyncTask) PaymentProductDirectoryResponse(com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentProductDirectoryResponse) CountDownLatch(java.util.concurrent.CountDownLatch) Test(org.junit.Test)

Example 2 with PaymentProductDirectoryResponse

use of com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentProductDirectoryResponse in project connect-sdk-client-android by Ingenico-ePayments.

the class GetPaymentProductDirectoryTest method testGetPaymentProductDirectoryAsyncTaskWithValidRequest.

@Test
public void testGetPaymentProductDirectoryAsyncTaskWithValidRequest() throws InterruptedException, CommunicationException {
    initializeValidMocksAndSession();
    final CountDownLatch waitForAsyncTaskCallBack = new CountDownLatch(1);
    Listener listener = new Listener(waitForAsyncTaskCallBack);
    // Create the PaymentProductDirectoryAsyncTask and start the test by running execute
    PaymentProductDirectoryAsyncTask paymentProductDirectoryAsyncTask = new PaymentProductDirectoryAsyncTask("809", CurrencyCode.EUR, CountryCode.NL, getContext(), getCommunicator(), listener);
    paymentProductDirectoryAsyncTask.execute();
    // Test that the response is received within 'ASYNCTASK_CALLBACK_TEST_TIMEOUT_SEC' seconds
    assertTrue(waitForAsyncTaskCallBack.await(ASYNCTASK_CALLBACK_TEST_TIMEOUT_SEC, TimeUnit.SECONDS));
    // Retrieve the paymentProductDirectoryResponse from the listener and validate it has the correct fields
    PaymentProductDirectoryResponse paymentProductDirectoryResponse = listener.getPaymentProductDirectoryResponse();
    assertNotNull(paymentProductDirectoryResponse);
    assertNotNull(paymentProductDirectoryResponse.getEntries());
    assertFalse(paymentProductDirectoryResponse.getEntries().isEmpty());
}
Also used : PaymentProductDirectoryAsyncTask(com.globalcollect.gateway.sdk.client.android.sdk.asynctask.PaymentProductDirectoryAsyncTask) PaymentProductDirectoryResponse(com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentProductDirectoryResponse) CountDownLatch(java.util.concurrent.CountDownLatch) Test(org.junit.Test)

Aggregations

PaymentProductDirectoryAsyncTask (com.globalcollect.gateway.sdk.client.android.sdk.asynctask.PaymentProductDirectoryAsyncTask)2 PaymentProductDirectoryResponse (com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentProductDirectoryResponse)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 Test (org.junit.Test)2