Skip to content

Commit b14bc46

Browse files
committed
Merge branch 'ACP2E-3667' of https://github.com/adobe-commerce-tier-4/magento2ce into PR-04-03-2025
2 parents c502869 + 1f2bbba commit b14bc46

File tree

8 files changed

+207
-17
lines changed

8 files changed

+207
-17
lines changed

app/code/Magento/Fedex/Model/Carrier.php

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,14 @@ public function getCode($type, $code = ''): \Magento\Framework\Phrase|array|fals
717717
'INTERNATIONAL_ECONOMY_FREIGHT' => __('Intl Economy Freight'),
718718
'INTERNATIONAL_FIRST' => __('International First'),
719719
'INTERNATIONAL_GROUND' => __('International Ground'),
720-
'INTERNATIONAL_PRIORITY' => __('International Priority'),
720+
'FEDEX_INTERNATIONAL_PRIORITY' => __('International Priority'),
721+
'FEDEX_INTERNATIONAL_PRIORITY_EXPRESS' => __('International Priority Express'),
722+
'FEDEX_FIRST' => __('First'),
723+
'FEDEX_PRIORITY' => __('Priority'),
724+
'FEDEX_PRIORITY_EXPRESS' => __('Priority Express'),
725+
'FEDEX_PRIORITY_EXPRESS_FREIGHT' => __('Priority Express Freight'),
726+
'FEDEX_PRIORITY_FREIGHT' => __('Priority Freight'),
727+
'FEDEX_ECONOMY_SELECT' => __('Economy Select'),
721728
'INTERNATIONAL_PRIORITY_FREIGHT' => __('Intl Priority Freight'),
722729
'PRIORITY_OVERNIGHT' => __('Priority Overnight'),
723730
'SMART_POST' => __('Smart Post'),
@@ -756,7 +763,11 @@ public function getCode($type, $code = ''): \Magento\Framework\Phrase|array|fals
756763
],
757764
],
758765
'from_us' => [
759-
'method' => ['INTERNATIONAL_FIRST', 'INTERNATIONAL_ECONOMY', 'INTERNATIONAL_PRIORITY'],
766+
'method' => [
767+
'INTERNATIONAL_FIRST',
768+
'INTERNATIONAL_ECONOMY',
769+
'FEDEX_INTERNATIONAL_PRIORITY'
770+
],
760771
],
761772
],
762773
],
@@ -778,15 +789,19 @@ public function getCode($type, $code = ''): \Magento\Framework\Phrase|array|fals
778789
],
779790
],
780791
'from_us' => [
781-
'method' => ['INTERNATIONAL_FIRST', 'INTERNATIONAL_ECONOMY', 'INTERNATIONAL_PRIORITY'],
792+
'method' => [
793+
'INTERNATIONAL_FIRST',
794+
'INTERNATIONAL_ECONOMY',
795+
'FEDEX_INTERNATIONAL_PRIORITY'
796+
],
782797
],
783798
],
784799
],
785800
[
786801
'containers' => ['FEDEX_10KG_BOX', 'FEDEX_25KG_BOX'],
787802
'filters' => [
788803
'within_us' => [],
789-
'from_us' => ['method' => ['INTERNATIONAL_PRIORITY']],
804+
'from_us' => ['method' => ['FEDEX_INTERNATIONAL_PRIORITY']],
790805
],
791806
],
792807
[
@@ -814,7 +829,8 @@ public function getCode($type, $code = ''): \Magento\Framework\Phrase|array|fals
814829
'method' => [
815830
'INTERNATIONAL_FIRST',
816831
'INTERNATIONAL_ECONOMY',
817-
'INTERNATIONAL_PRIORITY',
832+
'FEDEX_INTERNATIONAL_PRIORITY',
833+
'FEDEX_INTERNATIONAL_PRIORITY_EXPRESS',
818834
'INTERNATIONAL_GROUND',
819835
'FEDEX_FREIGHT',
820836
'FEDEX_1_DAY_FREIGHT',
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?php
2+
/**
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Fedex\Setup\Patch\Data;
9+
10+
use Magento\Framework\Setup\Patch\DataPatchInterface;
11+
use Magento\Framework\Setup\ModuleDataSetupInterface;
12+
use Magento\Framework\Setup\Patch\PatchVersionInterface;
13+
14+
class UpdateFedexInternationalPriority implements DataPatchInterface, PatchVersionInterface
15+
{
16+
/**
17+
* @var ModuleDataSetupInterface
18+
*/
19+
private $moduleDataSetup;
20+
21+
/**
22+
* UpdateFedexInternationalPriority constructor.
23+
* @param ModuleDataSetupInterface $moduleDataSetup
24+
*/
25+
public function __construct(
26+
ModuleDataSetupInterface $moduleDataSetup
27+
) {
28+
$this->moduleDataSetup = $moduleDataSetup;
29+
}
30+
31+
/**
32+
* @inheritdoc
33+
*
34+
* Apply the patch to update INTERNATIONAL_PRIORITY to FEDEX_INTERNATIONAL_PRIORITY
35+
*/
36+
public function apply()
37+
{
38+
$conn = $this->moduleDataSetup->getConnection();
39+
$configDataTable = $this->moduleDataSetup->getTable('core_config_data');
40+
$paths = [
41+
'carriers/fedex/allowed_methods',
42+
'carriers/fedex/free_method'
43+
];
44+
foreach ($paths as $path) {
45+
$select = $conn->select()
46+
->from($configDataTable)
47+
->where('path = ?', $path);
48+
$rows = $conn->fetchAll($select);
49+
foreach ($rows as $row) {
50+
$values = explode(',', $row['value']);
51+
$updated = false;
52+
foreach ($values as &$value) {
53+
if (trim($value) === 'INTERNATIONAL_PRIORITY') {
54+
$value = 'FEDEX_INTERNATIONAL_PRIORITY';
55+
$updated = true;
56+
}
57+
}
58+
unset($value);
59+
if ($updated) {
60+
$newValue = implode(',', $values);
61+
$conn->update(
62+
$configDataTable,
63+
['value' => $newValue],
64+
['config_id = ?' => $row['config_id']]
65+
);
66+
}
67+
}
68+
}
69+
70+
return $this;
71+
}
72+
73+
/**
74+
* @inheritdoc
75+
*/
76+
public static function getDependencies()
77+
{
78+
return [
79+
ConfigureFedexDefaults::class
80+
];
81+
}
82+
83+
/**
84+
* @inheritdoc
85+
*/
86+
public static function getVersion()
87+
{
88+
return '2.0.1';
89+
}
90+
91+
/**
92+
* @inheritdoc
93+
*/
94+
public function getAliases()
95+
{
96+
return [];
97+
}
98+
}

app/code/Magento/Fedex/Test/Unit/Model/CarrierTest.php

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,75 @@ public function testGetTracking($tracking, $shipTimeStamp, $expectedDate, $expec
995995
$this->assertEquals($expectedTime, $event['deliverytime']);
996996
}
997997

998+
/**
999+
* Test getCode with invalid type
1000+
*/
1001+
public function testGetCodeWithInvalidType(): void
1002+
{
1003+
$result = $this->carrier->getCode('invalid_type');
1004+
$this->assertFalse($result, 'Should return false for invalid type');
1005+
}
1006+
1007+
/**
1008+
* Test getCode with valid type and no code (returns all codes)
1009+
*/
1010+
public function testGetCodeWithValidTypeNoCode(): void
1011+
{
1012+
$result = $this->carrier->getCode('method');
1013+
$this->assertIsArray($result, 'Should return array of all method codes');
1014+
$this->assertArrayHasKey('FEDEX_INTERNATIONAL_PRIORITY', $result);
1015+
$this->assertArrayHasKey('FEDEX_INTERNATIONAL_PRIORITY_EXPRESS', $result);
1016+
$this->assertEquals(__('International Priority'), $result['FEDEX_INTERNATIONAL_PRIORITY']);
1017+
}
1018+
1019+
/**
1020+
* Test getCode with valid type and valid code
1021+
*/
1022+
public function testGetCodeWithValidTypeAndCode(): void
1023+
{
1024+
$result = $this->carrier->getCode('method', 'FEDEX_INTERNATIONAL_PRIORITY');
1025+
$this->assertInstanceOf(
1026+
\Magento\Framework\Phrase::class,
1027+
$result,
1028+
'Should return Phrase object for valid method code'
1029+
);
1030+
$this->assertEquals('International Priority', $result->getText());
1031+
}
1032+
1033+
/**
1034+
* Test getCode with valid type and invalid code
1035+
*/
1036+
public function testGetCodeWithValidTypeAndInvalidCode(): void
1037+
{
1038+
$result = $this->carrier->getCode('method', 'INVALID_CODE');
1039+
$this->assertFalse($result);
1040+
}
1041+
1042+
/**
1043+
* Test getCode with packaging type
1044+
*/
1045+
public function testGetCodeWithPackagingType(): void
1046+
{
1047+
$result = $this->carrier->getCode('packaging', 'FEDEX_ENVELOPE');
1048+
$this->assertInstanceOf(
1049+
\Magento\Framework\Phrase::class,
1050+
$result,
1051+
'Should return Phrase object for valid packaging code'
1052+
);
1053+
$this->assertEquals('FedEx Envelope', $result->getText());
1054+
}
1055+
1056+
/**
1057+
* Test getCode with dropoff type and empty code
1058+
*/
1059+
public function testGetCodeWithDropoffTypeNoCode(): void
1060+
{
1061+
$result = $this->carrier->getCode('dropoff');
1062+
$this->assertIsArray($result, 'Should return array of all dropoff codes');
1063+
$this->assertArrayHasKey('REGULAR_PICKUP', $result);
1064+
$this->assertEquals(__('Regular Pickup'), $result['REGULAR_PICKUP']);
1065+
}
1066+
9981067
/**
9991068
* Gets list of variations for testing ship date.
10001069
*
@@ -1065,7 +1134,7 @@ public static function shipDateDataProvider(): array
10651134
],
10661135
'tracking8' => [
10671136
'tracking8',
1068-
'shipTimestamp' => '2024-09-19T02:06:35+03:00',
1137+
'shipTimeStamp' => '2024-09-19T02:06:35+03:00',
10691138
'expectedDate' => '2024-09-21',
10701139
'18:31:00',
10711140
true

app/code/Magento/Fedex/etc/config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<shipment_requesttype>0</shipment_requesttype>
2222
<active>0</active>
2323
<sallowspecific>0</sallowspecific>
24-
<allowed_methods>EUROPE_FIRST_INTERNATIONAL_PRIORITY,FEDEX_1_DAY_FREIGHT,FEDEX_2_DAY_FREIGHT,FEDEX_2_DAY,FEDEX_2_DAY_AM,FEDEX_3_DAY_FREIGHT,FEDEX_EXPRESS_SAVER,FEDEX_GROUND,FIRST_OVERNIGHT,GROUND_HOME_DELIVERY,INTERNATIONAL_ECONOMY,INTERNATIONAL_ECONOMY_FREIGHT,INTERNATIONAL_FIRST,INTERNATIONAL_GROUND,INTERNATIONAL_PRIORITY,INTERNATIONAL_PRIORITY_FREIGHT,PRIORITY_OVERNIGHT,SMART_POST,STANDARD_OVERNIGHT,FEDEX_FREIGHT,FEDEX_NATIONAL_FREIGHT</allowed_methods>
24+
<allowed_methods>EUROPE_FIRST_INTERNATIONAL_PRIORITY,FEDEX_1_DAY_FREIGHT,FEDEX_2_DAY_FREIGHT,FEDEX_2_DAY,FEDEX_2_DAY_AM,FEDEX_3_DAY_FREIGHT,FEDEX_EXPRESS_SAVER,FEDEX_GROUND,FIRST_OVERNIGHT,GROUND_HOME_DELIVERY,INTERNATIONAL_ECONOMY,INTERNATIONAL_ECONOMY_FREIGHT,INTERNATIONAL_FIRST,INTERNATIONAL_GROUND,FEDEX_INTERNATIONAL_PRIORITY,FEDEX_INTERNATIONAL_PRIORITY_EXPRESS,FEDEX_FIRST,FEDEX_PRIORITY,FEDEX_PRIORITY_EXPRESS,FEDEX_PRIORITY_EXPRESS_FREIGHT,FEDEX_PRIORITY_FREIGHT,FEDEX_ECONOMY_SELECT,INTERNATIONAL_PRIORITY_FREIGHT,PRIORITY_OVERNIGHT,SMART_POST,STANDARD_OVERNIGHT,FEDEX_FREIGHT,FEDEX_NATIONAL_FREIGHT</allowed_methods>
2525
<cutoff_cost />
2626
<dropoff>REGULAR_PICKUP</dropoff>
2727
<free_method>FEDEX_GROUND</free_method>

app/code/Magento/Fedex/i18n/en_US.csv

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ Ground,Ground
1313
"International First","International First"
1414
"International Ground","International Ground"
1515
"International Priority","International Priority"
16+
"International Priority Express","International Priority Express"
17+
"First", "First"
18+
"Priority", "Priority"
19+
"Priority Express", "Priority Express"
20+
"Priority Express Freight", "Priority Express Freight"
21+
"Priority Freight", "Priority Freight"
22+
"Economy Select", "Economy Select"
1623
"Intl Priority Freight","Intl Priority Freight"
1724
"Priority Overnight","Priority Overnight"
1825
"Smart Post","Smart Post"

dev/tests/api-functional/_files/Magento/TestModuleFedex/_files/mock_rest_response_general_ca.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@
395395
}
396396
},
397397
{
398-
"serviceType": "INTERNATIONAL_PRIORITY",
398+
"serviceType": "FEDEX_INTERNATIONAL_PRIORITY",
399399
"serviceName": "International Priority",
400400
"packagingType": "YOUR_PACKAGING",
401401
"ratedShipmentDetails": [
@@ -480,7 +480,7 @@
480480
"signatureOptionType": "SERVICE_DEFAULT",
481481
"serviceDescription": {
482482
"serviceId": "EP1000000141",
483-
"serviceType": "INTERNATIONAL_PRIORITY",
483+
"serviceType": "FEDEX_INTERNATIONAL_PRIORITY",
484484
"names": [
485485
{
486486
"type": "long",
@@ -526,4 +526,4 @@
526526
"quoteDate": "2023-08-14",
527527
"encoded": false
528528
}
529-
}
529+
}

dev/tests/api-functional/testsuite/Magento/GraphQl/FedEx/SetFedExShippingMethodsOnCartTest.php

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

@@ -25,7 +25,7 @@
2525
* | FEDEX_2_DAY | 2 Day
2626
* | FIRST_OVERNIGHT | First Overnight
2727
* | INTERNATIONAL_ECONOMY |International Economy
28-
* | INTERNATIONAL_PRIORITY | International Priority
28+
* | FEDEX_INTERNATIONAL_PRIORITY | International Priority
2929
*/
3030
class SetFedExShippingMethodsOnCartTest extends GraphQlAbstract
3131
{
@@ -170,7 +170,7 @@ public static function dataProviderShippingMethodsBasedOnCanadaAddress(): array
170170
return [
171171
'Ground' => ['FEDEX_GROUND', 'Ground'],
172172
'International Economy' => ['INTERNATIONAL_ECONOMY', 'International Economy'],
173-
'International Priority' => ['INTERNATIONAL_PRIORITY', 'International Priority'],
173+
'International Priority' => ['FEDEX_INTERNATIONAL_PRIORITY', 'International Priority'],
174174
];
175175
}
176176

dev/tests/integration/testsuite/Magento/Fedex/Model/CarrierTest.php

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

77
namespace Magento\Fedex\Model;
@@ -38,7 +38,7 @@ public function testGetCode($type, $expectedCount)
3838
public static function getCodeDataProvider()
3939
{
4040
return [
41-
['method', 21],
41+
['method', 28],
4242
['dropoff', 5],
4343
['packaging', 7],
4444
['containers_filter', 4],

0 commit comments

Comments
 (0)