|
8 | 8 |
|
9 | 9 | namespace Magento\Usps\Model;
|
10 | 10 |
|
| 11 | +use Magento\Framework\App\ObjectManager; |
11 | 12 | use Magento\Quote\Model\Quote\Address\RateRequest;
|
12 | 13 | use Magento\Shipping\Helper\Carrier as CarrierHelper;
|
13 | 14 | use Magento\Shipping\Model\Carrier\AbstractCarrierOnline;
|
14 | 15 | use Magento\Shipping\Model\Rate\Result;
|
15 | 16 | use Magento\Framework\Xml\Security;
|
| 17 | +use Magento\Usps\Helper\Data as DataHelper; |
16 | 18 |
|
17 | 19 | /**
|
18 | 20 | * USPS shipping
|
@@ -128,6 +130,11 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C
|
128 | 130 | 'USERID'
|
129 | 131 | ];
|
130 | 132 |
|
| 133 | + /** |
| 134 | + * @var DataHelper |
| 135 | + */ |
| 136 | + private $dataHelper; |
| 137 | + |
131 | 138 | /**
|
132 | 139 | * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
|
133 | 140 | * @param \Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory
|
@@ -1982,11 +1989,13 @@ public function getDeliveryConfirmationTypes(\Magento\Framework\DataObject $para
|
1982 | 1989 | * Check whether girth is allowed for the USPS
|
1983 | 1990 | *
|
1984 | 1991 | * @param null|string $countyDest
|
| 1992 | + * @param null|string $carrierMethodCode |
1985 | 1993 | * @return bool
|
1986 | 1994 | */
|
1987 |
| - public function isGirthAllowed($countyDest = null) |
| 1995 | + public function isGirthAllowed($countyDest = null, $carrierMethodCode = null) |
1988 | 1996 | {
|
1989 |
| - return $this->_isUSCountry($countyDest) ? false : true; |
| 1997 | + return $this->_isUSCountry($countyDest) |
| 1998 | + && $this->getDataHelper()->displayGirthValue($carrierMethodCode) ? false : true; |
1990 | 1999 | }
|
1991 | 2000 |
|
1992 | 2001 | /**
|
@@ -2091,4 +2100,19 @@ protected function filterDebugData($data)
|
2091 | 2100 |
|
2092 | 2101 | return $data;
|
2093 | 2102 | }
|
| 2103 | + |
| 2104 | + /** |
| 2105 | + * Gets Data helper object |
| 2106 | + * |
| 2107 | + * @return DataHelper |
| 2108 | + * @deprecated |
| 2109 | + */ |
| 2110 | + private function getDataHelper() |
| 2111 | + { |
| 2112 | + if (!$this->dataHelper) { |
| 2113 | + $this->dataHelper = ObjectManager::getInstance()->get(DataHelper::class); |
| 2114 | + } |
| 2115 | + |
| 2116 | + return $this->dataHelper; |
| 2117 | + } |
2094 | 2118 | }
|
0 commit comments