Lusopay_LusopayGateway - Version 1.0.0

Version Notes

Versão para magento 1.9

Download this release

Release Info

Developer Lusopay
Extension Lusopay_LusopayGateway
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (24) hide show
  1. app/code/local/Magnimeios/Magnimeiosgateway/Block/Form.php +15 -0
  2. app/code/local/Magnimeios/Magnimeiosgateway/Block/Info.php +29 -0
  3. app/code/local/Magnimeios/Magnimeiosgateway/Helper/Data.php +4 -0
  4. app/code/local/Magnimeios/Magnimeiosgateway/Model/Convert/Order.php +21 -0
  5. app/code/local/Magnimeios/Magnimeiosgateway/Model/Convert/Quote.php +24 -0
  6. app/code/local/Magnimeios/Magnimeiosgateway/Model/GerarRef.php +321 -0
  7. app/code/local/Magnimeios/Magnimeiosgateway/Model/Mysql4/Setup.php +6 -0
  8. app/code/local/Magnimeios/Magnimeiosgateway/Model/PaymentAction.php +44 -0
  9. app/code/local/Magnimeios/Magnimeiosgateway/etc/config.xml +126 -0
  10. app/code/local/Magnimeios/Magnimeiosgateway/etc/system.xml +104 -0
  11. app/code/local/Magnimeios/Magnimeiosgateway/sql/magnimeiosgateway_setup/mysql4-install-2.0.0.php +25 -0
  12. app/design/adminhtml/default/default/template/magnimeiosgateway/form/form.phtml +8 -0
  13. app/design/adminhtml/default/default/template/magnimeiosgateway/form/mark.phtml +3 -0
  14. app/design/adminhtml/default/default/template/magnimeiosgateway/info/info.phtml +106 -0
  15. app/design/adminhtml/default/default/template/magnimeiosgateway/info/pdf/info.phtml +98 -0
  16. app/design/frontend/base/default/template/magnimeiosgateway/form/form.phtml +8 -0
  17. app/design/frontend/base/default/template/magnimeiosgateway/form/mark.phtml +3 -0
  18. app/design/frontend/base/default/template/magnimeiosgateway/info/info.phtml +88 -0
  19. app/etc/modules/Magnimeios_Magnimeiosgateway.xml +12 -0
  20. package.xml +18 -0
  21. skin/adminhtml/default/default/images/magnimeiosgateway/Logo_Lusopay_256x85px.png +0 -0
  22. skin/adminhtml/default/default/images/magnimeiosgateway/logo.png +0 -0
  23. skin/frontend/base/default/images/magnimeiosgateway/Logo_Lusopay_MBePayshop125x80px.png +0 -0
  24. skin/frontend/base/default/images/magnimeiosgateway/logo.png +0 -0
