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_Paypal_Adminhtml_Paypal_ReportsController
  • Mage_Paypal_Block_Adminhtml_Settlement_Details
  • Mage_Paypal_Block_Adminhtml_Settlement_Details_Form
  • Mage_Paypal_Block_Adminhtml_Settlement_Report
  • Mage_Paypal_Block_Adminhtml_Settlement_Report_Grid
  • Mage_Paypal_Block_Adminhtml_System_Config_ApiWizard
  • Mage_Paypal_Block_Adminhtml_System_Config_Field_Country
  • Mage_Paypal_Block_Adminhtml_System_Config_Field_Hidden
  • Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Expanded
  • Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Group
  • Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Hint
  • Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Location
  • Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Payment
  • Mage_Paypal_Block_Adminhtml_System_Config_Fieldset_Store
  • Mage_Paypal_Block_Adminhtml_System_Config_Payflowlink_Advanced
  • Mage_Paypal_Block_Adminhtml_System_Config_Payflowlink_Info
  • Mage_Paypal_Block_Express_Form
  • Mage_Paypal_Block_Express_Review
  • Mage_Paypal_Block_Express_Review_Billing
  • Mage_Paypal_Block_Express_Review_Details
  • Mage_Paypal_Block_Express_Review_Shipping
  • Mage_Paypal_Block_Express_Shortcut
  • Mage_Paypal_Block_Hosted_Pro_Form
  • Mage_Paypal_Block_Hosted_Pro_Iframe
  • Mage_Paypal_Block_Hosted_Pro_Info
  • Mage_Paypal_Block_Iframe
  • Mage_Paypal_Block_Logo
  • Mage_Paypal_Block_Payflow_Advanced_Form
  • Mage_Paypal_Block_Payflow_Advanced_Iframe
  • Mage_Paypal_Block_Payflow_Advanced_Info
  • Mage_Paypal_Block_Payflow_Link_Form
  • Mage_Paypal_Block_Payflow_Link_Iframe
  • Mage_Paypal_Block_Payflow_Link_Info
  • Mage_Paypal_Block_Payment_Info
  • Mage_Paypal_Block_Standard_Form
  • Mage_Paypal_Block_Standard_Redirect
  • Mage_Paypal_Controller_Express_Abstract
  • Mage_Paypal_ExpressController
  • Mage_Paypal_Helper_Data
  • Mage_Paypal_Helper_Hss
  • Mage_Paypal_HostedproController
  • Mage_Paypal_IpnController
  • Mage_Paypal_Model_Api_Abstract
  • Mage_Paypal_Model_Api_Nvp
  • Mage_Paypal_Model_Api_Standard
  • Mage_Paypal_Model_Cart
  • Mage_Paypal_Model_Cert
  • Mage_Paypal_Model_Config
  • Mage_Paypal_Model_Direct
  • Mage_Paypal_Model_Express
  • Mage_Paypal_Model_Express_Checkout
  • Mage_Paypal_Model_Hostedpro
  • Mage_Paypal_Model_Hostedpro_Request
  • Mage_Paypal_Model_Info
  • Mage_Paypal_Model_Ipn
  • Mage_Paypal_Model_Method_Agreement
  • Mage_Paypal_Model_Mysql4_Cert
  • Mage_Paypal_Model_Mysql4_Report_Settlement
  • Mage_Paypal_Model_Mysql4_Report_Settlement_Row
  • Mage_Paypal_Model_Mysql4_Report_Settlement_Row_Collection
  • Mage_Paypal_Model_Mysql4_Setup
  • Mage_Paypal_Model_Observer
  • Mage_Paypal_Model_Payflow_Request
  • Mage_Paypal_Model_Payflowadvanced
  • Mage_Paypal_Model_Payflowlink
  • Mage_Paypal_Model_Payflowpro
  • Mage_Paypal_Model_Payment_Transaction
  • Mage_Paypal_Model_Pro
  • Mage_Paypal_Model_Report_Settlement
  • Mage_Paypal_Model_Report_Settlement_Row
  • Mage_Paypal_Model_Resource_Cert
  • Mage_Paypal_Model_Resource_Report_Settlement
  • Mage_Paypal_Model_Resource_Report_Settlement_Row
  • Mage_Paypal_Model_Resource_Report_Settlement_Row_Collection
  • Mage_Paypal_Model_Resource_Setup
  • Mage_Paypal_Model_Session
  • Mage_Paypal_Model_Standard
  • Mage_Paypal_Model_System_Config_Backend_Cert
  • Mage_Paypal_Model_System_Config_Backend_Cron
  • Mage_Paypal_Model_System_Config_Backend_MerchantCountry
  • Mage_Paypal_Model_System_Config_Source_BuyerCountry
  • Mage_Paypal_Model_System_Config_Source_FetchingSchedule
  • Mage_Paypal_Model_System_Config_Source_Logo
  • Mage_Paypal_Model_System_Config_Source_MerchantCountry
  • Mage_Paypal_Model_System_Config_Source_PaymentActions
  • Mage_Paypal_Model_System_Config_Source_PaymentActions_Express
  • Mage_Paypal_Model_System_Config_Source_RequireBillingAddress
  • Mage_Paypal_Model_System_Config_Source_UrlMethod
  • Mage_Paypal_PayflowadvancedController
  • Mage_Paypal_PayflowController
  • Mage_Paypal_StandardController

