test_app_do_not_install - Version 1.1.0

Version Notes

1.1.0

Download this release

Release Info

Developer Magento Core Team
Extension test_app_do_not_install
Version 1.1.0
Comparing to
See all releases


Version 1.1.0

Files changed (28) hide show
  1. app/code/community/Paypalauth/Identity/Block/Adminhtml/Form/Field/Enable.php +77 -0
  2. app/code/community/Paypalauth/Identity/Block/Customer/Account/Asklink.php +43 -0
  3. app/code/community/Paypalauth/Identity/Block/Customer/Account/Dashboard/Info.php +90 -0
  4. app/code/community/Paypalauth/Identity/Block/Form/Paypal/Login.php +52 -0
  5. app/code/community/Paypalauth/Identity/Helper/Data.php +206 -0
  6. app/code/community/Paypalauth/Identity/Model/Mysql4/Paypal/Customer.php +82 -0
  7. app/code/community/Paypalauth/Identity/Model/Mysql4/Paypal/Customer/Collection.php +41 -0
  8. app/code/community/Paypalauth/Identity/Model/Observer.php +55 -0
  9. app/code/community/Paypalauth/Identity/Model/OpenId/Consumer.php +245 -0
  10. app/code/community/Paypalauth/Identity/Model/OpenId/Extension/Ax.php +236 -0
  11. app/code/community/Paypalauth/Identity/Model/Paypal/Customer.php +92 -0
  12. app/code/community/Paypalauth/Identity/controllers/OpenidController.php +439 -0
  13. app/code/community/Paypalauth/Identity/etc/config.xml +101 -0
  14. app/code/community/Paypalauth/Identity/etc/system.xml +49 -0
  15. app/code/community/Paypalauth/Identity/sql/paypalauth_identity_setup/mysql4-install-0.1.0.php +46 -0
  16. app/design/frontend/base/default/layout/paypalauth/customer.xml +110 -0
  17. app/design/frontend/base/default/template/paypalauth/checkout/onepage/login.phtml +166 -0
  18. app/design/frontend/base/default/template/paypalauth/customer/account/asklink.phtml +78 -0
  19. app/design/frontend/base/default/template/paypalauth/customer/account/dashboard/info.phtml +61 -0
  20. app/design/frontend/base/default/template/paypalauth/customer/form/login.phtml +106 -0
  21. app/design/frontend/base/default/template/paypalauth/customer/form/register.phtml +201 -0
  22. app/design/frontend/base/default/template/paypalauth/paypal_checkout.phtml +11 -0
  23. app/design/frontend/base/default/template/paypalauth/paypal_login.phtml +45 -0
  24. app/design/frontend/base/default/template/paypalauth/paypal_register.phtml +45 -0
  25. app/etc/modules/Paypalauth_Identity.xml +35 -0
  26. package.xml +18 -0
  27. skin/frontend/base/default/css/paypalauth/styles.css +9 -0
  28. skin/frontend/base/default/js/paypalauth/paypalauth.js +17 -0