app/code/local/Magnimeios/Magnimeiosgateway/Block/Form.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magnimeios_Magnimeiosgateway_Block_Form extends Mage_Payment_Block_Form
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $mark = Mage::getConfig()->getBlockClassName('core/template');
7
+ $mark = new $mark;
8
+ $mark->setTemplate('magnimeiosgateway/form/mark.phtml');
9
+
10
+ $this->setTemplate('magnimeiosgateway/form/form.phtml')
11
+ ->setMethodLabelAfterHtml($mark->toHtml())
12
+ ;
13
+ parent::_construct();
14
+ }
15
+ }
app/code/local/Magnimeios/Magnimeiosgateway/Block/Info.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magnimeios_Magnimeiosgateway_Block_Info extends Mage_Payment_Block_Info
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->setTemplate('magnimeiosgateway/info/info.phtml');
8
+ }
9
+
10
+ public function getInfo()
11
+ {
12
+ $info = $this->getData('info');
13
+ if (!($info instanceof Mage_Payment_Model_Info)) {
14
+ Mage::throwException($this->__('Can not retrieve payment info model object.'));
15
+ }
16
+ return $info;
17
+ }
18
+
19
+ public function getMethod()
20
+ {
21
+ return $this->getInfo()->getMethodInstance();
22
+ }
23
+
24
+ public function toPdf()
25
+ {
26
+ $this->setTemplate('magnimeiosgateway/info/pdf/info.phtml');
27
+ return $this->toHtml();
28
+ }
29
+ }
app/code/local/Magnimeios/Magnimeiosgateway/Helper/Data.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ class Magnimeios_Magnimeiosgateway_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ }
app/code/local/Magnimeios/Magnimeiosgateway/Model/Convert/Order.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magnimeios_Magnimeiosgateway_Model_Convert_Order extends Mage_Sales_Model_Convert_Order
3
+ {
4
+ /**
5
+ * Convert order payment to quote payment
6
+ *
7
+ * @param Mage_Sales_Model_Order_Payment $payment
8
+ * @return Mage_Sales_Model_Quote_Payment
9
+ */
10
+ public function paymentToQuotePayment(Mage_Sales_Model_Order_Payment $payment, $quotePayment=null)
11
+ {
12
+ $quotePayment = parent::paymentToQuotePayment($payment, $quotePayment);
13
+
14
+ $quotePayment->setMagnimeiosEntidade($payment->getMagnimeiosEntidade())
15
+ ->setMagnimeiosReferencia($payment->getMagnimeiosReferencia())
16
+ ->setMagnimeiosMontante($payment->getMagnimeiosMontante());
17
+
18
+
19
+ return $quotePayment;
20
+ }
21
+ }
app/code/local/Magnimeios/Magnimeiosgateway/Model/Convert/Quote.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magnimeios_Magnimeiosgateway_Model_Convert_Quote extends Mage_Sales_Model_Convert_Quote
3
+ {
4
+
5
+ /**
6
+ * Convert quote payment to order payment
7
+ *
8
+ * @param Mage_Sales_Model_Quote_Payment $payment
9
+ * @return Mage_Sales_Model_Quote_Payment
10
+ */
11
+ public function paymentToOrderPayment(Mage_Sales_Model_Quote_Payment $payment)
12
+ {
13
+
14
+ $orderPayment = parent::paymentToOrderPayment($payment);
15
+ //$orderPayment->setMagnimeiosEntidade($payment->getMagnimeiosEntidade())
16
+ // ->setMagnimeiosReferencia($payment->getMagnimeiosReferencia())
17
+ // ->setMagnimeiosMontante($payment->getMagnimeiosMontante());
18
+
19
+
20
+
21
+ return $orderPayment;
22
+ }
23
+
24
+ }
app/code/local/Magnimeios/Magnimeiosgateway/Model/GerarRef.php ADDED
@@ -0,0 +1,321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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;
15
+ protected $_canCapture = false;
16
+ protected $_canCapturePartial = false;
17
+ protected $_canRefund = false;
18
+ protected $_canRefundInvoicePartial = false;
19
+ protected $_canVoid = false;
20
+ protected $_canUseInternal = true;
21
+ protected $_canUseCheckout = true;
22
+ protected $_canUseForMultishipping = true;
23
+ protected $_isInitializeNeeded = false;
24
+ protected $_canFetchTransactionInfo = 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
+ *
35
+ * @return Mage_Sales_Model_Order
36
+ */
37
+ public function getOrder()
38
+ {
39
+ if (!$this->_order) {
40
+ $this->_order = $this->getCheckout()->getOrder();
41
+ }
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
+ $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
62
+ $select = $connection->select()->from('magnimeiosreferences', array('*'))->where('id_order=?', $order_id);
63
+ $rows = $connection->fetchRow($select);
64
+
65
+
66
+ //var_dump($rowsId);
67
+
68
+
69
+ if($rows == false)
70
+ {
71
+
72
+ $update=false;
73
+ $order_value = number_format($this -> getQuote() -> getGrandTotal(),2,'.','');
74
+
75
+ $chave = $this->getConfigData('chave');
76
+ $nif = $this->getConfigData('nif');
77
+ //var_dump($chave);
78
+ //echo $nif;
79
+ //Data, connection, auth
80
+ //webservice de teste
81
+ //$soapUrl = "http://development.magnimeios.pt/MagnimeiosWS.asmx?op=GetNewDynamicRef"; // asmx URL of WSDL
82
+ $soapUrl = "http://webservice.magnimeios.pt/MagnimeiosWS.asmx?op=GetNewDynamicRef"; // asmx URL of WSDL
83
+
84
+ // xml post structure
85
+ $xml_post_string = '<?xml version="1.0" encoding="utf-8"?>
86
+ <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
87
+ <soap12:Body>
88
+ <GetNewDynamicRef xmlns="http://tempuri.org/">
89
+ <clientGuid>'.$chave.'</clientGuid>
90
+ <nif>'.$nif.'</nif>
91
+ <valueList>
92
+ <Value>
93
+ <amount>'.$order_value.'</amount>
94
+ <description>'.$order_id.'</description>
95
+ <serviceType>Both</serviceType>
96
+ </Value>
97
+ </valueList>
98
+ <sendEmail>true</sendEmail>
99
+ </GetNewDynamicRef>
100
+ </soap12:Body>
101
+ </soap12:Envelope>';
102
+
103
+ $headers = array(
104
+ "Host: webservice.magnimeios.pt",
105
+ "Content-type: text/xml;charset=\"utf-8\"",
106
+ "Accept: text/xml",
107
+ "Cache-Control: no-cache",
108
+ "Pragma: no-cache",
109
+ "SOAPAction: http://tempuri.org/GetNewDynamicRef",
110
+ "Content-length: ".strlen($xml_post_string),
111
+ ); //SOAPAction: your op URL
112
+
113
+ $url = $soapUrl;
114
+
115
+
116
+ // PHP cURL for https connection with auth
117
+ $ch = curl_init();
118
+ curl_setopt($ch, CURLOPT_URL, $url);
119
+ curl_setopt($ch, CURLOPT_TIMEOUT, 60);
120
+ curl_setopt($ch, CURLOPT_POST, true);
121
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string); // the SOAP request
122
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
123
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
124
+
125
+ // converting
126
+ $response = curl_exec($ch);
127
+ curl_close($ch);
128
+
129
+ $referenceMB = "/<referenceMB>(.*?)<\/referenceMB>/s";
130
+ $referencePS = "/<referencePS>(.*?)<\/referencePS>/s";
131
+ if(preg_match($referencePS,$response,$referencePS_value) && preg_match($referenceMB, $response, $referenceMB_value)) {
132
+ $refs[1] = $referencePS_value[1];
133
+ //$refs[1] = -1;
134
+ $refs[2] = $referenceMB_value[1];
135
+ $referencias = "<ps>" . $refs[1] . "</ps><mb>". $refs[2] ."</mb>";
136
+
137
+
138
+
139
+ //var_dump($rows);
140
+ //$num_row = count($rows);
141
+ //var_dump($num_row);
142
+
143
+ $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
144
+ $connection->beginTransaction();
145
+ $fields = array();
146
+ $fields['id_order'] = $order_id;
147
+ $fields['refMB'] = $refs[2];
148
+ $fields['refPS'] = $refs[1];
149
+ $fields['value'] = $order_value;
150
+ $connection->insert('magnimeiosreferences',$fields);
151
+ $connection->commit();
152
+
153
+ $info = $this->getInfoInstance();
154
+ $info->setMagnimeiosEntidade("11024")
155
+ ->setMagnimeiosReferencia($referencias)
156
+ ->setMagnimeiosMontante($order_value);
157
+
158
+
159
+ //$this->run("INSERT INTO `magnimeiosreferences`(`id_order`, `refMB`, `refPS`, `value`) VALUES (". $order_id .",'". $refs[2] ."','". $refs[1] ."','". $order_value .")");
160
+ }
161
+ else {
162
+ $referencias = "Error";
163
+ }
164
+
165
+ }
166
+
167
+
168
+ else{
169
+
170
+ if ($rows['value'] == (number_format($this -> getQuote() -> getGrandTotal(),2,'.','')))
171
+ {
172
+ $ref[1] = $rows['refMB'];
173
+ //var_dump($ref[1]);
174
+ $ref[2] = $rows['refPS'];
175
+ $valor = $rows['value'];
176
+
177
+
178
+ $info = $this->getInfoInstance();
179
+ $info->setMagnimeiosEntidade("11024")
180
+ ->setMagnimeiosReferencia("<ps>" . $ref[2] . "</ps><mb>". $ref[1] ."</mb>")
181
+ ->setMagnimeiosMontante($valor);
182
+ }
183
+ else
184
+ {
185
+ echo "entrou aqui update";
186
+ $order_value = number_format($this -> getQuote() -> getGrandTotal(),2,'.','');
187
+
188
+ $chave = $this->getConfigData('chave');
189
+ $nif = $this->getConfigData('nif');
190
+
191
+
192
+ //$soapUrl = "http://development.magnimeios.pt/MagnimeiosWS.asmx?op=GetNewDynamicRef"; // asmx URL of WSDL
193
+ $soapUrl = "http://webservice.magnimeios.pt/MagnimeiosWS.asmx?op=GetNewDynamicRef"; // asmx URL of WSDL
194
+
195
+ // xml post structure
196
+ $xml_post_string = '<?xml version="1.0" encoding="utf-8"?>
197
+ <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
198
+ <soap12:Body>
199
+ <GetNewDynamicRef xmlns="http://tempuri.org/">
200
+ <clientGuid>'.$chave.'</clientGuid>
201
+ <nif>'.$nif.'</nif>
202
+ <valueList>
203
+ <Value>
204
+ <amount>'.$order_value.'</amount>
205
+ <description>'.$order_id.'</description>
206
+ <serviceType>Both</serviceType>
207
+ </Value>
208
+ </valueList>
209
+ <sendEmail>true</sendEmail>
210
+ </GetNewDynamicRef>
211
+ </soap12:Body>
212
+ </soap12:Envelope>';
213
+
214
+ $headers = array(
215
+ "Host: webservice.magnimeios.pt",
216
+ "Content-type: text/xml;charset=\"utf-8\"",
217
+ "Accept: text/xml",
218
+ "Cache-Control: no-cache",
219
+ "Pragma: no-cache",
220
+ "SOAPAction: http://tempuri.org/GetNewDynamicRef",
221
+ "Content-length: ".strlen($xml_post_string),
222
+ ); //SOAPAction: your op URL
223
+
224
+ $url = $soapUrl;
225
+
226
+
227
+ // PHP cURL for https connection with auth
228
+ $ch = curl_init();
229
+ curl_setopt($ch, CURLOPT_URL, $url);
230
+ curl_setopt($ch, CURLOPT_TIMEOUT, 60);
231
+ curl_setopt($ch, CURLOPT_POST, true);
232
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string); // the SOAP request
233
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
234
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
235
+
236
+ // converting
237
+ $response = curl_exec($ch);
238
+ curl_close($ch);
239
+
240
+ $referenceMB = "/<referenceMB>(.*?)<\/referenceMB>/s";
241
+ $referencePS = "/<referencePS>(.*?)<\/referencePS>/s";
242
+ if(preg_match($referencePS,$response,$referencePS_value) && preg_match($referenceMB, $response, $referenceMB_value)) {
243
+ $refs[1] = $referencePS_value[1];
244
+ $refs[2] = $referenceMB_value[1];
245
+ $referencias = "<ps>" . $refs[1] . "</ps><mb>". $refs[2] ."</mb>";
246
+
247
+ $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
248
+ $connection->beginTransaction();
249
+ $fields = array();
250
+ //$fields['id_order'] = $order_id;
251
+ $fields['refMB'] = $refs[2];
252
+ $fields['refPS'] = $refs[1];
253
+ $fields['value'] = $order_value;
254
+ $where = $connection->quoteInto('id_order =?', $order_id);
255
+ $connection->update('magnimeiosreferences',$fields, $where);
256
+ $connection->commit();
257
+
258
+ $info = $this->getInfoInstance();
259
+ $info->setMagnimeiosEntidade("11024")
260
+ ->setMagnimeiosReferencia($referencias)
261
+ ->setMagnimeiosMontante($order_value);
262
+
263
+ }
264
+ else {
265
+ $referencias = "Error";
266
+ }
267
+ }
268
+
269
+
270
+
271
+ }
272
+
273
+ return $this;
274
+
275
+ }
276
+
277
+ public function validate()
278
+ {
279
+ parent::validate();
280
+ $order_value = number_format($this->getQuote()->getGrandTotal(),2,'.','');
281
+
282
+ if ($order_value < 2) {
283
+ Mage::throwException(Mage::helper('magnimeiosgateway')->__('Impossível gerar referência MB ou Payshop para valores inferiores a 2 Euro.'));
284
+ }
285
+
286
+ if ($order_value >= 999999.99) {
287
+ Mage::throwException(Mage::helper('magnimeiosgateway')->__('O valor excede o limite para pagamento na rede MB e PS'));
288
+ }
289
+ $currency_code = $this->getQuote()->getBaseCurrencyCode();
290
+ if (!in_array($currency_code,$this->_allowCurrencyCode)) {
291
+ Mage::throwException(Mage::helper('magnimeiosgateway')->__('A moeda selecionada ('.$currency_code.') não é compatível com o Pagamento'));
292
+ }
293
+ return $this;
294
+ }
295
+
296
+ public function getQuote()
297
+ {
298
+ if (empty($this->_quote)) {
299
+ $this->_quote = $this->getCheckout()->getQuote();
300
+ }
301
+ return $this->_quote;
302
+ }
303
+
304
+ public function getCheckout()
305
+ {
306
+ if(Mage::getSingleton('customer/session')->isLoggedIn())
307
+ {
308
+ //echo "entrou aqui";
309
+ $this->_checkout = Mage::getSingleton('checkout/session');
310
+ }else{
311
+ $this->_checkout = Mage::getSingleton('adminhtml/session_quote');
312
+ }
313
+ /* Codigo antigo
314
+ if (empty($this->_checkout)) {
315
+ $this->_checkout = Mage::getSingleton('checkout/session');
316
+ }
317
+ */
318
+ return $this->_checkout;
319
+ }
320
+
321
+ }
app/code/local/Magnimeios/Magnimeiosgateway/Model/Mysql4/Setup.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ class Magnimeios_Magnimeiosgateway_Model_Mysql4_Setup extends Mage_Sales_Model_Mysql4_Setup
3
+ {
4
+
5
+
6
+ }
app/code/local/Magnimeios/Magnimeiosgateway/Model/PaymentAction.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
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 Mage
22
+ * @package Mage_Paygate
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ *
29
+ * Authorizenet Payment Action Dropdown source
30
+ *
31
+ * @author Magento Core Team <core@magentocommerce.com>
32
+ */
33
+ class Magnimeios_Magnimeiosgateway_Model_PaymentAction
34
+ {
35
+ public function toOptionArray()
36
+ {
37
+ return array(
38
+ array(
39
+ 'value' => Mage_Payment_Model_Method_Abstract::ACTION_ORDER,
40
+ 'label' => Mage::helper('magnimeiosgateway')->__('Order')
41
+ ),
42
+ );
43
+ }
44
+ }
app/code/local/Magnimeios/Magnimeiosgateway/etc/config.xml ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magnimeios_Magnimeiosgateway>
5
+ <version>2.0.0</version>
6
+ </Magnimeios_Magnimeiosgateway>
7
+ </modules>
8
+ <frontend>
9
+ <translate>
10
+ <modules>
11
+ <Magnimeios_Magnimeiosgateway>
12
+ <files>
13
+ <default>Magnimeios_Magnimeiosgateway.csv</default>
14
+ </files>
15
+ </Magnimeios_Magnimeiosgateway>
16
+ </modules>
17
+ </translate>
18
+ </frontend>
19
+ <adminhtml>
20
+ <translate>
21
+ <modules>
22
+ <Magnimeios_Magnimeiosgateway>
23
+ <files>
24
+ <default>Magnimeios_Magnimeiosgateway.csv</default>
25
+ </files>
26
+ </Magnimeios_Magnimeiosgateway>
27
+ </modules>
28
+ </translate>
29
+ </adminhtml>
30
+ <global>
31
+ <fieldsets>
32
+ <sales_convert_quote_payment>
33
+ <magnimeios_entidade><to_order_payment>*</to_order_payment></magnimeios_entidade>
34
+ <magnimeios_referencia><to_order_payment>*</to_order_payment></magnimeios_referencia>
35
+ <magnimeios_montante><to_order_payment>*</to_order_payment></magnimeios_montante>
36
+ </sales_convert_quote_payment>
37
+
38
+ <sales_convert_order_payment>
39
+ <magnimeios_entidade><to_quote_payment>*</to_quote_payment></magnimeios_entidade>
40
+ <magnimeios_referencia><to_quote_payment>*</to_quote_payment></magnimeios_referencia>
41
+ <magnimeios_montante><to_quote_payment>*</to_quote_payment></magnimeios_montante>
42
+ </sales_convert_order_payment>
43
+ </fieldsets>
44
+ <models>
45
+ <magnimeiosgateway>
46
+ <class>Magnimeios_Magnimeiosgateway_Model</class>
47
+ <resourceModel>magnimeiosgateway_mysql4</resourceModel>
48
+ </magnimeiosgateway>
49
+ <sales>
50
+ <rewrite>
51
+ <convert_order>Magnimeios_Magnimeiosgateway_Model_Convert_Order</convert_order>
52
+ <convert_quote>Magnimeios_Magnimeiosgateway_Model_Convert_Quote</convert_quote>
53
+ </rewrite>
54
+ </sales>
55
+ <magnimeiosgateway_mysql4>
56
+ <class>Magnimeios_Magnimeiosgateway_Model_Mysql4</class>
57
+ <entities>
58
+ <magnimeiosgateway>
59
+ <table>magnimeiosreferences</table>
60
+ </magnimeiosgateway>
61
+ </entities>
62
+ </magnimeiosgateway_mysql4>
63
+ </models>
64
+ <resources>
65
+ <magnimeiosgateway_setup>
66
+ <setup>
67
+ <module>Magnimeios_Magnimeiosgateway</module>
68
+ <class>Magnimeios_Magnimeiosgateway_Model_Mysql4_Setup</class>
69
+ </setup>
70
+ <connection>
71
+ <use>core_setup</use>
72
+ </connection>
73
+ </magnimeiosgateway_setup>
74
+ <magnimeiosgateway_write>
75
+ <connection>
76
+ <use>core_write</use>
77
+ </connection>
78
+ </magnimeiosgateway_write>
79
+ <magnimeiosgateway_read>
80
+ <connection>
81
+ <use>core_read</use>
82
+ </connection>
83
+ </magnimeiosgateway_read>
84
+ </resources>
85
+ <blocks>
86
+ <magnimeiosgateway>
87
+ <class>Magnimeios_Magnimeiosgateway_Block</class>
88
+ </magnimeiosgateway>
89
+ </blocks>
90
+ <helpers>
91
+ <magnimeiosgateway>
92
+ <class>Magnimeios_Magnimeiosgateway_Helper</class>
93
+ </magnimeiosgateway>
94
+ </helpers>
95
+ <sales>
96
+ <order>
97
+ <statuses>
98
+ <aguarda_pagamento_magnimeiosgateway translate="label"><label><![CDATA[MB - Aguarda Pagamento]]></label></aguarda_pagamento_magnimeiosgateway>
99
+ </statuses>
100
+ <states>
101
+ <new>
102
+ <statuses>
103
+ <aguarda_pagamento_magnimeiosgateway/>
104
+ </statuses>
105
+ </new>
106
+ </states>
107
+ </order>
108
+ </sales>
109
+ </global>
110
+ <default>
111
+ <payment>
112
+ <magnimeiosgateway>
113
+ <active>0</active>
114
+ <model>magnimeiosgateway/gerarRef</model>
115
+ <title>Pagamento por Multibanco e / ou Payshop (by LUSOPAY)</title>
116
+ <sort_order>1</sort_order>
117
+ <allowspecific>0</allowspecific>
118
+ <chave></chave>
119
+ <nif></nif>
120
+ <order_status>pending</order_status>
121
+ <mensagem>Pagamento por Multibanco e / ou Payshop</mensagem>
122
+ <payment_action>order</payment_action>
123
+ </magnimeiosgateway>
124
+ </payment>
125
+ </default>
126
+ </config>
app/code/local/Magnimeios/Magnimeiosgateway/etc/system.xml ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <magnimeiosgateway translate="label" module="payment">
7
+ <label><![CDATA[Pagamentos por Multibanco e / ou Payshop (by LUSOPAY)]]></label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>1</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <fields>
14
+ <active translate="label">
15
+ <label>Ativo</label>
16
+ <frontend_type>select</frontend_type>
17
+ <source_model>adminhtml/system_config_source_yesno</source_model>
18
+ <sort_order>5</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>1</show_in_store>
22
+ </active>
23
+ <order_status translate="label">
24
+ <label>Estado da Encomenda</label>
25
+ <frontend_type>select</frontend_type>
26
+ <source_model>adminhtml/system_config_source_order_status_new</source_model>
27
+ <sort_order>10</sort_order>
28
+ <show_in_default>1</show_in_default>
29
+ <show_in_website>1</show_in_website>
30
+ <show_in_store>1</show_in_store>
31
+ </order_status>
32
+ <sort_order translate="label">
33
+ <label><![CDATA[Ordem de apresenta&ccedil;&atilde;o]]></label>
34
+ <frontend_type>text</frontend_type>
35
+ <sort_order>15</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
+ </sort_order>
40
+ <title translate="label">
41
+ <label><![CDATA[T&iacute;tulo a apresentar no Website]]></label>
42
+ <frontend_type>text</frontend_type>
43
+ <sort_order>20</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>1</show_in_store>
47
+ </title>
48
+ <chave translate="label">
49
+ <label>Chave</label>
50
+ <frontend_type>text</frontend_type>
51
+ <sort_order>25</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>1</show_in_store>
55
+ </chave>
56
+ <nif translate="label">
57
+ <label>NIF</label>
58
+ <frontend_type>text</frontend_type>
59
+ <sort_order>30</sort_order>
60
+ <show_in_default>1</show_in_default>
61
+ <show_in_website>1</show_in_website>
62
+ <show_in_store>1</show_in_store>
63
+ </nif>
64
+ <mensagem translate="label">
65
+ <label><![CDATA[Instru&ccedil;&otilde;es]]></label>
66
+ <frontend_type>text</frontend_type>
67
+ <sort_order>35</sort_order>
68
+ <show_in_default>1</show_in_default>
69
+ <show_in_website>1</show_in_website>
70
+ <show_in_store>1</show_in_store>
71
+ </mensagem>
72
+ <allowspecific translate="label">
73
+ <label><![CDATA[Pagamento para os Pa&iacute;ses]]></label>
74
+ <frontend_type>allowspecific</frontend_type>
75
+ <sort_order>40</sort_order>
76
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
77
+ <show_in_default>1</show_in_default>
78
+ <show_in_website>1</show_in_website>
79
+ <show_in_store>1</show_in_store>
80
+ </allowspecific>
81
+ <specificcountry translate="label">
82
+ <label><![CDATA[Pagamento para Pa&iacute;ses Espec&iacute;ficos]]></label>
83
+ <frontend_type>multiselect</frontend_type>
84
+ <sort_order>45</sort_order>
85
+ <source_model>adminhtml/system_config_source_country</source_model>
86
+ <show_in_default>1</show_in_default>
87
+ <show_in_website>1</show_in_website>
88
+ <show_in_store>1</show_in_store>
89
+ </specificcountry>
90
+ <payment_action translate="label">
91
+ <label>Payment Action</label>
92
+ <frontend_type>select</frontend_type>
93
+ <source_model>magnimeiosgateway/paymentAction</source_model>
94
+ <sort_order>20</sort_order>
95
+ <show_in_default>0</show_in_default>
96
+ <show_in_website>0</show_in_website>
97
+ <show_in_store>0</show_in_store>
98
+ </payment_action>
99
+ </fields>
100
+ </magnimeiosgateway>
101
+ </groups>
102
+ </payment>
103
+ </sections>
104
+ </config>
app/code/local/Magnimeios/Magnimeiosgateway/sql/magnimeiosgateway_setup/mysql4-install-2.0.0.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $installer->startSetup();
5
+
6
+ $installer->run("CREATE TABLE IF NOT EXISTS `magnimeiosreferences` (id_order int, refMB VARCHAR(9), refPS VARCHAR(13), value VARCHAR(10))");
7
+
8
+
9
+ $installer->addAttribute('order_payment', 'magnimeios_entidade', array('type'=>'varchar'));
10
+ $installer->addAttribute('order_payment', 'magnimeios_referencia', array('type'=>'varchar'));
11
+ $installer->addAttribute('order_payment', 'magnimeios_montante', array('type'=>'varchar'));
12
+
13
+ $installer->addAttribute('quote_payment', 'magnimeios_entidade', array('type'=>'varchar'));
14
+ $installer->addAttribute('quote_payment', 'magnimeios_referencia', array('type'=>'varchar'));
15
+ $installer->addAttribute('quote_payment', 'magnimeios_montante', array('type'=>'varchar'));
16
+
17
+ $installer->endSetup();
18
+
19
+ if (Mage::getVersion() >= 1.1) {
20
+ $installer->startSetup();
21
+ $installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'), 'magnimeios_entidade', 'VARCHAR(255) NOT NULL');
22
+ $installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'), 'magnimeios_referencia', 'VARCHAR(255) NOT NULL');
23
+ $installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'), 'magnimeios_montante', 'VARCHAR(255) NOT NULL');
24
+ $installer->endSetup();
25
+ }
app/design/adminhtml/default/default/template/magnimeiosgateway/form/form.phtml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <fieldset class="form-list">
2
+ <ul id="payment_form_<?php echo $this->getMethodCode(); ?>" style="display:none">
3
+ <li><img src="<?php echo $this->getSkinUrl('images/magnimeiosgateway/Logo_Lusopay_256x85px.png') ?>" border="0" /></li>
4
+ <?php if ($this->getMethod()->getMensagem()): ?>
5
+ <?php echo '<li>' . $this->getMethod()->getMensagem() . '</li>'; ?>
6
+ <?php endif; ?>
7
+ </ul>
8
+ </fieldset>
app/design/adminhtml/default/default/template/magnimeiosgateway/form/mark.phtml ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <!-- Magnimeios Logo -->
2
+ <img src="<?php echo $this->getSkinUrl('images/magnimeiosgateway/logo.png') ?>" class="v-middle" />
3
+ <!-- Magnimeios Logo -->
app/design/adminhtml/default/default/template/magnimeiosgateway/info/info.phtml ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <?php
3
+ //Get Referencias
4
+ $referencias = $this->htmlEscape($this->getInfo()->getMagnimeiosReferencia());
5
+
6
+ if(!is_null($referencias)){
7
+
8
+ $re1='.*?'; # Non-greedy match on filler
9
+ $re2='(\\d+)'; # Integer Number 1
10
+ $re3='.*?'; # Non-greedy match on filler
11
+ $re4='(\\d+)'; # Integer Number 2
12
+
13
+ if ($c=preg_match_all ("/".$re1.$re2.$re3.$re4."/is", $referencias, $matches))
14
+ {
15
+ $int1=$matches[1][0];
16
+ $int2=$matches[2][0];
17
+ }
18
+
19
+ if ($int1 == '1'){
20
+ $showPS = 'display:none;';
21
+ $int1='';
22
+ }
23
+ else{
24
+ $showPS = '';
25
+ $int1 = substr($int1,0,3).' '.substr($int1,3,3).' '.substr($int1,6,3).' '.substr($int1,9,3).' '.substr($int1,12,1);
26
+ }
27
+
28
+ if ($int2 == '1'){
29
+ $showMB = 'display:none;';
30
+ $int2='';
31
+ }
32
+ else{
33
+ $showMB = '';
34
+ $int2 = substr($int2,0,3).' '.substr($int2,3,3).' '.substr($int2,6,3);
35
+ }
36
+
37
+
38
+ ?>
39
+
40
+
41
+
42
+ <div align="center">
43
+ <table cellpadding="3" width="400px" cellspacing="0" style="margin-top: 10px;border: 1px solid #DCDCDC;<?php echo $showMB;?>">
44
+ <tbody><tr>
45
+ <td style="font-size: x-small; border-bottom: 1px solid #DCDCDC; background-color: #DCDCDC; color: Black" colspan="3"><center>Pagamento por Multibanco (By LUSOPAY)</center></td>
46
+ </tr>
47
+ <tr>
48
+ <td rowspan="4"><div align="center"><img src="http://www.lusopay.com/modulos/imagens/Logo_Lusopay_MB125x80px.png" alt=""></div></td>
49
+ <td style="font-size: x-small; font-weight:bold; text-align:left">Entidade:</td>
50
+ <td style="font-size: x-small; text-align:left"><span><?php echo $this->htmlEscape($this->getInfo()->getMagnimeiosEntidade()) ?></span></td>
51
+ </tr>
52
+ <tr>
53
+ <td style="font-size: x-small; font-weight:bold; text-align:left">Referência:</td>
54
+ <td style="font-size: x-small; text-align:left"><span><?php echo $int2 ?></span></td>
55
+ </tr>
56
+ <tr>
57
+ <td style="font-size: x-small; font-weight:bold; text-align:left">Valor:</td>
58
+ <td style="font-size: x-small; text-align:left"><span><?php echo $this->htmlEscape($this->getInfo()->getMagnimeiosMontante()) . ' EUR' ?></span></td>
59
+ </tr>
60
+ <tr>
61
+ <td style="font-size: x-small; font-weight:bold; text-align:left">&nbsp;</td>
62
+ <td style="font-size: x-small; text-align:left">&nbsp;</td>
63
+ </tr>
64
+ <tr>
65
+ <td style="font-size: xx-small;border-top: 1px solid #DCDCDC; background-color: #DCDCDC; color: Black" colspan="3"><center>O tal&atilde;o emitido pela caixa autom&aacute;tica faz prova de pagamento. Conserve-o.</center></td>
66
+ </tr>
67
+ </tbody></table>
68
+
69
+
70
+
71
+
72
+ <table cellpadding="3" width="400px" cellspacing="0" style="margin-top: 10px;border: 1px solid #DCDCDC;<?php echo $showPS;?>">
73
+ <tbody>
74
+ <tr>
75
+ <td style="font-size: x-small; border-bottom: 1px solid #DCDCDC; background-color: #DCDCDC; color: Black" colspan="3"><center>Pagamento por Payshop (By LUSOPAY)</center></td>
76
+ </tr>
77
+ <tr>
78
+ <td rowspan="4"><div align="center"><img src="http://www.lusopay.com/modulos/imagens/Logo_Lusopay_Payshop125x80px.png" alt=""></div></td>
79
+ </tr>
80
+ <tr>
81
+ <td style="font-size: x-small; font-weight:bold; text-align:left">Referência:</td>
82
+ <td style="font-size: x-small; text-align:left"><span><?php echo $int1 ?></span></td>
83
+ </tr>
84
+ <tr>
85
+ <td style="font-size: x-small; font-weight:bold; text-align:left">Valor:</td>
86
+ <td style="font-size: x-small; text-align:left"><span><?php echo $this->htmlEscape($this->getInfo()->getMagnimeiosMontante()) . ' EUR' ?></span></td>
87
+ </tr>
88
+ <tr>
89
+ <td style="font-size: x-small; font-weight:bold; text-align:left">&nbsp;</td>
90
+ <td style="font-size: x-small; text-align:left">&nbsp;</td>
91
+ </tr>
92
+ <tr>
93
+ <td style="font-size: xx-small;border-top: 1px solid #DCDCDC; background-color: #DCDCDC; color: Black" colspan="3"><center>O tal&atilde;o emitido faz prova de pagamento. Conserve-o.</center></td>
94
+ </tr>
95
+ </tbody></table>
96
+
97
+ </div>
98
+
99
+ <?php }
100
+ else{
101
+ echo "A geração da referencia falhou";
102
+ }
103
+
104
+
105
+
106
+
app/design/adminhtml/default/default/template/magnimeiosgateway/info/pdf/info.phtml ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <?php
3
+ $referencias = $this->htmlEscape($this->getInfo()->getMagnimeiosReferencia());
4
+
5
+ if(!is_null($referencias)){
6
+ $re1='.*?'; # Non-greedy match on filler
7
+ $re2='(\\d+)'; # Integer Number 1
8
+ $re3='.*?'; # Non-greedy match on filler
9
+ $re4='(\\d+)'; # Integer Number 2
10
+
11
+ if ($c=preg_match_all ("/".$re1.$re2.$re3.$re4."/is", $referencias, $matches))
12
+ {
13
+ $int1=$matches[1][0];
14
+ $int2=$matches[2][0];
15
+ }
16
+
17
+ if ($int1 == '1'){
18
+ $showPS = 'display:none;';
19
+ $int1='';
20
+ }
21
+ else{
22
+ $showPS = '';
23
+ $int1 = substr($int1,0,3).' '.substr($int1,3,3).' '.substr($int1,6,3).' '.substr($int1,9,3).' '.substr($int1,12,1);
24
+ }
25
+
26
+ if ($int2 == '1'){
27
+ $showMB = 'display:none;';
28
+ $int2='';
29
+ }
30
+ else{
31
+ $showMB = '';
32
+ $int2 = substr($int2,0,3).' '.substr($int2,3,3).' '.substr($int2,6,3);
33
+ }
34
+
35
+
36
+ ?>
37
+
38
+ <div align="center">
39
+ <table cellpadding="3" width="400px" cellspacing="0" style="margin-top: 10px;border: 1px solid #DCDCDC;<?php echo $showMB;?>">
40
+ <tbody><tr>
41
+ <td style="font-size: x-small; border-bottom: 1px solid #DCDCDC; background-color: #DCDCDC; color: Black" colspan="3"><center>Pagamento por Multibanco (By LUSOPAY)</center></td>
42
+ </tr>
43
+ <tr>
44
+ <td rowspan="4"><div align="center"><img src="http://www.lusopay.com/modulos/imagens/Logo_Lusopay_MB125x80px.png" alt=""></div></td>
45
+ <td style="font-size: x-small; font-weight:bold; text-align:left">Entidade:</td>
46
+ <td style="font-size: x-small; text-align:left"><span><?php echo $this->htmlEscape($this->getInfo()->getMagnimeiosEntidade()) ?></span></td>
47
+ </tr>
48
+ <tr>
49
+ <td style="font-size: x-small; font-weight:bold; text-align:left">Referência:</td>
50
+ <td style="font-size: x-small; text-align:left"><span><?php echo $int2 ?></span></td>
51
+ </tr>
52
+ <tr>
53
+ <td style="font-size: x-small; font-weight:bold; text-align:left">Valor:</td>
54
+ <td style="font-size: x-small; text-align:left"><span><?php echo $this->htmlEscape($this->getInfo()->getMagnimeiosMontante()) . ' EUR' ?></span></td>
55
+ </tr>
56
+ <tr>
57
+ <td style="font-size: x-small; font-weight:bold; text-align:left">&nbsp;</td>
58
+ <td style="font-size: x-small; text-align:left">&nbsp;</td>
59
+ </tr>
60
+ <tr>
61
+ <td style="font-size: xx-small;border-top: 1px solid #DCDCDC; background-color: #DCDCDC; color: Black" colspan="3"><center>O tal&atilde;o emitido pela caixa autom&aacute;tica faz prova de pagamento. Conserve-o.</center></td>
62
+ </tr>
63
+ </tbody></table>
64
+
65
+
66
+
67
+
68
+ <table cellpadding="3" width="400px" cellspacing="0" style="margin-top: 10px;border: 1px solid #DCDCDC;<?php echo $showPS;?>">
69
+ <tbody>
70
+ <tr>
71
+ <td style="font-size: x-small; border-bottom: 1px solid #DCDCDC; background-color: #DCDCDC; color: Black" colspan="3"><center>Pagamento por Payshop (By LUSOPAY)</center></td>
72
+ </tr>
73
+ <tr>
74
+ <td rowspan="4"><div align="center"><img src="http://www.lusopay.com/modulos/imagens/Logo_Lusopay_Payshop125x80px.png" alt=""></div></td>
75
+ </tr>
76
+ <tr>
77
+ <td style="font-size: x-small; font-weight:bold; text-align:left">Referência:</td>
78
+ <td style="font-size: x-small; text-align:left"><span><?php echo $int1 ?></span></td>
79
+ </tr>
80
+ <tr>
81
+ <td style="font-size: x-small; font-weight:bold; text-align:left">Valor:</td>
82
+ <td style="font-size: x-small; text-align:left"><span><?php echo $this->htmlEscape($this->getInfo()->getMagnimeiosMontante()) . ' EUR' ?></span></td>
83
+ </tr>
84
+ <tr>
85
+ <td style="font-size: x-small; font-weight:bold; text-align:left">&nbsp;</td>
86
+ <td style="font-size: x-small; text-align:left">&nbsp;</td>
87
+ </tr>
88
+ <tr>
89
+ <td style="font-size: xx-small;border-top: 1px solid #DCDCDC; background-color: #DCDCDC; color: Black" colspan="3"><center>O tal&atilde;o emitido faz prova de pagamento. Conserve-o.</center></td>
90
+ </tr>
91
+ </tbody></table>
92
+
93
+ </div>
94
+
95
+ <?php }
96
+ else{
97
+ echo "A geração da referencia falhou";
98
+ }
app/design/frontend/base/default/template/magnimeiosgateway/form/form.phtml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <fieldset class="form-list">
2
+ <ul id="payment_form_<?php echo $this->getMethodCode(); ?>" style="display:none">
3
+ <li><img src="<?php echo $this->getSkinUrl('images/magnimeiosgateway/Logo_Lusopay_MBePayshop125x80px.png') ?>" border="0" /></li>
4
+ <?php if ($this->getMethod()->getMensagem()): ?>
5
+ <?php echo '<li>' . $this->getMethod()->getMensagem() . '</li>'; ?>
6
+ <?php endif; ?>
7
+ </ul>
8
+ </fieldset>
app/design/frontend/base/default/template/magnimeiosgateway/form/mark.phtml ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <!-- Magnimeios Logo -->
2
+ <img src="<?php echo $this->getSkinUrl('images/magnimeiosgateway/logo.png') ?>" class="v-middle" />
3
+ <!-- Magnimeios Logo -->
app/design/frontend/base/default/template/magnimeiosgateway/info/info.phtml ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p><strong><?php echo $this->escapeHtml($this->getMethod()->getMensagem()) ?></strong></p>
2
+ <?php
3
+
4
+
5
+ $referencias = $this->htmlEscape($this->getInfo()->getMagnimeiosReferencia());
6
+
7
+ if(!is_null($referencias)){
8
+
9
+ $re1='.*?'; # Non-greedy match on filler
10
+ $re2='(\\d+)'; # Integer Number 1
11
+ $re3='.*?'; # Non-greedy match on filler
12
+ $re4='(\\d+)'; # Integer Number 2
13
+
14
+ if ($c=preg_match_all ("/".$re1.$re2.$re3.$re4."/is", $referencias, $matches))
15
+ {
16
+ $int1=$matches[1][0];
17
+ $int2=$matches[2][0];
18
+ }
19
+
20
+
21
+
22
+ if ($int1 == '1'){
23
+ $showPS = 'display:none;';
24
+ $int1='';
25
+ }
26
+ else{
27
+ $showPS = '';
28
+ $int1 = substr($int1,0,3).' '.substr($int1,3,3).' '.substr($int1,6,3).' '.substr($int1,9,4);
29
+ }
30
+
31
+ if ($int2 == '1'){
32
+ $showMB = 'display:none;';
33
+ $int2='';
34
+ }
35
+ else{
36
+ $showMB = '';
37
+ $int2 = substr($int2,0,3).' '.substr($int2,3,3).' '.substr($int2,6,3);
38
+ }
39
+
40
+
41
+
42
+ ?>
43
+ <!--<table border="0" cellspacing="1" cellpadding="0" Style="<?php echo $showMB;?>">-->
44
+
45
+
46
+
47
+ <table border="0" cellspacing="1" cellpadding="0" Style="<?php echo $showMB;?>">
48
+ <tr>
49
+ <td colspan="2" align="center"><img src="http://www.lusopay.com/modulos/imagens/Logo_Lusopay_MB125x80px.png" border="0" alt="<?php echo $this->getMethod()->getTitle(); ?>" title="<?php echo $this->getMethod()->getTitle(); ?>" /></td>
50
+ </tr>
51
+
52
+
53
+ <tr>
54
+ <td><?php echo $this->__('<strong>Entidade:</strong>'); ?></td>
55
+ <td><?php echo $this->htmlEscape($this->getInfo()->getMagnimeiosEntidade()) ?></td>
56
+ </tr>
57
+ <tr>
58
+ <td><?php echo $this->__('<strong>Referência:</strong>'); ?> </td>
59
+ <td>&nbsp;<?php echo $int2 ?></td>
60
+ </tr>
61
+ <tr>
62
+ <td><?php echo $this->__('<strong>Montante:</strong>'); ?></td>
63
+ <td><?php echo $this->htmlEscape($this->getInfo()->getMagnimeiosMontante()) . ' EUR'; ?></td>
64
+ </tr>
65
+ </table>
66
+ <table border="0" cellspacing="1" cellpadding="0" Style="<?php echo $showPS;?>">
67
+ <tr>
68
+ <td colspan="2" align="center"><img src="http://www.lusopay.com/modulos/imagens/Logo_Lusopay_Payshop125x80px.png" border="0" alt="<?php echo $this->getMethod()->getTitle(); ?>" title="<?php echo $this->getMethod()->getTitle(); ?>" /></td>
69
+ </tr>
70
+ <tr>
71
+ <td><?php echo $this->__('<strong>Referência:</strong>'); ?> </td>
72
+ <td><?php echo $int1 ?></td>
73
+ </tr>
74
+ <tr>
75
+ <td><?php echo $this->__('<strong>Montante:</strong>'); ?></td>
76
+ <td><?php echo $this->htmlEscape($this->getInfo()->getMagnimeiosMontante()) . ' EUR'; ?></td>
77
+ </tr>
78
+ </table>
79
+ <?php
80
+
81
+ }
82
+ else {
83
+ echo "A geração da referencia falhou!";
84
+ }
85
+
86
+ ?>
87
+ <?php echo $this->getChildHtml()?>
88
+
app/etc/modules/Magnimeios_Magnimeiosgateway.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magnimeios_Magnimeiosgateway>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ <depends>
8
+ <Mage_Payment />
9
+ </depends>
10
+ </Magnimeios_Magnimeiosgateway>
11
+ </modules>
12
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Lusopay_LusopayGateway</name>
4
+ <version>1.0.0</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&#xE9;s da gera&#xE7;&#xE3;o refer&#xEA;ncias Multibanco e payshop</description>
11
+ <notes>Vers&#xE3;o para magento 1.9</notes>
12
+ <authors><author><name>Lusopay</name><user>lusopay</user><email>hf@lusopay.com</email></author></authors>
13
+ <date>2014-10-30</date>
14
+ <time>10:38:24</time>
15
+ <contents><target name="magelocal"><dir name="Magnimeios"><dir name="Magnimeiosgateway"><dir name="Block"><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"><dir name="Convert"><file name="Order.php" hash="5b2063bb5a1e5186b1e7052e694a208c"/><file name="Quote.php" hash="67c336422be52cffee09ab454677eeee"/><file name="Quote.php" hash="67c336422be52cffee09ab454677eeee"/><file name="Order.php" hash="5b2063bb5a1e5186b1e7052e694a208c"/></dir><file name="GerarRef.php" hash="582ccd3ace0d80dde93b0261f1b421c1"/><dir name="Mysql4"><file name="Setup.php" hash="81bb2624d9a505d700353013efebf632"/><file name="Setup.php" hash="81bb2624d9a505d700353013efebf632"/></dir><file name="PaymentAction.php" hash="52b0609d8c62770fb03ed1ca830a17a7"/><file name="GerarRef.php" hash="582ccd3ace0d80dde93b0261f1b421c1"/><file name="PaymentAction.php" hash="52b0609d8c62770fb03ed1ca830a17a7"/></dir><dir name="etc"><file name="config.xml" hash="5af65afe91e361e06cb79fe5dde89214"/><file name="system.xml" hash="2bfdf005b6527f0fa3107e62378b0610"/><file name="config.xml" hash="5af65afe91e361e06cb79fe5dde89214"/><file name="system.xml" hash="2bfdf005b6527f0fa3107e62378b0610"/></dir><dir name="sql"><dir name="magnimeiosgateway_setup"><file name="mysql4-install-2.0.0.php" hash="cfdf054ed86842fdc86de599aecf4fff"/><file name="mysql4-install-2.0.0.php" hash="cfdf054ed86842fdc86de599aecf4fff"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="magnimeiosgateway"><dir name="info"><dir name="pdf"><file name="info.phtml" hash="c121731f44b39c7e0b349bc71af71a3a"/></dir><file name="info.phtml" hash="ab767cdccd4d127e114361aaa3057aad"/></dir><dir name="form"><file name="form.phtml" hash="9d041c914f3feada5a4bf4958afa04aa"/><file name="mark.phtml" hash="747f61cb869f185ac3e808f6707838ed"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="magnimeiosgateway"><dir name="form"><file name="form.phtml" hash="610ffb365e0b5cc12c9466fb6c534354"/><file name="mark.phtml" hash="747f61cb869f185ac3e808f6707838ed"/></dir><dir name="info"><file name="info.phtml" hash="0d2579c0272eb422b457d4448cd76a60"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magnimeios_Magnimeiosgateway.xml" hash="bf2c21eae3198cddf69ab496cb29443f"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="magnimeiosgateway"><file name="Logo_Lusopay_256x85px.png" hash="bcc54ae1f8a25cf10f8642a8f91339e2"/><file name="logo.png" hash="c2e0e05d5dd6ac2331020dff60adf696"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="magnimeiosgateway"><file name="Logo_Lusopay_MBePayshop125x80px.png" hash="dbe096eb26c34cf69816b97fb049926b"/><file name="logo.png" hash="c2e0e05d5dd6ac2331020dff60adf696"/></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>
skin/adminhtml/default/default/images/magnimeiosgateway/Logo_Lusopay_256x85px.png ADDED
Binary file
skin/adminhtml/default/default/images/magnimeiosgateway/logo.png ADDED
Binary file
skin/frontend/base/default/images/magnimeiosgateway/Logo_Lusopay_MBePayshop125x80px.png ADDED
Binary file
skin/frontend/base/default/images/magnimeiosgateway/logo.png ADDED
Binary file