Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Payment_Block_Catalog_Product_View_Profile
  • Mage_Payment_Block_Form
  • Mage_Payment_Block_Form_Banktransfer
  • Mage_Payment_Block_Form_Cashondelivery
  • Mage_Payment_Block_Form_Cc
  • Mage_Payment_Block_Form_Ccsave
  • Mage_Payment_Block_Form_Checkmo
  • Mage_Payment_Block_Form_Container
  • Mage_Payment_Block_Form_Purchaseorder
  • Mage_Payment_Block_Info
  • Mage_Payment_Block_Info_Banktransfer
  • Mage_Payment_Block_Info_Cc
  • Mage_Payment_Block_Info_Ccsave
  • Mage_Payment_Block_Info_Checkmo
  • Mage_Payment_Block_Info_Container
  • Mage_Payment_Block_Info_Purchaseorder
  • Mage_Payment_Helper_Data
  • Mage_Payment_Model_Billing_AgreementAbstract
  • Mage_Payment_Model_Config
  • Mage_Payment_Model_Info
  • Mage_Payment_Model_Method_Abstract
  • Mage_Payment_Model_Method_Banktransfer
  • Mage_Payment_Model_Method_Cashondelivery
  • Mage_Payment_Model_Method_Cc
  • Mage_Payment_Model_Method_Ccsave
  • Mage_Payment_Model_Method_Checkmo
  • Mage_Payment_Model_Method_Free
  • Mage_Payment_Model_Method_Purchaseorder
  • Mage_Payment_Model_Observer
  • Mage_Payment_Model_Paygate_Result
  • Mage_Payment_Model_Recurring_Profile
  • Mage_Payment_Model_Source_Cctype
  • Mage_Payment_Model_Source_Invoice

Interfaces

  • Mage_Payment_Model_Billing_Agreement_MethodInterface
  • Mage_Payment_Model_Recurring_Profile_MethodInterface

Exceptions

  • Mage_Payment_Exception
  • Mage_Payment_Model_Info_Exception
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_Payment
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: /**
 28:  * Payment information model
 29:  *
 30:  * @category   Mage
 31:  * @package    Mage_Payment
 32:  * @author      Magento Core Team <core@magentocommerce.com>
 33:  */
 34: class Mage_Payment_Model_Info extends Mage_Core_Model_Abstract
 35: {
 36:     /**
 37:      * Additional information container
 38:      *
 39:      * @var array
 40:      */
 41:     protected $_additionalInformation = -1;
 42: 
 43:     /**
 44:      * Retrieve data
 45:      *
 46:      * @param   string $key
 47:      * @param   mixed $index
 48:      * @return unknown
 49:      */
 50:     public function getData($key='', $index=null)
 51:     {
 52:         if ('cc_number'===$key) {
 53:             if (empty($this->_data['cc_number']) && !empty($this->_data['cc_number_enc'])) {
 54:                 $this->_data['cc_number'] = $this->decrypt($this->getCcNumberEnc());
 55:             }
 56:         }
 57:         if ('cc_cid'===$key) {
 58:             if (empty($this->_data['cc_cid']) && !empty($this->_data['cc_cid_enc'])) {
 59:                 $this->_data['cc_cid'] = $this->decrypt($this->getCcCidEnc());
 60:             }
 61:         }
 62:         return parent::getData($key, $index);
 63:     }
 64: 
 65:     /**
 66:      * Retrieve payment method model object
 67:      *
 68:      * @return Mage_Payment_Model_Method_Abstract
 69:      * @throws Mage_Core_Exception
 70:      */
 71:     public function getMethodInstance()
 72:     {
 73:         if (!$this->hasMethodInstance()) {
 74:             if ($this->getMethod()) {
 75:                 $instance = Mage::helper('payment')->getMethodInstance($this->getMethod());
 76:                 if ($instance) {
 77:                     $instance->setInfoInstance($this);
 78:                     $this->setMethodInstance($instance);
 79:                     return $instance;
 80:                 }
 81:             }
 82:             Mage::throwException(Mage::helper('payment')->__('The requested Payment Method is not available.'));
 83:         }
 84: 
 85:         return $this->_getData('method_instance');
 86:     }
 87: 
 88:     /**
 89:      * Encrypt data
 90:      *
 91:      * @param   string $data
 92:      * @return  string
 93:      */
 94:     public function encrypt($data)
 95:     {
 96:         if ($data) {
 97:             return Mage::helper('core')->encrypt($data);
 98:         }
 99:         return $data;
100:     }
101: 
102:     /**
103:      * Decrypt data
104:      *
105:      * @param   string $data
106:      * @return  string
107:      */
108:     public function decrypt($data)
109:     {
110:         if ($data) {
111:             return Mage::helper('core')->decrypt($data);
112:         }
113:         return $data;
114:     }
115: 
116:     /**
117:      * Additional information setter
118:      * Updates data inside the 'additional_information' array
119:      * or all 'additional_information' if key is data array
120:      *
121:      * @param string|array $key
122:      * @param mixed $value
123:      * @return Mage_Payment_Model_Info
124:      * @throws Mage_Core_Exception
125:      */
126:     public function setAdditionalInformation($key, $value = null)
127:     {
128:         if (is_object($value)) {
129:             Mage::throwException(Mage::helper('sales')->__('Payment disallow storing objects.'));
130:         }
131:         $this->_initAdditionalInformation();
132:         if (is_array($key) && is_null($value)) {
133:             $this->_additionalInformation = $key;
134:         } else {
135:             $this->_additionalInformation[$key] = $value;
136:         }
137:         return $this->setData('additional_information', $this->_additionalInformation);
138:     }
139: 
140:     /**
141:      * Getter for entire additional_information value or one of its element by key
142:      *
143:      * @param string $key
144:      * @return array|null|mixed
145:      */
146:     public function getAdditionalInformation($key = null)
147:     {
148:         $this->_initAdditionalInformation();
149:         if (null === $key) {
150:             return $this->_additionalInformation;
151:         }
152:         return isset($this->_additionalInformation[$key]) ? $this->_additionalInformation[$key] : null;
153:     }
154: 
155:     /**
156:      * Unsetter for entire additional_information value or one of its element by key
157:      *
158:      * @param string $key
159:      * @return Mage_Payment_Model_Info
160:      */
161:     public function unsAdditionalInformation($key = null)
162:     {
163:         if ($key && isset($this->_additionalInformation[$key])) {
164:             unset($this->_additionalInformation[$key]);
165:             return $this->setData('additional_information', $this->_additionalInformation);
166:         }
167:         $this->_additionalInformation = -1;
168:         return $this->unsetData('additional_information');
169:     }
170: 
171:     /**
172:      * Check whether there is additional information by specified key
173:      *
174:      * @param $key
175:      * @return bool
176:      */
177:     public function hasAdditionalInformation($key = null)
178:     {
179:         $this->_initAdditionalInformation();
180:         return null === $key
181:             ? !empty($this->_additionalInformation)
182:             : array_key_exists($key, $this->_additionalInformation);
183:     }
184: 
185:     /**
186:      * Make sure _additionalInformation is an array
187:      */
188:     protected function _initAdditionalInformation()
189:     {
190:         if (-1 === $this->_additionalInformation) {
191:             $this->_additionalInformation = $this->_getData('additional_information');
192:         }
193:         if (null === $this->_additionalInformation) {
194:             $this->_additionalInformation = array();
195:         }
196:     }
197: }
198: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0