app/code/community/Paypalauth/Identity/Block/Adminhtml/Form/Field/Enable.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Enterprise Edition
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Magento Enterprise Edition License
8
+ * that is bundled with this package in the file LICENSE_EE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://www.magentocommerce.com/license/enterprise-edition
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 Paypalauth
22
+ * @package Paypalauth_Identity
23
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://www.magentocommerce.com/license/enterprise-edition
25
+ */
26
+
27
+ /**
28
+ * Adminhtml Paypalauth Identity custom select in admin config
29
+ *
30
+ */
31
+ class Paypalauth_Identity_Block_Adminhtml_Form_Field_Enable extends Mage_Adminhtml_Block_System_Config_Form_Field
32
+ {
33
+ /**
34
+ * Render select(enable/disable) login with PayPal
35
+ * enable if web/secure url contains 'https'
36
+ *
37
+ * @param Varien_Data_Form_Element_Abstract $element
38
+ * @return string
39
+ */
40
+ public function render(Varien_Data_Form_Element_Abstract $element)
41
+ {
42
+ $paypalAuthEnabled = Mage::getStoreConfigFlag('customer/startup/paypalauth_enabled');
43
+
44
+ if (substr((string)Mage::getConfig()->getNode('default/web/secure/base_url'),0,5) === 'https') {
45
+ $disabled = false;
46
+ } else {
47
+ $disabled = true;
48
+ }
49
+
50
+ $form = $this->getForm();
51
+ $yesNoValues = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
52
+
53
+ $name = Mage::app()->getStore()->getFrontendName();
54
+ $realm = urlencode(Mage::helper('paypalauth_identity/data')->getRootUrl());
55
+ $return = urlencode(Mage::helper('paypalauth_identity/data')->getRootUrl());
56
+
57
+ $whiteListUrl = "https://www.x.com/products/access/applications/submit?name=" . $name . "&realm=" .$realm. "&return_to_url=" .$return. "&access=advanced";
58
+
59
+ $comment = "<font color='#FF0000'>To enable Log in with PayPal Access please add your SSL secured website to the PayPal Access whitelist. It is easy to setup by visiting <a href=\"$whiteListUrl\">http://correctURLhere.com</a> and following the instructions. After you are whitelisted you can enable your customers to Log in with PayPal Access.</font>";
60
+ $label = "Enable Log in with PayPal Access";
61
+ $element = new Varien_Data_Form_Element_Select();
62
+ $element->setName('groups[startup][fields][paypalauth_enabled][value]')
63
+ ->setHtmlId('paypalauth_identity_enabled_id')
64
+ ->setId('customer_startup_paypalauth_enabled')
65
+ ->setForm($form)
66
+ ->setValues($yesNoValues)
67
+ ->setComment($comment)
68
+ ->setLabel($label)
69
+ ->setValue($paypalAuthEnabled)
70
+ ->setValue($paypalAuthEnabled)
71
+ ->setDisabled($disabled);
72
+
73
+ $html = parent::render($element);
74
+ return $html;
75
+ }
76
+
77
+ }
app/code/community/Paypalauth/Identity/Block/Customer/Account/Asklink.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Paypalauth
22
+ * @package Paypalauth_Identity
23
+ * @copyright Copyright (c) 2010 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
+ * @category Paypalauth
30
+ * @package Paypalauth_Identity
31
+ */
32
+ class Paypalauth_Identity_Block_Customer_Account_Asklink extends Mage_Customer_Block_Form_Login
33
+ {
34
+ /**
35
+ * Retrieve form posting url
36
+ *
37
+ * @return string
38
+ */
39
+ public function getAskLinkPostActionUrl()
40
+ {
41
+ return $this->helper('paypalauth_identity/data')->getAskLinkPostActionUrl();
42
+ }
43
+ }
app/code/community/Paypalauth/Identity/Block/Customer/Account/Dashboard/Info.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Paypalauth_Identity
22
+ * @package Paypalauth_Identity_Customer
23
+ * @copyright Copyright (c) 2011 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
+ * Dashboard Paypalauth_Identity Customer Info
29
+ *
30
+ * @category Paypalauth_Identity
31
+ * @package Paypalauth_Identity_Customer
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+
35
+ class Paypalauth_Identity_Block_Customer_Account_Dashboard_Info extends Mage_Customer_Block_Account_Dashboard_Info
36
+ {
37
+ /**
38
+ * Add paypalauth block to the customer dashboard
39
+ *
40
+ * @return string
41
+ */
42
+ protected function _toHtml()
43
+ {
44
+ $isExtensionEnabled = Mage::getStoreConfigFlag('customer/startup/paypalauth_enabled');
45
+
46
+ $html = $this->getChildHtml('paypalauth_dashboard');
47
+ if (!$html) {
48
+ return parent::_toHtml();
49
+ }
50
+ $html .= parent::_toHtml();
51
+ return $html;
52
+ }
53
+
54
+ /**
55
+ * Check if this customer account linked with PayPal account
56
+ *
57
+ * @return bool
58
+ */
59
+ public function getPaypalCustomerEmail()
60
+ {
61
+ $customerId = $this->getCustomer()->getId();
62
+ $paypalCustomerData = Mage::getModel('paypalauth_identity/paypal_customer')->
63
+ getPaypalCustomerDataByField('customer_id', $customerId);
64
+
65
+ if ($paypalCustomerData['email']) {
66
+ return $paypalCustomerData['email'];
67
+ }
68
+ return false;
69
+ }
70
+
71
+ /**
72
+ * Return action url for unlinking (native magento customer entity and paypal customer entity)
73
+ *
74
+ * @return string
75
+ */
76
+ public function getUnlinkUrl()
77
+ {
78
+ return Mage::getUrl('login/openid/unlink');
79
+ }
80
+
81
+ /**
82
+ * Return action url for authorized magento customer
83
+ *
84
+ * @return string
85
+ */
86
+ public function getAuthLoginUrl()
87
+ {
88
+ return Mage::getUrl('login/openid/authLogin');
89
+ }
90
+ }
app/code/community/Paypalauth/Identity/Block/Form/Paypal/Login.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Paypalauth
22
+ * @package Paypalauth_Identity
23
+ * @copyright Copyright (c) 2011 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
+ * Paypalauth Identity block
29
+ *
30
+ * @category Paypalauth
31
+ * @package Paypalauth_Identity
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+
35
+ class Paypalauth_Identity_Block_Form_Paypal_login extends Mage_Core_Block_Template
36
+ {
37
+
38
+ /**
39
+ * Prevent rendering if Paypalauth Identuty disabled
40
+ *
41
+ * @return string
42
+ */
43
+ protected function _toHtml()
44
+ {
45
+ $isExtensionEnabled = Mage::getStoreConfigFlag('customer/startup/paypalauth_enabled');
46
+ if ($isExtensionEnabled) {
47
+ return parent::_toHtml();
48
+ }
49
+ return '';
50
+ }
51
+
52
+ }
app/code/community/Paypalauth/Identity/Helper/Data.php ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Enterprise Edition
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Magento Enterprise Edition License
8
+ * that is bundled with this package in the file LICENSE_EE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://www.magentocommerce.com/license/enterprise-edition
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 Paypalauth
22
+ * @package Paypalauth_Identity
23
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://www.magentocommerce.com/license/enterprise-edition
25
+ */
26
+ class Paypalauth_Identity_Helper_Data extends Mage_Customer_Helper_Data
27
+ {
28
+
29
+ /**
30
+ * Return message for created account using PayPal Access flow
31
+ *
32
+ * @return string
33
+ */
34
+ public function addDashboardMessageAfterCreatingAccount()
35
+ {
36
+ $message = $this->_getCustomerSession()->addSuccess($this->__("Your %s account has been created successfully with PayPal Access.<br /><br />
37
+ You allowed access to your name, telephone, shipping address, and email address. No financial information will ever be shared by PayPal Access.<br /><br />
38
+ Simply use PayPal Access to log in, each time to visit.", Mage::app()->getStore()->getFrontendName()));
39
+
40
+ return $message;
41
+ }
42
+
43
+ /**
44
+ * Return message for created account using PayPal Access flow
45
+ *
46
+ * @return string
47
+ */
48
+ public function addDashboardMessageAfterLinking()
49
+ {
50
+ $message = $this->_getCustomerSession()->addSuccess($this->__("Your %s account has been linked with PayPal Access.<br /><br />
51
+ You allowed access to your name, telephone, shipping address, and email address. No financial information will ever be shared by PayPal Access.<br /><br />
52
+ Simply use PayPal Access to log in, each time to visit.", Mage::app()->getStore()->getFrontendName()));
53
+
54
+ return $message;
55
+ }
56
+
57
+ /**
58
+ * Retrieve customer session model object
59
+ *
60
+ * @return Mage_Customer_Model_Session
61
+ */
62
+ protected function _getCustomerSession()
63
+ {
64
+ return Mage::getSingleton('customer/session');
65
+ }
66
+ /**
67
+ * @return Zend_OpenId_Consumer_Storage_File
68
+ */
69
+ public function getStorage()
70
+ {
71
+ $storageDir = Mage::getBaseDir('var') . DS . 'paypalidentity' . DS . 'storage';
72
+ $storage = new Zend_OpenId_Consumer_Storage_File($storageDir);
73
+ return $storage;
74
+ }
75
+
76
+ /**
77
+ * Return base url of the site without '/' at the end
78
+ *
79
+ * @return string
80
+ */
81
+ public function getRootUrl()
82
+ {
83
+ $url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, 1);
84
+ $rootUrl = substr($url, 0, strlen($url) - 1);
85
+ return $rootUrl;
86
+ }
87
+
88
+ /**
89
+ * Return url for PayPal access login
90
+ *
91
+ * @return string
92
+ */
93
+ public function getPopUpLoginUrl()
94
+ {
95
+ $url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, 1);
96
+ $url = $url . 'login/openid/login';
97
+ return $url;
98
+ }
99
+
100
+ /**
101
+ * Retrieve customer login POST URL for accounts linking
102
+ *
103
+ * @return string
104
+ */
105
+ public function getAskLinkPostActionUrl()
106
+ {
107
+ $params = array();
108
+ if ($this->_getRequest()->getParam(self::REFERER_QUERY_PARAM_NAME)) {
109
+ $params = array(
110
+ self::REFERER_QUERY_PARAM_NAME => $this->_getRequest()->getParam(self::REFERER_QUERY_PARAM_NAME)
111
+ );
112
+ }
113
+ return $this->_getUrl('login/openid/askLinkPost', $params);
114
+ }
115
+
116
+ /**
117
+ * Add PayPal address to Magento customer account
118
+ *
119
+ * @param $customer
120
+ * @param $response
121
+ * @param bool $default
122
+ * @return Mage_Core_Model_Abstract
123
+ */
124
+ public function addPaypalAddress($customer, $response, $default = false)
125
+ {
126
+ $customerId = $customer->getId();
127
+ $regionId = Mage::getModel('directory/region')->loadByCode($response['state'], $response['country'])->getId();
128
+
129
+ $address = Mage::getModel('customer/address');
130
+ $address->setCustomerId($customerId);
131
+ $address->setFirstname($response['fname']);
132
+ $address->setLastname($response['lname']);
133
+ $address->setCountryId($response['country']);
134
+ $address->setCity($response['city']);
135
+
136
+ if ($regionId) {
137
+ $address->setRegionId($regionId);
138
+ }
139
+ $address->setPostcode($response['postcode']);
140
+ $address->setStreet($response['street1']);
141
+ $address->setTelephone($response['phone']);
142
+
143
+ if ($default == true) {
144
+ $address->setIsDefaultBilling(true);
145
+ $address->setIsDefaultShipping(true);
146
+ }
147
+
148
+ $address->save();
149
+ $customer->addAddress($address);
150
+ return $address;
151
+ }
152
+
153
+ /**
154
+ * Linking accounts action
155
+ *
156
+ * @param $response
157
+ * @param $customer
158
+ * @return Mage_Core_Model_Abstract
159
+ */
160
+ public function linkAccounts($response, $customer)
161
+ {
162
+ $customerId = $customer->getId();
163
+ if (!$customer->getAddresses()) {
164
+ $this->addPaypalAddress($customer, $response, true);
165
+ }
166
+
167
+ $payerId = $response['id'];
168
+ $email = $response['email'];
169
+
170
+ $paypalCustomer = Mage::getModel('paypalauth_identity/paypal_customer')->load($customerId, 'customer_id');
171
+
172
+ if ($paypalCustomer->getId()) {
173
+ return $paypalCustomer;
174
+ }
175
+
176
+ $paypalCustomer->setData('payer_id', $payerId);
177
+ $paypalCustomer->setData('customer_id', $customerId);
178
+ $paypalCustomer->setData('email', $email);
179
+ $paypalCustomer->save();
180
+
181
+ return $paypalCustomer;
182
+ }
183
+
184
+ /**
185
+ * Create magento customer using PayPal response
186
+ *
187
+ * @param $response
188
+ * @return Mage_Core_Model_Abstract
189
+ */
190
+ public function createMagentoCustomer($response)
191
+ {
192
+ $customer = Mage::getModel('customer/customer')->setId(null);
193
+ $password = $customer->generatePassword();
194
+
195
+ $customer->setData('firstname', $response['fname']);
196
+ $customer->setData('lastname', $response['lname']);
197
+ $customer->setData('email', $response['email']);
198
+ $customer->setData('password', $password);
199
+ $customer->save();
200
+
201
+ $customerId = $customer->getId();
202
+ $this->addPaypalAddress($customer, $response, true);
203
+
204
+ return $customer;
205
+ }
206
+ }
app/code/community/Paypalauth/Identity/Model/Mysql4/Paypal/Customer.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Enterprise Edition
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Magento Enterprise Edition License
8
+ * that is bundled with this package in the file LICENSE_EE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://www.magentocommerce.com/license/enterprise-edition
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 Paypalauth
22
+ * @package Paypalauth_Identity
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://www.magentocommerce.com/license/enterprise-edition
25
+ */
26
+
27
+ /**
28
+ * Paypal Customer Resource Model
29
+ */
30
+ class Paypalauth_Identity_Model_Mysql4_Paypal_Customer extends Mage_Core_Model_Mysql4_Abstract
31
+ {
32
+ /**
33
+ * Paypal customer resource model initialization
34
+ *
35
+ * @return void
36
+ */
37
+ public function _construct()
38
+ {
39
+ $this->_init('paypalauth_identity/customer', 'id');
40
+ }
41
+
42
+ /**
43
+ * Unlinks (native magento customer entity and paypal customer entity)
44
+ *
45
+ * @param $customerId
46
+ * @return Paypalauth_Identity_Model_Mysql4_Paypal_Customer
47
+ */
48
+ public function unlinkAccount($customerId)
49
+ {
50
+ $this->_getWriteAdapter()->delete($this->getMainTable(), "customer_id={$customerId}");
51
+ return $this;
52
+ }
53
+
54
+ /**
55
+ * Check PayPal customer existing in the database
56
+ *
57
+ * @param string $customerId
58
+ * @return bool
59
+ */
60
+ public function isPaypalCustomerExists($field, $value)
61
+ {
62
+ return (bool)$this->getPaypalCustomerDataByField($field, $value);
63
+ }
64
+
65
+ /**
66
+ * Return payer_id(PayPal customer id) and customer_id
67
+ *
68
+ * @param $field
69
+ * @param string $value
70
+ * @return mixed
71
+ */
72
+ public function getPaypalCustomerDataByField($field, $value = '')
73
+ {
74
+ $select = $this->_getReadAdapter()->select()
75
+ ->from($this->getMainTable(), array('customer_id', 'payer_id', 'email'))
76
+ ->where("$field=?", $value);
77
+ $result = $this->_getReadAdapter()->fetchRow($select);
78
+
79
+ return $result;
80
+ }
81
+
82
+ }
app/code/community/Paypalauth/Identity/Model/Mysql4/Paypal/Customer/Collection.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Enterprise Edition
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Magento Enterprise Edition License
8
+ * that is bundled with this package in the file LICENSE_EE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://www.magentocommerce.com/license/enterprise-edition
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 Paypalauth
22
+ * @package Paypalauth_Identity
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://www.magentocommerce.com/license/enterprise-edition
25
+ */
26
+
27
+ /**
28
+ * Paypal customer Collection Model
29
+ */
30
+ class Paypalauth_Identity_Model_Mysql4_Paypal_Customer_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
31
+ {
32
+ /**
33
+ * Resource initialization.
34
+ *
35
+ * @return void
36
+ */
37
+ protected function _construct()
38
+ {
39
+ $this->_init('paypalauth_identity/paypal_customer');
40
+ }
41
+ }
app/code/community/Paypalauth/Identity/Model/Observer.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Paypalauth
22
+ * @package Paypalauth_Identity
23
+ * @copyright Copyright (c) 2010 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
+ * Paypalauth Identity main observer
29
+ *
30
+ * @category Paypalauth
31
+ * @package Paypalauth_Identity
32
+ */
33
+ class Paypalauth_Identity_Model_Observer
34
+ {
35
+ /**
36
+ * Save system config event
37
+ *
38
+ * @param Varien_Object $observer
39
+ */
40
+ public function saveSystemConfig($observer)
41
+ {
42
+ $store = $observer->getStore();
43
+ $website = $observer->getWebsite();
44
+
45
+ if (substr((string)Mage::getConfig()->getNode('default/web/secure/base_url'),0,5) !== 'https') {
46
+ $groups['startup']['fields']['paypalauth_enabled']['value'] = 0;
47
+ Mage::getModel('adminhtml/config_data')
48
+ ->setSection('customer')
49
+ ->setWebsite($website)
50
+ ->setStore($store)
51
+ ->setGroups($groups)
52
+ ->save();
53
+ }
54
+ }
55
+ }
app/code/community/Paypalauth/Identity/Model/OpenId/Consumer.php ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zend Framework
5
+ *
6
+ * LICENSE
7
+ *
8
+ * This source file is subject to the new BSD license that is bundled
9
+ * with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://framework.zend.com/license/new-bsd
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@zend.com so we can send you a copy immediately.
15
+ *
16
+ * @category Paypalauth
17
+ * @package Paypalauth_Identity
18
+ * @subpackage Paypalauth_Identity_Consumer
19
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
20
+ * @license http://framework.zend.com/license/new-bsd New BSD License
21
+ * @version $Id: Consumer.php 20096 2010-01-06 02:05:09Z bkarwin $
22
+ */
23
+
24
+ /**
25
+ * OpenID consumer implementation
26
+ *
27
+ * @category Paypalauth
28
+ * @package Paypalauth_Identity
29
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
30
+ * @license http://framework.zend.com/license/new-bsd New BSD License
31
+ */
32
+ class Paypalauth_Identity_Model_OpenId_Consumer extends Zend_OpenId_Consumer
33
+ {
34
+ const OPEN_ID_IDENTIFIER = 'https://www.paypal.com/webapps/auth/server';
35
+ const IDENT_SELECT = 'http://specs.openid.net/auth/2.0/identifier_select';
36
+
37
+ /**
38
+ * Performs discovery of identity and finds OpenID URL, OpenID server URL
39
+ * and OpenID protocol version. Returns true on succees and false on
40
+ * failure.
41
+ *
42
+ * @param string &$id OpenID identity URL
43
+ * @param string &$server OpenID server URL
44
+ * @param float &$version OpenID protocol version
45
+ * @return bool
46
+ * @todo OpenID 2.0 (7.3) XRI and Yadis discovery
47
+ */
48
+ protected function _discovery(&$id, &$server, &$version)
49
+ {
50
+ $realId = $id;
51
+ if ($this->_storage->getDiscoveryInfo(
52
+ $id,
53
+ $realId,
54
+ $server,
55
+ $version,
56
+ $expire)) {
57
+ $id = $realId;
58
+ return true;
59
+ }
60
+
61
+ /* TODO: OpenID 2.0 (7.3) XRI and Yadis discovery */
62
+
63
+ /* HTML-based discovery */
64
+ $response = $this->_httpRequest($id, 'GET', array(), $status);
65
+ if ($status != 200 || !is_string($response)) {
66
+ return false;
67
+ }
68
+ if (preg_match(
69
+ '/<link[^>]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid2.provider[ \t]*[^"\']*\\1[^>]*href=(["\'])([^"\']+)\\2[^>]*\/?>/i',
70
+ $response,
71
+ $r)) {
72
+ $version = 2.0;
73
+ $server = $r[3];
74
+ } else if (preg_match(
75
+ '/<link[^>]*href=(["\'])([^"\']+)\\1[^>]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid2.provider[ \t]*[^"\']*\\3[^>]*\/?>/i',
76
+ $response,
77
+ $r)) {
78
+ $version = 2.0;
79
+ $server = $r[2];
80
+ } else if (preg_match(
81
+ '/<link[^>]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid.server[ \t]*[^"\']*\\1[^>]*href=(["\'])([^"\']+)\\2[^>]*\/?>/i',
82
+ $response,
83
+ $r)) {
84
+ $version = 1.1;
85
+ $server = $r[3];
86
+ } else if (preg_match(
87
+ '/<link[^>]*href=(["\'])([^"\']+)\\1[^>]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid.server[ \t]*[^"\']*\\3[^>]*\/?>/i',
88
+ $response,
89
+ $r)) {
90
+ $version = 1.1;
91
+ $server = $r[2];
92
+ } else if (preg_match('/<URI>([^<]+)<\/URI>/i', $response, $r)) {
93
+ $version = 2.0;
94
+ $server = $r[1];
95
+ }
96
+ else {
97
+ return false;
98
+ }
99
+ if ($version >= 2.0) {
100
+ if (preg_match(
101
+ '/<link[^>]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid2.local_id[ \t]*[^"\']*\\1[^>]*href=(["\'])([^"\']+)\\2[^>]*\/?>/i',
102
+ $response,
103
+ $r)) {
104
+ $realId = $r[3];
105
+ } else if (preg_match(
106
+ '/<link[^>]*href=(["\'])([^"\']+)\\1[^>]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid2.local_id[ \t]*[^"\']*\\3[^>]*\/?>/i',
107
+ $response,
108
+ $r)) {
109
+ $realId = $r[2];
110
+ }
111
+ } else {
112
+ if (preg_match(
113
+ '/<link[^>]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid.delegate[ \t]*[^"\']*\\1[^>]*href=(["\'])([^"\']+)\\2[^>]*\/?>/i',
114
+ $response,
115
+ $r)) {
116
+ $realId = $r[3];
117
+ } else if (preg_match(
118
+ '/<link[^>]*href=(["\'])([^"\']+)\\1[^>]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid.delegate[ \t]*[^"\']*\\3[^>]*\/?>/i',
119
+ $response,
120
+ $r)) {
121
+ $realId = $r[2];
122
+ }
123
+ }
124
+
125
+ $expire = time() + 60 * 60;
126
+ $this->_storage->addDiscoveryInfo($id, $realId, $server, $version, $expire);
127
+ $id = $realId;
128
+ return true;
129
+ }
130
+
131
+ /**
132
+ * Performs check of OpenID identity.
133
+ *
134
+ * This is the first step of OpenID authentication process.
135
+ * On success the function does not return (it does HTTP redirection to
136
+ * server and exits). On failure it returns false.
137
+ *
138
+ * @param bool $immediate enables or disables interaction with user
139
+ * @param string $id OpenID identity
140
+ * @param string $returnTo HTTP URL to redirect response from server to
141
+ * @param string $root HTTP URL to identify consumer on server
142
+ * @param mixed $extensions extension object or array of extensions objects
143
+ * @param Zend_Controller_Response_Abstract $response an optional response
144
+ * object to perform HTTP or HTML form redirection
145
+ * @return bool
146
+ */
147
+ protected function _checkId($immediate, $id, $returnTo=null, $root=null,
148
+ $extensions=null, Zend_Controller_Response_Abstract $response = null)
149
+ {
150
+ $this->_setError('');
151
+
152
+ if (!Zend_OpenId::normalize($id)) {
153
+ $this->_setError("Normalisation failed");
154
+ return false;
155
+ }
156
+ $claimedId = $id;
157
+
158
+ if (!$this->_discovery($id, $server, $version)) {
159
+ $this->_setError("Discovery failed: " . $this->getError());
160
+ return false;
161
+ }
162
+ if (!$this->_associate($server, $version)) {
163
+ $this->_setError("Association failed: " . $this->getError());
164
+ return false;
165
+ }
166
+ if (!$this->_getAssociation(
167
+ $server,
168
+ $handle,
169
+ $macFunc,
170
+ $secret,
171
+ $expires)) {
172
+ /* Use dumb mode */
173
+ unset($handle);
174
+ unset($macFunc);
175
+ unset($secret);
176
+ unset($expires);
177
+ }
178
+
179
+ $params = array();
180
+ if ($version >= 2.0) {
181
+ $params['openid.ns'] = Zend_OpenId::NS_2_0;
182
+ }
183
+
184
+ $params['openid.mode'] = $immediate ?
185
+ 'checkid_immediate' : 'checkid_setup';
186
+
187
+ $params['openid.identity'] = $id;
188
+
189
+ $params['openid.claimed_id'] = $claimedId;
190
+
191
+ if ($version <= 2.0) {
192
+ if ($this->_session !== null) {
193
+ $this->_session->identity = $id;
194
+ $this->_session->claimed_id = $claimedId;
195
+ if ($server == self::OPEN_ID_IDENTIFIER) {
196
+ $this->_session->identity = self::IDENT_SELECT;
197
+ $this->_session->claimed_id = self::IDENT_SELECT;
198
+ }
199
+ } else if (defined('SID')) {
200
+ $_SESSION["zend_openid"] = array(
201
+ "identity" => $id,
202
+ "claimed_id" => $claimedId);
203
+ if ($server == self::OPEN_ID_IDENTIFIER) {
204
+ $_SESSION['zend_openid']['identity'] = self::IDENT_SELECT;
205
+ $_SESSION['zend_openid']['claimed_id'] = self::IDENT_SELECT;
206
+ }
207
+ } else {
208
+ #require_once "Zend/Session/Namespace.php";
209
+ $this->_session = new Zend_Session_Namespace("zend_openid");
210
+ $this->_session->identity = $id;
211
+ $this->_session->claimed_id = $claimedId;
212
+ }
213
+ if ($server == self::OPEN_ID_IDENTIFIER) {
214
+ $params['openid.identity'] = self::IDENT_SELECT;
215
+ $params['openid.claimed_id'] = self::IDENT_SELECT;
216
+ }
217
+ }
218
+
219
+ if (isset($handle)) {
220
+ $params['openid.assoc_handle'] = $handle;
221
+ }
222
+
223
+ $params['openid.return_to'] = Zend_OpenId::absoluteUrl($returnTo);
224
+
225
+ if (empty($root)) {
226
+ $root = Zend_OpenId::selfUrl();
227
+ if ($root[strlen($root)-1] != '/') {
228
+ $root = dirname($root);
229
+ }
230
+ }
231
+ if ($version >= 2.0) {
232
+ $params['openid.realm'] = $root;
233
+ } else {
234
+ $params['openid.trust_root'] = $root;
235
+ }
236
+
237
+ if (!Zend_OpenId_Extension::forAll($extensions, 'prepareRequest', $params)) {
238
+ $this->_setError("Extension::prepareRequest failure");
239
+ return false;
240
+ }
241
+
242
+ Zend_OpenId::redirect($server, $params, $response);
243
+ return true;
244
+ }
245
+ }
app/code/community/Paypalauth/Identity/Model/OpenId/Extension/Ax.php ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Extension class for Zend_OpenId. Provides attribute exchange protocol.
4
+ *
5
+ * @author Chris Bisnett cbisnett@gmail.com
6
+ * @date 19July2009
7
+ */
8
+ class Paypalauth_Identity_Model_OpenId_Extension_Ax extends Zend_OpenId_Extension
9
+ {
10
+ /**
11
+ * Namespace URI for attribute exchange version 1.0
12
+ */
13
+ const NS_URL = 'http://openid.net/srv/ax/1.0';
14
+
15
+ /**
16
+ * Defined attributes listed at http://www.axschema.org/types as of 19July2009.
17
+ */
18
+ private $_definedAttributes = array(
19
+ // Name types
20
+ 'id' => 'https://www.paypal.com/webapps/auth/schema/payerID',
21
+ 'email' => 'http://axschema.org/contact/email',
22
+ 'fname' => 'http://axschema.org/namePerson/first',
23
+ 'lname' => 'http://axschema.org/namePerson/last',
24
+ 'fullname' => 'http://schema.openid.net/contact/fullname',
25
+ 'postcode' => 'http://axschema.org/contact/postalCode/home',
26
+ 'country' => 'http://axschema.org/contact/country/home',
27
+ 'street1' => 'http://schema.openid.net/contact/street1',
28
+ 'street2' => 'http://schema.openid.net/contact/street2',
29
+ 'city' => 'http://axschema.org/contact/city/home',
30
+ 'state' => 'http://axschema.org/contact/state/home',
31
+ 'phone' => 'http://axschema.org/contact/phone/default',
32
+ );
33
+
34
+ /**
35
+ * Name/Value pairs of requested attributes and a boolean specifying if the attribute is required.
36
+ */
37
+ private $_attributes = array();
38
+
39
+ /**
40
+ * Holds the attribute and the returned value.
41
+ */
42
+ private $_properties = array();
43
+
44
+ public function __construct(array $attribs)
45
+ {
46
+ $this->_attributes = $attribs;
47
+ }
48
+
49
+ /**
50
+ * Gets the property values returned by the provider.
51
+ *
52
+ * @return array
53
+ */
54
+ public function getProperties()
55
+ {
56
+ return $this->_properties;
57
+ }
58
+
59
+ private function splitParams($params)
60
+ {
61
+ $final = array();
62
+
63
+ // Loop the parameters
64
+ foreach ($params as $identifier => $value)
65
+ {
66
+ // Split the identifier at the boundries
67
+ $levels = explode('_', $identifier);
68
+
69
+ // Get the last value as the key
70
+ $key = array_pop($levels);
71
+
72
+ // Loop the levels, creating any that don't exist
73
+ $currentlevel = &$final;
74
+ foreach ($levels as $level)
75
+ {
76
+ // Check if the level is defined
77
+ if (!isset($currentlevel[$level]))
78
+ // Create the level
79
+ $currentlevel[$level] = array();
80
+ else
81
+ {
82
+ // Change any found value to the first key of an array
83
+ if (!is_array($currentlevel[$level]))
84
+ $currentlevel[$level] = array($currentlevel[$level]);
85
+ }
86
+
87
+ // Move down to the next level
88
+ $currentlevel = &$currentlevel[$level];
89
+ }
90
+
91
+ // Set the value
92
+ $currentlevel[$key] = $value;
93
+ }
94
+
95
+ return $final;
96
+ }
97
+
98
+ /**
99
+ * Adds an attribute type and URI to the list of defined attributes. This
100
+ * can be used to add expiremental types for testing.
101
+ *
102
+ * @param array &$attribs New attribute/URI pairs
103
+ * @return bool
104
+ */
105
+ public function addType($attribs)
106
+ {
107
+ // Verify the attributes is an array
108
+ if (!is_array($attribs))
109
+ return false;
110
+
111
+ // Merge the new types into the defined attributes
112
+ $this->_definedAttributes = array_merge($this->_definedAttributes, $attribs);
113
+
114
+ return true;
115
+ }
116
+
117
+ /**
118
+ * Generates a request to be sent to the provider requesting the
119
+ * specified attributes.
120
+ *
121
+ * @param array &$params request's var/val pairs
122
+ * @return bool
123
+ */
124
+ public function prepareRequest(&$params)
125
+ {
126
+ // Don't add attributes if there are none
127
+ if (!is_array($this->_attributes) || count($this->_attributes) < 1)
128
+ return;
129
+
130
+ // Setup the lists
131
+ $requiredAttributes = '';
132
+ $availableAttributes = '';
133
+
134
+ // Set the name space
135
+ $params['openid.ns.ax'] = Paypalauth_Identity_Model_OpenId_Extension_Ax::NS_URL;
136
+
137
+ // Set the mode
138
+ $params['openid.ax.mode'] = 'fetch_request';
139
+
140
+ // Loop the attributes only adding those that are valid
141
+ foreach ($this->_attributes as $attr => $isRequired)
142
+ {
143
+ // Check if the attribute is defined
144
+ if (!isset($this->_definedAttributes[$attr]))
145
+ continue;
146
+
147
+ // Add the attribute to a list
148
+ if ($isRequired)
149
+ $requiredAttributes .= (empty($requiredAttributes)) ? $attr : ',' . $attr;
150
+ else
151
+ $availableAttributes .= (empty($availableAttributes)) ? $attr : ',' . $attr;
152
+
153
+ // Add the type
154
+ $params['openid.ax.type.' . $attr] = $this->_definedAttributes[$attr];
155
+ }
156
+
157
+ // Add the required
158
+ if (!empty($requiredAttributes))
159
+ $params['openid.ax.required'] = $requiredAttributes;
160
+
161
+ // Add the requested
162
+ if (!empty($availableAttributes))
163
+ $params['openid.ax.if_available'] = $availableAttributes;
164
+
165
+ return true;
166
+ }
167
+
168
+ /**
169
+ * Parses the request from the consumer to determine what attribute values
170
+ * to return to the consumer.
171
+ *
172
+ * @param array $params request's var/val pairs
173
+ * @return bool
174
+ */
175
+ public function parseRequest($params)
176
+ {
177
+ return true;
178
+ }
179
+
180
+ /**
181
+ * Generates a response to the consumer's request that contains the
182
+ * requested attributes.
183
+ *
184
+ * @param array &$params response's var/val pairs
185
+ * @return bool
186
+ */
187
+ public function prepareResponse(&$params)
188
+ {
189
+ return true;
190
+ }
191
+
192
+ /**
193
+ * Gets property values from the response returned by the provider
194
+ *
195
+ * @param array $params response's var/val pairs
196
+ * @return bool
197
+ */
198
+ public function parseResponse($params)
199
+ {
200
+ $params = $this->splitParams($params);
201
+ $ax = null;
202
+
203
+ // Get the data name space
204
+ if (isset($params['openid']['ns']['ax']) && $params['openid']['ns']['ax'] == Paypal_Identity_Model_OpenId_Extension_Ax::NS_URL)
205
+ $ax = $params['openid']['ax'];
206
+ else
207
+ {
208
+ // Loop the extensions looking for the namespace url
209
+ foreach ($params['openid']['ns'] as $namespace => $uri)
210
+ {
211
+ // Check if the uri is attribute exchange
212
+ if ($uri == Paypalauth_Identity_Model_OpenId_Extension_Ax::NS_URL)
213
+ {
214
+ $ax = $params['openid'][$namespace];
215
+ break;
216
+ }
217
+ }
218
+ }
219
+
220
+ // Check if the data was found
221
+ if ($ax == null)
222
+ return false;
223
+
224
+ // Verify the mode is fetch_response
225
+ if (isset($ax['mode']) && $ax['mode'] != 'fetch_response')
226
+ return false;
227
+
228
+ // Get the attributes
229
+ foreach ($ax['value'] as $attr => $value)
230
+ {
231
+ $this->_properties[$attr] = $value;
232
+ }
233
+
234
+ return true;
235
+ }
236
+ }
app/code/community/Paypalauth/Identity/Model/Paypal/Customer.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Enterprise Edition
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Magento Enterprise Edition License
8
+ * that is bundled with this package in the file LICENSE_EE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://www.magentocommerce.com/license/enterprise-edition
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 Paypalauth
22
+ * @package Paypalauth_Identity
23
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://www.magentocommerce.com/license/enterprise-edition
25
+ */
26
+ /**
27
+ * Paypal Customer Model
28
+ */
29
+
30
+ class Paypalauth_Identity_Model_Paypal_Customer extends Mage_Core_Model_Abstract
31
+ {
32
+
33
+ /**
34
+ * @return void
35
+ */
36
+ public function _construct()
37
+ {
38
+ parent::_construct();
39
+ $this->_init('paypalauth_identity/paypal_customer');
40
+ }
41
+
42
+ /**
43
+ * Log in Magento
44
+ *
45
+ * @return Mage_Core_Model_Abstract
46
+ */
47
+ public function logInMagentoCustomerAccount($customerId)
48
+ {
49
+ $magentoCustomer = Mage::getModel('customer/customer')->load($customerId);
50
+ Mage::getModel('customer/session')->setCustomerAsLoggedIn($magentoCustomer);
51
+ return $magentoCustomer;
52
+ }
53
+
54
+ /**
55
+ * Unlink (native magento customer entity and paypal customer entity) from dashboard
56
+ *
57
+ * @return Paypalauth_Identity_Model_Paypal_Customer
58
+ */
59
+ public function unlinkAccount()
60
+ {
61
+ $customerId = Mage::getSingleton('customer/session')->getCustomer()->getId();
62
+ $this->_getResource()->unlinkAccount($customerId);
63
+ return $this;
64
+ }
65
+
66
+ /**
67
+ * Check paypalauth account existing in the database.
68
+ * Method returns true if exists, false - otherwise.
69
+ *
70
+ * @param $field
71
+ * @param $value
72
+ * @return bool
73
+ */
74
+ public function isPaypalCustomerExists($field, $value)
75
+ {
76
+ return (bool) $this->_getResource()->isPaypalCustomerExists((string) $field, (string) $value);
77
+ }
78
+
79
+ /**
80
+ * Return data array from paypalauth_customer table
81
+ *
82
+ * @param $field
83
+ * @param $value
84
+ * @return
85
+ */
86
+ public function getPaypalCustomerDataByField($field, $value)
87
+ {
88
+ $data = $this->_getResource()->getPaypalCustomerDataByField($field, $value);
89
+ return $data;
90
+ }
91
+
92
+ }
app/code/community/Paypalauth/Identity/controllers/OpenidController.php ADDED
@@ -0,0 +1,439 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Enterprise Edition
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Magento Enterprise Edition License
8
+ * that is bundled with this package in the file LICENSE_EE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://www.magentocommerce.com/license/enterprise-edition
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 Paypalauth
22
+ * @package Paypalauth Identity
23
+ * @subpackage Controllers
24
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://www.magentocommerce.com/license/enterprise-edition
26
+ */
27
+
28
+ /**
29
+ * PaypalAuth Open Id Controller
30
+ */
31
+ class Paypalauth_Identity_OpenidController extends Mage_Core_Controller_Front_Action
32
+ {
33
+
34
+ const OPEN_ID_IDENTIFIER = 'https://www.paypal.com/webapps/auth/server';
35
+
36
+ /**
37
+ * Attributes for request to Paypal
38
+ *
39
+ * @var array
40
+ */
41
+ protected $_attributes = array(
42
+ 'id' => true,
43
+ 'email' => true,
44
+ 'fname' => true,
45
+ 'lname' => true,
46
+ 'fullname' => true,
47
+ 'postcode' => true,
48
+ 'country' => true,
49
+ 'street1' => true,
50
+ 'street2' => true,
51
+ 'city' => true,
52
+ 'state' => true,
53
+ 'phone' => true,
54
+ );
55
+
56
+ /**
57
+ * Retrieve customer session model object
58
+ *
59
+ * @return Mage_Customer_Model_Session
60
+ */
61
+ protected function _getSession()
62
+ {
63
+ return Mage::getSingleton('customer/session');
64
+ }
65
+
66
+ protected function _getHelper()
67
+ {
68
+ return Mage::helper('paypalauth_identity/data');
69
+ }
70
+
71
+ /**
72
+ * Log in PayPal when customer is logged in Magento
73
+ *
74
+ * @return bool
75
+ */
76
+ public function authLoginAction()
77
+ {
78
+ $returnUrl = Mage::getUrl('*/*/authReturn', array('_secure' => true));
79
+ $this->_loginPaypal($returnUrl);
80
+ return true;
81
+ }
82
+
83
+ /**
84
+ * Log in PayPal when customer is not logged in Magento
85
+ *
86
+ * @return bool
87
+ */
88
+ public function loginAction()
89
+ {
90
+ $returnUrl = Mage::getUrl('*/*/return', array('_secure' => true));
91
+ $this->_loginPaypal($returnUrl);
92
+ return true;
93
+ }
94
+
95
+ /**
96
+ * Common process for logging to PayPal
97
+ * (for logged customers in Magento and not)
98
+ *
99
+ * @param $returnUrl
100
+ * @return void
101
+ */
102
+ protected function _loginPaypal($returnUrl)
103
+ {
104
+ $ax = Mage::getModel('paypalauth_identity/openId_extension_ax', $this->_attributes);
105
+ $storage = Mage::helper('paypalauth_identity/data')->getStorage();
106
+ $consumer = Mage::getModel('paypalauth_identity/openId_consumer', $storage);
107
+ $rootUrl = Mage::helper('paypalauth_identity/data')->getRootUrl();
108
+
109
+ if (!$consumer->login(self::OPEN_ID_IDENTIFIER, $returnUrl, $rootUrl, $ax)) {
110
+ die("PayPal Access login failed.");
111
+ }
112
+ }
113
+
114
+ /**
115
+ * Action (for logged customers in Magento) where we return after receive response from PayPal
116
+ *
117
+ * @return void
118
+ */
119
+ public function authReturnAction()
120
+ {
121
+ $response = $this->_verifyResponse();
122
+ if (!$response) {
123
+ Mage::throwException($this->__('Bad Response.'));
124
+ }
125
+
126
+ $payerId = $response['id'];
127
+ $isPaypalCustomerExists = Mage::getModel('paypalauth_identity/paypal_customer')->
128
+ isPaypalCustomerExists('payer_id', $payerId);
129
+
130
+ if (!$isPaypalCustomerExists) {
131
+ $customer = $this->_getSession()->getCustomer();
132
+ $this->_getHelper()->linkAccounts($response, $customer);
133
+ $this->_getHelper()->addDashboardMessageAfterLinking();
134
+ } else {
135
+ $this->_getSession()->addError($this->_getHelper()->__("Your PayPal Access is already linked to another %s account.",
136
+ Mage::app()->getStore()->getFrontendName()));
137
+ }
138
+
139
+ $url = $this->_getloginPostRedirect();
140
+ $this->_closePopup($url);
141
+ }
142
+
143
+ /**
144
+ * Action (for NOT logged customers in Magento) where we return after receive response from PayPal
145
+ *
146
+ * @return
147
+ */
148
+ public function returnAction()
149
+ {
150
+ $response = $this->_verifyResponse();
151
+
152
+ if (!$response) {
153
+ Mage::throwException($this->__('Bad Response.'));
154
+ }
155
+
156
+ $payerId = $response['id'];
157
+ $paypalCustomer = Mage::getModel('paypalauth_identity/paypal_customer');
158
+ $paypalCustomerData = Mage::getModel('paypalauth_identity/paypal_customer')->
159
+ getPaypalCustomerDataByField('payer_id', $payerId);
160
+
161
+ if (!$paypalCustomerData) {
162
+ $this->_getSession()->unsetData('paypalData');
163
+ $this->_getSession()->setData('paypalData', $response);
164
+ $url = Mage::getUrl('login/openid/askLink');
165
+ $this->_closePopup($url);
166
+ return;
167
+ }
168
+
169
+ $customer = $paypalCustomer->logInMagentoCustomerAccount($paypalCustomerData['customer_id']);
170
+ $url = $this->_getloginPostRedirect();
171
+ $this->_closePopup($url);
172
+ }
173
+
174
+ /**
175
+ * Linking accounts page
176
+ *
177
+ * @return void
178
+ */
179
+ public function askLinkAction()
180
+ {
181
+ $params = $this->getRequest()->getParams();
182
+ $paypalData = $this->_getSession()->getData('paypalData');
183
+
184
+ if (!$paypalData) {
185
+ $this->_redirect('customer/account');
186
+ return;
187
+ }
188
+ $params = $this->getRequest()->getParams();
189
+ $paypalData = $this->_getSession()->getData('paypalData');
190
+
191
+ if (!$paypalData) {
192
+ $this->_redirect('customer/account');
193
+ return;
194
+ }
195
+
196
+ $msg = $this->_getSession()->getMessages(true);
197
+ $this->loadLayout();
198
+ $this->getLayout()->getMessagesBlock()->addMessages($msg);
199
+ $this->_initLayoutMessages('core/session');
200
+ $this->renderLayout();
201
+ }
202
+
203
+ /**
204
+ * Linking account post action
205
+ *
206
+ * @return
207
+ */
208
+ public function askLinkPostAction()
209
+ {
210
+ $params = $this->getRequest()->getParams();
211
+ $paypalData = $this->_getSession()->getData('paypalData');
212
+
213
+ if (!$paypalData) {
214
+ $this->_redirect('customer/account');
215
+ return;
216
+ }
217
+
218
+ $askLinkUrl = 'login/openid/askLink';
219
+
220
+ if (array_key_exists('send', $params)) {
221
+ $login = $this->getRequest()->getPost('login');
222
+ $email = $login['username'];
223
+ $customerId = $this->_getCustomerIdByEmail($email);
224
+
225
+ $isPaypalCustomerExists = Mage::getModel('paypalauth_identity/paypal_customer')->
226
+ isPaypalCustomerExists('customer_id', $customerId);
227
+
228
+ if ($isPaypalCustomerExists) {
229
+ $this->_getSession()->addError($this->_getHelper()->__("Your %s account is already linked with PayPal Access.",
230
+ Mage::app()->getStore()->getFrontendName()));
231
+ $this->_redirect($askLinkUrl);
232
+ return;
233
+ }
234
+
235
+ $url = $this->_getLoginPostUrl();
236
+ if ($url == 'login/openid/askLink') {
237
+ $this->_redirect($url);
238
+ return;
239
+ }
240
+ $customer = $this->_getSession()->getCustomer();
241
+ $this->_getHelper()->linkAccounts($paypalData, $customer);
242
+ $this->_getHelper()->addDashboardMessageAfterLinking();
243
+
244
+ } else {
245
+ $customer = Mage::getModel('customer/customer');
246
+ $paypalEmail = $paypalData['email'];
247
+
248
+ $customerId = $this->_getCustomerIdByEmail($paypalEmail);
249
+
250
+ if ($customerId) {
251
+ $this->_getSession()->addError($this->_getHelper()->__("An account already exists with that email address.
252
+ Please enter the credentials to link the account."));
253
+ $this->_redirect($askLinkUrl);
254
+ return;
255
+ }
256
+ $url = $this->_getLoginPostRedirect();
257
+
258
+ try {
259
+ $customer = $this->_getHelper()->createMagentoCustomer($paypalData);
260
+ $paypalCustomer = $this->_getHelper()->linkAccounts($paypalData, $customer);
261
+ $customer = $paypalCustomer->logInMagentoCustomerAccount($customer->getId());
262
+ $this->_getHelper()->addDashboardMessageAfterCreatingAccount();
263
+ } catch(Exception $e) {
264
+ $this->_getSession()->addError($e->getMessage());
265
+ }
266
+ }
267
+ $this->_redirectUrl($url);
268
+ return;
269
+ }
270
+
271
+ /**
272
+ * Check data after log in at linking page
273
+ *
274
+ * @return string
275
+ */
276
+ protected function _getLoginPostUrl()
277
+ {
278
+ $session = $this->_getSession();
279
+
280
+ if ($this->getRequest()->isPost()) {
281
+ $login = $this->getRequest()->getPost('login');
282
+ if (!empty($login['username']) && !empty($login['password'])) {
283
+ try {
284
+ $session->login($login['username'], $login['password']);
285
+ if ($session->getCustomer()->getIsJustConfirmed()) {
286
+ $this->_welcomeCustomer($session->getCustomer(), true);
287
+ }
288
+ } catch (Mage_Core_Exception $e) {
289
+ switch ($e->getCode()) {
290
+ case Mage_Customer_Model_Customer::EXCEPTION_EMAIL_NOT_CONFIRMED:
291
+ $value = Mage::helper('customer')->getEmailConfirmationUrl($login['username']);
292
+ $message = Mage::helper('customer')->__('This account is not confirmed. <a href="%s">Click here</a> to resend confirmation email.', $value);
293
+ break;
294
+ case Mage_Customer_Model_Customer::EXCEPTION_INVALID_EMAIL_OR_PASSWORD:
295
+ $message = $e->getMessage();
296
+ $redirectUrl = 'login/openid/askLink';
297
+ break;
298
+ default:
299
+ $message = $e->getMessage();
300
+ }
301
+ $session->addError($message);
302
+ $session->setUsername($login['username']);
303
+ } catch (Exception $e) {
304
+ // Mage::logException($e); // PA DSS violation: this exception log can disclose customer password
305
+ }
306
+ } else {
307
+ $session->addError($this->__('Login and password are required.'));
308
+ }
309
+ }
310
+ if (empty($redirectUrl)) {
311
+ $redirectUrl = $this->_getloginPostRedirect();
312
+ }
313
+ return $redirectUrl;
314
+ }
315
+
316
+ /**
317
+ * Define and return target URL and redirect customer after logging in
318
+ *
319
+ * @return
320
+ */
321
+ protected function _getloginPostRedirect()
322
+ {
323
+ $session = $this->_getSession();
324
+
325
+ if (!$session->getBeforeAuthUrl() || $session->getBeforeAuthUrl() == Mage::getBaseUrl()) {
326
+ // Set default URL to redirect customer to
327
+ $session->setBeforeAuthUrl(Mage::helper('customer')->getAccountUrl());
328
+ // Redirect customer to the last page visited after logging in
329
+ if ($session->isLoggedIn()) {
330
+ if (!Mage::getStoreConfigFlag('customer/startup/redirect_dashboard')) {
331
+ $referer = $this->getRequest()->getParam(Mage_Customer_Helper_Data::REFERER_QUERY_PARAM_NAME);
332
+ if ($referer) {
333
+ $referer = Mage::helper('core')->urlDecode($referer);
334
+ if ($this->_isUrlInternal($referer)) {
335
+ $session->setBeforeAuthUrl($referer);
336
+ }
337
+ }
338
+ } else if ($session->getAfterAuthUrl()) {
339
+ $session->setBeforeAuthUrl($session->getAfterAuthUrl(true));
340
+ }
341
+ } else {
342
+ $session->setBeforeAuthUrl(Mage::helper('customer')->getLoginUrl());
343
+ }
344
+ } else if ($session->getBeforeAuthUrl() == Mage::helper('customer')->getLogoutUrl()) {
345
+ $session->setBeforeAuthUrl(Mage::helper('customer')->getDashboardUrl());
346
+ } else {
347
+ if (!$session->getAfterAuthUrl()) {
348
+ $session->setAfterAuthUrl($session->getBeforeAuthUrl());
349
+ }
350
+ if ($session->isLoggedIn()) {
351
+ $session->setBeforeAuthUrl($session->getAfterAuthUrl(true));
352
+ }
353
+ }
354
+ return $session->getBeforeAuthUrl(true);
355
+ }
356
+
357
+ /**
358
+ * Unlinking accounts action
359
+ *
360
+ * @return void
361
+ */
362
+ public function unlinkAction()
363
+ {
364
+ if ($this->_getSession()->getCustomer()->getId()) {
365
+ $paypalCustomer = Mage::getModel('paypalauth_identity/paypal_customer')->unlinkAccount();
366
+ $this->_getSession()->addSuccess($this->_getHelper()->__("Your %s account is no longer linked
367
+ with your PayPal Access Account.", Mage::app()->getStore()->getFrontendName()));
368
+ }
369
+
370
+ $this->_redirect('customer/account');
371
+ }
372
+
373
+ /**
374
+ * Verify response from PayPal and prepare response array data
375
+ *
376
+ * @return bool
377
+ */
378
+ protected function _verifyResponse()
379
+ {
380
+ $storage = Mage::helper('paypalauth_identity/data')->getStorage();
381
+ $consumer = Mage::getModel('paypalauth_identity/openId_consumer', $storage);
382
+ $params = $this->getRequest()->getParams();
383
+
384
+ if ($params['openid_mode'] == 'cancel') {
385
+ $this->_justClosePopUp();
386
+ exit();
387
+ }
388
+
389
+ $verify = $consumer->verify($params);
390
+ if (!$verify) {
391
+ return false;
392
+ }
393
+
394
+ $ax = Mage::getModel('paypalauth_identity/openId_extension_ax');
395
+ $ax->parseResponse($params);
396
+ $response = $ax->getProperties();
397
+
398
+ return $response;
399
+ }
400
+
401
+ /**
402
+ * @param $email
403
+ * @return bool|mixed
404
+ */
405
+ protected function _getCustomerIdByEmail($email)
406
+ {
407
+ $customer = Mage::getModel('customer/customer');
408
+ $customer->setWebsiteId(Mage::app()->getStore()->getWebsiteId())->loadByEmail($email);
409
+ if ($customer->getId()) {
410
+ return $customer->getId();
411
+ }
412
+ return false;
413
+ }
414
+
415
+ /**
416
+ * Closes Pop Up window and redirects main page
417
+ *
418
+ * @param null $url
419
+ * @return void
420
+ */
421
+ protected function _closePopUp($url = null)
422
+ {
423
+ ?>
424
+ <script type="text/javascript">
425
+ window.opener.location.href='<?php echo $url ?>';
426
+ self.close();
427
+ </script>
428
+ <?
429
+ }
430
+
431
+ protected function _justClosePopUp($url = null)
432
+ {
433
+ ?>
434
+ <script type="text/javascript">
435
+ self.close();
436
+ </script>
437
+ <?
438
+ }
439
+ }
app/code/community/Paypalauth/Identity/etc/config.xml ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento Enterprise Edition
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Magento Enterprise Edition License
9
+ * that is bundled with this package in the file LICENSE_EE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://www.magentocommerce.com/license/enterprise-edition
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Paypalauth
23
+ * @package Paypalauth_Identity
24
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://www.magentocommerce.com/license/enterprise-edition
26
+ */
27
+ -->
28
+ <config>
29
+ <modules>
30
+ <Paypalauth_Identity>
31
+ <version>0.1.0</version>
32
+ </Paypalauth_Identity>
33
+ </modules>
34
+ <global>
35
+ <models>
36
+ <paypalauth_identity>
37
+ <class>Paypalauth_Identity_Model</class>
38
+ <resourceModel>paypalauth_identity_mysql4</resourceModel>
39
+ </paypalauth_identity>
40
+ <paypalauth_identity_mysql4>
41
+ <class>Paypalauth_Identity_Model_Mysql4</class>
42
+ <entities>
43
+ <customer><table>paypalauth_customer</table></customer>
44
+ </entities>
45
+ </paypalauth_identity_mysql4>
46
+ </models>
47
+ <blocks>
48
+ <paypalauth_identity>
49
+ <class>Paypalauth_Identity_Block</class>
50
+ </paypalauth_identity>
51
+ <customer>
52
+ <rewrite>
53
+ <account_dashboard_info>Paypalauth_Identity_Block_Customer_Account_Dashboard_Info</account_dashboard_info>
54
+ </rewrite>
55
+ </customer>
56
+ </blocks>
57
+ <resources>
58
+ <paypalauth_identity_setup>
59
+ <setup>
60
+ <module>Paypalauth_Identity</module>
61
+ <class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
62
+ </setup>
63
+ </paypalauth_identity_setup>
64
+ </resources>
65
+ <helpers>
66
+ <paypalauth_identity>
67
+ <class>Paypalauth_Identity_Helper</class>
68
+ </paypalauth_identity>
69
+ </helpers>
70
+ </global>
71
+ <adminhtml>
72
+ <events>
73
+ <admin_system_config_changed_section_web>
74
+ <observers>
75
+ <paypalauth_identity>
76
+ <class>paypalauth_identity/observer</class>
77
+ <method>saveSystemConfig</method>
78
+ </paypalauth_identity>
79
+ </observers>
80
+ </admin_system_config_changed_section_web>
81
+ </events>
82
+ </adminhtml>
83
+ <frontend>
84
+ <routers>
85
+ <paypalauth_identity>
86
+ <use>standard</use>
87
+ <args>
88
+ <module>Paypalauth_Identity</module>
89
+ <frontName>login</frontName>
90
+ </args>
91
+ </paypalauth_identity>
92
+ </routers>
93
+ <layout>
94
+ <updates>
95
+ <identity>
96
+ <file>paypalauth/customer.xml</file>
97
+ </identity>
98
+ </updates>
99
+ </layout>
100
+ </frontend>
101
+ </config>
app/code/community/Paypalauth/Identity/etc/system.xml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Magento Enterprise Edition
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Magento Enterprise Edition License
9
+ * that is bundled with this package in the file LICENSE_EE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://www.magentocommerce.com/license/enterprise-edition
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Paypalauth
23
+ * @package Paypalauth_Identity
24
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
25
+ * @license http://www.magentocommerce.com/license/enterprise-edition
26
+ */
27
+ -->
28
+ <config>
29
+ <!-- ... -->
30
+ <sections>
31
+ <!-- ... -->
32
+ <customer>
33
+ <groups>
34
+ <startup>
35
+ <fields>
36
+ <paypalauth_enabled translate="label">
37
+ <frontend_model>paypalauth_identity/adminhtml_form_field_enable</frontend_model>
38
+ <sort_order>1</sort_order>
39
+ <show_in_default>1</show_in_default>
40
+ <show_in_website>0</show_in_website>
41
+ <show_in_store>0</show_in_store>
42
+ </paypalauth_enabled >
43
+ </fields>
44
+ </startup>
45
+ </groups>
46
+ </customer>
47
+ <!-- ... -->
48
+ </sections>
49
+ </config>
app/code/community/Paypalauth/Identity/sql/paypalauth_identity_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento Enterprise Edition
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Magento Enterprise Edition License
8
+ * that is bundled with this package in the file LICENSE_EE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://www.magentocommerce.com/license/enterprise-edition
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 Paypal
22
+ * @package Paypal_Identity
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://www.magentocommerce.com/license/enterprise-edition
25
+ */
26
+
27
+ /* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
28
+ $installer = $this;
29
+
30
+ $installer->startSetup();
31
+
32
+ $installer->run("
33
+ CREATE TABLE IF NOT EXISTS `{$installer->getTable('paypalauth_identity/customer')}`(
34
+ `id` INT(10) NOT NULL AUTO_INCREMENT,
35
+ `payer_id` VARCHAR(255) NOT NULL DEFAULT '',
36
+ `customer_id` INT(10) UNSIGNED NOT NULL,
37
+ `email` VARCHAR(255) NOT NULL DEFAULT '',
38
+ PRIMARY KEY (`id`),
39
+ UNIQUE KEY `IDX_UNIQUE_PAYER_ID` (`payer_id`),
40
+ UNIQUE KEY `IDX_UNIQUE_CUSTOMER_ID` (`customer_id`),
41
+ KEY `FK_CUSTOMER_PAYPAL_CUSTOMER_ID` (`customer_id`),
42
+ CONSTRAINT `FK_CUSTOMER_PAYPAL_CUSTOMER_ID` FOREIGN KEY (`customer_id`) REFERENCES `{$installer->getTable('customer_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
43
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
44
+ ");
45
+
46
+ $installer->endSetup();
app/design/frontend/base/default/layout/paypalauth/customer.xml ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento Enterprise Edition
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Magento Enterprise Edition License
9
+ * that is bundled with this package in the file LICENSE_EE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://www.magentocommerce.com/license/enterprise-edition
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category design
23
+ * @package paypalauth
24
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://www.magentocommerce.com/license/enterprise-edition
26
+ */
27
+
28
+ Supported layout update handles (action):
29
+ - customer_account_index
30
+ - customer_address_index
31
+ - customer_address_view
32
+ - customer_account_login
33
+ - customer_account_logoutsuccess
34
+ - customer_account_create
35
+ - customer_account_forgotpassword
36
+ - customer_account_confirmation
37
+ - customer_account_edit
38
+
39
+ Supported layout update handles (special):
40
+ - default
41
+
42
+ -->
43
+ <layout version="0.1.0">
44
+
45
+ <default>
46
+ <!-- Mage_Customer -->
47
+ <reference name="head">
48
+ <action method="addItem" ifconfig="customer/startup/paypalauth_enabled"><type>skin_js</type><name>js/paypalauth/paypalauth.js</name><params/></action>
49
+ </reference>
50
+ </default>
51
+
52
+ <customer_logged_in>
53
+ <reference name="top.links">
54
+ <action method="removeLinkByUrl" ifconfig="customer/startup/paypalauth_enabled"><url helper="customer/getLogoutUrl"/></action>
55
+ <action method="addLink" translate="label title" module="customer" ifconfig="customer/startup/paypalauth_enabled"><label>Log Out</label><url helper="customer/getLogoutUrl"/><title>Log Out</title><prepare/><urlParams/><position>100</position><liParams/><aParams><id>paypalout</id><onclick>return logOutFromPaypal()</onclick></aParams></action>
56
+ </reference>
57
+ </customer_logged_in>
58
+
59
+ <customer_logged_out>
60
+ <reference name="top.links">
61
+ <action method="addLink" translate="label title" module="customer" ifconfig="customer/startup/paypalauth_enabled"><label>.</label><url helper="paypalauth_identity/getPopUpLoginUrl"/><title>Log In With Paypal</title><prepare/><urlParams/><position>100</position><liParams/><aParams><id>topPayPalIn</id><class>top-link-paypalauth</class><onclick>return payPalPopUp()</onclick></aParams></action>
62
+ </reference>
63
+ <reference name="head">
64
+ <action method="addItem" ifconfig="customer/startup/paypalauth_enabled"><type>skin_css</type><name>css/paypalauth/styles.css</name><params/></action>
65
+ </reference>
66
+ </customer_logged_out>
67
+
68
+ <customer_account_index>
69
+ <!-- Mage_Review -->
70
+ <reference name="customer_account_dashboard_info">
71
+ <block type="paypalauth_identity/customer_account_dashboard_info" name="customer_account_dashboard_info_paypalauth_identity" as="paypalauth_dashboard" template="paypalauth/customer/account/dashboard/info.phtml"/>
72
+ </reference>
73
+ </customer_account_index>
74
+
75
+ <customer_account_login>
76
+ <reference name="customer_form_login">
77
+ <action method="setTemplate"><template>paypalauth/customer/form/login.phtml</template></action>
78
+ <block type="paypalauth_identity/form_paypal_login" name="paypalauth.login" template="paypalauth/paypal_login.phtml" />
79
+ <block type="persistent/form_remember" name="persistent.remember.me" template="persistent/remember_me.phtml" />
80
+ <block type="core/template" name="persistent.remember.me.tooltip" template="persistent/remember_me_tooltip.phtml" />
81
+ </reference>
82
+ </customer_account_login>
83
+
84
+ <customer_account_create>
85
+ <reference name="customer_form_register">
86
+ <action method="setTemplate"><template>paypalauth/customer/form/register.phtml</template></action>
87
+ <block type="paypalauth_identity/form_paypal_login" name="paypalauth.register" template="paypalauth/paypal_register.phtml" />
88
+ <block type="persistent/form_remember" name="persistent.remember.me" template="persistent/remember_me.phtml" />
89
+ <block type="core/template" name="persistent.remember.me.tooltip" template="persistent/remember_me_tooltip.phtml" />
90
+ </reference>
91
+ </customer_account_create>
92
+
93
+ <checkout_onepage_index>
94
+ <reference name="checkout.onepage.login">
95
+ <action method="setTemplate"><template>paypalauth/checkout/onepage/login.phtml</template></action>
96
+ <block type="paypalauth_identity/form_paypal_login" name="paypalauth.checkout.guest" template="paypalauth/paypal_checkout.phtml" />
97
+ <block type="persistent/form_remember" name="persistent.remember.me" template="persistent/remember_me.phtml" />
98
+ </reference>
99
+ </checkout_onepage_index>
100
+
101
+ <paypalauth_identity_openid_asklink>
102
+ <reference name="root">
103
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
104
+ </reference>
105
+ <reference name="content">
106
+ <block type="paypalauth_identity/customer_account_asklink" name="paypalauth" template="paypalauth/customer/account/asklink.phtml"/>
107
+ </reference>
108
+ </paypalauth_identity_openid_asklink>
109
+
110
+ </layout>
app/design/frontend/base/default/template/paypalauth/checkout/onepage/login.phtml ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-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 design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Customer onepage checkout login form template
30
+ *
31
+ * @see app/design/frontend/base/default/template/checkout/onepage/login.phtml
32
+ */
33
+ ?>
34
+
35
+ <?php
36
+ // Check if current Magento version includes Persistent Shopping Cart Extension
37
+ $isPersistantShoppingCartEnabled = Mage::getStoreConfigFlag('persistent/options/enabled');
38
+ ?>
39
+
40
+ <?php echo $this->getChildHtml('paypalauth.checkout.guest'); ?>
41
+ <div class="col2-set">
42
+ <?php echo $this->getChildHtml('login_before')?>
43
+ <div class="col-1">
44
+ <h3><?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
45
+ <?php echo $this->__('Checkout as a Guest or Register') ?><?php else: ?><?php echo $this->__('Register to Create an Account') ?><?php endif; ?></h3>
46
+ <?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
47
+ <p><?php echo $this->__('Register with us for future convenience:') ?></p>
48
+ <?php else: ?>
49
+ <p><strong><?php echo $this->__('Register and save time!') ?></strong><br />
50
+ <?php echo $this->__('Register with us for future convenience:') ?></p>
51
+ <ul>
52
+ <li><?php echo $this->__('Fast and easy check out') ?></li>
53
+ <li><?php echo $this->__('Easy access to your order history and status') ?></li>
54
+ </ul>
55
+ <?php endif; ?>
56
+ <?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
57
+ <ul class="form-list">
58
+ <?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
59
+ <li class="control">
60
+ <input type="radio" name="checkout_method" id="login:guest" value="guest"<?php if($this->getQuote()->getCheckoutMethod()==Mage_Checkout_Model_Type_Onepage::METHOD_GUEST): ?> checked="checked"<?php endif; ?> class="radio" /><label for="login:guest"><?php echo $this->__('Checkout as Guest') ?></label>
61
+ </li>
62
+ <?php endif; ?>
63
+ <li class="control">
64
+ <input type="radio" name="checkout_method" id="login:register" value="register"<?php if($this->getQuote()->getCheckoutMethod()==Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER || !$this->getQuote()->isAllowedGuestCheckout()): ?> checked="checked"<?php endif ?> class="radio" /><label for="login:register"><?php echo $this->__('Register') ?></label>
65
+ </li>
66
+ </ul>
67
+ <h4><?php echo $this->__('Register and save time!') ?></h4>
68
+ <p><?php echo $this->__('Register with us for future convenience:') ?></p>
69
+ <ul class="ul">
70
+ <li><?php echo $this->__('Fast and easy check out') ?></li>
71
+ <li><?php echo $this->__('Easy access to your order history and status') ?></li>
72
+ </ul>
73
+ <?php else: ?>
74
+ <input type="hidden" name="checkout_method" id="login:register" value="register" checked="checked" />
75
+ <?php endif; ?>
76
+ </div>
77
+ <div class="col-2">
78
+ <h3><?php echo $this->__('Login') ?></h3>
79
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
80
+ <form id="login-form" action="<?php echo $this->getPostAction() ?>" method="post">
81
+ <fieldset>
82
+ <h4><?php echo $this->__('Already registered?') ?></h4>
83
+ <p><?php echo $this->__('Please log in below:') ?></p>
84
+ <ul class="form-list">
85
+ <li>
86
+ <label for="login-email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
87
+ <div class="input-box">
88
+ <input type="text" class="input-text required-entry validate-email" id="login-email" name="login[username]" value="<?php echo $this->htmlEscape($this->getUsername()) ?>" />
89
+ </div>
90
+ </li>
91
+ <li>
92
+ <label for="login-password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
93
+ <div class="input-box">
94
+ <input type="password" class="input-text required-entry" id="login-password" name="login[password]" />
95
+ </div>
96
+ </li>
97
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
98
+ </ul>
99
+ <?php if ($isPersistantShoppingCartEnabled): ?>
100
+ <input name="context" type="hidden" value="checkout" />
101
+ <?php endif; ?>
102
+ </fieldset>
103
+ </form>
104
+ </div>
105
+ </div>
106
+ <div class="col2-set">
107
+ <div class="col-1">
108
+ <div class="buttons-set">
109
+ <p class="required">&nbsp;</p>
110
+ <?php if ($isPersistantShoppingCartEnabled): ?>
111
+ <?php if ($this->getQuote()->isAllowedGuestCheckout()): ?>
112
+ <button id="onepage-guest-register-button" type="button" class="button" onclick="checkout.setMethod();"><span><span><?php echo $this->__('Continue') ?></span></span></button>
113
+ <?php else: ?>
114
+ <form action="<?php echo $this->getUrl('persistent/index/saveMethod'); ?>">
115
+ <button id="onepage-guest-register-button" type="submit" class="button"><span><span><?php echo $this->__('Register') ?></span></span></button>
116
+ </form>
117
+ <?php endif; ?>
118
+ <?php else: ?>
119
+ <button type="button" class="button" onclick="checkout.setMethod();"><span><span><?php echo ($this->getQuote()->isAllowedGuestCheckout() ? $this->__('Continue') : $this->__('Register')) ?></span></span></button>
120
+ <?php endif; ?>
121
+ </div>
122
+ </div>
123
+ <div class="col-2">
124
+ <div class="buttons-set">
125
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
126
+ <a href="<?php echo $this->getUrl('customer/account/forgotpassword') ?>" class="f-left"><?php echo $this->__('Forgot your password?') ?></a>
127
+ <button type="submit" class="button" onclick="onepageLogin(this)"><span><span><?php echo $this->__('Login') ?></span></span></button>
128
+ </div>
129
+ </div>
130
+ </div>
131
+ <script type="text/javascript">
132
+ //<![CDATA[
133
+ var loginForm = new VarienForm('login-form', true);
134
+ $('login-email').observe('keypress', bindLoginPost);
135
+ $('login-password').observe('keypress', bindLoginPost);
136
+ function bindLoginPost(evt){
137
+ if (evt.keyCode == Event.KEY_RETURN) {
138
+ loginForm.submit();
139
+ }
140
+ }
141
+ function onepageLogin(button)
142
+ {
143
+ if(loginForm.validator && loginForm.validator.validate()){
144
+ button.disabled = true;
145
+ loginForm.submit();
146
+ }
147
+ }
148
+ //]]>
149
+ </script>
150
+ <?php
151
+ if ($isPersistantShoppingCartEnabled):
152
+ $registerParam = $this->getRequest()->getParam('register');
153
+ if ($registerParam || $registerParam === ''):
154
+ ?>
155
+ <script type="text/javascript">
156
+ //<![CDATA[
157
+ document.observe("dom:loaded", function() {
158
+ if($('login:register')) {
159
+ $('login:register').checked = true;
160
+ checkout.setMethod();
161
+ }
162
+ })
163
+ //]]>
164
+ </script>
165
+ <?php endif; ?>
166
+ <?php endif; ?>
app/design/frontend/base/default/template/paypalauth/customer/account/asklink.phtml ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-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 design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Additional customer login form template for Paypalauth Identity extension
30
+ *
31
+ * @see Mage_Customer_Block_Form_Login
32
+ */
33
+ ?>
34
+ <div class="account-create">
35
+ <div class="page-title">
36
+ <h1><?php echo $this->__('Link Your %s Account to PayPal Access', Mage::app()->getStore()->getFrontendName()) ?></h1>
37
+ </div>
38
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
39
+ <form action="<?php echo $this->getAskLinkPostActionUrl() ?>" method="post" id="login-form">
40
+ <div class="fieldset">
41
+ <h2 class="legend"><?php echo $this->__(Mage::app()->getStore()->getFrontendName()) ?></h2>
42
+ <p><?php echo $this->__('Do you already have an account with %s? If yes, please enter your Magento Store login
43
+ information to link it with your PayPal Access account to get special offers and perks.', Mage::app()->getStore()->getFrontendName()) ?></p>
44
+ <ul class="form-list">
45
+ <li>
46
+ <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
47
+ <div class="input-box">
48
+ <input type="text" name="login[username]" value="<?php echo $this->htmlEscape($this->getUsername()) ?>" id="email" class="input-text required-entry validate-email" title="<?php echo $this->__('Email Address') ?>" />
49
+ </div>
50
+ </li>
51
+ <li>
52
+ <label for="pass" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
53
+ <div class="input-box">
54
+ <input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->__('Password') ?>" />
55
+ </div>
56
+ </li>
57
+ </ul>
58
+ <div class="buttons-set">
59
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
60
+ <a href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left"><?php echo $this->__('Forgot Your Password?') ?></a>
61
+ <button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span><span><?php echo $this->__('Link Accounts') ?></span></span></button>
62
+ <button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="cancel" id="cancel"><span><span><?php echo $this->__('I Don\'t Have An Account') ?></span></span></button>
63
+ </div>
64
+ </div>
65
+ </form>
66
+ <script type="text/javascript">
67
+ //<![CDATA[
68
+ var dataForm = new VarienForm('login-form', true);
69
+ if ($('cancel')) {
70
+ Event.observe('cancel', 'click', removeValidation);
71
+ }
72
+ function removeValidation() {
73
+ $('email').className = '';
74
+ $('pass').className = '';
75
+ }
76
+ //]]>
77
+ </script>
78
+ </div>
app/design/frontend/base/default/template/paypalauth/customer/account/dashboard/info.phtml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-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 design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+
28
+ <div class="col-2">
29
+ <div class="box">
30
+ <div class="box-title">
31
+ <h3><?php echo $this->__('PayPal Access Account') ?></h3>
32
+ </div>
33
+ <div class="box-content">
34
+ <p>
35
+ <?php if(!$this->getPaypalCustomerEmail()): ?>
36
+ <p><?php echo $this->__('Log in quickly, easily and safely with PayPal Access') ?></p>
37
+ <ul style="list-style: disc outside none;padding-left: 18px;">
38
+ <li><?php echo $this->__('Avoid the hassle of filling in yet another registration form') ?></li>
39
+ <li><?php echo $this->__('Just one password to remember') ?></li>
40
+ </ul>
41
+ <br />
42
+ <button type="button" id="linkWithPaypal" title="<?php echo $this->__('Link Account') ?>" class="button"><span><span><?php echo $this->__('Link Account') ?></span></span></button>
43
+ <?php else: ?>
44
+ <?php echo $this->__('PayPal Access Linked Account: '); echo $this->getPaypalCustomerEmail() ?><br />
45
+ <a href="<?php echo $this->getUnlinkUrl()?>" id="unLinkWithPaypal"><?php echo $this->__('Unlink') ?></a>
46
+ <?php endif; ?>
47
+ </p>
48
+ <br />
49
+ </div>
50
+ </div>
51
+ </div>
52
+ <script type="text/javascript">
53
+ //<![CDATA[
54
+ if ($('linkWithPaypal')) {
55
+ Event.observe('linkWithPaypal', 'click', link);
56
+ }
57
+ function link() {
58
+ mywindow = window.open('<?php echo $this->getAuthLoginUrl() ?>', "_PPIdentityWindow_", "location=1,status=0,scrollbars=0,width=400,height=550"); return false;
59
+ }
60
+ //]]>
61
+ </script>
app/design/frontend/base/default/template/paypalauth/customer/form/login.phtml ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-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 design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Customer login form template
30
+ *
31
+ * @see app/design/frontend/base/default/template/customer/form/login.phtml
32
+ */
33
+ ?>
34
+
35
+ <?php
36
+ // Check if current Magento version includes Persistent Shopping Cart Extension
37
+ $isPersistantShoppingCartEnabled = Mage::getStoreConfigFlag('persistent/options/enabled');
38
+ if ($isPersistantShoppingCartEnabled) {
39
+ $accountUrl = Mage::helper('persistent')->getCreateAccountUrl($this->getCreateAccountUrl());
40
+ $isContextCheckout = Mage::helper('checkout')->isContextCheckout();
41
+ } else {
42
+ $accountUrl = $this->getCreateAccountUrl();
43
+ }
44
+ ?>
45
+
46
+ <div class="account-login">
47
+ <div class="page-title">
48
+ <h1><?php echo $this->__('Login or Create an Account') ?></h1>
49
+ </div>
50
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
51
+ <?php echo $this->getChildHtml('paypalauth.login'); ?>
52
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form">
53
+ <div class="col2-set">
54
+ <div class="col-1 new-users">
55
+ <div class="content">
56
+ <h2><?php echo $this->__('New Customers') ?></h2>
57
+ <p><?php echo $this->__('By creating an account with our store, you will be able to move through the checkout process faster, store multiple shipping addresses, view and track your orders in your account and more.') ?></p>
58
+ </div>
59
+ </div>
60
+ <div class="col-2 registered-users">
61
+ <div class="content">
62
+ <h2><?php echo $this->__('Registered Customers') ?></h2>
63
+ <p><?php echo $this->__('If you have an account with us, please log in.') ?></p>
64
+ <ul class="form-list">
65
+ <li>
66
+ <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
67
+ <div class="input-box">
68
+ <input type="text" name="login[username]" value="<?php echo $this->htmlEscape($this->getUsername()) ?>" id="email" class="input-text required-entry validate-email" title="<?php echo $this->__('Email Address') ?>" />
69
+ </div>
70
+ </li>
71
+ <li>
72
+ <label for="pass" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
73
+ <div class="input-box">
74
+ <input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->__('Password') ?>" />
75
+ </div>
76
+ </li>
77
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
78
+ </ul>
79
+ <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
80
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
81
+ </div>
82
+ </div>
83
+ </div>
84
+ <div class="col2-set">
85
+ <div class="col-1 new-users">
86
+ <div class="buttons-set">
87
+ <button type="button" title="<?php echo $this->__('Create an Account') ?>" class="button" onclick="window.location='<?php echo $accountUrl ?>';"><span><span><?php echo $this->__('Create an Account') ?></span></span></button>
88
+ </div>
89
+ </div>
90
+ <div class="col-2 registered-users">
91
+ <div class="buttons-set">
92
+ <a href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left"><?php echo $this->__('Forgot Your Password?') ?></a>
93
+ <button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button>
94
+ </div>
95
+ </div>
96
+ </div>
97
+ <?php if ($isContextCheckout): ?>
98
+ <input name="context" type="hidden" value="checkout" />
99
+ <?php endif; ?>
100
+ </form>
101
+ <script type="text/javascript">
102
+ //<![CDATA[
103
+ var dataForm = new VarienForm('login-form', true);
104
+ //]]>
105
+ </script>
106
+ </div>
app/design/frontend/base/default/template/paypalauth/customer/form/register.phtml ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-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 design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Customer register form template
30
+ *
31
+ * @see app/design/frontend/base/default/template/customer/form/register.phtml
32
+ */
33
+ ?>
34
+
35
+ <?php
36
+ // Check if current Magento version includes Persistent Shopping Cart Extension
37
+ $isPersistantShoppingCartEnabled = Mage::getStoreConfigFlag('persistent/options/enabled');
38
+ if ($isPersistantShoppingCartEnabled) {
39
+ $html = $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->setForceUseCustomerAttributes(true)->toHtml();
40
+ $isContextCheckout = Mage::helper('checkout')->isContextCheckout();
41
+ } else {
42
+ $html = $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->toHtml();
43
+ }
44
+ ?>
45
+
46
+ <div class="account-create">
47
+ <div class="page-title">
48
+ <h1><?php echo $this->__('Create an Account') ?></h1>
49
+ </div>
50
+ <?php echo $this->getChildHtml('form_fields_before')?>
51
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
52
+ <?php echo $this->getChildHtml('paypalauth.register'); ?>
53
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate">
54
+ <div class="fieldset">
55
+ <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
56
+ <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
57
+ <h2 class="legend"><?php echo $this->__('Personal Information') ?></h2>
58
+ <ul class="form-list">
59
+ <li class="fields">
60
+ <?php echo $html ?>
61
+ </li>
62
+ <li>
63
+ <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
64
+ <div class="input-box">
65
+ <input type="text" name="email" id="email_address" value="<?php echo $this->htmlEscape($this->getFormData()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
66
+ </div>
67
+ </li>
68
+ <?php if ($this->isNewsletterEnabled()): ?>
69
+ <li class="control">
70
+ <div class="input-box">
71
+ <input type="checkbox" name="is_subscribed" title="<?php echo $this->__('Sign Up for Newsletter') ?>" value="1" id="is_subscribed"<?php if($this->getFormData()->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" />
72
+ </div>
73
+ <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
74
+ </li>
75
+ <?php endif ?>
76
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
77
+ <?php if ($_dob->isEnabled()): ?>
78
+ <li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
79
+ <?php endif ?>
80
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
81
+ <?php if ($_taxvat->isEnabled()): ?>
82
+ <li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
83
+ <?php endif ?>
84
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
85
+ <?php if ($_gender->isEnabled()): ?>
86
+ <li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
87
+ <?php endif ?>
88
+ </ul>
89
+ </div>
90
+ <?php if($this->getShowAddressFields()): ?>
91
+ <div class="fieldset">
92
+ <input type="hidden" name="create_address" value="1" />
93
+ <h2 class="legend"><?php echo $this->__('Address Information') ?></h2>
94
+ <ul class="form-list">
95
+ <li class="fields">
96
+ <div class="field">
97
+ <label for="company"><?php echo $this->__('Company') ?></label>
98
+ <div class="input-box">
99
+ <input type="text" name="company" id="company" value="<?php echo $this->htmlEscape($this->getFormData()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" />
100
+ </div>
101
+ </div>
102
+ <div class="field">
103
+ <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
104
+ <div class="input-box">
105
+ <input type="text" name="telephone" id="telephone" value="<?php echo $this->htmlEscape($this->getFormData()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text required-entry" />
106
+ </div>
107
+ </div>
108
+ </li>
109
+ <li class="wide">
110
+ <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
111
+ <div class="input-box">
112
+ <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getFormData()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="input-text required-entry" />
113
+ </div>
114
+ </li>
115
+ <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
116
+ <li class="wide">
117
+ <div class="input-box">
118
+ <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getFormData()->getStreet($_i)) ?>" title="<?php echo $this->__('Street Address %s', $_i) ?>" id="street_<?php echo $_i?>" class="input-text" />
119
+ </div>
120
+ </li>
121
+ <?php endfor ?>
122
+ <li class="fields">
123
+ <div class="field">
124
+ <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
125
+ <div class="input-box">
126
+ <input type="text" name="city" value="<?php echo $this->htmlEscape($this->getFormData()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="input-text required-entry" id="city" />
127
+ </div>
128
+ </div>
129
+ <div class="field">
130
+ <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
131
+ <div class="input-box">
132
+ <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
133
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
134
+ </select>
135
+ <script type="text/javascript">
136
+ //<![CDATA[
137
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
138
+ //]]>
139
+ </script>
140
+ <input type="text" id="region" name="region" value="<?php echo $this->htmlEscape($this->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
141
+ </div>
142
+ </div>
143
+ </li>
144
+ <li class="fields">
145
+ <div class="field">
146
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
147
+ <div class="input-box">
148
+ <input type="text" name="postcode" value="<?php echo $this->htmlEscape($this->getFormData()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international required-entry" />
149
+ </div>
150
+ </div>
151
+ <div class="field">
152
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
153
+ <div class="input-box">
154
+ <?php echo $this->getCountryHtmlSelect() ?>
155
+ </div>
156
+ </div>
157
+ </li>
158
+ </ul>
159
+ <input type="hidden" name="default_billing" value="1" />
160
+ <input type="hidden" name="default_shipping" value="1" />
161
+ </div>
162
+ <?php endif; ?>
163
+ <div class="fieldset">
164
+ <h2 class="legend"><?php echo $this->__('Login Information') ?></h2>
165
+ <ul class="form-list">
166
+ <li class="fields">
167
+ <div class="field">
168
+ <label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
169
+ <div class="input-box">
170
+ <input type="password" name="password" id="password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
171
+ </div>
172
+ </div>
173
+ <div class="field">
174
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
175
+ <div class="input-box">
176
+ <input type="password" name="confirmation" title="<?php echo $this->__('Confirm Password') ?>" id="confirmation" class="input-text required-entry validate-cpassword" />
177
+ </div>
178
+ </div>
179
+ </li>
180
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
181
+ </ul>
182
+ <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
183
+ </div>
184
+ <div class="buttons-set">
185
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
186
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
187
+ <button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
188
+ </div>
189
+ <?php if ($isContextCheckout): ?>
190
+ <input name="context" type="hidden" value="checkout" />
191
+ <?php endif; ?>
192
+ </form>
193
+ <script type="text/javascript">
194
+ //<![CDATA[
195
+ var dataForm = new VarienForm('form-validate', true);
196
+ <?php if($this->getShowAddressFields()): ?>
197
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
198
+ <?php endif; ?>
199
+ //]]>
200
+ </script>
201
+ </div>
app/design/frontend/base/default/template/paypalauth/paypal_checkout.phtml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <div>
2
+ <h3><?php echo $this->__('PayPal Access Customers') ?></h3>
3
+ <p><?php echo $this->__('Log in quickly, easily and safely with PayPal Access') ?></p>
4
+ <ul style="list-style: disc outside none;padding-left: 18px;">
5
+ <li><?php echo $this->__('Avoid the hassle of filling in yet another registration form') ?></li>
6
+ <li><?php echo $this->__('Just one password to remember') ?><input type="image" src="https://www.paypal.com/en_US/i/btn/login-with-paypal-button.png" name="submit_with_popup" id="submit_with_popup" alt="Log in with PayPal" onclick="return payPalPopUp()" style="margin-left: 200px"/></li>
7
+ </ul>
8
+ <div class="paypal-or">
9
+ <center><h4>OR</h4></center>
10
+ </div>
11
+ </div>
app/design/frontend/base/default/template/paypalauth/paypal_login.phtml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-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 design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Customer Paypalauth Identity Login Section template
30
+ *
31
+ */
32
+ ?>
33
+ <div class="content new-users col-1" style="min-height: 0px">
34
+ <h2><?php echo $this->__('Log In Using Your PayPal Access Account') ?></h2>
35
+ <p><?php echo $this->__('Log in quickly, easily and safely with PayPal Access') ?></p>
36
+ <ul style="list-style: disc outside none;padding-left: 18px;">
37
+ <li><?php echo $this->__('Avoid the hassle of filling in yet another registration form') ?></li>
38
+ <li><?php echo $this->__('Just one password to remember') ?></li>
39
+ </ul>
40
+ </div>
41
+ <div class="buttons-set" style="text-align: left;margin-bottom: 25px">
42
+ <input type="image" src="https://www.paypal.com/en_US/i/btn/login-with-paypal-button.png" name="submit_with_popup" id="submit_with_popup" alt="Log in with PayPal Access" onclick="return payPalPopUp()"/>
43
+ </div>
44
+
45
+
app/design/frontend/base/default/template/paypalauth/paypal_register.phtml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-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 design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Customer Paypalauth Identity Registration Section template
30
+ *
31
+ */
32
+ ?>
33
+
34
+ <div>
35
+ <h4><?php echo $this->__('Use PayPal Access to create your account, easily!') ?></h4>
36
+ <p><?php echo $this->__('Log in quickly, easily and safely with PayPal Access') ?></p>
37
+ <ul style="list-style: disc outside none;padding-left: 18px;">
38
+ <li><?php echo $this->__('Anyone with a PayPal Account can do it') ?></li>
39
+ <li><?php echo $this->__('Avoid the hassle of filling in yet another registration form') ?></li>
40
+ <li><?php echo $this->__('Just one password to remember') ?><input type="image" src="https://www.paypal.com/en_US/i/btn/login-with-paypal-button.png" name="submit_with_popup" id="submit_with_popup" alt="Log in with PayPal Access" onclick="return payPalPopUp('<?php echo $this->getPaypalAccessUrl() ?>')" style="margin-left: 200px"/></li>
41
+ </ul>
42
+ <div class="paypal-or">
43
+ <center><h4>OR</h4></center>
44
+ </div>
45
+ </div>
app/etc/modules/Paypalauth_Identity.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento Enterprise Edition
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Magento Enterprise Edition License
9
+ * that is bundled with this package in the file LICENSE_EE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://www.magentocommerce.com/license/enterprise-edition
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category Iwerk
23
+ * @package Ford_Iwerk
24
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://www.magentocommerce.com/license/enterprise-edition
26
+ */
27
+ -->
28
+ <config>
29
+ <modules>
30
+ <Paypalauth_Identity>
31
+ <active>true</active>
32
+ <codePool>community</codePool>
33
+ </Paypalauth_Identity>
34
+ </modules>
35
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>test_app_do_not_install</name>
4
+ <version>1.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Integration with PayPal</summary>
10
+ <description>Current integration includes log in, account creation using PayPal</description>
11
+ <notes>1.1.0</notes>
12
+ <authors><author><name>Paypal</name><user>auto-converted</user><email>alex.gotgelf@magentocommerce.com</email></author></authors>
13
+ <date>2011-09-30</date>
14
+ <time>19:02:03</time>
15
+ <contents><target name="magecommunity"><dir name="Paypalauth"><dir name="Identity"><dir name="Block"><dir name="Adminhtml"><dir name="Form"><dir name="Field"><file name="Enable.php" hash="fd4fcae5c5a80247ab79190654ae5ac9"/></dir></dir></dir><dir name="Customer"><dir name="Account"><dir name="Dashboard"><file name="Info.php" hash="147e9835deb45d384e13baa89a40dc65"/></dir><file name="Asklink.php" hash="8a9ebcaacfcca888eb62f0b9f25d46c3"/></dir></dir><dir name="Form"><dir name="Paypal"><file name="Login.php" hash="27a46eea2e1656e1155ac2e2d5c18cf1"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="a4c7a4df67776a1a166351ba87b38930"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Paypal"><dir name="Customer"><file name="Collection.php" hash="9000318b3d6546eb1d611909ca164c63"/></dir><file name="Customer.php" hash="dc32a411d3051cc278d27f3bf04e54e5"/></dir></dir><dir name="OpenId"><dir name="Extension"><file name="Ax.php" hash="c76454373196a9cd592263cb9aaf5d54"/></dir><file name="Consumer.php" hash="eea1b4cf0136408f83877a5e7d04ce7f"/></dir><dir name="Paypal"><file name="Customer.php" hash="b618d33f8ea0c5f4ef0c27cd0e43a2c3"/></dir><file name="Observer.php" hash="8eb94b8ca03a827774d0fb35da2695f4"/></dir><dir name="controllers"><file name="OpenidController.php" hash="5083895717ce31ff4b7bf5cc5cf4dcd7"/></dir><dir name="etc"><file name="config.xml" hash="cc7f5619170b0790f791bcd704944182"/><file name="system.xml" hash="287dfa8382481dfc3047dc6390d72ba1"/></dir><dir name="sql"><dir name="paypalauth_identity_setup"><file name="mysql4-install-0.1.0.php" hash="ff20c0942e45cdf66728002f946f1bde"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Paypalauth_Identity.xml" hash="9da95abb68dd23bce0d00c2d00d27ebd"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="paypalauth"><dir name="checkout"><dir name="onepage"><file name="login.phtml" hash="eb0f6db455006ba5d11ac8fe40581ae1"/></dir></dir><dir name="customer"><dir name="account"><dir name="dashboard"><file name="info.phtml" hash="153151484ece7b927539f35ecacb121f"/></dir><file name="asklink.phtml" hash="d869f61285e6bfb1b8431eed3a71f880"/></dir><dir name="form"><file name="login.phtml" hash="5f7881edb65edafb7cbae02aa88d9a1d"/><file name="register.phtml" hash="e3bcc47bbe17172968b7d01d1df2460e"/></dir></dir><file name="paypal_checkout.phtml" hash="9f08061752cb316c72ba8d6923cd7f71"/><file name="paypal_login.phtml" hash="9456227fe2d8d606a7b7f97e05585a60"/><file name="paypal_register.phtml" hash="2cfd590b05be2ba305720d8a6d42901c"/></dir></dir><dir name="layout"><dir name="paypalauth"><file name="customer.xml" hash="d9b9f07325351ae4d2816dfe2d5b0123"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="paypalauth"><file name="styles.css" hash="02d9b47e0084c362759d9871209a9dca"/></dir></dir><dir name="js"><dir name="paypalauth"><file name="paypalauth.js" hash="15b47d1d1cafc2c64cba1dd03725d083"/></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>
skin/frontend/base/default/css/paypalauth/styles.css ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ a.top-link-paypalauth {
2
+ padding-right: 160px;
3
+ text-decoration: none;
4
+ color: #ed9333 !important;
5
+ font-size: 21px;
6
+ background: url('https://www.paypal.com/en_US/i/btn/login-with-paypal-button.png') no-repeat top;
7
+ }
8
+
9
+ .paypal-or { border-bottom:1px solid #ddd;border-top:1px solid #ddd; padding:5px 0 5px; margin:10px 0 10px; }
skin/frontend/base/default/js/paypalauth/paypalauth.js ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function logOutFromPaypal()
2
+ {
3
+ var Pixel = new Element('img', {src:"https://www.paypal.com/webapps/auth/logout", width:"1px", height:"1px"});
4
+ url = $('paypalout').readAttribute('href');
5
+ setTimeout(function(){ document.body.appendChild(Pixel);location.href = url},2000);
6
+ return false;
7
+ }
8
+
9
+ function payPalPopUp(url)
10
+ {
11
+ if (!url) {
12
+ url = $('topPayPalIn').readAttribute('href');
13
+ }
14
+ mywindow = window.open (url, "_PPIdentityWindow_", "location=1, status=0, scrollbars=0, width=400, height=550");
15
+ return false;
16
+ }
17
+