Search in sources :

Example 16 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 testInValidRegex.

@Test
public void testInValidRegex() {
    PaymentRequest paymentRequest = new TestPaymentRequest();
    paymentRequest.setValue("regex", invalidRegex);
    ValidationRuleRegex rule = new ValidationRuleRegex(regex, "", ValidationType.RANGE);
    assertEquals(false, 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 17 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 testValidRange.

// Test range validator
@Test
public void testValidRange() {
    PaymentRequest paymentRequest = new TestPaymentRequest();
    paymentRequest.setValue("range", validRange);
    ValidationRuleRange rule = new ValidationRuleRange(minLength, maxLength, "", ValidationType.RANGE);
    assertEquals(true, 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)

Example 18 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 testInvalidFixedList.

@Test
public void testInvalidFixedList() {
    PaymentRequest paymentRequest = new TestPaymentRequest();
    paymentRequest.setValue("fixedList", invalidListOption);
    ValidationRuleFixedList rule = new ValidationRuleFixedList(listEntries, "", ValidationType.FIXEDLIST);
    assertEquals(false, rule.validate(paymentRequest, "fixedList"));
}
Also used : PaymentRequest(com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentRequest) ValidationRuleFixedList(com.globalcollect.gateway.sdk.client.android.sdk.model.validation.ValidationRuleFixedList) Test(org.junit.Test)

Example 19 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 testValidLuhn.

// Test luhn validator
@Test
public void testValidLuhn() {
    PaymentRequest paymentRequest = new TestPaymentRequest();
    paymentRequest.setValue("luhn", validLuhnCheck);
    ValidationRuleLuhn rule = new ValidationRuleLuhn("", ValidationType.LUHN);
    assertEquals(true, rule.validate(paymentRequest, "luhn"));
}
Also used : PaymentRequest(com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentRequest) ValidationRuleLuhn(com.globalcollect.gateway.sdk.client.android.sdk.model.validation.ValidationRuleLuhn) Test(org.junit.Test)

Example 20 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 testValidLength.

// Test length validator
@Test
public void testValidLength() {
    PaymentRequest paymentRequest = new TestPaymentRequest();
    paymentRequest.setValue("length", validLength);
    ValidationRuleLength rule = new ValidationRuleLength(minLength, maxLength, "", ValidationType.LENGTH);
    assertEquals(true, rule.validate(paymentRequest, "length"));
}
Also used : ValidationRuleLength(com.globalcollect.gateway.sdk.client.android.sdk.model.validation.ValidationRuleLength) PaymentRequest(com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentRequest) 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