Search in sources :

Example 1 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 testValidEmailAddress.

// Test emailaddress validator
@Test
public void testValidEmailAddress() {
    PaymentRequest paymentRequest = new TestPaymentRequest();
    paymentRequest.setValue("emailAddress", emailAddressValid);
    ValidationRuleEmailAddress rule = new ValidationRuleEmailAddress("", ValidationType.EMAILADDRESS);
    assertEquals(true, rule.validate(paymentRequest, "emailAddress"));
}
Also used : PaymentRequest(com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentRequest) ValidationRuleEmailAddress(com.globalcollect.gateway.sdk.client.android.sdk.model.validation.ValidationRuleEmailAddress) Test(org.junit.Test)

Example 2 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 testInValidTermsAndConditions.

@Test
public void testInValidTermsAndConditions() {
    PaymentRequest paymentRequest = new TestPaymentRequest();
    paymentRequest.setValue("termsAndConditions", "test");
    ValidationRuleTermsAndConditions rule = new ValidationRuleTermsAndConditions("", ValidationType.TERMSANDCONDITIONS);
    assertEquals(false, 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 3 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 testInvalidExpirationDate.

@Test
public void testInvalidExpirationDate() {
    PaymentRequest paymentRequest = new TestPaymentRequest();
    paymentRequest.setValue("expirationDate", expirationDateInvalid);
    ValidationRuleExpirationDate rule = new ValidationRuleExpirationDate("", ValidationType.EXPIRATIONDATE);
    assertEquals(false, rule.validate(paymentRequest, "expirationDate"));
}
Also used : PaymentRequest(com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentRequest) ValidationRuleExpirationDate(com.globalcollect.gateway.sdk.client.android.sdk.model.validation.ValidationRuleExpirationDate) Test(org.junit.Test)

Example 4 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 testValidExpirationDate.

// Test expirationdate validator
@Test
public void testValidExpirationDate() {
    PaymentRequest paymentRequest = new TestPaymentRequest();
    paymentRequest.setValue("expirationDate", expirationDateValid);
    ValidationRuleExpirationDate rule = new ValidationRuleExpirationDate("", ValidationType.EXPIRATIONDATE);
    assertEquals(true, rule.validate(paymentRequest, "expirationDate"));
}
Also used : PaymentRequest(com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentRequest) ValidationRuleExpirationDate(com.globalcollect.gateway.sdk.client.android.sdk.model.validation.ValidationRuleExpirationDate) Test(org.junit.Test)

Example 5 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 testInvalidRange.

@Test
public void testInvalidRange() {
    PaymentRequest paymentRequest = new TestPaymentRequest();
    paymentRequest.setValue("range", invalidRange);
    ValidationRuleRange rule = new ValidationRuleRange(minLength, maxLength, "", ValidationType.RANGE);
    assertEquals(false, rule.validate(paymentRequest, "range"));
}
Also used : PaymentRequest(com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentRequest) ValidationRuleRange(com.globalcollect.gateway.sdk.client.android.sdk.model.validation.ValidationRuleRange) 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