Beispiel #1
0
 /**
  * Load recurring profile
  *
  * @return Mage_Sales_Model_Recurring_Profile
  * @throws Exception
  */
 protected function _getRecurringProfile()
 {
     if (empty($this->_recurringProfile)) {
         // get proper recurring profile
         $internalReferenceId = $this->_request['rp_invoice_id'];
         $this->_recurringProfile = Mage::getModel('sales/recurring_profile')->loadByInternalReferenceId($internalReferenceId);
         if (!$this->_recurringProfile->getId()) {
             throw new Exception(sprintf('Wrong recurring profile INTERNAL_REFERENCE_ID: "%s".', $internalReferenceId));
         }
         // re-initialize config with the method code and store id
         $methodCode = $this->_recurringProfile->getMethodCode();
         $this->_config = Mage::getModel('paypal/config', array($methodCode, $this->_recurringProfile->getStoreId()));
         if (!$this->_config->isMethodActive($methodCode) || !$this->_config->isMethodAvailable()) {
             throw new Exception(sprintf('Method "%s" is not available.', $methodCode));
         }
     }
     return $this->_recurringProfile;
 }