Webformat_LoginWithPayPal - Version 0.9.3

Version Notes

Added Seamless Checkout option

Download this release

Release Info

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


Code changes from version 0.9.2 to 0.9.3

app/code/community/Webformat/LoginWithPayPal/Model/AccessToken.php CHANGED
@@ -47,6 +47,7 @@ class Webformat_LoginWithPayPal_Model_AccessToken extends Webformat_LoginWithPay
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
  }
@@ -72,4 +73,4 @@ class Webformat_LoginWithPayPal_Model_AccessToken extends Webformat_LoginWithPay
72
  throw new Zend_Exception("Could not obtain PayPal Access Token");
73
  }
74
  }
75
- }
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
+ // curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
51
  if (($output = curl_exec($ch)) === FALSE) {
52
  throw new Zend_Exception("Could not obtain PayPal Access Token");
53
  }
73
  throw new Zend_Exception("Could not obtain PayPal Access Token");
74
  }
75
  }
76
+ }
app/code/community/Webformat/LoginWithPayPal/Model/Grant.php CHANGED
@@ -41,20 +41,23 @@ class Webformat_LoginWithPayPal_Model_Grant extends Webformat_LoginWithPayPal_Mo
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
@@ -70,4 +73,4 @@ class Webformat_LoginWithPayPal_Model_Grant extends Webformat_LoginWithPayPal_Mo
70
  throw new Zend_Exception("Could not obtain PayPal Grant Access Token");
71
  }
72
  }
73
- }
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, 1);
45
  curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
46
+ // curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
47
+
48
  if (($output = curl_exec($ch)) === FALSE) {
49
  throw new Zend_Exception("Could not grant authorization code");
50
  }
51
  curl_close($ch);
52
  $this->setResponse(json_decode($output));
53
  $this->validateResponse();
54
+ Mage::getSingleton('customer/session')
55
+ ->setPayPalAccessToken($this->getResponse()->access_token);
56
 
57
  return true;
58
  }
59
 
60
+
61
  /**
62
  * Validate response.
63
  * @throws Zend_Exception
73
  throw new Zend_Exception("Could not obtain PayPal Grant Access Token");
74
  }
75
  }
76
+ }
app/code/community/Webformat/LoginWithPayPal/Model/Paypal/Api/Nvp.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Nvp model rewrite. */
30
+ class Webformat_LoginWithPayPal_Model_Paypal_Api_Nvp extends Mage_Paypal_Model_Api_Nvp {
31
+ /**
32
+ * SetExpressCheckout call
33
+ * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetExpressCheckout
34
+ * TODO: put together style and giropay settings
35
+ */
36
+ public function callSetExpressCheckout()
37
+ {
38
+ $this->_prepareExpressCheckoutCallRequest($this->_setExpressCheckoutRequest);
39
+ $request = $this->_exportToRequest($this->_setExpressCheckoutRequest);
40
+ $this->_exportLineItems($request);
41
+
42
+ // import/suppress shipping address, if any
43
+ $options = $this->getShippingOptions();
44
+
45
+ if (Mage::getSingleton('customer/session')->hasPayPalAccessToken()) {
46
+ $request['IDENTITYACCESSTOKEN'] = Mage::getSingleton('customer/session')->getPayPalAccessToken();
47
+ }
48
+
49
+ if ($this->getAddress()) {
50
+ $request = $this->_importAddresses($request);
51
+ $request['ADDROVERRIDE'] = 1;
52
+ } elseif ($options && (count($options) <= 10)) { // doesn't support more than 10 shipping options
53
+ $request['CALLBACK'] = $this->getShippingOptionsCallbackUrl();
54
+ $request['CALLBACKTIMEOUT'] = 6; // max value
55
+ $request['MAXAMT'] = $request['AMT'] + 999.00; // it is impossible to calculate max amount
56
+ $this->_exportShippingOptions($request);
57
+ }
58
+
59
+ // add recurring profiles information
60
+ $i = 0;
61
+ foreach ($this->_recurringPaymentProfiles as $profile) {
62
+ $request["L_BILLINGTYPE{$i}"] = 'RecurringPayments';
63
+ $request["L_BILLINGAGREEMENTDESCRIPTION{$i}"] = $profile->getScheduleDescription();
64
+ $i++;
65
+ }
66
+ $response = $this->call(self::SET_EXPRESS_CHECKOUT, $request);
67
+ $this->_importFromResponse($this->_setExpressCheckoutResponse, $response);
68
+ }
69
+
70
+ /**
71
+ * Return Paypal Api version
72
+ *
73
+ * @return string
74
+ */
75
+ public function getVersion()
76
+ {
77
+ return '94.0';
78
+ }
79
+
80
+ }
app/code/community/Webformat/LoginWithPayPal/Model/UserInfo.php CHANGED
@@ -37,6 +37,7 @@ class Webformat_LoginWithPayPal_Model_UserInfo extends Webformat_LoginWithPayPal
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
  }
@@ -60,4 +61,4 @@ class Webformat_LoginWithPayPal_Model_UserInfo extends Webformat_LoginWithPayPal
60
  throw new Zend_Exception($data->error_description);
61
  }
62
  }
63
- }
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
+ // curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
41
  if (($output = curl_exec($ch)) === FALSE) {
42
  throw new Zend_Exception("Could not obtain user info");
43
  }
61
  throw new Zend_Exception($data->error_description);
62
  }
63
  }
64
+ }
app/code/community/Webformat/LoginWithPayPal/etc/config.xml CHANGED
@@ -28,7 +28,7 @@
28
  <config>
