diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/zen-cart-payco/.DS_Store b/zen-cart-payco/.DS_Store new file mode 100644 index 0000000..80c2b64 Binary files /dev/null and b/zen-cart-payco/.DS_Store differ diff --git a/zen-cart-payco/LEEME.TXT b/zen-cart-payco/LEEME.TXT new file mode 100644 index 0000000..ded9c25 --- /dev/null +++ b/zen-cart-payco/LEEME.TXT @@ -0,0 +1,16 @@ +DIST -> PLUGIN EN RAR +SRC -> PLUGIN SIN COMPRIMIR + +***-PLUGIN DE PAYCO PARA ZEN CART-*** + +*El plugin se instala de manera manual ya que zen cart no cuenta con un wizard para instalar plugin, asi que si tiene el plugin en rar debe descomprimirlo y realizar lo siguiente: + +*ubiquese en el directorio raiz de zen cart,asi mismo ubiquese en el directorio raiz del plugin, inicie copiando los archivos del plugin en su respectiva ubicacion +por ejemplo: + +PLUGIN: + plugin/confirmacion.php + +teniendo encuenta esa ubicacion asi mismo debera copiarla en el zen-car quedando el archivo confirmacion.php en raiz del zen- cart + +ZEN-CART: zen-cart/confirmacion.php \ No newline at end of file diff --git a/zen-cart-payco/checkout_process_pol.php b/zen-cart-payco/checkout_process_pol.php new file mode 100644 index 0000000..07af132 --- /dev/null +++ b/zen-cart-payco/checkout_process_pol.php @@ -0,0 +1,179 @@ + + + +Untitled Document + + + + + + + +notify('NOTIFY_HEADER_START_CHECKOUT_PROCESS'); + + if (!defined('IS_ADMIN_FLAG')) { + die('Illegal Access'); + } + +//notifica el comienzo del checkout + $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_BEGIN'); + +//incluye los lenguajes + require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php')); + +// if the customer is not logged on, redirect them to the time out page + if (!$_SESSION['customer_id']) { + zen_redirect(zen_href_link(FILENAME_TIME_OUT)); + } else { + // validate customer + if (zen_get_customer_validate_session($_SESSION['customer_id']) == false) { + $_SESSION['navigation']->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_SHIPPING)); + zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL')); + } + } + +// confirm where link came from + if (!strstr($_SERVER['HTTP_REFERER'], FILENAME_CHECKOUT_CONFIRMATION)) { + zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT,'','SSL')); + } + +// load selected payment module + require(DIR_WS_CLASSES . 'payment.php'); + $payment_modules = new payment($_SESSION['payment']); + +// load the selected shipping module + require(DIR_WS_CLASSES . 'shipping.php'); + $shipping_modules = new shipping($_SESSION['shipping']); + + require(DIR_WS_CLASSES . 'order.php'); + $order = new order; + +// prevent 0-entry orders from being generated/spoofed + if (sizeof($order->products) < 1) { + zen_redirect(zen_href_link(FILENAME_SHOPPING_CART)); + } + + + require(DIR_WS_CLASSES . 'order_total.php'); + $order_total_modules = new order_total; + + $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_BEFORE_ORDER_TOTALS_PRE_CONFIRMATION_CHECK'); + + $order_totals = $order_total_modules->pre_confirmation_check(); + + $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_BEFORE_ORDER_TOTALS_PROCESS'); + $order_totals = $order_total_modules->process(); + $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_ORDER_TOTALS_PROCESS'); + + if (!isset($_SESSION['payment']) && !$credit_covers) { + zen_redirect(zen_href_link(FILENAME_DEFAULT)); + } + +// load the before_process function from the payment modules + $payment_modules->before_process(); + $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_PAYMENT_MODULES_BEFOREPROCESS'); + +// create the order record + $insert_id = $order->create($order_totals, 2); + $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_ORDER_CREATE'); + $payment_modules->after_order_create($insert_id); + $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_PAYMENT_MODULES_AFTER_ORDER_CREATE'); + +// store the product info to the order + $order->create_add_products($insert_id); + $_SESSION['order_number_created'] = $insert_id; + $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_ORDER_CREATE_ADD_PRODUCTS'); + +//send email notifications + $order->send_order_email($insert_id, 2); + $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_SEND_ORDER_EMAIL'); + + +// load the after_process function from the payment modules + + $_SESSION['cart']->reset(true); + +// unregister session variables used during checkout + unset($_SESSION['sendto']); + unset($_SESSION['billto']); + unset($_SESSION['shipping']); + unset($_SESSION['payment']); + unset($_SESSION['comments']); + $order_total_modules->clear_posts();//ICW ADDED FOR CREDIT CLASS SYSTEM + + +// This should be before the zen_redirect: + $zco_notifier->notify('NOTIFY_HEADER_END_CHECKOUT_PROCESS'); + + +?> + + +
> + payco; + //var_export($order); + + $pkey = sha1($payco->clave_secreta.$payco->usuario_id); + + if($payco->prueba =="1"){ + $test = "TRUE"; + }else{ + $test = "FALSE"; + } + + ?> + + + + + + + + + + + + + "> + + + + +
+ + + + + \ No newline at end of file diff --git a/zen-cart-payco/confirmacion.php b/zen-cart-payco/confirmacion.php new file mode 100644 index 0000000..fd3b3ea --- /dev/null +++ b/zen-cart-payco/confirmacion.php @@ -0,0 +1,131 @@ +Execute($ultimo_estado); +// $ultimo_estado_zencart = mysql_fetch_assoc($ultimo_estado_zencart); + + $id1 = ($ultimo_estado_zencart->fields['id']+1); + $id2 = ($ultimo_estado_zencart->fields['id']+2); + $id3 = ($ultimo_estado_zencart->fields['id']+3); + + + $verificar = " select count(orders_status_id) as cantidad from " . TABLE_ORDERS_STATUS." where orders_status_name ='Aceptada' or orders_status_name ='Rechazada' or orders_status_name ='Pendiente'" ; + $verificar_estados = $db->Execute($verificar); + + if($verificar_estados->fields['cantidad'] == "0"){ + $order_status_payco = "insert into " . TABLE_ORDERS_STATUS . " (orders_status_id,language_id,orders_status_name) values (".$id1.",'0','Aceptada'),(".$id2.",'0','Rechazada'),(".$id3.",'0','Pendiente')"; + $db->Execute($order_status_payco); + } + + + //consulta para encontrar el id del estado de las transacciones + $order_status_query = "select orders_status_id from " . TABLE_ORDERS_STATUS . " where orders_status_name like '%" . $estado . "%'"; + $order_status = $db->Execute($order_status_query); + + + //consulta para actualizar el estado del pago respecto a la informacion que envia payco + $update_order_status_query = "update " . TABLE_ORDERS_STATUS_HISTORY . " set orders_status_id = '" + . $order_status->fields['orders_status_id'] . "' where orders_id = '" . $_POST['x_id_factura'] . "'"; + $db->Execute($update_order_status_query); + + //actualiza el estado del pago en la orden + $update_order_query = "update " . TABLE_ORDERS . " set orders_status = '" . $order_status->fields['orders_status_id'] + . "' where orders_id = '" . $_POST['x_id_factura'] . "'"; + + $db->Execute($update_order_query); + + + //si payco envia la variable con este valor es que se aprobo el pago y luego se redirecciona al checkout + /*if($_POST['x_respuesta']) { + header("Location: ".DIR_WS_MODULES."checkout_process.php"); + }*/ + + echo ' + + + + +
+

