Skip to content

Commit d89a382

Browse files
committed
ACP2E-3667: [Mainline ]Fedex International Priority unavailable.
1 parent 580d8ff commit d89a382

File tree

2 files changed

+97
-3
lines changed

2 files changed

+97
-3
lines changed

app/code/Magento/Fedex/Setup/Patch/Data/ConfigureFedexDefaults.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright 2015 Adobe
4-
* All Rights Reserved.
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
55
*/
66

77
namespace Magento\Fedex\Setup\Patch\Data;
@@ -48,7 +48,7 @@ public function apply()
4848
'INTERNATIONALECONOMY FREIGHT' => 'INTERNATIONAL_ECONOMY_FREIGHT',
4949
'INTERNATIONALFIRST' => 'INTERNATIONAL_FIRST',
5050
'INTERNATIONALGROUND' => 'INTERNATIONAL_GROUND',
51-
'INTERNATIONALPRIORITY' => 'FEDEX_INTERNATIONAL_PRIORITY',
51+
'INTERNATIONALPRIORITY' => 'INTERNATIONAL_PRIORITY',
5252
'INTERNATIONALPRIORITY FREIGHT' => 'INTERNATIONAL_PRIORITY_FREIGHT',
5353
'PRIORITYOVERNIGHT' => 'PRIORITY_OVERNIGHT',
5454
'SMARTPOST' => 'SMART_POST',
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?php
2+
/**
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
5+
*/
6+
7+
namespace Magento\Fedex\Setup\Patch\Data;
8+
9+
use Magento\Framework\Setup\Patch\DataPatchInterface;
10+
use Magento\Framework\Setup\ModuleDataSetupInterface;
11+
use Magento\Framework\Setup\Patch\PatchVersionInterface;
12+
13+
class UpdateFedexInternationalPriority implements DataPatchInterface, PatchVersionInterface
14+
{
15+
/**
16+
* @var ModuleDataSetupInterface
17+
*/
18+
private $moduleDataSetup;
19+
20+
/**
21+
* UpdateFedexInternationalPriority constructor.
22+
* @param ModuleDataSetupInterface $moduleDataSetup
23+
*/
24+
public function __construct(
25+
ModuleDataSetupInterface $moduleDataSetup
26+
) {
27+
$this->moduleDataSetup = $moduleDataSetup;
28+
}
29+
30+
/**
31+
* {@inheritdoc}
32+
* Apply the patch to update INTERNATIONAL_PRIORITY to FEDEX_INTERNATIONAL_PRIORITY
33+
*/
34+
public function apply()
35+
{
36+
$conn = $this->moduleDataSetup->getConnection();
37+
$configDataTable = $this->moduleDataSetup->getTable('core_config_data');
38+
$paths = [
39+
'carriers/fedex/allowed_methods',
40+
'carriers/fedex/free_method'
41+
];
42+
foreach ($paths as $path) {
43+
$select = $conn->select()
44+
->from($configDataTable)
45+
->where('path = ?', $path);
46+
$rows = $conn->fetchAll($select);
47+
foreach ($rows as $row) {
48+
$values = explode(',', $row['value']);
49+
$updated = false;
50+
foreach ($values as &$value) {
51+
if (trim($value) === 'INTERNATIONAL_PRIORITY') {
52+
$value = 'FEDEX_INTERNATIONAL_PRIORITY';
53+
$updated = true;
54+
}
55+
}
56+
unset($value);
57+
if ($updated) {
58+
$newValue = implode(',', $values);
59+
$conn->update(
60+
$configDataTable,
61+
['value' => $newValue],
62+
['config_id = ?' => $row['config_id']]
63+
);
64+
}
65+
}
66+
}
67+
}
68+
69+
/**
70+
* {@inheritdoc}
71+
*/
72+
public static function getDependencies()
73+
{
74+
return [
75+
ConfigureFedexDefaults::class
76+
];
77+
}
78+
79+
/**
80+
* {@inheritdoc}
81+
*/
82+
public static function getVersion()
83+
{
84+
return '2.0.1';
85+
}
86+
87+
/**
88+
* {@inheritdoc}
89+
*/
90+
public function getAliases()
91+
{
92+
return [];
93+
}
94+
}

0 commit comments

Comments
 (0)