Search in sources :

Example 6 with PaymentRequest

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

the class ValidationTest method testValidRegex.

// Test regex validator
@Test
public void testValidRegex() {
    PaymentRequest paymentRequest = new TestPaymentRequest();
    paymentRequest.setValue("regex", validRegex);
    ValidationRuleRegex rule = new ValidationRuleRegex(regex, "", ValidationType.RANGE);
    assertEquals(true, rule.validate(paymentRequest, "regex"));
}
Also used : ValidationRuleRegex(com.globalcollect.gateway.sdk.client.android.sdk.model.validation.ValidationRuleRegex) PaymentRequest(com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentRequest) Test(org.junit.Test)

Example 7 with PaymentRequest

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

the class ValidationTest method testValidTermsAndConditions.

// Test terms and conditions validator
@Test
public void testValidTermsAndConditions() {
    PaymentRequest paymentRequest = new TestPaymentRequest();
    paymentRequest.setValue("termsAndConditions", Boolean.TRUE.toString());
    ValidationRuleTermsAndConditions rule = new ValidationRuleTermsAndConditions("", ValidationType.TERMSANDCONDITIONS);
    assertEquals(true, rule.validate(paymentRequest, "termsAndConditions"));
}
Also used : PaymentRequest(com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentRequest) ValidationRuleTermsAndConditions(com.globalcollect.gateway.sdk.client.android.sdk.model.validation.ValidationRuleTermsAndConditions) Test(org.junit.Test)

Example 8 with PaymentRequest

use of com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentRequest 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 9 with PaymentRequest

use of com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentRequest 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 10 with PaymentRequest

use of com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentRequest 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)21 Test (org.junit.Test)19 PreparedPaymentRequest (com.globalcollect.gateway.sdk.client.android.sdk.model.PreparedPaymentRequest)4 CreatePaymentRequest (com.ingenico.connect.gateway.sdk.java.domain.payment.CreatePaymentRequest)4 CountDownLatch (java.util.concurrent.CountDownLatch)3 ValidationRuleEmailAddress (com.globalcollect.gateway.sdk.client.android.sdk.model.validation.ValidationRuleEmailAddress)2 ValidationRuleExpirationDate (com.globalcollect.gateway.sdk.client.android.sdk.model.validation.ValidationRuleExpirationDate)2 ValidationRuleFixedList (com.globalcollect.gateway.sdk.client.android.sdk.model.validation.ValidationRuleFixedList)2 ValidationRuleLength (com.globalcollect.gateway.sdk.client.android.sdk.model.validation.ValidationRuleLength)2 ValidationRuleLuhn (com.globalcollect.gateway.sdk.client.android.sdk.model.validation.ValidationRuleLuhn)2 ValidationRuleRange (com.globalcollect.gateway.sdk.client.android.sdk.model.validation.ValidationRuleRange)2 ValidationRuleRegex (com.globalcollect.gateway.sdk.client.android.sdk.model.validation.ValidationRuleRegex)2 ValidationRuleTermsAndConditions (com.globalcollect.gateway.sdk.client.android.sdk.model.validation.ValidationRuleTermsAndConditions)2 CommunicationException (com.globalcollect.gateway.sdk.client.android.sdk.exception.CommunicationException)1 PaymentProduct (com.globalcollect.gateway.sdk.client.android.sdk.model.paymentproduct.PaymentProduct)1 MaskedWallet (com.google.android.gms.wallet.MaskedWallet)1