/**
  * Decrypt value after loading
  * If no value present, do not  decrypt!
  */
 protected function _afterLoad()
 {
     $value = (string) $this->getValue();
     if ($value) {
         parent::_afterLoad();
     }
 }
Exemple #2
0
 /**
  * @return Mage_Core_Model_Abstract|void
  */
 public function save()
 {
     $api_key = $this->getValue();
     $responseJson = $this->testQuote($api_key);
     if (!isset($responseJson->status)) {
         $helper = Mage::helper('intelipost');
         // Mage::getSingleton('core/session')->addWarning($helper->__('Invalid ApiUrl/ApiKey combination'));
         Mage::throwException($helper->__('Invalid ApiUrl/ApiKey combination'));
     }
     parent::save();
 }
 /**
  * Decrypt and test current saved token
  */
 public function _afterSave()
 {
     $token = Mage::helper('core')->decrypt($this->getValue());
     if (!empty($token) && $token != $this->getOldValue()) {
         $valid = $this->testToken($this->getFieldsetDataValue('merchant_email'), $token);
         if ($valid !== true) {
             Mage::getSingleton('core/session')->addWarning($valid);
         }
     }
     parent::_afterSave();
 }
 /**
  * Prepare data before save
  * 
  * If field does not have value and method is enabled throw exception
  */
 protected function _beforeSave()
 {
     if (!$this->getValue() && $this->isValueChanged()) {
         $data = $this->getData();
         foreach ($this->_activeField as $field) {
             $fieldData = $data['groups']['braintree']['fields'][$field];
             if (isset($fieldData['value']) && $fieldData['value'] || isset($fieldData['inherit']) && $fieldData['inherit'] && (string) Mage::getConfig()->getNode('default/payment/braintree/' . $field)) {
                 if (strpos($field, 'paypal') !== false) {
                     $methodName = 'PayPal';
                 } else {
                     $methodName = 'Credit Card';
                 }
                 Mage::throwException(Mage::helper('braintree_payments')->__('The following fields are required to be completed to save the configuration: ' . 'Merchant ID, Merchant Account ID, Public Key and Private Key. No changes were saved'));
             }
         }
     }
     parent::_beforeSave();
 }
Exemple #5
0
 public function save()
 {
     $useraccount = $this->getValue();
     parent::save();
 }
 /**
  * Modified to return $this
  *
  * @return $this
  */
 public function afterLoad()
 {
     parent::afterLoad();
     return $this;
 }
Exemple #7
0
 public function save()
 {
     $token = $this->getValue();
     parent::save();
 }
Exemple #8
0
 public function save()
 {
     $password = $this->getValue();
     parent::save();
 }
Exemple #9
0
 public function save()
 {
     $api_url = $this->getValue();
     parent::save();
 }