From bf463bfa794dcbcaf46ab329f90e2c5452b10114 Mon Sep 17 00:00:00 2001 From: Tekton Date: Fri, 11 Aug 2023 18:10:07 -0500 Subject: [PATCH 01/14] feature: enable rsa fields --- .../woocommerce/assets/js/wc-checkout.js | 5 +++- .../woocommerce/class-fullculqi-wc-method.php | 2 ++ includes/admin/class-fullculqi-settings.php | 28 +++++++++++++++++++ includes/functions.php | 4 ++- .../layouts/admin/settings/input_rsa_id.php | 5 ++++ .../layouts/admin/settings/input_rsa_pk.php | 5 ++++ 6 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 resources/layouts/admin/settings/input_rsa_id.php create mode 100644 resources/layouts/admin/settings/input_rsa_pk.php diff --git a/includes/3rd-party/plugins/woocommerce/assets/js/wc-checkout.js b/includes/3rd-party/plugins/woocommerce/assets/js/wc-checkout.js index 7d12e97..25d3f81 100644 --- a/includes/3rd-party/plugins/woocommerce/assets/js/wc-checkout.js +++ b/includes/3rd-party/plugins/woocommerce/assets/js/wc-checkout.js @@ -117,6 +117,7 @@ Culqi3DS.publicKey = fullculqi_vars.public_key; * @return mixed */ setSettings: function() { + console.log(fullculqi_vars.rsa_pk); Culqi.publicKey = fullculqi_vars.public_key; let args_settings = { title: fullculqi_vars.commerce, @@ -125,7 +126,9 @@ Culqi3DS.publicKey = fullculqi_vars.public_key; amount: fullculqi_vars.total, culqiclient: 'woocommerce', culqiclientversion: fullculqi_vars.version_wc, - culqipluginversion: fullculqi_vars.version_plugin + culqipluginversion: fullculqi_vars.version_plugin, + xculqirsaid: fullculqi_vars.rsa_id, + rsapublickey: fullculqi_vars.rsa_pk }; console.log(fullculqi_vars.multi_order+':: el orderid'); if( fullculqi_vars.multi_order != '' ) { diff --git a/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-method.php b/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-method.php index 8525259..335e9ac 100644 --- a/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-method.php +++ b/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-method.php @@ -306,6 +306,8 @@ public function process_ajax($order_id) { 'url_actions' => site_url( $wc_action_url ), 'url_success' => $order->get_checkout_order_received_url(), 'public_key' => sanitize_text_field( $settings['public_key'] ), + 'rsa_id' => sanitize_text_field( $settings['rsa_id'] ), + 'rsa_pk' => sanitize_text_field( $settings['rsa_pk'] ), 'installments' => sanitize_title( $this->installments ), 'multipayment' => sanitize_title( $this->multipayment ), 'multi_order' => ((isset($settings['methods']['cuetealo']) and $settings['methods']['cuetealo']!='0') or (isset($settings['methods']['billetera']) and $settings['methods']['billetera']!='0') or (isset($settings['methods']['agente']) and $settings['methods']['agente']!='0') or (isset($settings['methods']['bancaMovil']) and $settings['methods']['bancaMovil']!='0')) ? $culqi_order_id : '', diff --git a/includes/admin/class-fullculqi-settings.php b/includes/admin/class-fullculqi-settings.php index d5b5075..69dd884 100644 --- a/includes/admin/class-fullculqi-settings.php +++ b/includes/admin/class-fullculqi-settings.php @@ -363,6 +363,22 @@ public function register_settings() { 'fullculqi_section' // Section ); + add_settings_field( + 'fullculqi_rsa_id', //ID + esc_html__('RSA Id', 'fullculqi'), + [$this, 'input_rsa_id'], + 'fullculqi_page', + 'fullculqi_section' + ); + + add_settings_field( + 'fullculqi_rsa_pk', //ID + esc_html__('RSA Publickey', 'fullculqi'), + [$this, 'input_rsa_pk'], + 'fullculqi_page', + 'fullculqi_section' + ); + /* add_settings_field( @@ -509,6 +525,18 @@ public function input_buttoncustom() { fullculqi_get_template( 'resources/layouts/admin/settings/input_buttoncustom.php', $settings ); } + public function input_rsa_id() { + $settings = fullculqi_get_settings(); + + fullculqi_get_template( 'resources/layouts/admin/settings/input_rsa_id.php', $settings ); + } + + public function input_rsa_pk() { + $settings = fullculqi_get_settings(); + + fullculqi_get_template( 'resources/layouts/admin/settings/input_rsa_pk.php', $settings ); + } + /** * Input Button Delete All * @return html diff --git a/includes/functions.php b/includes/functions.php index 27b6b2b..d20d24e 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -39,7 +39,9 @@ function fullculqi_get_default() { 'username' => '', 'password' => '', 'estado_pedido' => '', - 'color_palette' => '' + 'color_palette' => '', + 'rsa_id' => '', + 'rsa_pk' => '', ]; return apply_filters( 'fullculqi/settings_default', $default ); diff --git a/resources/layouts/admin/settings/input_rsa_id.php b/resources/layouts/admin/settings/input_rsa_id.php new file mode 100644 index 0000000..0546a05 --- /dev/null +++ b/resources/layouts/admin/settings/input_rsa_id.php @@ -0,0 +1,5 @@ + diff --git a/resources/layouts/admin/settings/input_rsa_pk.php b/resources/layouts/admin/settings/input_rsa_pk.php new file mode 100644 index 0000000..a28fc25 --- /dev/null +++ b/resources/layouts/admin/settings/input_rsa_pk.php @@ -0,0 +1,5 @@ + From 4cfac0305958a7624d43a32cf8cc3ecbc38920aa Mon Sep 17 00:00:00 2001 From: Tekton Date: Mon, 14 Aug 2023 10:18:09 -0500 Subject: [PATCH 02/14] fix: fields rsa position --- includes/admin/class-fullculqi-settings.php | 34 ++++++++++----------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/includes/admin/class-fullculqi-settings.php b/includes/admin/class-fullculqi-settings.php index 69dd884..57aa87b 100644 --- a/includes/admin/class-fullculqi-settings.php +++ b/includes/admin/class-fullculqi-settings.php @@ -339,6 +339,22 @@ public function register_settings() { array( 'class' => 'fullculqi_estado_pedido' ) ); + add_settings_field( + 'fullculqi_rsa_id', //ID + esc_html__('RSA Id', 'fullculqi'), + [$this, 'input_rsa_id'], + 'fullculqi_page', + 'fullculqi_section' + ); + + add_settings_field( + 'fullculqi_rsa_pk', //ID + esc_html__('RSA Publickey', 'fullculqi'), + [$this, 'input_rsa_pk'], + 'fullculqi_page', + 'fullculqi_section' + ); + add_settings_field( 'fullculqi_buttoncustom', // ID esc_html__( 'Personalizar formulario de checkout', 'fullculqi' ), // Logo @@ -363,24 +379,6 @@ public function register_settings() { 'fullculqi_section' // Section ); - add_settings_field( - 'fullculqi_rsa_id', //ID - esc_html__('RSA Id', 'fullculqi'), - [$this, 'input_rsa_id'], - 'fullculqi_page', - 'fullculqi_section' - ); - - add_settings_field( - 'fullculqi_rsa_pk', //ID - esc_html__('RSA Publickey', 'fullculqi'), - [$this, 'input_rsa_pk'], - 'fullculqi_page', - 'fullculqi_section' - ); - - - /* add_settings_field( 'fullculqi_button_clear', // ID esc_html__( 'Delete all the entities', 'fullculqi' ), // Simple Payment From 013f890852018fb0accafc40c2cbfa5ffb9e9bfe Mon Sep 17 00:00:00 2001 From: Tekton Date: Tue, 15 Aug 2023 13:04:08 -0500 Subject: [PATCH 03/14] fix: rsa validation --- .../plugins/woocommerce/assets/js/wc-checkout.js | 8 +++++--- resources/layouts/admin/settings/input_rsa_id.php | 2 +- resources/layouts/admin/settings/input_rsa_pk.php | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/includes/3rd-party/plugins/woocommerce/assets/js/wc-checkout.js b/includes/3rd-party/plugins/woocommerce/assets/js/wc-checkout.js index 25d3f81..de345f6 100644 --- a/includes/3rd-party/plugins/woocommerce/assets/js/wc-checkout.js +++ b/includes/3rd-party/plugins/woocommerce/assets/js/wc-checkout.js @@ -126,10 +126,12 @@ Culqi3DS.publicKey = fullculqi_vars.public_key; amount: fullculqi_vars.total, culqiclient: 'woocommerce', culqiclientversion: fullculqi_vars.version_wc, - culqipluginversion: fullculqi_vars.version_plugin, - xculqirsaid: fullculqi_vars.rsa_id, - rsapublickey: fullculqi_vars.rsa_pk + culqipluginversion: fullculqi_vars.version_plugin }; + if(fullculqi_vars.rsa_id && fullculqi_vars.rsa_pk) { + args_settings.xculqirsaid = fullculqi_vars.rsa_id; + args_settings.rsapublickey = fullculqi_vars.rsa_pk; + } console.log(fullculqi_vars.multi_order+':: el orderid'); if( fullculqi_vars.multi_order != '' ) { args_settings.order = fullculqi_vars.multi_order; diff --git a/resources/layouts/admin/settings/input_rsa_id.php b/resources/layouts/admin/settings/input_rsa_id.php index 0546a05..0d1411f 100644 --- a/resources/layouts/admin/settings/input_rsa_id.php +++ b/resources/layouts/admin/settings/input_rsa_id.php @@ -1,5 +1,5 @@ diff --git a/resources/layouts/admin/settings/input_rsa_pk.php b/resources/layouts/admin/settings/input_rsa_pk.php index a28fc25..d54e0a8 100644 --- a/resources/layouts/admin/settings/input_rsa_pk.php +++ b/resources/layouts/admin/settings/input_rsa_pk.php @@ -1,5 +1,5 @@ From 16af41d173344b0c708da1335279f47029067d37 Mon Sep 17 00:00:00 2001 From: Tekton Date: Tue, 15 Aug 2023 13:12:30 -0500 Subject: [PATCH 04/14] fix: tooltips --- admin/assets/css/form.css | 4 ++++ includes/admin/class-fullculqi-settings.php | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/admin/assets/css/form.css b/admin/assets/css/form.css index 758f9eb..d4d4521 100644 --- a/admin/assets/css/form.css +++ b/admin/assets/css/form.css @@ -2,6 +2,10 @@ margin-bottom: 1rem; } +.tool.custom-ml::after { + margin-left: -20px; +} + @media (max-width: 576px) { #woocommerce_culqi_login_button { margin-left: 0!important; diff --git a/includes/admin/class-fullculqi-settings.php b/includes/admin/class-fullculqi-settings.php index 57aa87b..08d3ef9 100644 --- a/includes/admin/class-fullculqi-settings.php +++ b/includes/admin/class-fullculqi-settings.php @@ -341,7 +341,10 @@ public function register_settings() { add_settings_field( 'fullculqi_rsa_id', //ID - esc_html__('RSA Id', 'fullculqi'), + esc_html__('RSA Id', 'fullculqi') . ' ' . + ' + ' . + ' ', [$this, 'input_rsa_id'], 'fullculqi_page', 'fullculqi_section' @@ -349,7 +352,10 @@ public function register_settings() { add_settings_field( 'fullculqi_rsa_pk', //ID - esc_html__('RSA Publickey', 'fullculqi'), + esc_html__('RSA Publickey', 'fullculqi') . ' ' . + ' + ' . + ' ', [$this, 'input_rsa_pk'], 'fullculqi_page', 'fullculqi_section' From d5fc1a24a77c48d93b9b991faa0b69c95c2be975 Mon Sep 17 00:00:00 2001 From: proveedor103 Date: Wed, 16 Aug 2023 09:32:56 -0500 Subject: [PATCH 05/14] fix: add culqi client --- .../3rd-party/plugins/woocommerce/assets/js/wc-checkout.js | 3 +++ .../plugins/woocommerce/class-fullculqi-wc-method.php | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/3rd-party/plugins/woocommerce/assets/js/wc-checkout.js b/includes/3rd-party/plugins/woocommerce/assets/js/wc-checkout.js index de345f6..cff36f1 100644 --- a/includes/3rd-party/plugins/woocommerce/assets/js/wc-checkout.js +++ b/includes/3rd-party/plugins/woocommerce/assets/js/wc-checkout.js @@ -138,6 +138,9 @@ Culqi3DS.publicKey = fullculqi_vars.public_key; } console.log(args_settings); Culqi.settings( args_settings ); + Culqi.client = { + email: fullculqi_vars.culqi_customer_email + }; }, /** * Set Culqi Options diff --git a/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-method.php b/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-method.php index 335e9ac..b063430 100644 --- a/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-method.php +++ b/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-method.php @@ -78,9 +78,10 @@ public function process_ajax($order_id) { $pnames = []; $order = new WC_Order( $order_id ); + $culqi_customer_email = ""; if (version_compare(WC_VERSION, "2.7", "<")) { $log = new FullCulqi_Logs( $order_id ); - + $culqi_customer_email = $order->billing_email; $settings = fullculqi_get_settings(); //var_dump($settings); exit(1); // Disabled from thirds @@ -171,6 +172,7 @@ public function process_ajax($order_id) { } }else{ $log = new FullCulqi_Logs( $order->get_id() ); + $culqi_customer_email = $order->get_billing_email(); $settings = fullculqi_get_settings(); //var_dump($settings); exit(1); @@ -337,6 +339,7 @@ public function process_ajax($order_id) { 'wpnonce' => wp_create_nonce( 'fullculqi' ), 'enviroment' => $settings['enviroment'], 'url' => $returnUrl3DS, + 'culqi_customer_email' => $culqi_customer_email ]; do_action( 'fullculqi/method/enqueue_scripts/pay_page', $order ); //} From c622e95ab787e5e01503026093f26ee367037377 Mon Sep 17 00:00:00 2001 From: proveedor103 Date: Tue, 22 Aug 2023 20:51:56 -0500 Subject: [PATCH 06/14] fix: expired token --- .../woocommerce/assets/js/wc-checkout.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/includes/3rd-party/plugins/woocommerce/assets/js/wc-checkout.js b/includes/3rd-party/plugins/woocommerce/assets/js/wc-checkout.js index cff36f1..9047a62 100644 --- a/includes/3rd-party/plugins/woocommerce/assets/js/wc-checkout.js +++ b/includes/3rd-party/plugins/woocommerce/assets/js/wc-checkout.js @@ -381,8 +381,9 @@ Culqi3DS.publicKey = fullculqi_vars.public_key; } }else{ + jQuery('#loadingloginculqi').remove(); $('#fullculqi_notify').addClass('woocommerce-error').html( 'Ha ocurrido un error procesando el pago. Por favor intente nuevamente o comuníquese con su entidad bancaria.'); - scrollToCulqiError();; + scrollToCulqiError(); } } @@ -409,9 +410,8 @@ Culqi3DS.publicKey = fullculqi_vars.public_key; data : post_data, success: function( response ) { - - $( document.body ).trigger('fullculqi.checkout.success', [ post_data, response ]); - + if( response.success ) { + $( document.body ).trigger('fullculqi.checkout.success', [ post_data, response ]); var enviroment = fullculqi_vars.enviroment.split('|'); $('#fullculqi_notify').empty(); if(Culqi.token==null){ @@ -426,6 +426,16 @@ Culqi3DS.publicKey = fullculqi_vars.public_key; //alert('stop'); location.href = fullculqi_vars.url_success; } + } else { + jQuery('#loadingloginculqi').remove(); + if(response.data && response.data.message) { + $('#fullculqi_notify').addClass('woocommerce-error').html(response.data.message); + scrollToCulqiError(); + } else { + $('#fullculqi_notify').addClass('woocommerce-error').html( 'Ha ocurrido un error procesando el pago. Por favor intente nuevamente o comuníquese con su entidad bancaria.'); + scrollToCulqiError(); + } + } }, From 721938a60f088035ac3ebe0b10c4b7db6cf08795 Mon Sep 17 00:00:00 2001 From: proveedor103 Date: Thu, 24 Aug 2023 09:37:24 -0500 Subject: [PATCH 07/14] php8.2 support --- admin/class-fullculqi-admin.php | 2 +- admin/class-fullculqi-entities.php | 2 +- admin/class-fullculqi-payments.php | 2 +- admin/class-fullculqi-settings.php | 2 +- .../3rd-party/plugins/woocommerce/class-fullculqi-wc-admin.php | 2 ++ .../3rd-party/plugins/woocommerce/class-fullculqi-wc-main.php | 2 ++ .../3rd-party/plugins/woocommerce/class-fullculqi-wc-method.php | 2 ++ .../plugins/woocommerce/class-fullculqi-wc-process.php | 2 ++ includes/admin/class-fullculqi-settings.php | 2 ++ includes/admin/class-fullculqi-updater.php | 2 ++ includes/admin/class-fullculqi-upgrader.php | 2 ++ includes/admin/class-fullculqi-welcome.php | 2 ++ includes/class-fullculqi-activator.php | 2 ++ includes/class-fullculqi-ajax.php | 2 ++ includes/class-fullculqi-checkout.php | 2 ++ includes/class-fullculqi-cpt.php | 1 + includes/class-fullculqi-endpoints.php | 1 + includes/class-fullculqi-i18n.php | 1 + includes/class-fullculqi-logs.php | 1 + includes/class-fullculqi-provider.php | 1 + includes/class-fullculqi-webhooks.php | 1 + includes/class-fullculqi.php | 1 + public/class-fullculqi-integrator.php | 1 + 23 files changed, 34 insertions(+), 4 deletions(-) diff --git a/admin/class-fullculqi-admin.php b/admin/class-fullculqi-admin.php index 3f75b0d..47946ec 100644 --- a/admin/class-fullculqi-admin.php +++ b/admin/class-fullculqi-admin.php @@ -1,6 +1,6 @@ Date: Fri, 1 Sep 2023 08:15:23 -0500 Subject: [PATCH 08/14] fix: dynamic cards logo --- .../woocommerce/assets/images/cards.svg | 12 ++-- .../woocommerce/assets/images/cards_old.svg | 44 ++++++++++++++ .../assets/images/pagoefectivo.svg | 9 +++ .../woocommerce/assets/images/yape.svg | 7 +++ .../woocommerce/class-fullculqi-wc-method.php | 58 ++++++++++++++++--- 5 files changed, 117 insertions(+), 13 deletions(-) create mode 100644 includes/3rd-party/plugins/woocommerce/assets/images/cards_old.svg create mode 100644 includes/3rd-party/plugins/woocommerce/assets/images/pagoefectivo.svg create mode 100644 includes/3rd-party/plugins/woocommerce/assets/images/yape.svg diff --git a/includes/3rd-party/plugins/woocommerce/assets/images/cards.svg b/includes/3rd-party/plugins/woocommerce/assets/images/cards.svg index ff67eb8..c945472 100644 --- a/includes/3rd-party/plugins/woocommerce/assets/images/cards.svg +++ b/includes/3rd-party/plugins/woocommerce/assets/images/cards.svg @@ -1,4 +1,4 @@ - + @@ -17,10 +17,10 @@ - - - - + + + + @@ -41,4 +41,4 @@ - + \ No newline at end of file diff --git a/includes/3rd-party/plugins/woocommerce/assets/images/cards_old.svg b/includes/3rd-party/plugins/woocommerce/assets/images/cards_old.svg new file mode 100644 index 0000000..ff67eb8 --- /dev/null +++ b/includes/3rd-party/plugins/woocommerce/assets/images/cards_old.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/includes/3rd-party/plugins/woocommerce/assets/images/pagoefectivo.svg b/includes/3rd-party/plugins/woocommerce/assets/images/pagoefectivo.svg new file mode 100644 index 0000000..8998d0d --- /dev/null +++ b/includes/3rd-party/plugins/woocommerce/assets/images/pagoefectivo.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/includes/3rd-party/plugins/woocommerce/assets/images/yape.svg b/includes/3rd-party/plugins/woocommerce/assets/images/yape.svg new file mode 100644 index 0000000..5e044a1 --- /dev/null +++ b/includes/3rd-party/plugins/woocommerce/assets/images/yape.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-method.php b/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-method.php index e376bd6..8af0cf2 100644 --- a/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-method.php +++ b/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-method.php @@ -551,7 +551,7 @@ public function process_payment( $order_id = 0 ) { public function get_title() { if (is_checkout() && !is_wc_endpoint_url()) { - return '' . esc_attr($this->title) . ''; + return '
' . esc_attr($this->title) . ''; } else { return esc_attr($this->title); } @@ -559,7 +559,30 @@ public function get_title() { public function get_icon() { // Return the icon image - return ''.$this->payment_methods.''; + $settings = fullculqi_get_settings(); + $tarjeta = (isset($settings['methods']['tarjeta']) and $settings['methods']['tarjeta']!='0'); + $yape = (isset($settings['methods']['yape']) and $settings['methods']['yape']!='0'); + $billetera = (isset($settings['methods']['billetera']) and $settings['methods']['billetera']!='0'); + $bancaMovil = (isset($settings['methods']['bancaMovil']) and $settings['methods']['bancaMovil']!='0'); + $agente = (isset($settings['methods']['agente']) and $settings['methods']['agente']!='0'); + $cuetealo = (isset($settings['methods']['cuetealo']) and $settings['methods']['cuetealo']!='0'); + // + $cards_img = MPCULQI_WC_URL . 'assets/images/cards.svg'; + $yape_img = MPCULQI_WC_URL . 'assets/images/yape.svg'; + $pagoefectivo_img = MPCULQI_WC_URL . 'assets/images/pagoefectivo.svg'; + $final_image = '
'; + if($tarjeta) { + $final_image .= ''.$this->payment_methods.''; + } + if($yape) { + $final_image .= ''.$this->payment_methods.''; + } + if($billetera || $bancaMovil || $agente || $cuetealo) { + $final_image .= ''.$this->payment_methods.''; + } + $final_image .= '
'; + + return $final_image; } @@ -761,14 +784,27 @@ public function custom_checkout_js() { if (is_checkout() && !is_wc_endpoint_url()) { ?> From 5ac927a18ee0b363042b73bac794a9333463abb2 Mon Sep 17 00:00:00 2001 From: JoseHCalderon <105760917+JoseHCalderon@users.noreply.github.com> Date: Fri, 1 Sep 2023 10:40:40 -0500 Subject: [PATCH 09/14] v3.0.7 --- changelog.txt | 4 ++++ index.php | 4 ++-- readme.txt | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index 3007384..4c6b74e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +2023-09-01 - version 3.0.7 +Fix: Add RSA encrypt +Fix: Add dynamic logos + 2023-08-10 - version 3.0.6 Fix: fix: 3ds-challengue diff --git a/index.php b/index.php index c5a49cb..836f6e2 100644 --- a/index.php +++ b/index.php @@ -3,7 +3,7 @@ Plugin Name: Culqi Plugin URI:https://wordpress.org/plugins/culqi-checkout Description: Culqi acepta pago con tarjetas, pagoefectivo, billeteras móviles y cuotéalo desde tu tienda virtual. -Version: 3.0.6 +Version: 3.0.7 Author: Culqi Author URI: https://culqi.com/ Developer: Culqi Team @@ -22,7 +22,7 @@ if ( ! defined( 'WPINC' ) ) { die; } -define( 'MPCULQI_PLUGIN_VERSION' , 'v3.0.6'); +define( 'MPCULQI_PLUGIN_VERSION' , 'v3.0.7'); define( 'MPCULQI_FILE' , __FILE__ ); define( 'MPCULQI_DIR' , plugin_dir_path(__FILE__) ); diff --git a/readme.txt b/readme.txt index f8d8449..c6a823b 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: culqi, checkout, payment method, Perú, woocommerce Donate link: https://culqi.com/ Requires at least: 4.5 Tested up to: 6.0.2 -Stable tag: 3.0.6 +Stable tag: 3.0.7 Requires PHP: 5.6 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html From 2396d5d08c513ac8549424f740363c834d9a8fd8 Mon Sep 17 00:00:00 2001 From: JoseHCalderon <105760917+JoseHCalderon@users.noreply.github.com> Date: Fri, 1 Sep 2023 11:05:34 -0500 Subject: [PATCH 10/14] txt --- includes/admin/class-fullculqi-settings.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/admin/class-fullculqi-settings.php b/includes/admin/class-fullculqi-settings.php index 072c0f6..785199e 100644 --- a/includes/admin/class-fullculqi-settings.php +++ b/includes/admin/class-fullculqi-settings.php @@ -343,7 +343,7 @@ public function register_settings() { add_settings_field( 'fullculqi_rsa_id', //ID - esc_html__('RSA Id', 'fullculqi') . ' ' . + esc_html__('RSA Id', 'fullculqi') . ' ' . ' ' . ' ', @@ -354,7 +354,7 @@ public function register_settings() { add_settings_field( 'fullculqi_rsa_pk', //ID - esc_html__('RSA Publickey', 'fullculqi') . ' ' . + esc_html__('RSA Publickey', 'fullculqi') . ' ' . ' ' . ' ', From 68fc193af03ea17541fc01e9db4437f950be23f8 Mon Sep 17 00:00:00 2001 From: JoseHCalderon <105760917+JoseHCalderon@users.noreply.github.com> Date: Fri, 1 Sep 2023 19:55:08 -0500 Subject: [PATCH 11/14] webhooks --- .../woocommerce/class-fullculqi-wc-main.php | 3 +- includes/class-fullculqi-webhooks.php | 55 ++++++++++++++----- 2 files changed, 43 insertions(+), 15 deletions(-) diff --git a/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-main.php b/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-main.php index 2946a4b..ffefecd 100644 --- a/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-main.php +++ b/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-main.php @@ -188,6 +188,7 @@ public function update_order( $culqi_order ) { * [old_update_order description] * @return [type] [description] */ + /* public function old_update_order() { $inputJSON = file_get_contents('php://input'); @@ -212,7 +213,7 @@ public function old_update_order() { echo wp_send_json( ['result' => 'success' ] ); die(); } - + */ /** * Notice Currency * @return html diff --git a/includes/class-fullculqi-webhooks.php b/includes/class-fullculqi-webhooks.php index f70a5a0..46cc1f2 100644 --- a/includes/class-fullculqi-webhooks.php +++ b/includes/class-fullculqi-webhooks.php @@ -26,7 +26,8 @@ public function to_receive() { $headers = getallheaders(); $headers = $headers['Authorization']; if(!isset($headers)){ - exit("Error: Cabecera Authorization no presente"); + $this->set_json_response("Error", "Cabecera Authorization no presente", 400); + //exit("Error: Cabecera Authorization no presente"); } $authorization = substr($headers,6); $credenciales = base64_decode($authorization); @@ -34,7 +35,8 @@ public function to_receive() { $username = $credenciales[0]; $password = $credenciales[1]; if(!isset($username) or !isset($password)){ - exit("Error: No Autorizado"); + $this->set_json_response("error", "No Autorizado", 401); + //exit("Error: No Autorizado"); } if( empty( $inputJSON ) ) return; @@ -45,7 +47,8 @@ public function to_receive() { $password_bd = $settings['password']; if( $username != $username_bd || $password != $password_bd ){ - exit("Error: Crendenciales Incorrectas"); + $this->set_json_response("error", "Crendenciales Incorrectas", 400); + //exit("Error: Crendenciales Incorrectas"); } if( $input->object != 'event' ) @@ -54,11 +57,13 @@ public function to_receive() { $data = json_decode( $input->data ); if (empty($data->metadata)) { - exit("Error: Metadata vacia"); + $this->set_json_response("Error", "Metadata vacia", 400); + //exit("Error: Metadata vacia"); } if (empty($data->amount) && empty($data->actualAmount)) { - exit("Error: No envió el amount"); + $this->set_json_response("error", "No envió el amount", 400); + //exit("Error: No envió el amount"); } // Webhook History @@ -67,14 +72,16 @@ public function to_receive() { switch( $input->type ) { case 'order.status.changed' : if (empty($data->id) || empty($data->order_number) || empty($data->currency_code) || empty($data->state)) { - exit("Error: order_id, order_number, currency_code o state vacios"); + $this->set_json_response("error", "order_id, order_number, currency_code o state vacios", 400); + //exit("Error: order_id, order_number, currency_code o state vacios"); } FullCulqi_Orders::update($data, 1); break; case 'refund.creation.succeeded' : if (empty($data->chargeId)) { - exit("Error: No envió el chargeId"); + $this->set_json_response("error", "No envió el chargeId", 400); + //exit("Error: No envió el chargeId"); } $order_id = fullculqi_post_from_meta('_culqi_charge_id', $data->chargeId); $charge_id = fullculqi_post_from_meta('culqi_id', $data->chargeId); @@ -121,28 +128,34 @@ public function to_receive() { $amount = $order->get_total() * 100; if($currency == $data->currency && $amount == $data->actualAmount) { FullCulqi_Charges::create( $data , true); - die("Cargo actualizado con éxito"); + $this->set_json_response("success", "Cargo actualizado con éxito", 200); + //die("Cargo actualizado con éxito"); break; } - die("La moneda o monto no coinciden con la orden."); + $this->set_json_response("error", "La moneda o monto no coinciden con la orden", 400); + //die("La moneda o monto no coinciden con la orden."); break; } - die($verifyCharge); + $this->set_json_response("error", $verifyCharge, 400); + //die($verifyCharge); break; } - die("No se puede actualizar, la orden no esta pendiente pago."); + $this->set_json_response("error", "No se puede actualizar, la orden no esta pendiente pago", 400); + //die("No se puede actualizar, la orden no esta pendiente pago."); break; } - die("El método de pago usado en la orden no es Culqi."); + $this->set_json_response("error", "El método de pago usado en la orden no es Culqi", 400); + //die("El método de pago usado en la orden no es Culqi."); break; } - - die("No existe la orden"); + $this->set_json_response("error", "No existe la orden", 400); + //die("No existe la orden"); break; } do_action( 'fullculqi/webhooks/to_receive', $input, $data ); + $this->set_json_response("success", "Operación satisfactoria", 200); } @@ -205,6 +218,20 @@ private function verifyChargeInOrders($charge_id, $current_order_id) return false; } + + public function set_json_response($result, $msg, $statusCode) { + if($statusCode===200){ + return wp_send_json_success( + ['result' => $result, + 'message' => $msg ], + $statusCode ); + }else{ + return wp_send_json_error( + ['result' => $result, + 'message' => $msg ], + $statusCode ); + } + } } From a8dba7dda3237d1e044733d13a2a8fea2cb507ff Mon Sep 17 00:00:00 2001 From: JoseHCalderon <105760917+JoseHCalderon@users.noreply.github.com> Date: Mon, 4 Sep 2023 20:46:33 -0500 Subject: [PATCH 12/14] txt --- .../woocommerce/class-fullculqi-wc-method.php | 44 ++++++++++++++++--- index.php | 2 +- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-method.php b/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-method.php index 8af0cf2..69eea5d 100644 --- a/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-method.php +++ b/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-method.php @@ -27,12 +27,9 @@ public function __construct() { $this->multipayment = $this->get_option( 'multipayment', 'no' ); $this->multi_duration = $this->get_option( 'multi_duration', 24 ); $this->multi_status = $this->get_option( 'multi_status', 'wc-pending' ); - $allowed_html = array( - 'strong' => array(), - ); - $this->description = wp_kses(__('Acepta pagos con tarjetas de débito y crédito; Yape, Cuotéalo BCP y PagoEfectivo (billeteras móviles, agentes y bodegas).', 'fullculqi'), $allowed_html); - $this->instructions = $this->get_option( 'instructions', $this->description ); + $this->description = $this->get_description(); + $this->instructions = $this->get_option( 'instructions', $this->get_description() ); $this->msg_fail = $this->get_option( 'msg_fail' ); $this->time_modal = $this->get_option( 'time_modal', 0 ); @@ -557,6 +554,43 @@ public function get_title() { } } + public function get_description() { + $settings = fullculqi_get_settings(); + $tarjeta = (isset($settings['methods']['tarjeta']) and $settings['methods']['tarjeta']!='0'); + $yape = (isset($settings['methods']['yape']) and $settings['methods']['yape']!='0'); + $billetera = (isset($settings['methods']['billetera']) and $settings['methods']['billetera']!='0'); + $bancaMovil = (isset($settings['methods']['bancaMovil']) and $settings['methods']['bancaMovil']!='0'); + $agente = (isset($settings['methods']['agente']) and $settings['methods']['agente']!='0'); + $cuotealo = (isset($settings['methods']['cuetealo']) and $settings['methods']['cuetealo']!='0'); + $txt_general = 'Acepta pagos con '; + $txt = ''; + $txtPE = ''; + if($tarjeta) { + $txt .= 'tarjetas de débito y crédito'; + } + if($yape) { + if($tarjeta) { + $txt .= ', '; + } + $txt .= 'Yape'; + } + if($billetera || $bancaMovil || $agente || $cuotealo) { + if($tarjeta || $yape) { + $txt .= ', '; + } + $txt .= 'Cuotéalo BCP y PagoEfectivo'; + $txtPE = ' (billeteras móviles, agentes y bodegas)'; + } + $txt = ''.$txt.''; + $txt = $txt_general. $txt. $txtPE; + $txt .= '.'; + $allowed_html = array( + 'strong' => array(), + ); + + return wp_kses(__($txt, 'fullculqi'), $allowed_html); + } + public function get_icon() { // Return the icon image $settings = fullculqi_get_settings(); diff --git a/index.php b/index.php index 836f6e2..4d80b73 100644 --- a/index.php +++ b/index.php @@ -2,7 +2,7 @@ /* Plugin Name: Culqi Plugin URI:https://wordpress.org/plugins/culqi-checkout -Description: Culqi acepta pago con tarjetas, pagoefectivo, billeteras móviles y cuotéalo desde tu tienda virtual. +Description: Culqi acepta pagos con tarjetas de débito y crédito, Yape, Cuotéalo BCP y PagoEfectivo (billeteras móviles, agentes y bodegas). Version: 3.0.7 Author: Culqi Author URI: https://culqi.com/ From de36f51a49987d39556717cd22448db2f6832ab6 Mon Sep 17 00:00:00 2001 From: JoseHCalderon <105760917+JoseHCalderon@users.noreply.github.com> Date: Mon, 4 Sep 2023 20:48:26 -0500 Subject: [PATCH 13/14] txt --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index 4d80b73..8aff118 100644 --- a/index.php +++ b/index.php @@ -16,7 +16,7 @@ Stable tag: 5.6 Requires PHP: 5.6 WC requires at least: 2.6.11 -WC tested up to: +WC tested up to: 3.0.0 */ // If this file is called directly, abort. if ( ! defined( 'WPINC' ) ) { From a0d622d3550b18e699acfab207737d9d4f1395a9 Mon Sep 17 00:00:00 2001 From: JoseHCalderon <105760917+JoseHCalderon@users.noreply.github.com> Date: Wed, 6 Sep 2023 11:28:38 -0500 Subject: [PATCH 14/14] txt_description --- .../plugins/woocommerce/class-fullculqi-wc-process.php | 8 ++++---- includes/class-fullculqi-checkout.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-process.php b/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-process.php index e00418a..c69b552 100644 --- a/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-process.php +++ b/includes/3rd-party/plugins/woocommerce/class-fullculqi-wc-process.php @@ -264,7 +264,7 @@ public static function charge( $post_data = [] ) { $args_charges = apply_filters( 'fullculqi/process/charge_args', [ 'amount' => fullculqi_format_total( $order->get_total() ), 'currency_code' => $order->order_currency, - 'description' => substr( str_pad( $desc, 5, '_' ), 0, 80 ), + 'description' => 'Venta desde plugin WooCommece',//substr( str_pad( $desc, 5, '_' ), 0, 80 ), 'capture' => true, //'email' => $order->billing_email, 'email' => $post_data['email'], @@ -279,7 +279,7 @@ public static function charge( $post_data = [] ) { $args_charges = apply_filters( 'fullculqi/process/charge_args', [ 'amount' => fullculqi_format_total( $order->get_total() ), 'currency_code' => $order->order_currency, - 'description' => substr( str_pad( $desc, 5, '_' ), 0, 80 ), + 'description' => 'Venta desde plugin WooCommece',//substr( str_pad( $desc, 5, '_' ), 0, 80 ), 'capture' => true, //'email' => $order->billing_email, 'email' => $post_data['email'], @@ -332,7 +332,7 @@ public static function charge( $post_data = [] ) { $args_charges = apply_filters( 'fullculqi/process/charge_args', [ 'amount' => fullculqi_format_total( $order->get_total() ), 'currency_code' => $order->get_currency(), - 'description' => substr( str_pad( $desc, 5, '_' ), 0, 80 ), + 'description' => 'Venta desde plugin WooCommece',//substr( str_pad( $desc, 5, '_' ), 0, 80 ), 'capture' => true, //'email' => $order->get_billing_email(), 'email' => $post_data['email'], @@ -347,7 +347,7 @@ public static function charge( $post_data = [] ) { $args_charges = apply_filters( 'fullculqi/process/charge_args', [ 'amount' => fullculqi_format_total( $order->get_total() ), 'currency_code' => $order->get_currency(), - 'description' => substr( str_pad( $desc, 5, '_' ), 0, 80 ), + 'description' => 'Venta desde plugin WooCommece',//substr( str_pad( $desc, 5, '_' ), 0, 80 ), 'capture' => true, //'email' => $order->get_billing_email(), 'email' => $post_data['email'], diff --git a/includes/class-fullculqi-checkout.php b/includes/class-fullculqi-checkout.php index 6707231..fe96548 100644 --- a/includes/class-fullculqi-checkout.php +++ b/includes/class-fullculqi-checkout.php @@ -65,7 +65,7 @@ static public function simple($order, $culqi_token, $log) { $args_payment = apply_filters('fullculqi/checkout/simple_args', [ 'amount' => fullculqi_format_total($order->get_total()), 'currency_code' => $order->get_currency(), - 'description' => substr(str_pad(implode(', ', $pnames), 5, '_'), 0, 80), + 'description' => 'Venta desde plugin WooCommece',//substr(str_pad(implode(', ', $pnames), 5, '_'), 0, 80), 'capture' => true, 'email' => $order->get_billing_email(), 'installments' => $installments,