Exceptions

  • Mage_Paypal_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_Paypal
 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:  *
 29:  * PayPal Standard Checkout Module
 30:  *
 31:  * @author      Magento Core Team <core@magentocommerce.com>
 32:  */
 33: class Mage_Paypal_Model_Standard extends Mage_Payment_Model_Method_Abstract
 34: {
 35:     protected $_code  = Mage_Paypal_Model_Config::METHOD_WPS;
 36:     protected $_formBlockType = 'paypal/standard_form';
 37:     protected $_infoBlockType = 'paypal/payment_info';
 38:     protected $_isInitializeNeeded      = true;
 39:     protected $_canUseInternal          = false;
 40:     protected $_canUseForMultishipping  = false;
 41: 
 42:     /**
 43:      * Config instance
 44:      * @var Mage_Paypal_Model_Config
 45:      */
 46:     protected $_config = null;
 47: 
 48:     /**
 49:      * Whether method is available for specified currency
 50:      *
 51:      * @param string $currencyCode
 52:      * @return bool
 53:      */
 54:     public function canUseForCurrency($currencyCode)
 55:     {
 56:         return $this->getConfig()->isCurrencyCodeSupported($currencyCode);
 57:     }
 58: 
 59:      /**
 60:      * Get paypal session namespace
 61:      *
 62:      * @return Mage_Paypal_Model_Session
 63:      */
 64:     public function getSession()
 65:     {
 66:         return Mage::getSingleton('paypal/session');
 67:     }
 68: 
 69:     /**
 70:      * Get checkout session namespace
 71:      *
 72:      * @return Mage_Checkout_Model_Session
 73:      */
 74:     public function getCheckout()
 75:     {
 76:         return Mage::getSingleton('checkout/session');
 77:     }
 78: 
 79:     /**
 80:      * Get current quote
 81:      *
 82:      * @return Mage_Sales_Model_Quote
 83:      */
 84:     public function getQuote()
 85:     {
 86:         return $this->getCheckout()->getQuote();
 87:     }
 88: 
 89:     /**
 90:      * Create main block for standard form
 91:      *
 92:      */
 93:     public function createFormBlock($name)
 94:     {
 95:         $block = $this->getLayout()->createBlock('paypal/standard_form', $name)
 96:             ->setMethod('paypal_standard')
 97:             ->setPayment($this->getPayment())
 98:             ->setTemplate('paypal/standard/form.phtml');
 99: 
100:         return $block;
101:     }
102: 
103:     /**
104:      * Return Order place redirect url
105:      *
106:      * @return string
107:      */
108:     public function getOrderPlaceRedirectUrl()
109:     {
110:           return Mage::getUrl('paypal/standard/redirect', array('_secure' => true));
111:     }
112: 
113:     /**
114:      * Return form field array
115:      *
116:      * @return array
117:      */
118:     public function getStandardCheckoutFormFields()
119:     {
120:         $orderIncrementId = $this->getCheckout()->getLastRealOrderId();
121:         $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
122:         /* @var $api Mage_Paypal_Model_Api_Standard */
123:         $api = Mage::getModel('paypal/api_standard')->setConfigObject($this->getConfig());
124:         $api->setOrderId($orderIncrementId)
125:             ->setCurrencyCode($order->getBaseCurrencyCode())
126:             //->setPaymentAction()
127:             ->setOrder($order)
128:             ->setNotifyUrl(Mage::getUrl('paypal/ipn/'))
129:             ->setReturnUrl(Mage::getUrl('paypal/standard/success'))
130:             ->setCancelUrl(Mage::getUrl('paypal/standard/cancel'));
131: 
132:         // export address
133:         $isOrderVirtual = $order->getIsVirtual();
134:         $address = $isOrderVirtual ? $order->getBillingAddress() : $order->getShippingAddress();
135:         if ($isOrderVirtual) {
136:             $api->setNoShipping(true);
137:         } elseif ($address->validate()) {
138:             $api->setAddress($address);
139:         }
140: 
141:         // add cart totals and line items
142:         $api->setPaypalCart(Mage::getModel('paypal/cart', array($order)))
143:             ->setIsLineItemsEnabled($this->_config->lineItemsEnabled)
144:         ;
145:         $api->setCartSummary($this->_getAggregatedCartSummary());
146:         $api->setLocale($api->getLocaleCode());
147:         $result = $api->getStandardCheckoutRequest();
148:         return $result;
149:     }
150: 
151:     /**
152:      * Instantiate state and set it to state object
153:      * @param string $paymentAction
154:      * @param Varien_Object
155:      */
156:     public function initialize($paymentAction, $stateObject)
157:     {
158:         $state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
159:         $stateObject->setState($state);
160:         $stateObject->setStatus('pending_payment');
161:         $stateObject->setIsNotified(false);
162:     }
163: 
164:     /**
165:      * Config instance getter
166:      * @return Mage_Paypal_Model_Config
167:      */
168:     public function getConfig()
169:     {
170:         if (null === $this->_config) {
171:             $params = array($this->_code);
172:             if ($store = $this->getStore()) {
173:                 $params[] = is_object($store) ? $store->getId() : $store;
174:             }
175:             $this->_config = Mage::getModel('paypal/config', $params);
176:         }
177:         return $this->_config;
178:     }
179: 
180:     /**
181:      * Check whether payment method can be used
182:      * @param Mage_Sales_Model_Quote
183:      * @return bool
184:      */
185:     public function isAvailable($quote = null)
186:     {
187:         if (parent::isAvailable($quote) && $this->getConfig()->isMethodAvailable()) {
188:             return true;
189:         }
190:         return false;
191:     }
192: 
193:     /**
194:      * Custom getter for payment configuration
195:      *
196:      * @param string $field
197:      * @param int $storeId
198:      * @return mixed
199:      */
200:     public function getConfigData($field, $storeId = null)
201:     {
202:         return $this->getConfig()->$field;
203:     }
204: 
205:     /**
206:      * Aggregated cart summary label getter
207:      *
208:      * @return string
209:      */
210:     private function _getAggregatedCartSummary()
211:     {
212:         if ($this->_config->lineItemsSummary) {
213:             return $this->_config->lineItemsSummary;
214:         }
215:         return Mage::app()->getStore($this->getStore())->getFrontendName();
216:     }
217: }
218: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0