File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
app/code/Magento/Usps/Model Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -318,7 +318,7 @@ public function _parseJsonResponse($response): Result
318
318
319
319
$ shippingCost = (float )$ method ['price ' ];
320
320
$ rate ->setCost ($ shippingCost );
321
- $ rate ->setPrice ($ this ->carrierModel ->getMethodPrice ($ shippingCost ));
321
+ $ rate ->setPrice ($ this ->carrierModel ->getMethodPrice ($ shippingCost, $ method [ ' code ' ] ));
322
322
323
323
/** @var Result $result */
324
324
$ result ->append ($ rate );
Original file line number Diff line number Diff line change 10
10
*/
11
11
class Freemethod extends Method
12
12
{
13
+ /**
14
+ * @param \Magento\Usps\Model\Carrier $shippingUsps
15
+ */
16
+ public function __construct (\Magento \Usps \Model \Carrier $ shippingUsps )
17
+ {
18
+ parent ::__construct ($ shippingUsps );
19
+ $ this ->code = $ this ->getUspsTypeMethodCode ();
20
+ }
21
+
22
+ /**
23
+ * Get dynamic code based on USPS type configuration
24
+ *
25
+ * @return string
26
+ */
27
+ private function getUspsTypeMethodCode (): string
28
+ {
29
+ $ uspsType = $ this ->shippingUsps ->getConfigData ('usps_type ' );
30
+
31
+ return match ($ uspsType ) {
32
+ 'USPS_REST ' => 'rest_method ' ,
33
+ default => 'method ' ,
34
+ };
35
+ }
13
36
/**
14
37
* @inheritDoc
15
38
*/
You can’t perform that action at this time.
0 commit comments