Plugin Directory

Changeset 3488363


Ignore:
Timestamp:
03/22/2026 06:40:45 PM (10 days ago)
Author:
evcode
Message:

Update to version 1.6.2 from GitHub

Location:
myd-delivery
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • myd-delivery/tags/1.6.2/README.txt

    r3488360 r3488363  
    55Requires at least: 5.5
    66Tested up to: 6.9
    7 Stable tag: 1.6.1
     7Stable tag: 1.6.2
    88Requires PHP: 7.4
    99License: GPL-3.0+
     
    7575
    7676== Changelog ==
     77
     78= 1.6.2 =
     79* Changed: code improvements in shipping method per cep range.
    7780
    7881= 1.6.1 =
  • myd-delivery/tags/1.6.2/includes/class-create-draft-order.php

    r3487445 r3488363  
    193193        }
    194194
    195         $this->calculate_total();
     195        $result = $this->calculate_total();
     196        if ( \is_wp_error( $result ) ) {
     197            return $result;
     198        }
    196199
    197200        $order_items = array();
     
    240243    /**
    241244     * Calculate order total
    242      */
    243     private function calculate_total(): void {
     245     *
     246     * @return \WP_Error|void
     247     */
     248    private function calculate_total() {
    244249        $this->subtotal = $this->cart->total;
    245250        $shipping_price = (float) ( $this->shipping['price'] ?? 0 );
    246251
     252        $shipping_data            = $this->shipping;
     253        $shipping_data['zipcode'] = $this->customer['address']['zipcode'] ?? '';
     254
    247255        $validated_shipping = Price_Calculator::validate_shipping_price(
    248256            $shipping_price,
    249             $this->shipping
     257            $shipping_data
    250258        );
    251259        if ( $validated_shipping === false ) {
     260            if ( $this->type === 'delivery' ) {
     261                return new \WP_Error( 'invalid_shipping', __( 'Invalid delivery price. Please try again.', 'myd-delivery' ) );
     262            }
    252263            $validated_shipping = 0.0;
    253264        }
  • myd-delivery/tags/1.6.2/includes/class-price-calculator.php

    r3488360 r3488363  
    137137        $options = get_option( 'myddelivery-operation-mode-options' );
    138138
    139         if ( ! isset( $options[ $method ] ) ) {
     139        if ( ! is_array( $options ) || ! isset( $options[ $method ] ) ) {
    140140            return 0.0;
    141141        }
     
    165165            case 'per-cep':
    166166                $ranges  = $config['options'] ?? $config;
    167                 $zipcode = (int) ( $shipping_data['zipcode'] ?? 0 );
     167                $zipcode = (int) preg_replace( '/\D/', '', $shipping_data['zipcode'] ?? '' );
    168168                foreach ( $ranges as $range ) {
    169169                    $from = (int) ( $range['from'] ?? 0 );
  • myd-delivery/tags/1.6.2/includes/class-store-data.php

    r3478512 r3488363  
    7676        }
    7777
    78         if ( array_key_exists( $data, self::$store_data ) ) {
    79             return self::$store_data[ $data ];
    80         }
     78        return self::$store_data[ $data ] ?? null;
    8179    }
    8280}
  • myd-delivery/tags/1.6.2/myd-delivery.php

    r3488360 r3488363  
    66 * Author: EduardoVillao.me
    77 * Author URI: https://eduardovillao.me/
    8  * Version: 1.6.1
     8 * Version: 1.6.2
    99 * Requires PHP: 7.4
    1010 * Requires at least: 5.5
     
    2626define( 'MYDDELIVERY_BASENAME', plugin_basename( __FILE__ ) );
    2727define( 'MYDDELIVERY_DIRNAME', plugin_basename( __DIR__ ) );
    28 define( 'MYDDELIVERY_VERSION', '1.6.1' );
     28define( 'MYDDELIVERY_VERSION', '1.6.2' );
    2929define( 'MYDDELIVERY_MIN_PHP_VERSION', '7.4' );
    3030define( 'MYDDELIVERY_MIN_WP_VERSION', '5.5' );
  • myd-delivery/tags/1.6.2/vendor/composer/installed.php

    r3488360 r3488363  
    22    'root' => array(
    33        'name' => 'eduardovillao/myd-delivery',
    4         'pretty_version' => 'v1.6.1',
    5         'version' => '1.6.1.0',
    6         'reference' => '5cdf7b4df0a190c74d2c87596790542fc26f04ac',
     4        'pretty_version' => 'v1.6.2',
     5        'version' => '1.6.2.0',
     6        'reference' => 'f5b72be95efee9f39493d4beed49bde6970c5ea2',
    77        'type' => 'project',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        'eduardovillao/myd-delivery' => array(
    14             'pretty_version' => 'v1.6.1',
    15             'version' => '1.6.1.0',
    16             'reference' => '5cdf7b4df0a190c74d2c87596790542fc26f04ac',
     14            'pretty_version' => 'v1.6.2',
     15            'version' => '1.6.2.0',
     16            'reference' => 'f5b72be95efee9f39493d4beed49bde6970c5ea2',
    1717            'type' => 'project',
    1818            'install_path' => __DIR__ . '/../../',
  • myd-delivery/trunk/README.txt

    r3488360 r3488363  
    55Requires at least: 5.5
    66Tested up to: 6.9
    7 Stable tag: 1.6.1
     7Stable tag: 1.6.2
    88Requires PHP: 7.4
    99License: GPL-3.0+
     
    7575
    7676== Changelog ==
     77
     78= 1.6.2 =
     79* Changed: code improvements in shipping method per cep range.
    7780
    7881= 1.6.1 =
  • myd-delivery/trunk/includes/class-create-draft-order.php

    r3487445 r3488363  
    193193        }
    194194
    195         $this->calculate_total();
     195        $result = $this->calculate_total();
     196        if ( \is_wp_error( $result ) ) {
     197            return $result;
     198        }
    196199
    197200        $order_items = array();
     
    240243    /**
    241244     * Calculate order total
    242      */
    243     private function calculate_total(): void {
     245     *
     246     * @return \WP_Error|void
     247     */
     248    private function calculate_total() {
    244249        $this->subtotal = $this->cart->total;
    245250        $shipping_price = (float) ( $this->shipping['price'] ?? 0 );
    246251
     252        $shipping_data            = $this->shipping;
     253        $shipping_data['zipcode'] = $this->customer['address']['zipcode'] ?? '';
     254
    247255        $validated_shipping = Price_Calculator::validate_shipping_price(
    248256            $shipping_price,
    249             $this->shipping
     257            $shipping_data
    250258        );
    251259        if ( $validated_shipping === false ) {
     260            if ( $this->type === 'delivery' ) {
     261                return new \WP_Error( 'invalid_shipping', __( 'Invalid delivery price. Please try again.', 'myd-delivery' ) );
     262            }
    252263            $validated_shipping = 0.0;
    253264        }
  • myd-delivery/trunk/includes/class-price-calculator.php

    r3488360 r3488363  
    137137        $options = get_option( 'myddelivery-operation-mode-options' );
    138138
    139         if ( ! isset( $options[ $method ] ) ) {
     139        if ( ! is_array( $options ) || ! isset( $options[ $method ] ) ) {
    140140            return 0.0;
    141141        }
     
    165165            case 'per-cep':
    166166                $ranges  = $config['options'] ?? $config;
    167                 $zipcode = (int) ( $shipping_data['zipcode'] ?? 0 );
     167                $zipcode = (int) preg_replace( '/\D/', '', $shipping_data['zipcode'] ?? '' );
    168168                foreach ( $ranges as $range ) {
    169169                    $from = (int) ( $range['from'] ?? 0 );
  • myd-delivery/trunk/includes/class-store-data.php

    r3478512 r3488363  
    7676        }
    7777
    78         if ( array_key_exists( $data, self::$store_data ) ) {
    79             return self::$store_data[ $data ];
    80         }
     78        return self::$store_data[ $data ] ?? null;
    8179    }
    8280}
  • myd-delivery/trunk/myd-delivery.php

    r3488360 r3488363  
    66 * Author: EduardoVillao.me
    77 * Author URI: https://eduardovillao.me/
    8  * Version: 1.6.1
     8 * Version: 1.6.2
    99 * Requires PHP: 7.4
    1010 * Requires at least: 5.5
     
    2626define( 'MYDDELIVERY_BASENAME', plugin_basename( __FILE__ ) );
    2727define( 'MYDDELIVERY_DIRNAME', plugin_basename( __DIR__ ) );
    28 define( 'MYDDELIVERY_VERSION', '1.6.1' );
     28define( 'MYDDELIVERY_VERSION', '1.6.2' );
    2929define( 'MYDDELIVERY_MIN_PHP_VERSION', '7.4' );
    3030define( 'MYDDELIVERY_MIN_WP_VERSION', '5.5' );
  • myd-delivery/trunk/vendor/composer/installed.php

    r3488360 r3488363  
    22    'root' => array(
    33        'name' => 'eduardovillao/myd-delivery',
    4         'pretty_version' => 'v1.6.1',
    5         'version' => '1.6.1.0',
    6         'reference' => '5cdf7b4df0a190c74d2c87596790542fc26f04ac',
     4        'pretty_version' => 'v1.6.2',
     5        'version' => '1.6.2.0',
     6        'reference' => 'f5b72be95efee9f39493d4beed49bde6970c5ea2',
    77        'type' => 'project',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        'eduardovillao/myd-delivery' => array(
    14             'pretty_version' => 'v1.6.1',
    15             'version' => '1.6.1.0',
    16             'reference' => '5cdf7b4df0a190c74d2c87596790542fc26f04ac',
     14            'pretty_version' => 'v1.6.2',
     15            'version' => '1.6.2.0',
     16            'reference' => 'f5b72be95efee9f39493d4beed49bde6970c5ea2',
    1717            'type' => 'project',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.