use of com.globalcollect.gateway.sdk.client.android.sdk.model.PreparedPaymentRequest in project connect-sdk-client-android by Ingenico-ePayments.
the class GcSessionPreparePaymentRequestTest method testGetPreparedPaymentRequestWithAccountOnFileAndValidRequest.
@Test
public void testGetPreparedPaymentRequestWithAccountOnFileAndValidRequest() throws InterruptedException {
try {
initializeValidGcSessionMocksAndSessionWithToken();
CountDownLatch waitForAsyncCallBack = new CountDownLatch(1);
PaymentRequest paymentRequest = constructValidPaymentRequest(true, false);
Listener listener = new Listener(waitForAsyncCallBack);
getSession().preparePaymentRequest(paymentRequest, getContext(), listener);
// Test that the request is prepared within 'PREPAREPAYMENTREQUEST_CALLBACK_TEST_TIMEOUT_SEC' seconds
assertTrue(waitForAsyncCallBack.await(PREPAREPAYMENTREQUEST_CALLBACK_TEST_TIMEOUT_SEC, TimeUnit.SECONDS));
PreparedPaymentRequest preparedPaymentRequest = listener.getPreparedPaymentRequest();
// Test that the encrypted blob that will be used for the payment has been created successfully
validateValidPreparedPaymentRequest(preparedPaymentRequest);
} catch (CommunicationException e) {
e.printStackTrace();
} finally {
deleteToken();
}
}
use of com.globalcollect.gateway.sdk.client.android.sdk.model.PreparedPaymentRequest in project connect-sdk-client-android by Ingenico-ePayments.
the class GcSessionPreparePaymentRequestTest method testGetPreparedPaymentRequestWithValidRequest.
@Test
public void testGetPreparedPaymentRequestWithValidRequest() throws InterruptedException, CommunicationException {
initializeValidGcSessionMocksAndSession();
CountDownLatch waitForAsyncCallBack = new CountDownLatch(1);
PaymentRequest paymentRequest = constructValidPaymentRequest(false, false);
Listener listener = new Listener(waitForAsyncCallBack);
getSession().preparePaymentRequest(paymentRequest, getContext(), listener);
// Test that the request is prepared within 'PREPAREPAYMENTREQUEST_CALLBACK_TEST_TIMEOUT_SEC' seconds
assertTrue(waitForAsyncCallBack.await(PREPAREPAYMENTREQUEST_CALLBACK_TEST_TIMEOUT_SEC, TimeUnit.SECONDS));
PreparedPaymentRequest preparedPaymentRequest = listener.getPreparedPaymentRequest();
// Test that the encrypted blob that will be used for the payment has been created successfully
validateValidPreparedPaymentRequest(preparedPaymentRequest);
}
use of com.globalcollect.gateway.sdk.client.android.sdk.model.PreparedPaymentRequest in project connect-sdk-client-android by Ingenico-ePayments.
the class GcSessionPreparePaymentRequestTest method testGetPreparedPaymentRequestWithCreatingTokenAndValidRequest.
@Test
public void testGetPreparedPaymentRequestWithCreatingTokenAndValidRequest() throws InterruptedException, CommunicationException {
initializeValidGcSessionMocksAndSession();
CountDownLatch waitForAsyncCallBack = new CountDownLatch(1);
PaymentRequest paymentRequest = constructValidPaymentRequest(false, true);
Listener listener = new Listener(waitForAsyncCallBack);
getSession().preparePaymentRequest(paymentRequest, getContext(), listener);
// Test that the request is prepared within 'PREPAREPAYMENTREQUEST_CALLBACK_TEST_TIMEOUT_SEC' seconds
assertTrue(waitForAsyncCallBack.await(PREPAREPAYMENTREQUEST_CALLBACK_TEST_TIMEOUT_SEC, TimeUnit.SECONDS));
PreparedPaymentRequest preparedPaymentRequest = listener.getPreparedPaymentRequest();
// Test that the encrypted blob that will be used for the payment has been created successfully
validateValidPreparedPaymentRequestTokenization(preparedPaymentRequest);
}
Aggregations