Search in sources :

Example 1 with 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 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();
    }
}
Also used : PreparedPaymentRequest(com.globalcollect.gateway.sdk.client.android.sdk.model.PreparedPaymentRequest) CommunicationException(com.globalcollect.gateway.sdk.client.android.sdk.exception.CommunicationException) PreparedPaymentRequest(com.globalcollect.gateway.sdk.client.android.sdk.model.PreparedPaymentRequest) CreatePaymentRequest(com.ingenico.connect.gateway.sdk.java.domain.payment.CreatePaymentRequest) PaymentRequest(com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentRequest) CountDownLatch(java.util.concurrent.CountDownLatch) Test(org.junit.Test)

Example 2 with 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 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);
}
Also used : PreparedPaymentRequest(com.globalcollect.gateway.sdk.client.android.sdk.model.PreparedPaymentRequest) PreparedPaymentRequest(com.globalcollect.gateway.sdk.client.android.sdk.model.PreparedPaymentRequest) CreatePaymentRequest(com.ingenico.connect.gateway.sdk.java.domain.payment.CreatePaymentRequest) PaymentRequest(com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentRequest) CountDownLatch(java.util.concurrent.CountDownLatch) Test(org.junit.Test)

Example 3 with 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);
}
Also used : PreparedPaymentRequest(com.globalcollect.gateway.sdk.client.android.sdk.model.PreparedPaymentRequest) PreparedPaymentRequest(com.globalcollect.gateway.sdk.client.android.sdk.model.PreparedPaymentRequest) CreatePaymentRequest(com.ingenico.connect.gateway.sdk.java.domain.payment.CreatePaymentRequest) PaymentRequest(com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentRequest) CountDownLatch(java.util.concurrent.CountDownLatch) Test(org.junit.Test)

Aggregations

PaymentRequest (com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentRequest)3 PreparedPaymentRequest (com.globalcollect.gateway.sdk.client.android.sdk.model.PreparedPaymentRequest)3 CreatePaymentRequest (com.ingenico.connect.gateway.sdk.java.domain.payment.CreatePaymentRequest)3 CountDownLatch (java.util.concurrent.CountDownLatch)3 Test (org.junit.Test)3 CommunicationException (com.globalcollect.gateway.sdk.client.android.sdk.exception.CommunicationException)1