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
318318
319319 $ shippingCost = (float )$ method ['price ' ];
320320 $ rate ->setCost ($ shippingCost );
321- $ rate ->setPrice ($ this ->carrierModel ->getMethodPrice ($ shippingCost ));
321+ $ rate ->setPrice ($ this ->carrierModel ->getMethodPrice ($ shippingCost, $ method [ ' code ' ] ));
322322
323323 /** @var Result $result */
324324 $ result ->append ($ rate );
Original file line number Diff line number Diff line change 1010 */
1111class Freemethod extends Method
1212{
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+ }
1336 /**
1437 * @inheritDoc
1538 */
You can’t perform that action at this time.
0 commit comments