Eupago_MBWAY - Version 1.0.2

Version Notes

re-orders is now avaiable

Download this release

Release Info

Developer Eupago
Extension Eupago_MBWAY
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

Files changed (36) hide show
  1. app/code/community/Eupago/Mbway/Block/Form.php +0 -15
  2. app/code/community/Eupago/Mbway/Block/Form/Mbway.php +9 -0
  3. app/code/community/Eupago/Mbway/Block/Info.php +0 -29
  4. app/code/community/Eupago/Mbway/Block/Info/Mbway.php +32 -0
  5. app/code/community/Eupago/Mbway/Block/Onepage/Success.phtml +0 -126
  6. app/code/community/Eupago/Mbway/Block/Success.php +0 -12
  7. app/code/community/Eupago/Mbway/Helper/Data.php +0 -4
  8. app/code/community/Eupago/Mbway/Model/Convert/Order.php +0 -24
  9. app/code/community/Eupago/Mbway/Model/Convert/Quote.php +0 -20
  10. app/code/community/Eupago/Mbway/Model/GerarRef.php +0 -96
  11. app/code/community/Eupago/Mbway/Model/Mbway.php +193 -0
  12. app/code/community/Eupago/Mbway/Model/Mysql4/Setup.php +0 -5
  13. app/code/community/Eupago/Mbway/Model/PaymentAction.php +0 -44
  14. app/code/community/Eupago/Mbway/Model/Process.php +0 -139
  15. app/code/community/Eupago/Mbway/controllers/CallbackController.php +82 -57
  16. app/code/community/Eupago/Mbway/etc/config.xml +38 -158
  17. app/code/community/Eupago/Mbway/etc/system.xml +22 -94
  18. app/code/community/Eupago/Mbway/sql/mbway_setup/mysql4-install-1.0.0.php +0 -20
  19. app/design/adminhtml/default/default/template/eupago/mbway/form/mbway.phtml +11 -0
  20. app/design/adminhtml/default/default/template/eupago/mbway/info/mbway.phtml +9 -0
  21. app/design/adminhtml/default/default/template/mbway/form/form.phtml +0 -8
  22. app/design/adminhtml/default/default/template/mbway/form/mark.phtml +0 -3
  23. app/design/adminhtml/default/default/template/mbway/info/info.phtml +0 -21
  24. app/design/adminhtml/default/default/template/mbway/info/pdf/info.phtml +0 -5
  25. app/design/frontend/base/default/layout/mbway.xml +0 -15
  26. app/design/frontend/base/default/template/eupago/mbway/form/mbway.phtml +11 -0
  27. app/design/frontend/base/default/template/eupago/mbway/info/mbway.phtml +7 -0
  28. app/design/frontend/base/default/template/mbway/checkout/success.phtml +0 -123
  29. app/design/frontend/base/default/template/mbway/form/form.phtml +0 -18
  30. app/design/frontend/base/default/template/mbway/form/mark.phtml +0 -3
  31. app/design/frontend/base/default/template/mbway/info/info.phtml +0 -20
  32. app/etc/modules/Eupago_Mbway.xml +9 -6
  33. package.xml +13 -11
  34. skin/adminhtml/default/default/images/mbway/eupagombway.png +0 -0
  35. skin/frontend/base/default/images/mbway/eupagombway.png +0 -0
  36. skin/frontend/base/default/images/mbway/mb_mark.gif +0 -0