29
  <modules>
30
  <Webformat_LoginWithPayPal>
31
- <version>0.9.2</version>
32
  </Webformat_LoginWithPayPal>
33
  </modules>
34
  <global>
@@ -46,6 +46,11 @@
46
  <webformat_loginwithpaypal>
47
  <class>Webformat_LoginWithPayPal_Model</class>
48
  </webformat_loginwithpaypal>
 
 
 
 
 
49
  </models>
50
  </global>
51
  <frontend>
@@ -103,7 +108,7 @@
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>
28
  <config>
29
  <modules>
30
  <Webformat_LoginWithPayPal>
31
+ <version>0.9.3</version>
32
  </Webformat_LoginWithPayPal>
33
  </modules>
34
  <global>
46
  <webformat_loginwithpaypal>
47
  <class>Webformat_LoginWithPayPal_Model</class>
48
  </webformat_loginwithpaypal>
49
+ <paypal>
50
+ <rewrite>
51
+ <api_nvp>Webformat_LoginWithPayPal_Model_Paypal_Api_Nvp</api_nvp>
52
+ </rewrite>
53
+ </paypal>
54
  </models>
55
  </global>
56
  <frontend>
108
  <flg_sandbox>1</flg_sandbox>
109
  <sandbox_endpoint>api.sandbox.paypal.com</sandbox_endpoint>
110
  <endpoint>api.paypal.com</endpoint>
111
+ <scope>openid email profile address phone https://uri.paypal.com/services/expresscheckout</scope>
112
  </settings>
113
  <redirect>
114
  <success_login>customer/account</success_login>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Webformat_LoginWithPayPal</name>
4
- <version>0.9.2</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>
@@ -12,11 +12,11 @@
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>FIXED a missing phtml file.</notes>
16
  <authors><author><name>WEBFORMAT s.r.l.</name><user>webformat</user><email>magesupport@webformat.com</email></author></authors>
17
- <date>2014-09-17</date>
18
- <time>10:26:37</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="0308a2b185357598f1ba84d366b64301"/></dir><dir name="Model"><file name="AbstractRequest.php" hash="40b0ebd9eeb0ed76c317f8b5e91891ff"/><file name="AccessToken.php" hash="db6360b0b2dfd9f28c426fd765988604"/><dir name="BackendNotifier"><file name="Feed.php" hash="b2be1437b16032678348b47cc9fdf851"/><file name="Observer.php" hash="855c1f0bb8c9bf123dd3e2e91eb0f78e"/></dir><file name="Grant.php" hash="8f16421adfe81be90925a02d3a076160"/><file name="Login.php" hash="5b5283363d73821a897766dfe4188787"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Button"><file name="Theme.php" hash="ee5558f22633bbed5058840971e4add7"/></dir></dir></dir></dir><file name="UserInfo.php" hash="e3fbbd2f72aa7b4d9d793e9007d9046f"/></dir><dir name="controllers"><file name="IndexController.php" hash="480b588f3e7a7b3e51c1e5e675a56c83"/></dir><dir name="etc"><file name="Webformat_LoginWithPayPal.xml" hash="0c076ab21d243bfd715ab0010a8a5116"/><file name="adminhtml.xml" hash="bab6d148c9560121b473b52374a234a5"/><file name="config.xml" hash="da790025d011aac70207929d6118fcfc"/><file name="system.xml" hash="5a57ca6037d9b65d18b4f29b8017151f"/></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="9fd11a652472d5faa735a07021dfdc68"/><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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Webformat_LoginWithPayPal</name>
4
+ <version>0.9.3</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>
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>Added Seamless Checkout option</notes>
16
  <authors><author><name>WEBFORMAT s.r.l.</name><user>webformat</user><email>magesupport@webformat.com</email></author></authors>
17
+ <date>2015-02-13</date>
18
+ <time>10:19:25</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="0308a2b185357598f1ba84d366b64301"/></dir><dir name="Model"><file name="AbstractRequest.php" hash="40b0ebd9eeb0ed76c317f8b5e91891ff"/><file name="AccessToken.php" hash="33f1d8309b69baf6240b9791d7e4ce64"/><dir name="BackendNotifier"><file name="Feed.php" hash="b2be1437b16032678348b47cc9fdf851"/><file name="Observer.php" hash="855c1f0bb8c9bf123dd3e2e91eb0f78e"/></dir><file name="Grant.php" hash="505c030617612c12234a363f6fbbcc95"/><file name="Login.php" hash="5b5283363d73821a897766dfe4188787"/><dir name="Paypal"><dir name="Api"><file name="Nvp.php" hash="fe15e8e9a6d1cf0af88da7867d75287f"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Button"><file name="Theme.php" hash="ee5558f22633bbed5058840971e4add7"/></dir></dir></dir></dir><file name="UserInfo.php" hash="f7357194d23d2cf7d462a19d3f926523"/></dir><dir name="controllers"><file name="IndexController.php" hash="480b588f3e7a7b3e51c1e5e675a56c83"/></dir><dir name="etc"><file name="Webformat_LoginWithPayPal.xml" hash="0c076ab21d243bfd715ab0010a8a5116"/><file name="adminhtml.xml" hash="bab6d148c9560121b473b52374a234a5"/><file name="config.xml" hash="84ca546f0656701429c997766cc30a0f"/><file name="system.xml" hash="5a57ca6037d9b65d18b4f29b8017151f"/></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="9fd11a652472d5faa735a07021dfdc68"/><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>