Version Notes
Con este módulo se podrá activar la pasarela de pago Pagantis en Magento y aceptar pago con tarjetas de debito.
Download this release
Release Info
Developer | Albert Fatsini |
Extension | Pagantis_Pagantis |
Version | 2.0.5 |
Comparing to | |
See all releases |
Code changes from version 2.0.1 to 2.0.5
- app/code/community/Pagantis/Pagantis/Block/Form.php +11 -0
- app/code/community/Pagantis/Pagantis/Model/Observer.php +34 -0
- app/code/community/Pagantis/Pagantis/Model/Webservice/Requestloan.php +2 -1
- app/code/community/Pagantis/Pagantis/controllers/PagantisController.php +21 -4
- app/code/community/Pagantis/Pagantis/etc/config.xml +10 -0
- app/design/adminhtml/default/default/layout/pagantis.xml +1 -1
- app/design/frontend/base/default/layout/pagantis.xml +7 -0
- app/design/frontend/base/default/template/pagantis/form.phtml +1 -19
- package.xml +10 -10
app/code/community/Pagantis/Pagantis/Block/Form.php
CHANGED
@@ -18,11 +18,22 @@ class Pagantis_Pagantis_Block_Form extends Mage_Payment_Block_Form
|
|
18 |
$session = Mage::getSingleton('checkout/session');
|
19 |
$mark = Mage::getConfig()->getBlockClassName('core/template');
|
20 |
$mark = new $mark;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
$mark->setData('inst2',$this->instAmount(2));
|
22 |
$mark->setData('inst3',$this->instAmount(3));
|
23 |
$mark->setData('inst4',$this->instAmount(4));
|
24 |
$mark->setData('inst5',$this->instAmount(5));
|
25 |
$mark->setData('inst6',$this->instAmount(6));
|
|
|
26 |
$mark->setTemplate('pagantis/form.phtml');
|
27 |
$this->setTemplate('pagantis/pagantis.phtml')
|
28 |
->setMethodLabelAfterHtml($mark->toHtml())
|
18 |
$session = Mage::getSingleton('checkout/session');
|
19 |
$mark = Mage::getConfig()->getBlockClassName('core/template');
|
20 |
$mark = new $mark;
|
21 |
+
$quote = Mage::getModel('checkout/session')->getQuote();
|
22 |
+
$quoteData= $quote->getData();
|
23 |
+
$amount=$quoteData['grand_total'];
|
24 |
+
$config = Mage::getStoreConfig('payment/pagantis');
|
25 |
+
$discount = $config['discount'];
|
26 |
+
if ($discount == 'true'){
|
27 |
+
$mark->setData('discount',1);
|
28 |
+
}else{
|
29 |
+
$mark->setData('discount',0);
|
30 |
+
}
|
31 |
$mark->setData('inst2',$this->instAmount(2));
|
32 |
$mark->setData('inst3',$this->instAmount(3));
|
33 |
$mark->setData('inst4',$this->instAmount(4));
|
34 |
$mark->setData('inst5',$this->instAmount(5));
|
35 |
$mark->setData('inst6',$this->instAmount(6));
|
36 |
+
$mark->setData('total',$amount);
|
37 |
$mark->setTemplate('pagantis/form.phtml');
|
38 |
$this->setTemplate('pagantis/pagantis.phtml')
|
39 |
->setMethodLabelAfterHtml($mark->toHtml())
|
app/code/community/Pagantis/Pagantis/Model/Observer.php
CHANGED
@@ -107,5 +107,39 @@ class Pagantis_Pagantis_Model_Observer
|
|
107 |
}
|
108 |
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
}
|
107 |
}
|
108 |
|
109 |
|
110 |
+
/*
|
111 |
+
autmatically cancel the not paid orders afer 60 minutes
|
112 |
+
*/
|
113 |
+
public function cancelPendingOrders()
|
114 |
+
{
|
115 |
+
$orderCollection = Mage::getResourceModel('sales/order_collection');
|
116 |
+
|
117 |
+
$orderCollection
|
118 |
+
->addFieldToFilter('state', 'pending_payment')
|
119 |
+
->addFieldToFilter('created_at', array(
|
120 |
+
'lt' => new Zend_Db_Expr("DATE_ADD('".now()."', INTERVAL -'60:00' HOUR_MINUTE)")))
|
121 |
+
->getSelect()
|
122 |
+
->limit(20)
|
123 |
+
;
|
124 |
+
|
125 |
+
|
126 |
+
$orders ="";
|
127 |
+
foreach($orderCollection->getItems() as $order)
|
128 |
+
{
|
129 |
+
$orderModel = Mage::getModel('sales/order');
|
130 |
+
$orderModel->load($order['entity_id']);
|
131 |
+
|
132 |
+
|
133 |
+
if(!$orderModel->canCancel())
|
134 |
+
continue;
|
135 |
+
|
136 |
+
$orderModel->cancel();
|
137 |
+
$orderModel->setStatus('canceled');
|
138 |
+
$orderModel->save();
|
139 |
+
|
140 |
+
}
|
141 |
+
}
|
142 |
+
|
143 |
+
|
144 |
|
145 |
}
|
app/code/community/Pagantis/Pagantis/Model/Webservice/Requestloan.php
CHANGED
@@ -115,7 +115,7 @@ class Pagantis_Pagantis_Model_Webservice_Requestloan
|
|
115 |
$array['discount[full]'] = $this->_discount;
|
116 |
|
117 |
$array['locale'] = $this->_languagePagantis;
|
118 |
-
|
119 |
$array['full_name'] = $this->_userData['full_name'];
|
120 |
$array['email'] = $this->_userData['email'];
|
121 |
$array['address[street]'] = $this->_userData['street'];
|
@@ -216,6 +216,7 @@ class Pagantis_Pagantis_Model_Webservice_Requestloan
|
|
216 |
$this->_userData['dni'] = $address->getVatId();
|
217 |
$this->_userData['full_name'] = $address->getFirstname() . ' ' . $address->getLastname();
|
218 |
$this->_userData['email'] = $address->getEmail();
|
|
|
219 |
} else {
|
220 |
throw new \Exception('Missing user data info');
|
221 |
}
|
115 |
$array['discount[full]'] = $this->_discount;
|
116 |
|
117 |
$array['locale'] = $this->_languagePagantis;
|
118 |
+
$array['phone'] = $this->_userData['phone'];
|
119 |
$array['full_name'] = $this->_userData['full_name'];
|
120 |
$array['email'] = $this->_userData['email'];
|
121 |
$array['address[street]'] = $this->_userData['street'];
|
216 |
$this->_userData['dni'] = $address->getVatId();
|
217 |
$this->_userData['full_name'] = $address->getFirstname() . ' ' . $address->getLastname();
|
218 |
$this->_userData['email'] = $address->getEmail();
|
219 |
+
$this->_userData['phone'] = $address->getTelephone();
|
220 |
} else {
|
221 |
throw new \Exception('Missing user data info');
|
222 |
}
|
app/code/community/Pagantis/Pagantis/controllers/PagantisController.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/**
|
4 |
* Pagantis Checkout Controller
|
5 |
-
*
|
6 |
* @package Pagantis_Pagantis
|
7 |
* @copyright Copyright (c) 2015 Yameveo (http://www.yameveo.com)
|
8 |
* @author Yameveo <yameveo@yameveo.com>
|
@@ -27,7 +27,7 @@ class Pagantis_Pagantis_PagantisController extends Mage_Core_Controller_Front_Ac
|
|
27 |
|
28 |
/**
|
29 |
* When customer cancel payment from CECA (UrlKO)
|
30 |
-
*
|
31 |
*/
|
32 |
public function cancelAction()
|
33 |
{
|
@@ -50,6 +50,23 @@ class Pagantis_Pagantis_PagantisController extends Mage_Core_Controller_Front_Ac
|
|
50 |
|
51 |
$json = file_get_contents('php://input');
|
52 |
$temp = json_decode($json,true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
$data = $temp['data'];
|
54 |
$orderId = $data['order_id'];
|
55 |
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
@@ -100,7 +117,7 @@ class Pagantis_Pagantis_PagantisController extends Mage_Core_Controller_Front_Ac
|
|
100 |
|
101 |
/**
|
102 |
* Process order
|
103 |
-
*
|
104 |
* @param $order
|
105 |
*/
|
106 |
private function _processOrder($order)
|
@@ -138,7 +155,7 @@ class Pagantis_Pagantis_PagantisController extends Mage_Core_Controller_Front_Ac
|
|
138 |
|
139 |
/**
|
140 |
* Create an invoice for the order and send an email
|
141 |
-
*
|
142 |
* @param Mage_Sales_Model_Order $order
|
143 |
* @return Mage_Sales_Model_Order_Invoice
|
144 |
*/
|
2 |
|
3 |
/**
|
4 |
* Pagantis Checkout Controller
|
5 |
+
*
|
6 |
* @package Pagantis_Pagantis
|
7 |
* @copyright Copyright (c) 2015 Yameveo (http://www.yameveo.com)
|
8 |
* @author Yameveo <yameveo@yameveo.com>
|
27 |
|
28 |
/**
|
29 |
* When customer cancel payment from CECA (UrlKO)
|
30 |
+
*
|
31 |
*/
|
32 |
public function cancelAction()
|
33 |
{
|
50 |
|
51 |
$json = file_get_contents('php://input');
|
52 |
$temp = json_decode($json,true);
|
53 |
+
//verify notification
|
54 |
+
$conf = Mage::getStoreConfig('payment/pagantis');
|
55 |
+
$environment = $conf['environment'];
|
56 |
+
switch($environment){
|
57 |
+
case Pagantis_Pagantis_Model_Webservice_Client::ENV_TESTING:
|
58 |
+
$key=$conf['account_key_test'];
|
59 |
+
break;
|
60 |
+
case Pagantis_Pagantis_Model_Webservice_Client::ENV_PRODUCTION:
|
61 |
+
$key=$conf['account_key_real'];
|
62 |
+
break;
|
63 |
+
}
|
64 |
+
$signature_check = sha1($key.$temp['account_id'].$temp['api_version'].$temp['event'].$temp['data']['id']);
|
65 |
+
if ($signature_check != $temp['signature'] ){
|
66 |
+
//hack detected
|
67 |
+
$this->cancelAction();
|
68 |
+
return false;
|
69 |
+
}
|
70 |
$data = $temp['data'];
|
71 |
$orderId = $data['order_id'];
|
72 |
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
117 |
|
118 |
/**
|
119 |
* Process order
|
120 |
+
*
|
121 |
* @param $order
|
122 |
*/
|
123 |
private function _processOrder($order)
|
155 |
|
156 |
/**
|
157 |
* Create an invoice for the order and send an email
|
158 |
+
*
|
159 |
* @param Mage_Sales_Model_Order $order
|
160 |
* @return Mage_Sales_Model_Order_Invoice
|
161 |
*/
|
app/code/community/Pagantis/Pagantis/etc/config.xml
CHANGED
@@ -119,4 +119,14 @@
|
|
119 |
</pagantis_pagantis>
|
120 |
</jobs>
|
121 |
</crontab>-->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
</config>
|
119 |
</pagantis_pagantis>
|
120 |
</jobs>
|
121 |
</crontab>-->
|
122 |
+
<crontab>
|
123 |
+
<jobs>
|
124 |
+
<pagantis_pagantis>
|
125 |
+
<schedule><cron_expr>*/30 * * * *</cron_expr></schedule>
|
126 |
+
<run>
|
127 |
+
<model>pagantis_pagantis/observer::cancelPendingOrders</model>
|
128 |
+
</run>
|
129 |
+
</pagantis_pagantis>
|
130 |
+
</jobs>
|
131 |
+
</crontab>
|
132 |
</config>
|
app/design/adminhtml/default/default/layout/pagantis.xml
CHANGED
@@ -5,4 +5,4 @@
|
|
5 |
<action method="addCss"><name>pagantis.css</name></action>
|
6 |
</reference>
|
7 |
</default>
|
8 |
-
</layout>
|
5 |
<action method="addCss"><name>pagantis.css</name></action>
|
6 |
</reference>
|
7 |
</default>
|
8 |
+
</layout>
|
app/design/frontend/base/default/layout/pagantis.xml
CHANGED
@@ -5,4 +5,11 @@
|
|
5 |
<block type="pagantis_pagantis/redirect" name="redirect" template="pagantis/redirect.phtml"></block>
|
6 |
</reference>
|
7 |
</pagantis_pagantis_redirect>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
</layout>
|
5 |
<block type="pagantis_pagantis/redirect" name="redirect" template="pagantis/redirect.phtml"></block>
|
6 |
</reference>
|
7 |
</pagantis_pagantis_redirect>
|
8 |
+
<default>
|
9 |
+
<reference name="before_body_end">
|
10 |
+
<block type="core/text" name="mapcontrol.script.block">
|
11 |
+
<action method="setText"><text><![CDATA[<script src="https://cdn.pagamastarde.com/js/pmt-simulator/latest/js/pmt-simulator.min.js"></script>]]></text></action>
|
12 |
+
</block>
|
13 |
+
</reference>
|
14 |
+
</default>
|
15 |
</layout>
|
app/design/frontend/base/default/template/pagantis/form.phtml
CHANGED
@@ -1,22 +1,4 @@
|
|
1 |
<img id="imgpagantisfront" src="<?php echo $this->getSkinUrl('images/pagantis/logopagamastarde.png') ?>"/>
|
2 |
<?php $_code = $this->getMethodCode() ?>
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
<span id="int_amount2"><?=round($this->inst6,2)?></span> € / mes en
|
7 |
-
<!--<select style="width:50px" name="num_inst2" disabled="enabled" id="num_inst2" onChange="document.getElementById('int_amount2').innerHTML=document.getElementById('instAmount2'+this.value).innerHTML;" >
|
8 |
-
<option value="6">6</option>
|
9 |
-
<option value="5">5</option>
|
10 |
-
<option value="4">4</option>
|
11 |
-
<option value="3">3</option>
|
12 |
-
<option value="2">2</option>
|
13 |
-
</select> -->
|
14 |
-
|
15 |
-
6 plazos
|
16 |
-
|
17 |
-
|
18 |
-
<div style="display:none" id="instAmount22"><?=round ($this->inst2,2)?></div>
|
19 |
-
<div style="display:none" id="instAmount23"><?=round ($this->inst3,2)?></div>
|
20 |
-
<div style="display:none" id="instAmount24"><?=round ($this->inst4,2)?></div>
|
21 |
-
<div style="display:none" id="instAmount25"><?=round ($this->inst5,2)?></div>
|
22 |
-
<div style="display:none" id="instAmount26"><?=round ($this->inst6,2)?></div>
|
1 |
<img id="imgpagantisfront" src="<?php echo $this->getSkinUrl('images/pagantis/logopagamastarde.png') ?>"/>
|
2 |
<?php $_code = $this->getMethodCode() ?>
|
3 |
|
4 |
+
Paga a plazos
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
-
<name>
|
4 |
-
<version>2.0.
|
5 |
<stability>stable</stability>
|
6 |
-
<license
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>Modulo de Magento para abilitar la pasarela de pago
|
10 |
-
<description>
|
11 |
-
<notes>
|
12 |
-
<authors><author><name>
|
13 |
-
<date>2015-
|
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="285814ecab6b4e338e75a370f41fdc12"/></dir></dir></dir></dir><file name="Form.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
+
<name>PagaMasTarde</name>
|
4 |
+
<version>2.0.5</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license>GPL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Modulo de Magento para abilitar 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>Con este módulo se podrá activar la pasarela de pago Pagantis en Magento y aceptar pago con tarjetas de debito.</notes>
|
12 |
+
<authors><author><name>PagaMasTarde</name><user>PagaMasTarde</user><email>afatsini@digitalorigin.com</email></author></authors>
|
13 |
+
<date>2015-12-14</date>
|
14 |
+
<time>09:44:28</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="285814ecab6b4e338e75a370f41fdc12"/></dir></dir></dir></dir><file name="Form.php" hash="7d934dc68b5c92d438d32ffa0727a0f9"/><file name="Redirect.php" hash="24fef0caf8b76c629b75e2d4acc81443"/></dir><dir name="Helper"><file name="Data.php" hash="e90849a9b9310979d58f7a092d2d2a28"/></dir><dir name="Model"><file name="Currency.php" hash="a5557e10938898b0213a90dd7be15540"/><file name="Observer.php" hash="0c2a7b1b4ca273b482600b6e9e030ad9"/><file name="Payment.php" hash="191a611492496b066ae0477807ef13e4"/><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="76506a6627d6523aae845169854f4ece"/><file name="Requestloan.php" hash="6b3a8045810226ed72362772d84012bd"/><file name="Response.php" hash="bb1ade5931c5580f4585fc0fdb2bc4b0"/></dir></dir><dir name="controllers"><file name="PagantisController.php" hash="dc86e18421e93d1969f7ab9d28b22933"/></dir><dir name="etc"><file name="config.xml" hash="a10e521ef5101e10d0b7aa61c2b76370"/><file name="system.xml" hash="6d15f34f3aa3429501cb6d1f9b8ec458"/></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="1dcc8470921052291d3041031a6f903c"/></dir><dir name="template"><dir name="pagantis"><file name="form.phtml" hash="554c2e705e96d98ddd008f4782d6ce04"/><file name="pagantis.phtml" hash="a84fa4e8feae06f001fc13dd4df3e3cd"/><file name="redirect.phtml" hash="3d7d1a5076fc98269e5a7f476be27650"/></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="45ca2308011ed481b8a649fe170ccb8a"/></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></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|