pagofacil - Version 2.0.0

Version Notes

- send mail to the buyer by PagoFacil
- enable installments
- show logo PagoFacil
- exchange

Download this release

Release Info

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


Version 2.0.0

app/code/local/Pagofacil/Pagofacildirect/Block/Form.php ADDED
@@ -0,0 +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
+ }
app/code/local/Pagofacil/Pagofacildirect/Helper/Data.php ADDED
@@ -0,0 +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
+ }
app/code/local/Pagofacil/Pagofacildirect/Model/Api.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * API para el consumo de los servicios
4
+ * de PagoFacil
5
+ * @author ivelazquex <isai.velazquez@gmail.com>
6
+ */
7
+ class Pagofacil_Pagofacildirect_Model_Api
8
+ {
9
+ // --- ATTRIBUTES ---
10
+ /**
11
+ * URL del servicio de PagoFacil para pruebas
12
+ * @var string
13
+ */
14
+ protected $_urlDemo = 'https://www.pagofacil.net/st/public/Wsrtransaccion/index/format/json';
15
+
16
+ /**
17
+ * URL del servicio de PagoFacil en ambiente de produccion
18
+ * @var string
19
+ */
20
+ protected $_urlProd = 'https://www.pagofacil.net/ws/public/Wsrtransaccion/index/format/json';
21
+
22
+ /**
23
+ * Clave de sucursal para el entorno de pruebasa(STAGE)
24
+ * @var string
25
+ */
26
+ protected $_sucursalKeyDemo = "60f961360ca187d533d5adba7d969d6334771370";
27
+
28
+ /**
29
+ * Clave de usuario para el entorno de pruebas(STAGE)
30
+ * @var string
31
+ */
32
+ protected $_usuarioKeyDemo = "62ad6f592ecf2faa87ef2437ed85a4d175e73c58";
33
+
34
+ /**
35
+ * respuesta sin parsear del servicio
36
+ * @var string
37
+ */
38
+ protected $_response = NULL;
39
+
40
+
41
+ // --- OPERATIONS ---
42
+
43
+ public function __construct()
44
+ {
45
+
46
+ }
47
+
48
+ /**
49
+ * consume el servicio de pago de PagoFacil
50
+ * @param string[] vector con la informacion de la peticion
51
+ * @return mixed respuesta del consumo del servicio
52
+ * @throws Exception
53
+ */
54
+ public function payment($info)
55
+ {
56
+ $response = null;
57
+ // NOTA la url a la cual s edebe conectar en produccion no viene
58
+ // la direccion de produccion en el documento
59
+
60
+ if (!is_array($info))
61
+ {
62
+ throw new Exception('parameter is not an array');
63
+ }
64
+
65
+ $info['url'] = $this->_urlProd;
66
+ // determinar si el entorno es para pruebas
67
+ if ($info['prod'] == '0')
68
+ {
69
+ $info['url'] = $this->_urlDemo;
70
+ $info['idSucursal'] = $this->_sucursalKeyDemo;
71
+ $info['idUsuario'] = $this->_usuarioKeyDemo;
72
+ }
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);
125
+ curl_close($ch);
126
+
127
+ // tratamiento de la respuesta del servicio
128
+ $response = json_decode($this->_response,true);
129
+ $response = $response['WebServices_Transacciones']['transaccion'];
130
+
131
+ return $response;
132
+ }
133
+
134
+ /**
135
+ * obtiene la respuesta del servicio
136
+ * @return string
137
+ */
138
+ public function getResponse()
139
+ {
140
+ return $this->_response;
141
+ }
142
+
143
+ }
app/code/local/Pagofacil/Pagofacildirect/Model/Observer.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author ivelazquex <isai.velazquez@gmail.com>
4
+ */
5
+ class Pagofacil_Pagofacildirect_Model_Observer
6
+ {
7
+ public function orderPlaceAfter($event)
8
+ {
9
+ $order = $event->getOrder();
10
+
11
+ if (!$order->getId())
12
+ {
13
+ //order is not saved in the database
14
+ return $this;
15
+ }
16
+
17
+ $payment = $order->getPayment();
18
+ $methodInstance = $payment->getMethodInstance();
19
+ $paymentMethod = $methodInstance->getCode();
20
+
21
+ if ($paymentMethod == 'pagofacildirect')
22
+ {
23
+ $model = new Pagofacil_Pagofacildirect_Model_Standard();
24
+ $status = $model->getConfigData('status');
25
+
26
+ if ($status == '')
27
+ {
28
+ $status = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
29
+ }
30
+ $this->processOrderStatus($order, $status);
31
+ }
32
+
33
+ return $this;
34
+ }
35
+
36
+ private function processOrderStatus($order, $status)
37
+ {
38
+ if ($status == 'processing' || $status == 'complete')
39
+ {
40
+ $this->invoicedOrder($order); // factura(invoiced)
41
+ if ($status == 'complete')
42
+ {
43
+ $this->shippedOrder($order); // envia(shipped)
44
+ }
45
+ $status = Mage_Sales_Model_Order::STATE_PROCESSING;
46
+ }
47
+ $order->setState($status, true);
48
+ $order->save();
49
+
50
+ return $this;
51
+ }
52
+
53
+ private function invoicedOrder($order)
54
+ {
55
+ if ($order->canInvoice())
56
+ {
57
+ $invoice = $order->prepareInvoice();
58
+ $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE);
59
+ $invoice->register();
60
+
61
+ $order->setCustomerNoteNotify(false);
62
+ $order->setIsInProcess(true);
63
+ $order->addStatusHistoryComment('Automatically INVOICED by PagoFacil.', false);
64
+
65
+ $transactionSave = Mage::getModel('core/resource_transaction');
66
+ $transactionSave->addObject($invoice)->addObject($invoice->getOrder());
67
+ $transactionSave->save();
68
+ }
69
+ }
70
+
71
+ /**
72
+ * envia a embarque y notifica al cliente
73
+ * @param type $order
74
+ */
75
+ private function shippedOrder($order)
76
+ {
77
+ $shipment = $order->prepareShipment();
78
+ $shipment->register();
79
+
80
+ $order->setCustomerNoteNotify(true);
81
+ $order->setIsInProcess(true);
82
+ $order->addStatusHistoryComment('Automatically SHIPPED by PagoFacil.', false);
83
+
84
+ $transactionSave = Mage::getModel('core/resource_transaction');
85
+ $transactionSave->addObject($shipment)->addObject($shipment->getOrder());
86
+ $transactionSave->save();
87
+ }
88
+ }
app/code/local/Pagofacil/Pagofacildirect/Model/Source.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Pagofacil_Pagofacildirect_Model_Source
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ return array(
7
+ array('value' => 'pending', 'label' => 'Pendiente')
8
+ ,array('value' => 'processing', 'label' => 'En Procesamiento')
9
+ ,array('value' => 'complete', 'label' => 'Completada')
10
+ );
11
+ }
12
+ }
app/code/local/Pagofacil/Pagofacildirect/Model/Standard.php ADDED
@@ -0,0 +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
+ }
app/code/local/Pagofacil/Pagofacildirect/etc/config.xml ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>
app/code/local/Pagofacil/Pagofacildirect/etc/system.xml ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>
app/design/frontend/base/default/template/pagofacildirect/pay.phtml ADDED
@@ -0,0 +1,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>
app/etc/modules/Pagofacil_Pagofacildirect.xml ADDED
@@ -0,0 +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>
package.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>