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.

Pencepay_Request_CustomerSearch::build()
    ->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

Pencepay_Request_TransactionSearch::build()
        ->ids()->is('5123335')
        ->status()->in(array('AUTHORIZED', 'DECLINED'));

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.

Pencepay_Request_TransactionSearch::build()
    ->amount()->between('10.99', '20.99')
    ->created()->greaterThanOrEqualTo('1417691085')
    ->created()->lessThanOrEqualTo('1417697085')
    ->created()->between('1417691085', '1417697085');

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