Tigo_Tmoney - Version 0.1.0

Version Notes

test

Download this release

Release Info

Developer Marcelo Guevara
Extension Tigo_Tmoney
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

Files changed (35) hide show
  1. app/code/local/Tigo/Tmoney/Block/Back.php +23 -0
  2. app/code/local/Tigo/Tmoney/Block/Error.php +23 -0
  3. app/code/local/Tigo/Tmoney/Block/Form.php +25 -0
  4. app/code/local/Tigo/Tmoney/Block/Info.php +38 -0
  5. app/code/local/Tigo/Tmoney/Block/Pagepaymod.php +9 -0
  6. app/code/local/Tigo/Tmoney/Block/Redirect.php +32 -0
  7. app/code/local/Tigo/Tmoney/Block/Success.php +23 -0
  8. app/code/local/Tigo/Tmoney/Helper/Checkout.php +66 -0
  9. app/code/local/Tigo/Tmoney/Helper/Data.php +5 -0
  10. app/code/local/Tigo/Tmoney/Model/Paymethod.php +268 -0
  11. app/code/local/Tigo/Tmoney/controllers/IndexController.php +104 -0
  12. app/code/local/Tigo/Tmoney/etc/config.xml +89 -0
  13. app/code/local/Tigo/Tmoney/etc/system.xml +76 -0
  14. app/code/local/Tigo/Tmoney/sql/tmoney_setup/mysql4-install-0.1.0.php +73 -0
  15. app/design/frontend/base/default/layout/tigo_tmoney.xml +42 -0
  16. app/design/frontend/base/default/template/tigo/tmoney/back.phtml +18 -0
  17. app/design/frontend/base/default/template/tigo/tmoney/error.phtml +18 -0
  18. app/design/frontend/base/default/template/tigo/tmoney/form.phtml +40 -0
  19. app/design/frontend/base/default/template/tigo/tmoney/paymod.phtml +2 -0
  20. app/design/frontend/base/default/template/tigo/tmoney/success.phtml +18 -0
  21. app/etc/modules/Tigo_Tmoney.xml +12 -0
  22. package.xml +18 -0
  23. skin/frontend/base/default/tmoney/css/tigomoney.css +82 -0
  24. skin/frontend/base/default/tmoney/css/tigomoney.css.map +7 -0
  25. skin/frontend/base/default/tmoney/img/MasterCard_Logo.svg.png +0 -0
  26. skin/frontend/base/default/tmoney/img/Visa.svg.png +0 -0
  27. skin/frontend/base/default/tmoney/img/Visa_Mastercard.png +0 -0
  28. skin/frontend/base/default/tmoney/img/delete-icon.jpg +0 -0
  29. skin/frontend/base/default/tmoney/img/error.png +0 -0
  30. skin/frontend/base/default/tmoney/img/row-bottom.png +0 -0
  31. skin/frontend/base/default/tmoney/img/row-left.png +0 -0
  32. skin/frontend/base/default/tmoney/img/success.png +0 -0
  33. skin/frontend/base/default/tmoney/img/tigomoney-phone.png +0 -0
  34. skin/frontend/base/default/tmoney/img/visa_mastercard.jpg +0 -0
  35. skin/frontend/base/default/tmoney/scss/tigomoney.scss +98 -0
