magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.54k stars 9.32k forks source link

Magento 2 new FedEx api not showing International Priority & International Priority Express #39162

Open ShapesGraphicStudio opened 1 month ago

ShapesGraphicStudio commented 1 month ago

Preconditions and environment

Steps to reproduce

  1. Enable only International Priority Shipping Method in FedEx module.

Expected result

International Priority Shipping Method Should be displayed to customer.

Actual result

No shipping method displayed.

Additional information

With the help of FedEx devs, regarding the International Priority Shipping Method, I tried to change all 'INTERNATIONAL_PRIORITY' entries to 'FEDEX_INTERNATIONAL_PRIORITY' directly in vendor/magento/module-fedex/Model/Carrier.php, get back to admin config to reselect International Priority and it seems to do the job.

FedEx devs say there is also another method missing : ''FEDEX_INTERNATIONAL_PRIORITY_EXPRESS'

Release note

No response

Triage and priority

m2-assistant[bot] commented 1 month ago

Hi @ShapesGraphicStudio. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

m2-assistant[bot] commented 1 month ago

Hi @engcom-Bravo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Bravo commented 1 month ago

Hi @ShapesGraphicStudio,

Thanks for your reporting and collaboration.

We have verified the issue in Latest 2.4-develop instance and the issue is reproducible.Kindly refer the screenshots.

Steps to reproduce

Configuration-Settings-Stores-Magento-Admin (1)

Checkout (2)

when we enable only International Priority Shipping Method no shipping method getting displayed.

Hence Confirming the issue.

Thanks.

github-jira-sync-bot commented 1 month ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-12965 is successfully created for this GitHub issue.

m2-assistant[bot] commented 1 month ago

:white_check_mark: Confirmed by @engcom-Bravo. Thank you for verifying the issue.
Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

Silarn commented 1 month ago

I can elaborate and expand upon this issue. It appears a number of international methods were left out of the Fedex module, particularly nearly all of the EU Domestic methods.

The Model\Carrier class needs to be updated to include these missing methods.

I've been able to work around the issue with the following plugin:

class AddFedexMethods
{
    /**
     * Add missing carrier methods to FedEx.
     *
     * @param \Magento\Fedex\Model\Carrier $subject
     * @param callable $proceed
     * @param string $type
     * @param string $code
     * @return \Magento\Framework\Phrase|array|false
     */
    public function aroundGetCode(
        \Magento\Fedex\Model\Carrier $subject,
        callable $proceed, $type, $code = ''): \Magento\Framework\Phrase|array|false
    {
        $result = $proceed($type, $code);
        if ($type == 'method') {
            $codes = [
                'method' => [
                    'FEDEX_FIRST' => __('First'),
                    'FEDEX_PRIORITY_EXPRESS' => __('Priority Express'),
                    'FEDEX_PRIORITY' => __('Priority'),
                    'FEDEX_PRIORITY_EXPRESS_FREIGHT' => __('Priority Express Freight'),
                    'FEDEX_PRIORITY_FREIGHT' => __('Priority Freight'),
                    'FEDEX_ECONOMY_SELECT' => __('Economy Select')
                ]
            ];
            if ($code !== '' && $result === false) {
                if (!isset($codes[$type][$code])) {
                    return false;
                } else {
                    return $codes[$type][$code];
                }
            }
            if ($code === '') {
                return array_merge($codes[$type], $result);
            }
        }
        return $result;
    }
}