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_XmlConnect
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: * XmlConnect PayPal Mobile Express Checkout Library model
29: *
30: * @category Mage
31: * @package Mage_XmlConnect
32: * @author Magento Core Team <core@magentocommerce.com>
33: */
34: class Mage_XmlConnect_Model_Payment_Method_Paypal_Mecl extends Mage_Paypal_Model_Express
35: {
36: /**
37: * Store MECL payment method code
38: */
39: const MECL_METHOD_CODE = 'paypal_mecl';
40:
41: /**
42: * Payment method code
43: *
44: * @var string
45: */
46: protected $_code = self::MECL_METHOD_CODE;
47:
48: /**
49: * Can use method for a frontend checkout
50: *
51: * @var bool
52: */
53: protected $_canUseCheckout = false;
54:
55: /**
56: * Can method be used for multishipping checkout type
57: *
58: * @var bool
59: */
60: protected $_canUseForMultishipping = false;
61:
62: /**
63: * Can method manage recurring profiles
64: *
65: * @var bool
66: */
67: protected $_canManageRecurringProfiles = false;
68:
69: /**
70: * Check whether payment method can be used
71: *
72: * @param Mage_Sales_Model_Quote $quote
73: * @return bool
74: */
75: public function isAvailable($quote = null)
76: {
77: $storeId = false;
78: $model = Mage::registry('current_app');
79:
80: if ($model instanceof Mage_XmlConnect_Model_Application) {
81: $storeId = $model->getStoreId();
82: }
83:
84: if (!$storeId) {
85: $storeId = $quote ? $quote->getStoreId() : Mage::app()->getStore()->getId();
86: }
87:
88: return (bool) Mage::getModel('paypal/config')->setStoreId($storeId)
89: ->isMethodAvailable(Mage_Paypal_Model_Config::METHOD_WPP_EXPRESS);
90: }
91:
92: /**
93: * Return title of the PayPal Mobile Express Checkout Payment method
94: *
95: * @return string
96: */
97: public function getTitle()
98: {
99: return Mage::helper('xmlconnect')->__('PayPal Mobile Express Checkout');
100: }
101: }
102: