Changeset 3083559
- Timestamp:
- 05/08/2024 08:33:32 PM (22 months ago)
- Location:
- shipping-envia-colvanes-woo
- Files:
-
- 5 edited
- 7 copied
-
tags/4.0.26 (copied) (copied from shipping-envia-colvanes-woo/trunk)
-
tags/4.0.26/includes/admin/settings.php (copied) (copied from shipping-envia-colvanes-woo/trunk/includes/admin/settings.php) (4 diffs)
-
tags/4.0.26/includes/class-method-shipping-envia-colvanes-ec.php (copied) (copied from shipping-envia-colvanes-woo/trunk/includes/class-method-shipping-envia-colvanes-ec.php) (8 diffs)
-
tags/4.0.26/includes/class-shipping-envia-colvanes-ec.php (copied) (copied from shipping-envia-colvanes-woo/trunk/includes/class-shipping-envia-colvanes-ec.php) (6 diffs)
-
tags/4.0.26/includes/class-shipping-envia-colvanes-plugin-ec.php (copied) (copied from shipping-envia-colvanes-woo/trunk/includes/class-shipping-envia-colvanes-plugin-ec.php)
-
tags/4.0.26/readme.txt (copied) (copied from shipping-envia-colvanes-woo/trunk/readme.txt) (2 diffs)
-
tags/4.0.26/shipping-envia-colvanes-woo.php (copied) (copied from shipping-envia-colvanes-woo/trunk/shipping-envia-colvanes-woo.php) (2 diffs)
-
trunk/includes/admin/settings.php (modified) (4 diffs)
-
trunk/includes/class-method-shipping-envia-colvanes-ec.php (modified) (8 diffs)
-
trunk/includes/class-shipping-envia-colvanes-ec.php (modified) (6 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/shipping-envia-colvanes-woo.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
shipping-envia-colvanes-woo/tags/4.0.26/includes/admin/settings.php
r3082125 r3083559 4 4 jQuery( function( $ ) { 5 5 6 let shipping_envia_colvanes_fields = '#woocommerce_shipping_envia_colvanes_ec_user, #woocommerce_shipping_envia_colvanes_ec_password, #woocommerce_shipping_envia_colvanes_ec_code_account, #woocommerce_shipping_envia_colvanes_ec_payment_method, #woocommerce_shipping_envia_colvanes_ec_code_service ';6 let shipping_envia_colvanes_fields = '#woocommerce_shipping_envia_colvanes_ec_user, #woocommerce_shipping_envia_colvanes_ec_password, #woocommerce_shipping_envia_colvanes_ec_code_account, #woocommerce_shipping_envia_colvanes_ec_payment_method, #woocommerce_shipping_envia_colvanes_ec_code_service, #woocommerce_shipping_envia_colvanes_ec_is_collection'; 7 7 8 let shipping_envia_colvanes_sandbox_fields = '#woocommerce_shipping_envia_colvanes_ec_sandbox_user, #woocommerce_shipping_envia_colvanes_ec_sandbox_password, #woocommerce_shipping_envia_colvanes_ec_sandbox_code_account, #woocommerce_shipping_envia_colvanes_ec_sandbox_payment_method, #woocommerce_shipping_envia_colvanes_ec_sandbox_code_service ';8 let shipping_envia_colvanes_sandbox_fields = '#woocommerce_shipping_envia_colvanes_ec_sandbox_user, #woocommerce_shipping_envia_colvanes_ec_sandbox_password, #woocommerce_shipping_envia_colvanes_ec_sandbox_code_account, #woocommerce_shipping_envia_colvanes_ec_sandbox_payment_method, #woocommerce_shipping_envia_colvanes_ec_sandbox_code_service, #woocommerce_shipping_envia_colvanes_ec_sandbox_is_collection'; 9 9 10 10 $( '#woocommerce_shipping_envia_colvanes_ec_environment' ).change(function(){ … … 160 160 'desc_tip' => true 161 161 ), 162 'is_collection' => array( 163 'title' => __('Activar/Desactivar'), 164 'type' => 'checkbox', 165 'label' => __('Pago con recaudo'), 166 'default' => 'no' 167 ), 162 168 'payment_method' => array( 163 169 'title' => __( 'Forma de Pago' ), … … 179 185 'description' => __( 'Es la modalidad para el manejo y transporte que se utiliza en el despacho.' ), 180 186 'desc_tip' => true, 181 'default' => '',187 'default' => 12, 182 188 'options' => array( 183 189 1 => __( 'Documento Express'), … … 204 210 'desc_tip' => true 205 211 ), 212 'sandbox_is_collection' => array( 213 'title' => __('Activar/Desactivar'), 214 'type' => 'checkbox', 215 'label' => __('Pago con recaudo'), 216 'default' => 'no' 217 ), 206 218 'sandbox_payment_method' => array( 207 219 'title' => __( 'Forma de Pago' ), -
shipping-envia-colvanes-woo/tags/4.0.26/includes/class-method-shipping-envia-colvanes-ec.php
r3082125 r3083559 12 12 */ 13 13 public $city_sender; 14 /** 15 * @var boolean 16 */ 17 public $is_collection; 14 18 /** 15 19 * @var mixed … … 89 93 $this->password = $this->get_option( 'sandbox_password' ); 90 94 $this->set_account_codes('sandbox_code_account'); 95 $this->is_collection = $this->get_option('sandbox_is_collection'); 91 96 $this->payment_method = $this->get_option('sandbox_payment_method'); 92 97 $this->code_service = $this->get_option('sandbox_code_service'); … … 95 100 $this->password = $this->get_option( 'password' ); 96 101 $this->set_account_codes('code_account'); 102 $this->is_collection = $this->get_option('is_collection'); 97 103 $this->payment_method = $this->get_option('payment_method'); 98 104 $this->code_service = $this->get_option('code_service'); … … 111 117 * Init the class settings 112 118 */ 113 public function init() 119 public function init(): void 114 120 { 115 121 // Load the settings API. … … 123 129 * Init the form fields for this shipping method 124 130 */ 125 public function init_form_fields() 131 public function init_form_fields(): void 126 132 { 127 133 $this->form_fields = include(dirname(__FILE__) . '/admin/settings.php'); 128 134 } 129 135 130 public function admin_options() 136 public function admin_options(): void 131 137 { 132 138 ?> … … 145 151 } 146 152 147 public function is_available($package) 153 public function is_available($package): bool 148 154 { 149 155 return parent::is_available($package) && … … 153 159 } 154 160 155 public function validate_text_field($key, $value) 156 { 157 158 if ($this->get_option( 'environment' ) == 0 && $key === 'code_account'){ 159 $value_actual = $value; 160 }elseif ($this->get_option( 'environment' ) == 1 && $key === 'sandbox_code_account'){ 161 $value_actual = $value; 162 } 163 164 if(isset($value_actual) && !preg_match('/^[0-9]+(-[0-9]+)+(-[0-9]+)$/', $value_actual)) 161 public function validate_text_field($key, $value): string 162 { 163 164 if (($key === 'code_account' || 165 $key === 'sandbox_code_account') && 166 !preg_match('/^[0-9]+(-[0-9]+)+(-[0-9]+)$/', $value) 167 ){ 165 168 WC_Admin_Settings::add_error("Código de cuenta require que cumpla el formato similar: 004-003-00000777"); 166 169 } 167 170 168 171 return $value; … … 249 252 'cod_regional_cta' => $this->cod_regional_cta, 250 253 'cod_oficina_cta' => $this->cod_oficina_cta, 251 'info_contenido' => [252 'valorproducto' => $data_products['cart_prods'][0]['declarado'] ?? 0253 ]254 254 ); 255 256 if($this->is_collection === 'yes'){ 257 $params['info_contenido']['valorproducto'] = $data_products['cart_prods'][0]['declarado'] ?? 0; 258 } 255 259 256 260 if ($this->debug === 'yes') -
shipping-envia-colvanes-woo/tags/4.0.26/includes/class-shipping-envia-colvanes-ec.php
r3082125 r3083559 6 6 { 7 7 8 public $enviaColvanes;8 public Client $enviaColvanes; 9 9 10 10 public function __construct($instance_id = 0) … … 18 18 } 19 19 20 public static function test_connection_liquidation() 20 public static function test_connection_liquidation(): void 21 21 { 22 22 $instance = new self(); … … 51 51 array( 52 52 'dice_contener' => '', 53 'num_documentos' => '12345-67890', 54 'valorproducto' => 50000 53 'num_documentos' => '12345-67890' 55 54 ), 56 55 'numero_guia' => '' 57 56 ); 57 58 if($instance->is_collection === 'yes'){ 59 $params['info_contenido']['valorproducto'] = 50000; 60 } 61 58 62 try { 59 63 $instance->enviaColvanes->liquidation($params); … … 64 68 } 65 69 66 public static function clean_city($city) 70 public static function clean_city($city): string 67 71 { 68 72 return $city === 'Bogota D.C' ? 'Bogota' : $city; 69 73 } 70 74 71 public static function clean_string( $string)75 public static function clean_string(string $string):string 72 76 { 73 77 $not_permitted = array("á", "é", "í", "ó", "ú", "Á", "É", "Í", … … 76 80 "U", "n"); 77 81 $text = str_replace($not_permitted, $permitted, $string); 78 $text = mb_strtolower($text); 79 return $text; 80 } 81 82 public static function get_city(string $city_destination) 82 return mb_strtolower($text); 83 } 84 85 public static function get_city(string $city_destination): string 83 86 { 84 87 $city_destination = self::clean_string($city_destination); … … 349 352 array ( 350 353 'dice_contener' => $instance->dice_contener ? $order_id : substr($namesProducts, 0, 30), 351 'num_documentos' => $order_id, 352 'valorproducto' => $data_products['cart_prods'][0]['declarado'] ?? 0 354 'num_documentos' => $order_id 353 355 ), 354 356 'numero_guia' => '' 355 357 ); 358 359 if($instance->is_collection === 'yes'){ 360 $params['info_contenido']['valorproducto'] = $data_products['cart_prods'][0]['declarado'] ?? 0; 361 } 356 362 357 363 if ($instance->debug === 'yes') -
shipping-envia-colvanes-woo/tags/4.0.26/readme.txt
r3082125 r3083559 5 5 Requires at least: 6.0 6 6 Tested up to: 6.5.2 7 Requires PHP: 7.28 Stable tag: 4.0.2 57 Requires PHP: 8.1 8 Stable tag: 4.0.26 9 9 License: GNU General Public License v3.0 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 94 94 * Added code_service fields settings 95 95 * Fixed repeat field _shipping_custom_price_product_smp in simple product 96 = 4.0.26 = 97 * Fixed pago con reacaudo 96 98 97 99 == Additional Info == -
shipping-envia-colvanes-woo/tags/4.0.26/shipping-envia-colvanes-woo.php
r3082125 r3083559 3 3 * Plugin Name: Shipping Envia Colvanes Woo 4 4 * Description: Shipping Envia Colvanes Woocommerce is available for Colombia 5 * Version: 4.0.2 55 * Version: 4.0.26 6 6 * Author: Saul Morales Pacheco 7 7 * Author URI: https://saulmoralespa.com 8 8 * License: GNU General Public License v3.0 9 9 * License URI: http://www.gnu.org/licenses/gpl-3.0.html 10 * WC tested up to: 6.0.210 * WC tested up to: 8.8.3 11 11 * WC requires at least: 4.0 12 12 * Requires Plugins: woocommerce,departamentos-y-ciudades-de-colombia-para-woocommerce … … 20 20 21 21 if(!defined('SHIPPING_ENVIA_COLVANES_EC_VERSION')){ 22 define('SHIPPING_ENVIA_COLVANES_EC_VERSION', '4.0.2 5');22 define('SHIPPING_ENVIA_COLVANES_EC_VERSION', '4.0.26'); 23 23 } 24 24 -
shipping-envia-colvanes-woo/trunk/includes/admin/settings.php
r3082125 r3083559 4 4 jQuery( function( $ ) { 5 5 6 let shipping_envia_colvanes_fields = '#woocommerce_shipping_envia_colvanes_ec_user, #woocommerce_shipping_envia_colvanes_ec_password, #woocommerce_shipping_envia_colvanes_ec_code_account, #woocommerce_shipping_envia_colvanes_ec_payment_method, #woocommerce_shipping_envia_colvanes_ec_code_service ';6 let shipping_envia_colvanes_fields = '#woocommerce_shipping_envia_colvanes_ec_user, #woocommerce_shipping_envia_colvanes_ec_password, #woocommerce_shipping_envia_colvanes_ec_code_account, #woocommerce_shipping_envia_colvanes_ec_payment_method, #woocommerce_shipping_envia_colvanes_ec_code_service, #woocommerce_shipping_envia_colvanes_ec_is_collection'; 7 7 8 let shipping_envia_colvanes_sandbox_fields = '#woocommerce_shipping_envia_colvanes_ec_sandbox_user, #woocommerce_shipping_envia_colvanes_ec_sandbox_password, #woocommerce_shipping_envia_colvanes_ec_sandbox_code_account, #woocommerce_shipping_envia_colvanes_ec_sandbox_payment_method, #woocommerce_shipping_envia_colvanes_ec_sandbox_code_service ';8 let shipping_envia_colvanes_sandbox_fields = '#woocommerce_shipping_envia_colvanes_ec_sandbox_user, #woocommerce_shipping_envia_colvanes_ec_sandbox_password, #woocommerce_shipping_envia_colvanes_ec_sandbox_code_account, #woocommerce_shipping_envia_colvanes_ec_sandbox_payment_method, #woocommerce_shipping_envia_colvanes_ec_sandbox_code_service, #woocommerce_shipping_envia_colvanes_ec_sandbox_is_collection'; 9 9 10 10 $( '#woocommerce_shipping_envia_colvanes_ec_environment' ).change(function(){ … … 160 160 'desc_tip' => true 161 161 ), 162 'is_collection' => array( 163 'title' => __('Activar/Desactivar'), 164 'type' => 'checkbox', 165 'label' => __('Pago con recaudo'), 166 'default' => 'no' 167 ), 162 168 'payment_method' => array( 163 169 'title' => __( 'Forma de Pago' ), … … 179 185 'description' => __( 'Es la modalidad para el manejo y transporte que se utiliza en el despacho.' ), 180 186 'desc_tip' => true, 181 'default' => '',187 'default' => 12, 182 188 'options' => array( 183 189 1 => __( 'Documento Express'), … … 204 210 'desc_tip' => true 205 211 ), 212 'sandbox_is_collection' => array( 213 'title' => __('Activar/Desactivar'), 214 'type' => 'checkbox', 215 'label' => __('Pago con recaudo'), 216 'default' => 'no' 217 ), 206 218 'sandbox_payment_method' => array( 207 219 'title' => __( 'Forma de Pago' ), -
shipping-envia-colvanes-woo/trunk/includes/class-method-shipping-envia-colvanes-ec.php
r3082125 r3083559 12 12 */ 13 13 public $city_sender; 14 /** 15 * @var boolean 16 */ 17 public $is_collection; 14 18 /** 15 19 * @var mixed … … 89 93 $this->password = $this->get_option( 'sandbox_password' ); 90 94 $this->set_account_codes('sandbox_code_account'); 95 $this->is_collection = $this->get_option('sandbox_is_collection'); 91 96 $this->payment_method = $this->get_option('sandbox_payment_method'); 92 97 $this->code_service = $this->get_option('sandbox_code_service'); … … 95 100 $this->password = $this->get_option( 'password' ); 96 101 $this->set_account_codes('code_account'); 102 $this->is_collection = $this->get_option('is_collection'); 97 103 $this->payment_method = $this->get_option('payment_method'); 98 104 $this->code_service = $this->get_option('code_service'); … … 111 117 * Init the class settings 112 118 */ 113 public function init() 119 public function init(): void 114 120 { 115 121 // Load the settings API. … … 123 129 * Init the form fields for this shipping method 124 130 */ 125 public function init_form_fields() 131 public function init_form_fields(): void 126 132 { 127 133 $this->form_fields = include(dirname(__FILE__) . '/admin/settings.php'); 128 134 } 129 135 130 public function admin_options() 136 public function admin_options(): void 131 137 { 132 138 ?> … … 145 151 } 146 152 147 public function is_available($package) 153 public function is_available($package): bool 148 154 { 149 155 return parent::is_available($package) && … … 153 159 } 154 160 155 public function validate_text_field($key, $value) 156 { 157 158 if ($this->get_option( 'environment' ) == 0 && $key === 'code_account'){ 159 $value_actual = $value; 160 }elseif ($this->get_option( 'environment' ) == 1 && $key === 'sandbox_code_account'){ 161 $value_actual = $value; 162 } 163 164 if(isset($value_actual) && !preg_match('/^[0-9]+(-[0-9]+)+(-[0-9]+)$/', $value_actual)) 161 public function validate_text_field($key, $value): string 162 { 163 164 if (($key === 'code_account' || 165 $key === 'sandbox_code_account') && 166 !preg_match('/^[0-9]+(-[0-9]+)+(-[0-9]+)$/', $value) 167 ){ 165 168 WC_Admin_Settings::add_error("Código de cuenta require que cumpla el formato similar: 004-003-00000777"); 166 169 } 167 170 168 171 return $value; … … 249 252 'cod_regional_cta' => $this->cod_regional_cta, 250 253 'cod_oficina_cta' => $this->cod_oficina_cta, 251 'info_contenido' => [252 'valorproducto' => $data_products['cart_prods'][0]['declarado'] ?? 0253 ]254 254 ); 255 256 if($this->is_collection === 'yes'){ 257 $params['info_contenido']['valorproducto'] = $data_products['cart_prods'][0]['declarado'] ?? 0; 258 } 255 259 256 260 if ($this->debug === 'yes') -
shipping-envia-colvanes-woo/trunk/includes/class-shipping-envia-colvanes-ec.php
r3082125 r3083559 6 6 { 7 7 8 public $enviaColvanes;8 public Client $enviaColvanes; 9 9 10 10 public function __construct($instance_id = 0) … … 18 18 } 19 19 20 public static function test_connection_liquidation() 20 public static function test_connection_liquidation(): void 21 21 { 22 22 $instance = new self(); … … 51 51 array( 52 52 'dice_contener' => '', 53 'num_documentos' => '12345-67890', 54 'valorproducto' => 50000 53 'num_documentos' => '12345-67890' 55 54 ), 56 55 'numero_guia' => '' 57 56 ); 57 58 if($instance->is_collection === 'yes'){ 59 $params['info_contenido']['valorproducto'] = 50000; 60 } 61 58 62 try { 59 63 $instance->enviaColvanes->liquidation($params); … … 64 68 } 65 69 66 public static function clean_city($city) 70 public static function clean_city($city): string 67 71 { 68 72 return $city === 'Bogota D.C' ? 'Bogota' : $city; 69 73 } 70 74 71 public static function clean_string( $string)75 public static function clean_string(string $string):string 72 76 { 73 77 $not_permitted = array("á", "é", "í", "ó", "ú", "Á", "É", "Í", … … 76 80 "U", "n"); 77 81 $text = str_replace($not_permitted, $permitted, $string); 78 $text = mb_strtolower($text); 79 return $text; 80 } 81 82 public static function get_city(string $city_destination) 82 return mb_strtolower($text); 83 } 84 85 public static function get_city(string $city_destination): string 83 86 { 84 87 $city_destination = self::clean_string($city_destination); … … 349 352 array ( 350 353 'dice_contener' => $instance->dice_contener ? $order_id : substr($namesProducts, 0, 30), 351 'num_documentos' => $order_id, 352 'valorproducto' => $data_products['cart_prods'][0]['declarado'] ?? 0 354 'num_documentos' => $order_id 353 355 ), 354 356 'numero_guia' => '' 355 357 ); 358 359 if($instance->is_collection === 'yes'){ 360 $params['info_contenido']['valorproducto'] = $data_products['cart_prods'][0]['declarado'] ?? 0; 361 } 356 362 357 363 if ($instance->debug === 'yes') -
shipping-envia-colvanes-woo/trunk/readme.txt
r3082125 r3083559 5 5 Requires at least: 6.0 6 6 Tested up to: 6.5.2 7 Requires PHP: 7.28 Stable tag: 4.0.2 57 Requires PHP: 8.1 8 Stable tag: 4.0.26 9 9 License: GNU General Public License v3.0 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 94 94 * Added code_service fields settings 95 95 * Fixed repeat field _shipping_custom_price_product_smp in simple product 96 = 4.0.26 = 97 * Fixed pago con reacaudo 96 98 97 99 == Additional Info == -
shipping-envia-colvanes-woo/trunk/shipping-envia-colvanes-woo.php
r3082125 r3083559 3 3 * Plugin Name: Shipping Envia Colvanes Woo 4 4 * Description: Shipping Envia Colvanes Woocommerce is available for Colombia 5 * Version: 4.0.2 55 * Version: 4.0.26 6 6 * Author: Saul Morales Pacheco 7 7 * Author URI: https://saulmoralespa.com 8 8 * License: GNU General Public License v3.0 9 9 * License URI: http://www.gnu.org/licenses/gpl-3.0.html 10 * WC tested up to: 6.0.210 * WC tested up to: 8.8.3 11 11 * WC requires at least: 4.0 12 12 * Requires Plugins: woocommerce,departamentos-y-ciudades-de-colombia-para-woocommerce … … 20 20 21 21 if(!defined('SHIPPING_ENVIA_COLVANES_EC_VERSION')){ 22 define('SHIPPING_ENVIA_COLVANES_EC_VERSION', '4.0.2 5');22 define('SHIPPING_ENVIA_COLVANES_EC_VERSION', '4.0.26'); 23 23 } 24 24
Note: See TracChangeset
for help on using the changeset viewer.