app/code/community/Eupago/Mbway/Block/Form.php DELETED
@@ -1,15 +0,0 @@
1
- <?php
2
- class Eupago_Mbway_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('mbway/form/mark.phtml');
9
-
10
- $this->setTemplate('mbway/form/form.phtml')
11
- ->setMethodLabelAfterHtml($mark->toHtml())
12
- ;
13
- parent::_construct();
14
- }
15
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Eupago/Mbway/Block/Form/Mbway.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Eupago_Mbway_Block_Form_Mbway extends Mage_Payment_Block_Form
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->setTemplate('eupago/mbway/form/mbway.phtml');
8
+ }
9
+ }
app/code/community/Eupago/Mbway/Block/Info.php DELETED
@@ -1,29 +0,0 @@
1
- <?php
2
- class Eupago_Mbway_Block_Info extends Mage_Payment_Block_Info
3
- {
4
- protected function _construct()
5
- {
6
- parent::_construct();
7
- $this->setTemplate('mbway/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('mbway/info/pdf/info.phtml');
27
- return $this->toHtml();
28
- }
29
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Eupago/Mbway/Block/Info/Mbway.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Eupago_Mbway_Block_Info_Mbway extends Mage_Payment_Block_Info
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->setTemplate('eupago/mbway/info/mbway.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 getMbwayData(){
20
+ $info = $this->getData('info');
21
+ $mbway_data = (Object)$info['additional_information'];
22
+ if (!($info instanceof Mage_Payment_Model_Info)) {
23
+ Mage::throwException($this->__('Can not retrieve payment info model object.'));
24
+ }
25
+ return $mbway_data;
26
+ }
27
+
28
+ public function getMethod()
29
+ {
30
+ return $this->getInfo()->getMethodInstance();
31
+ }
32
+ }
app/code/community/Eupago/Mbway/Block/Onepage/Success.phtml DELETED
@@ -1,126 +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_mbw_referencia FROM $sales_flat_order_payment WHERE parent_id=$order->entity_id");
74
- $referencia = $query->fetchColumn();
75
- $query = $conn->query("SELECT eupago_mbw_alias FROM $sales_flat_order_payment WHERE parent_id=$order->entity_id");
76
- $alias = $query->fetchColumn();
77
- $query = $conn->query("SELECT eupago_mbw_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
-
85
-
86
-
87
- <div align='center'>
88
-
89
- <table cellpadding="0" cellspacing="0" border="0" style="width: 370px; color:#666; background-color: #f1f1f1; height: 50px; margin: 10px 0; border: 0px solid #d70510;">
90
- <tbody><tr style=" font-size:small; border:0;">
91
- <td style="border: 0; padding:5px; margin:0; background-color: #D80410; color: #f1f1f1; text-align: center; font-size:small;" colspan="3">Pagamento por MB Way</td>
92
- </tr>
93
- <tr style=" font-size:small; border:0;">
94
- <td rowspan="4" style=" font-size:small;padding: 0px 15px;vertical-align: middle; border:0; "><img src="https://seguro.eupago.pt/repositorio/imagens/MBWay.png" style="margin-bottom: 0px; margin-right: 5px;"></td>
95
-
96
- </tr>
97
- <tr style=" font-size:small; border:0;">
98
- <td style="border:0; padding:10px 8px 0 8px;">N. Telefone:</td>
99
- <td style="border:0; padding:10px 8px 0 8px;"><?php echo $alias; ?></td>
100
- </tr>
101
- <tr style=" font-size:small; border:0;">
102
- <td style="border:0; padding:10px 8px 0 8px;">N. Pedido:</td>
103
- <td style="border:0; padding:10px 8px 0 8px;"><?php echo $referencia; ?></td>
104
- </tr>
105
- <tr style=" font-size:small; border:0;">
106
- <td style="border:0; padding:8px ; ">Valor:</td>
107
- <td style="border:0; padding:8px ;"><?php echo $valor; ?> </td>
108
- </tr>
109
- <tr>
110
- <td style="text-align:center;padding-top:5px; font-size: xx-small;border:0; border-top: 0px solid #ddd; background-color: #fff; color: #666" colspan="3">Foi enviado um pedido de pagamento para o seu smartphone.</td>
111
- </tr>
112
- </tbody>
113
- </table>
114
-
115
- </div>
116
-
117
-
118
-
119
- </p>
120
-
121
- <div class="buttons-set">
122
- <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>
123
- </div>
124
-
125
-
126
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Eupago/Mbway/Block/Success.php DELETED
@@ -1,12 +0,0 @@
1
- <?php
2
- class Eupago_Mbway_Block_Success extends Mage_Checkout_Block_Onepage_Success
3
- {
4
- protected function _construct()
5
- {
6
- parent::_construct();
7
- $this->setTemplate('/mbway/checkout/success.phtml');
8
- }
9
-
10
- }
11
-
12
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Eupago/Mbway/Helper/Data.php DELETED
@@ -1,4 +0,0 @@
1
- <?php
2
- class Eupago_Mbway_Helper_Data extends Mage_Core_Helper_Abstract
3
- {
4
- }
 
 
 
 
app/code/community/Eupago/Mbway/Model/Convert/Order.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- class Eupago_Mbway_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->setEupago_mbw_alias($payment->getEupago_mbw_alias())
17
- ->setEupago_mbw_referencia($payment->getEupago_mbw_referencia())
18
- ->setEupago_mbw_montante($payment->getEupago_mbw_montante());
19
-
20
- return $quotePayment;
21
- }
22
-
23
-
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Eupago/Mbway/Model/Convert/Quote.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
- class Eupago_Mbway_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->setEupago_mbw_alias($payment->getEupago_mbw_alias())
15
- ->setEupago_mbw_referencia($payment->getEupago_mbw_referencia())
16
- ->setEupago_mbw_montante($payment->getEupago_mbw_montante());
17
- return $orderPayment;
18
- }
19
-
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Eupago/Mbway/Model/GerarRef.php DELETED
@@ -1,96 +0,0 @@
1
- <?php
2
-
3
- class Eupago_Mbway_Model_GerarRef extends Mage_Payment_Model_Method_Abstract {
4
-
5
- protected $_code = 'mbway';
6
- protected $_paymentMethod = 'mbway';
7
- protected $_formBlockType = 'mbway/form';
8
- protected $_infoBlockType = 'mbway/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
- $_SESSION['alias'] = $data->alias;
33
- }
34
-
35
-
36
- public function validate() {
37
-
38
- parent::validate();
39
-
40
- $min = $this->getConfigData('min');
41
- $max = $this->getConfigData('max');
42
-
43
- if($min=="")
44
- $min='0';
45
- if($max=="")
46
- $max='9999.99';
47
-
48
- $paymentInfo = $this->getInfoInstance();
49
-
50
- if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
51
- $quote = $paymentInfo->getOrder();
52
- } else {
53
- $quote = $paymentInfo->getQuote();
54
- }
55
- $currency_code = $quote->getBaseCurrencyCode();
56
-
57
- if (!in_array($currency_code, $this->_allowCurrencyCode)) {
58
- Mage::throwException(Mage::helper('mbway')->__('A moeda selecionada (' . $currency_code . ') não é compatível com este meio de pagamento'));
59
- }
60
- $order_value = number_format($quote->getBaseGrandTotal(), 2, '.', '');
61
- if ($order_value < 1) {
62
- Mage::throwException(Mage::helper('mbway')->__('Impossível gerar referência MB para valores inferiores a 1 Euro.'));
63
- }
64
- if ($order_value >= 999999.99) {
65
- Mage::throwException(Mage::helper('mbway')->__('O valor excede o limite para pagamento na rede MB'));
66
- }
67
- $order_value = number_format($quote->getBaseGrandTotal(), 2, '.', '');
68
- if ($order_value < $min) {
69
- Mage::throwException(Mage::helper('mbway')->__('Meio de pagamento disponível para compras superiores a ' . $min . ' EUR .'));
70
- }
71
-
72
- if ($order_value > $max) {
73
- Mage::throwException(Mage::helper('mbway')->__('Meio de pagamento disponível para compras inferiores a ' . $max . ' EUR .'));
74
- }
75
-
76
- return $this;
77
- }
78
-
79
- public function getQuote() {
80
- if (empty($this->_quote)) {
81
- $this->_quote = $this->getCheckout()->getQuote();
82
- }
83
- return $this->_quote;
84
- }
85
-
86
- public function getCheckout() {
87
-
88
- if (empty($this->_checkout)) {
89
- $this->_checkout = Mage::getSingleton('checkout/session');
90
- }
91
-
92
-
93
- return $this->_checkout;
94
- }
95
-
96
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Eupago/Mbway/Model/Mbway.php ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ //http://excellencemagentoblog.com/blog/2012/05/01/magento-create-custom-payment-method-api-based/
4
+
5
+ class Eupago_Mbway_Model_Mbway extends Mage_Payment_Model_Method_Abstract{
6
+
7
+ protected $_code = 'mbway';
8
+
9
+ protected $_paymentMethod = 'eupago_mbway';
10
+
11
+ protected $_isGateway = true;
12
+
13
+ protected $_canAuthorize = true;
14
+
15
+ protected $_canCapture = true;
16
+
17
+ protected $_canCapturePartial = false;
18
+
19
+ protected $_canRefund = false;
20
+
21
+ protected $_canVoid = false;
22
+
23
+ protected $_canUseInternal = true;
24
+
25
+ protected $_canUseCheckout = true;
26
+
27
+ protected $_canUseForMultishipping = true;
28
+
29
+ protected $_canSaveCc = false; // WARNING: you cant keep card data unless you have PCI complience licence
30
+
31
+ protected $_formBlockType = 'mbway/form_mbway';
32
+
33
+ protected $_infoBlockType = 'mbway/info_mbway';
34
+
35
+ public function order(Varien_Object $payment, $amount)
36
+ {
37
+ $order = $payment->getOrder();
38
+ $alias = $payment->getAdditionalInformation('mbway_phone_number');
39
+
40
+ $result = $this->soapApiPedidoMBW($payment,$amount,$alias);
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('referencia'=>$result->referencia,'resposta'=>$result->resposta,'method'=>'MBWAY','alias'=>$result->alias));
48
+ $payment->setIsTransactionClosed(false);
49
+ $payment->setAdditionalInformation('pedido', $result->referencia);
50
+ $payment->setAdditionalInformation('valor', $result->valor);
51
+ }else{
52
+ $payment->setTransactionId(-1);
53
+ $payment->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS,array('error_cod'=>$result->estado,'error_description'=>$result->resposta));
54
+ $payment->setIsTransactionClosed(false);
55
+ $errorMsg = $result->resposta;
56
+ }
57
+ }
58
+
59
+ if(isset($errorMsg)){
60
+ Mage::log("pedido com erro: ".$errorMsg, null, 'eupago_mbway.log');
61
+ Mage::getSingleton('core/session')->addError($errorMsg);
62
+ Mage::throwException($errorMsg);
63
+ }
64
+
65
+ return $this;
66
+ }
67
+
68
+ public function capture(Varien_Object $payment)
69
+ {
70
+ if($payment->getMethod() != 'mbway')
71
+ return;
72
+
73
+ // vai á base de dados buscar todas as transaction desta encomenda
74
+ $collection = Mage::getModel('sales/order_payment_transaction')
75
+ ->getCollection()
76
+ ->addAttributeToFilter('order_id', array('eq' => $payment->getOrder()->getEntityId()))
77
+ ->addAttributeToFilter('txn_type', array('eq' => 'order'))
78
+ ->addPaymentIdFilter($payment->getId());
79
+
80
+ foreach($collection as $transaction){
81
+ $referencia = is_numeric($transaction->getTxnId()) ? $transaction->getTxnId() : null ;
82
+ }
83
+
84
+ if(!(isset($referencia) && $referencia != null)){
85
+ Mage::throwException("Não foi encontrado pedido Mbway");
86
+ }
87
+
88
+ $result = $this->soapApiInformacaoReferencia($referencia);
89
+
90
+ if($result == false) {
91
+ $errorMsg = $this->_getHelper()->__('Error Processing the request');
92
+ } else {
93
+ if($result->estado_referencia == 'paga' || $result->estado_referencia == 'transferida'){
94
+ // neste sistema altera logo para pago
95
+ $payment->setTransactionId($referencia."-capture");
96
+ $payment->setParentTransactionId($referencia);
97
+ $payment->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS,array('referencia'=>$referencia,'resposta'=>$result->resposta,'method'=>'MBWAY', "data de pagamento"=>$result->data_pagamento, "hora de pagamento"=>$result->hora_pagamento));
98
+ $payment->setIsTransactionClosed(true);
99
+ }else{
100
+ $errorMsg = "a referencia não se encontra paga";
101
+ }
102
+ }
103
+
104
+ if(isset($errorMsg)){
105
+ Mage::throwException($errorMsg);
106
+ }
107
+
108
+ return $this;
109
+ }
110
+
111
+
112
+ private function getSoapUrl(){
113
+ $version = 'eupagov5';
114
+ $chave = $this->getConfigData('chave');
115
+ $demo = explode("-",$chave);
116
+
117
+ if($demo[0] == 'demo'){
118
+ return 'https://replica.eupago.pt/replica.'.$version.'.wsdl';
119
+ }
120
+ return 'https://seguro.eupago.pt/'.$version.'.wsdl';
121
+ }
122
+
123
+
124
+ // faz pedido à eupago via SOAP Pagamento
125
+ private function soapApiPedidoMBW(Varien_Object $payment, $amount, $alias){
126
+
127
+ $order = $payment->getOrder();
128
+
129
+ $arraydados = array("chave" => $this->getConfigData('chave'), "valor" => $amount, "id" => $order->getIncrementId(), "alias"=>$alias);
130
+
131
+ $client = new SoapClient($this->getSoapUrl(), array('cache_wsdl' => WSDL_CACHE_NONE));// chamada do serviço SOAP
132
+
133
+ try {
134
+ $result = $client->pedidoMBW($arraydados);
135
+ }
136
+ catch (SoapFault $fault) {
137
+ Mage::throwException("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring}");
138
+ return false;
139
+ }
140
+
141
+ return $result;
142
+ }
143
+
144
+ // faz pedido à eupago para obter o estado da referencia
145
+ private function soapApiInformacaoReferencia($referencia){
146
+
147
+ $arraydados = array("chave" => $this->getConfigData('chave'), "referencia" => $referencia, "entidade" => "00000");
148
+
149
+ $client = new SoapClient($this->getSoapUrl(), array('cache_wsdl' => WSDL_CACHE_NONE));// chamada do serviço SOAP
150
+
151
+ try {
152
+ $result = $client->informacaoReferencia($arraydados);
153
+ }
154
+ catch (SoapFault $fault) {
155
+ Mage::throwException("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring}");
156
+ return false;
157
+ }
158
+
159
+ return $result;
160
+ }
161
+
162
+
163
+ public function assignData($data){
164
+ if (!($data instanceof Varien_Object)) {
165
+ $data = new Varien_Object($data);
166
+ }
167
+ $info = $this->getInfoInstance();
168
+ $info->setAdditionalInformation('mbway_phone_number', $data->getMbwayPhoneNumber());
169
+ //$info->setMbwayPhoneNumber($data->getMbwayPhoneNumber());
170
+
171
+ return $this;
172
+ }
173
+
174
+
175
+ public function validate(){
176
+ parent::validate();
177
+
178
+ $info = $this->getInfoInstance();
179
+ $no = $info->getAdditionalInformation('mbway_phone_number');
180
+
181
+ if(empty($no) || !is_numeric($no) || strlen ($no) != 9){
182
+ $errorCode = 'invalid_data';
183
+ $errorMsg = $this->_getHelper()->__('O campo Número Mbway parece ser inválido. Por favor verifique');
184
+ }
185
+
186
+ if(isset($errorMsg)){
187
+ Mage::throwException($errorMsg);
188
+ }
189
+
190
+ return $this;
191
+ }
192
+
193
+ }
app/code/community/Eupago/Mbway/Model/Mysql4/Setup.php DELETED
@@ -1,5 +0,0 @@
1
- <?php
2
- class Eupago_Mbway_Model_Mysql4_Setup extends Mage_Sales_Model_Mysql4_Setup
3
- {
4
-
5
- }
 
 
 
 
 
app/code/community/Eupago/Mbway/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_Mbway_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('mbway')->__('Order')
41
- ),
42
- );
43
- }
44
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Eupago/Mbway/Model/Process.php DELETED
@@ -1,139 +0,0 @@
1
- <?php
2
-
3
- class Eupago_Mbway_Model_Process extends Mage_Payment_Model_Method_Abstract {
4
-
5
- protected $_code = 'mbway';
6
- protected $_paymentMethod = 'mbway';
7
- protected $_formBlockType = 'mbway/form';
8
- protected $_infoBlockType = 'mbway/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
- $id = $observer->getEvent()->getOrder()->getIncrementId();
32
- $order_value = $observer->getEvent()->getOrder()->getGrandTotal();
33
- $entity = $observer->getEvent()->getOrder()->getId();
34
- $sales_flat_order_payment = Mage::getSingleton('core/resource')->getTableName('sales_flat_order_payment');
35
- $sales_flat_quote_payment = Mage::getSingleton('core/resource')->getTableName('sales_flat_quote_payment');
36
-
37
- $resource = Mage::getSingleton('core/resource');
38
- $writeConnection = $resource->getConnection('core_write');
39
- $quote_id = Mage::getSingleton('checkout/session')->getQuoteId();
40
-
41
- if ($quote_id != "") {
42
- $conn = Mage::getSingleton('core/resource')->getConnection('core_read');
43
- $query = $conn->query("SELECT eupago_mbw_referencia FROM $sales_flat_quote_payment WHERE quote_id =$quote_id");
44
- $referencia = $query->fetchColumn();
45
-
46
-
47
- if($chave_api){
48
- $demo = explode("-",$chave_api);
49
- if($demo['0']=='demo'){
50
- // $url = 'https://replica.eupago.pt/replica.eupagov3.wsdl';
51
- $url = 'http://replica.eupago.pt/replica.eupagov3_no_ssl.wsdl';
52
- }
53
- else {
54
- $url ='https://seguro.eupago.pt/eupagov3.wsdl';
55
- }
56
- }
57
-
58
-
59
- if ($referencia == "") {
60
- if(class_exists('SOAPClient')){
61
- $alias = $_SESSION['alias'];
62
- $arraydados = array("chave" => $chave_api, "valor" => $order_value, "id" => $id, "alias" => $alias); //cada canal tem a sua chave
63
- $client = @new SoapClient($url, array('cache_wsdl' => WSDL_CACHE_NONE)); // chamada do servi�o SOAP
64
- $result = $client->pedidoMBW($arraydados);
65
- if($result->estado == 0){
66
- $telefone = explode('#',$result->alias);
67
- $query = "UPDATE $sales_flat_order_payment SET eupago_mbw_montante = $order_value, eupago_mbw_alias = $telefone[1], eupago_mbw_referencia = $result->referencia WHERE parent_id =$entity";
68
- $query = "UPDATE $sales_flat_quote_payment SET eupago_mbw_montante = $order_value, eupago_mbw_alias = $telefone[1], eupago_mbw_referencia = $result->referencia WHERE quote_id =$quote_id";
69
- }else{
70
- // Mage::getSingleton('core/session')->addError('O número de telefone parece não estar associado ao MBWAY.. por favor tente novamente');
71
-
72
- if($result->estado == -9){
73
- Mage::throwException("O número de telefone parece não estar associado ao MBWAY.. por favor tente novamente");
74
- }else{
75
- $erro = $result->resposta;
76
- Mage::throwException($erro);
77
- }
78
- }
79
-
80
- }else{
81
- $client = new Varien_Http_Client();
82
- $client->setUri('https://replica.eupago.pt/bridge_clientes/bridge.php?servico=mb&chave_api='.$chave_api.'&valor='.$order_value.'&identificador='.$id)
83
- ->setMethod('GET')
84
- ->setConfig(array(
85
- 'maxredirects'=>1,
86
- 'timeout'=>30,
87
- ));
88
-
89
- $response = $client->request()->getBody();
90
- $dados = explode('#', $response);
91
- $alias = $dados['1']; // tenho de ver por aqui
92
- $referencia = $dados['2'];
93
- $query = "UPDATE $sales_flat_order_payment SET eupago_mbw_montante = $order_value, eupago_mbw_alias = $alias, eupago_mbw_referencia = $referencia WHERE parent_id =$entity";
94
- $query = "UPDATE $sales_flat_quote_payment SET eupago_mbw_montante = $order_value, eupago_mbw_alias = $alias, eupago_mbw_referencia = $referencia WHERE quote_id =$quote_id";
95
-
96
- }
97
-
98
-
99
- $writeConnection->query($query);
100
- $writeConnection->query($query);
101
- } else {
102
-
103
- $writeConnection = $resource->getConnection('core_write');
104
- $query = $conn->query("SELECT eupago_mbw_alias FROM $sales_flat_quote_payment WHERE quote_id =$quote_id");
105
- $alias = $query->fetchColumn();
106
- $query = $conn->query("SELECT eupago_mbw_montante FROM $sales_flat_quote_payment WHERE quote_id =$quote_id");
107
- $montante = $query->fetchColumn();
108
- $query = "UPDATE $sales_flat_order_payment SET eupago_mbw_montante = $montante, eupago_mbw_alias = $alias, eupago_mbw_referencia = $referencia WHERE parent_id =$entity";
109
- $writeConnection->query($query);
110
- $query = "UPDATE $sales_flat_quote_payment SET eupago_mbw_montante = $montante, eupago_mbw_alias = $alias, eupago_mbw_referencia = $referencia WHERE quote_id =$quote_id";
111
- $writeConnection->query($query);
112
- }
113
- }
114
-
115
-
116
-
117
- return;
118
- }
119
-
120
-
121
- /**
122
- * Get checkout session namespace
123
- *
124
- * @return Mage_Checkout_Model_Session
125
- */
126
- public function getCheckout() {
127
- return Mage::getSingleton('checkout/session');
128
- }
129
-
130
- /**
131
- * Get current quote
132
- *
133
- * @return Mage_Sales_Model_Quote
134
- */
135
- public function getQuote() {
136
- return $this->getCheckout()->getQuote();
137
- }
138
-
139
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Eupago/Mbway/controllers/CallbackController.php CHANGED
@@ -1,65 +1,90 @@
1
  <?php
 
 
 
 
 
