Version Notes
Solved bug that avoids cancelling an order after being paid
Download this release
Release Info
Developer | Albert Fatsini |
Extension | Pagantis_Pagantis |
Version | 3.2.3 |
Comparing to | |
See all releases |
Code changes from version 3.2.2 to 3.2.3
app/code/community/Pagantis/Pagantis/Model/Webservice/Requestloan.php
CHANGED
@@ -493,7 +493,8 @@ class Pagantis_Pagantis_Model_Webservice_Requestloan
|
|
493 |
*/
|
494 |
public function setUrlCancelled($urlKo = '')
|
495 |
{
|
496 |
-
|
|
|
497 |
$have_params = strpos($urlCancel,'?');
|
498 |
if ($have_params !== false){
|
499 |
$urlCancel = substr($urlCancel,0,$have_params);
|
493 |
*/
|
494 |
public function setUrlCancelled($urlKo = '')
|
495 |
{
|
496 |
+
#$urlCancel = Mage::helper('checkout/url')->getCheckoutUrl();
|
497 |
+
$urlCancel = $this->getUrl('cancel');
|
498 |
$have_params = strpos($urlCancel,'?');
|
499 |
if ($have_params !== false){
|
500 |
$urlCancel = substr($urlCancel,0,$have_params);
|
app/code/community/Pagantis/Pagantis/controllers/PagantisController.php
CHANGED
@@ -16,33 +16,29 @@ class Pagantis_Pagantis_PagantisController extends Mage_Core_Controller_Front_Ac
|
|
16 |
*/
|
17 |
public function redirectAction()
|
18 |
{
|
19 |
-
$state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
|
20 |
$session = Mage::getSingleton('checkout/session');
|
21 |
$order = Mage::getModel('sales/order')->load($session->getLastOrderId());
|
22 |
-
|
23 |
-
$order->
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
$this->loadLayout();
|
45 |
-
$this->renderLayout();
|
46 |
}
|
47 |
|
48 |
/**
|
@@ -52,16 +48,25 @@ class Pagantis_Pagantis_PagantisController extends Mage_Core_Controller_Front_Ac
|
|
52 |
public function cancelAction()
|
53 |
{
|
54 |
$session = Mage::getSingleton('checkout/session');
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
$order->cancel()->save();
|
|
|
61 |
}
|
62 |
-
|
|
|
|
|
|
|
63 |
}
|
64 |
-
$this->_redirect('checkout/cart');
|
65 |
}
|
66 |
|
67 |
public function notificationAction(){
|
@@ -101,7 +106,8 @@ class Pagantis_Pagantis_PagantisController extends Mage_Core_Controller_Front_Ac
|
|
101 |
$this->_processOrder($order);
|
102 |
break;
|
103 |
case 'charge.failed':
|
104 |
-
if ( $order->getState != Mage_Sales_Model_Order::STATE_PROCESSING
|
|
|
105 |
$order->setPagantisTransaction($data['id']);
|
106 |
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED,true);
|
107 |
$order->save();
|
@@ -224,4 +230,20 @@ class Pagantis_Pagantis_PagantisController extends Mage_Core_Controller_Front_Ac
|
|
224 |
return $invoice;
|
225 |
}
|
226 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
}
|
16 |
*/
|
17 |
public function redirectAction()
|
18 |
{
|
|
|
19 |
$session = Mage::getSingleton('checkout/session');
|
20 |
$order = Mage::getModel('sales/order')->load($session->getLastOrderId());
|
21 |
+
//we came back from previous order
|
22 |
+
if ($order->getState() == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT
|
23 |
+
&& $order->getPagantisTransaction() == 'pmt_pending_order') {
|
24 |
+
$this->_restore_cart($order);
|
25 |
+
$this->loadLayout();
|
26 |
+
$this->renderLayout();
|
27 |
+
}
|
28 |
+
// if order is not paid yet, redirect to payment page
|
29 |
+
else if($order->getState() != Mage_Sales_Model_Order::STATE_COMPLETE &&
|
30 |
+
$order->getState() !=Mage_Sales_Model_Order::STATE_PROCESSING) {
|
31 |
+
$state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
|
32 |
+
$order->setState($state, $state, Mage::helper('pagantis_pagantis')->__('Redirected to Pagantis'), false);
|
33 |
+
$order->setPagantisTransaction('pmt_pending_order');
|
34 |
+
$order->save();
|
35 |
+
$this->_restore_cart($order);
|
36 |
+
$this->loadLayout();
|
37 |
+
$this->renderLayout();
|
38 |
+
} else {
|
39 |
+
//order is paid
|
40 |
+
$this->successAction();
|
41 |
+
}
|
|
|
|
|
|
|
42 |
}
|
43 |
|
44 |
/**
|
48 |
public function cancelAction()
|
49 |
{
|
50 |
$session = Mage::getSingleton('checkout/session');
|
51 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
|
52 |
+
if ( !$order->getId()) {
|
53 |
+
$session->addError('Lo sentimos, se ha producido algún error en el pago, le agradeceríamos que volviera a intentarlo.');
|
54 |
+
Mage::helper('pagantis_pagantis')->restoreQuote();
|
55 |
+
$this->_redirect('checkout/cart');
|
56 |
+
} elseif ($order->getId() &&
|
57 |
+
$order->getState() != Mage_Sales_Model_Order::STATE_COMPLETE &&
|
58 |
+
$order->getState() !=Mage_Sales_Model_Order::STATE_PROCESSING) {
|
59 |
+
//Mage::getSingleton(‘core/session’)->addError(‘Error message’);
|
60 |
+
$session->addError('Lo sentimos, se ha producido algún error en el pago, le agradeceríamos que volviera a intentarlo.');
|
61 |
+
if ($session->getLastRealOrderId()) {
|
62 |
$order->cancel()->save();
|
63 |
+
Mage::helper('pagantis_pagantis')->restoreQuote();
|
64 |
}
|
65 |
+
$this->_redirect('checkout/cart');
|
66 |
+
} else {
|
67 |
+
//order is paid
|
68 |
+
$this->successAction();
|
69 |
}
|
|
|
70 |
}
|
71 |
|
72 |
public function notificationAction(){
|
106 |
$this->_processOrder($order);
|
107 |
break;
|
108 |
case 'charge.failed':
|
109 |
+
if ( $order->getState != Mage_Sales_Model_Order::STATE_PROCESSING &&
|
110 |
+
$order->getState != Mage_Sales_Model_Order::STATE_COMPLETE) {
|
111 |
$order->setPagantisTransaction($data['id']);
|
112 |
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED,true);
|
113 |
$order->save();
|
230 |
return $invoice;
|
231 |
}
|
232 |
|
233 |
+
private function _restore_cart($order) {
|
234 |
+
$cart = Mage::getSingleton('checkout/cart');
|
235 |
+
$items = $order->getItemsCollection();
|
236 |
+
if ($cart->getItemsCount()<=0){
|
237 |
+
foreach ($items as $item) {
|
238 |
+
try {
|
239 |
+
$cart->addOrderItem($item);
|
240 |
+
} catch (Mage_Core_Exception $e) {
|
241 |
+
$session->addError($this->__($e->getMessage()));
|
242 |
+
Mage::logException($e);
|
243 |
+
continue;
|
244 |
+
}
|
245 |
+
}
|
246 |
+
$cart->save();
|
247 |
+
}
|
248 |
+
}
|
249 |
}
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Pagantis_Pagantis</name>
|
4 |
-
<version>3.2.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.gnu.org/licenses/gpl-3.0.en.html">GPL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Modulo de Magento para habilitar la pasarela de pago Pagantis en Magento.</summary>
|
10 |
<description>Con este módulo se podrá activar la pasarela de pago Pagantis en Magento y aceptar pago con tarjetas de debito.</description>
|
11 |
-
<notes>
|
12 |
<authors><author><name>Albert Fatsini</name><user>PagaMasTarde</user><email>afatsini@digitalorigin.com</email></author></authors>
|
13 |
-
<date>2016-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="Pagantis"><dir name="Pagantis"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Payment.php" hash="7c2b0d3c7a7bf6d4a9ac02a5b6125af3"/></dir></dir></dir></dir><file name="Form.php" hash="89aded0a5a4754181ee2dd24f480cff9"/><file name="Redirect.php" hash="67d7cb6ddd3089cb5bba2a13c2b7493e"/></dir><dir name="Helper"><file name="Data.php" hash="dd40634af028d3179be77b48d4d6e3b1"/></dir><dir name="Model"><file name="Currency.php" hash="a5557e10938898b0213a90dd7be15540"/><file name="Observer.php" hash="fa0e7d5688701cae875a8d14f58a816e"/><file name="Payment.php" hash="56017eb1aa5bd545811df915f0eeae8f"/><dir name="Source"><dir name="Payment"><file name="Currency.php" hash="7e51124f09e2028198fb9587df820809"/><file name="Environment.php" hash="30d6400967acdd8975c5748994c100e6"/></dir></dir><dir name="Webservice"><file name="Client.php" hash="6a14e0ae7ef5180445a3a99aec4717bb"/><file name="Paymentrequest.php" hash="dcf473ea7211a82b55b5374549c3cfc0"/><file name="Request.php" hash="f39f3312449a4aa41b716842ff0466dd"/><file name="Requestloan.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>8.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Pagantis_Pagantis</name>
|
4 |
+
<version>3.2.3</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.gnu.org/licenses/gpl-3.0.en.html">GPL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Modulo de Magento para habilitar la pasarela de pago Pagantis en Magento.</summary>
|
10 |
<description>Con este módulo se podrá activar la pasarela de pago Pagantis en Magento y aceptar pago con tarjetas de debito.</description>
|
11 |
+
<notes>Solved bug that avoids cancelling an order after being paid</notes>
|
12 |
<authors><author><name>Albert Fatsini</name><user>PagaMasTarde</user><email>afatsini@digitalorigin.com</email></author></authors>
|
13 |
+
<date>2016-12-02</date>
|
14 |
+
<time>12:06:33</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Pagantis"><dir name="Pagantis"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Payment.php" hash="7c2b0d3c7a7bf6d4a9ac02a5b6125af3"/></dir></dir></dir></dir><file name="Form.php" hash="89aded0a5a4754181ee2dd24f480cff9"/><file name="Redirect.php" hash="67d7cb6ddd3089cb5bba2a13c2b7493e"/></dir><dir name="Helper"><file name="Data.php" hash="dd40634af028d3179be77b48d4d6e3b1"/></dir><dir name="Model"><file name="Currency.php" hash="a5557e10938898b0213a90dd7be15540"/><file name="Observer.php" hash="fa0e7d5688701cae875a8d14f58a816e"/><file name="Payment.php" hash="56017eb1aa5bd545811df915f0eeae8f"/><dir name="Source"><dir name="Payment"><file name="Currency.php" hash="7e51124f09e2028198fb9587df820809"/><file name="Environment.php" hash="30d6400967acdd8975c5748994c100e6"/></dir></dir><dir name="Webservice"><file name="Client.php" hash="6a14e0ae7ef5180445a3a99aec4717bb"/><file name="Paymentrequest.php" hash="dcf473ea7211a82b55b5374549c3cfc0"/><file name="Request.php" hash="f39f3312449a4aa41b716842ff0466dd"/><file name="Requestloan.php" hash="8efcee9efc6010918eccec46704a1d4d"/><file name="Response.php" hash="bb1ade5931c5580f4585fc0fdb2bc4b0"/></dir></dir><dir name="controllers"><file name="PagantisController.php" hash="608a0e88c5c3267102464bd091ebb55e"/></dir><dir name="etc"><file name="config.xml" hash="ac4c7505180457b75b59d40691329db7"/><file name="system.xml" hash="a8a6b2cc704f825ad0688d49b783562c"/></dir><dir name="sql"><dir name="pagantis_setup"><file name="mysql4-install-1.0.0.php" hash="4ec10724709f8d381758409f55cff99d"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="pagantis.xml" hash="4328e44e218a0996f4e2412c545a8e9b"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="pagantis.xml" hash="29736a84ea78eaeb75fe2be77d0a63cb"/></dir><dir name="template"><dir name="pagantis"><file name="form.phtml" hash="11cf70a55d8ec9e8ae3c1d94a832eeab"/><file name="pagantis.phtml" hash="39f682244d4cb5998d42ef65ed498f7c"/><file name="redirect.phtml" hash="01cc228e3183b4751e324435f2782124"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Pagantis_Pagantis.xml" hash="c57db60bd03314d7a45f27acc9a9475a"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="base"><dir name="default"><file name="pagantis.css" hash="7d1b6daea9f42c2552ebb5bd5c15596d"/></dir></dir><dir name="default"><dir name="default"><dir name="images"><dir name="pagantis"><file name="logopagamastarde.png" hash="d51fa42e42d9811653df55710a395d07"/><file name="pagantis.png" hash="292403ede1f62affccf06df004ddfe12"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="pagantis"><file name="logopagamastarde.png" hash="d51fa42e42d9811653df55710a395d07"/><file name="pagantis-fav.png" hash="c4e162b51c0792ff25385506d7998818"/><file name="pagantis.png" hash="292403ede1f62affccf06df004ddfe12"/></dir></dir><file name="iframe.css" hash="50660dc3125dee715f7d6ac8275d70da"/></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>8.0.0</max></php></required></dependencies>
|
18 |
</package>
|
skin/frontend/base/default/iframe.css
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* The Modal (background) */
|
2 |
+
.paylater_modal {
|
3 |
+
display: none; /* Hidden by default */
|
4 |
+
position: fixed; /* Stay in place */
|
5 |
+
z-index: 6000; /* Sit on top */
|
6 |
+
left: 0;
|
7 |
+
top: 0;
|
8 |
+
width: 100%; /* Full width */
|
9 |
+
height: 100%; /* Full height */
|
10 |
+
overflow: auto; /* Enable scroll if needed */
|
11 |
+
background-color: rgb(0,0,0); /* Fallback color */
|
12 |
+
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
|
13 |
+
}
|
14 |
+
|
15 |
+
/* Modal Content/Box */
|
16 |
+
.paylater_modal-content {
|
17 |
+
background-color: #fefefe;
|
18 |
+
margin: 15% auto; /* 15% from the top and centered */
|
19 |
+
padding: 20px;
|
20 |
+
border: 1px solid #888;
|
21 |
+
width: 80%; /* Could be more or less, depending on screen size */
|
22 |
+
border: 1px solid rgba(0, 0, 0, 0.3);
|
23 |
+
-webkit-border-radius: 6px;
|
24 |
+
-moz-border-radius: 6px;
|
25 |
+
border-radius: 6px;
|
26 |
+
-webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
|
27 |
+
-moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
|
28 |
+
box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
|
29 |
+
-webkit-background-clip: padding-box;
|
30 |
+
-moz-background-clip: padding-box;
|
31 |
+
background-clip: padding-box;
|
32 |
+
}
|
33 |
+
|
34 |
+
/* The Close Button */
|
35 |
+
#paylater_close {
|
36 |
+
color: #aaa;
|
37 |
+
float: right;
|
38 |
+
font-size: 28px;
|
39 |
+
font-weight: bold;
|
40 |
+
}
|
41 |
+
|
42 |
+
#paylater_close:hover,
|
43 |
+
#paylater_close:focus {
|
44 |
+
color: black;
|
45 |
+
text-decoration: none;
|
46 |
+
cursor: pointer;
|
47 |
+
}
|
48 |
+
@media only screen and (min-width: 768px) {
|
49 |
+
.paylater_modal-content {
|
50 |
+
width: 60%;
|
51 |
+
margin: 10% auto;
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
@media only screen and (min-width: 1200px) {
|
56 |
+
.paylater_modal-content {
|
57 |
+
width: 50%;
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
#iframe-pagantis {
|
62 |
+
border: none !important;
|
63 |
+
}
|