Version Notes
callback compatibility
Download this release
Release Info
Developer | Eupago |
Extension | Eupago_MBWAY |
Version | 1.0.6 |
Comparing to | |
See all releases |
Code changes from version 1.0.5 to 1.0.6
- app/code/community/Eupago/Mbway/Model/Mbway.php +9 -3
- app/code/community/Eupago/Mbway/Model/Observer.php +23 -0
- app/code/community/Eupago/Mbway/Model/System/Config/Template.php +2 -2
- app/code/community/Eupago/Mbway/controllers/CallbackController.php +1 -1
- app/code/community/Eupago/Mbway/etc/config.xml +30 -1
- app/code/community/Eupago/Mbway/etc/system.xml +5 -4
- app/design/frontend/base/default/template/eupago/mbway/info/mbway.phtml +4 -5
- package.xml +4 -4
app/code/community/Eupago/Mbway/Model/Mbway.php
CHANGED
@@ -90,14 +90,20 @@ class Eupago_Mbway_Model_Mbway extends Mage_Payment_Model_Method_Abstract{
|
|
90 |
if($result == false) {
|
91 |
$errorMsg = $this->_getHelper()->__('Error Processing the request');
|
92 |
} else {
|
93 |
-
if($result->estado_referencia == 'paga' || $result->estado_referencia == 'transferida')
|
|
|
94 |
// neste sistema altera logo para pago
|
95 |
$payment->setTransactionId($referencia."-capture");
|
96 |
$payment->setParentTransactionId($referencia);
|
97 |
$payment->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS,array('referencia'=>$referencia,'resposta'=>$result->resposta,'method'=>'MBWAY', "data de pagamento"=>$result->data_pagamento, "hora de pagamento"=>$result->hora_pagamento));
|
98 |
$payment->setIsTransactionClosed(true);
|
99 |
}else{
|
100 |
-
$
|
|
|
|
|
|
|
|
|
|
|
101 |
}
|
102 |
}
|
103 |
|
@@ -110,7 +116,7 @@ class Eupago_Mbway_Model_Mbway extends Mage_Payment_Model_Method_Abstract{
|
|
110 |
|
111 |
|
112 |
private function getSoapUrl(){
|
113 |
-
$version = '
|
114 |
$chave = $this->getConfigData('chave');
|
115 |
$demo = explode("-",$chave);
|
116 |
|
90 |
if($result == false) {
|
91 |
$errorMsg = $this->_getHelper()->__('Error Processing the request');
|
92 |
} else {
|
93 |
+
if(($result->estado_referencia == 'paga' || $result->estado_referencia == 'transferida' || $result->estado_referencia == "em processamento")
|
94 |
+
&& $payment->getOrder()->getBaseTotalDue() == $result->valor){
|
95 |
// neste sistema altera logo para pago
|
96 |
$payment->setTransactionId($referencia."-capture");
|
97 |
$payment->setParentTransactionId($referencia);
|
98 |
$payment->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS,array('referencia'=>$referencia,'resposta'=>$result->resposta,'method'=>'MBWAY', "data de pagamento"=>$result->data_pagamento, "hora de pagamento"=>$result->hora_pagamento));
|
99 |
$payment->setIsTransactionClosed(true);
|
100 |
}else{
|
101 |
+
if($payment->getOrder()->getBaseTotalDue() != $result->valor)
|
102 |
+
$errorMsg ="o valor pago não corresponde ao valor da encomenda";
|
103 |
+
else
|
104 |
+
$errorMsg = "a referência não se encontra paga";
|
105 |
+
|
106 |
+
Mage::log("\nincrementId: ".$payment->getOrder()->getIncrementId()."\nentidade: ".$entidade."\nreferencia: ".$referencia."\nerro: ". $errorMsg , null, 'eupago_multibanco.log');
|
107 |
}
|
108 |
}
|
109 |
|
116 |
|
117 |
|
118 |
private function getSoapUrl(){
|
119 |
+
$version = 'eupagov7';
|
120 |
$chave = $this->getConfigData('chave');
|
121 |
$demo = explode("-",$chave);
|
122 |
|
app/code/community/Eupago/Mbway/Model/Observer.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eupago_Mbway_Model_Observer
|
4 |
+
{
|
5 |
+
public function pendingPaymentState($observer)
|
6 |
+
{
|
7 |
+
$order = $observer->getOrder();
|
8 |
+
$method = $order->getPayment()->getMethodInstance();
|
9 |
+
if ($method->getCode() == 'mbway')
|
10 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true, 'A aguardar pagamento por mbway');
|
11 |
+
}
|
12 |
+
|
13 |
+
public function sendInvoiceEmail($observer)
|
14 |
+
{
|
15 |
+
$invoice = $observer->getEvent()->getInvoice();
|
16 |
+
$order = $invoice->getOrder();
|
17 |
+
$method = $order->getPayment()->getMethodInstance();
|
18 |
+
$sendEmail = Mage::getStoreConfig('payment/mbway/send_invoice_email');
|
19 |
+
if ($method->getCode() == 'mbway' && $sendEmail){
|
20 |
+
$invoice->sendEmail();
|
21 |
+
}
|
22 |
+
}
|
23 |
+
}
|
app/code/community/Eupago/Mbway/Model/System/Config/Template.php
CHANGED
@@ -9,8 +9,8 @@ class Eupago_Mbway_Model_System_Config_Template
|
|
9 |
public function toOptionArray()
|
10 |
{
|
11 |
return array(
|
12 |
-
array('value' => 'nenhum', 'label' => Mage::helper('adminhtml')->__('Nenhum')),
|
13 |
array('value' => 'mbway', 'label' => Mage::helper('adminhtml')->__('Mbway')),
|
|
|
14 |
);
|
15 |
}
|
16 |
|
@@ -22,8 +22,8 @@ class Eupago_Mbway_Model_System_Config_Template
|
|
22 |
public function toArray()
|
23 |
{
|
24 |
return array(
|
25 |
-
'nenhum' => Mage::helper('adminhtml')->__('Nenhum'),
|
26 |
'mbway' => Mage::helper('adminhtml')->__('Mbway'),
|
|
|
27 |
);
|
28 |
}
|
29 |
}
|
9 |
public function toOptionArray()
|
10 |
{
|
11 |
return array(
|
|
|
12 |
array('value' => 'mbway', 'label' => Mage::helper('adminhtml')->__('Mbway')),
|
13 |
+
array('value' => 'nenhum', 'label' => Mage::helper('adminhtml')->__('Nenhum')),
|
14 |
);
|
15 |
}
|
16 |
|
22 |
public function toArray()
|
23 |
{
|
24 |
return array(
|
|
|
25 |
'mbway' => Mage::helper('adminhtml')->__('Mbway'),
|
26 |
+
'nenhum' => Mage::helper('adminhtml')->__('Nenhum'),
|
27 |
);
|
28 |
}
|
29 |
}
|
app/code/community/Eupago/Mbway/controllers/CallbackController.php
CHANGED
@@ -280,7 +280,7 @@ class Eupago_Mbway_CallbackController extends Mage_Core_Controller_Front_Action
|
|
280 |
$order->setData('state', "complete");
|
281 |
$order->setStatus("processing");
|
282 |
$order->sendOrderUpdateEmail();
|
283 |
-
$history = $order->addStatusHistoryComment('
|
284 |
$history->setIsCustomerNotified(true);
|
285 |
if($geraFatura)
|
286 |
$this->geraFatura($order);
|
280 |
$order->setData('state', "complete");
|
281 |
$order->setStatus("processing");
|
282 |
$order->sendOrderUpdateEmail();
|
283 |
+
$history = $order->addStatusHistoryComment('Eupago: a referencia foi paga.', false);
|
284 |
$history->setIsCustomerNotified(true);
|
285 |
if($geraFatura)
|
286 |
$this->geraFatura($order);
|
app/code/community/Eupago/Mbway/etc/config.xml
CHANGED
@@ -16,6 +16,35 @@
|
|
16 |
<class>Eupago_Mbway_Model</class>
|
17 |
</mbway>
|
18 |
</models>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
</global>
|
20 |
<frontend>
|
21 |
<routers>
|
@@ -23,7 +52,7 @@
|
|
23 |
<use>standard</use>
|
24 |
<args>
|
25 |
<module>Eupago_Mbway</module>
|
26 |
-
<frontName>
|
27 |
</args>
|
28 |
</Eupago_Mbway>
|
29 |
</routers>
|
16 |
<class>Eupago_Mbway_Model</class>
|
17 |
</mbway>
|
18 |
</models>
|
19 |
+
<events>
|
20 |
+
<sales_order_place_after>
|
21 |
+
<observers>
|
22 |
+
<eupago_mbway_order_observer>
|
23 |
+
<type>singleton</type>
|
24 |
+
<class>mbway/observer</class>
|
25 |
+
<method>pendingPaymentState</method>
|
26 |
+
</eupago_mbway_order_observer>
|
27 |
+
</observers>
|
28 |
+
</sales_order_place_after>
|
29 |
+
<sales_order_invoice_save_after>
|
30 |
+
<observers>
|
31 |
+
<eupago_mbway_order_observer>
|
32 |
+
<type>singleton</type>
|
33 |
+
<class>mbway/observer</class>
|
34 |
+
<method>sendInvoiceEmail</method>
|
35 |
+
</eupago_mbway_order_observer>
|
36 |
+
</observers>
|
37 |
+
</sales_order_invoice_save_after>
|
38 |
+
</events>
|
39 |
+
<sales>
|
40 |
+
<order>
|
41 |
+
<states>
|
42 |
+
<pending_payment>
|
43 |
+
<visible_on_front>1</visible_on_front>
|
44 |
+
</pending_payment>
|
45 |
+
</states>
|
46 |
+
</order>
|
47 |
+
</sales>
|
48 |
</global>
|
49 |
<frontend>
|
50 |
<routers>
|
52 |
<use>standard</use>
|
53 |
<args>
|
54 |
<module>Eupago_Mbway</module>
|
55 |
+
<frontName>Eupago_Mbway</frontName>
|
56 |
</args>
|
57 |
</Eupago_Mbway>
|
58 |
</routers>
|
app/code/community/Eupago/Mbway/etc/system.xml
CHANGED
@@ -36,15 +36,16 @@
|
|
36 |
<show_in_website>0</show_in_website>
|
37 |
<show_in_store>0</show_in_store>
|
38 |
</chave>
|
39 |
-
<
|
40 |
-
<label>
|
|
|
41 |
<frontend_type>select</frontend_type>
|
42 |
-
<source_model>adminhtml/
|
43 |
<sort_order>4</sort_order>
|
44 |
<show_in_default>1</show_in_default>
|
45 |
<show_in_website>1</show_in_website>
|
46 |
<show_in_store>0</show_in_store>
|
47 |
-
</
|
48 |
<mostra_icon translate="label">
|
49 |
<label>Show icon</label>
|
50 |
<comment>Mostra icon do mbway na listagem de metodos de pagamento antes do titulo</comment>
|
36 |
<show_in_website>0</show_in_website>
|
37 |
<show_in_store>0</show_in_store>
|
38 |
</chave>
|
39 |
+
<send_invoice_email translate="label">
|
40 |
+
<label>Send Invoice email</label>
|
41 |
+
<comment>Envia o email de confirmação de pagamento (invoice email)</comment>
|
42 |
<frontend_type>select</frontend_type>
|
43 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
44 |
<sort_order>4</sort_order>
|
45 |
<show_in_default>1</show_in_default>
|
46 |
<show_in_website>1</show_in_website>
|
47 |
<show_in_store>0</show_in_store>
|
48 |
+
</send_invoice_email>
|
49 |
<mostra_icon translate="label">
|
50 |
<label>Show icon</label>
|
51 |
<comment>Mostra icon do mbway na listagem de metodos de pagamento antes do titulo</comment>
|
app/design/frontend/base/default/template/eupago/mbway/info/mbway.phtml
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
<
|
2 |
-
<
|
3 |
<?php
|
4 |
$mbway_data = $this->getMbwayData();
|
5 |
if(isset($mbway_data->pedido) && $mbway_data->pedido != ""){?>
|
@@ -34,6 +34,5 @@
|
|
34 |
echo "<h4>Mbway</h4>";
|
35 |
echo $this->__('Vai receber nos seus dispositivos inscritos no MB WAY um pedido de pagamento. Para validar a compra basta aceitar e introduzir o seu PIN MB WAY.');
|
36 |
}?>
|
37 |
-
|
38 |
-
|
39 |
-
</ul>
|
1 |
+
<div id="payment_info_<?php echo $this->getMethodCode() ?>">
|
2 |
+
<div style="min-width: 300px;">
|
3 |
<?php
|
4 |
$mbway_data = $this->getMbwayData();
|
5 |
if(isset($mbway_data->pedido) && $mbway_data->pedido != ""){?>
|
34 |
echo "<h4>Mbway</h4>";
|
35 |
echo $this->__('Vai receber nos seus dispositivos inscritos no MB WAY um pedido de pagamento. Para validar a compra basta aceitar e introduzir o seu PIN MB WAY.');
|
36 |
}?>
|
37 |
+
</div>
|
38 |
+
</div>
|
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Eupago_MBWAY</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license>GNU General Public License (GPL)</license>
|
7 |
<channel>community</channel>
|
@@ -13,9 +13,9 @@
|
|
13 |
</description>
|
14 |
<notes>callback compatibility</notes>
|
15 |
<authors><author><name>Eupago</name><user>eupago</user><email>suporte@eupago.pt</email></author></authors>
|
16 |
-
<date>
|
17 |
-
<time>
|
18 |
-
<contents><target name="magecommunity"><dir name="Eupago"><dir name="Mbway"><dir name="Block"><dir name="Form"><file name="Mbway.php" hash="87f0784cd78d5ce7cfbe532133070d15"/></dir><dir name="Info"><file name="Mbway.php" hash="acadf6f16d5b118124f723ca49aa45be"/></dir></dir><dir name="Model"><file name="Mbway.php" hash="
|
19 |
<compatible/>
|
20 |
<dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies>
|
21 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Eupago_MBWAY</name>
|
4 |
+
<version>1.0.6</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>GNU General Public License (GPL)</license>
|
7 |
<channel>community</channel>
|
13 |
</description>
|
14 |
<notes>callback compatibility</notes>
|
15 |
<authors><author><name>Eupago</name><user>eupago</user><email>suporte@eupago.pt</email></author></authors>
|
16 |
+
<date>2017-05-15</date>
|
17 |
+
<time>15:48:50</time>
|
18 |
+
<contents><target name="magecommunity"><dir name="Eupago"><dir name="Mbway"><dir name="Block"><dir name="Form"><file name="Mbway.php" hash="87f0784cd78d5ce7cfbe532133070d15"/></dir><dir name="Info"><file name="Mbway.php" hash="acadf6f16d5b118124f723ca49aa45be"/></dir></dir><dir name="Model"><file name="Mbway.php" hash="d58baf9c9795fd260fb4c3b94ec41367"/><file name="Observer.php" hash="9defb92db92a2b5fa047eb3c1492a5f6"/><dir name="System"><dir name="Config"><file name="Template.php" hash="85aac207ebcd64ac829146f02791fa85"/></dir></dir></dir><dir name="controllers"><file name="CallbackController.php" hash="d39d3ab102867e4162d1d8d5e6a798fd"/></dir><dir name="etc"><file name="config.xml" hash="ab11fd3c107ac0375aac17707b5dfba8"/><file name="system.xml" hash="c0e8a58e8c22f6e30fb1c1b8bdfa92fc"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Eupago_Mbway.xml" hash="1a844093c055d916fc3cc16fa9c86f64"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="eupago"><dir name="mbway"><dir name="form"><file name="default.phtml" hash="2325880e1c94f851c8379996786e128f"/><file name="mbway.phtml" hash="3ca1a607601ca50e70b75ad625032cd9"/></dir><dir name="info"><file name="default.phtml" hash="df73cde94c9f2d9e189396ffe9afbaa3"/><file name="mbway.phtml" hash="16d7fc3480c0906d18d7935f132e302b"/></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="eupago"><dir name="mbway"><dir name="form"><file name="mbway.phtml" hash="1fa44aab0a61a78c9a2abf4604264db2"/></dir><dir name="info"><file name="mbway.phtml" hash="2486d82ad350cd29d0640ba8799280c0"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="eupago"><dir name="mbway"><file name="MBWAY_RGB_negativo_m.png" hash="71de2353d68621b7ae1d66bb38b63b12"/><file name="MBWAY_RGB_negativo_s.png" hash="71f9710d7968c845d6344d5354b39c46"/><file name="MBWAY_RGB_positivo_m.png" hash="dd01c36caee3bca598831a26eae35aa5"/><file name="MBWAY_RGB_positivo_s.png" hash="1b8445fc5ec6b202c91ec67490a89315"/><file name="mbway_icon.png" hash="c8d7cee9ee9ca2f30eda5dec00d279bc"/></dir></dir></dir></dir></dir></dir></target></contents>
|
19 |
<compatible/>
|
20 |
<dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies>
|
21 |
</package>
|