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"));
}
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"));
}
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();
}
}
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);
}
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);
}
Aggregations