/** * check eway active, check whether method code is eway */ protected function _checkRecurringProfile() { $methodCode = $this->_recurringProfile->getMethodCode(); if ($methodCode != 'ewayrapid_saved') { throw new Exception(sprintf('Method "%s" is not eWAY Rapid (Saved).', $methodCode)); } if (!Mage::helper('ewayrapid')->isSavedMethodEnabled()) { throw new Exception(sprintf('Method "%s" is not available.', $methodCode)); } }
/** * 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; }