Transaccion '.$_REQUEST['x_respuesta'].'

+

Apreciado cliente, la transaccion No.'. $_REQUEST['x_transaction_id'].' + fue recibida por nuestro sistema.

+

Datos de compra:

+ + + + + + + + + + + + + + + +
Codigo de Referencia:  '.$_REQUEST['x_id_factura'].'
Valor: '.$_REQUEST['x_amount'].'
Moneda: '.$_REQUEST['x_currency_code'].'
+

Datos de la transaccion:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Fecha de Procesamiento:  '.$_REQUEST['x_fecha_transaccion'].'
Recibo No.: '.$_REQUEST['x_transaction_id'].'
Transaccion No.: '.$_REQUEST['x_ref_payco'].'
Banco o Franquicia: '.$_REQUEST['x_franchise'].'
Codigo de aprobacion: '.$_REQUEST['x_aproval_code'].'
Codigo de Respuesta POL: '.$_REQUEST['x_response_reason_text'].'
Regresar a la tienda
+
+ + '; + + //no permite que puedan acceder a la pagina desde el explorador + }else{ + echo "
Usted no esta autorizado para ver esta pagina."; + } + + +?> \ No newline at end of file diff --git a/zen-cart-payco/includes/languages/english/html_includes/classic/_notes/dwsync.xml b/zen-cart-payco/includes/languages/english/html_includes/classic/_notes/dwsync.xml new file mode 100644 index 0000000..7803b81 --- /dev/null +++ b/zen-cart-payco/includes/languages/english/html_includes/classic/_notes/dwsync.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/zen-cart-payco/includes/languages/english/html_includes/classic/define_checkout_success.php b/zen-cart-payco/includes/languages/english/html_includes/classic/define_checkout_success.php new file mode 100644 index 0000000..fc3e236 --- /dev/null +++ b/zen-cart-payco/includes/languages/english/html_includes/classic/define_checkout_success.php @@ -0,0 +1,64 @@ +