2
 
3
- class Eupago_Mbway_CallbackController extends Mage_Core_Controller_Front_Action { // extends Mage_Payment_Model_Method_Abstract
4
 
5
- public function autorizeAction(){
6
-
7
-
8
- ///// dados vindos da api para comfirmar
9
- $CallBack = $this->getRequest()->getParams();
10
- $CallBack_valor = $CallBack['valor'];
11
- $CallBack_referencia = $CallBack['referencia'];
12
- $CallBack_chave_api = $CallBack['chave_api'];
13
- $CallBack_orderId = $CallBack['identificador'];
14
- $CallBack_autorizacao = $CallBack['autorizacao'];
15
- //$CallBack_autorizacao = $CallBack['mp'];
16
-
17
- //mp
18
- //pc:pt -> mbway
19
- //ps:pt -> payshop
20
- //mw:pt -> mbway
21
- //pq:pt -> pagaqui
22
-
23
- ////// dados de encomenda
24
- $OrderNumber = $CallBack_orderId; //$CallBack_orderId vaem da api Eupago[order-id]
25
- $order = Mage::getModel('sales/order')->load($OrderNumber, 'increment_id');
26
- $valor_encomenda = $order->grand_total; //retirado do valor total da encomenda
27
-
28
-
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  /////// dados do pagamento
31
- $pagamento = $order->getPayment();
32
- $entidade = $pagamento->eupago_entidade;
33
- $referencia = $pagamento->eupago_referencia;
34
- $valor_gerado = $pagamento->eupago_montante;
35
-
36
- /////// dados do pagamento MBW
37
- $pagamentoMBW = $order->getPayment();
38
- $alias = $pagamentoMBW->eupago_mbw_alias;
39
- $referenciaMBW = $pagamentoMBW->eupago_mbw_referencia;
40
- $valor_geradoMBW = $pagamentoMBW->eupago_mbw_montante;
41
-
42
 
43
- /////// gera autorizacao
44
- $chave_api = Mage::getModel('mbway/process')->getConfigData('chave');
45
- $autorizacao = md5(date('Y-m-d').$chave_api);
46
-
47
-
48
- //////// Confere dados
49
- $confere_montantes = (($valor_encomenda == $valor_geradoMBW) == $CallBack_valor ? true : false);
50
- $confere_autorizacao = ($autorizacao == $CallBack_autorizacao ? true : false);
51
- $confere_referencia = ($referenciaMBW == $CallBack_referencia ? true : false);
52
- $confere_chave_api = ($CallBack_chave_api == $chave_api ? true : false);
53
-
54
-
55
- ////// se tudo ok, faz o update do estado da encomenda e envia um email ao cliente
56
- if($confere_montantes && $confere_chave_api && $confere_referencia){ /*futuro upgrade -> $confere_autorizacao*/
57
- $order->setData('state', "complete");
58
- $order->setStatus("processing");
59
- $order->sendOrderUpdateEmail();
60
- $history = $order->addStatusHistoryComment('Order marked as complete automatically.', false);
61
- $history->setIsCustomerNotified(true);
62
- $order->save();
63
  }
 
 
64
  }
65
- }
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ /*
3
+ Mygateway Payment Controller
4
+ By: Junaid Bhura
5
+ www.junaidbhura.com
6
+ */
7
 
