You are here

public function PayPalPaymentIPNWebTestCase::IPNExists in PayPal for Payment 7

Checks if an IPN exists in the database.

Parameters

PayPalPaymentIPN $ipn:

Return value

bool

1 call to PayPalPaymentIPNWebTestCase::IPNExists()
PayPalPaymentIPNControllerTest::testSave in paypal_payment_ipn/tests/PayPalPaymentIPNControllerTest.test
Tests save().

File

paypal_payment_ipn/tests/PayPalPaymentIPNWebTestCase.test, line 44
Contains \PayPalPaymentIPNWebTestCase.

Class

PayPalPaymentIPNWebTestCase
Contains testing helpers.

Code

public function IPNExists(PayPalPaymentIPN $ipn) {
  $query = db_select('paypal_payment_ipn', 'mpi');
  foreach (get_object_vars($ipn) as $property => $value) {
    if (property_exists(get_class($ipn), $property)) {
      $query
        ->condition($property, $value);
    }
  }
  $count = $query
    ->countQuery()
    ->execute()
    ->fetchField();
  return (bool) $count;
}