From f69dd6323cb998129463e1305e41fcf3ee685451 Mon Sep 17 00:00:00 2001 From: JuanEstebanGarciaV Date: Mon, 12 Aug 2024 12:33:31 -0500 Subject: [PATCH 1/3] Se actualiza logo de ePayco y el titulo de medios de pago --- assets/images/paymentLogo.svg | 591 ++++++++++++++-------------- classes/class-wc-gateway-epayco.php | 4 +- 2 files changed, 299 insertions(+), 296 deletions(-) diff --git a/assets/images/paymentLogo.svg b/assets/images/paymentLogo.svg index 98e84d9..1e60a8a 100644 --- a/assets/images/paymentLogo.svg +++ b/assets/images/paymentLogo.svg @@ -1,294 +1,297 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/classes/class-wc-gateway-epayco.php b/classes/class-wc-gateway-epayco.php index 2873609..335b1b8 100644 --- a/classes/class-wc-gateway-epayco.php +++ b/classes/class-wc-gateway-epayco.php @@ -208,14 +208,14 @@ function init_form_fields() { 'title' => __( 'Título', 'woo-epayco-gateway' ), 'type' => 'text', 'description' => __( 'Corresponde al título que el usuario ve durante el Checkout.', 'woo-epayco-gateway' ), - 'default' => __( 'Checkout ePayco (Tarjetas de crédito,debito,efectivo)', 'woo-epayco-gateway' ), + 'default' => __( 'Paga con ePayco', 'woo-epayco-gateway' ), 'desc_tip' => true, ), 'description' => array( 'title' => __( 'Descripción', 'woo-epayco-gateway' ), 'type' => 'textarea', 'description' => __( 'Corresponde a la descripción que verá el usuario durante el Checkout', 'woo-epayco-gateway' ), - 'default' => __( 'Checkout ePayco (Tarjetas de crédito,débito,efectivo)', 'woo-epayco-gateway' ), + 'default' => __( 'ePayco: Paga con Tarjeta de crédito/débito nacional e internacional, PSE, Daviplata, Nequi, Paypal, Efectivo, Safetypay y muchos más. ', 'woo-epayco-gateway' ), ), 'epayco_customerid' => array( 'title' => __( 'P_CUST_ID_CLIENTE', 'woo-epayco-gateway' ), From d91ebf729b833f709c4b5c50556902c6a7238492 Mon Sep 17 00:00:00 2001 From: RicardoSaldarriagaPayco Date: Thu, 29 Aug 2024 12:35:49 -0500 Subject: [PATCH 2/3] fix:se actualiza nombre de modulo de plugin y se configura impuestos --- classes/class-wc-gateway-epayco.php | 496 +++++++++++++++------------- readme.txt | 15 +- woocommerce-gateway-payco.php | 146 ++++---- 3 files changed, 351 insertions(+), 306 deletions(-) mode change 100644 => 100755 readme.txt diff --git a/classes/class-wc-gateway-epayco.php b/classes/class-wc-gateway-epayco.php index 2873609..41a1958 100644 --- a/classes/class-wc-gateway-epayco.php +++ b/classes/class-wc-gateway-epayco.php @@ -15,10 +15,10 @@ class WC_Gateway_Epayco extends WC_Payment_Gateway { public function __construct() { $this->id = 'epayco'; - $this->version = '8.0.3'; + $this->version = '8.1.0'; $this->icon = apply_filters( 'woocommerce_' . $this->id . '_icon', EPAYCO_PLUGIN_URL . 'assets/images/paymentLogo.svg' ); - $this->method_title = __( 'ePayco Checkout Gateway', 'woo-epayco-gateway' ); - $this->method_description = __( 'Acepta tarjetas de credito, depositos y transferencias.', 'woo-epayco-gateway' ); + $this->method_title = __( 'ePayco Checkout Gateway', 'epayco-woocommerce' ); + $this->method_description = __( 'Acepta tarjetas de credito, depositos y transferencias.', 'epayco-woocommerce' ); //$this->order_button_text = __('Pay', 'epayco_woocommerce'); $this->has_fields = false; $this->supports = array( @@ -103,22 +103,22 @@ public function admin_options() {
-

+

ePayco
- - . -
+ + . +
is_valid_for_use() ) : ?> @@ -129,7 +129,7 @@ public function admin_options() { ?> - + @@ -138,7 +138,7 @@ public function admin_options() {

- +


@@ -150,8 +150,8 @@ public function admin_options() {
-

-

del comercio son inválidas.
Consúltelas en el apartado de integraciones
Llaves API en su Dashboard ePayco.', 'woo-epayco-gateway' );?>

+

+

del comercio son inválidas.
Consúltelas en el apartado de integraciones
Llaves API en su Dashboard ePayco.', 'epayco-woocommerce' );?>

@@ -177,11 +177,11 @@ public function admin_options() {
-

:

@@ -199,129 +199,129 @@ public function admin_options() { function init_form_fields() { $this->form_fields = array( 'enabled' => array( - 'title' => __( 'Habilitar/Deshabilitar', 'woo-epayco-gateway' ), + 'title' => __( 'Habilitar/Deshabilitar', 'epayco-woocommerce' ), 'type' => 'checkbox', - 'label' => __( 'Habilitar ePayco', 'woo-epayco-gateway' ), + 'label' => __( 'Habilitar ePayco', 'epayco-woocommerce' ), 'default' => 'yes', ), 'title' => array( - 'title' => __( 'Título', 'woo-epayco-gateway' ), + 'title' => __( 'Título', 'epayco-woocommerce' ), 'type' => 'text', - 'description' => __( 'Corresponde al título que el usuario ve durante el Checkout.', 'woo-epayco-gateway' ), - 'default' => __( 'Checkout ePayco (Tarjetas de crédito,debito,efectivo)', 'woo-epayco-gateway' ), + 'description' => __( 'Corresponde al título que el usuario ve durante el Checkout.', 'epayco-woocommerce' ), + 'default' => __( 'Checkout ePayco (Tarjetas de crédito,debito,efectivo)', 'epayco-woocommerce' ), 'desc_tip' => true, ), 'description' => array( - 'title' => __( 'Descripción', 'woo-epayco-gateway' ), + 'title' => __( 'Descripción', 'epayco-woocommerce' ), 'type' => 'textarea', - 'description' => __( 'Corresponde a la descripción que verá el usuario durante el Checkout', 'woo-epayco-gateway' ), - 'default' => __( 'Checkout ePayco (Tarjetas de crédito,débito,efectivo)', 'woo-epayco-gateway' ), + 'description' => __( 'Corresponde a la descripción que verá el usuario durante el Checkout', 'epayco-woocommerce' ), + 'default' => __( 'Checkout ePayco (Tarjetas de crédito,débito,efectivo)', 'epayco-woocommerce' ), ), 'epayco_customerid' => array( - 'title' => __( 'P_CUST_ID_CLIENTE', 'woo-epayco-gateway' ), + 'title' => __( 'P_CUST_ID_CLIENTE', 'epayco-woocommerce' ), 'type' => 'text', - 'description' => __( 'ID de cliente que lo identifica en ePayco. Lo puede encontrar en su panel de clientes en la opción configuración', 'woo-epayco-gateway' ), + 'description' => __( 'ID de cliente que lo identifica en ePayco. Lo puede encontrar en su panel de clientes en la opción configuración', 'epayco-woocommerce' ), 'default' => '', //'desc_tip' => true, 'placeholder' => '', ), 'epayco_secretkey' => array( - 'title' => __( 'P_KEY', 'woo-epayco-gateway' ), + 'title' => __( 'P_KEY', 'epayco-woocommerce' ), 'type' => 'text', - 'description' => __( 'LLave para firmar la información enviada y recibida de ePayco. Lo puede encontrar en su panel de clientes en la opción configuración', 'woo-epayco-gateway' ), + 'description' => __( 'LLave para firmar la información enviada y recibida de ePayco. Lo puede encontrar en su panel de clientes en la opción configuración', 'epayco-woocommerce' ), 'default' => '', //'desc_tip' => true, 'placeholder' => '', ), 'epayco_publickey' => array( - 'title' => __( 'PUBLIC_KEY', 'woo-epayco-gateway' ), + 'title' => __( 'PUBLIC_KEY', 'epayco-woocommerce' ), 'type' => 'text', - 'description' => __( 'LLave para autenticar y consumir los servicios de ePayco, Proporcionado en su panel de clientes en la opción configuración', 'woo-epayco-gateway' ), + 'description' => __( 'LLave para autenticar y consumir los servicios de ePayco, Proporcionado en su panel de clientes en la opción configuración', 'epayco-woocommerce' ), 'default' => '', //'desc_tip' => true, 'placeholder' => '', ), 'epayco_privatekey' => array( - 'title' => __( 'PRIVATE_KEY', 'woo-epayco-gateway' ), + 'title' => __( 'PRIVATE_KEY', 'epayco-woocommerce' ), 'type' => 'text', - 'description' => __( 'LLave para autenticar y consumir los servicios de ePayco, Proporcionado en su panel de clientes en la opción configuración', 'woo-epayco-gateway' ), + 'description' => __( 'LLave para autenticar y consumir los servicios de ePayco, Proporcionado en su panel de clientes en la opción configuración', 'epayco-woocommerce' ), 'default' => '', //'desc_tip' => true, 'placeholder' => '', ), 'epayco_testmode' => array( - 'title' => __( 'Sitio en pruebas', 'woo-epayco-gateway' ), + 'title' => __( 'Sitio en pruebas', 'epayco-woocommerce' ), 'type' => 'checkbox', - 'label' => __('Habilitar el modo de pruebas', 'woo-epayco-gateway'), - 'description' => __( 'Habilite para realizar pruebas', 'woo-epayco-gateway' ), + 'label' => __('Habilitar el modo de pruebas', 'epayco-woocommerce'), + 'description' => __( 'Habilite para realizar pruebas', 'epayco-woocommerce' ), 'default' => 'no', ), 'epayco_type_checkout' => array( - 'title' => __( 'Tipo Checkout', 'woo-epayco-gateway' ), + 'title' => __( 'Tipo Checkout', 'epayco-woocommerce' ), 'type' => 'select', 'css' =>'line-height: inherit', - 'label' => __('Seleccione un tipo de Checkout:', 'woo-epayco-gateway'), - 'description' => __( '(Onpage Checkout, el usuario al pagar permanece en el sitio) ó (Standard Checkout, el usario al pagar es redireccionado a la pasarela de ePayco)', 'woo-epayco-gateway' ), + 'label' => __('Seleccione un tipo de Checkout:', 'epayco-woocommerce'), + 'description' => __( '(Onpage Checkout, el usuario al pagar permanece en el sitio) ó (Standard Checkout, el usario al pagar es redireccionado a la pasarela de ePayco)', 'epayco-woocommerce' ), 'options' => array('false'=>"Onpage Checkout","true"=>"Standard Checkout"), ), 'epayco_endorder_state' => array( - 'title' => __( 'Estado Final del Pedido', 'woo-epayco-gateway' ), + 'title' => __( 'Estado Final del Pedido', 'epayco-woocommerce' ), 'type' => 'select', 'css' =>'line-height: inherit', - 'description' => __( 'Seleccione el estado del pedido que se aplicará a la hora de aceptar y confirmar el pago de la orden', 'woo-epayco-gateway' ), + 'description' => __( 'Seleccione el estado del pedido que se aplicará a la hora de aceptar y confirmar el pago de la orden', 'epayco-woocommerce' ), 'options' => array( - 'epayco-processing'=> __( 'ePayco Procesando Pago', 'woo-epayco-gateway' ), - "epayco-completed"=> __( 'ePayco Pago Completado', 'woo-epayco-gateway' ), - 'processing'=> __( 'Procesando', 'woo-epayco-gateway' ), - "completed"=> __( 'Completado', 'woo-epayco-gateway' ) + 'epayco-processing'=> __( 'ePayco Procesando Pago', 'epayco-woocommerce' ), + "epayco-completed"=> __( 'ePayco Pago Completado', 'epayco-woocommerce' ), + 'processing'=> __( 'Procesando', 'epayco-woocommerce' ), + "completed"=> __( 'Completado', 'epayco-woocommerce' ) ), ), 'epayco_cancelled_endorder_state' => array( - 'title' => __( 'Estado Cancelado del Pedido', 'woo-epayco-gateway' ), + 'title' => __( 'Estado Cancelado del Pedido', 'epayco-woocommerce' ), 'type' => 'select', 'css' =>'line-height: inherit', - 'description' => __( 'Seleccione el estado del pedido que se aplicará cuando la transacciónes Cancelada o Rechazada', 'woo-epayco-gateway' ), + 'description' => __( 'Seleccione el estado del pedido que se aplicará cuando la transacciónes Cancelada o Rechazada', 'epayco-woocommerce' ), 'options' => array( - 'epayco-cancelled'=> __( 'ePayco Pago Cancelado', 'woo-epayco-gateway' ), - "epayco-failed"=> __( 'ePayco Pago Fallido', 'woo-epayco-gateway' ), - 'cancelled'=> __( 'Cancelado', 'woo-epayco-gateway' ), - "failed"=> __( 'Fallido', 'woo-epayco-gateway' ) + 'epayco-cancelled'=> __( 'ePayco Pago Cancelado', 'epayco-woocommerce' ), + "epayco-failed"=> __( 'ePayco Pago Fallido', 'epayco-woocommerce' ), + 'cancelled'=> __( 'Cancelado', 'epayco-woocommerce' ), + "failed"=> __( 'Fallido', 'epayco-woocommerce' ) ), ), 'epayco_url_response' => array( - 'title' => __( 'Página de Respuesta', 'woo-epayco-gateway' ), + 'title' => __( 'Página de Respuesta', 'epayco-woocommerce' ), 'type' => 'select', 'css' =>'line-height: inherit', - 'description' => __( 'Url de la tienda donde se redirecciona al usuario luego de pagar el pedido', 'woo-epayco-gateway' ), - 'options' => $this->get_pages(__('Seleccionar pagina', 'woo-epayco-gateway')), + 'description' => __( 'Url de la tienda donde se redirecciona al usuario luego de pagar el pedido', 'epayco-woocommerce' ), + 'options' => $this->get_pages(__('Seleccionar pagina', 'epayco-woocommerce')), ), 'epayco_url_confirmation' => array( - 'title' => __( 'Página de Confirmación', 'woo-epayco-gateway' ), + 'title' => __( 'Página de Confirmación', 'epayco-woocommerce' ), 'type' => 'select', 'css' =>'line-height: inherit', - 'description' => __( 'Url de la tienda donde ePayco confirma el pago', 'woo-epayco-gateway' ), - 'options' => $this->get_pages(__('Seleccionar pagina', 'woo-epayco-gateway')), + 'description' => __( 'Url de la tienda donde ePayco confirma el pago', 'epayco-woocommerce' ), + 'options' => $this->get_pages(__('Seleccionar pagina', 'epayco-woocommerce')), ), 'epayco_reduce_stock_pending' => array( - 'title' => __( 'Reducir el stock en transacciones pendientes', 'woo-epayco-gateway' ), + 'title' => __( 'Reducir el stock en transacciones pendientes', 'epayco-woocommerce' ), 'type' => 'checkbox', 'css' =>'line-height: inherit', 'default' => 'yes', - 'description' => sprintf( __( 'Habilite para reducir el stock en transacciones pendientes', 'woo-epayco-gateway' ) ), + 'description' => sprintf( __( 'Habilite para reducir el stock en transacciones pendientes', 'epayco-woocommerce' ) ), ), 'epayco_lang' => array( - 'title' => __( 'Idioma del Checkout', 'woo-epayco-gateway' ), + 'title' => __( 'Idioma del Checkout', 'epayco-woocommerce' ), 'type' => 'select', 'css' =>'line-height: inherit', - 'description' => __( 'Seleccione el idioma del checkout', 'woo-epayco-gateway' ), + 'description' => __( 'Seleccione el idioma del checkout', 'epayco-woocommerce' ), 'default' => 'es', 'options' => array(), ), 'response_data' => array( - 'title' => __( 'Habilitar envió de atributos a través de la URL de respuesta', 'woo-epayco-gateway' ), + 'title' => __( 'Habilitar envió de atributos a través de la URL de respuesta', 'epayco-woocommerce' ), 'type' => 'checkbox', - 'label' => __('Habilitar el modo redirección con data', 'woo-epayco-gateway'), - 'description' => __( 'Al habilitar esta opción puede exponer información sensible de sus clientes, el uso de esta opción es bajo su responsabilidad, conozca esta información en el siguiente link.', 'woo-epayco-gateway' ), + 'label' => __('Habilitar el modo redirección con data', 'epayco-woocommerce'), + 'description' => __( 'Al habilitar esta opción puede exponer información sensible de sus clientes, el uso de esta opción es bajo su responsabilidad, conozca esta información en el siguiente link.', 'epayco-woocommerce' ), 'default' => 'no', ), /*'monto_maximo' => array( @@ -371,183 +371,209 @@ function get_pages($title = false, $indent = true) { */ function generate_epayco_form( $order_id ) { global $woocommerce; - $order = new WC_Order($order_id); - $descripcionParts = array(); - $iva=0; - $ico=0; - $base_tax=$order->get_subtotal()-$order->get_total_discount(); - foreach($order->get_items('tax') as $item_id => $item ) { - if( strtolower( $item->get_label() ) == 'iva' ){ - $iva += round($item->get_tax_total(),2); - } - if( strtolower( $item->get_label() ) == 'ico'){ - $ico += round($item->get_tax_total(),2); - } - } + $order = new WC_Order($order_id); + $descripcionParts = array(); + $receiversData = []; + foreach ($order->get_items() as $product) { + $clearData = str_replace('_', ' ', $this->string_sanitize($product['name'])); + $descripcionParts[] = $clearData; + } + + $descripcion = implode(' - ', $descripcionParts); + $currency = strtolower(get_woocommerce_currency()); + $testMode = $this->epayco_testmode == "yes" ? "true" : "false"; + $basedCountry = WC()->countries->get_base_country(); + $external=$this->epayco_type_checkout; + $redirect_url =get_site_url() . "/"; + $confirm_url=get_site_url() . "/"; + $redirect_url = add_query_arg( 'wc-api', get_class( $this ), $redirect_url ); + $redirect_url = add_query_arg( 'order_id', $order_id, $redirect_url ); + + if ($this->get_option('epayco_url_confirmation' ) == 0) { + $confirm_url = add_query_arg( 'wc-api', get_class( $this ), $confirm_url ); + $confirm_url = add_query_arg( 'order_id', $order_id, $confirm_url ); + $confirm_url = $redirect_url.'&confirmation=1'; + } else { + $confirm_url = get_permalink($this->get_option('epayco_url_confirmation')); + } - foreach ($order->get_items() as $product) { - $clearData = str_replace('_', ' ', $this->string_sanitize($product['name'])); - $descripcionParts[] = $clearData; - } + $name_billing=$order->get_billing_first_name().' '.$order->get_billing_last_name(); + $address_billing=$order->get_billing_address_1(); + $phone_billing=@$order->billing_phone; + $email_billing=@$order->billing_email; - $descripcion = implode(' - ', $descripcionParts); - $currency = strtolower(get_woocommerce_currency()); - $testMode = $this->epayco_testmode == "yes" ? "true" : "false"; - $basedCountry = WC()->countries->get_base_country(); - $external=$this->epayco_type_checkout; - $redirect_url =get_site_url() . "/"; - $redirect_url = add_query_arg( 'wc-api', get_class( $this ), $redirect_url ); - $redirect_url = add_query_arg( 'order_id', $order_id, $redirect_url ); - $myIp=$this->getCustomerIp(); - $lang = $this->epayco_lang == 1 ? "es" : "en"; - if ($this->get_option('epayco_url_confirmation' ) == 0) { - $confirm_url = $redirect_url.'&confirmation=1'; - } else { - $confirm_url = get_permalink($this->get_option('epayco_url_confirmation')); - } + $tax=$order->get_total_tax(); + $tax=round($tax,2); + if((int)$tax>0){ + $base_tax=$order->get_total()-$tax; + }else{ + $base_tax=$order->get_total(); + $tax=0; + } + $myIp=$this->getCustomerIp(); + //Busca si ya se restauro el stock + if (!EpaycoOrder::ifExist($order_id)) { + //si no se restauro el stock restaurarlo inmediatamente + EpaycoOrder::create($order_id,1); + //$this->restore_order_stock($order->get_id(),"decrease"); + } + $force_redirect = $this->force_redirect == "yes" ? "true" : "false"; - $name_billing=$order->get_billing_first_name().' '.$order->get_billing_last_name(); - $address_billing=$order->get_billing_address_1(); - $phone_billing=@$order->billing_phone; - $email_billing=@$order->billing_email; + if ($this->epayco_lang !== "es") { + $msgEpaycoCheckout = 'Loading payment methods +
If they do not load automatically, click on the "Pay with ePayco" button'; + $epaycoButtonImage = plugin_dir_url(__FILE__).'lib/Boton-color-Ingles.png'; + }else{ + $msgEpaycoCheckout = 'Cargando métodos de pago +
Si no se cargan automáticamente, de clic en el botón "Pagar con ePayco'; + $epaycoButtonImage = plugin_dir_url(__FILE__).'lib/Boton-color-espanol.png'; + } - //Busca si ya se restauro el stock - if (!EpaycoOrder::ifExist($order_id)) { - //si no se restauro el stock restaurarlo inmediatamente - EpaycoOrder::create($order_id,1); - //$this->restore_order_stock($order->get_id(),"decrease"); - } - $orderStatus = "pending"; - $current_state = $order->get_status(); - if($current_state != $orderStatus){ - $order->update_status($orderStatus); - //$this->restore_order_stock($order->get_id(),"decrease"); - } - echo sprintf(' - - + - - - ', trim($this->epayco_publickey), - $testMode, - $descripcion, - $descripcion, - $order->get_id(), - $currency, - $order->get_total(), - $base_tax, - $iva, - $ico, - $basedCountry, - $lang, - $external, - $confirm_url, - $redirect_url, - $name_billing, - $address_billing, - $email_billing, - $phone_billing, - $myIp, - $testMode, - trim($this->epayco_publickey), - trim($this->epayco_privatekey) - ); - wp_enqueue_script('epayco', 'https://checkout.epayco.co/checkout.js', array(), $this->version, null); - wc_enqueue_js(' - jQuery("#btn_epayco_new").click(function(){ - console.log("epayco") - }); - ' - ); - return '
-
'; + } + var makePayment = function (privatekey, apikey, info, external) { + const headers = { "Content-Type": "application/json" } ; + headers["privatekey"] = privatekey; + headers["apikey"] = apikey; + var payment = function (){ + return fetch("https://cms.epayco.io/checkout/payment/session", { + method: "POST", + body: JSON.stringify(info), + headers + }) + .then(res => res.json()) + .catch(err => err); + } + payment() + .then(session => { + bntPagar.style.pointerEvents = "all"; + if(session.success){ + if(session.data.sessionId != undefined){ + localStorage.removeItem("sessionPayment"); + localStorage.setItem("sessionPayment", session.data.sessionId); + const handlerNew = window.ePayco.checkout.configure({ + sessionId: session.data.sessionId, + external: external, + }); + handlerNew.openNew() + }else{ + handler.open(data) + } + }else{ + handler.open(data) + } + }) + .catch(error => { + error.message; + }); + } + var openChekout = function () { + //handler.open(data) + openNewChekout() + } + var bntPagar = document.getElementById("btn_epayco"); + bntPagar.addEventListener("click", openChekout); + let responseUrl = document.getElementById("response").textContent; + handler.onCloseModal = function () {}; + var isForceRedirect='.$force_redirect.'; + if(isForceRedirect == true){ + let responseUrl = document.getElementById("response").textContent; + handler.onCreated(function(response) { + }).onResponse(function(response) { + }).onClosed(function(response) { + window.location.href = responseUrl + }); + } + handler.onCloseModal = function () {}; + setTimeout(openChekout, 1000) + + + + ', trim($this->epayco_publickey), + $testMode, + $descripcion, + $descripcion, + $order->get_id(), + $currency, + $order->get_total(), + $base_tax, + $tax, + $basedCountry, + $this->epayco_lang, + $external, + $confirm_url, + $redirect_url, + $name_billing, + $address_billing, + $email_billing, + $phone_billing, + $myIp, + $testMode, + trim($this->epayco_publickey), + trim($this->epayco_privatekey) + ); } /** * Process the payment and return the result @@ -573,8 +599,8 @@ function receipt_page( $order_id ) {

- ' . esc_html__( 'Cargando métodos de pago', 'woo-epayco-gateway' ) . ' -
' . esc_html__( '', 'woo-epayco-gateway' ) . ' + ' . esc_html__( 'Cargando métodos de pago', 'epayco-woocommerce' ) . ' +

'; if ($this->epayco_lang === "2") { @@ -680,7 +706,7 @@ function successful_request($validationData) } - $url = 'https://secure.epayco.co/validation/v1/reference/'.$ref_payco; + $url = 'https://secure.epayco.io/validation/v1/reference/'.$ref_payco; $response = wp_remote_get( $url ); $body = wp_remote_retrieve_body( $response ); $jsonData = @json_decode($body, true); diff --git a/readme.txt b/readme.txt old mode 100644 new mode 100755 index 234a6d6..ba53cc1 --- a/readme.txt +++ b/readme.txt @@ -1,11 +1,11 @@ === ePayco plugin for WooCommerce === Contributors: ePayco Team Donate link: https://epayco.com/ -Tags: e-commerce, commerce, wordpress ecommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, epayco -Requires at least: 5.5 -Tested up to: 6.4 -Stable tag: 7.0.0 -Requires PHP: 5.6.0 +Tags: e-commerce, commerce, wordpress ecommerce, store, epayco +Requires at least: 8.8.5 +Tested up to: 6.7 +Stable tag: 6.7 +Requires PHP: 7.4 License: GNU General Public License v3.0 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -45,8 +45,11 @@ Yes. But it is advisable that you consider using it since it is revealing for br == Changelog == -= 6.0.0 = += 6.7.0 = * Initial stable release += 8.1.0 = +* upload release + == Additional Info == **Contribute** [repository on github](https://github.com/epayco/Plugin_ePayco_WooCommerce) \ No newline at end of file diff --git a/woocommerce-gateway-payco.php b/woocommerce-gateway-payco.php index 2991282..9822585 100644 --- a/woocommerce-gateway-payco.php +++ b/woocommerce-gateway-payco.php @@ -6,13 +6,13 @@ * * Plugin Name: WooCommerce Epayco Gateway * Description: Plugin ePayco Gateway for WooCommerce. - * Version: 8.0.3 + * Version: 8.1 * Author: ePayco * Author URI: http://epayco.co * Tested up to: 6.4 * WC requires at least: 7.4 * WC tested up to: 8.3 - * Text Domain: woo-epayco-gateway + * Text Domain: epayco-woocommerce * Domain Path: /i18n/languages/ * License: GNU General Public License v3.0 * License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -67,7 +67,7 @@ function woocommerce_gateway_epayco_init() { /** * Localisation */ - load_plugin_textdomain( 'woo-epayco-gateway', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); + load_plugin_textdomain( 'epayco-woocommerce', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); /** @@ -126,7 +126,7 @@ function register_epayco_order_status() { 'show_in_admin_status_list' => true, 'show_in_admin_all_list' => true, 'exclude_from_search' => false, - 'label_count' => _n_noop( 'ePayco Pago Fallido (%s)', 'ePayco Pago Fallido (%s)' ) + 'label_count' => 'ePayco Pago Fallido (%s)' )); register_post_status( 'wc-epayco_failed', array( @@ -135,7 +135,7 @@ function register_epayco_order_status() { 'show_in_admin_status_list' => true, 'show_in_admin_all_list' => true, 'exclude_from_search' => false, - 'label_count' => _n_noop( 'ePayco Pago Fallido Prueba (%s)', 'ePayco Pago Fallido Prueba (%s)' ) + 'label_count' => 'ePayco Pago Fallido Prueba (%s)' )); register_post_status( 'wc-epayco-cancelled', array( @@ -144,7 +144,7 @@ function register_epayco_order_status() { 'show_in_admin_status_list' => true, 'show_in_admin_all_list' => true, 'exclude_from_search' => false, - 'label_count' => _n_noop( 'ePayco Pago Cancelado (%s)', 'ePayco Pago Cancelado (%s)' ) + 'label_count' => 'ePayco Pago Cancelado (%s)' )); register_post_status( 'wc-epayco_cancelled', array( @@ -153,7 +153,7 @@ function register_epayco_order_status() { 'show_in_admin_status_list' => true, 'show_in_admin_all_list' => true, 'exclude_from_search' => false, - 'label_count' => _n_noop( 'ePayco Pago Cancelado Prueba (%s)', 'ePayco Pago Cancelado Prueba (%s)' ) + 'label_count' => 'ePayco Pago Cancelado Prueba (%s)' )); register_post_status( 'wc-epayco-on-hold', array( @@ -162,7 +162,7 @@ function register_epayco_order_status() { 'show_in_admin_status_list' => true, 'show_in_admin_all_list' => true, 'exclude_from_search' => false, - 'label_count' => _n_noop( 'ePayco Pago Pendiente (%s)', 'ePayco Pago Pendiente (%s)' ) + 'label_count' => 'ePayco Pago Pendiente (%s)' )); register_post_status( 'wc-epayco_on_hold', array( @@ -171,7 +171,7 @@ function register_epayco_order_status() { 'show_in_admin_status_list' => true, 'show_in_admin_all_list' => true, 'exclude_from_search' => false, - 'label_count' => _n_noop( 'ePayco Pago Pendiente Prueba (%s)', 'ePayco Pago Pendiente Prueba (%s)' ) + 'label_count' => 'ePayco Pago Pendiente Prueba (%s)' )); register_post_status( 'wc-epayco-processing', array( @@ -180,7 +180,7 @@ function register_epayco_order_status() { 'show_in_admin_status_list' => true, 'show_in_admin_all_list' => true, 'exclude_from_search' => false, - 'label_count' => _n_noop( 'ePayco Procesando Pago (%s)', 'ePayco Procesando Pago (%s)' ) + 'label_count' => 'ePayco Procesando Pago (%s)' )); register_post_status( 'wc-epayco_processing', array( @@ -189,7 +189,7 @@ function register_epayco_order_status() { 'show_in_admin_status_list' => true, 'show_in_admin_all_list' => true, 'exclude_from_search' => false, - 'label_count' => _n_noop( 'ePayco Procesando Pago Prueba(%s)', 'ePayco Procesando Pago Prueba(%s)' ) + 'label_count' => 'ePayco Procesando Pago Prueba(%s)' )); register_post_status( 'wc-processing', array( @@ -198,7 +198,7 @@ function register_epayco_order_status() { 'show_in_admin_status_list' => true, 'show_in_admin_all_list' => true, 'exclude_from_search' => false, - 'label_count' => _n_noop( 'Procesando(%s)', 'Procesando(%s)' ) + 'label_count' => 'Procesando(%s)' )); register_post_status( 'wc-processing_test', array( @@ -207,7 +207,7 @@ function register_epayco_order_status() { 'show_in_admin_status_list' => true, 'show_in_admin_all_list' => true, 'exclude_from_search' => false, - 'label_count' => _n_noop( 'Procesando Prueba(%s)', 'Procesando Prueba(%s)' ) + 'label_count' => 'Procesando Prueba(%s)' )); register_post_status( 'wc-epayco-completed', array( @@ -216,7 +216,7 @@ function register_epayco_order_status() { 'show_in_admin_status_list' => true, 'show_in_admin_all_list' => true, 'exclude_from_search' => false, - 'label_count' => _n_noop( 'ePayco Pago Completado (%s)', 'ePayco Pago Completado (%s)' ) + 'label_count' => 'ePayco Pago Completado (%s)' )); register_post_status( 'wc-epayco_completed', array( @@ -225,7 +225,7 @@ function register_epayco_order_status() { 'show_in_admin_status_list' => true, 'show_in_admin_all_list' => true, 'exclude_from_search' => false, - 'label_count' => _n_noop( 'ePayco Pago Completado Prueba (%s)', 'ePayco Pago Completado Prueba (%s)' ) + 'label_count' => 'ePayco Pago Completado Prueba (%s)' )); register_post_status( 'wc-completed', array( @@ -234,7 +234,7 @@ function register_epayco_order_status() { 'show_in_admin_status_list' => true, 'show_in_admin_all_list' => true, 'exclude_from_search' => false, - 'label_count' => _n_noop( 'Completado(%s)', 'Completado(%s)' ) + 'label_count' => 'Completado(%s)' )); register_post_status( 'wc-completed_test', array( @@ -243,7 +243,7 @@ function register_epayco_order_status() { 'show_in_admin_status_list' => true, 'show_in_admin_all_list' => true, 'exclude_from_search' => false, - 'label_count' => _n_noop( 'Completado Prueba(%s)', 'Completado Prueba(%s)' ) + 'label_count' => 'Completado Prueba(%s)' )); } add_action( 'plugins_loaded', 'register_epayco_order_status' ); @@ -318,57 +318,73 @@ function styling_admin_order_list() { $epayco_order = get_option('epayco_order_status'); $testMode = $epayco_order == "yes" ? "true" : "false"; if($testMode=="true"){ - $order_status_failed = 'epayco_failed'; - $order_status_on_hold = 'epayco_on_hold'; - $order_status_processing = 'epayco_processing'; - $order_status_processing_ = 'processing_test'; - $order_status_completed = 'epayco_completed'; - $order_status_cancelled = 'epayco_cancelled'; - $order_status_completed_ = 'completed_test'; - + ?> + + + + - - - Date: Fri, 30 Aug 2024 09:18:31 -0500 Subject: [PATCH 3/3] feat:Se configura checkout de produccion --- README.md | 1 + classes/class-wc-gateway-epayco.php | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c4d9348..34ada8a 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ ** Se recomienda emplear la última versión disponible. ** ## Versiones +* [epayco plugin WooCommerce v8.1.0](https://github.com/epayco/Plugin_ePayco_WooCommerce/releases/tag/v8.1.0). * [epayco plugin WooCommerce v8.0.3](https://github.com/epayco/Plugin_ePayco_WooCommerce/releases/tag/v8.0.3). * [epayco plugin WooCommerce v8.0.2](https://github.com/epayco/Plugin_ePayco_WooCommerce/releases/tag/v8.0.2). * [epayco plugin WooCommerce v8.0.1](https://github.com/epayco/Plugin_ePayco_WooCommerce/releases/tag/v8.0.1). diff --git a/classes/class-wc-gateway-epayco.php b/classes/class-wc-gateway-epayco.php index 41a1958..f6c668c 100644 --- a/classes/class-wc-gateway-epayco.php +++ b/classes/class-wc-gateway-epayco.php @@ -444,7 +444,7 @@ function generate_epayco_form( $order_id ) {