Plugin Directory

Changeset 3454426


Ignore:
Timestamp:
02/05/2026 09:44:48 AM (5 weeks ago)
Author:
packlink
Message:

Release of version 3.6.4

Location:
packlink-pro-shipping
Files:
1053 added
22 edited

Legend:

Unmodified
Added
Removed
  • packlink-pro-shipping/trunk/Components/class-bootstrap-component.php

    r3379500 r3454426  
    2929use Packlink\BusinessLogic\FileResolver\FileResolverService;
    3030use Packlink\BusinessLogic\Order\Interfaces\ShopOrderService;
     31use Packlink\BusinessLogic\Order\OrderService;
    3132use Packlink\BusinessLogic\OrderShipmentDetails\Models\OrderShipmentDetails;
    3233use Packlink\BusinessLogic\Registration\RegistrationInfoService;
     
    3536use Packlink\BusinessLogic\ShipmentDraft\ShipmentDraftService;
    3637use Packlink\WooCommerce\Components\Services\Offline_Payments_Service;
     38use Packlink\WooCommerce\Components\Services\Order_Service;
    3739use Packlink\WooCommerce\Components\Services\Shipment_Draft_Service;
    3840use Packlink\BusinessLogic\ShippingMethod\Interfaces\ShopShippingMethodService;
     
    6264    protected static function initServices() {
    6365        parent::initServices();
     66
     67        ServiceRegister::registerService(
     68            OrderService::CLASS_NAME,
     69            function () {
     70                return Order_Service::getInstance();
     71            }
     72        );
    6473
    6574        ServiceRegister::registerService(
  • packlink-pro-shipping/trunk/Controllers/class-packlink-base-controller.php

    r3332993 r3454426  
    2525     */
    2626    protected $is_internal = true;
     27
     28    /**
     29     * Defines actions that shop manager is allowed to do
     30     */
     31    protected static $SHOP_MANAGER_ALLOWED_ACTIONS = array(
     32        'create_draft',
     33        'is_manual_sync_enabled',
     34        'get_draft_status'
     35    );
    2736
    2837    /**
     
    5665    protected function validate_internal_call() {
    5766        $logged_user_id = get_current_user_id();
    58         if ( empty( $logged_user_id ) || ! current_user_can('administrator') ) {
     67        $current_action = $this->get_param('action') ? $this->get_param('action') : '';
     68
     69        if ( empty( $logged_user_id ) ||
     70             ! current_user_can('administrator') &&
     71             ! (current_user_can('manage_woocommerce') &&
     72                in_array($current_action, self::$SHOP_MANAGER_ALLOWED_ACTIONS))) {
     73
    5974            status_header( 401 );
    6075            nocache_headers();
  • packlink-pro-shipping/trunk/Controllers/class-packlink-order-overview-controller.php

    r3332993 r3454426  
    5050
    5151    /**
     52     * Request-level cache for shipment details by order id.
     53     *
     54     * @var array
     55     */
     56    private $order_shipment_details_cache = array();
     57
     58    /**
    5259     * Adds Packlink column for printing label.
    5360     *
     
    94101     */
    95102    public function populate_packlink_column( $column, $data ) {
    96         $id = class_exists( OrderUtil::class ) && OrderUtil::custom_orders_table_usage_is_enabled() ?
    97             $data->get_id() : $data;
    98 
    99         $shipment_details = $this->get_order_shipment_details_service()->getDetailsByOrderId( (string) $id );
    100 
    101         if ( null !== $shipment_details ) {
    102             if ( static::COLUMN_ID === $column ) {
    103                 /** @var OrderService $order_service */
    104                 $order_service = ServiceRegister::getService( OrderService::CLASS_NAME );
    105                 $labels        = $shipment_details->getShipmentLabels();
    106 
    107                 if ( ! $order_service->isReadyToFetchShipmentLabels( $shipment_details->getShippingStatus() ) ) {
    108                     echo esc_html( __( 'Label is not yet available.', 'packlink-pro-shipping' ) );
    109                 } else {
    110                     $is_printed = false;
    111 
    112                     if ( empty( $labels ) ) {
    113                         $params = array(
    114                             'order_id' => $id,
    115                         );
    116 
    117                         $label_url = Shop_Helper::get_controller_url( 'Order_Overview', 'print_single_label', $params );
    118                     } else {
    119                         if ( $labels[0]->isPrinted() ) {
    120                             $is_printed = true;
    121                         }
    122 
    123                         $label_url = $labels[0]->getLink();
    124                     }
    125 
    126                     $class = 'pl-print-label button ' . ( $is_printed ? '' : 'button-primary' );
    127                     $label = $is_printed
    128                         ? __( 'Printed label', 'packlink-pro-shipping' )
    129                         : __( 'Print label', 'packlink-pro-shipping' );
    130 
    131                     echo '<button data-pl-id="' . esc_attr( $id ) . '" data-pl-label="' . esc_url( $label_url )
    132                          . '" type="button" class="' . esc_attr( $class ) . '" >' . esc_html( $label ) . '</button>';
    133                 }
    134             }
    135         }
    136 
    137         if (
    138             static::COLUMN_PACKLINK_ID === $column &&
    139             ! empty( $this->get_config_service()->getAuthorizationToken() )
    140         ) {
    141             global $post;
    142             $post_data = class_exists( OrderUtil::class ) && OrderUtil::custom_orders_table_usage_is_enabled() ?
    143                 $data : $post;
    144 
    145             echo $this->get_packlink_shipping_button( $post_data );
    146         }
     103
     104        if ( static::COLUMN_ID !== $column && static::COLUMN_PACKLINK_ID !== $column ) {
     105            return;
     106        }
     107
     108        $order_id = $this->resolve_order_id( $data );
     109
     110        if ( static::COLUMN_ID === $column ) {
     111            echo $this->render_label_column( $order_id );
     112
     113            return;
     114        }
     115
     116        echo $this->render_packlink_column( $data );
     117    }
     118
     119    /**
     120     * Resolves the order ID for both HPOS and legacy storage.
     121     *
     122     * @param mixed $data Order data.
     123     *
     124     * @return mixed
     125     */
     126    private function resolve_order_id( $data ) {
     127        if ( class_exists( OrderUtil::class ) && OrderUtil::custom_orders_table_usage_is_enabled() ) {
     128            return $data->get_id();
     129        }
     130
     131        return $data;
     132    }
     133
     134    /**
     135     * Resolves the order object for both HPOS and legacy storage.
     136     *
     137     * @param mixed $data Order data.
     138     *
     139     * @return mixed
     140     */
     141    private function resolve_order_object( $data ) {
     142        if ( class_exists( OrderUtil::class ) && OrderUtil::custom_orders_table_usage_is_enabled() ) {
     143            return $data;
     144        }
     145
     146        global $post;
     147
     148        return $post;
     149    }
     150
     151    /**
     152     * Renders Packlink label column contents for a single order.
     153     *
     154     * @param mixed $order_id Order ID.
     155     *
     156     * @return string
     157     *
     158     * @throws QueryFilterInvalidParamException When invalid filter parameters are set.
     159     */
     160    private function render_label_column( $order_id ) {
     161        $shipment_details = $this->get_order_shipment_details( (string) $order_id );
     162
     163        if ( null === $shipment_details ) {
     164            return '';
     165        }
     166
     167        /** @var OrderService $order_service */
     168        $order_service = ServiceRegister::getService( OrderService::CLASS_NAME );
     169        $labels        = $shipment_details->getShipmentLabels();
     170
     171        if ( ! $order_service->isReadyToFetchShipmentLabels( $shipment_details->getShippingStatus() ) ) {
     172            return esc_html( __( 'Label is not yet available.', 'packlink-pro-shipping' ) );
     173        }
     174
     175        $is_printed = false;
     176
     177        $params    = array( 'order_id' => $order_id );
     178        $label_url = Shop_Helper::get_controller_url( 'Order_Overview', 'print_single_label', $params );
     179
     180        if ( ! empty( $labels ) ) {
     181            $is_printed = $labels[0]->isPrinted();
     182            $label_url  = $labels[0]->getLink();
     183        }
     184
     185        $class = 'pl-print-label button ' . ( $is_printed ? '' : 'button-primary' );
     186        $label = $is_printed
     187            ? __( 'Printed label', 'packlink-pro-shipping' )
     188            : __( 'Print label', 'packlink-pro-shipping' );
     189
     190        return '<button data-pl-id="' . esc_attr( $order_id ) . '" data-pl-label="' . esc_url( $label_url )
     191               . '" type="button" class="' . esc_attr( $class ) . '" >' . esc_html( $label ) . '</button>';
     192    }
     193
     194    /**
     195     * Renders Packlink shipping column contents for a single order.
     196     *
     197     * @param mixed $data Order data.
     198     *
     199     * @return string
     200     */
     201    private function render_packlink_column( $data ) {
     202        if ( empty( $this->get_config_service()->getAuthorizationToken() ) ) {
     203            return '';
     204        }
     205
     206        $order_data = $this->resolve_order_object( $data );
     207
     208        if ( empty( $order_data ) ) {
     209            return '';
     210        }
     211
     212        return $this->get_packlink_shipping_button( $order_data );
    147213    }
    148214
     
    161227     */
    162228    public function get_draft_status() {
    163         $this->validate( 'no', true );
     229        $this->validate_admin_or_manager('no');
    164230
    165231        $order_id = ! empty( $_GET['order_id'] ) ? $_GET['order_id'] : null;
     
    307373     */
    308374    protected function get_packlink_shipping_button( $post ) {
    309         $orderId = (string) (($post instanceof \WP_Post) ? $post->ID : $post->get_id());
     375        $orderId          = (string) ( ( $post instanceof \WP_Post ) ? $post->ID : $post->get_id() );
    310376        $src              = Shop_Helper::get_plugin_base_url() . 'resources/images/logo.png';
    311         $shipment_details = $this->get_order_shipment_details_service()->getDetailsByOrderId( $orderId );
     377        $shipment_details = $this->get_order_shipment_details( $orderId );
    312378
    313379        if ( $shipment_details && ! empty( $shipment_details->getReference() ) ) {
     
    324390
    325391        if ( ! $this->get_config_service()->is_manual_sync_enabled() ) {
    326             $draft_status           = $this->get_shipment_draft_service()->getDraftStatus( $orderId );
     392            $draft_status = $this->get_shipment_draft_service()->getDraftStatus( $orderId );
    327393            if ( in_array( $draft_status->status, [ QueueItem::QUEUED, QueueItem::IN_PROGRESS ], true ) ) {
    328394                return '<div class="pl-draft-in-progress" data-order-id="' . $orderId . '">'
     
    335401               . '<span>' . __( 'Send with Packlink', 'packlink-pro-shipping' ) . '</span>'
    336402               . '</button>';
     403    }
     404
     405    /**
     406     * Returns cached shipment details for an order id.
     407     *
     408     * @param string $order_id
     409     *
     410     * @return OrderShipmentDetails|null
     411     */
     412    private function get_order_shipment_details( $order_id ) {
     413        if ( array_key_exists( $order_id, $this->order_shipment_details_cache ) ) {
     414            return $this->order_shipment_details_cache[ $order_id ];
     415        }
     416
     417        $this->order_shipment_details_cache[ $order_id ] =
     418            $this->get_order_shipment_details_service()->getDetailsByOrderId( $order_id );
     419
     420        return $this->order_shipment_details_cache[ $order_id ];
    337421    }
    338422
     
    502586        return $draft_service;
    503587    }
     588
     589    /**
     590     * Validates if plugin is enabled and if it is post request for calls permitted only for admins and shop managers
     591     *
     592     * @return void
     593     */
     594    protected function validate_admin_or_manager( $post = 'no' ) {
     595        if ( ! Shop_Helper::is_plugin_enabled() ) {
     596            exit();
     597        }
     598
     599        if ( 'yes' === $post && ! $this->is_post() ) {
     600            $this->redirect404();
     601        }
     602
     603        if (!is_user_logged_in()) {
     604            $this->redirect404();
     605        }
     606
     607        if (!current_user_can('administrator') && !current_user_can('manage_woocommerce')) {
     608            $this->redirect404();
     609        }
     610    }
    504611}
    505612
  • packlink-pro-shipping/trunk/changelog.txt

    r3444249 r3454426  
    11*** Packlink PRO Changelog ***
     2
     32026-02-04 - version 3.6.4
     4* Rates for AU, CA, and US fixed
     5* Shop manager enabled to create draft
     6* Weight unit mismatch fixed
     7* Duplicate SQL queries fixed
    28
    392026-01-21 - version 3.6.3
  • packlink-pro-shipping/trunk/composer.json

    r3444249 r3454426  
    22  "name": "packlink/woocommerce",
    33  "description": "Packlink WooCommerce Integration",
    4   "version": "3.6.3",
     4  "version": "3.6.4",
    55  "type": "library",
    66  "repositories": [
     
    1313  "require": {
    1414    "php": ">=5.6",
    15     "packlink/integration-core": "3.7.2",
     15    "packlink/integration-core": "3.7.3",
    1616    "ext-json": "*",
    1717    "ext-curl": "*",
  • packlink-pro-shipping/trunk/composer.lock

    r3444249 r3454426  
    55        "This file is @generated automatically"
    66    ],
    7     "content-hash": "dd4e4d699fbe66bc2d04e3cab387f4ed",
     7    "content-hash": "315c94b3ecd5f9e79c77715c46ec7479",
    88    "packages": [
    99        {
     
    6363        {
    6464            "name": "packlink/integration-core",
    65             "version": "v3.7.2",
     65            "version": "v3.7.3",
    6666            "source": {
    6767                "type": "git",
    6868                "url": "git@github.com:packlink-dev/ecommerce_module_core.git",
    69                 "reference": "37f5a860a2e6fe4794e2e2b0e4424d7e7a682044"
    70             },
    71             "dist": {
    72                 "type": "zip",
    73                 "url": "https://api.github.com/repos/packlink-dev/ecommerce_module_core/zipball/37f5a860a2e6fe4794e2e2b0e4424d7e7a682044",
    74                 "reference": "37f5a860a2e6fe4794e2e2b0e4424d7e7a682044",
     69                "reference": "745833642d0c42629fe196c4c109f0e5f98fa6e5"
     70            },
     71            "dist": {
     72                "type": "zip",
     73                "url": "https://api.github.com/repos/packlink-dev/ecommerce_module_core/zipball/745833642d0c42629fe196c4c109f0e5f98fa6e5",
     74                "reference": "745833642d0c42629fe196c4c109f0e5f98fa6e5",
    7575                "shasum": ""
    7676            },
     
    111111            ],
    112112            "description": "Packlink integrations core library",
    113             "time": "2026-01-14T10:02:49+00:00"
     113            "time": "2026-02-04T13:04:45+00:00"
    114114        },
    115115        {
  • packlink-pro-shipping/trunk/packlink-pro-shipping.php

    r3444249 r3454426  
    1010 * Plugin URI: https://en.wordpress.org/plugins/packlink-pro-shipping/
    1111 * Description: Save up to 70% on your shipping costs. No fixed fees, no minimum shipping volume required. Manage all your shipments in a single platform.
    12  * Version: 3.6.3
     12 * Version: 3.6.4
    1313 * Author: Packlink Shipping S.L.
    1414 * Author URI: https://pro.packlink.es/
  • packlink-pro-shipping/trunk/readme.txt

    r3444249 r3454426  
    9595== Changelog ==
    9696
     97#### 3.6.4 - February 4th, 2026
     98
     99**Updates**
     100- Rates for AU, CA, and US fixed
     101- Shop manager enabled to create draft
     102- Weight unit mismatch fixed
     103- Duplicate SQL queries fixed
     104
    97105#### 3.6.3 - January 21st, 2026
    98106
  • packlink-pro-shipping/trunk/vendor/autoload.php

    r3444249 r3454426  
    33// autoload.php @generated by Composer
    44
     5if (PHP_VERSION_ID < 50600) {
     6    if (!headers_sent()) {
     7        header('HTTP/1.1 500 Internal Server Error');
     8    }
     9    $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
     10    if (!ini_get('display_errors')) {
     11        if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
     12            fwrite(STDERR, $err);
     13        } elseif (!headers_sent()) {
     14            echo $err;
     15        }
     16    }
     17    trigger_error(
     18        $err,
     19        E_USER_ERROR
     20    );
     21}
     22
    523require_once __DIR__ . '/composer/autoload_real.php';
    624
    7 return ComposerAutoloaderInit8145286b9b97cb88896b0883461812c5::getLoader();
     25return ComposerAutoloaderInit315c94b3ecd5f9e79c77715c46ec7479::getLoader();
  • packlink-pro-shipping/trunk/vendor/composer/ClassLoader.php

    r3379500 r3454426  
    4343class ClassLoader
    4444{
    45     /** @var ?string */
     45    /** @var \Closure(string):void */
     46    private static $includeFile;
     47
     48    /** @var string|null */
    4649    private $vendorDir;
    4750
    4851    // PSR-4
    4952    /**
    50      * @var array[]
    51      * @psalm-var array<string, array<string, int>>
     53     * @var array<string, array<string, int>>
    5254     */
    5355    private $prefixLengthsPsr4 = array();
    5456    /**
    55      * @var array[]
    56      * @psalm-var array<string, array<int, string>>
     57     * @var array<string, list<string>>
    5758     */
    5859    private $prefixDirsPsr4 = array();
    5960    /**
    60      * @var array[]
    61      * @psalm-var array<string, string>
     61     * @var list<string>
    6262     */
    6363    private $fallbackDirsPsr4 = array();
     
    6565    // PSR-0
    6666    /**
    67      * @var array[]
    68      * @psalm-var array<string, array<string, string[]>>
     67     * List of PSR-0 prefixes
     68     *
     69     * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
     70     *
     71     * @var array<string, array<string, list<string>>>
    6972     */
    7073    private $prefixesPsr0 = array();
    7174    /**
    72      * @var array[]
    73      * @psalm-var array<string, string>
     75     * @var list<string>
    7476     */
    7577    private $fallbackDirsPsr0 = array();
     
    7981
    8082    /**
    81      * @var string[]
    82      * @psalm-var array<string, string>
     83     * @var array<string, string>
    8384     */
    8485    private $classMap = array();
     
    8889
    8990    /**
    90      * @var bool[]
    91      * @psalm-var array<string, bool>
     91     * @var array<string, bool>
    9292     */
    9393    private $missingClasses = array();
    9494
    95     /** @var ?string */
     95    /** @var string|null */
    9696    private $apcuPrefix;
    9797
    9898    /**
    99      * @var self[]
     99     * @var array<string, self>
    100100     */
    101101    private static $registeredLoaders = array();
    102102
    103103    /**
    104      * @param ?string $vendorDir
     104     * @param string|null $vendorDir
    105105     */
    106106    public function __construct($vendorDir = null)
    107107    {
    108108        $this->vendorDir = $vendorDir;
    109     }
    110 
    111     /**
    112      * @return string[]
     109        self::initializeIncludeClosure();
     110    }
     111
     112    /**
     113     * @return array<string, list<string>>
    113114     */
    114115    public function getPrefixes()
     
    122123
    123124    /**
    124      * @return array[]
    125      * @psalm-return array<string, array<int, string>>
     125     * @return array<string, list<string>>
    126126     */
    127127    public function getPrefixesPsr4()
     
    131131
    132132    /**
    133      * @return array[]
    134      * @psalm-return array<string, string>
     133     * @return list<string>
    135134     */
    136135    public function getFallbackDirs()
     
    140139
    141140    /**
    142      * @return array[]
    143      * @psalm-return array<string, string>
     141     * @return list<string>
    144142     */
    145143    public function getFallbackDirsPsr4()
     
    149147
    150148    /**
    151      * @return string[] Array of classname => path
    152      * @psalm-return array<string, string>
     149     * @return array<string, string> Array of classname => path
    153150     */
    154151    public function getClassMap()
     
    158155
    159156    /**
    160      * @param string[] $classMap Class to filename map
    161      * @psalm-param array<string, string> $classMap
     157     * @param array<string, string> $classMap Class to filename map
    162158     *
    163159     * @return void
     
    176172     * appending or prepending to the ones previously set for this prefix.
    177173     *
    178      * @param string          $prefix  The prefix
    179      * @param string[]|string $paths   The PSR-0 root directories
    180      * @param bool            $prepend Whether to prepend the directories
     174     * @param string              $prefix  The prefix
     175     * @param list<string>|string $paths   The PSR-0 root directories
     176     * @param bool                $prepend Whether to prepend the directories
    181177     *
    182178     * @return void
     
    184180    public function add($prefix, $paths, $prepend = false)
    185181    {
     182        $paths = (array) $paths;
    186183        if (!$prefix) {
    187184            if ($prepend) {
    188185                $this->fallbackDirsPsr0 = array_merge(
    189                     (array) $paths,
     186                    $paths,
    190187                    $this->fallbackDirsPsr0
    191188                );
     
    193190                $this->fallbackDirsPsr0 = array_merge(
    194191                    $this->fallbackDirsPsr0,
    195                     (array) $paths
     192                    $paths
    196193                );
    197194            }
     
    202199        $first = $prefix[0];
    203200        if (!isset($this->prefixesPsr0[$first][$prefix])) {
    204             $this->prefixesPsr0[$first][$prefix] = (array) $paths;
     201            $this->prefixesPsr0[$first][$prefix] = $paths;
    205202
    206203            return;
     
    208205        if ($prepend) {
    209206            $this->prefixesPsr0[$first][$prefix] = array_merge(
    210                 (array) $paths,
     207                $paths,
    211208                $this->prefixesPsr0[$first][$prefix]
    212209            );
     
    214211            $this->prefixesPsr0[$first][$prefix] = array_merge(
    215212                $this->prefixesPsr0[$first][$prefix],
    216                 (array) $paths
     213                $paths
    217214            );
    218215        }
     
    223220     * appending or prepending to the ones previously set for this namespace.
    224221     *
    225      * @param string          $prefix  The prefix/namespace, with trailing '\\'
    226      * @param string[]|string $paths   The PSR-4 base directories
    227      * @param bool            $prepend Whether to prepend the directories
     222     * @param string              $prefix  The prefix/namespace, with trailing '\\'
     223     * @param list<string>|string $paths   The PSR-4 base directories
     224     * @param bool                $prepend Whether to prepend the directories
    228225     *
    229226     * @throws \InvalidArgumentException
     
    233230    public function addPsr4($prefix, $paths, $prepend = false)
    234231    {
     232        $paths = (array) $paths;
    235233        if (!$prefix) {
    236234            // Register directories for the root namespace.
    237235            if ($prepend) {
    238236                $this->fallbackDirsPsr4 = array_merge(
    239                     (array) $paths,
     237                    $paths,
    240238                    $this->fallbackDirsPsr4
    241239                );
     
    243241                $this->fallbackDirsPsr4 = array_merge(
    244242                    $this->fallbackDirsPsr4,
    245                     (array) $paths
     243                    $paths
    246244                );
    247245            }
     
    253251            }
    254252            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
    255             $this->prefixDirsPsr4[$prefix] = (array) $paths;
     253            $this->prefixDirsPsr4[$prefix] = $paths;
    256254        } elseif ($prepend) {
    257255            // Prepend directories for an already registered namespace.
    258256            $this->prefixDirsPsr4[$prefix] = array_merge(
    259                 (array) $paths,
     257                $paths,
    260258                $this->prefixDirsPsr4[$prefix]
    261259            );
     
    264262            $this->prefixDirsPsr4[$prefix] = array_merge(
    265263                $this->prefixDirsPsr4[$prefix],
    266                 (array) $paths
     264                $paths
    267265            );
    268266        }
     
    273271     * replacing any others previously set for this prefix.
    274272     *
    275      * @param string          $prefix The prefix
    276      * @param string[]|string $paths  The PSR-0 base directories
     273     * @param string              $prefix The prefix
     274     * @param list<string>|string $paths  The PSR-0 base directories
    277275     *
    278276     * @return void
     
    291289     * replacing any others previously set for this namespace.
    292290     *
    293      * @param string          $prefix The prefix/namespace, with trailing '\\'
    294      * @param string[]|string $paths  The PSR-4 base directories
     291     * @param string              $prefix The prefix/namespace, with trailing '\\'
     292     * @param list<string>|string $paths  The PSR-4 base directories
    295293     *
    296294     * @throws \InvalidArgumentException
     
    426424    {
    427425        if ($file = $this->findFile($class)) {
    428             includeFile($file);
     426            $includeFile = self::$includeFile;
     427            $includeFile($file);
    429428
    430429            return true;
     
    477476
    478477    /**
    479      * Returns the currently registered loaders indexed by their corresponding vendor directories.
    480      *
    481      * @return self[]
     478     * Returns the currently registered loaders keyed by their corresponding vendor directories.
     479     *
     480     * @return array<string, self>
    482481     */
    483482    public static function getRegisteredLoaders()
     
    556555        return false;
    557556    }
     557
     558    /**
     559     * @return void
     560     */
     561    private static function initializeIncludeClosure()
     562    {
     563        if (self::$includeFile !== null) {
     564            return;
     565        }
     566
     567        /**
     568         * Scope isolated include.
     569         *
     570         * Prevents access to $this/self from included files.
     571         *
     572         * @param  string $file
     573         * @return void
     574         */
     575        self::$includeFile = \Closure::bind(static function($file) {
     576            include $file;
     577        }, null, null);
     578    }
    558579}
    559 
    560 /**
    561  * Scope isolated include.
    562  *
    563  * Prevents access to $this/self from included files.
    564  *
    565  * @param  string $file
    566  * @return void
    567  * @private
    568  */
    569 function includeFile($file)
    570 {
    571     include $file;
    572 }
  • packlink-pro-shipping/trunk/vendor/composer/InstalledVersions.php

    r3379500 r3454426  
    2222 *
    2323 * To require its presence, you can require `composer-runtime-api ^2.0`
     24 *
     25 * @final
    2426 */
    2527class InstalledVersions
     
    2729    /**
    2830     * @var mixed[]|null
    29      * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null
     31     * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
    3032     */
    3133    private static $installed;
     
    3840    /**
    3941     * @var array[]
    40      * @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
     42     * @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
    4143     */
    4244    private static $installedByVendor = array();
     
    9799        foreach (self::getInstalled() as $installed) {
    98100            if (isset($installed['versions'][$packageName])) {
    99                 return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
     101                return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
    100102            }
    101103        }
     
    118120    public static function satisfies(VersionParser $parser, $packageName, $constraint)
    119121    {
    120         $constraint = $parser->parseConstraints($constraint);
     122        $constraint = $parser->parseConstraints((string) $constraint);
    121123        $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
    122124
     
    242244    /**
    243245     * @return array
    244      * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
     246     * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
    245247     */
    246248    public static function getRootPackage()
     
    256258     * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
    257259     * @return array[]
    258      * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}
     260     * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
    259261     */
    260262    public static function getRawData()
     
    279281     *
    280282     * @return array[]
    281      * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
     283     * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
    282284     */
    283285    public static function getAllRawData()
     
    302304     * @return void
    303305     *
    304      * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data
     306     * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
    305307     */
    306308    public static function reload($data)
     
    312314    /**
    313315     * @return array[]
    314      * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
     316     * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
    315317     */
    316318    private static function getInstalled()
     
    327329                    $installed[] = self::$installedByVendor[$vendorDir];
    328330                } elseif (is_file($vendorDir.'/composer/installed.php')) {
    329                     $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
     331                    /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
     332                    $required = require $vendorDir.'/composer/installed.php';
     333                    $installed[] = self::$installedByVendor[$vendorDir] = $required;
    330334                    if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
    331335                        self::$installed = $installed[count($installed) - 1];
     
    339343            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
    340344            if (substr(__DIR__, -8, 1) !== 'C') {
    341                 self::$installed = require __DIR__ . '/installed.php';
     345                /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
     346                $required = require __DIR__ . '/installed.php';
     347                self::$installed = $required;
    342348            } else {
    343349                self::$installed = array();
    344350            }
    345351        }
    346         $installed[] = self::$installed;
     352
     353        if (self::$installed !== array()) {
     354            $installed[] = self::$installed;
     355        }
    347356
    348357        return $installed;
  • packlink-pro-shipping/trunk/vendor/composer/LICENSE

    r3048950 r3454426  
    1 
    21Copyright (c) Nils Adermann, Jordi Boggiano
    32
     
    1918OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    2019THE SOFTWARE.
    21 
  • packlink-pro-shipping/trunk/vendor/composer/autoload_classmap.php

    r3379500 r3454426  
    33// autoload_classmap.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname(__DIR__);
    66$baseDir = dirname($vendorDir);
    77
  • packlink-pro-shipping/trunk/vendor/composer/autoload_namespaces.php

    r3379500 r3454426  
    33// autoload_namespaces.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname(__DIR__);
    66$baseDir = dirname($vendorDir);
    77
  • packlink-pro-shipping/trunk/vendor/composer/autoload_psr4.php

    r3379500 r3454426  
    33// autoload_psr4.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname(__DIR__);
    66$baseDir = dirname($vendorDir);
    77
  • packlink-pro-shipping/trunk/vendor/composer/autoload_real.php

    r3444249 r3454426  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit8145286b9b97cb88896b0883461812c5
     5class ComposerAutoloaderInit315c94b3ecd5f9e79c77715c46ec7479
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit8145286b9b97cb88896b0883461812c5', 'loadClassLoader'), true, true);
    28         self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit8145286b9b97cb88896b0883461812c5', 'loadClassLoader'));
     27        spl_autoload_register(array('ComposerAutoloaderInit315c94b3ecd5f9e79c77715c46ec7479', 'loadClassLoader'), true, true);
     28        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit315c94b3ecd5f9e79c77715c46ec7479', 'loadClassLoader'));
    3030
    31         $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
    32         if ($useStaticLoader) {
    33             require __DIR__ . '/autoload_static.php';
    34 
    35             call_user_func(\Composer\Autoload\ComposerStaticInit8145286b9b97cb88896b0883461812c5::getInitializer($loader));
    36         } else {
    37             $map = require __DIR__ . '/autoload_namespaces.php';
    38             foreach ($map as $namespace => $path) {
    39                 $loader->set($namespace, $path);
    40             }
    41 
    42             $map = require __DIR__ . '/autoload_psr4.php';
    43             foreach ($map as $namespace => $path) {
    44                 $loader->setPsr4($namespace, $path);
    45             }
    46 
    47             $classMap = require __DIR__ . '/autoload_classmap.php';
    48             if ($classMap) {
    49                 $loader->addClassMap($classMap);
    50             }
    51         }
     31        require __DIR__ . '/autoload_static.php';
     32        call_user_func(\Composer\Autoload\ComposerStaticInit315c94b3ecd5f9e79c77715c46ec7479::getInitializer($loader));
    5233
    5334        $loader->register(true);
  • packlink-pro-shipping/trunk/vendor/composer/autoload_static.php

    r3444249 r3454426  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit8145286b9b97cb88896b0883461812c5
     7class ComposerStaticInit315c94b3ecd5f9e79c77715c46ec7479
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    6363    {
    6464        return \Closure::bind(function () use ($loader) {
    65             $loader->prefixLengthsPsr4 = ComposerStaticInit8145286b9b97cb88896b0883461812c5::$prefixLengthsPsr4;
    66             $loader->prefixDirsPsr4 = ComposerStaticInit8145286b9b97cb88896b0883461812c5::$prefixDirsPsr4;
    67             $loader->classMap = ComposerStaticInit8145286b9b97cb88896b0883461812c5::$classMap;
     65            $loader->prefixLengthsPsr4 = ComposerStaticInit315c94b3ecd5f9e79c77715c46ec7479::$prefixLengthsPsr4;
     66            $loader->prefixDirsPsr4 = ComposerStaticInit315c94b3ecd5f9e79c77715c46ec7479::$prefixDirsPsr4;
     67            $loader->classMap = ComposerStaticInit315c94b3ecd5f9e79c77715c46ec7479::$classMap;
    6868
    6969        }, null, ClassLoader::class);
  • packlink-pro-shipping/trunk/vendor/composer/installed.json

    r3440427 r3454426  
    6060        {
    6161            "name": "packlink/integration-core",
    62             "version": "v3.7.2",
    63             "version_normalized": "3.7.2.0",
     62            "version": "v3.7.3",
     63            "version_normalized": "3.7.3.0",
    6464            "source": {
    6565                "type": "git",
    6666                "url": "git@github.com:packlink-dev/ecommerce_module_core.git",
    67                 "reference": "37f5a860a2e6fe4794e2e2b0e4424d7e7a682044"
    68             },
    69             "dist": {
    70                 "type": "zip",
    71                 "url": "https://api.github.com/repos/packlink-dev/ecommerce_module_core/zipball/37f5a860a2e6fe4794e2e2b0e4424d7e7a682044",
    72                 "reference": "37f5a860a2e6fe4794e2e2b0e4424d7e7a682044",
     67                "reference": "745833642d0c42629fe196c4c109f0e5f98fa6e5"
     68            },
     69            "dist": {
     70                "type": "zip",
     71                "url": "https://api.github.com/repos/packlink-dev/ecommerce_module_core/zipball/745833642d0c42629fe196c4c109f0e5f98fa6e5",
     72                "reference": "745833642d0c42629fe196c4c109f0e5f98fa6e5",
    7373                "shasum": ""
    7474            },
     
    8282                "phpunit/phpunit": "^4.8"
    8383            },
    84             "time": "2026-01-14T10:02:49+00:00",
     84            "time": "2026-02-04T13:04:45+00:00",
    8585            "type": "library",
    8686            "installation-source": "dist",
  • packlink-pro-shipping/trunk/vendor/composer/installed.php

    r3444249 r3454426  
    11<?php return array(
    22    'root' => array(
    3         'pretty_version' => '3.6.3',
    4         'version' => '3.6.3.0',
     3        'name' => 'packlink/woocommerce',
     4        'pretty_version' => '3.6.4',
     5        'version' => '3.6.4.0',
     6        'reference' => null,
    57        'type' => 'library',
    68        'install_path' => __DIR__ . '/../../',
    79        'aliases' => array(),
    8         'reference' => NULL,
    9         'name' => 'packlink/woocommerce',
    1010        'dev' => false,
    1111    ),
     
    1414            'pretty_version' => '3.0.0',
    1515            'version' => '3.0.0.0',
     16            'reference' => 'b6042db24d66a49f3ecd261395ec918f00763e9c',
    1617            'type' => 'library',
    1718            'install_path' => __DIR__ . '/../iio/libmergepdf',
    1819            'aliases' => array(),
    19             'reference' => 'b6042db24d66a49f3ecd261395ec918f00763e9c',
    2020            'dev_requirement' => false,
    2121        ),
    2222        'packlink/integration-core' => array(
    23             'pretty_version' => 'v3.7.2',
    24             'version' => '3.7.2.0',
     23            'pretty_version' => 'v3.7.3',
     24            'version' => '3.7.3.0',
     25            'reference' => '745833642d0c42629fe196c4c109f0e5f98fa6e5',
    2526            'type' => 'library',
    2627            'install_path' => __DIR__ . '/../packlink/integration-core',
    2728            'aliases' => array(),
    28             'reference' => '37f5a860a2e6fe4794e2e2b0e4424d7e7a682044',
    2929            'dev_requirement' => false,
    3030        ),
    3131        'packlink/woocommerce' => array(
    32             'pretty_version' => '3.6.3',
    33             'version' => '3.6.3.0',
     32            'pretty_version' => '3.6.4',
     33            'version' => '3.6.4.0',
     34            'reference' => null,
    3435            'type' => 'library',
    3536            'install_path' => __DIR__ . '/../../',
    3637            'aliases' => array(),
    37             'reference' => NULL,
    3838            'dev_requirement' => false,
    3939        ),
     
    4141            'pretty_version' => '1.8.1',
    4242            'version' => '1.8.1.0',
     43            'reference' => '2c68c9e6c034ac3187d25968790139a73184cdb1',
    4344            'type' => 'library',
    4445            'install_path' => __DIR__ . '/../setasign/fpdf',
    4546            'aliases' => array(),
    46             'reference' => '2c68c9e6c034ac3187d25968790139a73184cdb1',
    4747            'dev_requirement' => false,
    4848        ),
     
    5050            'pretty_version' => '1.6.2',
    5151            'version' => '1.6.2.0',
     52            'reference' => 'a6ad58897a6d97cc2d2cd2adaeda343b25a368ea',
    5253            'type' => 'library',
    5354            'install_path' => __DIR__ . '/../setasign/fpdi',
    5455            'aliases' => array(),
    55             'reference' => 'a6ad58897a6d97cc2d2cd2adaeda343b25a368ea',
    5656            'dev_requirement' => false,
    5757        ),
     
    5959            'pretty_version' => '1.6.2',
    6060            'version' => '1.6.2.0',
     61            'reference' => 'a5dda72b78253c0e9e4d644e6e3af4b94662e27e',
    6162            'type' => 'library',
    6263            'install_path' => __DIR__ . '/../setasign/fpdi-fpdf',
    6364            'aliases' => array(),
    64             'reference' => 'a5dda72b78253c0e9e4d644e6e3af4b94662e27e',
    6565            'dev_requirement' => false,
    6666        ),
  • packlink-pro-shipping/trunk/vendor/packlink/integration-core/CHANGELOG.md

    r3440427 r3454426  
    33
    44The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
     5
     6## [3.7.3](https://github.com/packlink-dev/ecommerce_module_core/compare/v3.7.2...v3.7.3) - 2026-02-04
     7### Changed
     8- Add weight conversions
     9- Fixed service sync issue for AU, CA, and US
    510
    611## [3.7.2](https://github.com/packlink-dev/ecommerce_module_core/compare/v3.7.1...v3.7.2) - 2026-01-14
  • packlink-pro-shipping/trunk/vendor/packlink/integration-core/src/BusinessLogic/Order/OrderService.php

    r3379500 r3454426  
    492492        $draft->content = array();
    493493        $packages = array();
     494
    494495        foreach ($order->getItems() as $item) {
    495496            $quantity = $item->getQuantity() ?: 1;
    496497            $draft->content[] = $quantity . ' ' . $item->getTitle();
     498
    497499            for ($i = 0; $i < $quantity; $i++) {
     500                $weight = $this->convertWeightUnits($item->getWeight());
     501
    498502                $packages[] = new Package(
    499                     $item->getWeight(),
     503                    $weight,
    500504                    $item->getWidth(),
    501505                    $item->getHeight(),
     
    509513        $draft->packages = array($transformer->transform($packages));
    510514    }
     515
     516    /**
     517     * Converts weight units into kg
     518     *
     519     * @param float $weight weight to be converted to kg
     520     *
     521     * @return float
     522     */
     523    protected function convertWeightUnits($weight)
     524    {
     525        $unit = $this->getStoreUnit();
     526
     527        switch ($unit) {
     528            case 'g':
     529                return $weight / 1000;
     530            case 'oz':
     531                return $weight * 0.02834952;
     532            case 'lbs':
     533                return $weight * 0.45359237;
     534            case 'kg':
     535            default:
     536                return $weight;
     537        }
     538    }
     539
     540    /**
     541     * @return string
     542     */
     543    protected function getStoreUnit()
     544    {
     545        return 'kg';
     546    }
    511547}
  • packlink-pro-shipping/trunk/vendor/packlink/integration-core/src/BusinessLogic/ShippingMethod/ShippingCostCalculator.php

    r3379500 r3454426  
    163163        if (!empty($services)) {
    164164            foreach ($services as $service) {
    165                 $result = self::getCheapestService($method, $result, $service, '');
     165                $result = self::getCheapestService($method, $result, $service, $toCountry);
    166166            }
    167167        } else {
Note: See TracChangeset for help on using the changeset viewer.