You are here

public static function PayPalPaymentIPNController::validate in PayPal for Payment 7

Validates the contents of IPN variables.

Parameters

array $ipn_variables:

Return value

boolean

3 calls to PayPalPaymentIPNController::validate()
PayPalPaymentIPNControllerTest::testValidate in paypal_payment_ipn/tests/PayPalPaymentIPNControllerTest.test
Tests validate().
paypal_payment_ipn_post in paypal_payment_ipn/paypal_payment_ipn.module
Processes an IPN request based on POST data.
paypal_payment_pps_return in paypal_payment_pps/paypal_payment_pps.module
Return callback.

File

paypal_payment_ipn/includes/PayPalPaymentIPNController.inc, line 141

Class

PayPalPaymentIPNController
Provides IPN functionality.

Code

public static function validate(array $ipn_variables) {

  // Only process IPNs for which we have a payment.
  if (isset($ipn_variables['invoice']) && ($pid = self::PID($ipn_variables['invoice']))) {
    if ($payment = entity_load_single('payment', $pid)) {

      // Allow payment method controllers to completely take over validation.
      if ($payment->method->controller instanceof PayPalPaymentIPNPaymentMethodControllerInterface) {
        return $payment->method->controller
          ->PayPalValidateIPNVariables($payment, $ipn_variables);
      }
      else {
        return TRUE;
      }
    }
  }
  return FALSE;
}