110 \
Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory,
111 \Psr\Log\LoggerInterface
$logger,
114 parent::__construct(
$data);
115 $this->_scopeConfig = $scopeConfig;
116 $this->_rateErrorFactory = $rateErrorFactory;
128 if (empty($this->_code)) {
131 $path =
'carriers/' . $this->_code .
'/' . $field;
133 return $this->_scopeConfig->getValue(
135 \
Magento\Store\Model\ScopeInterface::SCOPE_STORE,
150 if (empty($this->_code)) {
153 $path =
'carriers/' . $this->_code .
'/' . $field;
155 return $this->_scopeConfig->isSetFlag(
157 \
Magento\Store\Model\ScopeInterface::SCOPE_STORE,
172 return new \Magento\Framework\DataObject();
185 return new \Magento\Framework\DataObject();
210 $containersAll = $this->getContainerTypesAll();
211 if (empty($containersAll)) {
215 return $containersAll;
217 $containersFilter = $this->getContainerTypesFilter();
218 $containersFiltered = [];
220 $countryShipper =
$params->getCountryShipper();
221 $countryRecipient =
$params->getCountryRecipient();
223 if (empty($containersFilter)) {
224 return $containersAll;
226 if (!
$params || !
$method || !$countryShipper || !$countryRecipient) {
227 return $containersAll;
230 if ($countryShipper == self::USA_COUNTRY_ID && $countryRecipient == self::USA_COUNTRY_ID) {
231 $direction =
'within_us';
233 if ($countryShipper == self::USA_COUNTRY_ID && $countryRecipient != self::USA_COUNTRY_ID) {
234 $direction =
'from_us';
236 return $containersAll;
240 foreach ($containersFilter as $dataItem) {
245 if (!empty($containersAll[$container])) {
246 $containersFiltered[$container] = $containersAll[$container];
252 return !empty($containersFiltered) ? $containersFiltered : $containersAll;
288 if ($speCountriesAllow && $speCountriesAllow == 1) {
290 $availableCountries = [];
292 $availableCountries = explode(
',', $this->
getConfigData(
'specificcountry'));
294 if ($availableCountries && in_array(
$request->getDestCountryId(), $availableCountries)) {
296 }
elseif ($showMethod && (!$availableCountries || $availableCountries && !in_array(
302 $error = $this->_rateErrorFactory->create();
303 $error->setCarrier($this->_code);
306 $error->setErrorMessage(
307 $errorMsg ? $errorMsg :
__(
308 'Sorry, but we can\'t deliver to the destination country with this shipping module.' 360 return $active == 1 || $active ==
'true';
424 if (is_object($this->_result)) {
425 foreach ($this->_result->getAllRates() as
$i =>
$item) {
426 if (
$item->getMethod() == $freeMethod) {
433 if ($freeRateId ===
false) {
437 if (
$request->getFreeMethodWeight() > 0) {
438 $this->_setFreeMethodRequest($freeMethod);
442 if (count(
$rates) == 1 &&
$rates[0] instanceof \Magento\Quote\Model\Quote\Address\RateResult\Method) {
448 $rate->getMethod() == $freeMethod
467 $this->_result->getRateById($freeRateId)->setPrice(
$price);
481 if (!$handlingType) {
485 if (!$handlingAction) {
510 if ($handlingType == self::HANDLING_TYPE_PERCENT) {
527 if ($handlingType == self::HANDLING_TYPE_PERCENT) {
528 return $cost * $this->_numBoxes + $cost * $this->_numBoxes * $handlingFee / 100;
531 return $cost * $this->_numBoxes + $handlingFee;
545 $this->_numBoxes = 1;
546 $maxPackageWeight = $this->
getConfigData(
'max_package_weight');
547 if ($weight > $maxPackageWeight && $maxPackageWeight != 0) {
548 $this->_numBoxes = ceil($weight / $maxPackageWeight);
596 $this->_logger->debug(var_export($debugData,
true));
620 $this->
_debug($debugData);
666 $xml = new \SimpleXMLElement(
$data);
667 $this->filterXmlData($xml);
668 $data = $xml->asXML();
669 }
catch (\Exception $e) {
679 private function filterXmlData(\SimpleXMLElement $xml)
682 foreach ($xml->children() as $child) {
683 if ($child->count()) {
684 $this->filterXmlData($child);
getDeliveryConfirmationTypes(\Magento\Framework\DataObject $params=null)
_getPerpackagePrice($cost, $handlingType, $handlingFee)
getContainerTypes(\Magento\Framework\DataObject $params=null)
elseif(isset( $params[ 'redirect_parent']))
_getPerorderPrice($cost, $handlingType, $handlingFee)
const HANDLING_ACTION_PERPACKAGE
getTotalNumOfBoxes($weight)
returnOfShipment($request)
const HANDLING_ACTION_PERORDER
const HANDLING_TYPE_FIXED
__construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, \Psr\Log\LoggerInterface $logger, array $data=[])
isShippingLabelsAvailable()
$_customizableContainerTypes
isZipCodeRequired($countryId=null)
getFinalPriceWithHandlingFee($cost)
_getAllowedContainers(\Magento\Framework\DataObject $params=null)
processAdditionalValidation(\Magento\Framework\DataObject $request)
requestToShipment($request)
_updateFreeMethodQuote($request)
checkAvailableShipCountries(\Magento\Framework\DataObject $request)
isStateProvinceRequired()
const HANDLING_TYPE_PERCENT
$_debugReplacePrivateDataKeys
getCustomizableContainerTypes()
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
proccessAdditionalValidation(\Magento\Framework\DataObject $request)
getContentTypes(\Magento\Framework\DataObject $params)