Webformat_LoginWithPayPal - Version 0.9.0

Version Notes

First stable release

Download this release

Release Info

Developer WEBFORMAT s.r.l.
Extension Webformat_LoginWithPayPal
Version 0.9.0
Comparing to
See all releases


Version 0.9.0

Files changed (24) hide show
  1. app/code/community/Webformat/LoginWithPayPal/Block/AbstractButton.php +101 -0
  2. app/code/community/Webformat/LoginWithPayPal/Block/Checkout/Onepage/Login/Button.php +48 -0
  3. app/code/community/Webformat/LoginWithPayPal/Block/Customer/Form/Login/Button.php +48 -0
  4. app/code/community/Webformat/LoginWithPayPal/Block/Customer/Form/Login/LoginWithPayPal.php +86 -0
  5. app/code/community/Webformat/LoginWithPayPal/Helper/Data.php +62 -0
  6. app/code/community/Webformat/LoginWithPayPal/Model/AbstractRequest.php +44 -0
  7. app/code/community/Webformat/LoginWithPayPal/Model/AccessToken.php +75 -0
  8. app/code/community/Webformat/LoginWithPayPal/Model/BackendNotifier/Feed.php +107 -0
  9. app/code/community/Webformat/LoginWithPayPal/Model/BackendNotifier/Observer.php +42 -0
  10. app/code/community/Webformat/LoginWithPayPal/Model/Grant.php +73 -0
  11. app/code/community/Webformat/LoginWithPayPal/Model/Login.php +155 -0
  12. app/code/community/Webformat/LoginWithPayPal/Model/System/Config/Source/Button/Theme.php +41 -0
  13. app/code/community/Webformat/LoginWithPayPal/Model/UserInfo.php +63 -0
  14. app/code/community/Webformat/LoginWithPayPal/controllers/IndexController.php +49 -0
  15. app/code/community/Webformat/LoginWithPayPal/etc/Webformat_LoginWithPayPal.xml +35 -0
  16. app/code/community/Webformat/LoginWithPayPal/etc/adminhtml.xml +48 -0
  17. app/code/community/Webformat/LoginWithPayPal/etc/config.xml +123 -0
  18. app/code/community/Webformat/LoginWithPayPal/etc/system.xml +200 -0
  19. app/design/frontend/base/default/layout/webformat/loginwithpaypal.xml +41 -0
  20. app/design/frontend/base/default/template/webformat/loginwithpaypal/customer/form/login/button.phtml +48 -0
  21. app/design/frontend/base/default/template/webformat/loginwithpaypal/customer/form/login/loginwithpaypal.phtml +30 -0
  22. app/etc/modules/Webformat_LoginWithPayPal.xml +9 -0
  23. app/locale/it_IT/webformat/Webformat_LoginWithPayPal.csv +19 -0
  24. package.xml +22 -0
