/**
  * Validate IPN Message
  * PayPal provides a simple solution for notifying us when a payment has been processed;
  * they call it Instant Payment Notifications (IPN). In order to take advantage of IPN,
  * we create an IPN listener for our application (see https://github.com/Quixotix/PHP-PayPal-IPN).
  * See also https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/
  * @return boolean whether ipn was validates
  */
 public function validateIPN()
 {
     $listener = new IpnListener();
     $listener->use_sandbox = !$this->apiLive;
     if ($listener->processIpn()) {
         if (Yii::app()->request->getPost('receiver_email') != $this->receiverEmail) {
             $this->errorCode = self::ERROR_PROCESS_IPN;
             $this->errorMessage = 'PayPal recurring payment receiver email mismatch';
             return false;
         } else {
             return true;
         }
     } else {
         $this->errorCode = self::ERROR_VERIFY_IPN;
         $this->errorMessage = var_export($listener->getErrors(), true);
         return false;
     }
 }