Skip to content

Commit 171fcf0

Browse files
committed
ACP2E-3667: [Mainline ]Fedex International Priority unavailable.
1 parent ff86f62 commit 171fcf0

File tree

2 files changed

+92
-5
lines changed

2 files changed

+92
-5
lines changed

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

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,15 @@ public function getCode($type, $code = ''): \Magento\Framework\Phrase|array|fals
718718
'INTERNATIONAL_FIRST' => __('International First'),
719719
'INTERNATIONAL_GROUND' => __('International Ground'),
720720
'INTERNATIONAL_PRIORITY' => __('International Priority'),
721+
'FEDEX_INTERNATIONAL_PRIORITY' => __('FedEx International Priority'),
722+
'FEDEX_INTERNATIONAL_PRIORITY_EXPRESS' => __('FedEx International Priority Express'),
723+
'FEDEX_FIRST' => __('First'),
724+
'FEDEX_PRIORITY' => __('Priority'),
725+
'FEDEX_PRIORITY_EXPRESS' => __('Priority Express'),
726+
'FEDEX_PRIORITY_EXPRESS_FREIGHT' => __('Priority Express Freight'),
727+
'FEDEX_PRIORITY_FREIGHT' => __('Priority Freight'),
728+
'FEDEX_ECONOMY_SELECT' => __('Economy Select'),
729+
'PRIORITY_EXPRESS' => __('Priority Express'),
721730
'INTERNATIONAL_PRIORITY_FREIGHT' => __('Intl Priority Freight'),
722731
'PRIORITY_OVERNIGHT' => __('Priority Overnight'),
723732
'SMART_POST' => __('Smart Post'),
@@ -756,7 +765,11 @@ public function getCode($type, $code = ''): \Magento\Framework\Phrase|array|fals
756765
],
757766
],
758767
'from_us' => [
759-
'method' => ['INTERNATIONAL_FIRST', 'INTERNATIONAL_ECONOMY', 'INTERNATIONAL_PRIORITY'],
768+
'method' => [
769+
'INTERNATIONAL_FIRST',
770+
'INTERNATIONAL_ECONOMY',
771+
'FEDEX_INTERNATIONAL_PRIORITY'
772+
],
760773
],
761774
],
762775
],
@@ -778,15 +791,19 @@ public function getCode($type, $code = ''): \Magento\Framework\Phrase|array|fals
778791
],
779792
],
780793
'from_us' => [
781-
'method' => ['INTERNATIONAL_FIRST', 'INTERNATIONAL_ECONOMY', 'INTERNATIONAL_PRIORITY'],
794+
'method' => [
795+
'INTERNATIONAL_FIRST',
796+
'INTERNATIONAL_ECONOMY',
797+
'FEDEX_INTERNATIONAL_PRIORITY'
798+
],
782799
],
783800
],
784801
],
785802
[
786803
'containers' => ['FEDEX_10KG_BOX', 'FEDEX_25KG_BOX'],
787804
'filters' => [
788805
'within_us' => [],
789-
'from_us' => ['method' => ['INTERNATIONAL_PRIORITY']],
806+
'from_us' => ['method' => ['FEDEX_INTERNATIONAL_PRIORITY']],
790807
],
791808
],
792809
[
@@ -814,7 +831,8 @@ public function getCode($type, $code = ''): \Magento\Framework\Phrase|array|fals
814831
'method' => [
815832
'INTERNATIONAL_FIRST',
816833
'INTERNATIONAL_ECONOMY',
817-
'INTERNATIONAL_PRIORITY',
834+
'FEDEX_INTERNATIONAL_PRIORITY',
835+
'FEDEX_INTERNATIONAL_PRIORITY_EXPRESS',
818836
'INTERNATIONAL_GROUND',
819837
'FEDEX_FREIGHT',
820838
'FEDEX_1_DAY_FREIGHT',

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(__('FedEx 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('FedEx 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

0 commit comments

Comments
 (0)