pagofacil - Version 3.0.0

Version Notes

Add cash payments

Download this release

Release Info

Developer isai velazquez
Extension pagofacil
Version 3.0.0
Comparing to
See all releases


Code changes from version 2.0.0 to 3.0.0

app/code/local/Pagofacil/Pagofacildirect/Block/CashForm.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Cash Form
5
+ *
6
+ * @author waldix (waldix86@gmail.com)
7
+ */
8
+
9
+
10
+ class Pagofacil_Pagofacildirect_Block_CashForm extends Mage_Payment_Block_Form{
11
+
12
+ protected function _construct(){
13
+
14
+ parent::_construct();
15
+ $this->setTemplate('pagofacildirect/cash.phtml');
16
+
17
+ }
18
+ }
19
+
20
+ ?>
app/code/local/Pagofacil/Pagofacildirect/Block/Form.php CHANGED
@@ -1,20 +1,20 @@
1
- <?php
2
- /**
3
- * Description of Form
4
- *
5
- * @author ivelazquex <isai.velazquez@gmail.com>
6
- */
7
- class Pagofacil_Pagofacildirect_Block_Form extends Mage_Payment_Block_Form
8
- {
9
- protected function _construct()
10
- {
11
- parent::_construct();
12
- $this->setTemplate('pagofacildirect/pay.phtml');
13
- }
14
-
15
- public function getMethod()
16
- {
17
- return parent::getMethod();
18
- }
19
-
20
  }
1
+ <?php
2
+ /**
3
+ * Description of Form
4
+ *
5
+ * @author ivelazquex <isai.velazquez@gmail.com>
6
+ */
7
+ class Pagofacil_Pagofacildirect_Block_Form extends Mage_Payment_Block_Form
8
+ {
9
+ protected function _construct()
10
+ {
11
+ parent::_construct();
12
+ $this->setTemplate('pagofacildirect/pay.phtml');
13
+ }
14
+
15
+ public function getMethod()
16
+ {
17
+ return parent::getMethod();
18
+ }
19
+
20
  }
app/code/local/Pagofacil/Pagofacildirect/Block/Onepage/Success.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Pagofacil_Pagofacildirect_Block_Onepage_Success extends Mage_Checkout_Block_Onepage_Success
4
+ {
5
+ // Write your custom methods
6
+ // All parent’s methods also will work
7
+ }
app/code/local/Pagofacil/Pagofacildirect/Helper/Data.php CHANGED
@@ -1,9 +1,9 @@
1
- <?php
2
- /**
3
- * Description of Data
4
- *
5
- * @author ivelazquex <isai.velazquez@gmail.com>
6
- */
7
- class Pagofacil_Pagofacildirect_Helper_Data extends Mage_Core_Helper_Abstract
8
- {
9
  }
1
+ <?php
2
+ /**
3
+ * Description of Data
4
+ *
5
+ * @author ivelazquex <isai.velazquez@gmail.com>
6
+ */
7
+ class Pagofacil_Pagofacildirect_Helper_Data extends Mage_Core_Helper_Abstract
8
+ {
9
  }
app/code/local/Pagofacil/Pagofacildirect/Model/Api.php CHANGED
@@ -73,52 +73,44 @@ class Pagofacil_Pagofacildirect_Model_Api
73
 
74
  // datos para la peticion del servicio
75
  $data = array(
76
- 'idServicio' => urlencode('3')
77
- ,'idSucursal' => urlencode($info['idSucursal'])
78
- ,'idUsuario' => urlencode($info['idUsuario'])
79
- ,'nombre' => urlencode($info['nombre'])
80
- ,'apellidos' => urlencode($info['apellidos'])
81
- ,'numeroTarjeta' => urlencode($info['numeroTarjeta'])
82
- ,'cvt' => urlencode($info['cvt'])
83
- ,'cp' => urlencode($info['cp'])
84
- ,'mesExpiracion' => urlencode($info['mesExpiracion'])
85
- ,'anyoExpiracion' => urlencode($info['anyoExpiracion'])
86
- ,'monto' => urlencode($info['monto'])
87
- ,'email' => urlencode($info['email'])
88
- ,'telefono' => urlencode($info['telefono'])
89
- ,'celular' => urlencode($info['celular'])
90
- ,'calleyNumero' => urlencode($info['calleyNumero'])
91
- ,'colonia' => urlencode($info['colonia'])
92
- ,'municipio' => urlencode($info['municipio'])
93
- ,'estado' => urlencode($info['estado'])
94
- ,'pais' => urlencode($info['pais'])
95
- ,'idPedido' => urlencode($info['idPedido'])
96
- ,'ip' => urlencode($info['ipBuyer'])
97
- ,'noMail' => urlencode($info['noMail'])
98
- ,'plan' => urlencode($info['plan'])
99
- ,'mensualidades' => urlencode($info['mensualidades'])
100
-
101
- //,'param1' => urlencode()
102
- //,'param2' => urlencode()
103
- //,'param3' => urlencode()
104
- //,'param4' => urlencode()
105
- //,'param5' => urlencode()
106
-
107
- //'httpUserAgent' => urlencode($_SERVER['HTTP_USER_AGENT']) // TABLA CAMPO OPCIONALES
108
-
109
  );
110
 
111
  // construccion de la peticion
112
- $cadena='';
113
- foreach ($data as $key=>$valor){
114
- $cadena.="&data[$key]=$valor";
115
  }
116
- $url = $info['url'].'/?method=transaccion'.$cadena;
117
 
118
  // consumo del servicio
119
  $ch = curl_init();
120
  curl_setopt($ch, CURLOPT_URL, $url);
121
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 
122
  // Blindly accept the certificate
123
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
124
  $this->_response = curl_exec($ch);
@@ -140,4 +132,58 @@ class Pagofacil_Pagofacildirect_Model_Api
140
  return $this->_response;
141
  }
142
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  }
73
 
74
  // datos para la peticion del servicio
75
  $data = array(
76
+ 'idServicio' => '3',
77
+ 'idSucursal' => $info['idSucursal'],
78
+ 'idUsuario' => $info['idUsuario'],
79
+ 'nombre' => $info['nombre'],
80
+ 'apellidos' => $info['apellidos'],
81
+ 'numeroTarjeta' => $info['numeroTarjeta'],
82
+ 'cvt' => $info['cvt'],
83
+ 'cp' => $info['cp'],
84
+ 'mesExpiracion' => $info['mesExpiracion'],
85
+ 'anyoExpiracion' => $info['anyoExpiracion'],
86
+ 'monto' => $info['monto'],
87
+ 'email' => $info['email'],
88
+ 'telefono' => $info['telefono'],
89
+ 'celular' => $info['celular'],
90
+ 'calleyNumero' => $info['calleyNumero'],
91
+ 'colonia' => $info['colonia'],
92
+ 'municipio' => $info['municipio'],
93
+ 'estado' => $info['estado'],
94
+ 'pais' => $info['pais'],
95
+ 'idPedido' => $info['idPedido'],
96
+ 'ip' => $info['ipBuyer'],
97
+ 'noMail' => $info['noMail'],
98
+ 'plan' => $info['plan'],
99
+ 'mensualidades' => $info['mensualidades'],
 
 
 
 
 
 
 
 
 
100
  );
101
 
102
  // construccion de la peticion
103
+ $query = '';
104
+ foreach ($data as $key=>$value){
105
+ $query .= sprintf("&data[%s]=%s", $key, urlencode($value));
106
  }
107
+ $url = $info['url'].'/?method=transaccion'.$query;
108
 
109
  // consumo del servicio
110
  $ch = curl_init();
111
  curl_setopt($ch, CURLOPT_URL, $url);
112
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
113
+
114
  // Blindly accept the certificate
115
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
116
  $this->_response = curl_exec($ch);
132
  return $this->_response;
133
  }
134
 
135
+ /**
136
+ * consume el servicio de pago en efectivo de PagoFacil
137
+ * @param string[] vector con la informacion de la peticion
138
+ * @return mixed respuesta del consumo del servicio
139
+ * @throws Exception
140
+ */
141
+ public function paymentCash($info)
142
+ {
143
+ $response = null;
144
+
145
+ if (!is_array($info))
146
+ {
147
+ throw new Exception('parameter is not an array');
148
+ }
149
+
150
+ $info['url'] = 'https://www.pagofacil.net/st/public/cash/charge';
151
+ // determinar si el entorno es para pruebas
152
+ if ($info['prod'] == '0')
153
+ {
154
+ $info['url'] = 'https://www.pagofacil.net/ws/public/cash/charge';
155
+ $info['branch_key'] = $this->_sucursalKeyDemo;
156
+ $info['user_key'] = $this->_usuarioKeyDemo;
157
+ }
158
+
159
+ // datos para la peticion del servicio
160
+ $data = array(
161
+ 'branch_key' => $info['branch_key'],
162
+ 'user_key' => $info['user_key'],
163
+ 'order_id' => $info['order_id'],
164
+ 'product' => $info['product'],
165
+ 'amount' => $info['amount'],
166
+ 'store_code' => $info['storeCode'],
167
+ 'customer' => $info['customer'],
168
+ 'email' => $info['email']
169
+ );
170
+
171
+ // consumo del servicio
172
+ $ch = curl_init();
173
+ curl_setopt($ch, CURLOPT_URL, $info['url']);
174
+ curl_setopt($ch, CURLOPT_POST, 1);
175
+ curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
176
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
177
+
178
+ // Blindly accept the certificate
179
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
180
+ $this->_response = curl_exec($ch);
181
+ curl_close($ch);
182
+
183
+ // tratamiento de la respuesta del servicio
184
+ $response = json_decode($this->_response,true);
185
+
186
+ return $response;
187
+ }
188
+
189
  }
