Search operators

Advanced searching of gateway objects is possible through the use of various search operators. This means that you can test objects not just for equality with is, but can also check if the string property contains some data or if the timestamp is between the given limit.

Full overview of supported operators follows. We have tried to develop our Libraries in a way that fluent interfaces are available for building the SearchRequest objects, so that you have the full support of your IDE and don't need to lookup the documentation too much when developing.

String operators

Each string property of a gateway object can be searched with the is, isNot, startWith, endsWith and contains operators.

CustomerSearchRequest search = new CustomerSearchRequest()
    .firstName().is("Johnny")
    .firstName().startsWith("Jo")
    .firstName().endsWith("ny")
    .firstName().contains("hnn");

You can use multiple string operators on the same field at the same time, e.g. startWith and contains.

Simple searches with the is operator can be done on non-string object properties as well, e.g. check if amount equals a value with is.

List operators

TransactionSearchRequest search = new TransactionSearchRequest()
    .status().is(Transaction.Status.AUTHORIZED)
    .paymentMethod().in(
            Transaction.PaymentMethodType.VISA,
            Transaction.PaymentMethodType.BANK_TRANSFER);

Operators is and in are used to search for single or multiple items in a list.

Range operators

Operators between, greaterThanOrEqual and in are used to search for values in the given constraints, typically for amounts and timestamps.

TransactionSearchRequest search = new TransactionSearchRequest()
    .amount().between(new BigDecimal("1"), new BigDecimal("10"))
    .created().greaterThanOrEqual(1417691085L)
    .created().lessThanOrEqual(1417697085L)
    .created().between(1417691085L, 1417697085L);

When searching based on timestamp properties, use timestamps based on seconds since Epoch (not miliseconds, as is default in some languages).