app/code/community/Webformat/LoginWithPayPal/Block/AbstractButton.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEBFORMAT s.r.l.
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 Webformat
22
+ * @package LoginWithPayPal
23
+ * @copyright Copyright (c) 2014 WEBFORMAT s.r.l. (http://www.webformat.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+
29
+ /**
30
+ * Block for form button login javascript.
31
+ */
32
+ abstract class Webformat_LoginWithPayPal_Block_AbstractButton extends Mage_Core_Block_Template {
33
+ /**
34
+ * Constructor.
35
+ */
36
+ protected function _construct() {
37
+ $this->setTemplate("webformat/loginwithpaypal/customer/form/login/button.phtml");
38
+ Mage::getSingleton('customer/session')->setLoginFormName($this->getLoginFormName());
39
+ }
40
+
41
+ /**
42
+ * Get PayPal Client Id App.
43
+ * @return string
44
+ */
45
+ public function getClientId() {
46
+ return Mage::helper('webformat_loginwithpaypal')->getClientId();
47
+ }
48
+
49
+ /**
50
+ * Is sand box?
51
+ * @return boolean
52
+ */
53
+ public function isSandBox() {
54
+ return Mage::helper('webformat_loginwithpaypal')->isSandBox();
55
+ }
56
+
57
+ /**
58
+ * Get return url.
59
+ * @return String
60
+ */
61
+ public function getReturnUrl() {
62
+ return Mage::getUrl('webformat_loginwithpaypal');
63
+ }
64
+
65
+ /**
66
+ * Get current locale string.
67
+ * @return String
68
+ */
69
+ public function getLocale() {
70
+ return Mage::app()->getLocale()->getLocaleCode();
71
+ }
72
+
73
+ /**
74
+ * Get scope for request.
75
+ * @return string
76
+ */
77
+ public function getScope() {
78
+ return Mage::getStoreConfig('webformat_loginwithpaypal/settings/scope');
79
+ }
80
+
81
+ /**
82
+ * Get scope for request.
83
+ * @return string
84
+ */
85
+ public function getButtonTheme() {
86
+ return Mage::getStoreConfig('webformat_loginwithpaypal/theme/button');
87
+ }
88
+
89
+ /**
90
+ * Is default theme?
91
+ * @return boolean
92
+ */
93
+ public function isDefaultButtonTheme() {
94
+ return $this->getButtonTheme() === 'blue';
95
+ }
96
+
97
+ /**
98
+ * Get login form name for redirect page.
99
+ */
100
+ public abstract function getLoginFormName();
101
+ }
app/code/community/Webformat/LoginWithPayPal/Block/Checkout/Onepage/Login/Button.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEBFORMAT s.r.l.
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 Webformat
22
+ * @package LoginWithPayPal
23
+ * @copyright Copyright (c) 2014 WEBFORMAT s.r.l. (http://www.webformat.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+
29
+ /**
30
+ * Block for form button login javascript.
31
+ */
32
+ class Webformat_LoginWithPayPal_Block_Checkout_Onepage_Login_Button
33
+ extends Webformat_LoginWithPayPal_Block_AbstractButton {
34
+ /**
35
+ * Constructor.
36
+ */
37
+ protected function _construct() {
38
+ parent::_construct();
39
+ }
40
+
41
+ /**
42
+ * Get login form name for redirect page.
43
+ * @return string
44
+ */
45
+ public function getLoginFormName() {
46
+ return 'checkout';
47
+ }
48
+ }
app/code/community/Webformat/LoginWithPayPal/Block/Customer/Form/Login/Button.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEBFORMAT s.r.l.
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 Webformat
22
+ * @package LoginWithPayPal
23
+ * @copyright Copyright (c) 2014 WEBFORMAT s.r.l. (http://www.webformat.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+
29
+ /**
30
+ * Block for form button login javascript.
31
+ */
32
+ class Webformat_LoginWithPayPal_Block_Customer_Form_Login_Button
33
+ extends Webformat_LoginWithPayPal_Block_AbstractButton {
34
+ /**
35
+ * Constructor.
36
+ */
37
+ protected function _construct() {
38
+ parent::_construct();
39
+ }
40
+
41
+ /**
42
+ * Get login form name for redirect page.
43
+ * @return string
44
+ */
45
+ public function getLoginFormName() {
46
+ return 'login';
47
+ }
48
+ }
app/code/community/Webformat/LoginWithPayPal/Block/Customer/Form/Login/LoginWithPayPal.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEBFORMAT s.r.l.
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 Webformat
22
+ * @package LoginWithPayPal
23
+ * @copyright Copyright (c) 2014 WEBFORMAT s.r.l. (http://www.webformat.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+
29
+ /**
30
+ * Block for form button login javascript.
31
+ */
32
+ class Webformat_LoginWithPayPal_Block_Customer_Form_Login_LoginWithPayPal extends Mage_Core_Block_Template {
33
+ /**
34
+ * Constructor.
35
+ */
36
+ protected function _construct() {
37
+ $this->setTemplate("webformat/loginwithpaypal/customer/form/login/loginwithpaypal.phtml");
38
+ }
39
+
40
+ /**
41
+ * Get redirect url.
42
+ * @return url
43
+ */
44
+ public function getRedirectUrl() {
45
+ if ($this->getError()) {
46
+ return $this->getRedirectError();
47
+ } else {
48
+ return $this->getRedirectSuccess();
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Redirect to error page.
54
+ */
55
+ public function getRedirectError() {
56
+ return $this->getRedirectConfig('error');
57
+ }
58
+
59
+ /**
60
+ * Redirect to success page.
61
+ */
62
+ public function getRedirectSuccess() {
63
+ return $this->getRedirectConfig('success');
64
+ }
65
+
66
+ /**
67
+ *
68
+ * @param string $code
69
+ */
70
+ public function getRedirectConfig($code) {
71
+ return Mage::getUrl(Mage::getStoreConfig("webformat_loginwithpaypal/redirect/"
72
+ . $code . "_" . $this->getLoginFormName()));
73
+ }
74
+
75
+ /**
76
+ * Get Login form name (login or checkout page?)
77
+ * @return string
78
+ */
79
+ public function getLoginFormName() {
80
+ if (Mage::getSingleton('customer/session')->hasLoginFormName()) {
81
+ return Mage::getSingleton('customer/session')->getLoginFormName();
82
+ } else {
83
+ return 'login';
84
+ }
85
+ }
86
+ }
app/code/community/Webformat/LoginWithPayPal/Helper/Data.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEBFORMAT s.r.l.
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 Webformat
22
+ * @package LoginWithPayPal
23
+ * @copyright Copyright (c) 2014 WEBFORMAT s.r.l. (http://www.webformat.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+
29
+ /* Paypal login helper.*/
30
+ class Webformat_LoginWithPayPal_Helper_Data extends Mage_Core_Helper_Data {
31
+ /**
32
+ * Get sandbox (or not) client id.
33
+ * @return string
34
+ */
35
+ public function getClientId() {
36
+ if ($this->isSandBox()) {
37
+ return Mage::getStoreConfig('webformat_loginwithpaypal/settings/sandbox_client_id');
38
+ } else {
39
+ return Mage::getStoreConfig('webformat_loginwithpaypal/settings/client_id');
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Get sandbox (or not) secret
45
+ * @return string
46
+ */
47
+ public function getSecret() {
48
+ if ($this->isSandBox()) {
49
+ return Mage::getStoreConfig('webformat_loginwithpaypal/settings/sandbox_secret');
50
+ } else {
51
+ return Mage::getStoreConfig('webformat_loginwithpaypal/settings/secret');
52
+ }
53
+ }
54
+
55
+ /**
56
+ * Is sand box?
57
+ * @return boolean
58
+ */
59
+ public function isSandBox() {
60
+ return Mage::getStoreConfigFlag('webformat_loginwithpaypal/settings/flg_sandbox');
61
+ }
62
+ }
app/code/community/Webformat/LoginWithPayPal/Model/AbstractRequest.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEBFORMAT s.r.l.
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 Webformat
22
+ * @package LoginWithPayPal
23
+ * @copyright Copyright (c) 2014 WEBFORMAT s.r.l. (http://www.webformat.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+
29
+ /** Access token. */
30
+ abstract class Webformat_LoginWithPayPal_Model_AbstractRequest extends Mage_Core_Model_Abstract {
31
+ /**
32
+ * Get service base url.
33
+ * @return url
34
+ */
35
+ protected function getServiceBaseUrl($req = '') {
36
+ $url = 'https://';
37
+ if (Mage::helper('webformat_loginwithpaypal')->isSandbox()) {
38
+ $url .= Mage::getStoreConfig('webformat_loginwithpaypal/settings/sandbox_endpoint');
39
+ } else {
40
+ $url .= Mage::getStoreConfig('webformat_loginwithpaypal/settings/endpoint');
41
+ }
42
+ return $url . $req;
43
+ }
44
+ }
app/code/community/Webformat/LoginWithPayPal/Model/AccessToken.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEBFORMAT s.r.l.
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 Webformat
22
+ * @package LoginWithPayPal
23
+ * @copyright Copyright (c) 2014 WEBFORMAT s.r.l. (http://www.webformat.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+
29
+ /**
30
+ * Access token.
31
+ * @deprecated (use Webformat_LoginWithPayPal_Model_Grant instead)
32
+ */
33
+ class Webformat_LoginWithPayPal_Model_AccessToken extends Webformat_LoginWithPayPal_Model_AbstractRequest {
34
+ /**
35
+ * Retrieve access token from PayPal oauth.
36
+ */
37
+ public function retrieve() {
38
+ $username = Mage::helper('webformat_loginwithpaypal')->getClientId();
39
+ $password = Mage::helper('webformat_loginwithpaypal')->getSecret();
40
+ $post = array('grant_type' => 'client_credentials');
41
+ $headers = array('Accept: application/json', 'Accept-Language: en_US');
42
+
43
+ $ch = curl_init($this->getServiceBaseUrl('/v1/oauth2/token'));
44
+
45
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
46
+ curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
47
+ curl_setopt($ch, CURLOPT_POST, count($post));
48
+ curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
49
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
50
+ if (($output = curl_exec($ch)) === FALSE) {
51
+ throw new Zend_Exception("Could not obtain PayPal Access Token");
52
+ }
53
+ curl_close($ch);
54
+ $this->setResponse(json_decode($output));
55
+ $this->validateResponse();
56
+
57
+ return true;
58
+ }
59
+
60
+ /**
61
+ * Validate response.
62
+ * @throws Zend_Exception
63
+ */
64
+ protected function validateResponse() {
65
+ if (!$this->getResponse()) {
66
+ throw new Zend_Exception("Could not obtain PayPal Access Token");
67
+ }
68
+ if (isset($this->getResponse()->error)) {
69
+ throw new Zend_Exception($this->getResponse()->error_description);
70
+ }
71
+ if (!isset($this->getResponse()->access_token)) {
72
+ throw new Zend_Exception("Could not obtain PayPal Access Token");
73
+ }
74
+ }
75
+ }
app/code/community/Webformat/LoginWithPayPal/Model/BackendNotifier/Feed.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEBFORMAT s.r.l.
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 Webformat
22
+ * @package LoginWithPayPal
23
+ * @copyright Copyright (c) 2014 WEBFORMAT s.r.l. (http://www.webformat.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+
29
+ /**
30
+ * Observe for new feeds
31
+ */
32
+ class Webformat_LoginWithPayPal_Model_BackendNotifier_Feed extends Mage_AdminNotification_Model_Feed {
33
+
34
+ const CACHE_ITEM_ID = "webformat_loginwithpaypal_lastcheck";
35
+
36
+ const XML_FEED_URL = "webformat_loginwithpaypal/feed/url";
37
+ const XML_FEED_FREQUENCY = "webformat_loginwithpaypal/feed/frequency";
38
+
39
+ /**
40
+ * Retrieve feed url.
41
+ * @return string
42
+ */
43
+ public function getFeedUrl() {
44
+ return (Mage::getStoreConfigFlag(self::XML_USE_HTTPS_PATH)
45
+ ? 'https://' : 'http://')
46
+ . Mage::getStoreConfig(self::XML_FEED_URL)
47
+ . '&src='.urlencode(Mage::getStoreConfig(Mage_Core_Model_Store::XML_PATH_UNSECURE_BASE_URL));
48
+ }
49
+
50
+ /**
51
+ * Check feed for modification
52
+ *
53
+ * @return Webformat_LoginWithPayPal_Model_BackendNotifier_Feed
54
+ */
55
+ public function checkUpdate() {
56
+ if (($this->getFrequency() + $this->getLastUpdate()) > time()) {
57
+ return $this;
58
+ }
59
+
60
+ $feedData = array();
61
+ $feedXml = $this->getFeedData();
62
+ if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
63
+ foreach ($feedXml->channel->item as $item) {
64
+ $feedData[] = array(
65
+ 'severity' => (int)$item->severity,
66
+ 'date_added' => $this->getDate((string)$item->pubDate),
67
+ 'title' => (string)$item->title,
68
+ 'description' => (string)$item->description,
69
+ 'url' => (string)$item->link,
70
+ );
71
+ }
72
+
73
+ if ($feedData) {
74
+ Mage::getModel('adminnotification/inbox')->parse(array_reverse($feedData));
75
+ }
76
+ }
77
+ $this->setLastUpdate();
78
+
79
+ return $this;
80
+ }
81
+
82
+ /**
83
+ * Set last update time (now)
84
+ * @return Webformat_LoginWithPayPal_Model_BackendNotifier_Feed
85
+ */
86
+ public function setLastUpdate() {
87
+ Mage::app()->saveCache(time(), self::CACHE_ITEM_ID);
88
+ return $this;
89
+ }
90
+
91
+ /**
92
+ * Retrieve Last update time
93
+ * @return int
94
+ */
95
+ public function getLastUpdate() {
96
+ return Mage::app()->loadCache(self::CACHE_ITEM_ID);
97
+ }
98
+
99
+ /**
100
+ * Retrieve Update Frequency
101
+ *
102
+ * @return int
103
+ */
104
+ public function getFrequency() {
105
+ return Mage::getStoreConfig(self::XML_FEED_FREQUENCY) * 3600;
106
+ }
107
+ }
app/code/community/Webformat/LoginWithPayPal/Model/BackendNotifier/Observer.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEBFORMAT s.r.l.
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 Webformat
22
+ * @package LoginWithPayPal
23
+ * @copyright Copyright (c) 2014 WEBFORMAT s.r.l. (http://www.webformat.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+
29
+ /**
30
+ * Observe for new feeds.
31
+ */
32
+ class Webformat_LoginWithPayPal_Model_BackendNotifier_Observer extends Mage_AdminNotification_Model_Feed {
33
+ /**
34
+ * Check for new feeds.
35
+ */
36
+ public function checkFeed() {
37
+ if (Mage::getSingleton('admin/session')->isLoggedIn()) {
38
+ $model = Mage::getModel('webformat_loginwithpaypal/backendNotifier_feed');
39
+ $model->checkUpdate();
40
+ }
41
+ }
42
+ }
app/code/community/Webformat/LoginWithPayPal/Model/Grant.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEBFORMAT s.r.l.
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 Webformat
22
+ * @package LoginWithPayPal
23
+ * @copyright Copyright (c) 2014 WEBFORMAT s.r.l. (http://www.webformat.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+
29
+ /** Grant token from authorization code. */
30
+ class Webformat_LoginWithPayPal_Model_Grant extends Webformat_LoginWithPayPal_Model_AbstractRequest {
31
+ /**
32
+ * Grant token from authorization code.
33
+ */
34
+ public function grant() {
35
+ $username = Mage::helper('webformat_loginwithpaypal')->getClientId();
36
+ $password = Mage::helper('webformat_loginwithpaypal')->getSecret();
37
+ $post = array('grant_type' => 'authorization_code',
38
+ 'code' => $this->getCode(),
39
+ 'redirect_uri' => Mage::getUrl('webformat_loginwithpaypal'));
40
+
41
+ $ch = curl_init($this->getServiceBaseUrl('/v1/identity/openidconnect/tokenservice'));
42
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
43
+ curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
44
+ curl_setopt($ch, CURLOPT_POST, count($post));
45
+ curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
46
+
47
+ if (($output = curl_exec($ch)) === FALSE) {
48
+ throw new Zend_Exception("Could not grant authorization code");
49
+ }
50
+ curl_close($ch);
51
+ $this->setResponse(json_decode($output));
52
+ $this->validateResponse();
53
+
54
+ return true;
55
+ }
56
+
57
+
58
+ /**
59
+ * Validate response.
60
+ * @throws Zend_Exception
61
+ */
62
+ protected function validateResponse() {
63
+ if (!$this->getResponse()) {
64
+ throw new Zend_Exception("Could not obtain PayPal Grant Access Token");
65
+ }
66
+ if (isset($this->getResponse()->error)) {
67
+ throw new Zend_Exception($this->getResponse()->error_description);
68
+ }
69
+ if (!isset($this->getResponse()->access_token)) {
70
+ throw new Zend_Exception("Could not obtain PayPal Grant Access Token");
71
+ }
72
+ }
73
+ }
app/code/community/Webformat/LoginWithPayPal/Model/Login.php ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEBFORMAT s.r.l.
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 Webformat
22
+ * @package LoginWithPayPal
23
+ * @copyright Copyright (c) 2014 WEBFORMAT s.r.l. (http://www.webformat.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+
29
+ /** Login service. */
30
+ class Webformat_LoginWithPayPal_Model_Login extends Mage_Core_Model_Abstract {
31
+ /**
32
+ * Login with PayPal Code $code
33
+ * @param string $code
34
+ */
35
+ public function login() {
36
+ /* @var $grant Webformat_LoginWithPayPal_Model_Grant */
37
+ $grant = Mage::getModel('webformat_loginwithpaypal/grant');
38
+ $grant->setCode($this->getCode())->grant();
39
+
40
+ /* @var $userInfo Webformat_LoginWithPayPal_Model_UserInfo */
41
+ $userInfo = Mage::getModel('webformat_loginwithpaypal/userInfo');
42
+ $userInfo->setAccessToken($grant)->retrieve();
43
+
44
+ $this->setUserInfo($userInfo->getResponse());
45
+
46
+ $this->validateUserInfo();
47
+ $customer = $this->checkUserExistence();
48
+ if ($customer !== false) {
49
+ $this->loginWithExistentUser($customer);
50
+ } else {
51
+ $this->loginWithNewUser();
52
+ }
53
+ return true;
54
+ }
55
+
56
+ /**
57
+ * Validate user info fields.
58
+ */
59
+ public function validateUserInfo() {
60
+ if (!$this->getUserInfo()->hasEmail()) {
61
+ throw new Zend_Exception("Can't retrieve user's email!");
62
+ }
63
+ if (!$this->getUserInfo()->hasGivenName()) {
64
+ throw new Zend_Exception("Can't retrieve user's given name!");
65
+ }
66
+ if (!$this->getUserInfo()->hasFamilyName()) {
67
+ throw new Zend_Exception("Can't retrieve user's family name!");
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Check for user existence.
73
+ * @return boolean
74
+ */
75
+ protected function checkUserExistence() {
76
+ $customer = Mage::getModel("customer/customer")
77
+ ->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
78
+ ->loadByEmail($this->getUserInfo()->getEmail());
79
+ return $customer->hasEntityId() ? $customer : false;
80
+ }
81
+
82
+ /**
83
+ * Login with an existent user.
84
+ * @param $customer Mage_Customer_Model_Customer
85
+ */
86
+ protected function loginWithExistentUser(Mage_Customer_Model_Customer $customer) {
87
+ Mage::dispatchEvent('customer_customer_authenticated', array(
88
+ 'model' => $customer,
89
+ 'password' => $customer->getPassword(),
90
+ ));
91
+ Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer);
92
+ Mage::getSingleton('customer/session')->renewSession();
93
+
94
+ }
95
+
96
+ /**
97
+ * Create a new user.
98
+ * @return Mage_Customer_Model_Customer
99
+ */
100
+ protected function createNewUser() {
101
+ $customer = Mage::getModel("customer/customer");
102
+ $password = $customer->generatePassword();
103
+
104
+ $userInfo = $this->getUserInfo();
105
+
106
+ $customer->setFirstname($userInfo->getGivenName());
107
+ $customer->setLastname($userInfo->getFamilyName());
108
+ $customer->setEmail($userInfo->getEmail());
109
+ $customer->setPassword($password);
110
+
111
+ if ($userInfo->hasAddress()) {
112
+ $address = new Varien_Object();
113
+ $address->addData((array) $userInfo->getAddress());
114
+ if ($userInfo->hasPhoneNumber()) {
115
+ $address->setPhoneNumber($userInfo->getPhoneNumber());
116
+ }
117
+ $this->addAddress($customer, $address);
118
+ }
119
+
120
+ return $customer->save();
121
+ }
122
+
123
+ /**
124
+ * Login with a new user.
125
+ */
126
+ protected function loginWithNewUser() {
127
+ $this->loginWithExistentUser($this->createNewUser());
128
+ }
129
+
130
+ /**
131
+ * Add address to customer
132
+ * @param Mage_Customer_Model_Entity $customer
133
+ * @param Varien_Object $addressData
134
+ */
135
+ public function addAddress($customer, $addressData) {
136
+ $address = Mage::getModel('customer/address');
137
+ $address->setIsDefaultBilling(true);
138
+ $address->setIsDefaultShipping(true);
139
+ $address->setFirstname($customer->getFirstname());
140
+ $address->setLastname($customer->getLastname());
141
+ $address->setTelephone($addressData->getPhoneNumber());
142
+ $address->setPostcode($addressData->getPostalCode());
143
+ $address->setCity($addressData->getLocality());
144
+ $address->setStreet($addressData->getStreetAddress());
145
+ $address->setCountryId($addressData->getCountry());
146
+
147
+ $regionModel = Mage::getModel('directory/region')
148
+ ->loadByCode($addressData->getRegion(),
149
+ $addressData->getCountry());
150
+ if ($regionModel->hasRegionId()) {
151
+ $address->setRegionId($regionModel->getId());
152
+ }
153
+ $customer->addAddress($address);
154
+ }
155
+ }
app/code/community/Webformat/LoginWithPayPal/Model/System/Config/Source/Button/Theme.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEBFORMAT s.r.l.
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 Webformat
22
+ * @package LoginWithPayPal
23
+ * @copyright Copyright (c) 2014 WEBFORMAT s.r.l. (http://www.webformat.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+
29
+ /* Blue or neutral theme? */
30
+ class Webformat_Loginwithpaypal_Model_System_Config_Source_Button_Theme {
31
+ /**
32
+ * To array.
33
+ * @return type
34
+ */
35
+ public function toOptionArray() {
36
+ return array(
37
+ array('value' => 'blue', 'label' => Mage::helper('webformat_loginwithpaypal')->__('Blue')),
38
+ array('value' => 'neutral', 'label' => Mage::helper('webformat_loginwithpaypal')->__('Neutral')),
39
+ );
40
+ }
41
+ }
app/code/community/Webformat/LoginWithPayPal/Model/UserInfo.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEBFORMAT s.r.l.
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 Webformat
22
+ * @package LoginWithPayPal
23
+ * @copyright Copyright (c) 2014 WEBFORMAT s.r.l. (http://www.webformat.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+
29
+ /** Access token. */
30
+ class Webformat_LoginWithPayPal_Model_UserInfo extends Webformat_LoginWithPayPal_Model_AbstractRequest {
31
+ /**
32
+ * Retrieve access token from PayPal oauth.
33
+ */
34
+ public function retrieve() {
35
+ $headers = array('Accept: application/json', 'Authorization: Bearer '
36
+ . $this->getAccessToken()->getResponse()->access_token);
37
+ $ch = curl_init($this->getServiceBaseUrl('/v1/identity/openidconnect/userinfo/?schema=openid'));
38
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
39
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
40
+ if (($output = curl_exec($ch)) === FALSE) {
41
+ throw new Zend_Exception("Could not obtain user info");
42
+ }
43
+ curl_close($ch);
44
+ $data = json_decode($output);
45
+ $this->validateData($data);
46
+
47
+ $rv = new Varien_Object();
48
+ $rv->addData((array) $data);
49
+ $this->setResponse($rv);
50
+
51
+ return true;
52
+ }
53
+
54
+ /** Validate data. */
55
+ public function validateData($data) {
56
+ if (!$data) {
57
+ throw new Zend_Exception("Could not obtain user info");
58
+ }
59
+ if (isset($data->error)) {
60
+ throw new Zend_Exception($data->error_description);
61
+ }
62
+ }
63
+ }
app/code/community/Webformat/LoginWithPayPal/controllers/IndexController.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEBFORMAT s.r.l.
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 Webformat
22
+ * @package LoginWithPayPal
23
+ * @copyright Copyright (c) 2014 WEBFORMAT s.r.l. (http://www.webformat.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+
29
+ /** Callback from paypal controller. */
30
+ class Webformat_LoginWithPayPal_IndexController extends Mage_Core_Controller_Front_Action {
31
+ /**
32
+ * Index action, called from PayPal controller.
33
+ */
34
+ public function indexAction() {
35
+ $block = $this->getLayout()->createBlock('webformat_loginwithpaypal/customer_form_login_loginWithPayPal');
36
+ $block->setError(filter_input(INPUT_GET, 'error_description'));
37
+ if ($block->getError()) {
38
+ Mage::getSingleton('customer/session')->addError($block->getError());
39
+ }
40
+ $code = filter_input(INPUT_GET, 'code');
41
+ try {
42
+ Mage::getModel('webformat_loginwithpaypal/login')
43
+ ->setCode($code)->login();
44
+ } catch (Exception $exception) {
45
+ Mage::getSingleton('customer/session')->addError($exception->getMessage());
46
+ }
47
+ $this->getResponse()->setBody($block->toHtml());
48
+ }
49
+ }
app/code/community/Webformat/LoginWithPayPal/etc/Webformat_LoginWithPayPal.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * WEBFORMAT s.r.l.
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
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 Webformat
23
+ * @package LoginWithPayPal
24
+ * @copyright Copyright (c) 2014 WEBFORMAT s.r.l. (http://www.webformat.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <modules>
30
+ <Webformat_LoginWithPayPal>
31
+ <active>true</active>
32
+ <codePool>community</codePool>
33
+ </Webformat_LoginWithPayPal>
34
+ </modules>
35
+ </config>
app/code/community/Webformat/LoginWithPayPal/etc/adminhtml.xml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * WEBFORMAT s.r.l.
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
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 Webformat
23
+ * @package LoginWithPayPal
24
+ * @copyright Copyright (c) 2014 WEBFORMAT s.r.l. (http://www.webformat.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <acl>
30
+ <resources>
31
+ <admin>
32
+ <children>
33
+ <system>
34
+ <children>
35
+ <config>
36
+ <children>
37
+ <webformat_loginwithpaypal translate="title" module="webformat_loginwithpaypal">
38
+ <title>Login With PayPal</title>
39
+ </webformat_loginwithpaypal>
40
+ </children>
41
+ </config>
42
+ </children>
43
+ </system>
44
+ </children>
45
+ </admin>
46
+ </resources>
47
+ </acl>
48
+ </config>
app/code/community/Webformat/LoginWithPayPal/etc/config.xml ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * WEBFORMAT s.r.l.
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
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 Webformat
23
+ * @package LoginWithPayPal
24
+ * @copyright Copyright (c) 2014 WEBFORMAT s.r.l. (http://www.webformat.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <modules>
30
+ <Webformat_LoginWithPayPal>
31
+ <version>0.9.0</version>
32
+ </Webformat_LoginWithPayPal>
33
+ </modules>
34
+ <global>
35
+ <helpers>
36
+ <webformat_loginwithpaypal>
37
+ <class>Webformat_LoginWithPayPal_Helper</class>
38
+ </webformat_loginwithpaypal>
39
+ </helpers>
40
+ <blocks>
41
+ <webformat_loginwithpaypal>
42
+ <class>Webformat_LoginWithPayPal_Block</class>
43
+ </webformat_loginwithpaypal>
44
+ </blocks>
45
+ <models>
46
+ <webformat_loginwithpaypal>
47
+ <class>Webformat_LoginWithPayPal_Model</class>
48
+ </webformat_loginwithpaypal>
49
+ </models>
50
+ </global>
51
+ <frontend>
52
+ <layout>
53
+ <updates>
54
+ <webformat_loginwithpaypal>
55
+ <file>webformat/loginwithpaypal.xml</file>
56
+ </webformat_loginwithpaypal>
57
+ </updates>
58
+ </layout>
59
+ <routers>
60
+ <webformat_loginwithpaypal>
61
+ <use>standard</use>
62
+ <args>
63
+ <module>Webformat_LoginWithPayPal</module>
64
+ <frontName>loginwithpaypal</frontName>
65
+ </args>
66
+ </webformat_loginwithpaypal>
67
+ </routers>
68
+ <translate>
69
+ <modules>
70
+ <webformat_loginwithpaypal>
71
+ <files>
72
+ <default>webformat/Webformat_LoginWithPayPal.csv</default>
73
+ </files>
74
+ </webformat_loginwithpaypal>
75
+ </modules>
76
+ </translate>
77
+ </frontend>
78
+ <adminhtml>
79
+ <translate>
80
+ <modules>
81
+ <webformat_loginwithpaypal>
82
+ <files>
83
+ <default>webformat/Webformat_LoginWithPayPal.csv</default>
84
+ </files>
85
+ </webformat_loginwithpaypal>
86
+ </modules>
87
+ </translate>
88
+ <events>
89
+ <controller_action_predispatch>
90
+ <observers>
91
+ <webformat_backenfmotifier>
92
+ <type>singleton</type>
93
+ <class>webformat_loginwithpaypal/backendNotifier_observer</class>
94
+ <method>checkFeed</method>
95
+ </webformat_backenfmotifier>
96
+ </observers>
97
+ </controller_action_predispatch>
98
+ </events>
99
+ </adminhtml>
100
+ <default>
101
+ <webformat_loginwithpaypal>
102
+ <settings>
103
+ <flg_sandbox>1</flg_sandbox>
104
+ <sandbox_endpoint>api.sandbox.paypal.com</sandbox_endpoint>
105
+ <endpoint>api.paypal.com</endpoint>
106
+ <scope>openid email profile address phone</scope>
107
+ </settings>
108
+ <redirect>
109
+ <success_login>customer/account</success_login>
110
+ <error_login>customer/account/login</error_login>
111
+ <success_checkout>checkout/onepage</success_checkout>
112
+ <error_checkout>checkout/onepage</error_checkout>
113
+ </redirect>
114
+ <theme>
115
+ <button>blue</button>
116
+ </theme>
117
+ <feed>
118
+ <url><![CDATA[www.webformat.com/index.php?id=559&type=105&m=loginwithpaypal]]></url>
119
+ <frequency>86400</frequency>
120
+ </feed>
121
+ </webformat_loginwithpaypal>
122
+ </default>
123
+ </config>
app/code/community/Webformat/LoginWithPayPal/etc/system.xml ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * WEBFORMAT s.r.l.
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
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 Webformat
23
+ * @package LoginWithPayPal
24
+ * @copyright Copyright (c) 2014 WEBFORMAT s.r.l. (http://www.webformat.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <sections>
30
+ <webformat_loginwithpaypal translate="label" module="webformat_loginwithpaypal">
31
+ <label>Login With PayPal</label>
32
+ <tab>customer</tab>
33
+ <frontend_type>text</frontend_type>
34
+ <sort_order>1500</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>1</show_in_store>
38
+ <groups>
39
+ <settings translate="label">
40
+ <label>Login with PayPal configuration</label>
41
+ <frontend_type>text</frontend_type>
42
+ <sort_order>1</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ <expanded>1</expanded>
47
+ <comment><![CDATA[<h3>Need help to configure <q>Login With PayPal</q> extension?</h3><p>If you need help to configure <q>Login With PayPal</q> extension, please visit this page: <a href="http://www.webformat.com/index.php?id=991&src=magento-config" target="_blank"><strong>Login with PayPal docs</strong></a>.</p>]]></comment>
48
+ <fields>
49
+ <flg_sandbox translate="label">
50
+ <label>Use Sandbox account</label>
51
+ <frontend_type>select</frontend_type>
52
+ <source_model>adminhtml/system_config_source_yesno</source_model>
53
+ <sort_order>10</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+ </flg_sandbox>
58
+ <client_id translate="label">
59
+ <label>Client ID</label>
60
+ <frontend_type>text</frontend_type>
61
+ <sort_order>20</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>1</show_in_store>
65
+ <depends>
66
+ <flg_sandbox>0</flg_sandbox>
67
+ </depends>
68
+ </client_id>
69
+ <secret translate="label">
70
+ <label>Secret</label>
71
+ <frontend_type>text</frontend_type>
72
+ <sort_order>30</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ <depends>
77
+ <flg_sandbox>0</flg_sandbox>
78
+ </depends>
79
+ </secret>
80
+ <sandbox_client_id translate="label">
81
+ <label>Sandbox Client ID</label>
82
+ <frontend_type>text</frontend_type>
83
+ <sort_order>40</sort_order>
84
+ <show_in_default>1</show_in_default>
85
+ <show_in_website>1</show_in_website>
86
+ <show_in_store>1</show_in_store>
87
+ <depends>
88
+ <flg_sandbox>1</flg_sandbox>
89
+ </depends>
90
+ </sandbox_client_id>
91
+ <sandbox_secret translate="label">
92
+ <label>Sandbox Secret</label>
93
+ <frontend_type>text</frontend_type>
94
+ <sort_order>50</sort_order>
95
+ <show_in_default>1</show_in_default>
96
+ <show_in_website>1</show_in_website>
97
+ <show_in_store>1</show_in_store>
98
+ <depends>
99
+ <flg_sandbox>1</flg_sandbox>
100
+ </depends>
101
+ </sandbox_secret>
102
+ <sandbox_endpoint translate="label">
103
+ <label>Sandbox endpoint</label>
104
+ <frontend_type>text</frontend_type>
105
+ <sort_order>60</sort_order>
106
+ <show_in_default>1</show_in_default>
107
+ <show_in_website>1</show_in_website>
108
+ <show_in_store>1</show_in_store>
109
+ <depends>
110
+ <flg_sandbox>1</flg_sandbox>
111
+ </depends>
112
+ </sandbox_endpoint>
113
+ <endpoint translate="label">
114
+ <label>Production endpoint</label>
115
+ <frontend_type>text</frontend_type>
116
+ <sort_order>70</sort_order>
117
+ <show_in_default>1</show_in_default>
118
+ <show_in_website>1</show_in_website>
119
+ <show_in_store>1</show_in_store>
120
+ <depends>
121
+ <flg_sandbox>0</flg_sandbox>
122
+ </depends>
123
+ </endpoint>
124
+ <scope translate="label">
125
+ <label>Info request scope</label>
126
+ <frontend_type>text</frontend_type>
127
+ <sort_order>80</sort_order>
128
+ <show_in_default>1</show_in_default>
129
+ <show_in_website>1</show_in_website>
130
+ <show_in_store>1</show_in_store>
131
+ </scope>
132
+ </fields>
133
+ </settings>
134
+ <theme>
135
+ <label>Theme configuration</label>
136
+ <frontend_type>text</frontend_type>
137
+ <sort_order>2</sort_order>
138
+ <show_in_default>1</show_in_default>
139
+ <show_in_website>1</show_in_website>
140
+ <show_in_store>1</show_in_store>
141
+ <expanded>1</expanded>
142
+ <fields>
143
+ <button>
144
+ <label>Button theme</label>
145
+ <frontend_type>select</frontend_type>
146
+ <source_model>webformat_loginwithpaypal/system_config_source_button_theme</source_model>
147
+ <sort_order>10</sort_order>
148
+ <show_in_default>1</show_in_default>
149
+ <show_in_website>1</show_in_website>
150
+ <show_in_store>1</show_in_store>
151
+ </button>
152
+ </fields>
153
+ </theme>
154
+ <redirect>
155
+ <label>Redirect configuration</label>
156
+ <frontend_type>text</frontend_type>
157
+ <sort_order>3</sort_order>
158
+ <show_in_default>1</show_in_default>
159
+ <show_in_website>1</show_in_website>
160
+ <show_in_store>1</show_in_store>
161
+ <expanded>1</expanded>
162
+ <fields>
163
+ <success_login translate="label">
164
+ <label>Success redirect page for customer login</label>
165
+ <frontend_type>text</frontend_type>
166
+ <sort_order>10</sort_order>
167
+ <show_in_default>1</show_in_default>
168
+ <show_in_website>1</show_in_website>
169
+ <show_in_store>1</show_in_store>
170
+ </success_login>
171
+ <error_login translate="label">
172
+ <label>Error redirect page for customer login</label>
173
+ <frontend_type>text</frontend_type>
174
+ <sort_order>20</sort_order>
175
+ <show_in_default>1</show_in_default>
176
+ <show_in_website>1</show_in_website>
177
+ <show_in_store>1</show_in_store>
178
+ </error_login>
179
+ <success_checkout translate="label">
180
+ <label>Success redirect page for checkout</label>
181
+ <frontend_type>text</frontend_type>
182
+ <sort_order>30</sort_order>
183
+ <show_in_default>1</show_in_default>
184
+ <show_in_website>1</show_in_website>
185
+ <show_in_store>1</show_in_store>
186
+ </success_checkout>
187
+ <error_checkout translate="label">
188
+ <label>Error redirect page for checkout</label>
189
+ <frontend_type>text</frontend_type>
190
+ <sort_order>40</sort_order>
191
+ <show_in_default>1</show_in_default>
192
+ <show_in_website>1</show_in_website>
193
+ <show_in_store>1</show_in_store>
194
+ </error_checkout>
195
+ </fields>
196
+ </redirect>
197
+ </groups>
198
+ </webformat_loginwithpaypal>
199
+ </sections>
200
+ </config>
app/design/frontend/base/default/layout/webformat/loginwithpaypal.xml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * WEBFORMAT s.r.l.
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
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 Webformat
23
+ * @package LoginWithPayPal
24
+ * @copyright Copyright (c) 2014 WEBFORMAT s.r.l. (http://www.webformat.com)
25
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
26
+ */
27
+ -->
28
+ <layout version="0.1.0">
29
+ <customer_account_login>
30
+ <reference name="customer_form_login">
31
+ <block type="core/text_list" name="form.additional.info">
32
+ <block type="webformat_loginwithpaypal/customer_form_login_button" name="loginwithpaypal.customer.form.login.button" after="-"/>
33
+ </block>
34
+ </reference>
35
+ </customer_account_login>
36
+ <checkout_onepage_index>
37
+ <reference name="checkout.onepage.login">
38
+ <block type="webformat_loginwithpaypal/checkout_onepage_login_button" name="loginwithpaypal.checkout.onepage.login.button" after="-"/>
39
+ </reference>
40
+ </checkout_onepage_index>
41
+ </layout>
app/design/frontend/base/default/template/webformat/loginwithpaypal/customer/form/login/button.phtml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEBFORMAT s.r.l.
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 Webformat
22
+ * @package LoginWithPayPal
23
+ * @copyright Copyright (c) 2014 WEBFORMAT s.r.l. (http://www.webformat.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+ <span id="webformat_loginwithpaypal_container"></span>
28
+ <script src="https://www.paypalobjects.com/js/external/api.js"></script>
29
+ <script>
30
+ paypal.use( ["login"], function(login) {
31
+ login.render ({
32
+ "appid": "<?php echo $this->getClientId() ?>",
33
+ <?php if (!$this->isDefaultButtonTheme()): ?>
34
+ "theme": "<?php echo $this->getButtonTheme() ?>",
35
+ <?php endif; ?>
36
+ <?php if ($this->isSandBox()): ?>
37
+ "authend": "sandbox",
38
+ <?php endif; ?>
39
+ "scopes": "<?php echo $this->getScope() ?>",
40
+ "containerid": "webformat_loginwithpaypal_container",
41
+ "locale": "<?php echo $this->getLocale() ?>",
42
+ "returnurl": "<?php echo $this->getReturnUrl() ?>"
43
+ });
44
+ if ($$('#webformat_loginwithpaypal_container button')) {
45
+ $$('#webformat_loginwithpaypal_container, 'return false;');
46
+ }
47
+ });
48
+ </script>
app/design/frontend/base/default/template/webformat/loginwithpaypal/customer/form/login/loginwithpaypal.phtml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WEBFORMAT s.r.l.
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 Webformat
22
+ * @package LoginWithPayPal
23
+ * @copyright Copyright (c) 2014 WEBFORMAT s.r.l. (http://www.webformat.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+ ?>
27
+ <script type="text/javascript">
28
+ window.opener.location.href = "<?php echo $this->getRedirectUrl() ?>";
29
+ window.close();
30
+ </script>
app/etc/modules/Webformat_LoginWithPayPal.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Webformat_LoginWithPayPal>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Webformat_LoginWithPayPal>
8
+ </modules>
9
+ </config>
app/locale/it_IT/webformat/Webformat_LoginWithPayPal.csv ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Redirect configuration", "Configuration dei redirect"
2
+ "Login with PayPal configuration", "Configurazione Login with PayPal"
3
+ "Theme configuration", "Configurazione tema"
4
+ "Login With PayPal", "Login With PayPal"
5
+ "Secret", "Password (Secret)"
6
+ "Sandbox Secret", "Password Account Sandbox (Secret)"
7
+ "Sandbox Client ID", "Client ID Account Sandbox"
8
+ "Use Sandbox account", "Usa Account Sandbox"
9
+ "Sandbox endpoint", "Endpoint Account Sandbox"
10
+ "Production endpoint", "Endpoint account produzione"
11
+ "Success redirect page for checkout", "Pagina di redirect in caso di successo (checkout)"
12
+ "Error redirect page for checkout", "Pagina di redirect in caso di errore (checkout)"
13
+ "Success redirect page for customer login", "Pagina di redirect in caso di successo (login cliente)"
14
+ "Error redirect page for customer login", "Pagina di redirect in caso di errore (login cliente)"
15
+ "Info request scope", "Scope della richiesta informazione utente"
16
+ "Blue", "Blue"
17
+ "Neutral", "Neutro"
18
+ "Button theme", "Tema del pulsante"
19
+ "<h3>Need help to configure <q>Login With PayPal</q> extension?</h3><p>If you need help to configure <q>Login With PayPal</q> extension, please visit this page: <a href=""http://www.webformat.com/index.php?id=991&src=magento-config"" target=""_blank""><strong>Login with PayPal docs</strong></a>.</p>", "<h3>Hai bisogno di aiuto per configurare <q>Login With PayPal</q>?</h3><p>Se hai bisogno di aiuto durante la configurazione di <q>Login With PayPal</q>, visita la pagina: <a href=""http://www.webformat.com/index.php?id=989&src=magento-config"" target=""_blank""><strong>Login with PayPal docs</strong></a>.</p>"
package.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Webformat_LoginWithPayPal</name>
4
+ <version>0.9.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension makes the customer login easier by adding a &#x201C;Login With PayPal&#x201D; button to customer login page and onepage checkout login tab.</summary>
10
+ <description>This extension makes the customer login easier by adding a &#x201C;Login With PayPal&#x201D; button to customer login page and onepage checkout login tab.&#xD;
11
+ &#xD;
12
+ Please note that an appropiate application in PayPal developer site it's needed. You can read our help page before installing the extension:&#xD;
13
+ http://www.webformat.com/index.php?id=989 (Italian documentation)&#xD;
14
+ http://www.webformat.com/index.php?id=991 (English documentation)</description>
15
+ <notes>First stable release</notes>
16
+ <authors><author><name>WEBFORMAT s.r.l.</name><user>webformat</user><email>magesupport@webformat.com</email></author></authors>
17
+ <date>2014-06-27</date>
18
+ <time>08:51:24</time>
19
+ <contents><target name="magecommunity"><dir name="Webformat"><dir name="LoginWithPayPal"><dir name="Block"><file name="AbstractButton.php" hash="e04788ca16d2c16e4ce4fa4d327f4dee"/><dir name="Checkout"><dir name="Onepage"><dir name="Login"><file name="Button.php" hash="338578ad8c0898153f1f1b5f2a650f29"/></dir></dir></dir><dir name="Customer"><dir name="Form"><dir name="Login"><file name="Button.php" hash="6d90b2bec3cbf61e190d1e2e34ac76ea"/><file name="LoginWithPayPal.php" hash="d8cb8f2497c1b55623bb9eaa31b3009b"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="208dd2474f021daa12d9058fc9656644"/></dir><dir name="Model"><file name="AbstractRequest.php" hash="dbe0119887c2246c1ccaabed8cb1b3df"/><file name="AccessToken.php" hash="1437543bd5108403d3bd59acb2589be1"/><dir name="BackendNotifier"><file name="Feed.php" hash="b2be1437b16032678348b47cc9fdf851"/><file name="Observer.php" hash="855c1f0bb8c9bf123dd3e2e91eb0f78e"/></dir><file name="Grant.php" hash="efc2af70982828db13ca70786b92804d"/><file name="Login.php" hash="bc380f97d84b1a6c050cbc72710a5b20"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Button"><file name="Theme.php" hash="fa6dcb47274a0986e21926933b6fa6c1"/></dir></dir></dir></dir><file name="UserInfo.php" hash="7d6712bc97c0f0e68049930cc4624e01"/></dir><dir name="controllers"><file name="IndexController.php" hash="4927a173a6de37204ca04908e4716c1a"/></dir><dir name="etc"><file name="Webformat_LoginWithPayPal.xml" hash="0c076ab21d243bfd715ab0010a8a5116"/><file name="adminhtml.xml" hash="8205afb3ba1b3920b0ce414815f16412"/><file name="config.xml" hash="ec4ad8f137c4a6cc94bb6a72cd71506d"/><file name="system.xml" hash="fdef3118041d00acfaf4357c281b3649"/></dir></dir></dir></target><target name="magelocale"><dir><dir name="it_IT"><dir name="webformat"><file name="Webformat_LoginWithPayPal.csv" hash="a4cdadcbebad4cd13e7f69d4f6b42637"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="webformat"><file name="loginwithpaypal.xml" hash="270fa729d717ed6950eb4d0d8af5c473"/></dir></dir><dir name="template"><dir name="webformat"><dir name="loginwithpaypal"><dir name="customer"><dir name="form"><dir name="login"><file name="button.phtml" hash="015659c0f98d978d88e162b5c24dddf8"/><file name="loginwithpaypal.phtml" hash="9bbfd3a6d2dda49844824f1bb6740c2c"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Webformat_LoginWithPayPal.xml" hash="237d579ed4022f3a1ce552f48e257cfe"/></dir></target></contents>
20
+ <compatible/>
21
+ <dependencies><required><php><min>5.2.0</min><max>5.6.0</max></php><extension><name>curl</name><min>7.0.0</min><max>8.0.0</max></extension></required></dependencies>
22
+ </package>