+ + + + + + + + + + + + + + + + + + + +
+ +
+ +

Thank you for your purchase.
+ The status of your transaction : +
+ For future reference keep the following details:

+

+ Reference number : [ - ]
+ Value :
+ Date :
+ Bank :
+ + + 0) { ?> + Unique tracking code :
+ + Description: Purchase of goods or services

+ Print +

+
+ + + + + + +
+ + + + + +
' . zen_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . ''; ?>
+ + +
+ +

+ diff --git a/zen-cart-payco/includes/languages/english/modules/payment/_notes/dwsync.xml b/zen-cart-payco/includes/languages/english/modules/payment/_notes/dwsync.xml new file mode 100644 index 0000000..b6ea552 --- /dev/null +++ b/zen-cart-payco/includes/languages/english/modules/payment/_notes/dwsync.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/zen-cart-payco/includes/languages/english/modules/payment/img_payco/Thumbs.db b/zen-cart-payco/includes/languages/english/modules/payment/img_payco/Thumbs.db new file mode 100644 index 0000000..11c8aea Binary files /dev/null and b/zen-cart-payco/includes/languages/english/modules/payment/img_payco/Thumbs.db differ diff --git a/zen-cart-payco/includes/languages/english/modules/payment/img_payco/logo.png b/zen-cart-payco/includes/languages/english/modules/payment/img_payco/logo.png new file mode 100644 index 0000000..0661089 Binary files /dev/null and b/zen-cart-payco/includes/languages/english/modules/payment/img_payco/logo.png differ diff --git a/zen-cart-payco/includes/languages/english/modules/payment/payco.php b/zen-cart-payco/includes/languages/english/modules/payment/payco.php new file mode 100644 index 0000000..9c39b5f --- /dev/null +++ b/zen-cart-payco/includes/languages/english/modules/payment/payco.php @@ -0,0 +1,27 @@ +'); + define('MODULE_PAYMENT_PAYCO_TEXT_DESCRIPTION', 'PAYCO'); + define('MODULE_PAYMENT_PAYCO_TEXT_ERROR_MESSAGE','Error in the process'); + define('MODULE_PAYMENT_PAYCO_TEXT_CANCEL','The process Canceled'); + define('MODULE_PAYMENT_PAYCO_TEXT_CREDIT_CARD_TYPE', 'Card Type:'); + define('MODULE_PAYMENT_PAYCO_TEXT_CREDIT_CARD_OWNER', 'Credit Card Owner:'); + define('MODULE_PAYMENT_PAYCO_TEXT_CREDIT_CARD_NUMBER', 'Number Card:'); + define('MODULE_PAYMENT_PAYCO_TEXT_CREDIT_CARD_EXPIRES', 'Expiration Date:'); + define('MODULE_PAYMENT_PAYCO_TEXT_JS_PAYCO_OWNER', '* The owner\'s name of the credit card must be at least ' . CC_OWNER_MIN_LENGTH . ' letras.\n'); + define('MODULE_PAYMENT_PAYCO_TEXT_JS_PAYCO_NUMBER', '* The credit card number must be at least ' . CC_NUMBER_MIN_LENGTH . ' numeros.\n'); + define('MODULE_PAYMENT_PAYCO_TEXT_ERROR', 'Credit Card Error!'); + + +?> diff --git a/zen-cart-payco/includes/languages/spanish/html_includes/classic/_notes/dwsync.xml b/zen-cart-payco/includes/languages/spanish/html_includes/classic/_notes/dwsync.xml new file mode 100644 index 0000000..48c3f37 --- /dev/null +++ b/zen-cart-payco/includes/languages/spanish/html_includes/classic/_notes/dwsync.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/zen-cart-payco/includes/languages/spanish/html_includes/classic/define_checkout_success.php b/zen-cart-payco/includes/languages/spanish/html_includes/classic/define_checkout_success.php new file mode 100644 index 0000000..cde0b0e --- /dev/null +++ b/zen-cart-payco/includes/languages/spanish/html_includes/classic/define_checkout_success.php @@ -0,0 +1,60 @@ +