app/code/local/Pagofacil/Pagofacildirect/Model/CashCP.php ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Funcionalidad de pagos en efectivo
4
+ *
5
+ * @author waldix <waldix86@gmail.com>
6
+ */
7
+
8
+
9
+ class Pagofacil_Pagofacildirect_Model_CashCP extends Mage_Payment_Model_Method_Abstract{
10
+ protected $_formBlockType = 'pagofacildirect/cashForm';
11
+ protected $_code = 'compropago';
12
+
13
+ protected $_canUseForMultiShipping = false;
14
+ protected $_canUseInternal = false;
15
+ protected $_isInitializeNeeded = true;
16
+
17
+
18
+ public function assignData($data)
19
+ {
20
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
21
+
22
+ if (!($data instanceof Varien_Object))
23
+ {
24
+ $data = new Varien_Object($data);
25
+ }
26
+
27
+ //Verificamos si existe el customer
28
+ if($customer->getFirstname()){
29
+ $info = array(
30
+ "storeCode" => $data->getStoreCode(),
31
+ "customer" => htmlentities($customer->getFirstname()),
32
+ "email" => htmlentities($customer->getEmail())
33
+ );
34
+ } else {
35
+ $sessionCheckout = Mage::getSingleton('checkout/session');
36
+ $quote = $sessionCheckout->getQuote();
37
+ $billingAddress = $quote->getBillingAddress();
38
+ $billing = $billingAddress->getData();
39
+
40
+ $info = array(
41
+ "storeCode" => $data->getStoreCode(),
42
+ "customer" => htmlentities($billing['firstname']),
43
+ "email" => htmlentities($billing['email'])
44
+ );
45
+
46
+ }
47
+
48
+ $infoInstance = $this->getInfoInstance();
49
+ $infoInstance->setAdditionalData(serialize($info));
50
+
51
+ return $this;
52
+ }
53
+
54
+ public function validate()
55
+ {
56
+ parent::validate();
57
+
58
+ // extraer datos de configuracion
59
+ $prod = $this->getConfigData('prod');
60
+
61
+ // entorno de produccion
62
+ if ($prod == '1')
63
+ {
64
+ if (trim($this->getConfigData('sucursalkey')) == ''
65
+ || trim($this->getConfigData('usuariokey')) == ''
66
+ ) {
67
+ Mage::throwException("Datos incompletos del servicio, contacte al administrador del sitio");
68
+ }
69
+ }
70
+
71
+ return $this;
72
+ }
73
+
74
+ public function initialize($paymentAction, $stateObject)
75
+ {
76
+ parent::initialize($paymentAction, $stateObject);
77
+
78
+ if($paymentAction != 'sale')
79
+ {
80
+ return $this;
81
+ }
82
+
83
+ // Set the default state of the new order.
84
+ $state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT; // state now = 'pending_payment'
85
+ $stateObject->setState($state);
86
+ $stateObject->setStatus($state);
87
+ $stateObject->setIsNotified(false);
88
+
89
+ //Retrieve cart/quote information.
90
+ $sessionCheckout = Mage::getSingleton('checkout/session');
91
+ $quoteId = $sessionCheckout->getQuoteId();
92
+
93
+ // obtiene el quote para informacion de la orden
94
+ $quote = Mage::getModel("sales/quote")->load($quoteId);
95
+ $grandTotal = $quote->getData('grand_total');
96
+ $subTotal = $quote->getSubtotal();
97
+ $shippingHandling = ($grandTotal-$subTotal);
98
+
99
+ $convertQuote = Mage::getSingleton('sales/convert_quote');
100
+ $order = $convertQuote->toOrder($quote);
101
+ $orderNumber = $order->getIncrementId();
102
+ $order1 = Mage::getModel('sales/order')->loadByIncrementId($orderNumber);
103
+
104
+ // obtener el nombre de cada uno de los items y concatenarlos
105
+ foreach ($order1->getAllItems() as $item) {
106
+ $name .= $item->getName();
107
+ }
108
+
109
+ // obtener datos del pago en info y asignar monto total
110
+ $infoIntance = $this->getInfoInstance();
111
+ $info = unserialize($infoIntance->getAdditionalData());
112
+ $info['order_id'] = $orderNumber;
113
+ $info['branch_key'] = trim($this->getConfigData('sucursalkey'));
114
+ $info['user_key'] = trim($this->getConfigData('usuariokey'));
115
+ $info['amount'] = $grandTotal;
116
+ $info['product'] = $name;
117
+
118
+ // enviar pago
119
+ try
120
+ {
121
+ $Api = new Pagofacil_Pagofacildirect_Model_Api();
122
+ $response = $Api->paymentCash($info);
123
+ }
124
+ catch (Exception $error)
125
+ {
126
+ Mage::throwException($error->getMessage());
127
+ }
128
+
129
+ // respuesta del servicio
130
+ if ($response == null)
131
+ {
132
+ Mage::throwException("El servicio de PagoFacil Efectivo no se encuentra disponible.");
133
+ }
134
+
135
+ if ($response['error'] == '1')
136
+ {
137
+ $errorMessage = $response['message'] . "\n";
138
+ if (is_array($response['error']))
139
+ {
140
+ $errorMessage.= implode("\n", array_values($response['error']));
141
+ }
142
+ Mage::throwException($errorMessage);
143
+ } else {
144
+ //Se almacenan los datos de la respuesta en session para posteriormente mostrarlos en el success.
145
+ $convenience_store = $response['charge']['convenience_store'];
146
+ $store_fixed_rate = $response['charge']['store_fixed_rate'];
147
+ $store_schedule = $response['charge']['store_schedule'];
148
+ $store_image = $response['charge']['store_image'];
149
+ $bank_account_number = $response['charge']['bank_account_number'];
150
+ $bank = $response['charge']['bank'];
151
+ $expiration_date = $response['charge']['expiration_date'];
152
+ $amount = $response['charge']['amount'];
153
+ $reference = $response['charge']['reference'];
154
+
155
+ Mage::getSingleton('core/session')->setConvenienceStore($convenience_store);
156
+ Mage::getSingleton('core/session')->setStoreFixedRate($store_fixed_rate);
157
+ Mage::getSingleton('core/session')->setStoreSchedule($store_schedule);
158
+ Mage::getSingleton('core/session')->setStoreImage($store_image);
159
+ Mage::getSingleton('core/session')->setBankAccountNumber($bank_account_number);
160
+ Mage::getSingleton('core/session')->setBank($bank);
161
+ Mage::getSingleton('core/session')->setExpirationDate($expiration_date);
162
+ Mage::getSingleton('core/session')->setAmount($amount);
163
+ Mage::getSingleton('core/session')->setReference($reference);
164
+ Mage::getSingleton('core/session')->setNameItem($name);
165
+ }
166
+
167
+ return $this;
168
+ }
169
+
170
+ public function getProviders()
171
+ {
172
+ $url = 'http://api-staging-compropago.herokuapp.com/v1/providers/';
173
+ $url.= 'true';
174
+ $username = 'pagofacil';
175
+
176
+ $ch = curl_init();
177
+ curl_setopt($ch, CURLOPT_URL, $url);
178
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
179
+ curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
180
+ curl_setopt($ch, CURLOPT_USERPWD, $username . ":");
181
+
182
+ // Blindly accept the certificate.
183
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
184
+ $this->_response = curl_exec($ch);
185
+ curl_close($ch);
186
+
187
+ // tratamiento de la respuesta del servicio.
188
+ $response = json_decode($this->_response,true);
189
+
190
+ return $response;
191
+ }
192
+ }
193
+
194
+ ?>
app/code/local/Pagofacil/Pagofacildirect/Model/Observer.php CHANGED
@@ -5,7 +5,7 @@
5
  class Pagofacil_Pagofacildirect_Model_Observer
