Eupago_MB - Version 1.1.2

Version Notes

[EN] - re-orders and trasactions is now avaiable
[PT] - novas funcionalidades : re-order e registo de transações

Download this release

Release Info

Developer Eupago
Extension Eupago_MB
Version 1.1.2
Comparing to
See all releases


Code changes from version 1.1.1 to 1.1.2

Files changed (40) hide show
  1. app/code/community/Eupago/Multibanco/Block/Form.php +0 -15
  2. app/code/community/Eupago/Multibanco/Block/Form/Multibanco.php +9 -0
  3. app/code/community/Eupago/Multibanco/Block/Info.php +0 -29
  4. app/code/community/Eupago/Multibanco/Block/Info/Multibanco.php +40 -0
  5. app/code/community/Eupago/Multibanco/Block/Onepage/Success.php +33 -0
  6. app/code/community/Eupago/Multibanco/Block/Onepage/Success.phtml +0 -124
  7. app/code/community/Eupago/Multibanco/Block/Success.php +0 -12
  8. app/code/community/Eupago/Multibanco/Helper/Data.php +0 -4
  9. app/code/community/Eupago/Multibanco/Model/Convert/Order.php +0 -24
  10. app/code/community/Eupago/Multibanco/Model/Convert/Quote.php +0 -20
  11. app/code/community/Eupago/Multibanco/Model/GerarRef.php +0 -98
  12. app/code/community/Eupago/Multibanco/Model/Multibanco.php +210 -0
  13. app/code/community/Eupago/Multibanco/Model/Mysql4/Setup.php +0 -5
  14. app/code/community/Eupago/Multibanco/Model/PaymentAction.php +0 -44
  15. app/code/community/Eupago/Multibanco/Model/Process.php +0 -138
  16. app/code/community/Eupago/Multibanco/Model/System/Config/Template.php +29 -0
  17. app/code/community/Eupago/Multibanco/controllers/CallbackController.php +82 -53
  18. app/code/community/Eupago/Multibanco/etc/config.xml +43 -159
  19. app/code/community/Eupago/Multibanco/etc/system.xml +55 -88
  20. app/code/community/Eupago/Multibanco/sql/multibanco_setup/mysql4-install-1.0.0.php +0 -20
  21. app/design/adminhtml/default/default/template/eupago/multibanco/info/multibanco.phtml +9 -0
  22. app/design/adminhtml/default/default/template/multibanco/form/form.phtml +0 -8
  23. app/design/adminhtml/default/default/template/multibanco/info/info.phtml +0 -21
  24. app/design/adminhtml/default/default/template/multibanco/info/pdf/info.phtml +0 -5
  25. app/design/frontend/base/default/layout/eupago_multibanco.xml +12 -0
  26. app/design/frontend/base/default/layout/multibanco.xml +0 -15
  27. app/design/frontend/base/default/template/eupago/multibanco/checkout/success.phtml +99 -0
  28. app/design/frontend/base/default/template/eupago/multibanco/info/default.phtml +13 -0
  29. app/design/frontend/base/default/template/eupago/multibanco/info/multibanco.phtml +42 -0
  30. app/design/frontend/base/default/template/multibanco/checkout/success.phtml +0 -124
  31. app/design/frontend/base/default/template/multibanco/form/form.phtml +0 -8
  32. app/design/frontend/base/default/template/multibanco/form/mark.phtml +0 -3
  33. app/design/frontend/base/default/template/multibanco/info/info.phtml +0 -86
  34. app/etc/modules/Eupago_Multibanco.xml +9 -9
  35. package.xml +10 -9
  36. skin/adminhtml/default/default/images/multibanco/eupagomultibanco.png +0 -0
  37. skin/frontend/base/default/images/eupago/multibanco/eupago_mb_p.png +0 -0
  38. skin/frontend/base/default/images/eupago/multibanco/multibanco_icon.png +0 -0
  39. skin/frontend/base/default/images/multibanco/eupagomultibanco.png +0 -0
  40. skin/frontend/base/default/images/multibanco/mb_mark.gif +0 -0