app/code/local/Tigo/Tmoney/Block/Back.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Tigo_Tmoney_Block_Back extends Mage_Core_Block_Template{
3
+ protected $_methodCode = 'tmoney';
4
+
5
+ protected function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->setTemplate('tigo/tmoney/back.phtml');
9
+ }
10
+ public function validate(){
11
+ $response = array();
12
+
13
+ try{
14
+ $resp = Mage::app()->getRequest()->getParam('r');//(isset($_REQUEST['r']))? $_REQUEST['r'] : '';
15
+ $excep = Mage::app()->getRequest()->getParam('e');//(isset($_REQUEST['e']))? $_REQUEST['e'] : '';
16
+ $tigomoney = Mage::getModel('tmoney/paymethod');
17
+ $response = $tigomoney->tigoverify($resp, $excep);
18
+ } catch (Exception $ex){
19
+ Mage::Log('Error validate status Error page(Block): '.$ex->getMessage(), null, 'tigobusiness-tigomoney.log');
20
+ }
21
+ return $response;
22
+ }
23
+ }
app/code/local/Tigo/Tmoney/Block/Error.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Tigobusiness_Tigomoneyb_Block_Error extends Mage_Core_Block_Template{
3
+ protected $_methodCode = 'tmoney';
4
+
5
+ protected function _construct() {
6
+ parent::_construct();
7
+ $this->setTemplate('tigo_tmoney/error.phtml');
8
+ }
9
+
10
+ public function validate(){
11
+ $response = array();
12
+
13
+ try{
14
+ $resp = Mage::app()->getRequest()->getParam('r');//(isset($_REQUEST['r']))? $_REQUEST['r'] : '';
15
+ $excep = Mage::app()->getRequest()->getParam('e');//(isset($_REQUEST['e']))? $_REQUEST['e'] : '';
16
+ $tigomoney = Mage::getModel('tmoney/paymethod');
17
+ $response = $tigomoney->tigoverify($resp, $excep);
18
+ } catch (Exception $ex){
19
+ Mage::Log('Error validate status Error page(Block): '.$ex->getMessage(), null, 'tigobusiness-tigomoney.log');
20
+ }
21
+ return $response;
22
+ }
23
+ }
app/code/local/Tigo/Tmoney/Block/Form.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Tigo_Tmoney_Block_Form extends Mage_Payment_Block_Form{
3
+ protected $_methodCode = 'tmoney';
4
+ protected $_config;
5
+
6
+ protected function _construct(){
7
+ parent::_construct();
8
+ $this->setTemplate('tigo/tmoney/form.phtml');
9
+ }
10
+ public function getCCTypes(){
11
+ return array('VI'=>'Visa', 'MC'=> 'MasterCard');
12
+ }
13
+
14
+ public function getMethodCode(){
15
+ return $this->_methodCode;
16
+ }
17
+
18
+ public function getMessage(){
19
+ return $this->getMethod()->getConfigData('message');
20
+ }
21
+ public function addItem($type, $path){
22
+ $head = $this->getLayout()->getBlock('head');
23
+ return $type == 'css' ? $head->addCss($path) : $type == 'javascript' ? $head->addJs($path) : $this ;
24
+ }
25
+ }
app/code/local/Tigo/Tmoney/Block/Info.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Tigo_Tmoney_Block_Info extends Mage_Payment_Block_Info_Cc{
3
+
4
+ protected function _prepareSpecificInformation($transport = null){
5
+ if (null !== $this->_paymentSpecificInformation) {
6
+ return $this->_paymentSpecificInformation;
7
+ }
8
+ $info = $this->getInfo();
9
+ $transport = new Varien_Object();
10
+ $transport = parent::_prepareSpecificInformation($transport);
11
+ $transport->addData(array(
12
+ 'test'=>'test'
13
+ ));
14
+ return $transport;
15
+ }
16
+ /*protected function _prepareSpecificInformation($transport = null)
17
+ {
18
+ if (null !== $this->_paymentSpecificInformation) {
19
+ return $this->_paymentSpecificInformation;
20
+ }
21
+ $info = $this->getInfo();
22
+ //print_r($info);
23
+ $transport = new Varien_Object();
24
+ $transport = parent::_prepareSpecificInformation($transport);
25
+ $transport->addData(array('test'=>'test'));
26
+ return $transport;
27
+ }
28
+ /*
29
+ protected function _prepareSpecificInformation($transport = null)
30
+ {
31
+
32
+ $transport = parent::_prepareSpecificInformation($transport);
33
+ $data = array();
34
+ $data['name'] = 'tester';
35
+ return $transport->setData(array_merge($data, $transport->getData()));
36
+ }
37
+ */
38
+ }
app/code/local/Tigo/Tmoney/Block/Pagepaymod.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Tigo_Tmoney_Block_Pagepaymod extends Mage_Core_Block_Template{
3
+ protected $_methodCode = 'tmoney';
4
+
5
+ protected function _construct(){
6
+ parent::_construct();
7
+ $this->setTemplate('tigo/tmoney/paymod.phtml');
8
+ }
9
+ }
app/code/local/Tigo/Tmoney/Block/Redirect.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Tigo_Tmoney_Block_Redirect extends Mage_Core_Block_Abstract
3
+ {
4
+ protected function _toHtml()
5
+ {
6
+ $standard = Mage::getModel('paypal/standard');
7
+
8
+ $form = new Varien_Data_Form();
9
+ $form->setAction($standard->getConfig()->getPaypalUrl())
10
+ ->setId('paypal_standard_checkout')
11
+ ->setName('paypal_standard_checkout')
12
+ ->setMethod('POST')
13
+ ->setUseContainer(true);
14
+ foreach ($standard->getStandardCheckoutFormFields() as $field=>$value) {
15
+ $form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value));
16
+ }
17
+ $idSuffix = Mage::helper('core')->uniqHash();
18
+ $submitButton = new Varien_Data_Form_Element_Submit(array(
19
+ 'value' => $this->__('Click here if you are not redirected within 10 seconds...'),
20
+ ));
21
+ $id = "submit_to_paypal_button_{$idSuffix}";
22
+ $submitButton->setId($id);
23
+ $form->addElement($submitButton);
24
+ $html = '<html><body>';
25
+ $html.= $this->__('You will be redirected to the PayPal website in a few seconds.');
26
+ $html.= $form->toHtml();
27
+ $html.= '<script type="text/javascript">document.getElementById("paypal_standard_checkout").submit();</script>';
28
+ $html.= '</body></html>';
29
+
30
+ return $html;
31
+ }
32
+ }
app/code/local/Tigo/Tmoney/Block/Success.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Tigo_Tmoney_Block_Success extends Mage_Core_Block_Template{
3
+ protected $_methodCode = 'tmoney';
4
+
5
+ protected function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->setTemplate('tigo/tmoney/success.phtml');
9
+ }
10
+ public function validate(){
11
+ $response = array();
12
+
13
+ try{
14
+ $resp = Mage::app()->getRequest()->getParam('r');//(isset($_REQUEST['r']))? $_REQUEST['r'] : '';
15
+ $excep = Mage::app()->getRequest()->getParam('e');//(isset($_REQUEST['e']))? $_REQUEST['e'] : '';
16
+ $tigomoney = Mage::getModel('tmoney/paymethod');
17
+ $response = $tigomoney->tigoverify($resp, $excep);
18
+ } catch (Exception $ex){
19
+ Mage::Log('Error validate status Error page(Block): '.$ex->getMessage(), null, 'tigobusiness-tigomoney.log');
20
+ }
21
+ return $response;
22
+ }
23
+ }
app/code/local/Tigo/Tmoney/Helper/Checkout.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Checkout workflow helper
4
+ */
5
+ class Tigo_Tmoney_Helper_Checkout extends Mage_Core_Helper_Abstract
6
+ {
7
+ /**
8
+ * Restore last active quote based on checkout session
9
+ *
10
+ * @return bool True if quote restored successfully, false otherwise
11
+ */
12
+ public function restoreQuote()
13
+ {
14
+ $order = $this->_getCheckoutSession()->getLastRealOrder();
15
+ if ($order->getId()) {
16
+ $quote = $this->_getQuote($order->getQuoteId());
17
+ if ($quote->getId()) {
18
+ $quote->setIsActive(1)
19
+ ->setReservedOrderId(null)
20
+ ->save();
21
+ $this->_getCheckoutSession()
22
+ ->replaceQuote($quote)
23
+ ->unsLastRealOrderId();
24
+ return true;
25
+ }
26
+ }
27
+ return false;
28
+ }
29
+
30
+ /**
31
+ * Cancel last placed order with specified comment message
32
+ *
33
+ * @param string $comment Comment appended to order history
34
+ * @return bool True if order cancelled, false otherwise
35
+ */
36
+ public function cancelCurrentOrder($comment)
37
+ {
38
+ $order = $this->_getCheckoutSession()->getLastRealOrder();
39
+ if ($order->getId() && $order->getState() != Mage_Sales_Model_Order::STATE_CANCELED) {
40
+ $order->registerCancellation($comment)->save();
41
+ return true;
42
+ }
43
+ return false;
44
+ }
45
+
46
+ /**
47
+ * Return checkout session instance
48
+ *
49
+ * @return Mage_Checkout_Model_Session
50
+ */
51
+ protected function _getCheckoutSession()
52
+ {
53
+ return Mage::getSingleton('checkout/session');
54
+ }
55
+
56
+ /**
57
+ * Return sales quote instance for specified ID
58
+ *
59
+ * @param int $quoteId Quote identifier
60
+ * @return Mage_Sales_Model_Quote
61
+ */
62
+ protected function _getQuote($quoteId)
63
+ {
64
+ return Mage::getModel('sales/quote')->load($quoteId);
65
+ }
66
+ }
app/code/local/Tigo/Tmoney/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Tigo_Tmoney_Helper_Data extends Mage_Core_Helper_Abstract{
4
+
5
+ }
app/code/local/Tigo/Tmoney/Model/Paymethod.php ADDED
@@ -0,0 +1,268 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Module: TIGO Money
4
+ * Author: Marcelo Guevara
5
+ * Email: marcelo.guevara@connaxis.com
6
+ * Skype: connaxis.mguevara
7
+ * Version: 1
8
+ */
9
+
10
+ class Tigo_Tmoney_Model_Paymethod extends Mage_Payment_Model_Method_Abstract{
11
+
12
+ protected $_code = 'tmoney';
13
+ protected $_formBlockType = 'tmoney/form';
14
+ protected $_infoBlockType = 'tmoney/info';
15
+ protected $_isGateway = true;
16
+ protected $_canAuthorize = true;
17
+ protected $_canUseCheckout = true;
18
+
19
+ protected $_order;
20
+ protected $_config;
21
+ protected $_payment;
22
+ protected $_redirectUrl;
23
+
24
+ var $urlTransaction;
25
+ var $pubKey;
26
+ var $priKey;
27
+
28
+ var $PostalCode = '';
29
+ var $firstname = '';
30
+ var $lastname = '';
31
+ var $costumerMail = '';
32
+ var $address = '';
33
+ var $province_state = '';
34
+ var $orderId = '';
35
+ var $root_path = '';
36
+ var $telephone = '';
37
+
38
+ var $company = '';
39
+ var $vat = '';
40
+
41
+ var $returnURL = '';
42
+ var $backButtonURL = '';
43
+ var $countryName = '';
44
+ var $mage_currency = '';
45
+ var $lang_mage = '';
46
+
47
+
48
+ /*
49
+ * Peryment function who create the connection of LOGIC Core and create a message of response.
50
+ * Here set the parameter of user and TIGO Money Code
51
+ */
52
+ public function authorize(Varien_Object $payment, $amount){
53
+ $response = '';
54
+ $message_response = array();
55
+ $urlTransaction = '';
56
+
57
+ $this->PostalCode = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getPostcode();
58
+ $this->firstname = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getFirstname();
59
+ $this->lastname = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getLastname();
60
+ $this->costumerMail = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getEmail();
61
+ $this->address = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getStreet();
62
+ $this->province_state = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getRegion();
63
+
64
+ $this->telephone = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getTelephone();
65
+ $this->contactPhone = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getFax();
66
+
67
+ $this->orderId = $payment->getOrder()->getIncrementId();
68
+ $this->root_path = Mage::getBaseDir();
69
+ $this->urlTransaction = $this->getConfigData('submit_url');//url to have a gateway to connect to LOGIC CORE
70
+ $this->pubKey = $this->getConfigData('key_id');//user to validate the connection
71
+ $this->priKey = $this->getConfigData('key_encrypt');//password to connect the connection
72
+ $this->returnURL = Mage::getUrl('tigomoney/index/success', array('_secure' => true, '_query'=> array('orderID' => $this->orderId)));
73
+ $this->backButtonURL = Mage::getUrl('tigomoney/index/back', array('_secure' => true, '_query'=> array('orderID' => $this->orderId)));
74
+ $this->countryName = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getCountryId();
75
+ $this->mage_currency = Mage::app()->getStore()->getCurrentCurrencyCode();
76
+ $this->lang_mage = Mage::app()->getLocale()->getLocaleCode();
77
+
78
+ //Mage::Log('Product Name: '.$amount, null, 'tigobusiness-tigomoney.log');
79
+ try {
80
+
81
+ $checkout = Mage::getSingleton('checkout/session')->getQuote();
82
+ $billAddress = $checkout->getBillingAddress();
83
+ $variable_blling = $billAddress->getData();
84
+
85
+ $this->company = isset($variable_blling['company'])? $variable_blling['company'] : '';
86
+ $this->vat = isset($variable_blling['vat_id'])? $variable_blling['vat_id'] : '';
87
+
88
+ //$billingaddress = $order->getBillingAddress();
89
+ $urlTransaction = $this->tigomoney($amount);
90
+ if($urlTransaction != ''){
91
+ $response = 1;
92
+ }
93
+
94
+ } catch (Exception $e) {
95
+ $payment->setStatus(self::STATUS_ERROR);
96
+ $payment->setAmount($amount);
97
+ $payment->setLastTransId($this->orderId);
98
+ $this->setStore($payment->getOrder()->getStoreId());
99
+ Mage::throwException($e->getMessage());
100
+ $response = 0;
101
+ }
102
+ if($response){
103
+ Mage::getSingleton('customer/session')->setRedirectUrl($urlTransaction);
104
+ }else{
105
+ Mage::getSingleton('customer/session')->setRedirectUrl(Mage::getUrl('tigomoney/index/error', array('_secure' => true, '_query'=> array('msg'=>'error', 'mesage'=>'error to create the url and redirect it'))));
106
+ }
107
+ return $this;
108
+ }
109
+ /*
110
+ * Default function of magento
111
+ * create a session of user for the ckeckout
112
+ */
113
+ protected function _getCheckout(){
114
+ return Mage::getSingleton('checkout/session');
115
+ }
116
+ /*
117
+ * Default function of magento
118
+ * Get the current order of session
119
+ */
120
+ protected function _getOrder(){
121
+ return $this->_order;
122
+ }
123
+
124
+ public function getOrderPlaceRedirectUrl(){
125
+ Mage::Log('returning redirect url:: ' . $this->_redirectUrl , null, 'tigobusiness-tigomoney.log');
126
+ return Mage::getSingleton('customer/session')->getRedirectUrl();
127
+ }
128
+ public function createFormBlock($name){
129
+ $block = $this->getLayout()->createBlock('tigo/tmoney/form', $name)
130
+ ->setMethod('tmoney_paymethod')
131
+ ->setPayment($this->getPayment())
132
+ ->setTemplate('tigo/tmoney/form.phtml');
133
+
134
+ return $block;
135
+ }
136
+
137
+ public function initialize($paymentAction, $stateObject){
138
+ $state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
139
+ $stateObject->setState($state);
140
+ $stateObject->setStatus('pending_payment');
141
+ $stateObject->setIsNotified(false);
142
+ }
143
+
144
+ public function isAvailable($quote = null){
145
+ if (parent::isAvailable($quote)) {
146
+ return true;
147
+ }
148
+ return false;
149
+ }
150
+ /*
151
+ * TigoMoney Method for transaction
152
+ */
153
+ function tigomoney($amount){
154
+ $reurl = '';
155
+ try{
156
+ $nit_user_name = $this->company;
157
+ $nit_user_number = $this->vat;
158
+
159
+ $msisdn = Mage::app()->getRequest()->getParam($this->_code.'_tigo_money_id');//$_REQUEST['tmoney_tigo_money_id'];
160
+ $total = 0;
161
+ $items = array();
162
+ $i = 0;
163
+ $successURL = $this->returnURL;
164
+ $errorURL = $this->backButtonURL;
165
+ $p_total = 0;
166
+ $c_nit = $nit_user_number;
167
+ $order_id = $this->orderId;
168
+ $c_razon = $nit_user_name;
169
+ $url_transaction = (isset($this->urlTransaction))? $this->urlTransaction : 'http://190.129.208.178:96/vipagos/faces/payment.xhtml';
170
+ $pubk = (isset($this->pubKey))? $this->pubKey : '3124b901ec27b88b0694263bc32bcf9e6d266f4b3f0fa891bb28b0970eb035ab7abbb456ef0d582142177ddd4c44e15b0948a37347588423ca97ea7f431194cd';// Identify key
171
+ $prik = (isset($this->priKey))? $this->priKey :'HT4BW8DEP6GUPO2U9A6YHMM0';//Encrypt Key
172
+
173
+ $cart = Mage::getModel('checkout/cart')->getQuote();
174
+ foreach ($cart->getAllItems() as $item) {
175
+ $productName = $item->getProduct()->getName();
176
+ $productPrice = $item->getProduct()->getPrice();
177
+ $productQty = ($item->getProduct()->getQty()) ? $item->getProduct()->getQty() : 1 ;
178
+ $p_total = $productQty * $productPrice;
179
+
180
+ $item_ = '*i'.($i+1).'|'.$productQty.'|'.$productName.'|'.$productPrice.'|'.$amount;
181
+
182
+ array_push($items, $item_);
183
+
184
+ $i++;
185
+ Mage::Log('Item data: '.$item_, null, 'tigobusiness-tigomoney.log');
186
+ }
187
+ $ndoc = $c_nit;
188
+ $billetera = $msisdn;
189
+ $monto = $amount;
190
+
191
+ $orden = $order_id;
192
+ $nomb = $this->firstname.' '.$this->lastname;
193
+ $confi = '';
194
+ $notif = 'Pago recibido por '.$monto.' Bs Pedido '.$orden;
195
+ $rs = $c_razon;
196
+ $nit = $c_nit;
197
+ $hitems = implode('',$items);
198
+ $prmts = "".
199
+ "pv_nroDocumento=$ndoc;".
200
+ "pv_linea=$billetera;".
201
+ "pv_monto=$monto;".
202
+ "pv_orderId=$orden;".
203
+ "pv_nombre=$nomb;".
204
+ "pv_confirmacion=$confi;".
205
+ "pv_notificacion=$notif;".
206
+ "pv_razonSocial=$rs;".
207
+ "pv_nit=$nit;".
208
+ "pv_items=$hitems;".
209
+ "pv_urlCorrecto=".$successURL.";".
210
+ "pv_urlError=".$errorURL.";".
211
+ "";
212
+
213
+ Mage::Log('Encrypt Data of Tigomoney: '.$prmts, null, 'tigobusiness-tigomoney.log');
214
+ $crypt = base64_encode(mcrypt_ecb( MCRYPT_3DES , $prik , $prmts, MCRYPT_ENCRYPT));
215
+ $reurl = $url_transaction.'?key='.$pubk.'&parametros='.$crypt;//redirect the URL of transaction
216
+ Mage::Log('URL of Tigomoney item crypt: '.$prmts, null, 'tigobusiness-tigomoney.log');
217
+ Mage::Log('URL of Tigomoney: '.$reurl, null, 'tigobusiness-tigomoney.log');
218
+ } catch (Exception $ex){
219
+ Mage::Log('Error to create the URL of Tigomoney: '.$ex->getMessage(), null, 'tigobusiness-tigomoney.log');
220
+ }
221
+
222
+ return $reurl;
223
+ }
224
+ /*
225
+ * Verify the transacction
226
+ */
227
+ public function tigoverify($resp, $excep){
228
+ $response_ = array();
229
+ try{
230
+ $tmorder = '';
231
+ $prik = (isset($this->priKey))? $this->priKey :'HT4BW8DEP6GUPO2U9A6YHMM0';
232
+ $response = '';
233
+ $cleanr = '';
234
+ $status = '';
235
+ $ids = array();
236
+ if(isset($excep)){
237
+ $tmorder=strip_tags($excep);
238
+ }
239
+ if (isset($resp)) {
240
+ $response = base64_decode(str_replace(' ','+',$resp));
241
+ $cleanr = mcrypt_ecb( MCRYPT_3DES , $prik , $response, MCRYPT_DECRYPT);// esto puede cambiar en php 5.5
242
+ } else {
243
+ $response='';
244
+ }
245
+
246
+ $arr_resp = explode('&', $cleanr);
247
+ $cod = explode('=', $arr_resp[0]);
248
+ $cod = $cod[1];
249
+ $response_['code'] = $cod;
250
+
251
+ $msg = explode('=', $arr_resp[1]);
252
+ $msg = $msg[1];
253
+ $response_['msg'] = $msg;
254
+
255
+ $oid = explode('=', $arr_resp[2]);
256
+ $oid = $oid[1];
257
+ $response_['orderId'] = $oid;
258
+
259
+ $msg = explode(':', $msg);//el primer string es legible para el publico
260
+ $msg = $msg[0];
261
+ $response_['msg_public'] = $msg;
262
+
263
+ } catch (Exception $ex) {
264
+ Mage::Log('Error to verify the status of Tigomoney Transaction: '.$ex->getMessage(), null, 'tigobusiness-tigomoney.log');
265
+ }
266
+ return $response_;
267
+ }
268
+ }
app/code/local/Tigo/Tmoney/controllers/IndexController.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Tigo_Tmoney_IndexController extends Mage_Core_Controller_Front_Action {
3
+ public function indexAction() {
4
+ $this->loadLayout();
5
+ $this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
6
+ $block = $this->getLayout()->createBlock('tmoney/pagepaymod');
7
+ $this->getLayout()->getBlock('content')->insert($block);
8
+ $this->renderLayout();
9
+ }
10
+ /*
11
+ * Success page when is the transaction in correct
12
+ */
13
+ public function successAction(){
14
+ $this->loadLayout();
15
+ $this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
16
+ $block = $this->getLayout()->createBlock('tmoney/success');
17
+ $this->getLayout()->getBlock('content')->insert($block);
18
+
19
+ try{
20
+
21
+ $session = $this->_getCheckout();
22
+ $orderIncrementId = $session->getLastRealOrderId() ;
23
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
24
+ Mage::Log('Order id:'.$order->getId(), null, 'tigobusiness-tigomoney.log');
25
+
26
+ $payment = $order->getPayment();
27
+ $grandTotal = $order->getBaseGrandTotal();
28
+
29
+ if($order->getId()){
30
+ $tid = $order->getId();
31
+ } else {
32
+ $tid = -1 ;
33
+ }
34
+ //echo $tid;
35
+ $payment->setTransactionId($tid)->setPreparedMessage("Payment Sucessfull Result:")->setIsTransactionClosed(0)->registerAuthorizationNotification($grandTotal);
36
+ $order->save();
37
+ try {
38
+ if(!$order->canInvoice()){
39
+ Mage::throwException(Mage::helper('core')->__('Cannot create an invoice.'));
40
+ }
41
+ $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
42
+ if (!$invoice->getTotalQty()) {
43
+ Mage::throwException(Mage::helper('core')->__('Cannot create an invoice without products.'));
44
+ }
45
+ $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
46
+ //Or you can use
47
+ $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE);
48
+ $invoice->register();
49
+ $transactionSave = Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder());
50
+ $transactionSave->save();
51
+ //$comment = $order->sendNewOrderEmail()->addStatusHistoryComment($message)->setIsCustomerNotified(true)->save();
52
+ } catch (Mage_Core_Exception $e) {
53
+ //Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
54
+ Mage::Log('Invoce status status order #'.$orderIncrementId.': '.$e->getMessage(), null, 'tigobusiness-tigomoney.log');
55
+ }
56
+ } catch (Exception $ex) {
57
+ //Mage::getSingleton('adminhtml/session')->addError($ex->getMessage());
58
+ Mage::Log('Success page status: '.$ex->getMessage(), null, 'tigobusiness-tigomoney.log');
59
+ }
60
+
61
+ $this->renderLayout();
62
+ }
63
+
64
+ protected function _getCheckout() {
65
+ return Mage::getSingleton('checkout/session');
66
+ }
67
+ /*
68
+ * Show Error data and have a button action to reacrete the order
69
+ */
70
+ public function backAction(){
71
+ $this->loadLayout();
72
+ $resp = Mage::app()->getRequest()->getParam('r');//(isset($_REQUEST['r']))? $_REQUEST['r'] : '';
73
+ $excep = Mage::app()->getRequest()->getParam('e');//(isset($_REQUEST['e']))? $_REQUEST['e'] : '';
74
+ $tigomoney = Mage::getModel('tmoney/paymethod');
75
+ $response = $tigomoney->tigoverify($resp, $excep);
76
+ //print_r($response);
77
+ $this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
78
+ $block = $this->getLayout()->createBlock('tmoney/back');
79
+ $this->getLayout()->getBlock('content')->insert($block);
80
+ try{
81
+ $session = $this->_getCheckout();
82
+ if ($session->getLastRealOrderId()) {
83
+ $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
84
+ if ($order->getId()) {
85
+ //Cancel order
86
+ if ($order->getState() != Mage_Sales_Model_Order::STATE_CANCELED) {
87
+ $order->registerCancellation($errorMsg)->save();
88
+ }
89
+ $quote = Mage::getModel('sales/quote')->load($order->getQuoteId());
90
+ //Return quote
91
+ if ($quote->getId()) {
92
+ $quote->setIsActive(1)->setReservedOrderId(NULL)->save();
93
+ $session->replaceQuote($quote);
94
+ }
95
+ $session->unsLastRealOrderId();
96
+ }
97
+ }
98
+ } catch (Exception $ex){
99
+ Mage::getSingleton('adminhtml/session')->addError($ex->getMessage());
100
+ Mage::Log('Error page status: '.$ex->getMessage(), null, 'tigobusiness-tigomoney.log');
101
+ }
102
+ $this->renderLayout();
103
+ }
104
+ }
app/code/local/Tigo/Tmoney/etc/config.xml ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <config>
3
+ <modules>
4
+ <Tigo_Tmoney>
5
+ <version>0.1.0</version>
6
+ </Tigo_Tmoney>
7
+ </modules>
8
+
9
+ <frontend>
10
+ <routers>
11
+ <tmoney>
12
+ <use>standard</use>
13
+ <args>
14
+ <module>Tigo_Tmoney</module>
15
+ <frontName>tigomoney</frontName>
16
+ </args>
17
+ </tmoney>
18
+ </routers>
19
+ <layout>
20
+ <updates>
21
+ <Tigo_Tmoney>
22
+ <file>tigo_tmoney.xml</file>
23
+ </Tigo_Tmoney>
24
+ </updates>
25
+ </layout>
26
+ </frontend>
27
+
28
+ <global>
29
+ <blocks>
30
+ <tmoney>
31
+ <class>Tigo_Tmoney_Block</class>
32
+ </tmoney>
33
+ </blocks>
34
+ <fieldsets>
35
+ <sales_convert_quote_payment>
36
+ </sales_convert_quote_payment>
37
+ </fieldsets>
38
+ <payment>
39
+ <cc>
40
+ <types>
41
+
42
+ </types>
43
+ </cc>
44
+ </payment>
45
+ <models>
46
+ <tmoney>
47
+ <class>Tigo_Tmoney_Model</class>
48
+ </tmoney>
49
+ </models>
50
+
51
+ <resources>
52
+ <tmoney_setup>
53
+ <setup>
54
+ <module>Tigo_Tmoney</module>
55
+ </setup>
56
+ <connection>
57
+ <use>core_setup</use>
58
+ </connection>
59
+ </tmoney_setup>
60
+ <tmoney_write>
61
+ <connection>
62
+ <use>core_write</use>
63
+ </connection>
64
+ </tmoney_write>
65
+ <tmoney_read>
66
+ <connection>
67
+ <use>core_read</use>
68
+ </connection>
69
+ </tmoney_read>
70
+ </resources>
71
+ </global>
72
+
73
+ <default>
74
+ <payment>
75
+ <tmoney>
76
+ <active>1</active>
77
+ <model>tmoney/paymethod</model>
78
+ <order_status>pending</order_status>
79
+ <title>Tigo Business - Tigo Money</title>
80
+ <payment_action>authorize</payment_action>
81
+ <submit_url>http://190.129.208.178:96/vipagos/faces/payment.xhtml</submit_url>
82
+ <key_id>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</key_id>
83
+ <key_encrypt>xxxxxxxxxxxx</key_encrypt>
84
+ <message>Para realizar las transacciones a traves de TIGO Money se enviara un mensaje a su celular pidiendo que coloque su PIN para realizar la transaccion.</message>
85
+ <allowspecific>0</allowspecific>
86
+ </tmoney>
87
+ </payment>
88
+ </default>
89
+ </config>
app/code/local/Tigo/Tmoney/etc/system.xml ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <tmoney translate="label" module="paygate">
7
+ <label>Tigo - TigoMoney</label>
8
+ <sort_order>570</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>1</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>1</show_in_store>
21
+ </active>
22
+ <order_status translate="label">
23
+ <label>Order status</label>
24
+ <frontend_type>select</frontend_type>
25
+ <source_model>adminhtml/system_config_source_order_status_processing</source_model>
26
+ <sort_order>2</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ </order_status>
31
+ <title translate="label">
32
+ <label>Title</label>
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
+ </title>
39
+ <submit_url>
40
+ <label>URL Transaction</label>
41
+ <frontend_type>text</frontend_type>
42
+ <sort_order>4</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ </submit_url>
47
+ <key_id>
48
+ <label>Llave de identifiación</label>
49
+ <frontend_type>text</frontend_type>
50
+ <sort_order>5</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <show_in_store>1</show_in_store>
54
+ </key_id>
55
+ <key_encrypt>
56
+ <label>Llave de encriptación</label>
57
+ <frontend_type>text</frontend_type>
58
+ <sort_order>6</sort_order>
59
+ <show_in_default>1</show_in_default>
60
+ <show_in_website>1</show_in_website>
61
+ <show_in_store>1</show_in_store>
62
+ </key_encrypt>
63
+ <message translate="label">
64
+ <label>Displayed Message</label>
65
+ <frontend_type>textarea</frontend_type>
66
+ <sort_order>7</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>1</show_in_store>
70
+ </message>
71
+ </fields>
72
+ </tmoney>
73
+ </groups>
74
+ </payment>
75
+ </sections>
76
+ </config>
app/code/local/Tigo/Tmoney/sql/tmoney_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*$installer = $this;
3
+ $installer->startSetup();
4
+
5
+ $installer->addAttribute("customer", "nitname", array(
6
+ "type" => "varchar",
7
+ "backend" => "",
8
+ "label" => "Nombre a Facturar del Equipo",
9
+ "input" => "text",
10
+ "source" => "",
11
+ "visible" => false,
12
+ "required" => false,
13
+ "default" => "",
14
+ "frontend" => "",
15
+ "unique" => false,
16
+ "note" => ""
17
+ ));
18
+
19
+ $attribute = Mage::getSingleton("eav/config")->getAttribute("customer", "nitname");
20
+
21
+
22
+ $used_in_forms=array();
23
+
24
+ $used_in_forms[]="adminhtml_customer";
25
+ $used_in_forms[]="checkout_register";
26
+ $used_in_forms[]="customer_account_create";
27
+ $used_in_forms[]="customer_account_edit";
28
+ $used_in_forms[]="adminhtml_checkout";
29
+ $attribute->setData("used_in_forms", $used_in_forms)
30
+ ->setData("is_used_for_customer_segment", true)
31
+ ->setData("is_system", 0)
32
+ ->setData("is_user_defined", 0)
33
+ ->setData("is_visible", 1)
34
+ ->setData("sort_order", 100)
35
+ ;
36
+ $attribute->save();
37
+
38
+
39
+ $installer->addAttribute("customer", "nitscan", array(
40
+ "type" => "varchar",
41
+ "backend" => "",
42
+ "label" => "Imagen de CI",
43
+ "input" => "text",
44
+ "source" => "",
45
+ "visible" => false,
46
+ "required" => false,
47
+ "default" => "",
48
+ "frontend" => "",
49
+ "unique" => false,
50
+ "note" => ""
51
+ ));
52
+
53
+ $attribute = Mage::getSingleton("eav/config")->getAttribute("customer", "nitscan");
54
+
55
+
56
+ $used_in_forms=array();
57
+
58
+ $used_in_forms[]="adminhtml_customer";
59
+ $used_in_forms[]="checkout_register";
60
+ $used_in_forms[]="customer_account_create";
61
+ $used_in_forms[]="customer_account_edit";
62
+ $used_in_forms[]="adminhtml_checkout";
63
+ $attribute->setData("used_in_forms", $used_in_forms)
64
+ ->setData("is_used_for_customer_segment", true)
65
+ ->setData("is_system", 0)
66
+ ->setData("is_user_defined", 0)
67
+ ->setData("is_visible", 1)
68
+ ->setData("sort_order", 100)
69
+ ;
70
+ $attribute->save();
71
+
72
+ $installer->endSetup();
73
+ */
app/design/frontend/base/default/layout/tigo_tmoney.xml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addCss">
6
+ <stylesheet>tmoney/css/tigomoney.css</stylesheet>
7
+ </action>
8
+ </reference>
9
+ </default>
10
+ <tmoney_index_index>
11
+ <reference name="root">
12
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
13
+ </reference>
14
+ <reference name="content">
15
+ <block name="tmoney.index" type="tigo_tmoney/index" template="tigo/tmoney/paymod.phtml" />
16
+ </reference>
17
+ </tmoney_index_index>
18
+ <tmoney_index_success>
19
+ <reference name="root">
20
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
21
+ </reference>
22
+ <reference name="content">
23
+ <block name="tmoney_success" type="tigo_tmoney/success" template="tigo/tmoney/success.phtml" />
24
+ </reference>
25
+ </tmoney_index_success>
26
+ <tmoney_index_error>
27
+ <reference name="root">
28
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
29
+ </reference>
30
+ <reference name="content">
31
+ <block name="tmoney_error" type="tigo_tmoney/error" template="tigo/tmoney/error.phtml" />
32
+ </reference>
33
+ </tmoney_index_error>
34
+ <tmoney_index_back>
35
+ <reference name="root">
36
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
37
+ </reference>
38
+ <reference name="content">
39
+ <block name="tmoney.back" type="tigo_tmoney/back" template="tigo/tmoney/back.phtml" />
40
+ </reference>
41
+ </tmoney_index_back>
42
+ </layout>
app/design/frontend/base/default/template/tigo/tmoney/back.phtml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $validate = $this->validate();
3
+ $message = (isset($validate['msg_public']))? $validate['msg_public'] : 'Lo sentimos ocurrio un error en la transaccion, porfavor intente de nuevo';
4
+ $image = $this->getSkinUrl('tmoney/img/error.png');
5
+ $url = Mage::getUrl('/');
6
+ ?>
7
+ <div class="error-page-tigomoney">
8
+ <div class="image"><img src="<?php echo $image ?>" alt="Error" /></div>
9
+ <div class="page-title category-title">
10
+ <h2><?php echo $this->__('Lo sentimos ocurrio un error') ?></h2>
11
+ </div>
12
+ <section class="message">
13
+ <p><?php echo $this->__($message) ?></p>
14
+ <div class="content-buttons">
15
+ <a class="button" href="<?php echo $url ?>">Continuar comprando</a>
16
+ </div>
17
+ </section>
18
+ </div>
app/design/frontend/base/default/template/tigo/tmoney/error.phtml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $validate = $this->validate();
3
+ $message = (isset($validate['msg_public']))? $validate['msg_public'] : 'Lo sentimos ocurrio un error en la transaccion, porfavor intente de nuevo';
4
+ $image = $this->getSkinUrl('tmoney/img/error.png');
5
+ $url = Mage::getUrl('/');
6
+ ?>
7
+ <div class="error-page-tigomoney">
8
+ <div class="image"><img src="<?php echo $image ?>" alt="Error" /></div>
9
+ <div class="page-title category-title">
10
+ <h2><?php echo $this->__('Lo sentimos ocurrio un error') ?></h2>
11
+ </div>
12
+ <section class="message">
13
+ <p><?php echo $this->__($message) ?></p>
14
+ <div class="content-buttons">
15
+ <a class="button" href="<?php echo $url ?>">Continuar comprando</a>
16
+ </div>
17
+ </section>
18
+ </div>
app/design/frontend/base/default/template/tigo/tmoney/form.phtml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_code=$this->getMethodCode();
2
+
3
+
4
+ ?>
5
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none">
6
+
7
+ <li>
8
+ <div class="msessage">
9
+ <div class="msg"><?php echo $this->getMessage() ?></div>
10
+ </div>
11
+ <div class="input-box">
12
+ <label for="<?php echo $_code ?>_tigo_money_id"><?php echo __('Introduce tu numero de billetera') ?>
13
+ <span class="required"></span>
14
+ </label>
15
+ <input type="text" name="<?php echo $_code ?>_tigo_money_id" class="input-text required-entry" id="<?php echo $_code ?>_tigo_money_id" />
16
+ </div>
17
+ </li>
18
+ </ul>
19
+ <script>
20
+ /*var $j = jQuery.noConflict();
21
+ $j(document).ready(function(){*/
22
+ /* $j("#paymod_payments_id").on("change", function() {
23
+ var pay_id = $j('#paymod_payments_id').val();
24
+ $j('#payment_form_paymod li.fields').hide('slow');
25
+ if($j('#payment_form_paymod li.fields_'+pay_id).is(':hidden')){
26
+ $j('#payment_form_paymod li.fields_'+pay_id).show('slow');
27
+ }
28
+ console.log(pay_id);
29
+ });*/
30
+ /*$j('#paymod_payments_id').change(function(){
31
+ console.log('holssss');
32
+ var pay_id = $j('#paymod_payments_id').val();
33
+ $j('#payment_form_paymod li.fields').hide('slow');
34
+ if($j('#payment_form_paymod li.fields_'+pay_id).is(':hidden')){
35
+ $j('#payment_form_paymod li.fields_'+pay_id).show('slow');
36
+ }
37
+ console.log(pay_id);
38
+ });*/
39
+ //});
40
+ </script>
app/design/frontend/base/default/template/tigo/tmoney/paymod.phtml ADDED
@@ -0,0 +1,2 @@
 
 
1
+
2
+ <h1>holas </h1>
app/design/frontend/base/default/template/tigo/tmoney/success.phtml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $validate = $this->validate();
3
+ $message = (isset($validate['msg_public']))? $validate['msg_public'] : 'Felicidades la transaccion se ha realizado';
4
+ $image = $this->getSkinUrl('tmoney/img/success.png');
5
+ $url = Mage::getUrl('/');
6
+ ?>
7
+ <div class="success-page-tigomoney">
8
+ <div class="image"><img src="<?php echo $image ?>" alt="Exito" /></div>
9
+ <div class="page-title category-title">
10
+ <h2><?php echo $this->__('Felicidades') ?></h2>
11
+ </div>
12
+ <section class="message">
13
+ <p><?php echo $this->__($message) ?></p>
14
+ <div class="content-buttons">
15
+ <a class="button" href="<?php echo $url ?>">Continuar comprando</a>
16
+ </div>
17
+ </section>
18
+ </div>
app/etc/modules/Tigo_Tmoney.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Tigo_Tmoney>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ <depends>
8
+ <Mage_Payment />
9
+ </depends>
10
+ </Tigo_Tmoney>
11
+ </modules>
12
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Tigo_Tmoney</name>
4
+ <version>0.1.0</version>
5
+ <stability>beta</stability>
6
+ <license>GPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>test</summary>
10
+ <description>test</description>
11
+ <notes>test</notes>
12
+ <authors><author><name>Marcelo Guevara</name><user>guechamagu</user><email>guechamagu@yahoo.es</email></author></authors>
13
+ <date>2016-05-10</date>
14
+ <time>22:56:50</time>
15
+ <contents><target name="magelocal"><dir name="Tigo"><dir name="Tmoney"><dir name="Block"><file name="Back.php" hash="bf0eef2524b7ddb7f29ac73a1f0f67f3"/><file name="Error.php" hash="c4ee5bab335df8c4aec38750fd5babad"/><file name="Form.php" hash="cd75b30291b4ac8d20e525d965b8ccec"/><file name="Info.php" hash="b725f6caffa58f10eca1754c7330fe9b"/><file name="Pagepaymod.php" hash="34440d6165db0457a49e501bb1446972"/><file name="Redirect.php" hash="749717f3d5118bbbc2e57437432b1deb"/><file name="Success.php" hash="dba1b03d2883262fac4532e7d39e76dd"/></dir><dir name="Helper"><file name="Checkout.php" hash="b2299336f8e7201c34253d183d64ac12"/><file name="Data.php" hash="1e006469a70f3f9b28038709fef4c71c"/></dir><dir name="Model"><file name="Paymethod.php" hash="c71d662a9e3eb32b4dedb8351bbaef3a"/></dir><dir name="controllers"><file name="IndexController.php" hash="de85ae45bc52158d99b54080c878710c"/></dir><dir name="etc"><file name="config.xml" hash="ada86f9260538dd049189cb97e57b2ff"/><file name="system.xml" hash="404b10ba7d8bfdf158f3bfc430eb33d4"/></dir><dir name="sql"><dir name="tmoney_setup"><file name="mysql4-install-0.1.0.php" hash="d7377abf28ee92c5360291befc8b768f"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Tigo_Tmoney.xml" hash="b36d6f42f9b8b0c94d98ff3f4bd5dc05"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="tmoney"><dir name="css"><file name="tigomoney.css" hash="59f54fad85c41fbedf5c03828beda0f7"/><file name="tigomoney.css.map" hash="6e0bb6cb16b0923768a6050aefa617f5"/></dir><dir name="img"><file name="MasterCard_Logo.svg.png" hash="cf017c3df4b4b6ce716a19b6d146a93c"/><file name="Visa.svg.png" hash="a27755ba80948dd6bcc5a7bcf4e29e91"/><file name="Visa_Mastercard.png" hash="e1fdf8418d6f2908ed37e83b0bd10d7c"/><file name="delete-icon.jpg" hash="fc0fe22212ec63960e9deccce514c11a"/><file name="error.png" hash="1d41afb46293a2bfffc12c9726eea0e9"/><file name="row-bottom.png" hash="03d8d76e10c43a6705ebe485b2bbbfa3"/><file name="row-left.png" hash="6ac679ce36df09282d53f1846b6f3773"/><file name="success.png" hash="afa20fa5203554353d6e1d19092ad812"/><file name="tigomoney-phone.png" hash="e22d84ff9fa92b3e9bf8b412afa83f32"/><file name="visa_mastercard.jpg" hash="b6a8ae54a0c8eb16f8e97ea1fba8ed70"/></dir><dir name="scss"><file name="tigomoney.scss" hash="04b609b4ea635950761b0d6d0ac46683"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="tigo_tmoney.xml" hash="d4dfbbda65621b14e6555bc8fb4c73ed"/></dir><dir name="template"><dir name="tigo"><dir name="tmoney"><file name="back.phtml" hash="65dde4f32dd98f16e14a822b9a8a8866"/><file name="error.phtml" hash="65dde4f32dd98f16e14a822b9a8a8866"/><file name="form.phtml" hash="77d3d2d01e1535dc4cd338e3f050cc69"/><file name="paymod.phtml" hash="863045041bde54258c7b96e0c84b9236"/><file name="success.phtml" hash="389be19b4819a83953bf4aee9ab799b8"/></dir></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.0.0</min><max>5.6.0</max></php></required></dependencies>
18
+ </package>
skin/frontend/base/default/tmoney/css/tigomoney.css ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,700,600italic,700italic,800,800italic);
2
+ /*font-family: 'Open Sans', sans-serif;*/
3
+ #payment_form_tmoney li {
4
+ list-style: none; }
5
+ #payment_form_tmoney li .msessage {
6
+ float: left;
7
+ width: 100%; }
8
+ #payment_form_tmoney li .msessage .msg {
9
+ float: left;
10
+ width: 58%;
11
+ font-family: 'Open Sans', sans-serif;
12
+ color: #666666;
13
+ font-weight: 600;
14
+ font-size: 1rem; }
15
+ #payment_form_tmoney li .msessage::after {
16
+ content: ' ';
17
+ float: right;
18
+ width: 40%;
19
+ min-height: 75px;
20
+ background: transparent url(../img/tigomoney-phone.png) no-repeat center center;
21
+ background-size: auto 100%;
22
+ display: block; }
23
+ #payment_form_tmoney li .input-box {
24
+ clear: both;
25
+ padding-top: 15px; }
26
+ #payment_form_tmoney li .input-box label {
27
+ font-family: 'Open Sans', sans-serif;
28
+ width: 100%;
29
+ font-size: 1rem;
30
+ color: #666666;
31
+ font-weight: 300;
32
+ display: block;
33
+ padding-bottom: 10px; }
34
+ #payment_form_tmoney li .input-box .input-text {
35
+ width: 100%;
36
+ display: block;
37
+ -webkit-box-sizing: border-box;
38
+ -moz-box-sizing: border-box;
39
+ -ms-box-sizing: border-box;
40
+ box-sizing: border-box;
41
+ border: solid 1px #ddd;
42
+ background-color: #fff;
43
+ font-family: 'Open Sans', sans-serif;
44
+ color: #666666;
45
+ font-weight: 600;
46
+ font-size: 1.3rem; }
47
+
48
+ .success-page-tigomoney,
49
+ .error-page-tigomoney {
50
+ display: block;
51
+ margin: 0px auto;
52
+ max-width: 500px;
53
+ -webkit-box-sizing: border-box;
54
+ -moz-box-sizing: border-box;
55
+ -ms-box-sizing: border-box;
56
+ box-sizing: border-box;
57
+ padding: 50px 20px;
58
+ text-align: center; }
59
+ .success-page-tigomoney .image,
60
+ .error-page-tigomoney .image {
61
+ padding: 15px 0px; }
62
+ .success-page-tigomoney .image img,
63
+ .error-page-tigomoney .image img {
64
+ max-width: 100%;
65
+ display: inline-block; }
66
+ .success-page-tigomoney .page-title h2,
67
+ .error-page-tigomoney .page-title h2 {
68
+ font-family: 'Open Sans', sans-serif;
69
+ font-size: 27px;
70
+ color: #3E53B4;
71
+ border-bottom: solid #ededed 1px; }
72
+ .success-page-tigomoney .message p,
73
+ .error-page-tigomoney .message p {
74
+ font-family: 'Open Sans', sans-serif;
75
+ font-size: 18px;
76
+ color: #939393;
77
+ text-align: left; }
78
+ .success-page-tigomoney .message .content-buttons,
79
+ .error-page-tigomoney .message .content-buttons {
80
+ padding-top: 20px; }
81
+
82
+ /*# sourceMappingURL=tigomoney.css.map */
skin/frontend/base/default/tmoney/css/tigomoney.css.map ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ {
2
+ "version": 3,
3
+ "mappings": "AAAQ,oIAA4H;AACpI,yCAAyC;AAEjC,uBAAE;EACE,UAAU,EAAE,IAAI;EAChB,iCAAS;IACL,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;IACX,sCAAI;MACA,KAAK,EAAE,IAAI;MACX,KAAK,EAAE,GAAG;MACV,WAAW,EAAE,uBAAuB;MACpC,KAAK,EAAE,OAAO;MACd,WAAW,EAAE,GAAG;MAChB,SAAS,EAAE,IAAI;IAEnB,wCAAQ;MACJ,OAAO,EAAE,GAAG;MACZ,KAAK,EAAE,KAAK;MACZ,KAAK,EAAE,GAAG;MACV,UAAU,EAAE,IAAI;MAChB,UAAU,EAAE,mEAAmE;MAC/E,eAAe,EAAE,SAAS;MAC1B,OAAO,EAAE,KAAK;EAGtB,kCAAU;IACN,KAAK,EAAE,IAAI;IACX,WAAW,EAAE,IAAI;IACjB,wCAAK;MACD,WAAW,EAAE,uBAAuB;MACpC,KAAK,EAAE,IAAI;MACX,SAAS,EAAE,IAAI;MACf,KAAK,EAAE,OAAO;MACd,WAAW,EAAE,GAAG;MAChB,OAAO,EAAE,KAAK;MACd,cAAc,EAAE,IAAI;IAExB,8CAAW;MACP,KAAK,EAAE,IAAI;MACX,OAAO,EAAE,KAAK;MACd,kBAAkB,EAAE,UAAU;MAC9B,eAAe,EAAE,UAAU;MAC3B,cAAc,EAAE,UAAU;MAC1B,UAAU,EAAE,UAAU;MAEtB,MAAM,EAAE,cAAc;MACtB,gBAAgB,EAAE,IAAI;MACtB,WAAW,EAAE,uBAAuB;MACpC,KAAK,EAAE,OAAO;MACd,WAAW,EAAE,GAAG;MAChB,SAAS,EAAE,MAAM;;AAMrC;qBACqB;EACjB,OAAO,EAAE,KAAK;EACd,MAAM,EAAE,QAAQ;EAChB,SAAS,EAAE,KAAK;EAChB,kBAAkB,EAAE,UAAU;EAC9B,eAAe,EAAE,UAAU;EAC3B,cAAc,EAAE,UAAU;EAC1B,UAAU,EAAE,UAAU;EAEtB,OAAO,EAAE,SAAS;EAClB,UAAU,EAAE,MAAM;EAClB;8BAAM;IACF,OAAO,EAAE,QAAQ;IACjB;oCAAG;MACC,SAAS,EAAE,IAAI;MACf,OAAO,EAAE,YAAY;EAIzB;sCAAE;IACE,WAAW,EAAE,uBAAuB;IACpC,SAAS,EAAE,IAAI;IAEf,KAAK,EAAE,OAAO;IACd,aAAa,EAAE,iBAAiB;EAIpC;kCAAC;IACG,WAAW,EAAE,uBAAuB;IACpC,SAAS,EAAE,IAAI;IACf,KAAK,EAAE,OAAO;IACd,UAAU,EAAE,IAAI;EAGpB;iDAAgB;IACZ,WAAW,EAAE,IAAI",
4
+ "sources": ["../scss/tigomoney.scss"],
5
+ "names": [],
6
+ "file": "tigomoney.css"
7
+ }
skin/frontend/base/default/tmoney/img/MasterCard_Logo.svg.png ADDED
Binary file
skin/frontend/base/default/tmoney/img/Visa.svg.png ADDED
Binary file
skin/frontend/base/default/tmoney/img/Visa_Mastercard.png ADDED
Binary file
skin/frontend/base/default/tmoney/img/delete-icon.jpg ADDED
Binary file
skin/frontend/base/default/tmoney/img/error.png ADDED
Binary file
skin/frontend/base/default/tmoney/img/row-bottom.png ADDED
Binary file
skin/frontend/base/default/tmoney/img/row-left.png ADDED
Binary file
skin/frontend/base/default/tmoney/img/success.png ADDED
Binary file
skin/frontend/base/default/tmoney/img/tigomoney-phone.png ADDED
Binary file
skin/frontend/base/default/tmoney/img/visa_mastercard.jpg ADDED
Binary file
skin/frontend/base/default/tmoney/scss/tigomoney.scss ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,700,600italic,700italic,800,800italic);
2
+ /*font-family: 'Open Sans', sans-serif;*/
3
+ #payment_form_tmoney{
4
+ li{
5
+ list-style: none;
6
+ .msessage{
7
+ float: left;
8
+ width: 100%;
9
+ .msg{
10
+ float: left;
11
+ width: 58%;
12
+ font-family: 'Open Sans', sans-serif;
13
+ color: #666666;
14
+ font-weight: 600;
15
+ font-size: 1rem;
16
+ }
17
+ &::after{
18
+ content: ' ';
19
+ float: right;
20
+ width: 40%;
21
+ min-height: 75px;
22
+ background: transparent url(../img/tigomoney-phone.png) no-repeat center center;
23
+ background-size: auto 100%;
24
+ display: block;
25
+ }
26
+ }
27
+ .input-box{
28
+ clear: both;
29
+ padding-top: 15px;
30
+ label{
31
+ font-family: 'Open Sans', sans-serif;
32
+ width: 100%;
33
+ font-size: 1rem;
34
+ color: #666666;
35
+ font-weight: 300;
36
+ display: block;
37
+ padding-bottom: 10px;
38
+ }
39
+ .input-text{
40
+ width: 100%;
41
+ display: block;
42
+ -webkit-box-sizing: border-box;
43
+ -moz-box-sizing: border-box;
44
+ -ms-box-sizing: border-box;
45
+ box-sizing: border-box;
46
+
47
+ border: solid 1px #ddd;
48
+ background-color: #fff;
49
+ font-family: 'Open Sans', sans-serif;
50
+ color: #666666;
51
+ font-weight: 600;
52
+ font-size: 1.3rem;
53
+ }
54
+ }
55
+ }
56
+ }
57
+
58
+ .success-page-tigomoney,
59
+ .error-page-tigomoney{
60
+ display: block;
61
+ margin: 0px auto;
62
+ max-width: 500px;
63
+ -webkit-box-sizing: border-box;
64
+ -moz-box-sizing: border-box;
65
+ -ms-box-sizing: border-box;
66
+ box-sizing: border-box;
67
+
68
+ padding: 50px 20px;
69
+ text-align: center;
70
+ .image{
71
+ padding: 15px 0px;
72
+ img{
73
+ max-width: 100%;
74
+ display: inline-block;
75
+ }
76
+ }
77
+ .page-title{
78
+ h2{
79
+ font-family: 'Open Sans', sans-serif;
80
+ font-size: 27px;
81
+ //letter-spacing: -1px;
82
+ color: #3E53B4;
83
+ border-bottom: solid #ededed 1px;
84
+ }
85
+ }
86
+ .message{
87
+ p{
88
+ font-family: 'Open Sans', sans-serif;
89
+ font-size: 18px;
90
+ color: #939393;
91
+ text-align: left;
92
+ }
93
+
94
+ .content-buttons{
95
+ padding-top: 20px;
96
+ }
97
+ }
98
+ }