6
  {
7
  public function orderPlaceAfter($event)
8
- {
9
  $order = $event->getOrder();
10
 
11
  if (!$order->getId())
5
  class Pagofacil_Pagofacildirect_Model_Observer
6
  {
7
  public function orderPlaceAfter($event)
8
+ {
9
  $order = $event->getOrder();
10
 
11
  if (!$order->getId())
app/code/local/Pagofacil/Pagofacildirect/Model/Standard.php CHANGED
@@ -1,163 +1,163 @@
1
- <?php
2
- /**
3
- * Description of Standard
4
- *
5
- * @author ivelazquex <isai.velazquez@gmail.com>
6
- */
7
- class Pagofacil_Pagofacildirect_Model_Standard extends Mage_Payment_Model_Method_Abstract
8
- {
9
- protected $_code = 'pagofacildirect';
10
- protected $_formBlockType = 'pagofacildirect/form';
11
-
12
- protected $_canUseForMultiShipping = false;
13
- protected $_canUseInternal = false;
14
- protected $_isInitializeNeeded = true;
15
-
16
-
17
- public function assignData($data)
18
- {
19
- if (!($data instanceof Varien_Object))
20
- {
21
- $data = new Varien_Object($data);
22
- }
23
-
24
- $info = array(
25
- "nombre" => $data->getNombre()
26
- ,"apellidos" => $data->getApellidos()
27
- ,"numeroTarjeta" => $data->getNumeroTarjeta()
28
- ,"cvt" => $data->getCvt()
29
- ,"cp" => $data->getCp()
30
- ,"mesExpiracion" => $data->getMesExpiracion()
31
- ,"anyoExpiracion" => $data->getAnyoExpiracion()
32
- ,"email" => $data->getEmail()
33
- ,"telefono" => $data->getTelefono()
34
- ,"celular" => $data->getCelular()
35
- ,"calleyNumero" => $data->getCalleyNumero()
36
- ,"colonia" => $data->getColonia()
37
- ,"municipio" => $data->getMunicipio()
38
- ,"estado" => $data->getEstado()
39
- ,"pais" => $data->getPais()
40
- ,"mensualidades" => $data->getMsi()
41
- );
42
-
43
- $infoInstance = $this->getInfoInstance();
44
- $infoInstance->setAdditionalData(serialize($info));
45
-
46
- return $this;
47
- }
48
-
49
- public function validate()
50
- {
51
- parent::validate();
52
-
53
- // extraer datos de configuracion
54
- $prod = $this->getConfigData('prod');
55
-
56
- // entorno de produccion
57
- if ($prod == '1')
58
- {
59
- if (trim($this->getConfigData('sucursalkey')) == ''
60
- || trim($this->getConfigData('usuariokey')) == ''
61
- ) {
62
- Mage::throwException("Datos incompletos del servicio, contacte al administrador del sitio");
63
- }
64
- }
65
-
66
- return $this;
67
- }
68
-
69
- public function initialize($paymentAction, $stateObject)
70
- {
71
- parent::initialize($paymentAction, $stateObject);
72
-
73
- if($paymentAction != 'sale')
74
- {
75
- return $this;
76
- }
77
-
78
- // Set the default state of the new order.
79
- $state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT; // state now = 'pending_payment'
80
- $stateObject->setState($state);
81
- $stateObject->setStatus($state);
82
- $stateObject->setIsNotified(false);
83
-
84
- //Retrieve cart/quote information.
85
- $sessionCheckout = Mage::getSingleton('checkout/session');
86
- $quoteId = $sessionCheckout->getQuoteId();
87
-
88
- // obtiene el quote para informacion de la orden
89
- $quote = Mage::getModel("sales/quote")->load($quoteId);
90
- $grandTotal = $quote->getData('grand_total');
91
- $subTotal = $quote->getSubtotal();
92
- $shippingHandling = ($grandTotal-$subTotal);
93
-
94
- $convertQuote = Mage::getSingleton('sales/convert_quote');
95
- $order = $convertQuote->toOrder($quote);
96
- $orderNumber = $order->getIncrementId();
97
-
98
- // obtener datos del pago en info y asignar monto total
99
- $infoIntance = $this->getInfoInstance();
100
- $info = unserialize($infoIntance->getAdditionalData());
101
- $info['idPedido'] = $orderNumber;
102
- $info['prod'] = trim($this->getConfigData('prod'));
103
- $info['idSucursal'] = trim($this->getConfigData('sucursalkey'));
104
- $info['idUsuario'] = trim($this->getConfigData('usuariokey'));
105
- $info['monto'] = $grandTotal;
106
- $info['ipBuyer'] = $_SERVER['REMOTE_ADDR'];
107
- $info['noMail'] = ((int)trim($this->getConfigData('notify')) == 1 ? 0 : 1 );
108
- $info['plan'] = ( (int)trim($this->getConfigData('msi')) == 1 ? ($info['mensualidades'] == '00' ? 'NOR' : 'MSI' ) : 'NOR' );
109
-
110
- // enviar pago
111
- try
112
- {
113
- $Api = new Pagofacil_Pagofacildirect_Model_Api();
114
- $response = $Api->payment($info);
115
- }
116
- catch (Exception $error)
117
- {
118
- Mage::throwException($error->getMessage());
119
- }
120
-
121
- // respuesta del servicio
122
- if ($response == null)
123
- {
124
- Mage::throwException("El servicio de PagoFacil no se encuentra");
125
- }
126
-
127
- if ($response['autorizado'] == '0')
128
- {
129
- $errorMessage = $response['texto'] . "\n";
130
- if (is_array($response['error']))
131
- {
132
- $errorMessage.= implode("\n", array_values($response['error']));
133
- }
134
- Mage::throwException($errorMessage);
135
- }
136
-
137
- return $this;
138
- }
139
-
140
- public function getBillingInfo()
141
- {
142
- $sessionCheckout = Mage::getSingleton('checkout/session');
143
- $quote = $sessionCheckout->getQuote();
144
- $billingAddress = $quote->getBillingAddress();
145
- $data = $billingAddress->getData();
146
-
147
- $country = Mage::getModel('directory/country')->load($data['country_id']);
148
- $data['country'] = $country->getName();
149
-
150
- return $data;
151
- }
152
-
153
- public function showLogoPagoFacil()
154
- {
155
- return ( (int)trim($this->getConfigData("logo")) == 1 ? true : false );
156
- }
157
-
158
- public function enabledMSI()
159
- {
160
- return ( (int)trim($this->getConfigData("msi")) == 1 ? true : false );
161
- }
162
-
163
  }
1
+ <?php
2
+ /**
3
+ * Description of Standard
4
+ *
5
+ * @author ivelazquex <isai.velazquez@gmail.com>
6
+ */
7
+ class Pagofacil_Pagofacildirect_Model_Standard extends Mage_Payment_Model_Method_Abstract
8
+ {
9
+ protected $_code = 'pagofacildirect';
10
+ protected $_formBlockType = 'pagofacildirect/form';
11
+
12
+ protected $_canUseForMultiShipping = false;
13
+ protected $_canUseInternal = false;
14
+ protected $_isInitializeNeeded = true;
15
+
16
+
17
+ public function assignData($data)
18
+ {
19
+ if (!($data instanceof Varien_Object))
20
+ {
21
+ $data = new Varien_Object($data);
22
+ }
23
+
24
+ $info = array(
25
+ "nombre" => $data->getNombre()
26
+ ,"apellidos" => $data->getApellidos()
27
+ ,"numeroTarjeta" => $data->getNumeroTarjeta()
28
+ ,"cvt" => $data->getCvt()
29
+ ,"cp" => $data->getCp()
30
+ ,"mesExpiracion" => $data->getMesExpiracion()
31
+ ,"anyoExpiracion" => $data->getAnyoExpiracion()
32
+ ,"email" => $data->getEmail()
33
+ ,"telefono" => $data->getTelefono()
34
+ ,"celular" => $data->getCelular()
35
+ ,"calleyNumero" => $data->getCalleyNumero()
36
+ ,"colonia" =>( trim($data->getColonia()) == '' ? substr(trim($data->getCalleyNumero()), 0, 30) : $data->getColonia() )
37
+ ,"municipio" => $data->getMunicipio()
38
+ ,"estado" => $data->getEstado()
39
+ ,"pais" => $data->getPais()
40
+ ,"mensualidades" => $data->getMsi()
41
+ );
42
+
43
+ $infoInstance = $this->getInfoInstance();
44
+ $infoInstance->setAdditionalData($infoInstance->encrypt(serialize($info)));
45
+
46
+ return $this;
47
+ }
48
+
49
+ public function validate()
50
+ {
51
+ parent::validate();
52
+
53
+ // extraer datos de configuracion
54
+ $prod = $this->getConfigData('prod');
55
+
56
+ // entorno de produccion
57
+ if ($prod == '1')
58
+ {
59
+ if (trim($this->getConfigData('sucursalkey')) == ''
60
+ || trim($this->getConfigData('usuariokey')) == ''
61
+ ) {
62
+ Mage::throwException("Datos incompletos del servicio, contacte al administrador del sitio");
63
+ }
64
+ }
65
+
66
+ return $this;
67
+ }
68
+
69
+ public function initialize($paymentAction, $stateObject)
70
+ {
71
+ parent::initialize($paymentAction, $stateObject);
72
+
73
+ if($paymentAction != 'sale')
74
+ {
75
+ return $this;
76
+ }
77
+
78
+ // Set the default state of the new order.
79
+ $state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT; // state now = 'pending_payment'
80
+ $stateObject->setState($state);
81
+ $stateObject->setStatus($state);
82
+ $stateObject->setIsNotified(false);
83
+
84
+ //Retrieve cart/quote information.
85
+ $sessionCheckout = Mage::getSingleton('checkout/session');
86
+ $quoteId = $sessionCheckout->getQuoteId();
87
+
88
+ // obtiene el quote para informacion de la orden
89
+ $quote = Mage::getModel("sales/quote")->load($quoteId);
90
+ $grandTotal = $quote->getData('grand_total');
91
+ $subTotal = $quote->getSubtotal();
92
+ $shippingHandling = ($grandTotal-$subTotal);
93
+
94
+ $convertQuote = Mage::getSingleton('sales/convert_quote');
95
+ $order = $convertQuote->toOrder($quote);
96
+ $orderNumber = $order->getIncrementId();
97
+
98
+ // obtener datos del pago en info y asignar monto total
99
+ $infoInstance = $this->getInfoInstance();
100
+ $info = unserialize($infoInstance->decrypt($infoInstance->getAdditionalData()));
101
+
102
+ $info['idPedido'] = $orderNumber;
103
+ $info['prod'] = trim($this->getConfigData('prod'));
104
+ $info['idSucursal'] = trim($this->getConfigData('sucursalkey'));
105
+ $info['idUsuario'] = trim($this->getConfigData('usuariokey'));
106
+ $info['monto'] = $grandTotal;
107
+ $info['ipBuyer'] = $_SERVER['REMOTE_ADDR'];
108
+ $info['noMail'] = ((int)trim($this->getConfigData('notify')) == 1 ? 0 : 1 );
109
+ $info['plan'] = ( (int)trim($this->getConfigData('msi')) == 1 ? ($info['mensualidades'] == '00' ? 'NOR' : 'MSI' ) : 'NOR' );
110
+
111
+ // enviar pago
112
+ try
113
+ {
114
+ $Api = new Pagofacil_Pagofacildirect_Model_Api();
115
+ $response = $Api->payment($info);
116
+ }
117
+ catch (Exception $error)
118
+ {
119
+ Mage::throwException($error->getMessage());
120
+ }
121
+
122
+ // respuesta del servicio
123
+ if ($response == null)
124
+ {
125
+ Mage::throwException("El servicio de PagoFacil no se encuentra");
126
+ }
127
+
128
+ if ($response['autorizado'] == '0')
129
+ {
130
+ $errorMessage = $response['texto'] . "\n";
131
+ if (is_array($response['error']))
132
+ {
133
+ $errorMessage.= implode("\n", array_values($response['error']));
134
+ }
135
+ Mage::throwException($errorMessage);
136
+ }
137
+
138
+ return $this;
139
+ }
140
+
141
+ public function getBillingInfo()
142
+ {
143
+ $sessionCheckout = Mage::getSingleton('checkout/session');
144
+ $quote = $sessionCheckout->getQuote();
145
+ $billingAddress = $quote->getBillingAddress();
146
+ $data = $billingAddress->getData();
147
+
148
+ $country = Mage::getModel('directory/country')->load($data['country_id']);
149
+ $data['country'] = $country->getName();
150
+
151
+ return $data;
152
+ }
153
+
154
+ public function showLogoPagoFacil()
155
+ {
156
+ return ( (int)trim($this->getConfigData("logo")) == 1 ? true : false );
157
+ }
158
+
159
+ public function enabledMSI()
160
+ {
161
+ return ( (int)trim($this->getConfigData("msi")) == 1 ? true : false );
162
+ }
163
  }
app/code/local/Pagofacil/Pagofacildirect/controllers/WebhookController.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Webhook para notificaciones de pagos.
4
+ *
5
+ * @author waldix (waldix86@gmail.com)
6
+ */
7
+
8
+ class Pagofacil_Pagofacildirect_WebhookController extends Mage_Core_Controller_Front_Action{
9
+
10
+ public function indexAction(){
11
+ $params = $this->getRequest()->getParams();
12
+
13
+ $body = @file_get_contents('php://input');
14
+ $event_json = json_decode($body);
15
+ $_id = $event_json->{'customer_order'};
16
+ $_type = $event_json->{'status'};
17
+
18
+ $config = Mage::getModel('pagofacildirect/CashCP');
19
+ $_order = Mage::getModel('sales/order')->loadByIncrementId($_id);
20
+
21
+ switch ($_type) {
22
+ case 'pagada':
23
+ $createinvoice = Mage::getModel('pagofacildirect/CashCP')->getConfigData('auto_create_inovice');
24
+ if ($createinvoice == 1){
25
+ if(!$_order->hasInvoices()){
26
+ $invoice = $_order->prepareInvoice();
27
+ $invoice->register()->pay();
28
+ Mage::getModel('core/resource_transaction')
29
+ ->addObject($invoice)
30
+ ->addObject($invoice->getOrder())
31
+ ->save();
32
+
33
+ $message = 'Payment '.$invoice->getIncrementId().' was created. ComproPago automatically confirmed payment for this order.';
34
+ $status = $config->getConfigData('order_status_approved');
35
+ $_order->addStatusToHistory($status,$message,true);
36
+ $invoice->sendEmail(true, $message);
37
+ }
38
+ } else {
39
+ $message = 'ComproPago automatically confirmed payment for this order.';
40
+ $status = $config->getConfigData('order_status_approved');
41
+ $_order->addStatusToHistory($status,$message,true);
42
+ }
43
+ break;
44
+ case 'pendiente':
45
+ $status = $config->getConfigData('order_status_in_process');
46
+ $message = 'The user has not completed the payment process yet.';
47
+ $_order->addStatusToHistory($status, $message);
48
+ break;
49
+ case 'cancelada':
50
+ $status = $config->getConfigData('order_status_cancelled');
51
+ $message = 'The user has not completed the payment and the order was cancelled.';
52
+ $_order->cancel();
53
+ break;
54
+ default:
55
+ $status = $config->getConfigData('order_status_in_process');
56
+ $message = "";
57
+ $_order->addStatusToHistory($status, $message);
58
+ }
59
+
60
+
61
+ $_order->save();
62
+ }
63
+ }
app/code/local/Pagofacil/Pagofacildirect/etc/config.xml CHANGED
@@ -1,74 +1,106 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Pagofacil_Pagofacildirect>
5
- <version>2.0.0</version>
6
- </Pagofacil_Pagofacildirect>
7
- </modules>
8
-
9
- <global>
10
- <models>
11
- <pagofacildirect>
12
- <class>Pagofacil_Pagofacildirect_Model</class>
13
- </pagofacildirect>
14
- </models>
15
- <helpers>
16
- <pagofacildirect>
17
- <class>Pagofacil_Pagofacildirect_Helper</class>
18
- </pagofacildirect>
19
- </helpers>
20
- <blocks>
21
- <pagofacildirect>
22
- <class>Pagofacil_Pagofacildirect_Block</class>
23
- </pagofacildirect>
24
- </blocks>
25
- <payment>
26
- <groups>
27
- <pagofacildirect>pagofacil</pagofacildirect>
28
- </groups>
29
- </payment>
30
- <events>
31
- <sales_order_place_after>
32
- <observers>
33
- <pagofacildirect>
34
- <type>singleton</type>
35
- <class>pagofacildirect/observer</class>
36
- <method>orderPlaceAfter</method>
37
- </pagofacildirect>
38
- </observers>
39
- </sales_order_place_after>
40
- </events>
41
- </global>
42
-
43
- <frontend>
44
- <routers>
45
- <pagofacildirect>
46
- <use>standard</use>
47
- <args>
48
- <module>Pagofacil_Pagofacildirect</module>
49
- <frontName>pagofacildirect</frontName>
50
- </args>
51
- </pagofacildirect>
52
- </routers>
53
- </frontend>
54
-
55
- <default>
56
- <payment>
57
- <pagofacildirect>
58
- <model>pagofacildirect/standard</model>
59
- <group>pagofacil</group>
60
- <payment_action>sale</payment_action>
61
- <allowspecific>0</allowspecific>
62
- <active>1</active>
63
- <title><![CDATA[PagoFácil]]></title>
64
- <status>processing</status>
65
- <prod>1</prod>
66
- <notify>1</notify>
67
- <divisa>0</divisa>
68
- <msi>0</msi>
69
- <logo>1</logo>
70
- </pagofacildirect>
71
- </payment>
72
- </default>
73
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Pagofacil_Pagofacildirect>
5
+ <version>2.0.0</version>
6
+ </Pagofacil_Pagofacildirect>
7
+ </modules>
8
+
9
+ <global>
10
+ <models>
11
+ <pagofacildirect>
12
+ <class>Pagofacil_Pagofacildirect_Model</class>
13
+ </pagofacildirect>
14
+ </models>
15
+ <helpers>
16
+ <pagofacildirect>
17
+ <class>Pagofacil_Pagofacildirect_Helper</class>
18
+ </pagofacildirect>
19
+ </helpers>
20
+ <blocks>
21
+ <pagofacildirect>
22
+ <class>Pagofacil_Pagofacildirect_Block</class>
23
+ </pagofacildirect>
24
+ </blocks>
25
+ <payment>
26
+ <groups>
27
+ <pagofacildirect>pagofacil</pagofacildirect>
28
+ </groups>
29
+ </payment>
30
+ <events>
31
+ <sales_order_place_after>
32
+ <observers>
33
+ <pagofacildirect>
34
+ <type>singleton</type>
35
+ <class>pagofacildirect/observer</class>
36
+ <method>orderPlaceAfter</method>
37
+ </pagofacildirect>
38
+ </observers>
39
+ </sales_order_place_after>
40
+ </events>
41
+ </global>
42
+
43
+ <frontend>
44
+ <routers>
45
+ <pagofacildirect>
46
+ <use>standard</use>
47
+ <args>
48
+ <module>Pagofacil_Pagofacildirect</module>
49
+ <frontName>pagofacildirect</frontName>
50
+ </args>
51
+ </pagofacildirect>
52
+ <compropago>
53
+ <use>cashCP</use>
54
+ <args>
55
+ <module>Pagofacil_Pagofacildirect</module>
56
+ <frontName>pagofacildirect</frontName>
57
+ </args>
58
+ </compropago>
59
+ </routers>
60
+ <layout>
61
+ <updates>
62
+ <pagofacildirect>
63
+ <file>pagofacildirect.xml</file>
64
+ </pagofacildirect>
65
+ <compropago>
66
+ <file>pagofacildirect.xml</file>
67
+ </compropago>
68
+ </updates>
69
+ </layout>
70
+ </frontend>
71
+
72
+ <default>
73
+ <payment>
74
+ <pagofacildirect>
75
+ <model>pagofacildirect/standard</model>
76
+ <group>pagofacil</group>
77
+ <payment_action>sale</payment_action>
78
+ <allowspecific>0</allowspecific>
79
+ <active>1</active>
80
+ <title><![CDATA[PagoFácil]]></title>
81
+ <status>processing</status>
82
+ <prod>1</prod>
83
+ <notify>1</notify>
84
+ <divisa>0</divisa>
85
+ <msi>0</msi>
86
+ <logo>1</logo>
87
+ </pagofacildirect>
88
+ <compropago>
89
+ <active>1</active>
90
+ <prod>1</prod>
91
+ <payment_action>sale</payment_action>
92
+ <allowspecific>0</allowspecific>
93
+ <model>pagofacildirect/cashCP</model>
94
+ <title><![CDATA[PagoFácil]]> - Efectivo</title>
95
+ <order_status_new>pending</order_status_new>
96
+ <order_status_approved>processing</order_status_approved>
97
+ <order_status_refunded>refunded</order_status_refunded>
98
+ <order_status_in_process>pending</order_status_in_process>
99
+ <order_status_cancelled>cancelled</order_status_cancelled>
100
+ <installments></installments>
101
+ <auto_create_inovice>0</auto_create_inovice>
102
+ </compropago>
103
+ </payment>
104
+ </default>
105
+
106
  </config>
app/code/local/Pagofacil/Pagofacildirect/etc/system.xml CHANGED
@@ -1,109 +1,220 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <config>
3
- <sections>
4
- <payment>
5
- <groups>
6
- <pagofacildirect translate="label" module="paygate">
7
- <label><![CDATA[PagoF&aacute;cil]]></label>
8
- <sort_order>501</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
- <comment></comment>
13
-
14
- <fields>
15
- <active translate="label">
16
- <label>Habilitado</label>
17
- <frontend_type>select</frontend_type>
18
- <source_model>adminhtml/system_config_source_yesno</source_model>
19
- <sort_order>1</sort_order>
20
- <show_in_default>1</show_in_default>
21
- <show_in_website>1</show_in_website>
22
- <show_in_store>0</show_in_store>
23
- </active>
24
- <status translate="label">
25
- <label>Estado de la Orden</label>
26
- <!-- <comment>despu&eacute;s de autorizar y cobrar en PagoF&aacute;cil</comment> -->
27
- <frontend_type>select</frontend_type>
28
- <source_model>pagofacildirect/source</source_model>
29
- <sort_order>2</sort_order>
30
- <show_in_default>1</show_in_default>
31
- <show_in_website>1</show_in_website>
32
- <show_in_store>0</show_in_store>
33
- </status>
34
- <title translate="label">
35
- <label>Servicio</label>
36
- <frontend_type>text</frontend_type>
37
- <sort_order>3</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
- </title>
42
- <prod translate="label">
43
- <label><![CDATA[Entorno Producci&oacute;n]]></label>
44
- <frontend_type>select</frontend_type>
45
- <source_model>adminhtml/system_config_source_yesno</source_model>
46
- <sort_order>4</sort_order>
47
- <show_in_default>1</show_in_default>
48
- <show_in_website>1</show_in_website>
49
- <show_in_store>0</show_in_store>
50
- </prod>
51
- <sucursalkey translate="label">
52
- <label>API Sucursal</label>
53
- <frontend_type>text</frontend_type>
54
- <sort_order>6</sort_order>
55
- <show_in_default>1</show_in_default>
56
- <show_in_website>1</show_in_website>
57
- <show_in_store>0</show_in_store>
58
- </sucursalkey>
59
- <usuariokey translate="label">
60
- <label>API Usuario</label>
61
- <frontend_type>text</frontend_type>
62
- <sort_order>7</sort_order>
63
- <show_in_default>1</show_in_default>
64
- <show_in_website>1</show_in_website>
65
- <show_in_store>0</show_in_store>
66
- </usuariokey>
67
- <notify translate="label">
68
- <label><![CDATA[Enviar Notificaci&oacute;n]]></label>
69
- <frontend_type>select</frontend_type>
70
- <source_model>adminhtml/system_config_source_yesno</source_model>
71
- <sort_order>8</sort_order>
72
- <show_in_default>1</show_in_default>
73
- <show_in_website>1</show_in_website>
74
- <show_in_store>0</show_in_store>
75
- </notify>
76
- <divisa translate="label">
77
- <label>Divisa (USD a MXN)</label>
78
- <frontend_type>select</frontend_type>
79
- <source_model>adminhtml/system_config_source_yesno</source_model>
80
- <sort_order>8</sort_order>
81
- <show_in_default>1</show_in_default>
82
- <show_in_website>1</show_in_website>
83
- <show_in_store>0</show_in_store>
84
- </divisa>
85
- <msi translate="label">
86
- <label>Habilitar Meses sin Intereses</label>
87
- <frontend_type>select</frontend_type>
88
- <source_model>adminhtml/system_config_source_yesno</source_model>
89
- <sort_order>9</sort_order>
90
- <show_in_default>1</show_in_default>
91
- <show_in_website>1</show_in_website>
92
- <show_in_store>1</show_in_store>
93
- </msi>
94
- <logo translate="label">
95
- <label><![CDATA[Mostrar Logotipo]]></label>
96
- <frontend_type>select</frontend_type>
97
- <source_model>adminhtml/system_config_source_yesno</source_model>
98
- <sort_order>10</sort_order>
99
- <show_in_default>1</show_in_default>
100
- <show_in_website>1</show_in_website>
101
- <show_in_store>1</show_in_store>
102
- </logo>
103
- </fields>
104
-
105
- </pagofacildirect>
106
- </groups>
107
- </payment>
108
- </sections>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  </config>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <pagofacildirect translate="label" module="paygate">
7
+ <label><![CDATA[PagoF&aacute;cil]]></label>
8
+ <sort_order>501</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
+ <comment></comment>
13
+
14
+ <fields>
15
+ <active translate="label">
16
+ <label>Habilitado</label>
17
+ <frontend_type>select</frontend_type>
18
+ <source_model>adminhtml/system_config_source_yesno</source_model>
19
+ <sort_order>1</sort_order>
20
+ <show_in_default>1</show_in_default>
21
+ <show_in_website>1</show_in_website>
22
+ <show_in_store>0</show_in_store>
23
+ </active>
24
+ <status translate="label">
25
+ <label>Estado de la Orden</label>
26
+ <!-- <comment>despu&eacute;s de autorizar y cobrar en PagoF&aacute;cil</comment> -->
27
+ <frontend_type>select</frontend_type>
28
+ <source_model>pagofacildirect/source</source_model>
29
+ <sort_order>2</sort_order>
30
+ <show_in_default>1</show_in_default>
31
+ <show_in_website>1</show_in_website>
32
+ <show_in_store>0</show_in_store>
33
+ </status>
34
+ <title translate="label">
35
+ <label>Servicio</label>
36
+ <frontend_type>text</frontend_type>
37
+ <sort_order>3</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
+ </title>
42
+ <prod translate="label">
43
+ <label><![CDATA[Entorno Producci&oacute;n]]></label>
44
+ <frontend_type>select</frontend_type>
45
+ <source_model>adminhtml/system_config_source_yesno</source_model>
46
+ <sort_order>4</sort_order>
47
+ <show_in_default>1</show_in_default>
48
+ <show_in_website>1</show_in_website>
49
+ <show_in_store>0</show_in_store>
50
+ </prod>
51
+ <sucursalkey translate="label">
52
+ <label>API Sucursal</label>
53
+ <frontend_type>text</frontend_type>
54
+ <sort_order>6</sort_order>
55
+ <show_in_default>1</show_in_default>
56
+ <show_in_website>1</show_in_website>
57
+ <show_in_store>0</show_in_store>
58
+ </sucursalkey>
59
+ <usuariokey translate="label">
60
+ <label>API Usuario</label>
61
+ <frontend_type>text</frontend_type>
62
+ <sort_order>7</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>0</show_in_store>
66
+ </usuariokey>
67
+ <notify translate="label">
68
+ <label><![CDATA[Enviar Notificaci&oacute;n]]></label>
69
+ <frontend_type>select</frontend_type>
70
+ <source_model>adminhtml/system_config_source_yesno</source_model>
71
+ <sort_order>8</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ <show_in_store>0</show_in_store>
75
+ </notify>
76
+ <divisa translate="label">
77
+ <label>Divisa (USD a MXN)</label>
78
+ <frontend_type>select</frontend_type>
79
+ <source_model>adminhtml/system_config_source_yesno</source_model>
80
+ <sort_order>8</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>0</show_in_store>
84
+ </divisa>
85
+ <msi translate="label">
86
+ <label>Habilitar Meses sin Intereses</label>
87
+ <frontend_type>select</frontend_type>
88
+ <source_model>adminhtml/system_config_source_yesno</source_model>
89
+ <sort_order>9</sort_order>
90
+ <show_in_default>1</show_in_default>
91
+ <show_in_website>1</show_in_website>
92
+ <show_in_store>1</show_in_store>
93
+ </msi>
94
+ <logo translate="label">
95
+ <label><![CDATA[Mostrar Logotipo]]></label>
96
+ <frontend_type>select</frontend_type>
97
+ <source_model>adminhtml/system_config_source_yesno</source_model>
98
+ <sort_order>10</sort_order>
99
+ <show_in_default>1</show_in_default>
100
+ <show_in_website>1</show_in_website>
101
+ <show_in_store>1</show_in_store>
102
+ </logo>
103
+ </fields>
104
+ </pagofacildirect>
105
+ <compropago translate="label" module="paygate">
106
+ <label>Pago Facil - Efectivo</label>
107
+ <sort_order>670</sort_order>
108
+ <show_in_default>1</show_in_default>
109
+ <show_in_website>1</show_in_website>
110
+ <show_in_store>0</show_in_store>
111
+ <fields>
112
+ <active translate="label">
113
+ <label>Habilitar</label>
114
+ <frontend_type>select</frontend_type>
115
+ <source_model>adminhtml/system_config_source_yesno</source_model>
116
+ <sort_order>1</sort_order>
117
+ <show_in_default>1</show_in_default>
118
+ <show_in_website>1</show_in_website>
119
+ <show_in_store>0</show_in_store>
120
+ </active>
121
+ <title translate="label,comment">
122
+ <label>Título</label>
123
+ <comment>
124
+ <![CDATA[
125
+ Este campo se mostrará como etiqueta de metodo de pago.
126
+ ]]>
127
+ </comment>
128
+ <frontend_type>text</frontend_type>
129
+ <sort_order>2</sort_order>
130
+ <show_in_default>1</show_in_default>
131
+ <show_in_website>1</show_in_website>
132
+ <show_in_store>0</show_in_store>
133
+ </title>
134
+ <prod translate="label">
135
+ <label><![CDATA[Entorno Producci&oacute;n]]></label>
136
+ <frontend_type>select</frontend_type>
137
+ <source_model>adminhtml/system_config_source_yesno</source_model>
138
+ <sort_order>4</sort_order>
139
+ <show_in_default>1</show_in_default>
140
+ <show_in_website>1</show_in_website>
141
+ <show_in_store>0</show_in_store>
142
+ </prod>
143
+ <sucursalkey translate="label">
144
+ <label>API Sucursal</label>
145
+ <frontend_type>text</frontend_type>
146
+ <sort_order>6</sort_order>
147
+ <show_in_default>1</show_in_default>
148
+ <show_in_website>1</show_in_website>
149
+ <show_in_store>0</show_in_store>
150
+ </sucursalkey>
151
+ <usuariokey translate="label">
152
+ <label>API Usuario</label>
153
+ <frontend_type>text</frontend_type>
154
+ <sort_order>7</sort_order>
155
+ <show_in_default>1</show_in_default>
156
+ <show_in_website>1</show_in_website>
157
+ <show_in_store>0</show_in_store>
158
+ </usuariokey>
159
+ <order_status_new translate="label">
160
+ <label>Elegir estado de nuevas ordenes</label>
161
+ <comment>
162
+ <![CDATA[
163
+ Ir a "system -> OrderStatuses" y asignar una nueva orden de estado personalizada en la opción de 'new'.
164
+ ]]>
165
+ </comment>
166
+ <frontend_type>select</frontend_type>
167
+ <source_model>adminhtml/system_config_source_order_status</source_model>
168
+ <sort_order>19</sort_order>
169
+ <show_in_default>1</show_in_default>
170
+ <show_in_website>1</show_in_website>
171
+ <show_in_store>1</show_in_store>
172
+ </order_status_new>
173
+ <order_status_approved translate="label">
174
+ <label>Elegir estado de ordenes aprovadas</label>
175
+ <comment>
176
+ <![CDATA[
177
+ Ir a "system -> OrderStatuses" y asignar una nueva orden de estado personalizada en la opción de 'new'.
178
+ ]]>
179
+ </comment>
180
+ <frontend_type>select</frontend_type>
181
+ <source_model>adminhtml/system_config_source_order_status</source_model>
182
+ <sort_order>20</sort_order>
183
+ <show_in_default>1</show_in_default>
184
+ <show_in_website>1</show_in_website>
185
+ <show_in_store>1</show_in_store>
186
+ </order_status_approved>
187
+ <order_status_in_process translate="label">
188
+ <label>Elegir estado de ordenes pendientes</label>
189
+ <comment>
190
+ <![CDATA[
191
+ Ir a "system -> OrderStatuses" y asignar una nueva orden de estado personalizada en la opción de 'new'.
192
+ ]]>
193
+ </comment>
194
+ <frontend_type>select</frontend_type>
195
+ <source_model>adminhtml/system_config_source_order_status</source_model>
196
+ <sort_order>22</sort_order>
197
+ <show_in_default>1</show_in_default>
198
+ <show_in_website>1</show_in_website>
199
+ <show_in_store>1</show_in_store>
200
+ </order_status_in_process>
201
+ <order_status_cancelled translate="label">
202
+ <label>Elegir el estado de las ordenes canceladas</label>
203
+ <comment>
204
+ <![CDATA[
205
+ Ir a "system -> OrderStatuses" y asignar una nueva orden de estado personalizada en la opción de 'new'.
206
+ ]]>
207
+ </comment>
208
+ <frontend_type>select</frontend_type>
209
+ <source_model>adminhtml/system_config_source_order_status</source_model>
210
+ <sort_order>23</sort_order>
211
+ <show_in_default>1</show_in_default>
212
+ <show_in_website>1</show_in_website>
213
+ <show_in_store>1</show_in_store>
214
+ </order_status_cancelled>
215
+ </fields>
216
+ </compropago>
217
+ </groups>
218
+ </payment>
219
+ </sections>
220
  </config>
app/design/frontend/base/default/layout/pagofacildirect.xml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category design
23
+ * @package base_default
24
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ */
27
+
28
+ -->
29
+ <layout version="0.1.0">
30
+ <checkout_onepage_success translate="label">
31
+ <label>One Page Checkout Success</label>
32
+ <reference name="root">
33
+ <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
34
+ </reference>
35
+ <reference name="content">
36
+ <reference name="checkout.success">
37
+ <action method="setTemplate"><template>pagofacildirect/success.phtml</template></action>
38
+ </reference>
39
+ </reference>
40
+ </checkout_onepage_success>
41
+ </layout>
app/design/frontend/base/default/template/pagofacildirect/cash.phtml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * Form payment cash
6
+ *
7
+ * @author Oswaldo Lopez (waldix86@gmail.com)
8
+ */
9
+
10
+ ?>
11
+
12
+ <?php $_code= $this->getMethodCode();
13
+ $_model = $this->getMethod();
14
+ $_getProviders = $_model->getProviders();
15
+ ?>
16
+
17
+ <ul id="payment_form_<?php echo $_code ?>" style="display:none;" >
18
+ <label for="p_method_cpfaster" style="cursor:pointer;">
19
+ <li>
20
+ <select id="<?php echo $_code ?>_mes_expiracion"
21
+ name="payment[store_code]">
22
+ <?php foreach ($_getProviders as $_provider): ?>
23
+ <option value="<?php echo $_provider['internal_name'] ?>"><?php echo $_provider['name'] ?></option>
24
+ <?php endforeach; ?>
25
+ </select>
26
+ </li>
27
+ </label>
28
+ </ul>
29
+ <div>
30
+ <?php echo $this->getMethod()->getConfigData('message');?>
31
+ </div>
32
+
33
+
34
+
35
+
36
+
app/design/frontend/base/default/template/pagofacildirect/pay.phtml CHANGED
@@ -1,290 +1,292 @@
1
- <?php
2
- /**
3
- * @author ivelazquex <isai.velazquez@gmail.com>
4
- */
5
- $_code = $this->getMethodCode();
6
- $_model = $this->getMethod();
7
- $_billingInfo = $_model->getBillingInfo();
8
-
9
- if ($_model->showLogoPagoFacil())
10
- {
11
- ?>
12
- <div id="iframe-warning" class="warning-message">
13
- <a href="https://www.pagofacil.net" target="_blank">
14
- <img src="https://www.pagofacil.net/images/logo_tarjetas.png" width="110" />
15
- </a>
16
- </div>
17
- <?php
18
- }
19
- ?>
20
- <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
21
-
22
- <li>
23
- <label for="<?php echo $_code ?>_nombre" class="required">
24
- <em>*</em><?php echo $this->__('Nombre Titular') ?> :
25
- </label>
26
- <div class="input-box">
27
- <input type="text" title="<?php echo $this->__('Nombre Titular') ?>"
28
- class="input-text required-entry validate-length maximum-length-50"
29
- id="<?php echo $_code ?>_nombre"
30
- name="payment[nombre]"
31
- value="<?php echo substr(trim($_billingInfo['firstname']), 0, 50) ?>"
32
- maxlength="50"
33
- />
34
- </div>
35
- </li>
36
-
37
- <li>
38
- <label for="<?php echo $_code ?>_apellidos" class="required">
39
- <em>*</em><?php echo $this->__('Apellidos Titular') ?> :
40
- </label>
41
- <div class="input-box">
42
- <input type="text" title="<?php echo $this->__('Apellidos Titular') ?>"
43
- class="input-text required-entry validate-length maximum-length-50"
44
- id="<?php echo $_code ?>_apellidos"
45
- name="payment[apellidos]"
46
- value="<?php echo substr(trim($_billingInfo['lastname']), 0, 50) ?>"
47
- maxlength="50"
48
- />
49
- </div>
50
- </li>
51
-
52
- <li>
53
- <label for="<?php echo $_code ?>_numero_tarjeta" class="required">
54
- <em>*</em><?php echo $this->__('N&uacute;mero Tarjeta') ?> :
55
- </label>
56
- <div class="input-box">
57
- <input type="text" title="<?php echo $this->__('N&uacute;mero Tarjeta') ?>"
58
- class="input-text required-entry validate-digits validate-length minimum-length-15 maximum-length-16"
59
- id="<?php echo $_code; ?>_numero_tarjeta"
60
- name="payment[numero_tarjeta]"
61
- value=""
62
- maxlength="16"
63
- />
64
- </div>
65
- </li>
66
-
67
- <li>
68
- <label for="<?php echo $_code ?>_cvt" class="required">
69
- <em>*</em>CVT (<?php echo $this->__('c&oacute;digo de seguridad de la tarjeta') ?>) :
70
- </label>
71
- <div class="input-box">
72
- <div class="v-fix">
73
- <input type="text" title="<?php echo $this->__('c&oacute;digo de seguridad de la tarjeta') ?>"
74
- class="input-text required-entry validate-digits validate-length minimum-length-3 maximum-length-4"
75
- id="<?php echo $_code ?>_cvt"
76
- name="payment[cvt]"
77
- value=""
78
- maxlength="4"
79
- />
80
- </div>
81
- </div>
82
- <div class="v-fix">
83
- <a class="cvv-what-is-this" href="#"><?php echo $this->__('Qu&eacute; es esto') ?>?</a>
84
- </div>
85
- </li>
86
-
87
- <li>
88
- <label for="<?php echo $_code ?>_mes_expiracion" class="required">
89
- <em>*</em><?php echo $this->__('Fecha de Expiraci&oacute;n') ?> :
90
- </label>
91
- <div class="input-box">
92
- <div class="v-fix">
93
- <select class="required-entry"
94
- id="<?php echo $_code ?>_mes_expiracion"
95
- name="payment[mes_expiracion]"
96
- >
97
- <option value=""><?php echo $this->__('Mes') ?></option>
98
- <option value="01">01 - enero</option>
99
- <option value="02">02 - febrero</option>
100
- <option value="03">03 - marzo</option>
101
- <option value="04">04 - abril</option>
102
- <option value="05">05 - mayo</option>
103
- <option value="06">06 - junio</option>
104
- <option value="07">07 - julio</option>
105
- <option value="08">08 - agosto</option>
106
- <option value="09">09 - septiembre</option>
107
- <option value="10">10 - octubre</option>
108
- <option value="11">11 - noviembre</option>
109
- <option value="12">12 - diciembre</option>
110
- </select>
111
- </div>
112
- </div>
113
- <div class="v-fix">
114
- <select class="required-entry"
115
- id="<?php echo $_code ?>_anyo_expiracion"
116
- name="payment[anyo_expiracion]"
117
- >
118
- <option value=""><?php echo $this->__('A&ntilde;o') ?></option>
119
- <?php
120
- $anyoActual = date('Y');
121
- $anyoHasta = $anyoActual + 10;
122
- for($i = $anyoActual; $i <= $anyoHasta; $i++)
123
- {
124
- echo '<option value="' . substr($i, -2).'">'.$i.'</option>';
125
- }
126
- ?>
127
- </select>
128
- </div>
129
- </li>
130
-
131
- <li>
132
- <label for="<?php echo $_code ?>_telefono" class="required">
133
- <em>*</em><?php echo $this->__('Tel&eacute;fono(10 d&iacute;gitos)') ?> :
134
- </label>
135
- <div class="input-box">
136
- <input type="text" title="<?php echo $this->__('Telefono(10 d&iacute;gitos)') ?>"
137
- class="input-text required-entry validate-digits validate-length minimum-length-10 maximum-length-10"
138
- id="<?php echo $_code ?>_telefono"
139
- name="payment[telefono]"
140
- value="<?php echo substr(trim($_billingInfo['telephone']), 0, 10) ?>"
141
- maxlength="10"
142
- />
143
- </div>
144
- </li>
145
-
146
- <li>
147
- <label for="<?php echo $_code ?>_celular" class="required">
148
- <em>*</em><?php echo $this->__('Celular(10 d&iacute;gitos)') ?> :
149
- </label>
150
- <div class="input-box">
151
- <input type="text" title="<?php echo $this->__('Celular(10 d&iacute;gitos)') ?>"
152
- class="input-text required-entry validate-digits validate-length minimum-length-10 maximum-length-10"
153
- id="<?php echo $_code ?>_celular"
154
- name="payment[celular]"
155
- value="<?php echo substr(trim($_billingInfo['telephone']), 0, 10) ?>"
156
- maxlength="10"
157
- />
158
- </div>
159
- </li>
160
-
161
- <li>
162
- <label for="<?php echo $_code ?>_calley_numero" class="required">
163
- <em>*</em><?php echo $this->__('Calle y N&uacute;mero') ?> :
164
- </label>
165
- <div class="input-box">
166
- <input type="text" title="<?php echo $this->__('Calle y N&uacute;mero') ?>"
167
- class="input-text required-entry validate-length maximum-length-45"
168
- id="<?php echo $_code ?>_calley_numero"
169
- name="payment[calley_numero]"
170
- value="<?php echo substr(trim($_billingInfo['street']), 0, 45) ?>"
171
- maxlength="45"
172
- />
173
- </div>
174
- </li>
175
-
176
- <li>
177
- <label for="<?php echo $_code ?>_colonia" class="required">
178
- <em>*</em><?php echo $this->__('Colonia') ?> :
179
- </label>
180
- <div class="input-box">
181
- <input type="text" title="<?php echo $this->__('Colonia') ?>"
182
- class="input-text required-entry validate-length maximum-length-30"
183
- id="<?php echo $_code ?>_colonia"
184
- name="payment[colonia]"
185
- value=""
186
- maxlength="30"
187
- />
188
- </div>
189
- </li>
190
-
191
- <li>
192
- <label for="<?php echo $_code ?>_municipio" class="required">
193
- <em>*</em><?php echo $this->__('Municipio') ?> :
194
- </label>
195
- <div class="input-box">
196
- <input type="text" title="<?php echo $this->__('Municipio') ?>"
197
- class="input-text required-entry validate-length maximum-length-30"
198
- id="<?php echo $_code ?>_municipio"
199
- name="payment[municipio]"
200
- value="<?php echo substr(trim($_billingInfo['city']), 0, 30) ?>"
201
- maxlength="30"
202
- />
203
- </div>
204
- </li>
205
-
206
- <li>
207
- <label for="<?php echo $_code ?>_estado" class="required">
208
- <em>*</em><?php echo $this->__('Estado') ?> :
209
- </label>
210
- <div class="input-box">
211
- <input type="text" title="<?php echo $this->__('Estado') ?>"
212
- class="input-text required-entry validate-length maximum-length-45"
213
- id="<?php echo $_code ?>_estado"
214
- name="payment[estado]"
215
- value="<?php echo substr(trim($_billingInfo['region']), 0, 45) ?>"
216
- maxlength="45"
217
- />
218
- </div>
219
- </li>
220
-
221
- <li>
222
- <label for="<?php echo $_code ?>_pais" class="required">
223
- <em>*</em><?php echo $this->__('Pa&iacute;s') ?> :
224
- </label>
225
- <div class="input-box">
226
- <input type="text" title="<?php echo $this->__('Pa&iacute;s') ?>"
227
- class="input-text required-entry validate-length maximum-length-50"
228
- id="<?php echo $_code ?>_pais"
229
- name="payment[pais]"
230
- value="<?php echo substr(trim($_billingInfo['country']), 0, 50) ?>"
231
- maxlength="50"
232
- />
233
- </div>
234
- </li>
235
-
236
- <li>
237
- <label for="<?php echo $_code ?>_cp" class="required">
238
- <em>*</em><?php echo $this->__('C&oacute;digo Postal') ?> :
239
- </label>
240
- <div class="input-box">
241
- <input type="text" title="<?php echo $this->__('C&oacute;digo Postal') ?>"
242
- class="input-text required-entry validate-zip-international validate-length maximum-length-9"
243
- id="<?php echo $_code ?>_cp"
244
- name="payment[cp]"
245
- value="<?php echo substr(trim($_billingInfo['postcode']), 0, 9) ?>"
246
- maxlength="9"
247
- />
248
- </div>
249
- </li>
250
-
251
- <li>
252
- <label for="<?php echo $_code ?>_email" class="required">
253
- <em>*</em><?php echo $this->__('Correo Electr&oacute;nico') ?> :
254
- </label>
255
- <div class="input-box">
256
- <input type="text" title="<?php echo $this->__('Correo Electr&oacute;nico') ?>"
257
- class="input-text required-entry validate-email validate-length maximum-length-200"
258
- id="<?php echo $_code ?>_email"
259
- name="payment[email]"
260
- value="<?php echo substr(trim($_billingInfo['email']), 0, 200) ?>"
261
- maxlength="200"
262
- />
263
- </div>
264
- </li>
265
- <?php
266
- if ($_model->enabledMSI())
267
- {
268
- ?>
269
- <li>
270
- <label for="<?php echo $_code ?>_msi" class="required">
271
- <?php echo $this->__('Meses Sin Intereses') ?> :
272
- </label>
273
- <div class="input-box">
274
- <select class="" id="<?php echo $_code ?>_msi" name="payment[msi]">
275
- <option value="00">Seleccione</option>
276
- <optgroup label="MasterCard/Visa"></optgroup>
277
- <option value="03">3 Meses</option>
278
- <option value="06">6 Meses</option>
279
- <optgroup label="American Express"></optgroup>
280
- <option value="03">3 Meses</option>
281
- <option value="06">6 Meses</option>
282
- <option value="09">9 Meses</option>
283
- <option value="12">12 Meses</option>
284
- </select>
285
- </div>
286
- </li>
287
- <?php
288
- }
289
- ?>
 
 
290
  </ul>
1
+ <?php
2
+ /**
3
+ * @author ivelazquex <isai.velazquez@gmail.com>
4
+ */
5
+ $_code = $this->getMethodCode();
6
+ $_model = $this->getMethod();
7
+ $_billingInfo = $_model->getBillingInfo();
8
+
9
+ if ($_model->showLogoPagoFacil())
10
+ {
11
+ ?>
12
+ <div id="iframe-warning" class="warning-message">
13
+ <a href="https://www.pagofacil.net" target="_blank">
14
+ <img src="https://www.pagofacil.net/images/logo_tarjetas.png" width="110" />
15
+ </a>
16
+ </div>
17
+ <?php
18
+ }
19
+ ?>
20
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
21
+
22
+ <li>
23
+ <label for="<?php echo $_code ?>_nombre" class="required">
24
+ <em>*</em><?php echo $this->__('Nombre Titular') ?> :
25
+ </label>
26
+ <div class="input-box">
27
+ <input type="text" title="<?php echo $this->__('Nombre Titular') ?>"
28
+ class="input-text required-entry validate-length maximum-length-50"
29
+ id="<?php echo $_code ?>_nombre"
30
+ name="payment[nombre]"
31
+ value="<?php echo substr(trim($_billingInfo['firstname']), 0, 50) ?>"
32
+ maxlength="50"
33
+ />
34
+ </div>
35
+ </li>
36
+
37
+ <li>
38
+ <label for="<?php echo $_code ?>_apellidos" class="required">
39
+ <em>*</em><?php echo $this->__('Apellidos Titular') ?> :
40
+ </label>
41
+ <div class="input-box">
42
+ <input type="text" title="<?php echo $this->__('Apellidos Titular') ?>"
43
+ class="input-text required-entry validate-length maximum-length-50"
44
+ id="<?php echo $_code ?>_apellidos"
45
+ name="payment[apellidos]"
46
+ value="<?php echo substr(trim($_billingInfo['lastname']), 0, 50) ?>"
47
+ maxlength="50"
48
+ />
49
+ </div>
50
+ </li>
51
+
52
+ <li>
53
+ <label for="<?php echo $_code ?>_numero_tarjeta" class="required">
54
+ <em>*</em><?php echo $this->__('N&uacute;mero Tarjeta') ?> :
55
+ </label>
56
+ <div class="input-box">
57
+ <input type="text" title="<?php echo $this->__('N&uacute;mero Tarjeta') ?>"
58
+ class="input-text required-entry validate-digits validate-length minimum-length-15 maximum-length-16"
59
+ id="<?php echo $_code; ?>_numero_tarjeta"
60
+ name="payment[numero_tarjeta]"
61
+ value=""
62
+ maxlength="16"
63
+ />
64
+ </div>
65
+ </li>
66
+
67
+ <li>
68
+ <label for="<?php echo $_code ?>_cvt" class="required">
69
+ <em>*</em>CVT (<?php echo $this->__('c&oacute;digo de seguridad de la tarjeta') ?>) :
70
+ </label>
71
+ <div class="input-box">
72
+ <div class="v-fix">
73
+ <input type="text" title="<?php echo $this->__('c&oacute;digo de seguridad de la tarjeta') ?>"
74
+ class="input-text required-entry validate-digits validate-length minimum-length-3 maximum-length-4"
75
+ id="<?php echo $_code ?>_cvt"
76
+ name="payment[cvt]"
77
+ value=""
78
+ maxlength="4"
79
+ />
80
+ </div>
81
+ </div>
82
+ <div class="v-fix">
83
+ <a class="cvv-what-is-this" href="#"><?php echo $this->__('Qu&eacute; es esto') ?>?</a>
84
+ </div>
85
+ </li>
86
+
87
+ <li>
88
+ <label for="<?php echo $_code ?>_mes_expiracion" class="required">
89
+ <em>*</em><?php echo $this->__('Fecha de Expiraci&oacute;n') ?> :
90
+ </label>
91
+ <div class="input-box">
92
+ <div class="v-fix">
93
+ <select class="required-entry"
94
+ id="<?php echo $_code ?>_mes_expiracion"
95
+ name="payment[mes_expiracion]"
96
+ >
97
+ <option value=""><?php echo $this->__('Mes') ?></option>
98
+ <option value="01">01 - enero</option>
99
+ <option value="02">02 - febrero</option>
100
+ <option value="03">03 - marzo</option>
101
+ <option value="04">04 - abril</option>
102
+ <option value="05">05 - mayo</option>
103
+ <option value="06">06 - junio</option>
104
+ <option value="07">07 - julio</option>
105
+ <option value="08">08 - agosto</option>
106
+ <option value="09">09 - septiembre</option>
107
+ <option value="10">10 - octubre</option>
108
+ <option value="11">11 - noviembre</option>
109
+ <option value="12">12 - diciembre</option>
110
+ </select>
111
+ </div>
112
+ </div>
113
+ <div class="v-fix">
114
+ <select class="required-entry"
115
+ id="<?php echo $_code ?>_anyo_expiracion"
116
+ name="payment[anyo_expiracion]"
117
+ >
118
+ <option value=""><?php echo $this->__('A&ntilde;o') ?></option>
119
+ <?php
120
+ $anyoActual = date('Y');
121
+ $anyoHasta = $anyoActual + 10;
122
+ for($i = $anyoActual; $i <= $anyoHasta; $i++)
123
+ {
124
+ echo '<option value="' . substr($i, -2).'">'.$i.'</option>';
125
+ }
126
+ ?>
127
+ </select>
128
+ </div>
129
+ </li>
130
+
131
+ <li>
132
+ <label for="<?php echo $_code ?>_telefono" class="required">
133
+ <em>*</em><?php echo $this->__('Tel&eacute;fono(10 d&iacute;gitos)') ?> :
134
+ </label>
135
+ <div class="input-box">
136
+ <input type="text" title="<?php echo $this->__('Telefono(10 d&iacute;gitos)') ?>"
137
+ class="input-text required-entry validate-digits validate-length minimum-length-10 maximum-length-10"
138
+ id="<?php echo $_code ?>_telefono"
139
+ name="payment[telefono]"
140
+ value="<?php echo substr(trim($_billingInfo['telephone']), 0, 10) ?>"
141
+ maxlength="10"
142
+ />
143
+ </div>
144
+ </li>
145
+
146
+ <li>
147
+ <label for="<?php echo $_code ?>_celular" class="required">
148
+ <em>*</em><?php echo $this->__('Celular(10 d&iacute;gitos)') ?> :
149
+ </label>
150
+ <div class="input-box">
151
+ <input type="text" title="<?php echo $this->__('Celular(10 d&iacute;gitos)') ?>"
152
+ class="input-text required-entry validate-digits validate-length minimum-length-10 maximum-length-10"
153
+ id="<?php echo $_code ?>_celular"
154
+ name="payment[celular]"
155
+ value="<?php echo substr(trim($_billingInfo['telephone']), 0, 10) ?>"
156
+ maxlength="10"
157
+ />
158
+ </div>
159
+ </li>
160
+
161
+ <li>
162
+ <label for="<?php echo $_code ?>_calley_numero" class="required">
163
+ <em>*</em><?php echo $this->__('Calle y N&uacute;mero') ?> :
164
+ </label>
165
+ <div class="input-box">
166
+ <input type="text" title="<?php echo $this->__('Calle y N&uacute;mero') ?>"
167
+ class="input-text required-entry validate-length maximum-length-45"
168
+ id="<?php echo $_code ?>_calley_numero"
169
+ name="payment[calley_numero]"
170
+ value="<?php echo substr(trim($_billingInfo['street']), 0, 45) ?>"
171
+ maxlength="45"
172
+ />
173
+ </div>
174
+ </li>
175
+
176
+ <li>
177
+ <label for="<?php echo $_code ?>_colonia" >
178
+ <em>*</em><?php echo $this->__('Colonia') ?> :
179
+ </label>
180
+ <div class="input-box">
181
+ <input type="text" title="<?php echo $this->__('Colonia') ?>"
182
+ class="input-text validate-length maximum-length-30"
183
+ id="<?php echo $_code ?>_colonia"
184
+ name="payment[colonia]"
185
+ value=""
186
+ maxlength="30"
187
+ />
188
+ </div>
189
+ </li>
190
+
191
+ <li>
192
+ <label for="<?php echo $_code ?>_municipio" class="required">
193
+ <em>*</em><?php echo $this->__('Municipio') ?> :
194
+ </label>
195
+ <div class="input-box">
196
+ <input type="text" title="<?php echo $this->__('Municipio') ?>"
197
+ class="input-text required-entry validate-length maximum-length-30"
198
+ id="<?php echo $_code ?>_municipio"
199
+ name="payment[municipio]"
200
+ value="<?php echo substr(trim($_billingInfo['city']), 0, 30) ?>"
201
+ maxlength="30"
202
+ />
203
+ </div>
204
+ </li>
205
+
206
+ <li>
207
+ <label for="<?php echo $_code ?>_estado" class="required">
208
+ <em>*</em><?php echo $this->__('Estado') ?> :
209
+ </label>
210
+ <div class="input-box">
211
+ <input type="text" title="<?php echo $this->__('Estado') ?>"
212
+ class="input-text required-entry validate-length maximum-length-45"
213
+ id="<?php echo $_code ?>_estado"
214
+ name="payment[estado]"
215
+ value="<?php echo substr(trim($_billingInfo['region']), 0, 45) ?>"
216
+ maxlength="45"
217
+ />
218
+ </div>
219
+ </li>
220
+
221
+ <li>
222
+ <label for="<?php echo $_code ?>_pais" class="required">
223
+ <em>*</em><?php echo $this->__('Pa&iacute;s') ?> :
224
+ </label>
225
+ <div class="input-box">
226
+ <input type="text" title="<?php echo $this->__('Pa&iacute;s') ?>"
227
+ class="input-text required-entry validate-length maximum-length-50"
228
+ id="<?php echo $_code ?>_pais"
229
+ name="payment[pais]"
230
+ value="<?php echo substr(trim($_billingInfo['country']), 0, 50) ?>"
231
+ maxlength="50"
232
+ />
233
+ </div>
234
+ </li>
235
+
236
+ <li>
237
+ <label for="<?php echo $_code ?>_cp" class="required">
238
+ <em>*</em><?php echo $this->__('C&oacute;digo Postal') ?> :
239
+ </label>
240
+ <div class="input-box">
241
+ <input type="text" title="<?php echo $this->__('C&oacute;digo Postal') ?>"
242
+ class="input-text required-entry validate-zip-international validate-length maximum-length-9"
243
+ id="<?php echo $_code ?>_cp"
244
+ name="payment[cp]"
245
+ value="<?php echo substr(trim($_billingInfo['postcode']), 0, 9) ?>"
246
+ maxlength="9"
247
+ />
248
+ </div>
249
+ </li>
250
+
251
+ <li>
252
+ <label for="<?php echo $_code ?>_email" class="required">
253
+ <em>*</em><?php echo $this->__('Correo Electr&oacute;nico') ?> :
254
+ </label>
255
+ <div class="input-box">
256
+ <input type="text" title="<?php echo $this->__('Correo Electr&oacute;nico') ?>"
257
+ class="input-text required-entry validate-email validate-length maximum-length-200"
258
+ id="<?php echo $_code ?>_email"
259
+ name="payment[email]"
260
+ value="<?php echo substr(trim($_billingInfo['email']), 0, 200) ?>"
261
+ maxlength="200"
262
+ />
263
+ </div>
264
+ </li>
265
+ <?php
266
+ if ($_model->enabledMSI())
267
+ {
268
+ ?>
269
+ <li>
270
+ <label for="<?php echo $_code ?>_msi" class="required">
271
+ <?php echo $this->__('Meses Sin Intereses') ?> :
272
+ </label>
273
+ <div class="input-box">
274
+ <select class="" id="<?php echo $_code ?>_msi" name="payment[msi]">
275
+ <option value="00">Seleccione</option>
276
+ <optgroup label="MasterCard/Visa"></optgroup>
277
+ <option value="03">3 Meses</option>
278
+ <option value="06">6 Meses</option>
279
+ <option value="09">9 Meses</option>
280
+ <option value="12">12 Meses</option>
281
+ <optgroup label="American Express"></optgroup>
282
+ <option value="03">3 Meses</option>
283
+ <option value="06">6 Meses</option>
284
+ <option value="09">9 Meses</option>
285
+ <option value="12">12 Meses</option>
286
+ </select>
287
+ </div>
288
+ </li>
289
+ <?php
290
+ }
291
+ ?>
292
  </ul>
app/design/frontend/base/default/template/pagofacildirect/success.phtml ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author waldix <waldix86@gmail.com>
4
+ */
5
+ ?>
6
+ <link rel="stylesheet" href="<?php echo $this->getSkinUrl('css/pagofacil/pagofacil.css'); ?>" />
7
+ <link href="<?php echo $this->getSkinUrl('css/pagofacil/pagofacil.css'); ?>" rel="stylesheet" type="text/css" media="screen, print" />
8
+ <div class="page-title">
9
+ <h3>¡Felicitaciones! Su pedido ha sido generado correctamente.</h3>
10
+ </div>
11
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
12
+ <?php $convenience_store = Mage::getSingleton('core/session')->getConvenienceStore();
13
+ $store_fixed_rate = Mage::getSingleton('core/session')->getStoreFixedRate();
14
+ $store_schedule = Mage::getSingleton('core/session')->getStoreSchedule();
15
+ $store_image = Mage::getSingleton('core/session')->getStoreImage();
16
+ $bank_account_number = Mage::getSingleton('core/session')->getBankAccountNumber();
17
+ $bank = Mage::getSingleton('core/session')->getBank();
18
+ $expiration_date = Mage::getSingleton('core/session')->getExpirationDate();
19
+ $amount = Mage::getSingleton('core/session')->getAmount();
20
+ $reference = Mage::getSingleton('core/session')->getReference();
21
+ $name = Mage::getSingleton('core/session')->getNameItem();
22
+ ?>
23
+
24
+ <?php if ($this->getOrderId()):?>
25
+ <?php if ($this->getCanViewOrder()) :?>
26
+ <p><?php echo $this->__('Your order # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getViewOrderUrl()), $this->escapeHtml($this->getOrderId()))) ?></p>
27
+ <?php else :?>
28
+ <div class="cp-instruction-section">
29
+ <div class="expiration-date">
30
+ Último día para pagar:
31
+ <span >
32
+ <?php echo date('d-m-Y', strtotime($this->__($expiration_date))) ?>
33
+ </span>
34
+ </div>
35
+
36
+ <div class="cp-title">Seguir los siguientes pasos:</div>
37
+
38
+ <div class="cp-step-box">
39
+ <div class="cp-step">
40
+ <div class="cp-num">1.</div> <span> Ir a la caja <?php echo $this->__($convenience_store) ?> de <?php echo $this->__($store_schedule) ?> </span> <img src="<?php echo $this->__($store_image) ?>" class="cp-image-store" />
41
+ </div>
42
+ <div class="cp-step">
43
+ <div class="cp-num">2.</div> Solicitar depósito a cuenta (debito): <?php echo $this->__($bank) ?> - <?php echo $this->__($bank_account_number) ?>
44
+ </div>
45
+ <div class="cp-step">
46
+ <div class="cp-num">3.</div> Deposita la cantidad <b>EXACTA</b> de: $<b><?php echo $this->__($amount) ?></b>
47
+ </div>
48
+ </div>
49
+ <hr class="cp-grey">
50
+ <span class="cp-note" style="font-size:12px;color: #333;">Oxxo/7Eleven/Extra cobra en caja una comisión de $7.00/$8.00 por concepto de recepción de cobranza.</span>
51
+ </div>
52
+
53
+ <div class="cp-warning-box">
54
+ <img src="<?php echo $this->getSkinUrl('images/pagofacil/warning.png'); ?>" style="margin: -7px 0px 0px 0px;">
55
+ <span style="font-size: 12px;"><b>Importante</b></span>
56
+ <ul style="" class="cp-warning">
57
+ <li>El ID de control es: <b><?php echo $this->__($reference) ?></b></li>
58
+ <li>El número de cuenta/tarjeta asignado es único por cada orden de compra.</li>
59
+ <li>Orden válida antes de <?php echo date('d/m/Y', strtotime($this->__($expiration_date))) ?>, en caso de vencimiento genera una nueva compra.</li>
60
+
61
+ <li>Las tiendas <?php echo $this->__($convenience_store) ?> cobran en caja una comisión de $ <?php echo $this->__($store_fixed_rate) ?> por el concepto de recepción de cobranza.</li>
62
+
63
+ </ul>
64
+ </div>
65
+ <?php endif;?>
66
+ <?php if ($this->getCanViewOrder() && $this->getCanPrintOrder()) :?>
67
+ <p>
68
+ <?php echo $this->__('Click <a href="%s" onclick="this.target=\'_blank\'">here to print</a> a copy of your order confirmation.', $this->getPrintUrl()) ?>
69
+ <?php echo $this->getChildHtml() ?>
70
+ </p>
71
+ <?php endif;?>
72
+ <?php endif;?>
73
+
74
+ <?php if ($this->getAgreementRefId()): ?>
75
+ <p><?php echo $this->__('Your billing agreement # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getAgreementUrl()), $this->escapeHtml($this->getAgreementRefId())))?></p>
76
+ <?php endif;?>
77
+
78
+ <?php if ($profiles = $this->getRecurringProfiles()):?>
79
+ <p><?php echo $this->__('Your recurring payment profiles:'); ?></p>
80
+ <ul class="disc">
81
+ <?php foreach($profiles as $profile):?>
82
+ <?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')));?>
83
+ <li><?php echo $this->__('Payment profile # %s: "%s".', $profileIdHtml, $this->escapeHtml($this->getObjectData($profile, 'schedule_description')))?></li>
84
+ <?php endforeach;?>
85
+ </ul>
86
+ <?php endif;?>
87
+
88
+ <div class="buttons-set">
89
+ <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>
90
+ <button type="button" class="button" title="Imprimir" onclick="window.print(); return false;"><span><span>Imprimir</span></span></button>
91
+ </div>
app/etc/modules/Pagofacil_Pagofacildirect.xml CHANGED
@@ -1,12 +1,12 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Pagofacil_Pagofacildirect>
5
- <active>true</active>
6
- <codePool>local</codePool>
7
- <depends>
8
- <Mage_Payment />
9
- </depends>
10
- </Pagofacil_Pagofacildirect>
11
- </modules>
12
  </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Pagofacil_Pagofacildirect>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ <depends>
8
+ <Mage_Payment />
9
+ </depends>
10
+ </Pagofacil_Pagofacildirect>
11
+ </modules>
12
  </config>
package.xml CHANGED
@@ -1,25 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>pagofacil</name>
4
- <version>2.0.0</version>
5
  <stability>stable</stability>
6
- <license uri="http://opensource.org/licenses/gpl-license.php">GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Online Payment Processor</summary>
10
- <description>PagoF&#xE1;cil is a payment service company in Mexico currently offering web and mobile solutions.&#xD;
11
- Start accepting American Express, JCB, MasterCard and Visa either credit or debit with the best rates in the market.&#xD;
12
- The extension integrate completely in your website without leaving the domain or changing the look and feel of the store.&#xD;
13
- The service includes the option for Deferred payments into 3, 6, 9 or 12 months, for your customers.&#xD;
14
- If you don&#x2019;t have an account you can register for free: http://www.pagofacil.net/registros</description>
15
- <notes>- send mail to the buyer by PagoFacil&#xD;
16
- - enable installments&#xD;
17
- - show logo PagoFacil&#xD;
18
- - exchange</notes>
19
- <authors><author><name>isai velazquez</name><user>pagofacil</user><email>soporte@pagofacil.net</email></author></authors>
20
- <date>2014-01-15</date>
21
- <time>22:35:56</time>
22
- <contents><target name="magelocal"><dir name="Pagofacil"><dir name="Pagofacildirect"><dir name="Block"><file name="Form.php" hash="d7048b534c8fd6824078c3d49df0d58c"/></dir><dir name="Helper"><file name="Data.php" hash="36d6bb0b16e6d0b60b15abd8e99c53ea"/></dir><dir name="Model"><file name="Api.php" hash="4c191a165fb80cffa4257e4d135d2037"/><file name="Observer.php" hash="e95aefed6ba407f571d7fbedee328990"/><file name="Source.php" hash="a53e9e90bd41e4f627de4d3222459fe0"/><file name="Standard.php" hash="0548c7d3cf0d3ad967b7e0cc43545e4f"/></dir><dir name="etc"><file name="config.xml" hash="de301d47b00688b44abaf8f07ffe2d7e"/><file name="system.xml" hash="29dfbe6b0756f0956ed40b65e20a8d67"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="pagofacildirect"><file name="pay.phtml" hash="359aa8a305ae01dc80cea42cbaac2a54"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Pagofacil_Pagofacildirect.xml" hash="2c7e994b76e28272ed97929e9a1057d8"/></dir></target></contents>
23
  <compatible/>
24
- <dependencies><required><php><min>5.2.0</min><max>5.4.16</max></php><extension><name>curl</name><min></min><max></max></extension></required></dependencies>
25
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>pagofacil</name>
4
+ <version>3.0.0</version>
5
  <stability>stable</stability>
6
+ <license>GNU General Public License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Online Payment Processor</summary>
10
+ <description>PagoF&#xE1;cil is an important Mexican Payments Gateway offering web and mobile solutions. Start accepting American Express, MasterCard and Visa either credit or debit cards with the best rates in the market. The extension integrates completely in your website without leaving the domain or changing the look and feel of the store. The service includes the option for Deferred payments into 3, 6, 9 or 12 months, and the latest and most advanced product in the market: cash payments; this is extension with the best value for your customers. If you don&#x2019;t have an account you can register for free: http://www.pagofacil.net/registros</description>
11
+ <notes>Add cash payments</notes>
12
+ <authors><author><name>isai velazquez</name><user>ivelazquex</user><email>isai.velazquez@gmail.com</email></author><author><name>oswaldo lopez</name><user>waldix</user><email>waldix86@gmail.com</email></author></authors>
13
+ <date>2015-10-23</date>
14
+ <time>22:55:21</time>
15
+ <contents><target name="magelocal"><dir name="Pagofacil"><dir name="Pagofacildirect"><dir name="Block"><file name="CashForm.php" hash="a57db195f436949e264e4dc3ee3f7b50"/><file name="Form.php" hash="6ae09ff5ba2f43725c4728e9859f0a00"/><dir name="Onepage"><file name="Success.php" hash="0914ef203ff0167788b805ccb03b737d"/></dir></dir><dir name="Helper"><file name="Data.php" hash="3bd654c332485269a6c151535b99aa6c"/></dir><dir name="Model"><file name="Api.php" hash="69ad889aa1710bf2fdb888782df27248"/><file name="CashCP.php" hash="17e94d5ec29cf484dfab4b47a3f59913"/><file name="Observer.php" hash="705c6a36dd433f69e0d0ad10e14ddf09"/><file name="Source.php" hash="a53e9e90bd41e4f627de4d3222459fe0"/><file name="Standard.php" hash="d8ef3bcfa57c24adce8c33daa85fbb3f"/></dir><dir name="controllers"><file name="WebhookController.php" hash="68940fb84c142c7f4cfc2682c3d95670"/></dir><dir name="etc"><file name="config.xml" hash="e0490e525e3e3b0ebf26c86eedaba23c"/><file name="system.xml" hash="3dca12425dc7761aefefdba769c933e2"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="pagofacildirect.xml" hash="f7821ec4977e06e6ebfd6c266729910c"/></dir><dir name="template"><dir name="pagofacildirect"><file name="cash.phtml" hash="4bdbb5936f9878f4ab3f7b1062de75ea"/><file name="pay.phtml" hash="6a83e55210105eb40eeab581edd57617"/><file name="success.phtml" hash="f982fb2549865927230bd10669854f5d"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Pagofacil_Pagofacildirect.xml" hash="1de5dec2b8aac0f2984265084de69965"/></dir></target></contents>
 
 
 
 
 
 
 
16
  <compatible/>
17
+ <dependencies><required><php><min>5.2.17</min><max>5.6.14</max></php></required></dependencies>
18
  </package>