app/code/community/Eupago/Multibanco/Block/Form.php DELETED
@@ -1,15 +0,0 @@
1
- <?php
2
- class Eupago_Multibanco_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('multibanco/form/mark.phtml');
9
-
10
- $this->setTemplate('multibanco/form/form.phtml')
11
- ->setMethodLabelAfterHtml($mark->toHtml())
12
- ;
13
- parent::_construct();
14
- }
15
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Eupago/Multibanco/Block/Form/Multibanco.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Eupago_Multibanco_Block_Form_Multibanco extends Mage_Payment_Block_Form
3
+ {
4
+ protected function _construct()
5
+ {
6
+ if(Mage::getStoreConfig('payment/multibanco/mostra_icon'))
7
+ $this->setMethodLabelAfterHtml('<img style="padding:0 5px;"src="'.$this->getSkinUrl('images/eupago/multibanco/multibanco_icon.png').'" />');
8
+ }
9
+ }
app/code/community/Eupago/Multibanco/Block/Info.php DELETED
@@ -1,29 +0,0 @@
1
- <?php
2
- class Eupago_Multibanco_Block_Info extends Mage_Payment_Block_Info
3
- {
4
- protected function _construct()
5
- {
6
- parent::_construct();
7
- $this->setTemplate('multibanco/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('multibanco/info/pdf/info.phtml');
27
- return $this->toHtml();
28
- }
29
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Eupago/Multibanco/Block/Info/Multibanco.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Eupago_Multibanco_Block_Info_Multibanco extends Mage_Payment_Block_Info
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+ if(Mage::getStoreConfig('payment/multibanco/frontend_template') == 'multibanco')
8
+ $this->setTemplate('eupago/multibanco/info/multibanco.phtml');
9
+ else
10
+ $this->setTemplate('eupago/multibanco/info/default.phtml');
11
+ }
12
+
13
+ public function getInfo()
14
+ {
15
+ $info = $this->getData('info');
16
+ if (!($info instanceof Mage_Payment_Model_Info)) {
17
+ Mage::throwException($this->__('Can not retrieve payment info model object.'));
18
+ }
19
+ return $info;
20
+ }
21
+
22
+ public function getMultibancoData(){
23
+ $info = $this->getData('info');
24
+ $multibanco_data = (Object)$info['additional_information'];
25
+ if (!($info instanceof Mage_Payment_Model_Info)) {
26
+ Mage::throwException($this->__('Can not retrieve payment info model object.'));
27
+ }
28
+ return $multibanco_data;
29
+ }
30
+
31
+ public function getMethod()
32
+ {
33
+ return $this->getInfo()->getMethodInstance();
34
+ }
35
+
36
+ public function getMethodCode()
37
+ {
38
+ return $this->getInfo()->getMethodInstance()->getCode();
39
+ }
40
+ }
app/code/community/Eupago/Multibanco/Block/Onepage/Success.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Eupago_Multibanco_Block_Onepage_Success extends Mage_Checkout_Block_Onepage_Success
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+ //$this->setTemplate('eupago/multibanco/checkout/success.phtml');
8
+ }
9
+
10
+ public function getMultibancoData(){
11
+ $order = $order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
12
+
13
+ // vai á base de dados buscar todas as transaction desta encomenda
14
+ $collection = Mage::getModel('sales/order_payment_transaction')
15
+ ->getCollection()
16
+ ->addAttributeToFilter('order_id', array('eq' => $order->getEntityId()))
17
+ ->addAttributeToFilter('txn_type', array('eq' => 'order'))
18
+ ->addPaymentIdFilter($order->getPayment()->getId());
19
+
20
+ // retorna os valores da ultima transação
21
+ foreach($collection as $transaction){
22
+ $rawValue = $transaction->getAdditionalInformation();
23
+ if($rawValue['raw_details_info']['method'] == 'MULTIBANCO' && is_numeric($rawValue['raw_details_info']['referencia'])){
24
+ $entidade = $rawValue['raw_details_info']['entidade'];
25
+ $referencia = $rawValue['raw_details_info']['referencia'];
26
+ }
27
+ }
28
+
29
+ return (object)array("entidade" => $entidade, "referencia" => $referencia, "valor" => $order->getGrandTotal());
30
+ }
31
+
32
+
33
+ }
app/code/community/Eupago/Multibanco/Block/Onepage/Success.phtml DELETED
@@ -1,124 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-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 design
22
- * @package base_default
23
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
- */
26
-
27
- ?>
28
-
29
- <div class="page-title">
30
- <h1><?php echo $this->__('Your order has been received.') ?></h1>
31
- </div>
32
- <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
33
- <h2 class="sub-title"><?php echo $this->__('Thank you for your purchase!') ?></h2>
34
-
35
- <?php if ($this->getOrderId()): ?>
36
- <?php if ($this->getCanViewOrder()) : ?>
37
- <p><?php echo $this->__('Your order # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getViewOrderUrl()), $this->escapeHtml($this->getOrderId()))) ?></p>
38
- <?php else : ?>
39
- <p><?php echo $this->__('Your order # is: %s.', $this->escapeHtml($this->getOrderId())) ?></p>
40
- <?php endif; ?>
41
-
42
- <p><?php echo $this->__('You will receive an order confirmation email with details of your order and a link to track its progress.') ?></p>
43
- <?php if ($this->getCanViewOrder() && $this->getCanPrintOrder()) : ?>
44
- <p>
45
- <?php echo $this->__('Click <a href="%s" onclick="this.target=\'_blank\'">here to print</a> a copy of your order confirmation.', $this->getPrintUrl()) ?>
46
- <?php echo $this->getChildHtml() ?>
47
- </p>
48
-
49
- <?php endif; ?>
50
- <?php endif; ?>
51
-
52
- <?php if ($this->getAgreementRefId()): ?>
53
- <p><?php echo $this->__('Your billing agreement # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getAgreementUrl()), $this->escapeHtml($this->getAgreementRefId()))) ?></p>
54
- <?php endif; ?>
55
-
56
- <?php if ($profiles = $this->getRecurringProfiles()): ?>
57
- <p><?php echo $this->__('Your recurring payment profiles:'); ?></p>
58
- <ul class="disc">
59
- <?php foreach ($profiles as $profile): ?>
60
- <?php $profileIdHtml = ($this->getCanViewProfiles() ? sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getProfileUrl($profile)), $this->escapeHtml($this->getObjectData($profile, 'reference_id'))) : $this->escapeHtml($this->getObjectData($profile, 'reference_id'))); ?>
61
- <li><?php echo $this->__('Payment profile # %s: "%s".', $profileIdHtml, $this->escapeHtml($this->getObjectData($profile, 'schedule_description'))) ?></li>
62
- <?php endforeach; ?>
63
- </ul>
64
- <?php endif; ?>
65
-
66
- <?php
67
- $sales_flat_order_payment = Mage::getSingleton('core/resource')->getTableName('sales_flat_order_payment');
68
-
69
- $order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
70
- if ($order->getPayment()->getMethod() == 'multibanco') {
71
-
72
- $conn = Mage::getSingleton('core/resource')->getConnection('core_read');
73
- $query = $conn->query("SELECT eupago_referencia FROM $sales_flat_order_payment WHERE parent_id=$order->entity_id");
74
- $referencia = $query->fetchColumn();
75
- $query = $conn->query("SELECT eupago_entidade FROM $sales_flat_order_payment WHERE parent_id=$order->entity_id");
76
- $entidade = $query->fetchColumn();
77
- $query = $conn->query("SELECT eupago_montante FROM $sales_flat_order_payment WHERE parent_id=$order->entity_id");
78
- $valor = $query->fetchColumn();
79
- $valor = number_format($valor,'2',',','');
80
- }
81
- ?>
82
-
83
-
84
- <?php if($order->getPayment()->getMethod() == 'multibanco'){?>
85
-
86
- <p> Para pagar esta encomenda atrav&eacute;s da Rede de Caixas Autom&aacute;ticas Multibanco e introduza os seguintes dados:
87
- <div align='center'>
88
-
89
- <table style="margin-top: 10px;border: 1px solid #000;" width="450px" cellspacing="0" align="center">
90
- <tr>
91
- <td colspan="2" style="height:25px;vertical-align:center; text-align:center">
92
- <img src="https://seguro.eupago.pt/repositorio/imagens/eupagomultibanco.png" alt="euPago Multibanco" height="25" />
93
- </td>
94
- </tr>
95
- <tr>
96
- <td colspan="2" style="height:25px;vertical-align:center;background-color:#3a87ad;font-size:small;text-align:center;color:#ebebeb;">
97
- Multibanco (Pagamento de Compras\Servi&ccedil;os)</td>
98
- </tr>
99
- <tr>
100
- <td align="left" style="font-size:small;font-weight:bold;padding-left:15px;">Entidade:</td>
101
- <td align="left" style="font-size:small;"><?php echo $entidade; ?></td>
102
- </tr>
103
- <tr>
104
- <td align="left" style="font-size:small;font-weight:bold;padding-left:15px;">Refer&ecirc;ncia:</td>
105
- <td align="left" style="font-size:small;"><?php echo $referencia; ?> </td>
106
- </tr>
107
- <tr>
108
- <td align="left" style="font-size:small;font-weight:bold;padding-left:15px;">Valor:</td>
109
- <td align="left" style="font-size:small;"><?php echo $valor; ?> EUR </td>
110
- </tr>
111
- <tr>
112
- <td colspan="2" style="height:30px;vertical-align:center;background-color:#3a87ad;font-size:small;text-align:center;color:#ebebeb;">O tal&atilde;o emitido pela caixa autom&aacute;tica faz de prova de pagamento.<br/>Conserve-o.</td>
113
- </tr>
114
- </table>
115
-
116
- </div>
117
- </p>
118
- <?php } ?>
119
- <div class="buttons-set">
120
- <button type="button" class="button" title="<?php echo $this->__('Continue Shopping') ?>" onclick="window.location='<?php echo $this->getUrl() ?>'"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
121
- </div>
122
-
123
-
124
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Eupago/Multibanco/Block/Success.php DELETED
@@ -1,12 +0,0 @@
1
- <?php
2
- class Eupago_Multibanco_Block_Success extends Mage_Checkout_Block_Onepage_Success
3
- {
4
- protected function _construct()
5
- {
6
- parent::_construct();
7
- $this->setTemplate('multibanco/checkout/success.phtml');
8
- }
9
-
10
- }
11
-
12
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Eupago/Multibanco/Helper/Data.php DELETED
@@ -1,4 +0,0 @@
1
- <?php
2
- class Eupago_Multibanco_Helper_Data extends Mage_Core_Helper_Abstract
3
- {
4
- }
 
 
 
 
app/code/community/Eupago/Multibanco/Model/Convert/Order.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- class Eupago_Multibanco_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
- var_dump($quotePayment);
15
-
16
- $quotePayment->setEupagoEntidade($payment->getEupagoEntidade())
17
- ->setEupagoReferencia($payment->getEupagoReferencia())
18
- ->setEupagoMontante($payment->getEupagoMontante());
19
-
20
- return $quotePayment;
21
- }
22
-
23
-
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Eupago/Multibanco/Model/Convert/Quote.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
- class Eupago_Multibanco_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
- $orderPayment = parent::paymentToOrderPayment($payment);
14
- $orderPayment->setEupagoEntidade($payment->getEupagoEntidade())
15
- ->setEupagoReferencia($payment->getEupagoReferencia())
16
- ->setEupagoMontante($payment->getEupagoMontante());
17
- return $orderPayment;
18
- }
19
-
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Eupago/Multibanco/Model/GerarRef.php DELETED
@@ -1,98 +0,0 @@
1
- <?php
2
-
3
- class Eupago_Multibanco_Model_GerarRef extends Mage_Payment_Model_Method_Abstract {
4
-
5
- protected $_code = 'multibanco';
6
- protected $_paymentMethod = 'multibanco';
7
- protected $_formBlockType = 'multibanco/form';
8
- protected $_infoBlockType = 'multibanco/info';
9
- protected $_allowCurrencyCode = array('EUR');
10
- protected $_isGateway = false;
11
- protected $_canOrder = true;
12
- protected $_canAuthorize = false;
13
- protected $_canCapture = true;
14
- protected $_canCapturePartial = false;
15
- protected $_canRefund = false;
16
- protected $_canRefundInvoicePartial = false;
17
- protected $_canVoid = false;
18
- protected $_canUseInternal = true;
19
- protected $_canUseCheckout = true;
20
- protected $_canUseForMultishipping = true;
21
- protected $_isInitializeNeeded = false;
22
- protected $_canFetchTransactionInfo = false;
23
- protected $_canReviewPayment = false;
24
- protected $_canCreateBillingAgreement = false;
25
- protected $_canManageRecurringProfiles = true;
26
-
27
- public function getMensagem() {
28
- return $this->getConfigData('mensagem');
29
- }
30
-
31
- public function assignData($data) {
32
-
33
- }
34
-
35
- public function validate() {
36
-
37
- parent::validate();
38
-
39
- $min = $this->getConfigData('min');
40
- $max = $this->getConfigData('max');
41
-
42
- if($min=="")
43
- $min='0';
44
- if($max=="")
45
- $max='9999.99';
46
-
47
-
48
-
49
- $paymentInfo = $this->getInfoInstance();
50
-
51
- if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
52
- $quote = $paymentInfo->getOrder();
53
- } else {
54
- $quote = $paymentInfo->getQuote();
55
- }
56
- $currency_code = $quote->getBaseCurrencyCode();
57
-
58
-
59
- if (!in_array($currency_code, $this->_allowCurrencyCode)) {
60
- Mage::throwException(Mage::helper('multibanco')->__('A moeda selecionada (' . $currency_code . ') não é compatível com este meio de pagamento'));
61
- }
62
- $order_value = number_format($quote->getBaseGrandTotal(), 2, '.', '');
63
- if ($order_value < 1) {
64
- Mage::throwException(Mage::helper('multibanco')->__('Impossível gerar referência MB para valores inferiores a 1 Euro.'));
65
- }
66
- if ($order_value >= 999999.99) {
67
- Mage::throwException(Mage::helper('multibanco')->__('O valor excede o limite para pagamento na rede MB'));
68
- }
69
- $order_value = number_format($quote->getBaseGrandTotal(), 2, '.', '');
70
- if ($order_value < $min) {
71
- Mage::throwException(Mage::helper('multibanco')->__('Meio de pagamento disponível para compras superiores a ' . $min . ' EUR .'));
72
- }
73
-
74
- if ($order_value > $max) {
75
- Mage::throwException(Mage::helper('multibanco')->__('Meio de pagamento disponível para compras inferiores a ' . $max . ' EUR .'));
76
- }
77
-
78
- return $this;
79
- }
80
-
81
- public function getQuote() {
82
- if (empty($this->_quote)) {
83
- $this->_quote = $this->getCheckout()->getQuote();
84
- }
85
- return $this->_quote;
86
- }
87
-
88
- public function getCheckout() {
89
-
90
- if (empty($this->_checkout)) {
91
- $this->_checkout = Mage::getSingleton('checkout/session');
92
- }
93
-
94
-
95
- return $this->_checkout;
96
- }
97
-
98
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Eupago/Multibanco/Model/Multibanco.php ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ //http://excellencemagentoblog.com/blog/2012/05/01/magento-create-custom-payment-method-api-based/
4
+
5
+ class Eupago_Multibanco_Model_Multibanco extends Mage_Payment_Model_Method_Abstract{
6
+
7
+ protected $_code = 'multibanco';
8
+
9
+ protected $_paymentMethod = 'eupago_multibanco';
10
+
11
+ protected $_isGateway = true;
12
+
13
+ protected $_canAuthorize = false;
14
+
15
+ protected $_canCapture = true;
16
+
17
+ protected $_canCapturePartial = false;
18
+
19
+ protected $_canOrder = true;
20
+
21
+ protected $_canRefund = false;
22
+
23
+ protected $_canVoid = false;
24
+
25
+ protected $_canUseInternal = true;
26
+
27
+ protected $_canUseCheckout = true;
28
+
29
+ protected $_canUseForMultishipping = true;
30
+
31
+ protected $_canSaveCc = false; // WARNING: you can't keep card data unless you have PCI complience licence
32
+
33
+ protected $_formBlockType = 'multibanco/form_multibanco';
34
+
35
+ protected $_infoBlockType = 'multibanco/info_multibanco';
36
+
37
+ public function order(Varien_Object $payment, $amount)
38
+ {
39
+
40
+ $result = $this->soapApiGeraRefMB($payment,$amount);
41
+
42
+ if($result == false) {
43
+ $errorMsg = $this->_getHelper()->__('Error Processing the request');
44
+ } else {
45
+ if($result->estado == 0){
46
+ $payment->setTransactionId($result->referencia);
47
+ $payment->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS,array('entidade'=>$result->entidade, 'referencia'=>$result->referencia,'method'=>'MULTIBANCO','resposta'=>$result->resposta));
48
+ $payment->setIsTransactionClosed(false);
49
+ $payment->setAdditionalInformation('entidade', $result->entidade);
50
+ $payment->setAdditionalInformation('referencia', $result->referencia);
51
+ $payment->setAdditionalInformation('valor', $result->valor);
52
+ }else{
53
+ $payment->setTransactionId(-1);
54
+ $payment->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS,array('error_cod'=>$result->estado,'error_description'=>$result->resposta));
55
+ $payment->setIsTransactionClosed(false);
56
+ $errorMsg = $result->resposta;
57
+ }
58
+ }
59
+
60
+ if(isset($errorMsg)){
61
+ Mage::log("pedido com erro: ".$errorMsg, null, 'eupago_multibanco.log');
62
+ Mage::getSingleton('core/session')->addError($errorMsg);
63
+ Mage::throwException($errorMsg);
64
+ }
65
+
66
+ return $this;
67
+ }
68
+
69
+ public function capture(Varien_Object $payment)
70
+ {
71
+ if($payment->getMethod() != 'multibanco')
72
+ return;
73
+
74
+ // vai á base de dados buscar todas as transaction desta encomenda
75
+ $collection = Mage::getModel('sales/order_payment_transaction')
76
+ ->getCollection()
77
+ ->addAttributeToFilter('order_id', array('eq' => $payment->getOrder()->getEntityId()))
78
+ ->addAttributeToFilter('txn_type', array('eq' => 'order'))
79
+ ->addPaymentIdFilter($payment->getId());
80
+
81
+ foreach($collection as $transaction){
82
+ $rawValue = $transaction->getAdditionalInformation();
83
+ if($rawValue['raw_details_info']['method'] == 'MULTIBANCO' && is_numeric($rawValue['raw_details_info']['referencia'])){
84
+ $entidade = $rawValue['raw_details_info']['entidade'];
85
+ $referencia = $rawValue['raw_details_info']['referencia'];
86
+ }
87
+ }
88
+
89
+ if(!(isset($referencia) && $referencia != null) && !(isset($entidade) && $entidade != null)){
90
+ Mage::throwException("Não foi encontrado pedido Multibanco");
91
+ }
92
+
93
+ $result = $this->soapApiInformacaoReferencia($referencia, $entidade);
94
+
95
+ if($result == false) {
96
+ $errorMsg = $this->_getHelper()->__('Error Processing the request');
97
+ } else {
98
+ if($result->estado_referencia == 'paga' || $result->estado_referencia == 'transferida'){
99
+ // neste sistema altera logo para pago
100
+ $payment->setTransactionId($referencia."-capture");
101
+ $payment->setParentTransactionId($referencia);
102
+ $payment->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS,array('referencia'=>$referencia,'resposta'=>$result->resposta,'method'=>'MULTIBANCO', "data de pagamento"=>$result->data_pagamento, "hora de pagamento"=>$result->hora_pagamento));
103
+ $payment->setIsTransactionClosed(true);
104
+ }else{
105
+ $errorMsg = "a referencia não se encontra paga";
106
+ Mage::log("pedido com erro: ".$errorMsg, null, 'eupago_multibanco.log');
107
+ }
108
+ }
109
+
110
+ if(isset($errorMsg)){
111
+ Mage::throwException($errorMsg);
112
+ }
113
+
114
+ return $this;
115
+ }
116
+
117
+
118
+ private function getSoapUrl(){
119
+ $version = 'eupagov7';
120
+ $chave = $this->getConfigData('chave');
121
+ $demo = explode("-",$chave);
122
+
123
+ if($demo[0] == 'demo'){
124
+ return 'https://replica.eupago.pt/replica.'.$version.'.wsdl';
125
+ }
126
+ return 'https://seguro.eupago.pt/'.$version.'.wsdl';
127
+ }
128
+
129
+
130
+ // faz pedido à eupago via SOAP Para gerar Referencias Multibanco
131
+ private function soapApiGeraRefMB(Varien_Object $payment, $amount){
132
+
133
+ $per_dup = $this->getConfigData('per_dup');
134
+
135
+ $n_dias = $this->getConfigData('payment_deadline');
136
+
137
+ $order = $payment->getOrder();
138
+
139
+ $client = new SoapClient($this->getSoapUrl(), array('cache_wsdl' => WSDL_CACHE_NONE));// chamada do serviço SOAP
140
+
141
+ try {
142
+ if($per_dup != 1 || (is_numeric($n_dias) && $n_dias > 0)){
143
+ $data_inicio = date("Y-m-d");
144
+ $data_fim = (is_numeric($n_dias) && $n_dias > 0) ? date('Y-m-d', strtotime('+'.$n_dias.' day', strtotime($data_inicio))) : "2099-12-31";
145
+ $per_dup =($per_dup == true) ? 1 : 0;
146
+ $arraydados = array("chave" => $this->getConfigData('chave'), "valor" => $amount, "id" => $order->getIncrementId(), "data_inicio"=>$data_inicio, "data_fim"=>$data_fim, "valor_minimo"=>$amount, "valor_maximo"=>$amount, 'per_dup' => $per_dup);
147
+ $result = $client->gerarReferenciaMBDL($arraydados);
148
+ }else{
149
+ $arraydados = array("chave" => $this->getConfigData('chave'), "valor" => $amount, "id" => $order->getIncrementId());
150
+ $result = $client->gerarReferenciaMB($arraydados);
151
+ }
152
+ }
153
+ catch (SoapFault $fault) {
154
+ Mage::throwException("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring}");
155
+ return false;
156
+ }
157
+
158
+ return $result;
159
+ }
160
+
161
+ // faz pedido à eupago para obter o estado da referencia
162
+ private function soapApiInformacaoReferencia($referencia, $entidade){
163
+
164
+ $arraydados = array("chave" => $this->getConfigData('chave'), "referencia" => $referencia, "entidade" => $entidade);
165
+
166
+ $client = new SoapClient($this->getSoapUrl(), array('cache_wsdl' => WSDL_CACHE_NONE));// chamada do serviço SOAP
167
+
168
+ try {
169
+ $result = $client->informacaoReferencia($arraydados);
170
+ }
171
+ catch (SoapFault $fault) {
172
+ Mage::throwException("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring}");
173
+ return false;
174
+ }
175
+
176
+ return $result;
177
+ }
178
+
179
+
180
+ // public function assignData($data){
181
+ // if (!($data instanceof Varien_Object)) {
182
+ // $data = new Varien_Object($data);
183
+ // }
184
+ // $info = $this->getInfoInstance();
185
+ // $info->setAdditionalInformation('multibanco_phone_number', $data->getMultibancoPhoneNumber());
186
+
187
+ // return $this;
188
+ // }
189
+
190
+
191
+ public function validate(){
192
+ parent::validate();
193
+
194
+ $info = $this->getInfoInstance();
195
+ // acrescentar as validações de valor caso existam
196
+ // $no = $info->getAdditionalInformation('multibanco_phone_number');
197
+
198
+ // if(empty($no) || !is_numeric($no) || strlen ($no) != 9){
199
+ // $errorCode = 'invalid_data';
200
+ // $errorMsg = $this->_getHelper()->__('O campo Número Multibanco parece ser inválido. Por favor verifique');
201
+ // }
202
+
203
+ // if(isset($errorMsg)){
204
+ // Mage::throwException($errorMsg);
205
+ // }
206
+
207
+ return $this;
208
+ }
209
+
210
+ }
app/code/community/Eupago/Multibanco/Model/Mysql4/Setup.php DELETED
@@ -1,5 +0,0 @@
1
- <?php
2
- class Eupago_Multibanco_Model_Mysql4_Setup extends Mage_Sales_Model_Mysql4_Setup
3
- {
4
-
5
- }
 
 
 
 
 
