use of com.globalcollect.gateway.sdk.client.android.sdk.model.iin.IinDetailsResponse in project connect-sdk-client-android by Ingenico-ePayments.
the class GetIinDetailsAsyncTaskTest method testGetIinDetailsAsyncTaskUNKNOWNWithValidRequest.
@Test
public void testGetIinDetailsAsyncTaskUNKNOWNWithValidRequest() throws InterruptedException, CommunicationException {
initializeValidMocksAndSession();
final CountDownLatch waitForAsyncCallBack = new CountDownLatch(1);
// Create the IinLookupAsyncTask and then begin the test by calling execute
List<IinLookupAsyncTask.OnIinLookupCompleteListener> listeners = new ArrayList<>(1);
Listener listener = new Listener(waitForAsyncCallBack);
listeners.add(listener);
IinLookupAsyncTask iinLookupAsyncTask = new IinLookupAsyncTask(getContext(), // Invalid number
"123456", getCommunicator(), listeners, minimalValidPaymentContext);
iinLookupAsyncTask.execute();
// Test that the IinLookup returns with status UNKNOW within 'ASYNCTASK_CALLBACK_TEST_TIMEOUT_SEC' seconds
assertTrue(waitForAsyncCallBack.await(ASYNCTASK_CALLBACK_TEST_TIMEOUT_SEC, TimeUnit.SECONDS));
// Retrieve the response from the callback and validate its status
IinDetailsResponse iinDetailsResponse = listener.getIinDetailsResponse();
validateResponseStatusUNKNOWN(iinDetailsResponse);
}
use of com.globalcollect.gateway.sdk.client.android.sdk.model.iin.IinDetailsResponse in project connect-sdk-client-android by Ingenico-ePayments.
the class GetIinDetailsAsyncTaskTest method testGetIinDetailsAsyncTaskSUPPORTEDWithInValidRequest.
@Test
public void testGetIinDetailsAsyncTaskSUPPORTEDWithInValidRequest() throws InterruptedException {
initializeInValidMocksAndSession();
final CountDownLatch waitForAsyncTaskCallBack = new CountDownLatch(1);
// Create the IinLookupAsyncTask and then begin the test by calling execute.
List<IinLookupAsyncTask.OnIinLookupCompleteListener> listeners = new ArrayList<>(1);
Listener listener = new Listener(waitForAsyncTaskCallBack);
listeners.add(listener);
IinLookupAsyncTask iinLookupAsyncTask = new IinLookupAsyncTask(getContext(), // Visa number
"401200", getCommunicator(), listeners, minimalValidPaymentContext);
iinLookupAsyncTask.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 iin details response from the listener
IinDetailsResponse iinDetailsResponse = listener.getIinDetailsResponse();
// Test that the status assigned to response is UNKNOWN as it should be since the lookup failed
validateResponseStatusUNKNOWN(iinDetailsResponse);
}
use of com.globalcollect.gateway.sdk.client.android.sdk.model.iin.IinDetailsResponse in project connect-sdk-client-android by Ingenico-ePayments.
the class GetIinDetailsAsyncTaskTest method testGetIinDetailsAsyncTaskEXISTING_BUT_NOT_ALLOWEDWithValidRequest.
@Test
public void testGetIinDetailsAsyncTaskEXISTING_BUT_NOT_ALLOWEDWithValidRequest() throws InterruptedException, CommunicationException {
initializeValidMocksAndSession();
final CountDownLatch waitForAsyncCallBack = new CountDownLatch(1);
// Create the IinLookupAsyncTask and then begin the test by calling execute
List<IinLookupAsyncTask.OnIinLookupCompleteListener> listeners = new ArrayList<>(1);
Listener listener = new Listener(waitForAsyncCallBack);
listeners.add(listener);
PaymentContext customPaymentContext = new PaymentContext(new AmountOfMoney(1000L, CurrencyCode.USD), CountryCode.US, false);
IinLookupAsyncTask iinLookupAsyncTask = new IinLookupAsyncTask(getContext(), // Number that is valid, but not allowed in the customPaymentContext
"653598", getCommunicator(), listeners, customPaymentContext);
iinLookupAsyncTask.execute();
// Test that the IinLookup returns with status EXISTING_BUT_NOT_ALLOWED wiithin 'ASYNCTASK_CALLBACK_TEST_TIMEOUT_SEC' seconds
assertTrue(waitForAsyncCallBack.await(ASYNCTASK_CALLBACK_TEST_TIMEOUT_SEC, TimeUnit.SECONDS));
// Retrieve the response from the callback and validate its status
IinDetailsResponse iinDetailsResponse = listener.getIinDetailsResponse();
validateResponseStatusEXISTING_BUT_NOT_ALLOWED(iinDetailsResponse);
}
use of com.globalcollect.gateway.sdk.client.android.sdk.model.iin.IinDetailsResponse in project connect-sdk-client-android by Ingenico-ePayments.
the class GetIinDetailsAsyncTaskTest method testGetIinDetailsAsyncTaskNOT_ENOUGH_DIGITSWithValidRequest.
@Test
public void testGetIinDetailsAsyncTaskNOT_ENOUGH_DIGITSWithValidRequest() throws InterruptedException, CommunicationException {
initializeValidMocksAndSession();
final CountDownLatch waitForAsyncCallBack = new CountDownLatch(1);
// Create the IinLookupAsyncTask and then begin the test by calling execute
List<IinLookupAsyncTask.OnIinLookupCompleteListener> listeners = new ArrayList<>(1);
Listener listener = new Listener(waitForAsyncCallBack);
listeners.add(listener);
IinLookupAsyncTask iinLookupAsyncTask = new IinLookupAsyncTask(getContext(), // Number that is too short
"1", getCommunicator(), listeners, minimalValidPaymentContext);
iinLookupAsyncTask.execute();
// Test that the IinLookup returns with status NOT_ENOUGH_DIGITS wiithin 'ASYNCTASK_CALLBACK_TEST_TIMEOUT_SEC' seconds
assertTrue(waitForAsyncCallBack.await(ASYNCTASK_CALLBACK_TEST_TIMEOUT_SEC, TimeUnit.SECONDS));
// Retrieve the response from the callback and validate its status
IinDetailsResponse iinDetailsResponse = listener.getIinDetailsResponse();
validateResponseStatusNOT_ENOUGH_DIGITS(iinDetailsResponse);
}
use of com.globalcollect.gateway.sdk.client.android.sdk.model.iin.IinDetailsResponse in project connect-sdk-client-android by Ingenico-ePayments.
the class GetIinDetailsAsyncTaskTest method testGetIinDetailsAsyncTaskSUPPORTEDWithValidRequest.
@Test
public void testGetIinDetailsAsyncTaskSUPPORTEDWithValidRequest() throws InterruptedException, CommunicationException {
initializeValidMocksAndSession();
final CountDownLatch waitForAsyncTaskCallBack = new CountDownLatch(1);
// Create the IinLookupAsyncTask and then begin the test by calling execute.
List<IinLookupAsyncTask.OnIinLookupCompleteListener> listeners = new ArrayList<>(1);
Listener listener = new Listener(waitForAsyncTaskCallBack);
listeners.add(listener);
IinLookupAsyncTask iinLookupAsyncTask = new IinLookupAsyncTask(getContext(), // Visa number
"401200", getCommunicator(), listeners, minimalValidPaymentContext);
iinLookupAsyncTask.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 iin details response from the listener
IinDetailsResponse iinDetailsResponse = listener.getIinDetailsResponse();
validateResponseStatusSUPPORTED(iinDetailsResponse);
}
Aggregations