Plugin Directory

Changeset 3083559


Ignore:
Timestamp:
05/08/2024 08:33:32 PM (22 months ago)
Author:
saulmorales
Message:

tagging version 4.0.26

Location:
shipping-envia-colvanes-woo
Files:
5 edited
7 copied

Legend:

Unmodified
Added
Removed
  • shipping-envia-colvanes-woo/tags/4.0.26/includes/admin/settings.php

    r3082125 r3083559  
    44    jQuery( function( $ ) {
    55   
    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';
    77   
    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';
    99
    1010    $( '#woocommerce_shipping_envia_colvanes_ec_environment' ).change(function(){
     
    160160                'desc_tip' => true
    161161            ),
     162            'is_collection' => array(
     163                'title' => __('Activar/Desactivar'),
     164                'type' => 'checkbox',
     165                'label' => __('Pago con recaudo'),
     166                'default' => 'no'
     167            ),
    162168            'payment_method' => array(
    163169                'title' => __( 'Forma de Pago' ),
     
    179185                'description' => __( 'Es la modalidad para el manejo y transporte que se utiliza en el despacho.' ),
    180186                'desc_tip' => true,
    181                 'default' => '',
     187                'default' => 12,
    182188                'options' => array(
    183189                    1    => __( 'Documento Express'),
     
    204210                'desc_tip' => true
    205211            ),
     212            'sandbox_is_collection' => array(
     213                'title' => __('Activar/Desactivar'),
     214                'type' => 'checkbox',
     215                'label' => __('Pago con recaudo'),
     216                'default' => 'no'
     217            ),
    206218            'sandbox_payment_method' => array(
    207219                'title' => __( 'Forma de Pago' ),
  • shipping-envia-colvanes-woo/tags/4.0.26/includes/class-method-shipping-envia-colvanes-ec.php

    r3082125 r3083559  
    1212     */
    1313    public $city_sender;
     14    /**
     15     * @var boolean
     16     */
     17    public $is_collection;
    1418    /**
    1519     * @var mixed
     
    8993            $this->password = $this->get_option( 'sandbox_password' );
    9094            $this->set_account_codes('sandbox_code_account');
     95            $this->is_collection = $this->get_option('sandbox_is_collection');
    9196            $this->payment_method = $this->get_option('sandbox_payment_method');
    9297            $this->code_service = $this->get_option('sandbox_code_service');
     
    95100            $this->password = $this->get_option( 'password' );
    96101            $this->set_account_codes('code_account');
     102            $this->is_collection = $this->get_option('is_collection');
    97103            $this->payment_method = $this->get_option('payment_method');
    98104            $this->code_service = $this->get_option('code_service');
     
    111117     * Init the class settings
    112118     */
    113     public function init()
     119    public function init(): void
    114120    {
    115121        // Load the settings API.
     
    123129     * Init the form fields for this shipping method
    124130     */
    125     public function init_form_fields()
     131    public function init_form_fields(): void
    126132    {
    127133        $this->form_fields = include(dirname(__FILE__) . '/admin/settings.php');
    128134    }
    129135
    130     public function admin_options()
     136    public function admin_options(): void
    131137    {
    132138        ?>
     
    145151    }
    146152
    147     public function is_available($package)
     153    public function is_available($package): bool
    148154    {
    149155        return parent::is_available($package) &&
     
    153159    }
    154160
    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        ){
    165168            WC_Admin_Settings::add_error("Código de cuenta require que cumpla el formato similar: 004-003-00000777");
    166 
     169        }
    167170
    168171        return $value;
     
    249252            'cod_regional_cta' => $this->cod_regional_cta,
    250253            'cod_oficina_cta' => $this->cod_oficina_cta,
    251             'info_contenido' => [
    252                 'valorproducto' => $data_products['cart_prods'][0]['declarado'] ?? 0
    253             ]
    254254        );
     255
     256        if($this->is_collection === 'yes'){
     257            $params['info_contenido']['valorproducto'] = $data_products['cart_prods'][0]['declarado'] ?? 0;
     258        }
    255259
    256260        if ($this->debug === 'yes')
  • shipping-envia-colvanes-woo/tags/4.0.26/includes/class-shipping-envia-colvanes-ec.php

    r3082125 r3083559  
    66{
    77
    8     public $enviaColvanes;
     8    public Client $enviaColvanes;
    99
    1010    public function __construct($instance_id = 0)
     
    1818    }
    1919
    20     public static function test_connection_liquidation()
     20    public static function test_connection_liquidation(): void
    2121    {
    2222        $instance = new self();
     
    5151                array(
    5252                    'dice_contener' => '',
    53                     'num_documentos' => '12345-67890',
    54                     'valorproducto' => 50000
     53                    'num_documentos' => '12345-67890'
    5554                ),
    5655            'numero_guia' => ''
    5756        );
     57
     58        if($instance->is_collection === 'yes'){
     59            $params['info_contenido']['valorproducto'] = 50000;
     60        }
     61
    5862        try {
    5963            $instance->enviaColvanes->liquidation($params);
     
    6468    }
    6569
    66     public static function clean_city($city)
     70    public static function clean_city($city): string
    6771    {
    6872        return $city === 'Bogota D.C' ? 'Bogota' : $city;
    6973    }
    7074
    71     public static function clean_string($string)
     75    public static function clean_string(string $string):string
    7276    {
    7377        $not_permitted = array("á", "é", "í", "ó", "ú", "Á", "É", "Í",
     
    7680            "U", "n");
    7781        $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
    8386    {
    8487        $city_destination = self::clean_string($city_destination);
     
    349352                array (
    350353                    '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
    353355                ),
    354356            'numero_guia' => ''
    355357        );
     358
     359        if($instance->is_collection === 'yes'){
     360            $params['info_contenido']['valorproducto'] = $data_products['cart_prods'][0]['declarado'] ?? 0;
     361        }
    356362
    357363        if ($instance->debug === 'yes')
  • shipping-envia-colvanes-woo/tags/4.0.26/readme.txt

    r3082125 r3083559  
    55Requires at least: 6.0
    66Tested up to: 6.5.2
    7 Requires PHP: 7.2
    8 Stable tag: 4.0.25
     7Requires PHP: 8.1
     8Stable tag: 4.0.26
    99License: GNU General Public License v3.0
    1010License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    9494* Added code_service fields settings
    9595* Fixed repeat field _shipping_custom_price_product_smp in simple product
     96= 4.0.26 =
     97* Fixed pago con reacaudo
    9698
    9799== Additional Info ==
  • shipping-envia-colvanes-woo/tags/4.0.26/shipping-envia-colvanes-woo.php

    r3082125 r3083559  
    33 * Plugin Name: Shipping Envia Colvanes Woo
    44 * Description: Shipping Envia Colvanes Woocommerce is available for Colombia
    5  * Version: 4.0.25
     5 * Version: 4.0.26
    66 * Author: Saul Morales Pacheco
    77 * Author URI: https://saulmoralespa.com
    88 * License: GNU General Public License v3.0
    99 * License URI: http://www.gnu.org/licenses/gpl-3.0.html
    10  * WC tested up to: 6.0.2
     10 * WC tested up to: 8.8.3
    1111 * WC requires at least: 4.0
    1212 * Requires Plugins: woocommerce,departamentos-y-ciudades-de-colombia-para-woocommerce
     
    2020
    2121if(!defined('SHIPPING_ENVIA_COLVANES_EC_VERSION')){
    22     define('SHIPPING_ENVIA_COLVANES_EC_VERSION', '4.0.25');
     22    define('SHIPPING_ENVIA_COLVANES_EC_VERSION', '4.0.26');
    2323}
    2424
  • shipping-envia-colvanes-woo/trunk/includes/admin/settings.php

    r3082125 r3083559  
    44    jQuery( function( $ ) {
    55   
    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';
    77   
    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';
    99
    1010    $( '#woocommerce_shipping_envia_colvanes_ec_environment' ).change(function(){
     
    160160                'desc_tip' => true
    161161            ),
     162            'is_collection' => array(
     163                'title' => __('Activar/Desactivar'),
     164                'type' => 'checkbox',
     165                'label' => __('Pago con recaudo'),
     166                'default' => 'no'
     167            ),
    162168            'payment_method' => array(
    163169                'title' => __( 'Forma de Pago' ),
     
    179185                'description' => __( 'Es la modalidad para el manejo y transporte que se utiliza en el despacho.' ),
    180186                'desc_tip' => true,
    181                 'default' => '',
     187                'default' => 12,
    182188                'options' => array(
    183189                    1    => __( 'Documento Express'),
     
    204210                'desc_tip' => true
    205211            ),
     212            'sandbox_is_collection' => array(
     213                'title' => __('Activar/Desactivar'),
     214                'type' => 'checkbox',
     215                'label' => __('Pago con recaudo'),
     216                'default' => 'no'
     217            ),
    206218            'sandbox_payment_method' => array(
    207219                'title' => __( 'Forma de Pago' ),
  • shipping-envia-colvanes-woo/trunk/includes/class-method-shipping-envia-colvanes-ec.php

    r3082125 r3083559  
    1212     */
    1313    public $city_sender;
     14    /**
     15     * @var boolean
     16     */
     17    public $is_collection;
    1418    /**
    1519     * @var mixed
     
    8993            $this->password = $this->get_option( 'sandbox_password' );
    9094            $this->set_account_codes('sandbox_code_account');
     95            $this->is_collection = $this->get_option('sandbox_is_collection');
    9196            $this->payment_method = $this->get_option('sandbox_payment_method');
    9297            $this->code_service = $this->get_option('sandbox_code_service');
     
    95100            $this->password = $this->get_option( 'password' );
    96101            $this->set_account_codes('code_account');
     102            $this->is_collection = $this->get_option('is_collection');
    97103            $this->payment_method = $this->get_option('payment_method');
    98104            $this->code_service = $this->get_option('code_service');
     
    111117     * Init the class settings
    112118     */
    113     public function init()
     119    public function init(): void
    114120    {
    115121        // Load the settings API.
     
    123129     * Init the form fields for this shipping method
    124130     */
    125     public function init_form_fields()
     131    public function init_form_fields(): void
    126132    {
    127133        $this->form_fields = include(dirname(__FILE__) . '/admin/settings.php');
    128134    }
    129135
    130     public function admin_options()
     136    public function admin_options(): void
    131137    {
    132138        ?>
     
    145151    }
    146152
    147     public function is_available($package)
     153    public function is_available($package): bool
    148154    {
    149155        return parent::is_available($package) &&
     
    153159    }
    154160
    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        ){
    165168            WC_Admin_Settings::add_error("Código de cuenta require que cumpla el formato similar: 004-003-00000777");
    166 
     169        }
    167170
    168171        return $value;
     
    249252            'cod_regional_cta' => $this->cod_regional_cta,
    250253            'cod_oficina_cta' => $this->cod_oficina_cta,
    251             'info_contenido' => [
    252                 'valorproducto' => $data_products['cart_prods'][0]['declarado'] ?? 0
    253             ]
    254254        );
     255
     256        if($this->is_collection === 'yes'){
     257            $params['info_contenido']['valorproducto'] = $data_products['cart_prods'][0]['declarado'] ?? 0;
     258        }
    255259
    256260        if ($this->debug === 'yes')
  • shipping-envia-colvanes-woo/trunk/includes/class-shipping-envia-colvanes-ec.php

    r3082125 r3083559  
    66{
    77
    8     public $enviaColvanes;
     8    public Client $enviaColvanes;
    99
    1010    public function __construct($instance_id = 0)
     
    1818    }
    1919
    20     public static function test_connection_liquidation()
     20    public static function test_connection_liquidation(): void
    2121    {
    2222        $instance = new self();
     
    5151                array(
    5252                    'dice_contener' => '',
    53                     'num_documentos' => '12345-67890',
    54                     'valorproducto' => 50000
     53                    'num_documentos' => '12345-67890'
    5554                ),
    5655            'numero_guia' => ''
    5756        );
     57
     58        if($instance->is_collection === 'yes'){
     59            $params['info_contenido']['valorproducto'] = 50000;
     60        }
     61
    5862        try {
    5963            $instance->enviaColvanes->liquidation($params);
     
    6468    }
    6569
    66     public static function clean_city($city)
     70    public static function clean_city($city): string
    6771    {
    6872        return $city === 'Bogota D.C' ? 'Bogota' : $city;
    6973    }
    7074
    71     public static function clean_string($string)
     75    public static function clean_string(string $string):string
    7276    {
    7377        $not_permitted = array("á", "é", "í", "ó", "ú", "Á", "É", "Í",
     
    7680            "U", "n");
    7781        $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
    8386    {
    8487        $city_destination = self::clean_string($city_destination);
     
    349352                array (
    350353                    '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
    353355                ),
    354356            'numero_guia' => ''
    355357        );
     358
     359        if($instance->is_collection === 'yes'){
     360            $params['info_contenido']['valorproducto'] = $data_products['cart_prods'][0]['declarado'] ?? 0;
     361        }
    356362
    357363        if ($instance->debug === 'yes')
  • shipping-envia-colvanes-woo/trunk/readme.txt

    r3082125 r3083559  
    55Requires at least: 6.0
    66Tested up to: 6.5.2
    7 Requires PHP: 7.2
    8 Stable tag: 4.0.25
     7Requires PHP: 8.1
     8Stable tag: 4.0.26
    99License: GNU General Public License v3.0
    1010License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    9494* Added code_service fields settings
    9595* Fixed repeat field _shipping_custom_price_product_smp in simple product
     96= 4.0.26 =
     97* Fixed pago con reacaudo
    9698
    9799== Additional Info ==
  • shipping-envia-colvanes-woo/trunk/shipping-envia-colvanes-woo.php

    r3082125 r3083559  
    33 * Plugin Name: Shipping Envia Colvanes Woo
    44 * Description: Shipping Envia Colvanes Woocommerce is available for Colombia
    5  * Version: 4.0.25
     5 * Version: 4.0.26
    66 * Author: Saul Morales Pacheco
    77 * Author URI: https://saulmoralespa.com
    88 * License: GNU General Public License v3.0
    99 * License URI: http://www.gnu.org/licenses/gpl-3.0.html
    10  * WC tested up to: 6.0.2
     10 * WC tested up to: 8.8.3
    1111 * WC requires at least: 4.0
    1212 * Requires Plugins: woocommerce,departamentos-y-ciudades-de-colombia-para-woocommerce
     
    2020
    2121if(!defined('SHIPPING_ENVIA_COLVANES_EC_VERSION')){
    22     define('SHIPPING_ENVIA_COLVANES_EC_VERSION', '4.0.25');
     22    define('SHIPPING_ENVIA_COLVANES_EC_VERSION', '4.0.26');
    2323}
    2424
Note: See TracChangeset for help on using the changeset viewer.