app/code/community/Eupago/Multibanco/Model/PaymentAction.php DELETED
@@ -1,44 +0,0 @@
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 Eupago_Multibanco_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('multibanco')->__('Order')
41
- ),
42
- );
43
- }
44
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Eupago/Multibanco/Model/Process.php DELETED
@@ -1,138 +0,0 @@
1
- <?php
2
-
3
- class Eupago_Multibanco_Model_Process extends Mage_Payment_Model_Method_Abstract {
4
-
5
- protected $_code = 'multibanco';
6
- protected $_paymentMethod = 'multibanco';
7
- protected $_formBlockType = 'multibanco/form';
8
- protected $_infoBlockType = 'multibanco/info';
9
- protected $_allowCurrencyCode = array('EUR');
10
- protected $_isGateway = false;
11
- protected $_canOrder = true;
12
- protected $_canAuthorize = false;
13
- protected $_canCapture = true;
14
- protected $_canCapturePartial = false;
15
- protected $_canRefund = false;
16
- protected $_canRefundInvoicePartial = false;
17
- protected $_canVoid = false;
18
- protected $_canUseInternal = true;
19
- protected $_canUseCheckout = true;
20
- protected $_canUseForMultishipping = true;
21
- protected $_isInitializeNeeded = false;
22
- protected $_canFetchTransactionInfo = false;
23
- protected $_canReviewPayment = false;
24
- protected $_canCreateBillingAgreement = false;
25
- // protected $chave_api = $this->getConfigData('chave');
26
-
27
- public function orderObserver($observer) {
28
-
29
- $chave_api = $this->getConfigData('chave');
30
-
31
- $order = $observer->getEvent()->getOrder();
32
- $id = $observer->getEvent()->getOrder()->getIncrementId();
33
- $order_value = $observer->getEvent()->getOrder()->getGrandTotal();
34
-
35
- $entity = $observer->getEvent()->getOrder()->getId();
36
- $sales_flat_order_payment = Mage::getSingleton('core/resource')->getTableName('sales_flat_order_payment');
37
- $sales_flat_quote_payment = Mage::getSingleton('core/resource')->getTableName('sales_flat_quote_payment');
38
-
39
- $resource = Mage::getSingleton('core/resource');
40
- $writeConnection = $resource->getConnection('core_write');
41
- $quote_id = $order->getQuoteId();
42
-
43
- $payment_method =$order->getPayment()->getMethodInstance()->getCode();
44
-
45
- if(Mage::getSingleton('admin/session')->isLoggedIn()){
46
- Mage::getSingleton('admin/session')->setAdminQuoteEupagoId($quote_id);
47
- $_SESSION['admin_quote_eupago_id'] = $quote_id;
48
- }
49
-
50
-
51
- if($payment_method == "multibanco"){
52
- if ($quote_id != "" ) {
53
- $conn = Mage::getSingleton('core/resource')->getConnection('core_read');
54
- $query = $conn->query("SELECT eupago_referencia FROM $sales_flat_quote_payment WHERE quote_id =$quote_id");
55
- $referencia = $query->fetchColumn();
56
- if ($referencia == "") {
57
- $this->geraReferencia($chave_api, $order_value, $id, $entity, $writeConnection, $sales_flat_order_payment, $sales_flat_quote_payment, $quote_id);
58
- } else {
59
- $query = $conn->query("SELECT eupago_entidade FROM $sales_flat_quote_payment WHERE quote_id =$quote_id");
60
- $entidade = $query->fetchColumn();
61
- $query = $conn->query("SELECT eupago_montante FROM $sales_flat_quote_payment WHERE quote_id =$quote_id");
62
- $montante = $query->fetchColumn();
63
- $query = "UPDATE $sales_flat_order_payment SET eupago_montante = $montante, eupago_entidade = $entidade, eupago_referencia = $referencia WHERE parent_id =$entity";
64
- $writeConnection->query($query);
65
- $query = "UPDATE $sales_flat_quote_payment SET eupago_montante = $montante, eupago_entidade = $entidade, eupago_referencia = $referencia WHERE quote_id =$quote_id";
66
- $writeConnection->query($query);
67
- }
68
- }
69
- }
70
- return;
71
- }
72
-
73
- /*
74
- ** GERA RERERENCIA E INSERE NA Base de Dados
75
- */
76
-
77
- public function geraReferencia($chave_api, $order_value, $id, $entity, $writeConnection, $sales_flat_order_payment, $sales_flat_quote_payment, $quote_id) {
78
-
79
- if($chave_api){
80
- $demo = explode("-",$chave_api);
81
- if($demo['0']=='demo'){
82
- $url = 'https://replica.eupago.pt/replica.eupagov3.wsdl';
83
- }
84
- else {
85
- $url ='https://seguro.eupago.pt/eupagov3.wsdl';
86
- }
87
- }
88
-
89
- if(class_exists('SOAPClient')){
90
- $arraydados = array("chave" => $chave_api, "valor" => $order_value, "id" => $id); //cada canal tem a sua chave
91
- $client = @new SoapClient($url, array('cache_wsdl' => WSDL_CACHE_NONE)); // chamada do servi�o SOAP
92
- $result = $client->gerarReferenciaMB($arraydados);
93
- $entidade = $result->entidade;
94
- $referencia = $result->referencia;
95
- }else{
96
- $client = new Varien_Http_Client();
97
- $client->setUri('https://replica.eupago.pt/bridge_clientes/bridge.php?servico=mb&chave_api='.$chave_api.'&valor='.$order_value.'&identificador='.$id)
98
- ->setMethod('GET')
99
- ->setConfig(array(
100
- 'maxredirects'=>1,
101
- 'timeout'=>30,
102
- ));
103
-
104
- $response = $client->request()->getBody();
105
- $dados = explode('#', $response);
106
- $entidade = $dados['0'];
107
- $referencia = $dados['1'];
108
- }
109
-
110
- If($quote_id){
111
- $query = "UPDATE $sales_flat_quote_payment SET eupago_montante = $order_value, eupago_entidade = $entidade, eupago_referencia = $referencia WHERE quote_id =$quote_id";
112
- $writeConnection->query($query);
113
- }else{
114
- $query = "UPDATE $sales_flat_order_payment SET eupago_montante = $order_value, eupago_entidade = $entidade, eupago_referencia = $referencia WHERE parent_id =$entity";
115
- $writeConnection->query($query);
116
- }
117
- }
118
-
119
-
120
- /**
121
- * Get checkout session namespace
122
- *
123
- * @return Mage_Checkout_Model_Session
124
- */
125
- public function getCheckout() {
126
- return Mage::getSingleton('checkout/session');
127
- }
128
-
129
- /**
130
- * Get current quote
131
- *
132
- * @return Mage_Sales_Model_Quote
133
- */
134
- public function getQuote() {
135
- return $this->getCheckout()->getQuote();
136
- }
137
-
138
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Eupago/Multibanco/Model/System/Config/Template.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Eupago_Multibanco_Model_System_Config_Template
3
+ {
4
+ /**
5
+ * Options getter
6
+ *
7
+ * @return array
8
+ */
9
+ public function toOptionArray()
10
+ {
11
+ return array(
12
+ array('value' => 'nenhum', 'label' => Mage::helper('adminhtml')->__('Nenhum')),
13
+ array('value' => 'multibanco', 'label' => Mage::helper('adminhtml')->__('Multibanco')),
14
+ );
15
+ }
16
+
17
+ /**
18
+ * Get options in "key-value" format
19
+ *
20
+ * @return array
21
+ */
22
+ public function toArray()
23
+ {
24
+ return array(
25
+ 'nenhum' => Mage::helper('adminhtml')->__('Nenhum'),
26
+ 'multibanco' => Mage::helper('adminhtml')->__('Multibanco'),
27
+ );
28
+ }
29
+ }
app/code/community/Eupago/Multibanco/controllers/CallbackController.php CHANGED
@@ -1,61 +1,90 @@
1
  <?php
2
-
3
- class Eupago_Multibanco_CallbackController extends Mage_Core_Controller_Front_Action { // extends Mage_Payment_Model_Method_Abstract
 
 
 
 
 
4
 
5
- public function autorizeAction(){
6
-
7
- ///// dados vindos da api para comfirmar
8
- $CallBack = $this->getRequest()->getParams();
9
- $CallBack_valor = $CallBack['valor'];
10
- $CallBack_referencia = $CallBack['referencia'];
11
- $CallBack_chave_api = $CallBack['chave_api'];
12
- $CallBack_orderId = $CallBack['identificador'];
13
- $CallBack_autorizacao = $CallBack['autorizacao'];
 
 
 
 
 
 
 
 
 
 
 
 
14
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
- ////// dados de encomenda
17
- $OrderNumber = $CallBack_orderId; //$CallBack_orderId vaem da api Eupago[order-id]
18
- $order = Mage::getModel('sales/order')->load($OrderNumber, 'increment_id');
19
- $valor_encomenda = $order->grand_total; //retirado do valor total da encomenda
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  /////// dados do pagamento
22
- $pagamento = $order->getPayment();
23
- $entidade = $pagamento->eupago_entidade;
24
- $referencia = $pagamento->eupago_referencia;
25
- $valor_gerado = $pagamento->eupago_montante;
26
-
27
- /////// gera autorizacao
28
- $chave_api = Mage::getModel('multibanco/process')->getConfigData('chave');
29
- $autorizacao = md5(date('Y-m-d').$chave_api);
30
-
31
- //////// Confere dados
32
- $confere_montantes = (($valor_encomenda == $valor_gerado) == $CallBack_valor ? true : false);
33
- $confere_autorizacao = ($autorizacao == $CallBack_autorizacao ? true : false);
34
- $confere_referencia = ($referencia == $CallBack_referencia ? true : false);
35
- $confere_chave_api = ($CallBack_chave_api == $chave_api ? true : false);
36
-
37
- ////// se tudo ok, faz o update do estado da encomenda e envia um email ao cliente
38
- if($confere_montantes && $confere_chave_api && $confere_referencia){ /*futuro upgrade -> $confere_autorizacao*/
39
- $order->setData('state', "complete");
40
- $order->setStatus("processing");
41
- $order->sendOrderUpdateEmail();
42
-
43
- //////// hack for generate invoice automatically
44
- $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
45
- if (!$invoice->getTotalQty()) {
46
- Mage::throwException(Mage::helper('core')->__('Cannot create an invoice without products.'));
47
- }
48
- $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
49
- $invoice->register();
50
- $transactionSave = Mage::getModel('core/resource_transaction')
51
- ->addObject($invoice)
52
- ->addObject($invoice->getOrder());
53
- $transactionSave->save();
54
- ////////////////
55
-
56
- $history = $order->addStatusHistoryComment('Order marked as complete automatically.', false);
57
- $history->setIsCustomerNotified(true);
58
- $order->save();
59
  }
 
 
 
 
 
 
 
 
 
 
60
  }
61
- }
 
1
  <?php
2
+ /*
3
+ Mygateway Payment Controller
4
+ By: Junaid Bhura
5
+ www.junaidbhura.com
6
+ */
7
+
8
+ class Eupago_Multibanco_CallbackController extends Mage_Core_Controller_Front_Action {
9
 
10
+ public function multibancoAction() {
11
+
12
+ // tirar de comentário se pretender validar apenas pedidos post
13
+ // if(!$this->getRequest()->isPost())
14
+ // exit("pedido de callback deve ser post");
15
+
16
+ // carrega dados de callback e encomenda
17
+ $callBack_params = (object)$this->getRequest()->getParams();
18
+ $order = Mage::getModel('sales/order')->load($callBack_params->identificador, 'increment_id');
19
+
20
+ // valida metodo de pagamento
21
+ if(!isset($callBack_params->mp) || $callBack_params->mp != 'PC:PT')
22
+ exit("método de pagamento inválido");
23
+
24
+ // valida chave API
25
+ if($callBack_params->chave_api != Mage::getStoreConfig('payment/multibanco/chave'))
26
+ exit("chave API inválida");
27
+
28
+ // valida order_id
29
+ if($order->getId() == null)
30
+ exit("a encomenda não existe");
31
 
32
+ // valida estado da encomenda
33
+ if($order->getStatus() == "canceled") // devemos validar se esta completa?
34
+ exit("não foi possivel concluir o pagamento porque o estado da encomenda é: ".$order_status);
35
+
36
+ // valida valor da encomenda -> comentar no caso de premitir pagamento parcial
37
+ if($order->getGrandTotal() != $callBack_params->valor)
38
+ exit ("O valor da encomenda e o valor pago não correspondem!");
39
+
40
+ // verifica se a encomenda já está paga
41
+ if($order->getBaseTotalDue() == 0)
42
+ exit("A encomenda já se encontra paga!");
43
 
44
+ // valida valor por pagar
45
+ if($order->getBaseTotalDue() < $callBack_params->valor)
46
+ exit("O valor a pagamento é inferior ao valor pago!");
 
47
 
48
+ // marca como paga ou gera fatura
49
+ if($this->validaTransacao($callBack_params, $order)){
50
+ //$this->marcaComoPaga($order, $callBack_params->valor); // -> para usar para marcar como paga sem gerar fatura
51
+ $this->capture($order);
52
+ }
53
+ }
54
+
55
+ private function marcaComoPaga($order,$valor_pago){
56
+
57
+ $order->setData('state', "complete");
58
+ $order->setStatus("processing");
59
+ $order->sendOrderUpdateEmail();
60
+ $history = $order->addStatusHistoryComment('Encomenda paga por MULTIBANCO.', false);
61
+ $history->setIsCustomerNotified(true);
62
+ $order->setTotalPaid($valor_pago);
63
+ $order->save();
64
+ echo "estado alterado para processing com sucesso";
65
+ }
66
+
67
+ private function validaTransacao($CallBack, $order){
68
+
69
  /////// dados do pagamento
70
+ $payment = $order->getPayment();
71
+
72
+ ///// dados transaction
73
+ $transaction = $payment->getTransaction(intval($CallBack->referencia));
74
+ if($transaction == false){
75
+ echo "a referencia não corresponde a nenhuma transação desta encomenda.";
76
+ return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  }
78
+
79
+ return true;
80
+ }
81
+
82
+ // gera invoice
83
+ private function capture($order){
84
+ $payment = $order->getPayment();
85
+ $payment->capture();
86
+ $order->save();
87
+ echo "Pagamento foi capturado com sucesso. e a fatura foi gerada";
88
  }
89
+
90
+ }
app/code/community/Eupago/Multibanco/etc/config.xml CHANGED
@@ -1,174 +1,58 @@
1
  <?xml version="1.0"?>
2
  <config>
3
  <modules>
4
- <Eupago_Multibanco>
5
- <version>1.1.1</version>
6
- </Eupago_Multibanco>
7
  </modules>
8
- <frontend>
9
- <translate>
10
- <modules>
11
- <Eupago_Multibanco>
12
- <files>
13
- <default>Eupago_Multibanco.csv</default>
14
- </files>
15
- </Eupago_Multibanco>
16
- </modules>
17
- </translate>
18
- <layout>
19
- <updates>
20
- <yourmodule>
21
- <file>multibanco.xml</file>
22
- </yourmodule>
23
- </updates>
24
- </layout>
25
- <routers>
26
- <Eupago_Multibanco>
27
- <use>standard</use>
28
- <args>
29
- <module>Eupago_Multibanco</module>
30
- <frontName>Eupago</frontName>
31
- </args>
32
- </Eupago_Multibanco>
33
  <checkout>
34
- <rewrite>
35
- <checkout_onepage_success>Eupago_Multibanco_Block_Success</checkout_onepage_success>
36
- </rewrite>
37
- </checkout>
38
- </routers>
39
- </frontend>
40
- <adminhtml>
41
- <translate>
42
- <modules>
43
- <Eupago_Multibanco>
44
- <files>
45
- <default>Eupago_Multibanco.csv</default>
46
- </files>
47
- </Eupago_Multibanco>
48
- </modules>
49
- </translate>
50
- </adminhtml>
51
- <global>
52
- <fieldsets>
53
- <sales_convert_quote_payment>
54
- <eupago_entidade>
55
- <to_order_payment>*</to_order_payment>
56
- </eupago_entidade>
57
- <eupago_referencia>
58
- <to_order_payment>*</to_order_payment>
59
- </eupago_referencia>
60
- <eupago_montante>
61
- <to_order_payment>*</to_order_payment>
62
- </eupago_montante>
63
- </sales_convert_quote_payment>
64
-
65
- <sales_convert_order_payment>
66
- <eupago_entidade>
67
- <to_quote_payment>*</to_quote_payment>
68
- </eupago_entidade>
69
- <eupago_referencia>
70
- <to_quote_payment>*</to_quote_payment>
71
- </eupago_referencia>
72
- <eupago_montante>
73
- <to_quote_payment>*</to_quote_payment>
74
- </eupago_montante>
75
- </sales_convert_order_payment>
76
- </fieldsets>
77
  <models>
78
  <multibanco>
79
  <class>Eupago_Multibanco_Model</class>
80
- <resourceModel>multibanco_mysql4</resourceModel>
81
  </multibanco>
82
- <sales>
83
- <rewrite>
84
- <convert_order>Eupago_Multibanco_Model_Convert_Order</convert_order>
85
- <convert_quote>Eupago_Multibanco_Model_Convert_Quote</convert_quote>
86
- </rewrite>
87
- </sales>
88
- <multibanco_mysql4>
89
- <class>Eupago_Multibanco_Model_Mysql4</class>
90
- <entities>
91
- <multibanco>
92
- <table>eupago</table>
93
- </multibanco>
94
- </entities>
95
- </multibanco_mysql4>
96
  </models>
97
- <resources>
98
- <multibanco_setup>
99
- <setup>
100
- <module>Eupago_Multibanco</module>
101
- <class>Eupago_Multibanco_Model_Mysql4_Setup</class>
102
- </setup>
103
- <connection>
104
- <use>core_setup</use>
105
- </connection>
106
- </multibanco_setup>
107
- <multibanco_write>
108
- <connection>
109
- <use>core_write</use>
110
- </connection>
111
- </multibanco_write>
112
- <multibanco_read>
113
- <connection>
114
- <use>core_read</use>
115
- </connection>
116
- </multibanco_read>
117
- </resources>
118
- <blocks>
119
- <multibanco>
120
- <class>Eupago_Multibanco_Block</class>
121
- </multibanco>
122
- </blocks>
123
- <helpers>
124
- <multibanco>
125
- <class>Eupago_Multibanco_Helper</class>
126
- </multibanco>
127
- </helpers>
128
- <sales>
129
- <order>
130
- <statuses>
131
- <aguarda_pagamento_multibanco translate="label">
132
- <label><![CDATA[MB - Aguarda Pagamento]]>
133
- </label>
134
- </aguarda_pagamento_multibanco>
135
- </statuses>
136
- <states>
137
- <new>
138
- <statuses>
139
- <aguarda_pagamento_multibanco/>
140
- </statuses>
141
- </new>
142
- </states>
143
- </order>
144
- </sales>
145
- <events>
146
- <sales_order_save_after>
147
- <observers>
148
- <payone_save_status>
149
- <type>singleton</type>
150
- <class>multibanco/process</class>
151
- <method>orderObserver</method>
152
- </payone_save_status>
153
- </observers>
154
- </sales_order_save_after>
155
- </events>
156
-
157
  </global>
158
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  <default>
160
-
161
  <payment>
162
- <multibanco>
163
- <active>0</active>
164
- <model>multibanco/gerarRef</model>
165
- <title>Multibanco</title>
166
- <sort_order>1</sort_order>
167
- <allowspecific>0</allowspecific>
168
- <chave></chave>
169
- <mensagem>Pagamento por Multibanco</mensagem>
170
- <payment_action>order</payment_action>
 
171
  </multibanco>
172
- </payment>
173
- </default>
174
  </config>
1
  <?xml version="1.0"?>
2
  <config>
3
  <modules>
4
+ <Eupago_Multibanco>
5
+ <version>1.0.1</version>
6
+ </Eupago_Multibanco>
7
  </modules>
8
+ <global>
9
+ <blocks>
10
+ <multibanco>
11
+ <class>Eupago_Multibanco_Block</class>
12
+ </multibanco>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  <checkout>
14
+ <rewrite>
15
+ <onepage_success>Eupago_Multibanco_Block_Onepage_Success</onepage_success>
16
+ </rewrite>
17
+ </checkout>
18
+ </blocks>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  <models>
20
  <multibanco>
21
  <class>Eupago_Multibanco_Model</class>
 
22
  </multibanco>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  </models>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  </global>
25
+ <frontend>
26
+ <routers>
27
+ <Eupago_Multibanco>
28
+ <use>standard</use>
29
+ <args>
30
+ <module>Eupago_Multibanco</module>
31
+ <frontName>Eupago</frontName>
32
+ </args>
33
+ </Eupago_Multibanco>
34
+ </routers>
35
+ <layout>
36
+ <updates>
37
+ <mymodule>
38
+ <file>eupago_multibanco.xml</file>
39
+ </mymodule>
40
+ </updates>
41
+ </layout>
42
+ </frontend>
43
  <default>
 
44
  <payment>
45
+ <multibanco>
46
+ <active>1</active>
47
+ <model>multibanco/multibanco</model>
48
+ <order_status>1</order_status>
49
+ <login backend_model="adminhtml/system_config_backend_encrypted"/>
50
+ <order_status>pending</order_status>
51
+ <title>Eupago Multibanco</title>
52
+ <cgi_url>https://seguro.eupago.pt/eupagov7.wsdl</cgi_url>
53
+ <debug>0</debug>
54
+ <payment_action>order</payment_action>
55
  </multibanco>
56
+ </payment>
57
+ </default>
58
  </config>
app/code/community/Eupago/Multibanco/etc/system.xml CHANGED
@@ -1,125 +1,92 @@
1
  <?xml version="1.0"?>
2
  <config>
3
- <sections>
4
  <payment>
5
  <groups>
6
- <multibanco translate="label" module="payment">
7
- <label><![CDATA[euPago - Pagamentos por Refer&ecirc;ncias Multibanco (Oficial)]]>
8
- </label>
9
- <frontend_type>text</frontend_type>
10
- <sort_order>1</sort_order>
11
  <show_in_default>1</show_in_default>
12
  <show_in_website>1</show_in_website>
13
- <show_in_store>1</show_in_store>
14
  <fields>
15
  <active translate="label">
16
- <label>Ativo</label>
17
  <frontend_type>select</frontend_type>
18
  <source_model>adminhtml/system_config_source_yesno</source_model>
19
- <sort_order>5</sort_order>
20
  <show_in_default>1</show_in_default>
21
  <show_in_website>1</show_in_website>
22
- <show_in_store>1</show_in_store>
23
  </active>
24
- <order_status translate="label">
25
- <label>Estado da Encomenda</label>
26
- <frontend_type>select</frontend_type>
27
- <source_model>adminhtml/system_config_source_order_status</source_model>
28
- <sort_order>10</sort_order>
29
- <show_in_default>1</show_in_default>
30
- <show_in_website>1</show_in_website>
31
- <show_in_store>1</show_in_store>
32
- </order_status>
33
- <sort_order translate="label">
34
- <label><![CDATA[Ordem de apresenta&ccedil;&atilde;o]]>
35
- </label>
36
- <frontend_type>text</frontend_type>
37
- <sort_order>15</sort_order>
38
- <show_in_default>1</show_in_default>
39
- <show_in_website>1</show_in_website>
40
- <show_in_store>1</show_in_store>
41
- </sort_order>
42
  <title translate="label">
43
- <label><![CDATA[T&iacute;tulo a apresentar no Website]]>
44
- </label>
45
  <frontend_type>text</frontend_type>
46
- <sort_order>20</sort_order>
47
  <show_in_default>1</show_in_default>
48
  <show_in_website>1</show_in_website>
49
- <show_in_store>1</show_in_store>
50
  </title>
51
- <chave translate="label">
52
- <label>Chave da API</label>
53
- <comment>Se ainda não tiver uma chave <![CDATA[ <a target="_blank" href="https://eupago.pt/registo?magento#registo_form">clique aqui</a> ]]></comment>
54
  <frontend_type>text</frontend_type>
55
- <sort_order>25</sort_order>
56
  <show_in_default>1</show_in_default>
57
- <show_in_website>1</show_in_website>
58
- <show_in_store>1</show_in_store>
59
  </chave>
60
- <min translate="label">
61
- <label>Valor Mínimo da Encomenda</label>
62
- <frontend_type>text</frontend_type>
63
- <validate>validate-number</validate>
64
- <sort_order>30</sort_order>
65
  <show_in_default>1</show_in_default>
66
  <show_in_website>1</show_in_website>
67
- <show_in_store>1</show_in_store>
68
- </min>
69
- <max translate="label">
70
- <label>Valor Máximo da Encomenda</label>
71
- <frontend_type>text</frontend_type>
72
- <validate>validate-number</validate>
73
- <sort_order>35</sort_order>
 
74
  <show_in_default>1</show_in_default>
75
  <show_in_website>1</show_in_website>
76
- <show_in_store>1</show_in_store>
77
- </max>
78
-
79
- <mensagem translate="label">
80
- <label><![CDATA[Instru&ccedil;&otilde;es]]>
81
- </label>
82
- <frontend_type>text</frontend_type>
83
- <sort_order>40</sort_order>
84
  <show_in_default>1</show_in_default>
85
  <show_in_website>1</show_in_website>
86
- <show_in_store>1</show_in_store>
87
- </mensagem>
88
- <allowspecific translate="label">
89
- <label><![CDATA[Pagamento para os Pa&iacute;ses]]>
90
- </label>
91
- <frontend_type>allowspecific</frontend_type>
92
- <sort_order>45</sort_order>
93
- <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
94
  <show_in_default>1</show_in_default>
95
  <show_in_website>1</show_in_website>
96
- <show_in_store>1</show_in_store>
97
- </allowspecific>
98
- <specificcountry translate="label">
99
- <label><![CDATA[Pagamento para Pa&iacute;ses Espec&iacute;ficos]]>
100
- </label>
101
- <frontend_type>multiselect</frontend_type>
102
- <sort_order>50</sort_order>
103
- <source_model>adminhtml/system_config_source_country</source_model>
104
  <show_in_default>1</show_in_default>
105
  <show_in_website>1</show_in_website>
106
- <show_in_store>1</show_in_store>
107
- </specificcountry>
108
- <payment_action translate="label">
109
- <label>Payment Action</label>
110
- <frontend_type>select</frontend_type>
111
- <source_model>multibanco/paymentAction</source_model>
112
- <sort_order>55</sort_order>
113
- <show_in_default>0</show_in_default>
114
- <show_in_website>0</show_in_website>
115
  <show_in_store>0</show_in_store>
116
- </payment_action>
117
  </fields>
118
  </multibanco>
119
  </groups>
120
  </payment>
121
- <info>
122
- <label><![CDATA[Pagamento para Pa&iacute;ses Espec&iacute;ficos]]></label>
123
- </info>
124
  </sections>
125
- </config>
1
  <?xml version="1.0"?>
2
  <config>
3
+ <sections>
4
  <payment>
5
  <groups>
6
+ <multibanco translate="label" module="paygate">
7
+ <label>Eupago Multibanco</label>
8
+ <sort_order>10</sort_order>
 
 
9
  <show_in_default>1</show_in_default>
10
  <show_in_website>1</show_in_website>
11
+ <show_in_store>0</show_in_store>
12
  <fields>
13
  <active translate="label">
14
+ <label>Enabled</label>
15
  <frontend_type>select</frontend_type>
16
  <source_model>adminhtml/system_config_source_yesno</source_model>
17
+ <sort_order>1</sort_order>
18
  <show_in_default>1</show_in_default>
19
  <show_in_website>1</show_in_website>
20
+ <show_in_store>0</show_in_store>
21
  </active>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  <title translate="label">
23
+ <label>Title</label>
 
24
  <frontend_type>text</frontend_type>
25
+ <sort_order>2</sort_order>
26
  <show_in_default>1</show_in_default>
27
  <show_in_website>1</show_in_website>
28
+ <show_in_store>0</show_in_store>
29
  </title>
30
+ <chave translate="label">
31
+ <label>API key</label>
32
+ <comment>Se ainda não tiver uma chave <![CDATA[ <a target="_blank" href="https://eupago.pt/registo?magento#registo_form">registe-se aqui</a> ]]></comment>
33
  <frontend_type>text</frontend_type>
34
+ <sort_order>3</sort_order>
35
  <show_in_default>1</show_in_default>
36
+ <show_in_website>0</show_in_website>
37
+ <show_in_store>0</show_in_store>
38
  </chave>
39
+ <order_status translate="label">
40
+ <label>New order status</label>
41
+ <frontend_type>select</frontend_type>
42
+ <source_model>adminhtml/system_config_source_order_status_new</source_model>
43
+ <sort_order>4</sort_order>
44
  <show_in_default>1</show_in_default>
45
  <show_in_website>1</show_in_website>
46
+ <show_in_store>0</show_in_store>
47
+ </order_status>
48
+ <mostra_icon translate="label">
49
+ <label>Show icon</label>
50
+ <comment>Mostra icon do multibanco na listagem de metodos de pagamento antes do titulo</comment>
51
+ <frontend_type>select</frontend_type>
52
+ <source_model>adminhtml/system_config_source_yesno</source_model>
53
+ <sort_order>5</sort_order>
54
  <show_in_default>1</show_in_default>
55
  <show_in_website>1</show_in_website>
56
+ <show_in_store>0</show_in_store>
57
+ </mostra_icon>
58
+ <frontend_template translate="label">
59
+ <label>Frontend Template</label>
60
+ <comment>Selecione o tema e defina como os seus clientes vêm este método de pagamento</comment>
61
+ <frontend_type>select</frontend_type>
62
+ <source_model>multibanco/system_config_template</source_model>
63
+ <sort_order>6</sort_order>
64
  <show_in_default>1</show_in_default>
65
  <show_in_website>1</show_in_website>
66
+ <show_in_store>0</show_in_store>
67
+ </frontend_template>
68
+ <per_dup translate="label">
69
+ <label>Allow duplicated payments</label>
70
+ <comment>Escolha sim se pretende que apenas seja possivel pagar uma referência várias vezes</comment>
71
+ <frontend_type>select</frontend_type>
72
+ <source_model>adminhtml/system_config_source_yesno</source_model>
73
+ <sort_order>7</sort_order>
74
  <show_in_default>1</show_in_default>
75
  <show_in_website>1</show_in_website>
76
+ <show_in_store>0</show_in_store>
77
+ </per_dup>
78
+ <payment_deadline translate="label">
79
+ <label>Payment Deadline</label>
80
+ <comment>Se pretender que a referência tenha uma validade, preencha o número de dias que a referência está disponível para pagamento</comment>
81
+ <frontend_type>text</frontend_type>
82
+ <sort_order>8</sort_order>
 
83
  <show_in_default>1</show_in_default>
84
  <show_in_website>1</show_in_website>
 
 
 
 
 
 
 
 
 
85
  <show_in_store>0</show_in_store>
86
+ </payment_deadline>
87
  </fields>
88
  </multibanco>
89
  </groups>
90
  </payment>
 
 
 
91
  </sections>
92
+ </config>
app/code/community/Eupago/Multibanco/sql/multibanco_setup/mysql4-install-1.0.0.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
- $installer = $this;
3
-
4
- $installer->startSetup();
5
- $installer->addAttribute('order_payment', 'eupago_entidade', array('type'=>'varchar'));
6
- $installer->addAttribute('order_payment', 'eupago_referencia', array('type'=>'varchar'));
7
- $installer->addAttribute('order_payment', 'eupago_montante', array('type'=>'varchar'));
8
-
9
- $installer->addAttribute('quote_payment', 'eupago_entidade', array('type'=>'varchar'));
10
- $installer->addAttribute('quote_payment', 'eupago_referencia', array('type'=>'varchar'));
11
- $installer->addAttribute('quote_payment', 'eupago_montante', array('type'=>'varchar'));
12
- $installer->endSetup();
13
-
14
- if (Mage::getVersion() >= 1.1) {
15
- $installer->startSetup();
16
- $installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'), 'eupago_entidade', 'VARCHAR(255) NOT NULL');
17
- $installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'), 'eupago_referencia', 'VARCHAR(255) NOT NULL');
18
- $installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'), 'eupago_montante', 'VARCHAR(255) NOT NULL');
19
- $installer->endSetup();
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/eupago/multibanco/info/multibanco.phtml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <ul id="payment_info_<?php echo $this->getMethodCode() ?>">
2
+ <li>
3
+ <h4>Multibanco</h4>
4
+ <?php $multibanco_data = $this->getMultibancoData(); ?>
5
+ <?php echo $this->__('Entidade: ').$multibanco_data->entidade."</br>" ?>
6
+ <?php echo $this->__('Referência: ').chunk_split($multibanco_data->referencia,3," ")."</br>" ?>
7
+ <?php echo $this->__('Valor: ').number_format($multibanco_data->valor,2)." EUR" ?>
8
+ </li>
9
+ </ul>
app/design/adminhtml/default/default/template/multibanco/form/form.phtml DELETED
@@ -1,8 +0,0 @@
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/multibanco/eupagomultibanco.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/multibanco/info/info.phtml DELETED
@@ -1,21 +0,0 @@
1
- <table border="0" cellspacing="1" cellpadding="0">
2
- <tr>
3
- <td><img src="<?php echo $this->getSkinUrl('images/multibanco/eupagomultibanco.png') ?>" border="0" alt="<?php echo $this->getMethod()->getTitle(); ?>" title="<?php echo $this->getMethod()->getTitle(); ?>" /></td>
4
- </tr>
5
- <tr>
6
- <td><table width="100%" border="0" cellspacing="1" cellpadding="0">
7
- <tr>
8
- <td><?php echo $this->__('<strong>Entidade:</strong>'); ?></td>
9
- <td><?php echo $this->htmlEscape($this->getInfo()->getEupagoEntidade()) ?></td>
10
- </tr>
11
- <tr>
12
- <td><?php echo $this->__('<strong>Referência:</strong>'); ?> </td>
13
- <td><?php echo $this->htmlEscape($this->getInfo()->getEupagoReferencia()); ?></td>
14
- </tr>
15
- <tr>
16
- <td><?php echo $this->__('<strong>Montante:</strong>'); ?></td>
17
- <td><?php echo number_format($this->htmlEscape($this->getInfo()->getEupagoMontante()),'2',',','') . ' EUR'; ?></td>
18
- </tr>
19
- </table></td>
20
- </tr>
21
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/multibanco/info/pdf/info.phtml DELETED
@@ -1,5 +0,0 @@
1
- <?php echo $this->__('Entidade: %s', $this->htmlEscape($this->getInfo()->getEupagoEntidade())) ?>
2
- {{pdf_row_separator}}
3
- <?php echo utf8_encode($this->__('Refer�ncia: %s', $this->htmlEscape($this->getInfo()->getEupagoReferencia()))) ?>
4
- {{pdf_row_separator}}
5
- <?php echo $this->__('Montante: %s EUR', $this->htmlEscape($this->getInfo()->getEupagoMontante())) ?>
 
 
 
 
 
app/design/frontend/base/default/layout/eupago_multibanco.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <checkout_onepage_success translate="label">
4
+ <label>One Page Checkout Success</label>
5
+ <!-- <reference name="root"> -->
6
+ <!-- <action method="setTemplate"><template>page/2columns-right.phtml</template></action> -->
7
+ <!-- </reference> -->
8
+ <reference name="checkout.success">
9
+ <action method="setTemplate"><template>eupago/multibanco/checkout/success.phtml</template></action>
10
+ </reference>
11
+ </checkout_onepage_success>
12
+ </layout>
app/design/frontend/base/default/layout/multibanco.xml DELETED
@@ -1,15 +0,0 @@
1
- <?xml version="1.0"?>
2
- <layout version="0.1.0">
3
- <checkout_onepage_success translate="label">
4
- <label>One Page Checkout Success</label>
5
- <!-- <reference name="root">
6
- <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
7
- </reference> -->
8
- <reference name="content">
9
- <reference name="checkout.success">
10
- <action method="setTemplate"><template>multibanco/checkout/success.phtml</template></action>
11
- </reference>
12
- </reference>
13
- </checkout_onepage_success>
14
- </layout>
15
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/eupago/multibanco/checkout/success.phtml ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-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@magento.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.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <div class="page-title">
28
+ <h1><?php echo $this->__('Your order has been received.') ?></h1>
29
+ </div>
30
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
31
+ <h2 class="sub-title"><?php echo $this->__('Thank you for your purchase!') ?></h2>
32
+
33
+ <?php if ($this->getOrderId()):?>
34
+ <?php if ($this->getCanViewOrder()) :?>
35
+ <p><?php echo $this->__('Your order # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getViewOrderUrl()), $this->escapeHtml($this->getOrderId()))) ?></p>
36
+ <?php else :?>
37
+ <p><?php echo $this->__('Your order # is: %s.', $this->escapeHtml($this->getOrderId())) ?></p>
38
+ <?php endif;?>
39
+ <p><?php echo $this->__('You will receive an order confirmation email with details of your order and a link to track its progress.') ?></p>
40
+ <?php if ($this->getCanViewOrder() && $this->getCanPrintOrder()) :?>
41
+ <p>
42
+ <?php echo $this->__('Click <a href="%s" onclick="this.target=\'_blank\'">here to print</a> a copy of your order confirmation.', $this->getPrintUrl()) ?>
43
+ <?php echo $this->getChildHtml() ?>
44
+ </p>
45
+ <?php endif;?>
46
+ <?php endif;?>
47
+
48
+ <?php if ($this->getAgreementRefId()): ?>
49
+ <p><?php echo $this->__('Your billing agreement # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getAgreementUrl()), $this->escapeHtml($this->getAgreementRefId())))?></p>
50
+ <?php endif;?>
51
+
52
+ <?php if ($profiles = $this->getRecurringProfiles()):?>
53
+ <p><?php echo $this->__('Your recurring payment profiles:'); ?></p>
54
+ <ul class="disc">
55
+ <?php foreach($profiles as $profile):?>
56
+ <?php $profileIdHtml = ($this->getCanViewProfiles() ? sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getProfileUrl($profile)), $this->escapeHtml($this->getObjectData($profile, 'reference_id'))) : $this->escapeHtml($this->getObjectData($profile, 'reference_id')));?>
57
+ <li><?php echo $this->__('Payment profile # %s: "%s".', $profileIdHtml, $this->escapeHtml($this->getObjectData($profile, 'schedule_description')))?></li>
58
+ <?php endforeach;?>
59
+ </ul>
60
+ <?php endif;?>
61
+
62
+ <?php
63
+ $multibanco_data = $this->getMultibancoData();
64
+ if(isset($multibanco_data->referencia) && $multibanco_data->referencia != ""){?>
65
+ <div style="margin: 20px;" align='center'>
66
+ <table style="width:100%; max-width:400px; padding:5px; font-size: 11px; color: #374953; margin:0 auto;">
67
+ <tbody>
68
+ <tr>
69
+ <td style="font-size: 12px; border-top: 0px; border-left: 0px; border-right: 0px; border-bottom: 1px solid #45829F; padding:3px; background-color: #45829F; color: White; height:25px; line-height:25px" colspan="3"><div align="center"><?php echo $this->__('Pagamento por Multibanco ou Homebanking') ?></div></td>
70
+ </tr>
71
+ <tr style="background-color:#f1f1f1;">
72
+ <td style="padding:8px 0;" rowspan="3"><div align="center"><img src="<?php echo $this->getSkinUrl('images/eupago/multibanco/eupago_mb_p.png'); ?>" alt="euPago" /></div></td>
73
+ <td style="padding:10px 2px 2px 2px; font-weight:bold; text-align:left"><?php echo $this->__('Entidade') ?></td>
74
+ <td style="padding:10px 2px 2px 2px; text-align:left"><?php echo $multibanco_data->entidade; ?></td>
75
+ </tr>
76
+ <tr style="background-color:#f1f1f1;">
77
+ <td style=" padding:2px; font-weight:bold; text-align:left"><?php echo $this->__('Referência') ?></td>
78
+ <td style=" padding:2px; text-align:left"><?php echo chunk_split($multibanco_data->referencia,3,' '); ?></td>
79
+ </tr>
80
+ <tr style="background-color:#f1f1f1;">
81
+ <td style="padding:2px; padding-bottom:10px; font-weight:bold; text-align:left"><?php echo $this->__('Valor') ?></td>
82
+ <td style="padding:2px; padding-bottom:10px; text-align:left"><?php echo number_format($multibanco_data->valor,2).' EUR'; ?></td>
83
+ </tr>
84
+ <tr>
85
+ <td style="font-size: xx-small; padding:0; border: 0px; text-align:center;" colspan="3"><?php echo $this->__('O ticket obtido na maquina automática faz prova de pagamento.') ?></td>
86
+ </tr>
87
+ <?php if(isset($multibanco_data->data_limite) && $multibanco_data->data_limite != ''){ ?>
88
+ <tr>
89
+ <td style="font-size: xx-small; color:#dd0000; line-height: 10px; padding:0; border: 0px; text-align:center;" colspan="3"><?php echo $this->__('Data limite de pagamento') ?> : </span><?php echo $multibanco_data->data_limite ?></td>
90
+ </tr>
91
+ <?php } ?>
92
+ </tbody>
93
+ </table>
94
+ </div>
95
+ <?php } ?>
96
+
97
+ <div class="buttons-set">
98
+ <button type="button" class="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Continue Shopping')) ?>" onclick="window.location='<?php echo $this->getUrl() ?>'"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
99
+ </div>
app/design/frontend/base/default/template/eupago/multibanco/info/default.phtml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <ul id="payment_info_<?php echo $this->getMethodCode() ?>">
2
+ <li style="min-width: 300px;">
3
+ <h4>Multibanco</h4>
4
+ <?php
5
+ $multibanco_data = $this->getMultibancoData();
6
+ if(isset($multibanco_data->referencia) && $multibanco_data->referencia != ""){
7
+ echo $this->__('Entidade: ').$multibanco_data->entidade."</br>"
8
+ .$this->__('Referência: ').chunk_split($multibanco_data->referencia,3," ")."</br>"
9
+ .$this->__('Valor: ').number_format($multibanco_data->valor,2)." EUR";
10
+ }else
11
+ echo $this->__('Vai receber nos seus dispositivos inscritos no MB WAY um pedido de pagamento. Para validar a compra basta aceitar e introduzir o seu PIN MB WAY.') ?>
12
+ </li>
13
+ </ul>
app/design/frontend/base/default/template/eupago/multibanco/info/multibanco.phtml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <ul id="payment_info_<?php echo $this->getMethodCode() ?>">
2
+ <li style="min-width: 400px;">
3
+ <?php
4
+ $multibanco_data = $this->getMultibancoData();
5
+ if(isset($multibanco_data->referencia) && $multibanco_data->referencia != ""){?>
6
+ <div align='center'>
7
+ <table style="width:100%; padding:5px; font-size: 11px; color: #374953; margin:0 auto;">
8
+ <tbody>
9
+ <tr>
10
+ <td style="font-size: 12px; border-top: 0px; border-left: 0px; border-right: 0px; border-bottom: 1px solid #45829F; padding:3px; background-color: #45829F; color: White; height:25px; line-height:25px" colspan="3"><div align="center"><?php echo $this->__('Pagamento por Multibanco ou Homebanking') ?></div></td>
11
+ </tr>
12
+ <tr style="background-color:#f1f1f1;">
13
+ <td style="padding:8px 0;" rowspan="3"><div align="center"><img src="<?php echo $this->getSkinUrl('images/eupago/multibanco/eupago_mb_p.png'); ?>" alt="euPago" /></div></td>
14
+ <td style="padding:10px 2px 2px 2px; font-weight:bold; text-align:left"><?php echo $this->__('Entidade') ?></td>
15
+ <td style="padding:10px 2px 2px 2px; text-align:left"><?php echo $multibanco_data->entidade; ?></td>
16
+ </tr>
17
+ <tr style="background-color:#f1f1f1;">
18
+ <td style=" padding:2px; font-weight:bold; text-align:left"><?php echo $this->__('Referência') ?></td>
19
+ <td style=" padding:2px; text-align:left"><?php echo chunk_split($multibanco_data->referencia,3,' '); ?></td>
20
+ </tr>
21
+ <tr style="background-color:#f1f1f1;">
22
+ <td style="padding:2px; padding-bottom:10px; font-weight:bold; text-align:left"><?php echo $this->__('Valor') ?></td>
23
+ <td style="padding:2px; padding-bottom:10px; text-align:left"><?php echo number_format($multibanco_data->valor,2).' EUR'; ?></td>
24
+ </tr>
25
+ <tr>
26
+ <td style="font-size: xx-small; padding:0; border: 0px; text-align:center;" colspan="3"><?php echo $this->__('O ticket obtido na maquina automática faz prova de pagamento.') ?></td>
27
+ </tr>
28
+ <?php if(isset($multibanco_data->data_limite) && $multibanco_data->data_limite != ''){ ?>
29
+ <tr>
30
+ <td style="font-size: xx-small; color:#dd0000; line-height: 10px; padding:0; border: 0px; text-align:center;" colspan="3"><?php echo $this->__('Data limite de pagamento') ?> : </span><?php echo $multibanco_data->data_limite ?></td>
31
+ </tr>
32
+ <?php } ?>
33
+ </tbody>
34
+ </table>
35
+ </div>
36
+ <?php }else{
37
+ echo "<h4>Multibanco</h4>";
38
+ echo $this->__('Os dados para pagamento multibanco serão apresentados quando finalizar a sua encomenda e/ou enviados para o seu e-mail.');
39
+ }?>
40
+
41
+ </li>
42
+ </ul>
app/design/frontend/base/default/template/multibanco/checkout/success.phtml DELETED
@@ -1,124 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-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 design
22
- * @package base_default
23
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
- */
26
-
27
- ?>
28
-
29
- <div class="page-title">
30
- <h1><?php echo $this->__('Your order has been received.') ?></h1>
31
- </div>
32
- <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
33
- <h2 class="sub-title"><?php echo $this->__('Thank you for your purchase!') ?></h2>
34
-
35
- <?php if ($this->getOrderId()): ?>
36
- <?php if ($this->getCanViewOrder()) : ?>
37
- <p><?php echo $this->__('Your order # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getViewOrderUrl()), $this->escapeHtml($this->getOrderId()))) ?></p>
38
- <?php else : ?>
39
- <p><?php echo $this->__('Your order # is: %s.', $this->escapeHtml($this->getOrderId())) ?></p>
40
- <?php endif; ?>
41
-
42
- <p><?php echo $this->__('You will receive an order confirmation email with details of your order and a link to track its progress.') ?></p>
43
- <?php if ($this->getCanViewOrder() && $this->getCanPrintOrder()) : ?>
44
- <p>
45
- <?php echo $this->__('Click <a href="%s" onclick="this.target=\'_blank\'">here to print</a> a copy of your order confirmation.', $this->getPrintUrl()) ?>
46
- <?php echo $this->getChildHtml() ?>
47
- </p>
48
-
49
- <?php endif; ?>
50
- <?php endif; ?>
51
-
52
- <?php if ($this->getAgreementRefId()): ?>
53
- <p><?php echo $this->__('Your billing agreement # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getAgreementUrl()), $this->escapeHtml($this->getAgreementRefId()))) ?></p>
54
- <?php endif; ?>
55
-
56
- <?php if ($profiles = $this->getRecurringProfiles()): ?>
57
- <p><?php echo $this->__('Your recurring payment profiles:'); ?></p>
58
- <ul class="disc">
59
- <?php foreach ($profiles as $profile): ?>
60
- <?php $profileIdHtml = ($this->getCanViewProfiles() ? sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getProfileUrl($profile)), $this->escapeHtml($this->getObjectData($profile, 'reference_id'))) : $this->escapeHtml($this->getObjectData($profile, 'reference_id'))); ?>
61
- <li><?php echo $this->__('Payment profile # %s: "%s".', $profileIdHtml, $this->escapeHtml($this->getObjectData($profile, 'schedule_description'))) ?></li>
62
- <?php endforeach; ?>
63
- </ul>
64
- <?php endif; ?>
65
-
66
- <?php
67
- $sales_flat_order_payment = Mage::getSingleton('core/resource')->getTableName('sales_flat_order_payment');
68
-
69
- $order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
70
- if ($order->getPayment()->getMethod() == 'multibanco') {
71
-
72
- $conn = Mage::getSingleton('core/resource')->getConnection('core_read');
73
- $query = $conn->query("SELECT eupago_referencia FROM $sales_flat_order_payment WHERE parent_id=$order->entity_id");
74
- $referencia = $query->fetchColumn();
75
- $query = $conn->query("SELECT eupago_entidade FROM $sales_flat_order_payment WHERE parent_id=$order->entity_id");
76
- $entidade = $query->fetchColumn();
77
- $query = $conn->query("SELECT eupago_montante FROM $sales_flat_order_payment WHERE parent_id=$order->entity_id");
78
- $valor = $query->fetchColumn();
79
- $valor = number_format($valor,'2',',','');
80
- }
81
- ?>
82
-
83
-
84
- <?php if($order->getPayment()->getMethod() == 'multibanco'){?>
85
-
86
- <p> Para pagar esta encomenda atrav&eacute;s da Rede de Caixas Autom&aacute;ticas Multibanco e introduza os seguintes dados:
87
- <div align='center'>
88
-
89
- <table style="margin-top: 10px;border: 1px solid #000;" width="450px" cellspacing="0" align="center">
90
- <tr>
91
- <td colspan="2" style="height:25px;vertical-align:center; text-align:center">
92
- <img src="https://seguro.eupago.pt/repositorio/imagens/eupagomultibanco.png" alt="euPago Multibanco" height="25" />
93
- </td>
94
- </tr>
95
- <tr>
96
- <td colspan="2" style="height:25px;vertical-align:center;background-color:#3a87ad;font-size:small;text-align:center;color:#ebebeb;">
97
- Multibanco (Pagamento de Compras\Servi&ccedil;os)</td>
98
- </tr>
99
- <tr>
100
- <td align="left" style="font-size:small;font-weight:bold;padding-left:15px;">Entidade:</td>
101
- <td align="left" style="font-size:small;"><?php echo $entidade; ?></td>
102
- </tr>
103
- <tr>
104
- <td align="left" style="font-size:small;font-weight:bold;padding-left:15px;">Refer&ecirc;ncia:</td>
105
- <td align="left" style="font-size:small;"><?php echo $referencia; ?> </td>
106
- </tr>
107
- <tr>
108
- <td align="left" style="font-size:small;font-weight:bold;padding-left:15px;">Valor:</td>
109
- <td align="left" style="font-size:small;"><?php echo $valor; ?> EUR </td>
110
- </tr>
111
- <tr>
112
- <td colspan="2" style="height:30px;vertical-align:center;background-color:#3a87ad;font-size:small;text-align:center;color:#ebebeb;">O tal&atilde;o emitido pela caixa autom&aacute;tica faz de prova de pagamento.<br/>Conserve-o.</td>
113
- </tr>
114
- </table>
115
-
116
- </div>
117
- </p>
118
- <?php } ?>
119
- <div class="buttons-set">
120
- <button type="button" class="button" title="<?php echo $this->__('Continue Shopping') ?>" onclick="window.location='<?php echo $this->getUrl() ?>'"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
121
- </div>
122
-
123
-
124
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/multibanco/form/form.phtml DELETED
@@ -1,8 +0,0 @@
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/multibanco/eupagomultibanco.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/multibanco/form/mark.phtml DELETED
@@ -1,3 +0,0 @@
1
- <!-- MB Logo -->
2
- <img src="<?php echo $this->getSkinUrl('images/multibanco/mb_mark.gif') ?>" class="v-middle" />
3
- <!-- MB Logo -->
 
 
 
app/design/frontend/base/default/template/multibanco/info/info.phtml DELETED
@@ -1,86 +0,0 @@
1
- <table border="1" cellspacing="1" cellpadding="0">
2
-
3
- <tr>
4
- <td><table width="100%" border="0" cellspacing="1" cellpadding="0">
5
-
6
- <?php
7
-
8
- $AdminQouteId = Mage::getSingleton('admin/session')->getAdminQuoteEupagoId();
9
- if($AdminQouteId != null && $AdminQouteId != ""){
10
- $quote_id = $AdminQouteId;
11
- }else{
12
- $orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
13
- $quote_id = Mage::getSingleton('checkout/session')->getQuoteId();
14
- }
15
- $conn = Mage::getSingleton('core/resource')->getConnection('core_read');
16
- $referencia = "";
17
- if ($quote_id != "") {
18
- $sales_flat_quote_payment = Mage::getSingleton('core/resource')->getTableName('sales_flat_quote_payment');
19
- $query = $conn->query("SELECT eupago_referencia FROM $sales_flat_quote_payment WHERE quote_id= $quote_id");
20
- $referencia = $query->fetchColumn();
21
- }
22
- if ($referencia == "") {
23
- ?>
24
- <tr>
25
- <td><img src="<?php echo $this->getSkinUrl('images/multibanco/eupagomultibanco.png') ?>" border="0" alt="<?php echo $this->getMethod()->getTitle(); ?>" title="<?php echo $this->getMethod()->getTitle(); ?>" /></td>
26
- </tr>
27
- <tr>
28
- <td> Os dados para pagamento multibanco ser&atilde;o apresentados quando finalizar a sua encomenda e/ou enviados para o seu e-mail.</td></tr>
29
- <?
30
- } else {
31
-
32
-
33
- $conn = Mage::getSingleton('core/resource')->getConnection('core_read');
34
- $sales_flat_order_payment = Mage::getSingleton('core/resource')->getTableName('sales_flat_order_payment');
35
- $query = $conn->query("SELECT max(parent_id) eupago_referencia FROM $sales_flat_order_payment ");
36
- $entity_id = $query->fetchColumn();
37
-
38
- $query = $conn->query("SELECT eupago_referencia FROM $sales_flat_order_payment WHERE parent_id=$entity_id");
39
- $referencia = $query->fetchColumn();
40
- $query = $conn->query("SELECT eupago_entidade FROM $sales_flat_order_payment WHERE parent_id=$entity_id");
41
- $entidade = $query->fetchColumn();
42
- $query = $conn->query("SELECT eupago_montante FROM $sales_flat_order_payment WHERE parent_id=$entity_id");
43
- $valor = $query->fetchColumn();
44
- $valor = number_format($valor,'2',',','');
45
- if(($referencia != "" && $referencia != null) && ($entidade != "" && $entidade != null) && $valor){
46
- ?>
47
-
48
- <div align='center'>
49
-
50
- <table style="margin-top: 10px;border: 1px solid #000;" width="250px" cellspacing="0" align="center">
51
- <tr>
52
- <td colspan="2" style="height:25px;vertical-align:center; text-align:center">
53
- <img src="https://seguro.eupago.pt/repositorio/imagens/eupagomultibanco.png" alt="euPago Multibanco" height="25" />
54
- </td>
55
- </tr>
56
- <tr>
57
- <td colspan="2" style="height:25px;vertical-align:center;background-color:#3a87ad;font-size:small;text-align:center;color:#ebebeb;">
58
- Multibanco (Pagamento de Compras\Servi&ccedil;os)</td>
59
- </tr>
60
- <tr>
61
- <td align="left" style="font-size:small;font-weight:bold;padding-left:15px;">Entidade:</td>
62
- <td align="left" style="font-size:small;"><?php echo $entidade; ?></td>
63
- </tr>
64
- <tr>
65
- <td align="left" style="font-size:small;font-weight:bold;padding-left:15px;">Refer&ecirc;ncia:</td>
66
- <td align="left" style="font-size:small;"><?php echo $referencia; ?> </td>
67
- </tr>
68
- <tr>
69
- <td align="left" style="font-size:small;font-weight:bold;padding-left:15px;">Valor:</td>
70
- <td align="left" style="font-size:small;"><?php echo $valor; ?>EUR </td>
71
- </tr>
72
-
73
- </table>
74
-
75
- </div>
76
-
77
-
78
-
79
-
80
- <? }
81
- }?>
82
- </tr>
83
-
84
- </table></td>
85
- </tr>
86
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/etc/modules/Eupago_Multibanco.xml CHANGED
@@ -1,12 +1,12 @@
1
  <?xml version="1.0"?>
2
  <config>
3
- <modules>
4
- <Eupago_Multibanco>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- <depends>
8
- <Mage_Payment />
9
  </depends>
10
- </Eupago_Multibanco>
11
- </modules>
12
- </config>
1
  <?xml version="1.0"?>
2
  <config>
3
+ <modules>
4
+ <Eupago_Multibanco>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Payment />
9
  </depends>
10
+ </Eupago_Multibanco>
11
+ </modules>
12
+ </config>
package.xml CHANGED
@@ -1,18 +1,19 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Eupago_MB</name>
4
- <version>1.1.1</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Modulo de pagamento que gera referencias multibanco.</summary>
10
- <description>Modulo de pagamento por Entidade e Referencia Multibanco</description>
11
- <notes>- Bug Fix</notes>
12
- <authors><author><name>euPago</name><user>euPago</user><email>dev@eupago.pt</email></author></authors>
13
- <date>2016-09-02</date>
14
- <time>11:46:21</time>
15
- <contents><target name="magecommunity"><dir name="Eupago"><dir name="Multibanco"><dir name="Block"><file name="Form.php" hash="b10bbd2ac4230fb7b5b23163bba5497d"/><file name="Info.php" hash="6b2e8bc2cb50cd10921632d72d283e91"/><dir name="Onepage"><file name="Success.phtml" hash="cc8ae90a0d1473ecbebdd6767a052407"/><file name="Success.phtml" hash="cc8ae90a0d1473ecbebdd6767a052407"/></dir><file name="Success.php" hash="60fc3720de3d31488f5850e8e7c27a3e"/><file name="Form.php" hash="b10bbd2ac4230fb7b5b23163bba5497d"/><file name="Info.php" hash="6b2e8bc2cb50cd10921632d72d283e91"/><file name="Success.php" hash="60fc3720de3d31488f5850e8e7c27a3e"/><file name="Form.php" hash="b10bbd2ac4230fb7b5b23163bba5497d"/><file name="Info.php" hash="6b2e8bc2cb50cd10921632d72d283e91"/></dir><dir name="Helper"><file name="Data.php" hash="08f64400e4204040eced048d885fe3da"/><file name="Data.php" hash="08f64400e4204040eced048d885fe3da"/><file name="Data.php" hash="08f64400e4204040eced048d885fe3da"/></dir><dir name="Model"><dir name="Convert"><file name="Order.php" hash="10fb9abcee863b4a809cd46d39fa0121"/><file name="Quote.php" hash="371acecf7ee5300f3bf9f363ca2c6e39"/><file name="Order.php" hash="10fb9abcee863b4a809cd46d39fa0121"/><file name="Quote.php" hash="371acecf7ee5300f3bf9f363ca2c6e39"/><file name="Order.php" hash="10fb9abcee863b4a809cd46d39fa0121"/><file name="Quote.php" hash="371acecf7ee5300f3bf9f363ca2c6e39"/><file name="Order.php" hash="10fb9abcee863b4a809cd46d39fa0121"/><file name="Quote.php" hash="371acecf7ee5300f3bf9f363ca2c6e39"/></dir><file name="GerarRef.php" hash="a7e966a5dd1e47544cd8aaea3b460238"/><dir name="Mysql4"><file name="Setup.php" hash="da156d537188951a4f6eccc0adf96f06"/><file name="Setup.php" hash="da156d537188951a4f6eccc0adf96f06"/></dir><file name="PaymentAction.php" hash="d37848a985083e38e966ec081aa4c02b"/><file name="Process.php" hash="2b87cf9d04aa0614e67db0a08a3ad79a"/><file name="GerarRef.php" hash="a7e966a5dd1e47544cd8aaea3b460238"/><file name="PaymentAction.php" hash="d37848a985083e38e966ec081aa4c02b"/><file name="Process.php" hash="2b87cf9d04aa0614e67db0a08a3ad79a"/><file name="GerarRef.php" hash="a7e966a5dd1e47544cd8aaea3b460238"/><file name="PaymentAction.php" hash="d37848a985083e38e966ec081aa4c02b"/><file name="Process.php" hash="2b87cf9d04aa0614e67db0a08a3ad79a"/></dir><dir name="controllers"><file name="CallbackController.php" hash="2997ccbeeb97ac25a4abe1c93de5dbf0"/><file name="CallbackController.php" hash="2997ccbeeb97ac25a4abe1c93de5dbf0"/><file name="CallbackController.php" hash="2997ccbeeb97ac25a4abe1c93de5dbf0"/></dir><dir name="etc"><file name="config.xml" hash="a26dc9601525da5240794e32d9f0570d"/><file name="system.xml" hash="cef2c4e868da93fb756db6cec1ca254a"/><file name="config.xml" hash="a26dc9601525da5240794e32d9f0570d"/><file name="system.xml" hash="cef2c4e868da93fb756db6cec1ca254a"/><file name="config.xml" hash="a26dc9601525da5240794e32d9f0570d"/><file name="system.xml" hash="cef2c4e868da93fb756db6cec1ca254a"/></dir><dir name="sql"><dir name="multibanco_setup"><file name="mysql4-install-1.0.0.php" hash="9f00ec506a0a94d8863cf14e3673d9ef"/><file name="mysql4-install-1.0.0.php" hash="9f00ec506a0a94d8863cf14e3673d9ef"/><file name="mysql4-install-1.0.0.php" hash="9f00ec506a0a94d8863cf14e3673d9ef"/><file name="mysql4-install-1.0.0.php" hash="9f00ec506a0a94d8863cf14e3673d9ef"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Eupago_Multibanco.xml" hash="79392e90e1f4e79aa0362ea7957930c3"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="multibanco"><dir name="form"><file name="form.phtml" hash=""/><file name="mark.phtml" hash=""/></dir><dir name="info"><file name="info.phtml" hash=""/><dir name="pdf"><file name="info.phtml" hash=""/></dir></dir></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="template"><dir name="multibanco"><dir name="form"><file name="form.phtml" hash="a9bed52032750b6d5b01d09306f63cc1"/><file name="mark.phtml.phtml" hash=""/></dir><dir name="info"><file name="info.phtml" hash="fa6321e93aaf8d3849b6b5219a8b8987"/><dir name="pdf"><file name="info.phtml" hash="30d8927be3ac9f8ec898b21a58d1c574"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="multibanco"><dir name="checkout"><file name="success.phtml" hash="cc8ae90a0d1473ecbebdd6767a052407"/><file name="success.phtml" hash="cc8ae90a0d1473ecbebdd6767a052407"/><file name="success.phtml" hash="cc8ae90a0d1473ecbebdd6767a052407"/></dir><dir name="form"><file name="form.phtml" hash="a9bed52032750b6d5b01d09306f63cc1"/><file name="mark.phtml" hash="59b0d4028051a96a8c54d5b33b67c8fd"/><file name="form.phtml" hash="a9bed52032750b6d5b01d09306f63cc1"/><file name="mark.phtml" hash="59b0d4028051a96a8c54d5b33b67c8fd"/><file name="form.phtml" hash="a9bed52032750b6d5b01d09306f63cc1"/><file name="mark.phtml" hash="59b0d4028051a96a8c54d5b33b67c8fd"/></dir><dir name="info"><file name="info.phtml" hash="25cbb5cdd9211bf573c1323971eb6c08"/><file name="info.phtml" hash="25cbb5cdd9211bf573c1323971eb6c08"/><file name="info.phtml" hash="25cbb5cdd9211bf573c1323971eb6c08"/></dir></dir></dir><dir name="layout"><file name="multibanco.xml" hash="969c55bcef9cc469e66d53283a31c200"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="multibanco"><file name="eupagomultibanco.png" hash="0b8ff29352f558fc8e756339a337a885"/><file name="eupagomultibanco.png" hash="0b8ff29352f558fc8e756339a337a885"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="multibanco"><file name="eupagomultibanco.png" hash="0ca321915123d5a712fb2b4f6744278a"/><file name="mb_mark.gif" hash="bbfd7b49dc892a72a8a87d8d1ae3e4ee"/><file name="eupagomultibanco.png" hash="0ca321915123d5a712fb2b4f6744278a"/><file name="mb_mark.gif" hash="bbfd7b49dc892a72a8a87d8d1ae3e4ee"/></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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Eupago_MB</name>
4
+ <version>1.1.2</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Pagamento por Multibanco</summary>
10
+ <description>Permite pagamentos atrav&#xE9;s de refer&#xEA;ncias multibanco</description>
11
+ <notes>[EN] - re-orders and trasactions is now avaiable&#xD;
12
+ [PT] - novas funcionalidades : re-order e registo de transa&#xE7;&#xF5;es</notes>
13
+ <authors><author><name>Eupago</name><user>eupago</user><email>suporte@eupago.pt</email></author></authors>
14
+ <date>2016-12-02</date>
15
+ <time>18:43:37</time>
16
+ <contents><target name="magecommunity"><dir name="Eupago"><dir name="Multibanco"><dir name="Block"><dir name="Form"><file name="Multibanco.php" hash="a526f756cd407a159a5438efefa0d66f"/></dir><dir name="Info"><file name="Multibanco.php" hash="460f7315eecf5b43574eac9fd30844ac"/></dir><dir name="Onepage"><file name="Success.php" hash="9da0851f53a89abeb25602d3c94a2612"/></dir></dir><dir name="Model"><file name="Multibanco.php" hash="5f34211caaa4f2564d1213779de0e2bf"/><dir name="System"><dir name="Config"><file name="Template.php" hash="fd636ddfc0a57d9e904ceb913415398d"/></dir></dir></dir><dir name="controllers"><file name="CallbackController.php" hash="a4cd7c27de50d646c2778eefde1e2495"/></dir><dir name="etc"><file name="config.xml" hash="179d01bf0777fd0c2e4e49e86282abce"/><file name="system.xml" hash="f25b77b36ec9b9cddbbd4131b861bcd7"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Eupago_Multibanco.xml" hash="87ee673b7cd7ec1dbc44cf2a0ef0f0c3"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="eupago"><dir name="multibanco"><dir name="checkout"><file name="success.phtml" hash="65c0fbce628ecdb41855475826cbbc2b"/></dir><dir name="info"><file name="default.phtml" hash="a74d2e7e6bf4cc69995b6d513cd06859"/><file name="multibanco.phtml" hash="a502ada6767afe020486170e6243e086"/></dir></dir></dir></dir><dir name="layout"><file name="eupago_multibanco.xml" hash="e3fbf5f655164991b363b305e09b0953"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="eupago"><dir name="multibanco"><dir name="info"><file name="multibanco.phtml" hash="47d133c69fb6121b648037995c868740"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="eupago"><dir name="multibanco"><file name="eupago_mb_p.png" hash="6db08f88f1f4770337db63105a4f0f08"/><file name="multibanco_icon.png" hash="87425d6e05c42ae6780b16ca8379d97a"/></dir></dir></dir></dir></dir></dir></target></contents>
17
  <compatible/>
18
+ <dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies>
19
  </package>
skin/adminhtml/default/default/images/multibanco/eupagomultibanco.png DELETED
Binary file
skin/frontend/base/default/images/eupago/multibanco/eupago_mb_p.png ADDED
Binary file
skin/frontend/base/default/images/eupago/multibanco/multibanco_icon.png ADDED
Binary file
skin/frontend/base/default/images/multibanco/eupagomultibanco.png DELETED
Binary file
skin/frontend/base/default/images/multibanco/mb_mark.gif DELETED
Binary file