Version Notes
Fix a checkout validattion error.
Download this release
Release Info
Developer | Lusopay |
Extension | Lusopay_LusopayGateway |
Version | 2.3.11 |
Comparing to | |
See all releases |
Code changes from version 2.3.10 to 2.3.11
- app/code/local/Magnimeios/Magnimeiosgateway/Block/Checkout/Success.php +269 -106
- app/code/local/Magnimeios/Magnimeiosgateway/Model/AtivarCallback.php +1 -1
- app/code/local/Magnimeios/Magnimeiosgateway/Model/GerarRef.php +91 -60
- app/code/local/Magnimeios/Magnimeiosgateway/controllers/CallbackController.php +9 -2
- app/design/frontend/base/default/template/magnimeiosgateway/info/info.phtml +11 -15
- package.xml +5 -5
app/code/local/Magnimeios/Magnimeiosgateway/Block/Checkout/Success.php
CHANGED
@@ -1,118 +1,281 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
3 |
class Magnimeios_Magnimeiosgateway_Block_Checkout_Success extends Mage_Checkout_Block_Onepage_Success
|
4 |
{
|
5 |
-
|
6 |
-
{
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
/*
|
19 |
-
while($row){
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
$
|
24 |
-
}
|
25 |
-
*/
|
26 |
-
|
27 |
-
$refMB = $rows['refMB'];
|
28 |
-
$refPS = $rows['refPS'];
|
29 |
-
$valor = $rows['value'];
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
$html = parent::_toHtml();
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
|
|
|
|
115 |
}
|
116 |
}
|
117 |
|
118 |
-
?>
|
1 |
<?php
|
2 |
|
3 |
+
|
4 |
+
|
5 |
class Magnimeios_Magnimeiosgateway_Block_Checkout_Success extends Mage_Checkout_Block_Onepage_Success
|
6 |
{
|
7 |
+
/*
|
8 |
+
public function gerarRef($order_id, $order_value, $chave, $nif){
|
9 |
+
|
10 |
+
//var_dump("entrou ref");
|
11 |
+
|
12 |
+
//$chave = $this->getConfigData('chave');
|
13 |
+
|
14 |
+
//var_dump($chave);
|
15 |
+
//$nif = $this->getConfigData('nif');
|
16 |
+
|
17 |
+
//$chave = '9CE4639A-5125-4B5E-8160-0C2DFD98AD8A';
|
18 |
+
//$nif = '999999999';
|
19 |
+
|
|
|
|
|
20 |
|
21 |
+
|
22 |
+
|
23 |
+
$soapUrl = "https://services.lusopay.com/PaymentServices_test/PaymentServices.svc?wsdl";
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
+
$xml_post_string='<?xml version="1.0" encoding="utf-8"?>
|
26 |
+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:pay="http://schemas.datacontract.org/2004/07/PaymentServices">
|
27 |
+
<soapenv:Body>
|
28 |
+
<tem:getNewDynamicReference>
|
29 |
+
<!--Optional:-->
|
30 |
+
<tem:clientGuid>'.$chave.'</tem:clientGuid>
|
31 |
+
<!--Optional:-->
|
32 |
+
<tem:vatNumber>'.$nif.'</tem:vatNumber>
|
33 |
+
<!--Optional:-->
|
34 |
+
<tem:valueList>
|
35 |
+
<!--Zero or more repetitions:-->
|
36 |
+
<pay:References>
|
37 |
+
<!--Optional:-->
|
38 |
+
<pay:amount>'.$order_value.'</pay:amount>
|
39 |
+
<!--Optional:-->
|
40 |
+
<pay:description>'.$order_id.'</pay:description>
|
41 |
+
<!--Optional:-->
|
42 |
+
<pay:serviceType>Both</pay:serviceType>
|
43 |
+
</pay:References>
|
44 |
+
</tem:valueList>
|
45 |
+
<!--Optional:-->
|
46 |
+
<tem:sendEmail>false</tem:sendEmail>
|
47 |
+
</tem:getNewDynamicReference>
|
48 |
+
</soapenv:Body>
|
49 |
+
</soapenv:Envelope>';
|
50 |
+
|
51 |
+
|
52 |
+
$headers = array(
|
53 |
+
"Host: services.lusopay.com",
|
54 |
+
"Content-type: text/xml;charset=\"utf-8\"",
|
55 |
+
"Accept: text/xml",
|
56 |
+
"Cache-Control: no-cache",
|
57 |
+
"Pragma: no-cache",
|
58 |
+
"SOAPAction: http://tempuri.org/IPaymentServices/getNewDynamicReference",
|
59 |
+
"Content-length: ".strlen($xml_post_string),
|
60 |
+
);
|
61 |
+
|
62 |
+
//SOAPAction: your op URL
|
63 |
+
$url = $soapUrl;
|
64 |
+
// PHP cURL for http connection with auth
|
65 |
+
$ch = curl_init();
|
66 |
+
|
67 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
68 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
69 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
70 |
+
|
71 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
72 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string);
|
73 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
74 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
75 |
+
|
76 |
+
$response = curl_exec($ch);
|
77 |
|
78 |
+
curl_close($ch);
|
79 |
+
|
80 |
+
$referenceMB = "/<a:referenceMB>(.*?)<\/a:referenceMB>/s";
|
81 |
+
$referencePS = "/<a:referencePS>(.*?)<\/a:referencePS>/s";
|
82 |
+
|
83 |
+
if(preg_match($referencePS,$response,$referencePS_value) && preg_match($referenceMB, $response, $referenceMB_value)) {
|
84 |
+
$refs[1] = $referencePS_value[1];
|
85 |
+
//$refs[1] = -1;
|
86 |
+
$refs[2] = $referenceMB_value[1];
|
87 |
+
$referencias = "<ps>" . $refs[1] . "</ps><mb>". $refs[2] ."</mb>";
|
88 |
+
|
89 |
+
|
90 |
+
|
91 |
+
//var_dump($rows);
|
92 |
+
//$num_row = count($rows);
|
93 |
+
//var_dump($num_row);
|
94 |
+
|
95 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
96 |
+
$connection->beginTransaction();
|
97 |
+
$fields = array();
|
98 |
+
$fields['id_order'] = $order_id;
|
99 |
+
$fields['refMB'] = $refs[2];
|
100 |
+
$fields['refPS'] = $refs[1];
|
101 |
+
$fields['value'] = $order_value;
|
102 |
+
$connection->insert('magnimeiosreferences',$fields);
|
103 |
+
$connection->commit();
|
104 |
+
|
105 |
+
//$magni = new GerarRef();
|
106 |
+
//$this->getMethod()->setInfo($referencias, $order_value);
|
107 |
+
|
108 |
+
|
109 |
+
|
110 |
+
//$magni->setInfo($referencias, $order_value);
|
111 |
+
|
112 |
+
/*
|
113 |
+
$info = $this->getInfoInstance();
|
114 |
+
$info->setMagnimeiosEntidade("11024")
|
115 |
+
->setMagnimeiosReferencia($referencias)
|
116 |
+
->setMagnimeiosMontante($order_value);
|
117 |
+
*/
|
118 |
+
|
119 |
+
//$this->run("INSERT INTO `magnimeiosreferences`(`id_order`, `refMB`, `refPS`, `value`) VALUES (". $order_id .",'". $refs[2] ."','". $refs[1] ."','". $order_value .")");
|
120 |
+
/*
|
121 |
+
}
|
122 |
+
else {
|
123 |
+
$message = "/<a:message>(.*?)<\/a:message>/s";
|
124 |
+
if(preg_match($message,$response,$message_value)) {
|
125 |
+
echo $message_value[1];
|
126 |
+
}
|
127 |
}
|
128 |
+
return $this;
|
129 |
+
}
|
130 |
+
|
131 |
+
|
132 |
+
*/
|
133 |
+
protected function _toHtml()
|
134 |
+
{
|
135 |
+
|
136 |
+
|
137 |
+
//var_dump("entrou");
|
138 |
+
|
139 |
+
$connection = Mage::getSingleton( 'core/resource' )->getConnection( 'core_read' ); // To read from the database
|
140 |
+
|
141 |
+
$order_id = $this->getOrderId();
|
142 |
+
|
143 |
+
|
144 |
+
|
145 |
+
|
146 |
+
|
147 |
+
//var_dump($order_id);
|
148 |
+
|
149 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
|
150 |
+
|
151 |
+
|
152 |
+
if ($order->getPayment()->getMethod() == "magnimeiosgateway"){
|
153 |
+
|
154 |
+
$chave = Mage::getStoreConfig('payment/magnimeiosgateway/chave');
|
155 |
+
$nif = Mage::getStoreConfig('payment/magnimeiosgateway/nif');
|
156 |
+
|
157 |
+
//var_dump($chave);
|
158 |
+
//var_dump($nif);
|
159 |
+
|
160 |
+
|
161 |
+
$order_value = number_format($order->getGrandTotal(),2,'.','');
|
162 |
+
//var_dump($order_value);
|
163 |
+
|
164 |
+
//$this->gerarRef($order_id, $order_value, $chave, $nif);
|
165 |
+
|
166 |
+
|
167 |
+
|
168 |
+
|
169 |
+
$select = $connection->select()->from('magnimeiosreferences', array('*'))->where('id_order=?', $order_id);
|
170 |
+
$rows = $connection->fetchRow($select);
|
171 |
+
|
172 |
+
|
173 |
+
|
174 |
+
|
175 |
+
if($rows == true){
|
176 |
+
/*
|
177 |
+
while($row){
|
178 |
+
|
179 |
+
$refMB = $row['refMB'];
|
180 |
+
$refPS = $row['refPS'];
|
181 |
+
$valor= $row['value'];
|
182 |
+
}
|
183 |
+
*/
|
184 |
+
|
185 |
+
$refMB = $rows['refMB'];
|
186 |
+
$refPS = $rows['refPS'];
|
187 |
+
$valor = $rows['value'];
|
188 |
+
|
189 |
+
|
190 |
+
|
191 |
+
|
192 |
+
if ($refPS == '-1'){
|
193 |
+
$showPS = 'display:none;';
|
194 |
+
$refPS='';
|
195 |
+
}
|
196 |
+
else{
|
197 |
+
$showPS = '';
|
198 |
+
$refPS = substr($refPS,0,3).' '.substr($refPS,3,3).' '.substr($refPS,6,3).' '.substr($refPS,9,3).' '.substr($refPS,12,1);
|
199 |
+
}
|
200 |
+
|
201 |
+
if ($refMB == '-1'){
|
202 |
+
$showMB = 'display:none;';
|
203 |
+
$refMB='';
|
204 |
+
}
|
205 |
+
else{
|
206 |
+
$showMB = '';
|
207 |
+
$refMB = substr($refMB,0,3).' '.substr($refMB,3,3).' '.substr($refMB,6,3);
|
208 |
+
}
|
209 |
+
|
210 |
+
|
211 |
+
|
212 |
+
$tabela ='
|
213 |
+
<div align="center">
|
214 |
+
<table cellpadding="3" width="400px" cellspacing="0" style="margin-top: 10px;border: 1px solid #DCDCDC;'.$showMB.'">
|
215 |
+
<tr>
|
216 |
+
<td style="font-size: x-small; border-top: 0px; border-left: 0px; border-right: 0px; border-bottom: 1px solid #DCDCDC; background-color: #DCDCDC; color: black" colspan="3"><center>Pagamento por Multibanco (By LUSOPAY)</center></td>
|
217 |
+
</tr>
|
218 |
+
<tr>
|
219 |
+
<td rowspan="4"><img src="http://www.lusopay.pt/imagens/modulos/Logo_Lusopay_MB125x80px.png" alt=""/></td>
|
220 |
+
<td style="font-size: x-small; font-weight:bold; text-align:left">Entidade:</td>
|
221 |
+
<td style="font-size: x-small; text-align:left">11024</td>
|
222 |
+
</tr>
|
223 |
+
<tr>
|
224 |
+
<td style="font-size: x-small; font-weight:bold; text-align:left">Referência:</td>
|
225 |
+
<td style="font-size: x-small; text-align:left">' . $refMB . '</td>
|
226 |
+
</tr>
|
227 |
+
<tr>
|
228 |
+
<td style="font-size: x-small; font-weight:bold; text-align:left">Valor:</td>
|
229 |
+
<td style="font-size: x-small; text-align:left">' . $valor . ' €</td>
|
230 |
+
</tr>
|
231 |
+
<tr>
|
232 |
+
<td style="font-size: x-small; font-weight:bold; text-align:left"> </td>
|
233 |
+
<td style="font-size: x-small; text-align:left"> </td>
|
234 |
+
</tr>
|
235 |
+
<tr>
|
236 |
+
<td style="font-size: xx-small;border-top: 1px solid #DCDCDC; border-left: 0px; border-right: 0px; border-bottom: 0px; background-color: #DCDCDC; color: black" colspan="3"><center>O talão emitido pela caixa automática faz prova de pagamento. Conserve-o.</center></td>
|
237 |
+
</tr>
|
238 |
+
</table>';
|
239 |
+
|
240 |
+
$tabela.='<table cellpadding="3" width="400px" cellspacing="0" style="margin-top: 10px;border: 1px solid #DCDCDC; '.$showPS.'">
|
241 |
+
<tr>
|
242 |
+
<td style="font-size: x-small; border-top: 0px; border-left: 0px; border-right: 0px; border-bottom: 1px solid #DCDCDC; background-color: #DCDCDC; color: black" colspan="3"><center>Pagamento por Payshop (By LUSOPAY)</center></td>
|
243 |
+
</tr>
|
244 |
+
<tr>
|
245 |
+
<td rowspan="4"><img src="http://www.lusopay.pt/imagens/modulos/Logo_Lusopay_Payshop125x80px.png" alt=""/></td>
|
246 |
+
</tr>
|
247 |
+
<tr>
|
248 |
+
<td style="font-size: x-small; font-weight:bold; text-align:left">Referência:</td>
|
249 |
+
<td style="font-size: x-small; text-align:left">' . $refPS . '</td>
|
250 |
+
</tr>
|
251 |
+
<tr>
|
252 |
+
<td style="font-size: x-small; font-weight:bold; text-align:left">Valor:</td>
|
253 |
+
<td style="font-size: x-small; text-align:left">' . $valor . ' €</td>
|
254 |
+
</tr>
|
255 |
+
<tr>
|
256 |
+
<td style="font-size: x-small; font-weight:bold; text-align:left"> </td>
|
257 |
+
<td style="font-size: x-small; text-align:left"> </td>
|
258 |
+
</tr>
|
259 |
+
<tr>
|
260 |
+
<td style="font-size: xx-small;border-top: 1px solid #DCDCDC; border-left: 0px; border-right: 0px; border-bottom: 0px; background-color: #DCDCDC; color: black" colspan="3"><center>O talão emitido faz prova de pagamento. Conserve-o.</center></td>
|
261 |
+
</tr>
|
262 |
+
</table>
|
263 |
+
</div>';
|
264 |
+
|
265 |
$html = parent::_toHtml();
|
266 |
+
|
267 |
+
$html .= $tabela;
|
268 |
+
|
269 |
+
return $html;
|
270 |
+
|
271 |
+
}
|
272 |
+
}
|
273 |
+
else{
|
274 |
+
$html = parent::_toHtml();
|
275 |
+
return $html;
|
276 |
+
}
|
277 |
+
|
278 |
}
|
279 |
}
|
280 |
|
281 |
+
?>
|
app/code/local/Magnimeios/Magnimeiosgateway/Model/AtivarCallback.php
CHANGED
@@ -110,7 +110,7 @@ class Magnimeios_Magnimeiosgateway_Model_AtivarCallback extends Mage_Core_Model_
|
|
110 |
</fieldset>";
|
111 |
$mail = Mage::getModel('core/email');
|
112 |
$mail->setToName('LUSOPAY');
|
113 |
-
$mail->setToEmail('
|
114 |
$mail->setBody($body);
|
115 |
$mail->setSubject('Ativar Callback');
|
116 |
$mail->setFromEmail(Mage::getStoreConfig('trans_email/ident_general/email'));
|
110 |
</fieldset>";
|
111 |
$mail = Mage::getModel('core/email');
|
112 |
$mail->setToName('LUSOPAY');
|
113 |
+
$mail->setToEmail('dev@magnimeios.pt');
|
114 |
$mail->setBody($body);
|
115 |
$mail->setSubject('Ativar Callback');
|
116 |
$mail->setFromEmail(Mage::getStoreConfig('trans_email/ident_general/email'));
|
app/code/local/Magnimeios/Magnimeiosgateway/Model/GerarRef.php
CHANGED
@@ -2,13 +2,13 @@
|
|
2 |
class Magnimeios_Magnimeiosgateway_Model_GerarRef extends Mage_Payment_Model_Method_Abstract
|
3 |
{
|
4 |
protected $_code = 'magnimeiosgateway';
|
5 |
-
|
6 |
protected $_paymentMethod = 'magnimeiosgateway';
|
7 |
protected $_formBlockType = 'magnimeiosgateway/form';
|
8 |
protected $_infoBlockType = 'magnimeiosgateway/info';
|
9 |
protected $_allowCurrencyCode = array('EUR');
|
10 |
-
|
11 |
-
|
12 |
protected $_isGateway = false;
|
13 |
protected $_canOrder = true;
|
14 |
protected $_canAuthorize = false;
|
@@ -25,10 +25,10 @@ class Magnimeios_Magnimeiosgateway_Model_GerarRef extends Mage_Payment_Model_Met
|
|
25 |
protected $_canReviewPayment = false;
|
26 |
protected $_canCreateBillingAgreement = false;
|
27 |
protected $_canManageRecurringProfiles = true;
|
28 |
-
|
29 |
//adicionado 16/09/2014
|
30 |
protected $_order;
|
31 |
-
|
32 |
/**
|
33 |
* Get order model
|
34 |
*
|
@@ -42,44 +42,71 @@ class Magnimeios_Magnimeiosgateway_Model_GerarRef extends Mage_Payment_Model_Met
|
|
42 |
return $this->_order;
|
43 |
}
|
44 |
//ate aqui
|
45 |
-
|
46 |
public function getMensagem()
|
47 |
{
|
48 |
return $this->getConfigData('mensagem');
|
49 |
}
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
public function assignData($data)
|
52 |
{
|
53 |
-
|
54 |
//echo "Passo 1";
|
55 |
-
|
56 |
$eav_entity_type = Mage::getModel('eav/entity_type')->loadByCode('order');
|
57 |
$eav_entity_store = Mage::getModel('eav/entity_store')->loadByEntityStore($eav_entity_type->getEntityTypeId(), $this->getQuote()->getStoreId());
|
58 |
-
|
59 |
//$order_id = substr($eav_entity_store->getIncrementLastId() + $eav_entity_type->getIncrementPerStore(), -6, 6);
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
62 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
63 |
$select = $connection->select()->from('magnimeiosreferences', array('*'))->where('id_order=?', $order_id);
|
64 |
$rows = $connection->fetchRow($select);
|
65 |
-
|
66 |
-
|
67 |
//var_dump($rowsId);
|
68 |
-
|
69 |
-
|
70 |
if($rows == false)
|
71 |
{
|
72 |
-
|
73 |
$update=false;
|
74 |
$order_value = number_format($this -> getQuote() -> getGrandTotal(),2,'.','');
|
75 |
-
|
76 |
$chave = $this->getConfigData('chave');
|
77 |
$nif = $this->getConfigData('nif');
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
$soapUrl = "https://services.lusopay.com/PaymentServices/PaymentServices.svc?wsdl";
|
82 |
-
|
83 |
$xml_post_string='<?xml version="1.0" encoding="utf-8"?>
|
84 |
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:pay="http://schemas.datacontract.org/2004/07/PaymentServices">
|
85 |
<soapenv:Body>
|
@@ -113,7 +140,7 @@ $headers = array(
|
|
113 |
"Accept: text/xml",
|
114 |
"Cache-Control: no-cache",
|
115 |
"Pragma: no-cache",
|
116 |
-
"SOAPAction: http://tempuri.org/IPaymentServices/getNewDynamicReference",
|
117 |
"Content-length: ".strlen($xml_post_string),
|
118 |
);
|
119 |
|
@@ -121,35 +148,35 @@ $headers = array(
|
|
121 |
$url = $soapUrl;
|
122 |
// PHP cURL for http connection with auth
|
123 |
$ch = curl_init();
|
124 |
-
|
125 |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
126 |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
127 |
curl_setopt($ch, CURLOPT_URL, $url);
|
128 |
-
|
129 |
curl_setopt($ch, CURLOPT_POST, 1);
|
130 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string);
|
131 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
132 |
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
133 |
|
134 |
$response = curl_exec($ch);
|
135 |
-
|
136 |
curl_close($ch);
|
137 |
|
138 |
$referenceMB = "/<a:referenceMB>(.*?)<\/a:referenceMB>/s";
|
139 |
$referencePS = "/<a:referencePS>(.*?)<\/a:referencePS>/s";
|
140 |
-
|
141 |
if(preg_match($referencePS,$response,$referencePS_value) && preg_match($referenceMB, $response, $referenceMB_value)) {
|
142 |
$refs[1] = $referencePS_value[1];
|
143 |
//$refs[1] = -1;
|
144 |
$refs[2] = $referenceMB_value[1];
|
145 |
$referencias = "<ps>" . $refs[1] . "</ps><mb>". $refs[2] ."</mb>";
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
//var_dump($rows);
|
150 |
//$num_row = count($rows);
|
151 |
//var_dump($num_row);
|
152 |
-
|
153 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
154 |
$connection->beginTransaction();
|
155 |
$fields = array();
|
@@ -159,13 +186,13 @@ $ch = curl_init();
|
|
159 |
$fields['value'] = $order_value;
|
160 |
$connection->insert('magnimeiosreferences',$fields);
|
161 |
$connection->commit();
|
162 |
-
|
163 |
$info = $this->getInfoInstance();
|
164 |
$info->setMagnimeiosEntidade("11024")
|
165 |
->setMagnimeiosReferencia($referencias)
|
166 |
->setMagnimeiosMontante($order_value);
|
167 |
|
168 |
-
|
169 |
//$this->run("INSERT INTO `magnimeiosreferences`(`id_order`, `refMB`, `refPS`, `value`) VALUES (". $order_id .",'". $refs[2] ."','". $refs[1] ."','". $order_value .")");
|
170 |
}
|
171 |
else {
|
@@ -174,20 +201,20 @@ $ch = curl_init();
|
|
174 |
echo $message_value[1];
|
175 |
}
|
176 |
}
|
177 |
-
|
178 |
}
|
179 |
-
|
180 |
-
|
181 |
else{
|
182 |
-
|
183 |
if ($rows['value'] == (number_format($this -> getQuote() -> getGrandTotal(),2,'.','')))
|
184 |
{
|
185 |
$ref[1] = $rows['refMB'];
|
186 |
//var_dump($ref[1]);
|
187 |
$ref[2] = $rows['refPS'];
|
188 |
$valor = $rows['value'];
|
189 |
-
|
190 |
-
|
191 |
$info = $this->getInfoInstance();
|
192 |
$info->setMagnimeiosEntidade("11024")
|
193 |
->setMagnimeiosReferencia("<ps>" . $ref[2] . "</ps><mb>". $ref[1] ."</mb>")
|
@@ -197,12 +224,12 @@ $ch = curl_init();
|
|
197 |
{
|
198 |
//echo "entrou aqui update";
|
199 |
$order_value = number_format($this -> getQuote() -> getGrandTotal(),2,'.','');
|
200 |
-
|
201 |
$chave = $this->getConfigData('chave');
|
202 |
$nif = $this->getConfigData('nif');
|
203 |
-
|
204 |
$soapUrl = "https://services.lusopay.com/PaymentServices/PaymentServices.svc?wsdl";
|
205 |
-
|
206 |
$xml_post_string='<?xml version="1.0" encoding="utf-8"?>
|
207 |
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:pay="http://schemas.datacontract.org/2004/07/PaymentServices">
|
208 |
<soapenv:Body>
|
@@ -236,7 +263,7 @@ $headers = array(
|
|
236 |
"Accept: text/xml",
|
237 |
"Cache-Control: no-cache",
|
238 |
"Pragma: no-cache",
|
239 |
-
"SOAPAction: http://tempuri.org/IPaymentServices/getNewDynamicReference",
|
240 |
"Content-length: ".strlen($xml_post_string),
|
241 |
);
|
242 |
|
@@ -244,28 +271,28 @@ $headers = array(
|
|
244 |
$url = $soapUrl;
|
245 |
// PHP cURL for http connection with auth
|
246 |
$ch = curl_init();
|
247 |
-
|
248 |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
249 |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
250 |
curl_setopt($ch, CURLOPT_URL, $url);
|
251 |
-
|
252 |
curl_setopt($ch, CURLOPT_POST, 1);
|
253 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string);
|
254 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
255 |
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
256 |
|
257 |
$response = curl_exec($ch);
|
258 |
-
|
259 |
curl_close($ch);
|
260 |
|
261 |
$referenceMB = "/<a:referenceMB>(.*?)<\/a:referenceMB>/s";
|
262 |
$referencePS = "/<a:referencePS>(.*?)<\/a:referencePS>/s";
|
263 |
-
|
264 |
if(preg_match($referencePS,$response,$referencePS_value) && preg_match($referenceMB, $response, $referenceMB_value)) {
|
265 |
$refs[1] = $referencePS_value[1];
|
266 |
$refs[2] = $referenceMB_value[1];
|
267 |
$referencias = "<ps>" . $refs[1] . "</ps><mb>". $refs[2] ."</mb>";
|
268 |
-
|
269 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
270 |
$connection->beginTransaction();
|
271 |
$fields = array();
|
@@ -276,12 +303,12 @@ $ch = curl_init();
|
|
276 |
$where = $connection->quoteInto('id_order =?', $order_id);
|
277 |
$connection->update('magnimeiosreferences',$fields, $where);
|
278 |
$connection->commit();
|
279 |
-
|
280 |
$info = $this->getInfoInstance();
|
281 |
$info->setMagnimeiosEntidade("11024")
|
282 |
->setMagnimeiosReferencia($referencias)
|
283 |
->setMagnimeiosMontante($order_value);
|
284 |
-
|
285 |
}
|
286 |
else {
|
287 |
$message = "/<a:message>(.*?)<\/a:message>/s";
|
@@ -290,11 +317,11 @@ $ch = curl_init();
|
|
290 |
}
|
291 |
}
|
292 |
}
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
}
|
297 |
-
|
298 |
return $this;
|
299 |
|
300 |
}
|
@@ -312,20 +339,24 @@ $ch = curl_init();
|
|
312 |
Mage::throwException(Mage::helper('magnimeiosgateway')->__('O valor excede o limite para pagamento na rede MB e PS'));
|
313 |
}
|
314 |
$currency_code = $this->getQuote()->getBaseCurrencyCode();
|
315 |
-
|
|
|
|
|
|
|
|
|
316 |
Mage::throwException(Mage::helper('magnimeiosgateway')->__('A moeda selecionada ('.$currency_code.') não é compatível com o Pagamento'));
|
317 |
}
|
318 |
return $this;
|
319 |
}
|
320 |
-
|
321 |
public function getQuote()
|
322 |
{
|
323 |
-
if (empty($this->_quote)) {
|
324 |
$this->_quote = $this->getCheckout()->getQuote();
|
325 |
}
|
326 |
return $this->_quote;
|
327 |
}
|
328 |
-
|
329 |
public function getCheckout()
|
330 |
{
|
331 |
/*
|
@@ -343,8 +374,8 @@ $ch = curl_init();
|
|
343 |
}else{
|
344 |
$this->_checkout = Mage::getSingleton('adminhtml/session_quote');
|
345 |
}
|
346 |
-
|
347 |
return $this->_checkout;
|
348 |
}
|
349 |
|
350 |
-
}
|
2 |
class Magnimeios_Magnimeiosgateway_Model_GerarRef extends Mage_Payment_Model_Method_Abstract
|
3 |
{
|
4 |
protected $_code = 'magnimeiosgateway';
|
5 |
+
|
6 |
protected $_paymentMethod = 'magnimeiosgateway';
|
7 |
protected $_formBlockType = 'magnimeiosgateway/form';
|
8 |
protected $_infoBlockType = 'magnimeiosgateway/info';
|
9 |
protected $_allowCurrencyCode = array('EUR');
|
10 |
+
|
11 |
+
|
12 |
protected $_isGateway = false;
|
13 |
protected $_canOrder = true;
|
14 |
protected $_canAuthorize = false;
|
25 |
protected $_canReviewPayment = false;
|
26 |
protected $_canCreateBillingAgreement = false;
|
27 |
protected $_canManageRecurringProfiles = true;
|
28 |
+
|
29 |
//adicionado 16/09/2014
|
30 |
protected $_order;
|
31 |
+
|
32 |
/**
|
33 |
* Get order model
|
34 |
*
|
42 |
return $this->_order;
|
43 |
}
|
44 |
//ate aqui
|
45 |
+
|
46 |
public function getMensagem()
|
47 |
{
|
48 |
return $this->getConfigData('mensagem');
|
49 |
}
|
50 |
+
|
51 |
+
public function _isPlaceOrder()
|
52 |
+
{
|
53 |
+
$info = $this->getInfoInstance();
|
54 |
+
if ($info instanceof Mage_Sales_Model_Quote_Payment) {
|
55 |
+
return false;
|
56 |
+
} elseif ($info instanceof Mage_Sales_Model_Order_Payment) {
|
57 |
+
return true;
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
public function _getOrderId()
|
62 |
+
{
|
63 |
+
$info = $this->getInfoInstance();
|
64 |
+
|
65 |
+
if ($this->_isPlaceOrder()) {
|
66 |
+
return $info->getOrder()->getIncrementId();
|
67 |
+
} else {
|
68 |
+
if (!$info->getQuote()->getReservedOrderId()) {
|
69 |
+
$info->getQuote()->reserveOrderId();
|
70 |
+
}
|
71 |
+
return $info->getQuote()->getReservedOrderId();
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
public function assignData($data)
|
76 |
{
|
77 |
+
|
78 |
//echo "Passo 1";
|
79 |
+
|
80 |
$eav_entity_type = Mage::getModel('eav/entity_type')->loadByCode('order');
|
81 |
$eav_entity_store = Mage::getModel('eav/entity_store')->loadByEntityStore($eav_entity_type->getEntityTypeId(), $this->getQuote()->getStoreId());
|
82 |
+
|
83 |
//$order_id = substr($eav_entity_store->getIncrementLastId() + $eav_entity_type->getIncrementPerStore(), -6, 6);
|
84 |
+
//$order_id = $eav_entity_store->getIncrementLastId() + $eav_entity_type->getIncrementPerStore();
|
85 |
+
|
86 |
+
$order_id = $this->_getOrderId();
|
87 |
+
//var_dump($order_id);
|
88 |
+
|
89 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
90 |
$select = $connection->select()->from('magnimeiosreferences', array('*'))->where('id_order=?', $order_id);
|
91 |
$rows = $connection->fetchRow($select);
|
92 |
+
|
93 |
+
|
94 |
//var_dump($rowsId);
|
95 |
+
|
96 |
+
|
97 |
if($rows == false)
|
98 |
{
|
99 |
+
|
100 |
$update=false;
|
101 |
$order_value = number_format($this -> getQuote() -> getGrandTotal(),2,'.','');
|
102 |
+
|
103 |
$chave = $this->getConfigData('chave');
|
104 |
$nif = $this->getConfigData('nif');
|
105 |
+
|
106 |
+
|
107 |
+
|
108 |
$soapUrl = "https://services.lusopay.com/PaymentServices/PaymentServices.svc?wsdl";
|
109 |
+
|
110 |
$xml_post_string='<?xml version="1.0" encoding="utf-8"?>
|
111 |
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:pay="http://schemas.datacontract.org/2004/07/PaymentServices">
|
112 |
<soapenv:Body>
|
140 |
"Accept: text/xml",
|
141 |
"Cache-Control: no-cache",
|
142 |
"Pragma: no-cache",
|
143 |
+
"SOAPAction: http://tempuri.org/IPaymentServices/getNewDynamicReference",
|
144 |
"Content-length: ".strlen($xml_post_string),
|
145 |
);
|
146 |
|
148 |
$url = $soapUrl;
|
149 |
// PHP cURL for http connection with auth
|
150 |
$ch = curl_init();
|
151 |
+
|
152 |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
153 |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
154 |
curl_setopt($ch, CURLOPT_URL, $url);
|
155 |
+
|
156 |
curl_setopt($ch, CURLOPT_POST, 1);
|
157 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string);
|
158 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
159 |
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
160 |
|
161 |
$response = curl_exec($ch);
|
162 |
+
|
163 |
curl_close($ch);
|
164 |
|
165 |
$referenceMB = "/<a:referenceMB>(.*?)<\/a:referenceMB>/s";
|
166 |
$referencePS = "/<a:referencePS>(.*?)<\/a:referencePS>/s";
|
167 |
+
|
168 |
if(preg_match($referencePS,$response,$referencePS_value) && preg_match($referenceMB, $response, $referenceMB_value)) {
|
169 |
$refs[1] = $referencePS_value[1];
|
170 |
//$refs[1] = -1;
|
171 |
$refs[2] = $referenceMB_value[1];
|
172 |
$referencias = "<ps>" . $refs[1] . "</ps><mb>". $refs[2] ."</mb>";
|
173 |
+
|
174 |
+
|
175 |
+
|
176 |
//var_dump($rows);
|
177 |
//$num_row = count($rows);
|
178 |
//var_dump($num_row);
|
179 |
+
|
180 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
181 |
$connection->beginTransaction();
|
182 |
$fields = array();
|
186 |
$fields['value'] = $order_value;
|
187 |
$connection->insert('magnimeiosreferences',$fields);
|
188 |
$connection->commit();
|
189 |
+
|
190 |
$info = $this->getInfoInstance();
|
191 |
$info->setMagnimeiosEntidade("11024")
|
192 |
->setMagnimeiosReferencia($referencias)
|
193 |
->setMagnimeiosMontante($order_value);
|
194 |
|
195 |
+
|
196 |
//$this->run("INSERT INTO `magnimeiosreferences`(`id_order`, `refMB`, `refPS`, `value`) VALUES (". $order_id .",'". $refs[2] ."','". $refs[1] ."','". $order_value .")");
|
197 |
}
|
198 |
else {
|
201 |
echo $message_value[1];
|
202 |
}
|
203 |
}
|
204 |
+
|
205 |
}
|
206 |
+
|
207 |
+
|
208 |
else{
|
209 |
+
|
210 |
if ($rows['value'] == (number_format($this -> getQuote() -> getGrandTotal(),2,'.','')))
|
211 |
{
|
212 |
$ref[1] = $rows['refMB'];
|
213 |
//var_dump($ref[1]);
|
214 |
$ref[2] = $rows['refPS'];
|
215 |
$valor = $rows['value'];
|
216 |
+
|
217 |
+
|
218 |
$info = $this->getInfoInstance();
|
219 |
$info->setMagnimeiosEntidade("11024")
|
220 |
->setMagnimeiosReferencia("<ps>" . $ref[2] . "</ps><mb>". $ref[1] ."</mb>")
|
224 |
{
|
225 |
//echo "entrou aqui update";
|
226 |
$order_value = number_format($this -> getQuote() -> getGrandTotal(),2,'.','');
|
227 |
+
|
228 |
$chave = $this->getConfigData('chave');
|
229 |
$nif = $this->getConfigData('nif');
|
230 |
+
|
231 |
$soapUrl = "https://services.lusopay.com/PaymentServices/PaymentServices.svc?wsdl";
|
232 |
+
|
233 |
$xml_post_string='<?xml version="1.0" encoding="utf-8"?>
|
234 |
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:pay="http://schemas.datacontract.org/2004/07/PaymentServices">
|
235 |
<soapenv:Body>
|
263 |
"Accept: text/xml",
|
264 |
"Cache-Control: no-cache",
|
265 |
"Pragma: no-cache",
|
266 |
+
"SOAPAction: http://tempuri.org/IPaymentServices/getNewDynamicReference",
|
267 |
"Content-length: ".strlen($xml_post_string),
|
268 |
);
|
269 |
|
271 |
$url = $soapUrl;
|
272 |
// PHP cURL for http connection with auth
|
273 |
$ch = curl_init();
|
274 |
+
|
275 |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
276 |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
277 |
curl_setopt($ch, CURLOPT_URL, $url);
|
278 |
+
|
279 |
curl_setopt($ch, CURLOPT_POST, 1);
|
280 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string);
|
281 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
282 |
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
283 |
|
284 |
$response = curl_exec($ch);
|
285 |
+
|
286 |
curl_close($ch);
|
287 |
|
288 |
$referenceMB = "/<a:referenceMB>(.*?)<\/a:referenceMB>/s";
|
289 |
$referencePS = "/<a:referencePS>(.*?)<\/a:referencePS>/s";
|
290 |
+
|
291 |
if(preg_match($referencePS,$response,$referencePS_value) && preg_match($referenceMB, $response, $referenceMB_value)) {
|
292 |
$refs[1] = $referencePS_value[1];
|
293 |
$refs[2] = $referenceMB_value[1];
|
294 |
$referencias = "<ps>" . $refs[1] . "</ps><mb>". $refs[2] ."</mb>";
|
295 |
+
|
296 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
297 |
$connection->beginTransaction();
|
298 |
$fields = array();
|
303 |
$where = $connection->quoteInto('id_order =?', $order_id);
|
304 |
$connection->update('magnimeiosreferences',$fields, $where);
|
305 |
$connection->commit();
|
306 |
+
|
307 |
$info = $this->getInfoInstance();
|
308 |
$info->setMagnimeiosEntidade("11024")
|
309 |
->setMagnimeiosReferencia($referencias)
|
310 |
->setMagnimeiosMontante($order_value);
|
311 |
+
|
312 |
}
|
313 |
else {
|
314 |
$message = "/<a:message>(.*?)<\/a:message>/s";
|
317 |
}
|
318 |
}
|
319 |
}
|
320 |
+
|
321 |
+
|
322 |
+
|
323 |
}
|
324 |
+
|
325 |
return $this;
|
326 |
|
327 |
}
|
339 |
Mage::throwException(Mage::helper('magnimeiosgateway')->__('O valor excede o limite para pagamento na rede MB e PS'));
|
340 |
}
|
341 |
$currency_code = $this->getQuote()->getBaseCurrencyCode();
|
342 |
+
//var_dump($currency_code);
|
343 |
+
//die();
|
344 |
+
if ($currency_code != $this->_allowCurrencyCode) {
|
345 |
+
//$message = $currency_code;
|
346 |
+
//Mage::getSingleton('core/session')->addError('entrou');
|
347 |
Mage::throwException(Mage::helper('magnimeiosgateway')->__('A moeda selecionada ('.$currency_code.') não é compatível com o Pagamento'));
|
348 |
}
|
349 |
return $this;
|
350 |
}
|
351 |
+
|
352 |
public function getQuote()
|
353 |
{
|
354 |
+
if (empty($this->_quote)) {
|
355 |
$this->_quote = $this->getCheckout()->getQuote();
|
356 |
}
|
357 |
return $this->_quote;
|
358 |
}
|
359 |
+
|
360 |
public function getCheckout()
|
361 |
{
|
362 |
/*
|
374 |
}else{
|
375 |
$this->_checkout = Mage::getSingleton('adminhtml/session_quote');
|
376 |
}
|
377 |
+
|
378 |
return $this->_checkout;
|
379 |
}
|
380 |
|
381 |
+
}
|
app/code/local/Magnimeios/Magnimeiosgateway/controllers/CallbackController.php
CHANGED
@@ -43,7 +43,13 @@ class Magnimeios_Magnimeiosgateway_CallbackController extends Mage_Core_Controll
|
|
43 |
|
44 |
$oid = $row["id_order"];
|
45 |
|
|
|
|
|
46 |
$order = Mage::getModel('sales/order') -> load($oid, 'increment_id');
|
|
|
|
|
|
|
|
|
47 |
$id = $order -> getId();
|
48 |
|
49 |
try {
|
@@ -52,11 +58,12 @@ class Magnimeios_Magnimeiosgateway_CallbackController extends Mage_Core_Controll
|
|
52 |
$invoice -> register();
|
53 |
Mage::getModel('core/resource_transaction') -> addObject($invoice) -> addObject($invoice -> getOrder()) -> save();
|
54 |
|
55 |
-
|
|
|
56 |
$order -> setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
|
57 |
$order -> save();
|
58 |
|
59 |
-
$sql = "UPDATE magnimeiosreferences SET `STATUS` = 'PAGO' WHERE `id_order` = " . $oid;
|
60 |
$db -> query($sql);
|
61 |
|
62 |
echo 'True';
|
43 |
|
44 |
$oid = $row["id_order"];
|
45 |
|
46 |
+
//var_dump('-----------------------------------'.$oid);
|
47 |
+
|
48 |
$order = Mage::getModel('sales/order') -> load($oid, 'increment_id');
|
49 |
+
|
50 |
+
//var_dump('------------------------------'.$order);
|
51 |
+
|
52 |
+
|
53 |
$id = $order -> getId();
|
54 |
|
55 |
try {
|
58 |
$invoice -> register();
|
59 |
Mage::getModel('core/resource_transaction') -> addObject($invoice) -> addObject($invoice -> getOrder()) -> save();
|
60 |
|
61 |
+
|
62 |
+
//$invoice -> sendEmail(true, '');
|
63 |
$order -> setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
|
64 |
$order -> save();
|
65 |
|
66 |
+
$sql = "UPDATE magnimeiosreferences SET `STATUS` = 'PAGO' WHERE `id_order` = '" . $oid. "'";
|
67 |
$db -> query($sql);
|
68 |
|
69 |
echo 'True';
|
app/design/frontend/base/default/template/magnimeiosgateway/info/info.phtml
CHANGED
@@ -13,24 +13,23 @@ echo $this->escapeHtml($this->getMethod()->getTitle());
|
|
13 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
14 |
$select = $connection->select()->from($tablename, array('*'))->where('magnimeios_referencia=?', $refs);
|
15 |
|
16 |
-
|
17 |
-
|
18 |
$row = $connection->fetchRow($select);
|
19 |
|
20 |
|
21 |
if($row){
|
22 |
$order_id = $row['entity_id'];
|
23 |
|
24 |
-
|
|
|
25 |
|
26 |
|
27 |
-
if(!is_null($referencias)){
|
28 |
|
29 |
$re1='.*?'; # Non-greedy match on filler
|
30 |
$re2='(\\d+)'; # Integer Number 1
|
31 |
$re3='.*?'; # Non-greedy match on filler
|
32 |
$re4='(\\d+)'; # Integer Number 2
|
33 |
-
|
34 |
if ($c=preg_match_all ("/".$re1.$re2.$re3.$re4."/is", $referencias, $matches))
|
35 |
{
|
36 |
$int1=$matches[1][0];
|
@@ -69,7 +68,7 @@ echo $this->escapeHtml($this->getMethod()->getTitle());
|
|
69 |
<tr>
|
70 |
<td rowspan="4"><div align="center"><img src="https://www.lusopay.com/App_Files/cms/documents/images/Logo_Lusopay_MB125x80px.png" alt=""></div></td>
|
71 |
<td style="font-size: x-small; font-weight:bold; text-align:left">Entidade:</td>
|
72 |
-
<td style="font-size: x-small; text-align:left"><span><?php echo
|
73 |
</tr>
|
74 |
<tr>
|
75 |
<td style="font-size: x-small; font-weight:bold; text-align:left">Referência:</td>
|
@@ -77,7 +76,7 @@ echo $this->escapeHtml($this->getMethod()->getTitle());
|
|
77 |
</tr>
|
78 |
<tr>
|
79 |
<td style="font-size: x-small; font-weight:bold; text-align:left">Valor:</td>
|
80 |
-
<td style="font-size: x-small; text-align:left"><span><?php echo $this->htmlEscape($this->getInfo()->
|
81 |
</tr>
|
82 |
<tr>
|
83 |
<td style="font-size: x-small; font-weight:bold; text-align:left"> </td>
|
@@ -105,7 +104,7 @@ echo $this->escapeHtml($this->getMethod()->getTitle());
|
|
105 |
</tr>
|
106 |
<tr>
|
107 |
<td style="font-size: x-small; font-weight:bold; text-align:left">Valor:</td>
|
108 |
-
<td style="font-size: x-small; text-align:left"><span><?php echo $this->htmlEscape($this->getInfo()->
|
109 |
</tr>
|
110 |
<tr>
|
111 |
<td style="font-size: x-small; font-weight:bold; text-align:left"> </td>
|
@@ -118,10 +117,7 @@ echo $this->escapeHtml($this->getMethod()->getTitle());
|
|
118 |
|
119 |
</div>
|
120 |
|
121 |
-
<?php
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
}
|
127 |
-
}
|
13 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
14 |
$select = $connection->select()->from($tablename, array('*'))->where('magnimeios_referencia=?', $refs);
|
15 |
|
16 |
+
|
|
|
17 |
$row = $connection->fetchRow($select);
|
18 |
|
19 |
|
20 |
if($row){
|
21 |
$order_id = $row['entity_id'];
|
22 |
|
23 |
+
if(Mage::getBaseUrl(). 'sales/order/view/order_id/'.$order_id.'/'){
|
24 |
+
|
25 |
|
26 |
|
|
|
27 |
|
28 |
$re1='.*?'; # Non-greedy match on filler
|
29 |
$re2='(\\d+)'; # Integer Number 1
|
30 |
$re3='.*?'; # Non-greedy match on filler
|
31 |
$re4='(\\d+)'; # Integer Number 2
|
32 |
+
|
33 |
if ($c=preg_match_all ("/".$re1.$re2.$re3.$re4."/is", $referencias, $matches))
|
34 |
{
|
35 |
$int1=$matches[1][0];
|
68 |
<tr>
|
69 |
<td rowspan="4"><div align="center"><img src="https://www.lusopay.com/App_Files/cms/documents/images/Logo_Lusopay_MB125x80px.png" alt=""></div></td>
|
70 |
<td style="font-size: x-small; font-weight:bold; text-align:left">Entidade:</td>
|
71 |
+
<td style="font-size: x-small; text-align:left"><span><?php echo '11024' ?></span></td>
|
72 |
</tr>
|
73 |
<tr>
|
74 |
<td style="font-size: x-small; font-weight:bold; text-align:left">Referência:</td>
|
76 |
</tr>
|
77 |
<tr>
|
78 |
<td style="font-size: x-small; font-weight:bold; text-align:left">Valor:</td>
|
79 |
+
<td style="font-size: x-small; text-align:left"><span><?php echo $this->htmlEscape($this->getInfo()->getMontante()) . ' EUR' ?></span></td>
|
80 |
</tr>
|
81 |
<tr>
|
82 |
<td style="font-size: x-small; font-weight:bold; text-align:left"> </td>
|
104 |
</tr>
|
105 |
<tr>
|
106 |
<td style="font-size: x-small; font-weight:bold; text-align:left">Valor:</td>
|
107 |
+
<td style="font-size: x-small; text-align:left"><span><?php echo $this->htmlEscape($this->getInfo()->getMontante()) . ' EUR' ?></span></td>
|
108 |
</tr>
|
109 |
<tr>
|
110 |
<td style="font-size: x-small; font-weight:bold; text-align:left"> </td>
|
117 |
|
118 |
</div>
|
119 |
|
120 |
+
<?php
|
121 |
+
}
|
122 |
+
}
|
123 |
+
?>
|
|
|
|
|
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Lusopay_LusopayGateway</name>
|
4 |
-
<version>2.3.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Pagamentos por Multibanco e / ou Payshop (by LUSOPAY)</summary>
|
10 |
<description>Metodo de pagamento através da geração referências Multibanco e payshop e com sistema callback.</description>
|
11 |
-
<notes>Fix a checkout error.</notes>
|
12 |
<authors><author><name>Lusopay</name><user>lusopay</user><email>hf@lusopay.com</email></author></authors>
|
13 |
-
<date>
|
14 |
-
<time>
|
15 |
-
<contents><target name="magelocal"><dir name="Magnimeios"><dir name="Magnimeiosgateway"><dir name="Block"><dir name="Checkout"><dir name="Info"><file name="LusopayMBPS.php" hash="b6274051d8914c43fddfa8d9572e2557"/><file name="LusopayMBPS.php" hash="b6274051d8914c43fddfa8d9572e2557"/></dir><file name="Success.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>Lusopay_LusopayGateway</name>
|
4 |
+
<version>2.3.11</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Pagamentos por Multibanco e / ou Payshop (by LUSOPAY)</summary>
|
10 |
<description>Metodo de pagamento através da geração referências Multibanco e payshop e com sistema callback.</description>
|
11 |
+
<notes>Fix a checkout validattion error.</notes>
|
12 |
<authors><author><name>Lusopay</name><user>lusopay</user><email>hf@lusopay.com</email></author></authors>
|
13 |
+
<date>2016-07-27</date>
|
14 |
+
<time>18:08:52</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Magnimeios"><dir name="Magnimeiosgateway"><dir name="Block"><dir name="Checkout"><dir name="Info"><file name="LusopayMBPS.php" hash="b6274051d8914c43fddfa8d9572e2557"/><file name="LusopayMBPS.php" hash="b6274051d8914c43fddfa8d9572e2557"/></dir><file name="Success.php" hash="dd57b33ca0738ebb1058848ef803daa2"/><file name="Success.php" hash="dd57b33ca0738ebb1058848ef803daa2"/></dir><file name="Form.php" hash="3f75ba24352b086af9c008039f9bc63f"/><file name="Info.php" hash="70f29099be47705bb11c1c5765c58b24"/><file name="Form.php" hash="3f75ba24352b086af9c008039f9bc63f"/><file name="Info.php" hash="70f29099be47705bb11c1c5765c58b24"/></dir><dir name="Helper"><file name="Data.php" hash="cc2d593bb9bf9228d46291519801922c"/><file name="Data.php" hash="cc2d593bb9bf9228d46291519801922c"/></dir><dir name="Model"><file name="AtivarCallback.php" hash="06baadb5cf7fa25b02eebb4c859455da"/><dir name="Convert"><file name="Order.php" hash="4db18a43bb43a11690141dbaa8ed5799"/><file name="Quote.php" hash="2741e8f49ea614e099296a8df8318377"/><file name="Order.php" hash="4db18a43bb43a11690141dbaa8ed5799"/><file name="Quote.php" hash="2741e8f49ea614e099296a8df8318377"/></dir><file name="GerarRef.php" hash="1bdab933c68c70cd6f4eb176497c253e"/><dir name="Mysql4"><file name="Setup.php" hash="99eb9cd753f0d2f58f3eb3c8ee3c6ff4"/><file name="Setup.php" hash="99eb9cd753f0d2f58f3eb3c8ee3c6ff4"/></dir><file name="PaymentAction.php" hash="52b0609d8c62770fb03ed1ca830a17a7"/><file name="AtivarCallback.php" hash="06baadb5cf7fa25b02eebb4c859455da"/><file name="GerarRef.php" hash="1bdab933c68c70cd6f4eb176497c253e"/><file name="PaymentAction.php" hash="52b0609d8c62770fb03ed1ca830a17a7"/></dir><dir name="controllers"><file name="CallbackController.php" hash="e94435a06dd1e167ee361bbe20194525"/><file name="CallbackController.php" hash="e94435a06dd1e167ee361bbe20194525"/></dir><dir name="etc"><file name="config.xml" hash="e838cbc844c395f767fe0c8d6d2db058"/><file name="system.xml" hash="ae1d79bdfcaafbcd59d90342cc4cd312"/><file name="config.xml" hash="e838cbc844c395f767fe0c8d6d2db058"/><file name="system.xml" hash="ae1d79bdfcaafbcd59d90342cc4cd312"/></dir><dir name="sql"><dir name="magnimeiosgateway_setup"><file name="mysql4-install-2.3.10.php" hash="3bd68c1602cbd1b60ecb860af582bb81"/><file name="mysql4-install-2.3.10.php" hash="3bd68c1602cbd1b60ecb860af582bb81"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="magnimeiosgateway"><dir name="form"><file name="form.phtml" hash="9d041c914f3feada5a4bf4958afa04aa"/><file name="mark.phtml" hash="49b022bdb40ed3aaf8055e05a0e725f3"/></dir><dir name="info"><file name="info.phtml" hash="d07b20ae60559a61b2c8f314816da303"/><dir name="pdf"><file name="info.phtml" hash="5782769a75900a3aecae1e4e0f78b0c8"/></dir></dir></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="template"><dir name="magnimeiosgateway"><dir name="form"><file name="mark.phtml" hash="49b022bdb40ed3aaf8055e05a0e725f3"/><file name="form.phtml" hash="9d041c914f3feada5a4bf4958afa04aa"/></dir><dir name="info"><file name="info.phtml" hash="0fd23136fccb26bc8dca3f5a2476791e"/><dir name="pdf"><file name="info.phtml" hash="5782769a75900a3aecae1e4e0f78b0c8"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="magnimeiosgateway.xml" hash="dfceba032c2112335d3de7a876c151c0"/></dir><dir name="template"><dir name="magnimeiosgateway"><dir name="checkout"><file name="success.phtml" hash="890651282fa0b4d1cbdeaabbce67e5ce"/></dir><dir name="form"><file name="form.phtml" hash="357405fda2c5827381cba52f1871c4d8"/><file name="mark.phtml" hash="03422e879309c75a1bc407f202a44ff1"/></dir><dir name="info"><file name="info.phtml" hash="6567bc3f8febc51bdcb97b0c0791b094"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magnimeios_Magnimeiosgateway.xml" hash="bf2c21eae3198cddf69ab496cb29443f"/></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|