8
+ class Eupago_Mbway_CallbackController extends Mage_Core_Controller_Front_Action {
9
 
10
+ public function mbwayAction() {
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 != 'MBW:PT')
22
+ exit("método de pagamento inválido");
23
+
24
+ // valida chave API
25
+ if($callBack_params->chave_api != Mage::getStoreConfig('payment/mbway/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 MBWAY.', 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/Mbway/etc/config.xml CHANGED
@@ -1,173 +1,53 @@
1
  <?xml version="1.0"?>
2
  <config>
3
  <modules>
4
- <Eupago_Mbway>
5
- <version>1.0.0</version>
6
- </Eupago_Mbway>
7
  </modules>
8
- <frontend>
9
- <translate>
10
- <modules>
11
- <Eupago_Mbway>
12
- <files>
13
- <default>Eupago_Mbway.csv</default>
14
- </files>
15
- </Eupago_Mbway>
16
- </modules>
17
- </translate>
18
- <layout>
19
- <updates>
20
- <yourmodule>
21
- <file>mbway.xml</file>
22
- </yourmodule>
23
- </updates>
24
- </layout>
25
- <routers>
26
- <Eupago_Mbway>
27
- <use>standard</use>
28
- <args>
29
- <module>Eupago_Mbway</module>
30
- <frontName>Eupago</frontName>
31
- </args>
32
- </Eupago_Mbway>
33
- </routers>
34
- </frontend>
35
- <adminhtml>
36
- <translate>
37
- <modules>
38
- <Eupago_Mbway>
39
- <files>
40
- <default>Eupago_Mbway.csv</default>
41
- </files>
42
- </Eupago_Mbway>
43
- </modules>
44
- </translate>
45
- </adminhtml>
46
- <global>
47
- <fieldsets>
48
- <sales_convert_quote_payment>
49
- <eupago_mbw_alias>
50
- <to_order_payment>*</to_order_payment>
51
- </eupago_mbw_alias>
52
- <eupago_mbw_referencia>
53
- <to_order_payment>*</to_order_payment>
54
- </eupago_mbw_referencia>
55
- <eupago_mbw_montante>
56
- <to_order_payment>*</to_order_payment>
57
- </eupago_mbw_montante>
58
- </sales_convert_quote_payment>
59
-
60
- <sales_convert_order_payment>
61
- <eupago_mbw_alias>
62
- <to_quote_payment>*</to_quote_payment>
63
- </eupago_mbw_alias>
64
- <eupago_mbw_referencia>
65
- <to_quote_payment>*</to_quote_payment>
66
- </eupago_mbw_referencia>
67
- <eupago_mbw_montante>
68
- <to_quote_payment>*</to_quote_payment>
69
- </eupago_mbw_montante>
70
- </sales_convert_order_payment>
71
- </fieldsets>
72
  <models>
73
  <mbway>
74
  <class>Eupago_Mbway_Model</class>
75
- <resourceModel>mbway_mysql4</resourceModel>
76
  </mbway>
77
- <sales>
78
- <rewrite>
79
- <convert_order>Eupago_Mbway_Model_Convert_Order</convert_order>
80
- <convert_quote>Eupago_Mbway_Model_Convert_Quote</convert_quote>
81
- </rewrite>
82
- </sales>
83
- <mbway_mysql4>
84
- <class>Eupago_Mbway_Model_Mysql4</class>
85
- <entities>
86
- <mbway>
87
- <table>eupago</table>
88
- </mbway>
89
- </entities>
90
- </mbway_mysql4>
91
  </models>
92
- <resources>
93
- <mbway_setup>
94
- <setup>
95
- <module>Eupago_Mbway</module>
96
- <class>Eupago_Mbway_Model_Mysql4_Setup</class>
97
- </setup>
98
- <connection>
99
- <use>core_setup</use>
100
- </connection>
101
- </mbway_setup>
102
- <mbway_write>
103
- <connection>
104
- <use>core_write</use>
105
- </connection>
106
- </mbway_write>
107
- <mbway_read>
108
- <connection>
109
- <use>core_read</use>
110
- </connection>
111
- </mbway_read>
112
- </resources>
113
- <blocks>
114
- <mbway>
115
- <class>Eupago_Mbway_Block</class>
116
- </mbway>
117
- <checkout>
118
- <rewrite>
119
- <checkout_onepage_success>Eupago_Mbway_Block_Success</checkout_onepage_success>
120
- </rewrite>
121
- </checkout>
122
- </blocks>
123
- <helpers>
124
- <Eupago_Mbway>
125
- <class>Eupago_Mbway_Helper</class>
126
- </Eupago_Mbway>
127
- </helpers>
128
- <sales>
129
- <order>
130
- <statuses>
131
- <aguarda_pagamento_mbway translate="label">
132
- <label><![CDATA[MB - Aguarda Pagamento]]>
133
- </label>
134
- </aguarda_pagamento_mbway>
135
- </statuses>
136
- <states>
137
- <new>
138
- <statuses>
139
- <aguarda_pagamento_mbway/>
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>mbway/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
  <payment>
161
  <mbway>
162
- <active>0</active>
163
- <model>mbway/gerarRef</model>
164
- <title>Mbway</title>
165
- <sort_order>1</sort_order>
166
- <allowspecific>0</allowspecific>
167
- <chave></chave>
168
- <mensagem>Pagamentos por MBWAY</mensagem>
169
- <payment_action>order</payment_action>
 
170
  </mbway>
171
- </payment>
172
- </default>
173
  </config>
1
  <?xml version="1.0"?>
2
  <config>
3
  <modules>
4
+ <Eupago_Mbway>
5
+ <version>1.0.1</version>
6
+ </Eupago_Mbway>
7
  </modules>
8
+ <global>
9
+ <blocks>
10
+ <mbway>
11
+ <class>Eupago_Mbway_Block</class>
12
+ </mbway>
13
+ </blocks>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  <models>
15
  <mbway>
16
  <class>Eupago_Mbway_Model</class>
 
17
  </mbway>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  </models>
19
+ <fieldsets>
20
+ <sales_convert_quote_payment>
21
+ <mbway_phone_number>
22
+ <to_order_payment>*</to_order_payment>
23
+ </mbway_phone_number>
24
+ </sales_convert_quote_payment>
25
+ </fieldsets>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  </global>
27
+ <frontend>
28
+ <routers>
29
+ <Eupago_Mbway>
30
+ <use>standard</use>
31
+ <args>
32
+ <module>Eupago_Mbway</module>
33
+ <frontName>Eupago</frontName>
34
+ </args>
35
+ </Eupago_Mbway>
36
+ </routers>
37
+ </frontend>
38
  <default>
39
  <payment>
40
  <mbway>
41
+ <active>1</active>
42
+ <model>mbway/mbway</model>
43
+ <order_status>1</order_status>
44
+ <login backend_model="adminhtml/system_config_backend_encrypted"/>
45
+ <order_status>pending</order_status>
46
+ <title>Eupago Mbway</title>
47
+ <cgi_url>https://seguro.eupago.pt/eupagov5.wsdl</cgi_url>
48
+ <debug>0</debug>
49
+ <payment_action>order</payment_action>
50
  </mbway>
51
+ </payment>
52
+ </default>
53
  </config>
app/code/community/Eupago/Mbway/etc/system.xml CHANGED
@@ -1,125 +1,53 @@
1
  <?xml version="1.0"?>
2
  <config>
3
- <sections>
4
  <payment>
5
  <groups>
6
- <mbway translate="label" module="payment">
7
- <label><![CDATA[euPago - Pagamentos por MBWAY (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_new</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>mbway/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
  </mbway>
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
+ <mbway translate="label" module="paygate">
7
+ <label>Eupago Mbway</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>1</show_in_website>
37
  <show_in_store>1</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>6</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
  </fields>
49
  </mbway>
50
  </groups>
51
  </payment>
 
 
 
52
  </sections>
53
+ </config>
app/code/community/Eupago/Mbway/sql/mbway_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_mbw_alias', array('type'=>'varchar'));
6
- $installer->addAttribute('order_payment', 'eupago_mbw_referencia', array('type'=>'varchar'));
7
- $installer->addAttribute('order_payment', 'eupago_mbw_montante', array('type'=>'varchar'));
8
-
9
- $installer->addAttribute('quote_payment', 'eupago_mbw_alias', array('type'=>'varchar'));
10
- $installer->addAttribute('quote_payment', 'eupago_mbw_referencia', array('type'=>'varchar'));
11
- $installer->addAttribute('quote_payment', 'eupago_mbw_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_mbw_alias', 'VARCHAR(255) NOT NULL');
17
- $installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'), 'eupago_mbw_referencia', 'VARCHAR(255) NOT NULL');
18
- $installer->getConnection()->addColumn($installer->getTable('sales_flat_quote_payment'), 'eupago_mbw_montante', 'VARCHAR(255) NOT NULL');
19
- $installer->endSetup();
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/eupago/mbway/form/mbway.phtml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_code=$this->getMethodCode() ?>
2
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
3
+ <li>
4
+ <span class="input-box">
5
+ <label for="<?php echo $_code ?>_mbway_phone_number" class="required"><em>*</em><?php echo $this->__('Numero Mbway') ?></label>
6
+ <input type="text" title="<?php echo $this->__('Número Mbway:') ?>" class="input-text required-entry" id="<?php echo $_code ?>_mbway_phone_number" name="payment[mbway_phone_number]" value="<?php echo $this->htmlEscape($this->getInfoData('mbway_phone_number')) ?>" />
7
+ </span>
8
+ </li>
9
+ </ul>
10
+ <div>
11
+ <?php echo $this->getMethod()->getConfigData('message');?>
app/design/adminhtml/default/default/template/eupago/mbway/info/mbway.phtml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <ul id="payment_info_<?php echo $this->getMethodCode() ?>">
2
+ <li>
3
+ <h4>Mbway</h4>
4
+ <?php $mbway_data = $this->getMbwayData(); ?>
5
+ <?php echo $this->__('Nº Telefone: ').$mbway_data->mbway_phone_number."</br>" ?>
6
+ <?php echo $this->__('Nº Pedido: ').$mbway_data->pedido."</br>" ?>
7
+ <?php echo $this->__('Valor: ').number_format($mbway_data->valor,2)." EUR" ?>
8
+ </li>
9
+ </ul>
app/design/adminhtml/default/default/template/mbway/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/mbway/eupagombway.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/mbway/form/mark.phtml DELETED
@@ -1,3 +0,0 @@
1
- <!-- MB Logo -->
2
- <img src="<?php echo $this->getSkinUrl('images/mbway/mb_mark.gif') ?>" class="v-middle" />
3
- <!-- MB Logo -->
 
 
 
app/design/adminhtml/default/default/template/mbway/info/info.phtml DELETED
@@ -1,21 +0,0 @@
1
- <table border="0" cellspacing="1" cellpadding="0">
2
-
3
- <tr>
4
- <td><table width="100%" border="0" cellspacing="1" cellpadding="0">
5
- <tr style=" font-size:small; border:0;">
6
- <td rowspan="4" style=" font-size:small;padding: 0px 15px;vertical-align: middle; border:0; "><img src="https://seguro.eupago.pt/repositorio/imagens/MBWay.png" style="margin-bottom: 0px; margin-right: 5px;"></td>
7
- <tr>
8
- <td style="padding-right:5px;"><?php echo $this->__('<strong>Telefone:</strong>'); ?></td>
9
- <td style="padding-right:5px;"><?php echo $this->htmlEscape($this->getInfo()->getEupago_mbw_alias()) ?></td>
10
- </tr>
11
- <tr>
12
- <td style="padding-right:5px;"><?php echo $this->__('<strong>Referência:</strong>'); ?> </td>
13
- <td style="padding-right:5px;"><?php echo $this->htmlEscape($this->getInfo()->getEupago_mbw_referencia()); ?></td>
14
- </tr>
15
- <tr>
16
- <td style="padding-right:5px;"><?php echo $this->__('<strong>Montante:</strong>'); ?></td>
17
- <td style="padding-right:5px;"><?php echo number_format($this->htmlEscape($this->getInfo()->getEupago_mbw_montante()),'2',',','') . ' EUR'; ?></td>
18
- </tr>
19
- </table></td>
20
- </tr>
21
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/mbway/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/mbway.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>mbway/checkout/success.phtml</template></action>
11
- </reference>
12
- </reference>
13
- </checkout_onepage_success>
14
- </layout>
15
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/eupago/mbway/form/mbway.phtml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_code=$this->getMethodCode() ?>
2
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
3
+ <li>
4
+ <span class="input-box">
5
+ <label for="<?php echo $_code ?>_mbway_phone_number" class="required"><em>*</em><?php echo $this->__('Numero Mbway') ?></label>
6
+ <input type="text" title="<?php echo $this->__('Número Mbway:') ?>" class="input-text required-entry" id="<?php echo $_code ?>_mbway_phone_number" name="payment[mbway_phone_number]" value="<?php echo $this->htmlEscape($this->getInfoData('mbway_phone_number')) ?>" />
7
+ </span>
8
+ </li>
9
+ </ul>
10
+ <div>
11
+ <?php echo $this->getMethod()->getConfigData('message');?>
app/design/frontend/base/default/template/eupago/mbway/info/mbway.phtml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <ul id="payment_info_<?php echo $this->getMethodCode() ?>">
2
+ <li>
3
+ <h4>Mbway</h4>
4
+ <?php 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.') ?>
5
+ <!-- <p><?php //echo $this->__('Para saber mais acerca do mbway por favor clique ') ?><a target="blank" href="https://www.mbway.pt/">aqui</a></p> -->
6
+ </li>
7
+ </ul>
app/design/frontend/base/default/template/mbway/checkout/success.phtml DELETED
@@ -1,123 +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() == 'mbway') {
71
-
72
- $conn = Mage::getSingleton('core/resource')->getConnection('core_read');
73
- $query = $conn->query("SELECT eupago_mbw_referencia FROM $sales_flat_order_payment WHERE parent_id=$order->entity_id");
74
- $referencia = $query->fetchColumn();
75
- $query = $conn->query("SELECT eupago_mbw_alias FROM $sales_flat_order_payment WHERE parent_id=$order->entity_id");
76
- $alias = $query->fetchColumn();
77
- $query = $conn->query("SELECT eupago_mbw_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
-
85
-
86
-
87
- <div align='center'>
88
-
89
- <table cellpadding="0" cellspacing="0" border="0" style="width: 370px; color:#666; background-color: #f1f1f1; height: 50px; margin: 10px 0; border: 0px solid #d70510;">
90
- <tbody><tr style=" font-size:small; border:0;">
91
- <td style="border: 0; padding:5px; margin:0; background-color: #D80410; color: #f1f1f1; text-align: center; font-size:small;" colspan="3">Pagamento por MB Way</td>
92
- </tr>
93
- <tr style=" font-size:small; border:0;">
94
- <td rowspan="4" style=" font-size:small;padding: 0px 15px;vertical-align: middle; border:0; "><img src="https://seguro.eupago.pt/repositorio/imagens/MBWay.png" style="margin-bottom: 0px; margin-right: 5px;"></td>
95
-
96
- </tr>
97
- <tr style=" font-size:small; border:0;">
98
- <td style="border:0; padding:10px 8px 0 8px;">N. Telefone:</td>
99
- <td style="border:0; padding:10px 8px 0 8px;"><?php echo $alias; ?></td>
100
- </tr>
101
- <tr style=" font-size:small; border:0;">
102
- <td style="border:0; padding:10px 8px 0 8px;">N. Pedido:</td>
103
- <td style="border:0; padding:10px 8px 0 8px;"><?php echo $referencia; ?></td>
104
- </tr>
105
- <tr style=" font-size:small; border:0;">
106
- <td style="border:0; padding:8px ; ">Valor:</td>
107
- <td style="border:0; padding:8px ;"><?php echo $valor; ?> </td>
108
- </tr>
109
- <tr>
110
- <td style="text-align:center;padding-top:5px; font-size: xx-small;border:0; border-top: 0px solid #ddd; background-color: #fff; color: #666" colspan="3">Foi enviado um pedido de pagamento para o seu smartphone.</td>
111
- </tr>
112
- </tbody>
113
- </table>
114
-
115
- </div>
116
-
117
-
118
- <div class="buttons-set">
119
- <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>
120
- </div>
121
-
122
-
123
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/mbway/form/form.phtml DELETED
@@ -1,18 +0,0 @@
1
- <fieldset class="form-list">
2
- <ul id="payment_form_<?php echo $this->getMethodCode(); ?>" style="display:none">
3
- <table cellpadding="0" cellspacing="0" border="0" style="width: 370px; color:#666; background-color: #f1f1f1; height: 50px; margin: 10px 0; border: 0px solid #d70510;">
4
- <tr>
5
- <td style="border: 0; padding:5px; margin:0; background-color: #D80410; color: #f1f1f1; text-align: center; font-size:small;" colspan="3">Pagamento por MB Way</td>
6
- </tr>
7
- <tr>
8
- <td style="padding: 10px 10px 0 10px;"><label>Insira o número de telefone</label><input type="text" title="<?php echo $this->__('alias') ?>" name="payment[alias]" placeholder="Número de telefone" value="<?php echo $this->htmlEscape($this->getInfoData('alias')) ?>" required /></td>
9
- </tr>
10
- <tr>
11
- <td style="border: 0; padding:10px; margin:0; color: #666; font-size:small;">Se ainda não instalou a aplicação no smartphone ou ainda não aderiu ao serviço mbway, por favor consulte este <a target="_blank" href="https://www.mbway.pt/" >link</a>. </p></td>
12
- </tr>
13
- </table>
14
- </ul>
15
- </fieldset>
16
- <script>
17
-
18
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/mbway/form/mark.phtml DELETED
@@ -1,3 +0,0 @@
1
- <!-- MB Logo -->
2
- <img src="https://seguro.eupago.pt/repositorio/imagens/MBWay.png" style="margin-bottom: 0px; width: 40px; height: 20px; margin-right: 5px;" class="v-middle">
3
- <!-- MB Logo -->
 
 
 
app/design/frontend/base/default/template/mbway/info/info.phtml DELETED
@@ -1,20 +0,0 @@
1
-
2
-
3
-
4
- <?php if($_SESSION['alias'] == ""){
5
- echo '<div class="alert alert-danger" style="color: #a94442; background-color: #f2dede; border-color: #ebccd1; padding: 10px; width: 100%; display: block;">
6
- <strong>ALERTA!</strong> Por favor insira o número de telefone
7
- </div>';
8
- }else{
9
- echo '<img src="https://seguro.eupago.pt/repositorio/imagens/MBWay.png" class="v-middle">';
10
- }?>
11
-
12
-
13
- <!--<table cellpadding="0" cellspacing="0" border="0" style="width: 370px; color:#666; background-color: #f1f1f1; height: 50px; margin: 10px 0; border: 0px solid #d70510;">
14
- <tr>
15
- <td style="border: 0; padding:5px; margin:0; background-color: #D80410; color: #f1f1f1; text-align: center; font-size:small;" colspan="3">Pagamento por MB Way</td>
16
- </tr>
17
- <tr>
18
- <td style="border: 0; padding:10px; margin:0; color: #666; font-size:small;">Se ainda não instalou a aplicação no smartphone ou ainda não aderiu ao serviço mbway, por favor consulte este <a target="_blank" href="https://www.mbway.pt/" >link</a>. </p></td>
19
- </tr>
20
- </table>-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/etc/modules/Eupago_Mbway.xml CHANGED
@@ -1,9 +1,12 @@
1
  <?xml version="1.0"?>
2
  <config>
3
- <modules>
4
- <Eupago_Mbway>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- </Eupago_Mbway>
8
- </modules>
 
 
 
9
  </config>
1
  <?xml version="1.0"?>
2
  <config>
3
+ <modules>
4
+ <Eupago_Mbway>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Payment />
9
+ </depends>
10
+ </Eupago_Mbway>
11
+ </modules>
12
  </config>
package.xml CHANGED
@@ -1,19 +1,21 @@
1
  <?xml version="1.0"?>
2
  <package>
3
- <name>Eupago_MBWAY</name>
4
- <version>1.0.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 para MBWAY</summary>
10
- <description>M&#xE9;todo de pagamento para MBWAY</description>
11
- <notes>- Order automatic update&#xD;
12
- - callback</notes>
13
- <authors><author><name>euPago</name><user>euPago</user><email>dev@eupago.pt</email></author></authors>
14
- <date>2016-02-09</date>
15
- <time>17:09:25</time>
16
- <contents><target name="magecommunity"><dir name="Eupago"><dir name="Mbway"><dir name="Block"><file name="Form.php" hash="457132b29be361ff58808f896bbcd51a"/><file name="Info.php" hash="47d3ac60276c028e5e207c87ab5f8fca"/><dir name="Onepage"><file name="Success.phtml" hash="08fa78dfdbc11b7fd25b5f0bc5e5f117"/><file name="Success.phtml" hash="08fa78dfdbc11b7fd25b5f0bc5e5f117"/><file name="Success.phtml" hash="08fa78dfdbc11b7fd25b5f0bc5e5f117"/></dir><file name="Success.php" hash="a9908a23e6c7987e63f420dec16610a8"/><file name="Form.php" hash="457132b29be361ff58808f896bbcd51a"/><file name="Info.php" hash="47d3ac60276c028e5e207c87ab5f8fca"/><file name="Success.php" hash="a9908a23e6c7987e63f420dec16610a8"/><file name="Form.php" hash="457132b29be361ff58808f896bbcd51a"/><file name="Info.php" hash="47d3ac60276c028e5e207c87ab5f8fca"/><file name="Success.php" hash="a9908a23e6c7987e63f420dec16610a8"/><file name="Form.php" hash="457132b29be361ff58808f896bbcd51a"/><file name="Info.php" hash="47d3ac60276c028e5e207c87ab5f8fca"/></dir><dir name="Helper"><file name="Data.php" hash="42b48d62c5c77cd4d511c12c8743b461"/><file name="Data.php" hash="42b48d62c5c77cd4d511c12c8743b461"/><file name="Data.php" hash="42b48d62c5c77cd4d511c12c8743b461"/><file name="Data.php" hash="42b48d62c5c77cd4d511c12c8743b461"/></dir><dir name="Model"><dir name="Convert"><file name="Order.php" hash="dcabdd5c4cbe88508a65148af27a676f"/><file name="Quote.php" hash="110590303af75aa88aa1b3f630421c4f"/><file name="Order.php" hash="dcabdd5c4cbe88508a65148af27a676f"/><file name="Quote.php" hash="110590303af75aa88aa1b3f630421c4f"/><file name="Order.php" hash="dcabdd5c4cbe88508a65148af27a676f"/><file name="Quote.php" hash="110590303af75aa88aa1b3f630421c4f"/><file name="Order.php" hash="dcabdd5c4cbe88508a65148af27a676f"/><file name="Quote.php" hash="110590303af75aa88aa1b3f630421c4f"/><file name="Order.php" hash="dcabdd5c4cbe88508a65148af27a676f"/><file name="Quote.php" hash="110590303af75aa88aa1b3f630421c4f"/></dir><file name="GerarRef.php" hash="14251d34e77c9d6910237da24e942b79"/><dir name="Mysql4"><file name="Setup.php" hash="01c41be63649dd0d1f4ab113ecbc7997"/><file name="Setup.php" hash="01c41be63649dd0d1f4ab113ecbc7997"/><file name="Setup.php" hash="01c41be63649dd0d1f4ab113ecbc7997"/></dir><file name="PaymentAction.php" hash="6306b0a94106f6a461e2ac477518a891"/><file name="Process.php" hash="67d83962812fa838bc78042acc10bf91"/><file name="GerarRef.php" hash="14251d34e77c9d6910237da24e942b79"/><file name="PaymentAction.php" hash="6306b0a94106f6a461e2ac477518a891"/><file name="Process.php" hash="67d83962812fa838bc78042acc10bf91"/><file name="GerarRef.php" hash="14251d34e77c9d6910237da24e942b79"/><file name="PaymentAction.php" hash="6306b0a94106f6a461e2ac477518a891"/><file name="Process.php" hash="67d83962812fa838bc78042acc10bf91"/><file name="GerarRef.php" hash="14251d34e77c9d6910237da24e942b79"/><file name="PaymentAction.php" hash="6306b0a94106f6a461e2ac477518a891"/><file name="Process.php" hash="67d83962812fa838bc78042acc10bf91"/><dir name="Mysgl4"><file name="Setup.php" hash=""/></dir></dir><dir name="controllers"><file name="CallbackController.php" hash="2f9bcf94d35be8d23be571265a068b58"/><file name="CallbackController.php" hash="2f9bcf94d35be8d23be571265a068b58"/><file name="CallbackController.php" hash="2f9bcf94d35be8d23be571265a068b58"/><file name="CallbackController.php" hash="2f9bcf94d35be8d23be571265a068b58"/></dir><dir name="etc"><file name="config.xml" hash="311886de7d89f451650f42af2e1a6932"/><file name="system.xml" hash="9ed7bc7fbcdd13fb87169fa7e582537f"/><file name="config.xml" hash="311886de7d89f451650f42af2e1a6932"/><file name="system.xml" hash="9ed7bc7fbcdd13fb87169fa7e582537f"/><file name="config.xml" hash="311886de7d89f451650f42af2e1a6932"/><file name="system.xml" hash="9ed7bc7fbcdd13fb87169fa7e582537f"/><file name="config.xml" hash="311886de7d89f451650f42af2e1a6932"/><file name="system.xml" hash="9ed7bc7fbcdd13fb87169fa7e582537f"/></dir><dir name="sql"><dir name="mbway_setup"><file name="mysql4-install-1.0.0.php" hash="88957e805ec4b644f266271fe07114db"/><file name="mysql4-install-1.0.0.php" hash="88957e805ec4b644f266271fe07114db"/><file name="mysql4-install-1.0.0.php" hash="88957e805ec4b644f266271fe07114db"/><file name="mysql4-install-1.0.0.php" hash="88957e805ec4b644f266271fe07114db"/><file name="mysql4-install-1.0.0.php" hash="88957e805ec4b644f266271fe07114db"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Eupago_Mbway.xml" hash="c37793843e7666d45c6b5fa692007746"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="mbway"><dir name="form"><file name="form.phtml" hash="6c316b9faa97227b78230c22f3ae991b"/><file name="mark.phtml" hash="f013b5347041ada0961252129b44127a"/><file name="form.phtml" hash="6c316b9faa97227b78230c22f3ae991b"/><file name="mark.phtml" hash="f013b5347041ada0961252129b44127a"/><file name="form.phtml" hash="6c316b9faa97227b78230c22f3ae991b"/><file name="mark.phtml" hash="f013b5347041ada0961252129b44127a"/></dir><dir name="info"><file name="info.phtml" hash="d0af4f680c201f7d79813ac08df93683"/><dir name="pdf"><file name="info.phtml" hash="30d8927be3ac9f8ec898b21a58d1c574"/><file name="info.phtml" hash="30d8927be3ac9f8ec898b21a58d1c574"/><file name="info.phtml" hash="30d8927be3ac9f8ec898b21a58d1c574"/><file name="info.phtml" hash="30d8927be3ac9f8ec898b21a58d1c574"/></dir><file name="info.phtml" hash="d0af4f680c201f7d79813ac08df93683"/><file name="info.phtml" hash="d0af4f680c201f7d79813ac08df93683"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="mbway"><dir name="checkout"><file name="success.phtml" hash="f0793610fb7183301f0784fb128ec057"/><file name="success.phtml" hash="f0793610fb7183301f0784fb128ec057"/><file name="success.phtml" hash="f0793610fb7183301f0784fb128ec057"/></dir><dir name="form"><file name="form.phtml" hash="e5eefe077cf0e24992c1c347dc77baf1"/><file name="mark.phtml" hash="a5c4ad861ceaa58b07266fcfd9393ca8"/><file name="form.phtml" hash="e5eefe077cf0e24992c1c347dc77baf1"/><file name="mark.phtml" hash="a5c4ad861ceaa58b07266fcfd9393ca8"/><file name="form.phtml" hash="e5eefe077cf0e24992c1c347dc77baf1"/><file name="mark.phtml" hash="a5c4ad861ceaa58b07266fcfd9393ca8"/></dir><dir name="info"><file name="info.phtml" hash="d67bc540251df859b325dc903cf5815a"/><file name="info.phtml" hash="d67bc540251df859b325dc903cf5815a"/><file name="info.phtml" hash="d67bc540251df859b325dc903cf5815a"/></dir></dir></dir><dir name="layout"><file name="mbway.xml" hash="3abe3cd742f4651a49b5f9bdb986a59e"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="mbway"><file name="eupagombway.png" hash="0b8ff29352f558fc8e756339a337a885"/><file name="eupagombway.png" hash="0b8ff29352f558fc8e756339a337a885"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="mbway"><file name="eupagombway.png" hash="0ca321915123d5a712fb2b4f6744278a"/><file name="mb_mark.gif" hash="bbfd7b49dc892a72a8a87d8d1ae3e4ee"/><file name="eupagombway.png" hash="0ca321915123d5a712fb2b4f6744278a"/><file name="mb_mark.gif" hash="bbfd7b49dc892a72a8a87d8d1ae3e4ee"/></dir></dir></dir></dir></dir></target></contents>
 
 
17
  <compatible/>
18
- <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
+ <name>Eupago_Mbway</name>
4
+ <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Pagamento por Mbway</summary>
10
+ <description>[PT] - Permite pagamentos atrav&#xE9;s da app mbway&#xD;
11
+ &#xD;
12
+ [EN] - Allow payments by mbway app&#xD;
13
+ </description>
14
+ <notes>re-orders is now avaiable</notes>
15
+ <authors><author><name>Eupago</name><user>eupago</user><email>suporte@eupago.pt</email></author></authors>
16
+ <date>2016-11-14</date>
17
+ <time>16:38:49</time>
18
+ <contents><target name="magecommunity"><dir name="Eupago"><dir name="Mbway"><dir name="Block"><dir name="Form"><file name="Mbway.php" hash="27853132998649907104c43546563bac"/></dir><dir name="Info"><file name="Mbway.php" hash="f9f3c4bc85505be3abcbe31011f68cda"/></dir></dir><dir name="Model"><file name="Mbway.php" hash="4feb7fb37bb9a008c7fd427ed5a3c9af"/></dir><dir name="controllers"><file name="CallbackController.php" hash="162e06ac5e37ae219b2ad83ff3fb38e9"/></dir><dir name="etc"><file name="config.xml" hash="4b38c359f8d9a900dc1a78c1b9ce0185"/><file name="system.xml" hash="c44f0320187747999a57205ee2e76b9d"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Eupago_Mbway.xml" hash="1a844093c055d916fc3cc16fa9c86f64"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="eupago"><dir name="mbway"><dir name="form"><file name="mbway.phtml" hash="1fa44aab0a61a78c9a2abf4604264db2"/></dir><dir name="info"><file name="mbway.phtml" hash="2ed70855f58e82278d303695d5194695"/></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="eupago"><dir name="mbway"><dir name="form"><file name="mbway.phtml" hash="1fa44aab0a61a78c9a2abf4604264db2"/></dir><dir name="info"><file name="mbway.phtml" hash="2486d82ad350cd29d0640ba8799280c0"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
19
  <compatible/>
20
+ <dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies>
21
  </package>
skin/adminhtml/default/default/images/mbway/eupagombway.png DELETED
Binary file
skin/frontend/base/default/images/mbway/eupagombway.png DELETED
Binary file
skin/frontend/base/default/images/mbway/mb_mark.gif DELETED
Binary file