+ + + + + + + + + + + + + + + + + + + +
+ +
+ +

Gracias por su Compra.
+ El estado de su transacción es : +
+ Para futuras referencias conserve los siguientes datos:

+

+ Numero de referencia : [ - ]
+ Valor :
+ Fecha :
+ Banco :
+ Codigo unico de seguimiento :
+ Descripcion : Compra de productos o servicios

+ Imprimir +

+
+ + + + + + +
+ + + + + +
' . zen_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . ''; ?>
+ + +
+ +

+ diff --git a/zen-cart-payco/includes/languages/spanish/modules/payment/_notes/dwsync.xml b/zen-cart-payco/includes/languages/spanish/modules/payment/_notes/dwsync.xml new file mode 100644 index 0000000..b3442c9 --- /dev/null +++ b/zen-cart-payco/includes/languages/spanish/modules/payment/_notes/dwsync.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/zen-cart-payco/includes/languages/spanish/modules/payment/img_payco/Thumbs.db b/zen-cart-payco/includes/languages/spanish/modules/payment/img_payco/Thumbs.db new file mode 100644 index 0000000..3ec339e Binary files /dev/null and b/zen-cart-payco/includes/languages/spanish/modules/payment/img_payco/Thumbs.db differ diff --git a/zen-cart-payco/includes/languages/spanish/modules/payment/img_payco/logo.png b/zen-cart-payco/includes/languages/spanish/modules/payment/img_payco/logo.png new file mode 100644 index 0000000..0661089 Binary files /dev/null and b/zen-cart-payco/includes/languages/spanish/modules/payment/img_payco/logo.png differ diff --git a/zen-cart-payco/includes/languages/spanish/modules/payment/payco.php b/zen-cart-payco/includes/languages/spanish/modules/payment/payco.php new file mode 100644 index 0000000..86ea4f6 --- /dev/null +++ b/zen-cart-payco/includes/languages/spanish/modules/payment/payco.php @@ -0,0 +1,25 @@ +'); + define('MODULE_PAYMENT_PAYCO_TEXT_DESCRIPTION', 'PAYCO'); + define('MODULE_PAYMENT_PAYCO_TEXT_ERROR_MESSAGE','Error en el proceso'); + define('MODULE_PAYMENT_PAYCO_TEXT_CANCEL','Cancelado el proceso'); + define('MODULE_PAYMENT_PAYCO_TEXT_CREDIT_CARD_TYPE', 'Tipo de Tarjeta:'); + define('MODULE_PAYMENT_PAYCO_TEXT_CREDIT_CARD_OWNER', 'Titular de la Tarjeta:'); + define('MODULE_PAYMENT_PAYCO_TEXT_CREDIT_CARD_NUMBER', 'Numero de la Tarjeta:'); + define('MODULE_PAYMENT_PAYCO_TEXT_CREDIT_CARD_EXPIRES', 'Fecha de Caducidad:'); + define('MODULE_PAYMENT_PAYCO_TEXT_JS_PAYCO_OWNER', '* El titular de la tarjeta de credito debe de tener al menos ' . CC_OWNER_MIN_LENGTH . ' letras.\n'); + define('MODULE_PAYMENT_PAYCO_TEXT_JS_PAYCO_NUMBER', '* El numero de la tarjeta de credito debe de tener al menos ' . CC_NUMBER_MIN_LENGTH . ' numeros.\n'); + define('MODULE_PAYMENT_PAYCO_TEXT_ERROR', 'Error en Tarjeta de Credito!'); +?> diff --git a/zen-cart-payco/includes/modules/payment/_notes/dwsync.xml b/zen-cart-payco/includes/modules/payment/_notes/dwsync.xml new file mode 100644 index 0000000..e1d7f20 --- /dev/null +++ b/zen-cart-payco/includes/modules/payment/_notes/dwsync.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/zen-cart-payco/includes/modules/payment/payco.php b/zen-cart-payco/includes/modules/payment/payco.php new file mode 100644 index 0000000..a91d64d --- /dev/null +++ b/zen-cart-payco/includes/modules/payment/payco.php @@ -0,0 +1,257 @@ +Execute($query)); + } + + function tep_db_num_rows($query){ + return($query->RecordCount()); + } + + + +//se crea la clase del metodo de pago de payco + +class payco{ + +//declaracion de variables + var $code, $title, $description, $enabled, $usuario_id, $clave_secreta, $tasa_iva, $prueba; + +// class constructor + function payco() + { + global $order; + +//asignacion de valores + $this->code = 'payco'; + $this->title = MODULE_PAYMENT_PAYCO_TEXT_TITLE; + $this->description = MODULE_PAYMENT_PAYCO_TEXT_DESCRIPTION; + $this->enabled = ((MODULE_PAYMENT_PAYCO_STATUS == 'True') ? true : false); + $this->sort_order = MODULE_PAYMENT_PAYCO_SORT_ORDER; + + + if ((int)MODULE_PAYMENT_PAYCO_ORDER_STATUS_ID > 0) { + $this->order_status = MODULE_PAYMENT_PAYCO_ORDER_STATUS_ID; + } + + if (is_object($order)) $this->update_status(); + + /* a que direccion se redirecciona despues de dar click en el boton de pago, se direcciona al checkout el cual crea la orden y envia los datos al sistema */ + $this->form_action_url = DIR_WS_CATALOG . 'checkout_process_pol.php'; + + /* Numero de usuario en Payco */ + $this->usuario_id = MODULE_PAYMENT_PAYCO_ID_COM; + + /* Indica si la transaccion es de prueba (1) o no (0)*/ + $this->prueba = MODULE_PAYMENT_PAYCO_PRUEBA; + + /* Clave de encripcion para la firma digital (Obligatorio para usuarios nuevos) */ + $this->clave_secreta = MODULE_PAYMENT_PAYCO_ID_SEED; + + /* La tasa de IVA que aplica para sus productos, debe coincidir con la configurada en el oscommerce */ + $this->tasa_iva = 0.16; + + } + +// class methods + + //funcion para actualizar el estado del plugin + function update_status() + { + global $order, $db; + + if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_PAYCO_ZONE > 0) ) { + $check_flag = false; + $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" + . MODULE_PAYMENT_PAYCO_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); + while (!$check->EOF) { + if ($check->fields['zone_id'] < 1) { + $check_flag = true; + break; + } elseif ($check->fields['zone_id'] == $order->billing['zone_id']) { + $check_flag = true; + break; + } + $check->MoveNext(); + } + + if ($check_flag == false) { + $this->enabled = false; + } + } + } + + + function javascript_validation() { + return false; + } + + function selection() { + return array('id' => $this->code, + 'module' => $this->title); + } + + function pre_confirmation_check() { + return false; + } + + function confirmation() { + return false; + } + + +//funcion para crear el boton de pago + + function process_button() + { + global $order, $currencies, $currency, $languages; + + + //referencia de venta + $refventa=time(); + + //moneda + $my_currency = $order->info['currency']; + + //descripcion de la venta + + /*for($i = 0; $i < sizeof($order->products); $i++) { + + $descripcion .= "[".$order->products[$i]['name']." x ".$order->products[$i]['qty']."] "; + }*/ + + //nombre del comprador + $nombre_cliente = $order->customer['firstname']." ".$order->customer['lastname']; + + //telefono del comprador + $telefono = $order->customer['telephone']; + + //iva del pedido + $iva = number_format($order->info['tax'] * $currencies->get_value($my_currency),2,'.',''); + + //base de devolucion + $baseDevolucionIva = number_format(($iva / $this->tasa_iva),2,'.',''); + + //se organiza la descripcion de la compra + $descripcion = substr($descripcion,0,250); + + //valor total de la compra + + $total=$order->info['total']; + $valor = round($total*$order->info['currency_value'],2); + $valor = number_format($valor, 2, '.', ''); + + + //cadena para la firma digital + $cadtmp = $this->clave_secreta."~".$this->usuario_id."~".$refventa."~".$valor."~".$my_currency; + + //firma digital + $firma = md5($cadtmp); + + //pagina de respuesta + $url_respuesta= HTTP_SERVER . DIR_WS_CATALOG . "index.php?main_page=checkout_success"; + + + //creacion del boton de pago + $process_button_string = + zen_draw_hidden_field('valor', $valor). + zen_draw_hidden_field('extra1', urlencode("Nombre Cliente : ".$nombre_cliente." Telefono : ".$telefono)). + zen_draw_hidden_field('refVenta', $refventa). + zen_draw_hidden_field('usuarioId', $this->usuario_id). + zen_draw_hidden_field('descripcion', "Compra en la tienda ".'::' . STORE_NAME . '::'). + zen_draw_hidden_field('moneda', $my_currency). + zen_draw_hidden_field('prueba', $this->prueba). + zen_draw_hidden_field('emailComprador', $order->customer['email_address']). + zen_draw_hidden_field('iva', $iva). + zen_draw_hidden_field('baseDevolucionIva', $baseDevolucionIva). + zen_draw_hidden_field('plantilla', ""). + zen_draw_hidden_field('url_respuesta', $url_respuesta). + zen_draw_hidden_field('url_confirmacion', HTTP_SERVER . DIR_WS_CATALOG . "confirmacion.php"). + zen_draw_hidden_field('lng', $_SESSION['languages_code']); + + //creacion de la firma digital + if(strlen($this->clave_secreta)) { + $process_button_string = $process_button_string."\n".zen_draw_hidden_field('firma', $firma); + } + + return $process_button_string; + } + + function before_process(){ + return false; + } + + function after_process(){ + return false; + } + + function output_error() { + return false; + } + + function check(){ + global $db; + if (!isset($this->_check)) { + $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PAYCO_STATUS'"); + $this->_check = $check_query->RecordCount(); + } + return $this->_check; + } + + + + //funcion para instalar el plugin de Payco en el modulo administrativo + function install(){ + + tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Activar módulo Pagosonline', 'MODULE_PAYMENT_PAYCO_STATUS', 'True', 'Quiere aceptar pagos usando Payco?', '6', '3', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); + + tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Id Usuario', 'MODULE_PAYMENT_PAYCO_ID_COM', '', 'Codigo de usuario (usuarioId) proporcionado por Payco', '6', '4', now())"); + + tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Llave secreta', 'MODULE_PAYMENT_PAYCO_ID_SEED', '', 'Clave de encriptación proporcionada por Payco', '6', '4', now())"); + + tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('URL de la pasarela de pago', 'MODULE_PAYMENT_PAYCO_URL', 'https://secure2.payco.co/payment.php', 'Direccion en internet de la pasarela de pago', '6', '4', now())"); + + tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Prueba', 'MODULE_PAYMENT_PAYCO_PRUEBA', '1', 'Prueba es la variable para poner su carrito en modo de pruebas, si quiere hacer transacciones en modo de pruebas debe ingresar 1 y si si quiere estar en produccion debe dejarlo en o', '6', '4', now())"); + + tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Orden de aparicion.', 'MODULE_PAYMENT_PAYCO_SORT_ORDER', '0', 'Orden de aparicion. Numero menor es mostrado antes que los mayores.', '6', '0', now())"); + + tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Zona de pago', 'MODULE_PAYMENT_PAYCO_ZONE', '0', 'Si selecciona una zona, este módulo sólo estará disponible en esa zona.', '6', '2', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())"); + + tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Estado del pedido', 'MODULE_PAYMENT_PAYCO_ORDER_STATUS_ID', '0', 'Seleccione el estado del pedido un vez procesado con este módulo', '6', '0', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())"); + + } + + //funcion para eliminar el plugin desde el modulo administrativo + function remove(){ + tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); + } + + function keys(){ + return array + ( + 'MODULE_PAYMENT_PAYCO_STATUS', + 'MODULE_PAYMENT_PAYCO_ID_COM', + 'MODULE_PAYMENT_PAYCO_ID_SEED', + 'MODULE_PAYMENT_PAYCO_URL', + 'MODULE_PAYMENT_PAYCO_PRUEBA', + 'MODULE_PAYMENT_PAYCO_SORT_ORDER', + 'MODULE_PAYMENT_PAYCO_ZONE', + 'MODULE_PAYMENT_PAYCO_ORDER_STATUS_ID' + ); + } + } + + + +?>