AbstractCarrierOnline.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Shipping\Model\Carrier;
  7. use Magento\Framework\Exception\LocalizedException;
  8. use Magento\Quote\Model\Quote\Address\RateRequest;
  9. use Magento\Quote\Model\Quote\Address\RateResult\Error;
  10. use Magento\Shipping\Model\Shipment\Request;
  11. use Magento\Framework\Xml\Security;
  12. /**
  13. * Abstract online shipping carrier model
  14. *
  15. * @api
  16. * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
  17. * @since 100.0.2
  18. */
  19. abstract class AbstractCarrierOnline extends AbstractCarrier
  20. {
  21. const USA_COUNTRY_ID = 'US';
  22. const PUERTORICO_COUNTRY_ID = 'PR';
  23. const GUAM_COUNTRY_ID = 'GU';
  24. const GUAM_REGION_CODE = 'GU';
  25. /**
  26. * Array of quotes
  27. *
  28. * @var array
  29. */
  30. protected static $_quotesCache = [];
  31. /**
  32. * Flag for check carriers for activity
  33. *
  34. * @var string
  35. */
  36. protected $_activeFlag = 'active';
  37. /**
  38. * Directory data
  39. *
  40. * @var \Magento\Directory\Helper\Data
  41. */
  42. protected $_directoryData = null;
  43. /**
  44. * @var \Magento\Shipping\Model\Simplexml\ElementFactory
  45. */
  46. protected $_xmlElFactory;
  47. /**
  48. * @var \Magento\Shipping\Model\Rate\ResultFactory
  49. */
  50. protected $_rateFactory;
  51. /**
  52. * @var \Magento\Quote\Model\Quote\Address\RateResult\MethodFactory
  53. */
  54. protected $_rateMethodFactory;
  55. /**
  56. * @var \Magento\Shipping\Model\Tracking\ResultFactory
  57. */
  58. protected $_trackFactory;
  59. /**
  60. * @var \Magento\Shipping\Model\Tracking\Result\ErrorFactory
  61. */
  62. protected $_trackErrorFactory;
  63. /**
  64. * @var \Magento\Shipping\Model\Tracking\Result\StatusFactory
  65. */
  66. protected $_trackStatusFactory;
  67. /**
  68. * @var \Magento\Directory\Model\RegionFactory
  69. */
  70. protected $_regionFactory;
  71. /**
  72. * @var \Magento\Directory\Model\CountryFactory
  73. */
  74. protected $_countryFactory;
  75. /**
  76. * @var \Magento\Directory\Model\CurrencyFactory
  77. */
  78. protected $_currencyFactory;
  79. /**
  80. * @var \Magento\CatalogInventory\Api\StockRegistryInterface
  81. */
  82. protected $stockRegistry;
  83. /**
  84. * Raw rate request data
  85. *
  86. * @var \Magento\Framework\DataObject|null
  87. */
  88. protected $_rawRequest = null;
  89. /**
  90. * The security scanner XML document
  91. *
  92. * @var Security
  93. */
  94. protected $xmlSecurity;
  95. /**
  96. * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
  97. * @param \Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory
  98. * @param \Psr\Log\LoggerInterface $logger
  99. * @param Security $xmlSecurity
  100. * @param \Magento\Shipping\Model\Simplexml\ElementFactory $xmlElFactory
  101. * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory
  102. * @param \Magento\Quote\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory
  103. * @param \Magento\Shipping\Model\Tracking\ResultFactory $trackFactory
  104. * @param \Magento\Shipping\Model\Tracking\Result\ErrorFactory $trackErrorFactory
  105. * @param \Magento\Shipping\Model\Tracking\Result\StatusFactory $trackStatusFactory
  106. * @param \Magento\Directory\Model\RegionFactory $regionFactory
  107. * @param \Magento\Directory\Model\CountryFactory $countryFactory
  108. * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory
  109. * @param \Magento\Directory\Helper\Data $directoryData
  110. * @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry
  111. * @param array $data
  112. *
  113. * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  114. */
  115. public function __construct(
  116. \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
  117. \Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory,
  118. \Psr\Log\LoggerInterface $logger,
  119. Security $xmlSecurity,
  120. \Magento\Shipping\Model\Simplexml\ElementFactory $xmlElFactory,
  121. \Magento\Shipping\Model\Rate\ResultFactory $rateFactory,
  122. \Magento\Quote\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory,
  123. \Magento\Shipping\Model\Tracking\ResultFactory $trackFactory,
  124. \Magento\Shipping\Model\Tracking\Result\ErrorFactory $trackErrorFactory,
  125. \Magento\Shipping\Model\Tracking\Result\StatusFactory $trackStatusFactory,
  126. \Magento\Directory\Model\RegionFactory $regionFactory,
  127. \Magento\Directory\Model\CountryFactory $countryFactory,
  128. \Magento\Directory\Model\CurrencyFactory $currencyFactory,
  129. \Magento\Directory\Helper\Data $directoryData,
  130. \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry,
  131. array $data = []
  132. ) {
  133. $this->_xmlElFactory = $xmlElFactory;
  134. $this->_rateFactory = $rateFactory;
  135. $this->_rateMethodFactory = $rateMethodFactory;
  136. $this->_trackFactory = $trackFactory;
  137. $this->_trackErrorFactory = $trackErrorFactory;
  138. $this->_trackStatusFactory = $trackStatusFactory;
  139. $this->_regionFactory = $regionFactory;
  140. $this->_countryFactory = $countryFactory;
  141. $this->_currencyFactory = $currencyFactory;
  142. $this->_directoryData = $directoryData;
  143. $this->stockRegistry = $stockRegistry;
  144. parent::__construct($scopeConfig, $rateErrorFactory, $logger, $data);
  145. $this->xmlSecurity = $xmlSecurity;
  146. }
  147. /**
  148. * Set flag for check carriers for activity
  149. *
  150. * @param string $code
  151. * @return $this
  152. * @api
  153. */
  154. public function setActiveFlag($code = 'active')
  155. {
  156. $this->_activeFlag = $code;
  157. return $this;
  158. }
  159. /**
  160. * Return code of carrier
  161. *
  162. * @return string|null
  163. */
  164. public function getCarrierCode()
  165. {
  166. return $this->_code ?? null;
  167. }
  168. /**
  169. * Get tracking information
  170. *
  171. * @param string $tracking
  172. * @return string|false
  173. * @api
  174. */
  175. public function getTrackingInfo($tracking)
  176. {
  177. $result = $this->getTracking($tracking);
  178. if ($result instanceof \Magento\Shipping\Model\Tracking\Result) {
  179. $trackings = $result->getAllTrackings();
  180. if ($trackings) {
  181. return $trackings[0];
  182. }
  183. } elseif (is_string($result) && !empty($result)) {
  184. return $result;
  185. }
  186. return false;
  187. }
  188. /**
  189. * Check if carrier has shipping tracking option available
  190. *
  191. * All \Magento\Usa carriers have shipping tracking option available
  192. *
  193. * @return boolean
  194. */
  195. public function isTrackingAvailable()
  196. {
  197. return true;
  198. }
  199. /**
  200. * Check if city option required
  201. *
  202. * @return boolean
  203. */
  204. public function isCityRequired()
  205. {
  206. return true;
  207. }
  208. /**
  209. * Determine whether zip-code is required for the country of destination
  210. *
  211. * @param string|null $countryId
  212. * @return bool
  213. */
  214. public function isZipCodeRequired($countryId = null)
  215. {
  216. if ($countryId != null) {
  217. return !$this->_directoryData->isZipCodeOptional($countryId);
  218. }
  219. return true;
  220. }
  221. /**
  222. * Check if carrier has shipping label option available
  223. *
  224. * @return boolean
  225. */
  226. public function isShippingLabelsAvailable()
  227. {
  228. return true;
  229. }
  230. /**
  231. * Return items for further shipment rate evaluation. We need to pass children of a bundle instead passing the
  232. * bundle itself, otherwise we may not get a rate at all (e.g. when total weight of a bundle exceeds max weight
  233. * despite each item by itself is not)
  234. *
  235. * @param RateRequest $request
  236. * @return array
  237. * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  238. * @api
  239. */
  240. public function getAllItems(RateRequest $request)
  241. {
  242. $items = [];
  243. if ($request->getAllItems()) {
  244. foreach ($request->getAllItems() as $item) {
  245. /* @var $item \Magento\Quote\Model\Quote\Item */
  246. if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
  247. // Don't process children here - we will process (or already have processed) them below
  248. continue;
  249. }
  250. if ($item->getHasChildren() && $item->isShipSeparately()) {
  251. foreach ($item->getChildren() as $child) {
  252. if (!$child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
  253. $items[] = $child;
  254. }
  255. }
  256. } else {
  257. // Ship together - count compound item as one solid
  258. $items[] = $item;
  259. }
  260. }
  261. }
  262. return $items;
  263. }
  264. /**
  265. * Processing additional validation to check if carrier applicable.
  266. *
  267. * @param \Magento\Framework\DataObject $request
  268. * @return $this|bool|\Magento\Framework\DataObject
  269. * @deprecated 100.2.6
  270. * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  271. * @SuppressWarnings(PHPMD.NPathComplexity)
  272. */
  273. public function proccessAdditionalValidation(\Magento\Framework\DataObject $request)
  274. {
  275. return $this->processAdditionalValidation($request);
  276. }
  277. /**
  278. * Processing additional validation to check if carrier applicable.
  279. *
  280. * @param \Magento\Framework\DataObject $request
  281. * @return $this|bool|\Magento\Framework\DataObject
  282. * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  283. * @SuppressWarnings(PHPMD.NPathComplexity)
  284. * @since 100.2.6
  285. */
  286. public function processAdditionalValidation(\Magento\Framework\DataObject $request)
  287. {
  288. //Skip by item validation if there is no items in request
  289. if (!count($this->getAllItems($request))) {
  290. return $this;
  291. }
  292. $maxAllowedWeight = (double)$this->getConfigData('max_package_weight');
  293. $errorMsg = '';
  294. $configErrorMsg = $this->getConfigData('specificerrmsg');
  295. $defaultErrorMsg = __('The shipping module is not available.');
  296. $showMethod = $this->getConfigData('showmethod');
  297. /** @var $item \Magento\Quote\Model\Quote\Item */
  298. foreach ($this->getAllItems($request) as $item) {
  299. $product = $item->getProduct();
  300. if ($product && $product->getId()) {
  301. $weight = $product->getWeight();
  302. $stockItemData = $this->stockRegistry->getStockItem(
  303. $product->getId(),
  304. $item->getStore()->getWebsiteId()
  305. );
  306. $doValidation = true;
  307. if ($stockItemData->getIsQtyDecimal() && $stockItemData->getIsDecimalDivided()) {
  308. if ($stockItemData->getEnableQtyIncrements() && $stockItemData->getQtyIncrements()
  309. ) {
  310. $weight = $weight * $stockItemData->getQtyIncrements();
  311. } else {
  312. $doValidation = false;
  313. }
  314. } elseif ($stockItemData->getIsQtyDecimal() && !$stockItemData->getIsDecimalDivided()) {
  315. $weight = $weight * $item->getQty();
  316. }
  317. if ($doValidation && $weight > $maxAllowedWeight) {
  318. $errorMsg = $configErrorMsg ? $configErrorMsg : $defaultErrorMsg;
  319. break;
  320. }
  321. }
  322. }
  323. if (!$errorMsg && !$request->getDestPostcode() && $this->isZipCodeRequired($request->getDestCountryId())) {
  324. $errorMsg = __('This shipping method is not available. Please specify the zip code.');
  325. }
  326. if ($errorMsg && $showMethod) {
  327. $error = $this->_rateErrorFactory->create();
  328. $error->setCarrier($this->_code);
  329. $error->setCarrierTitle($this->getConfigData('title'));
  330. $error->setErrorMessage($errorMsg);
  331. return $error;
  332. } elseif ($errorMsg) {
  333. return false;
  334. }
  335. return $this;
  336. }
  337. /**
  338. * Returns cache key for some request to carrier quotes service
  339. *
  340. * @param string|array $requestParams
  341. * @return string
  342. */
  343. protected function _getQuotesCacheKey($requestParams)
  344. {
  345. if (is_array($requestParams)) {
  346. $requestParams = implode(
  347. ',',
  348. array_merge([$this->getCarrierCode()], array_keys($requestParams), $requestParams)
  349. );
  350. }
  351. return crc32($requestParams);
  352. }
  353. /**
  354. * Checks whether some request to rates have already been done, so we have cache for it
  355. *
  356. * Used to reduce number of same requests done to carrier service during one session
  357. * Returns cached response or null
  358. *
  359. * @param string|array $requestParams
  360. * @return null|string
  361. */
  362. protected function _getCachedQuotes($requestParams)
  363. {
  364. $key = $this->_getQuotesCacheKey($requestParams);
  365. return self::$_quotesCache[$key] ?? null;
  366. }
  367. /**
  368. * Sets received carrier quotes to cache
  369. *
  370. * @param string|array $requestParams
  371. * @param string $response
  372. * @return $this
  373. */
  374. protected function _setCachedQuotes($requestParams, $response)
  375. {
  376. $key = $this->_getQuotesCacheKey($requestParams);
  377. self::$_quotesCache[$key] = $response;
  378. return $this;
  379. }
  380. /**
  381. * Prepare service name. Strip tags and entities from name
  382. *
  383. * @param string|object $name service name or object with implemented __toString() method
  384. * @return string prepared service name
  385. */
  386. protected function _prepareServiceName($name)
  387. {
  388. $name = html_entity_decode((string)$name);
  389. $name = strip_tags(preg_replace('#&\w+;#', '', $name));
  390. return trim($name);
  391. }
  392. /**
  393. * Prepare shipment request. Validate and correct request information
  394. *
  395. * @param \Magento\Framework\DataObject $request
  396. * @return void
  397. */
  398. protected function _prepareShipmentRequest(\Magento\Framework\DataObject $request)
  399. {
  400. $phonePattern = '/[\s\_\-\(\)]+/';
  401. $phoneNumber = $request->getShipperContactPhoneNumber();
  402. $phoneNumber = preg_replace($phonePattern, '', $phoneNumber);
  403. $request->setShipperContactPhoneNumber($phoneNumber);
  404. $phoneNumber = $request->getRecipientContactPhoneNumber();
  405. $phoneNumber = preg_replace($phonePattern, '', $phoneNumber);
  406. $request->setRecipientContactPhoneNumber($phoneNumber);
  407. }
  408. /**
  409. * Do request to shipment
  410. *
  411. * @param Request $request
  412. * @return \Magento\Framework\DataObject
  413. * @throws \Magento\Framework\Exception\LocalizedException
  414. */
  415. public function requestToShipment($request)
  416. {
  417. $packages = $request->getPackages();
  418. if (!is_array($packages) || !$packages) {
  419. throw new LocalizedException(__('No packages for request'));
  420. }
  421. if ($request->getStoreId() != null) {
  422. $this->setStore($request->getStoreId());
  423. }
  424. $data = [];
  425. foreach ($packages as $packageId => $package) {
  426. $request->setPackageId($packageId);
  427. $request->setPackagingType($package['params']['container']);
  428. $request->setPackageWeight($package['params']['weight']);
  429. $request->setPackageParams(new \Magento\Framework\DataObject($package['params']));
  430. $request->setPackageItems($package['items']);
  431. $result = $this->_doShipmentRequest($request);
  432. if ($result->hasErrors()) {
  433. $this->rollBack($data);
  434. break;
  435. } else {
  436. $data[] = [
  437. 'tracking_number' => $result->getTrackingNumber(),
  438. 'label_content' => $result->getShippingLabelContent(),
  439. ];
  440. }
  441. if (!isset($isFirstRequest)) {
  442. $request->setMasterTrackingId($result->getTrackingNumber());
  443. $isFirstRequest = false;
  444. }
  445. }
  446. $response = new \Magento\Framework\DataObject(['info' => $data]);
  447. if ($result->getErrors()) {
  448. $response->setErrors($result->getErrors());
  449. }
  450. return $response;
  451. }
  452. /**
  453. * Do request to RMA shipment
  454. *
  455. * @param Request $request
  456. * @return \Magento\Framework\DataObject
  457. * @throws \Magento\Framework\Exception\LocalizedException
  458. */
  459. public function returnOfShipment($request)
  460. {
  461. $request->setIsReturn(true);
  462. $packages = $request->getPackages();
  463. if (!is_array($packages) || !$packages) {
  464. throw new LocalizedException(__('No packages for request'));
  465. }
  466. if ($request->getStoreId() != null) {
  467. $this->setStore($request->getStoreId());
  468. }
  469. $data = [];
  470. foreach ($packages as $packageId => $package) {
  471. $request->setPackageId($packageId);
  472. $request->setPackagingType($package['params']['container']);
  473. $request->setPackageWeight($package['params']['weight']);
  474. $request->setPackageParams(new \Magento\Framework\DataObject($package['params']));
  475. $request->setPackageItems($package['items']);
  476. $result = $this->_doShipmentRequest($request);
  477. if ($result->hasErrors()) {
  478. $this->rollBack($data);
  479. break;
  480. } else {
  481. $data[] = [
  482. 'tracking_number' => $result->getTrackingNumber(),
  483. 'label_content' => $result->getShippingLabelContent(),
  484. ];
  485. }
  486. if (!isset($isFirstRequest)) {
  487. $request->setMasterTrackingId($result->getTrackingNumber());
  488. $isFirstRequest = false;
  489. }
  490. }
  491. $response = new \Magento\Framework\DataObject(['info' => $data]);
  492. if ($result->getErrors()) {
  493. $response->setErrors($result->getErrors());
  494. }
  495. return $response;
  496. }
  497. /**
  498. * For multi package shipments. Delete requested shipments if the current shipment. Request is failed
  499. *
  500. * @param array $data
  501. * @return bool
  502. *
  503. * @todo implement rollback logic
  504. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  505. * @api
  506. */
  507. public function rollBack($data)
  508. {
  509. return true;
  510. }
  511. /**
  512. * Do shipment request to carrier web service, obtain Print Shipping Labels and process errors in response
  513. *
  514. * @param \Magento\Framework\DataObject $request
  515. * @return \Magento\Framework\DataObject
  516. */
  517. abstract protected function _doShipmentRequest(\Magento\Framework\DataObject $request);
  518. /**
  519. * Check is Country U.S. Possessions and Trust Territories
  520. *
  521. * @param string $countyId
  522. * @return boolean
  523. */
  524. protected function _isUSCountry($countyId)
  525. {
  526. switch ($countyId) {
  527. case 'AS':
  528. // Samoa American
  529. case 'GU':
  530. // Guam
  531. case 'MP':
  532. // Northern Mariana Islands
  533. case 'PW':
  534. // Palau
  535. case 'PR':
  536. // Puerto Rico
  537. case 'VI':
  538. // Virgin Islands US
  539. case 'US':
  540. // United States
  541. return true;
  542. }
  543. return false;
  544. }
  545. /**
  546. * Check whether girth is allowed for the carrier
  547. *
  548. * @param null|string $countyDest
  549. * @param null|string $carrierMethodCode
  550. * @return bool
  551. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  552. * @api
  553. */
  554. public function isGirthAllowed($countyDest = null, $carrierMethodCode = null)
  555. {
  556. return false;
  557. }
  558. /**
  559. * Set Raw Request
  560. *
  561. * @param \Magento\Framework\DataObject|null $request
  562. * @return $this
  563. * @api
  564. */
  565. public function setRawRequest($request)
  566. {
  567. $this->_rawRequest = $request;
  568. return $this;
  569. }
  570. /**
  571. * Calculate price considering free shipping and handling fee
  572. *
  573. * @param string $cost
  574. * @param string $method
  575. * @return float|string
  576. * @api
  577. */
  578. public function getMethodPrice($cost, $method = '')
  579. {
  580. return $method == $this->getConfigData(
  581. $this->_freeMethod
  582. ) && $this->getConfigFlag(
  583. 'free_shipping_enable'
  584. ) && $this->getConfigData(
  585. 'free_shipping_subtotal'
  586. ) <= $this->_rawRequest->getBaseSubtotalInclTax() ? '0.00' : $this->getFinalPriceWithHandlingFee(
  587. $cost
  588. );
  589. }
  590. /**
  591. * Parse XML string and return XML document object or false
  592. *
  593. * @param string $xmlContent
  594. * @param string $customSimplexml
  595. * @return \SimpleXMLElement|bool
  596. * @throws LocalizedException
  597. *
  598. * @api
  599. */
  600. public function parseXml($xmlContent, $customSimplexml = 'SimpleXMLElement')
  601. {
  602. if (!$this->xmlSecurity->scan($xmlContent)) {
  603. throw new LocalizedException(__('The security validation of the XML document has failed.'));
  604. }
  605. $xmlElement = simplexml_load_string($xmlContent, $customSimplexml);
  606. return $xmlElement;
  607. }
  608. /**
  609. * Checks if shipping method can collect rates
  610. *
  611. * @return bool
  612. */
  613. public function canCollectRates()
  614. {
  615. return (bool)$this->getConfigFlag($this->_activeFlag);
  616. }
  617. /**
  618. * Debug errors if showmethod is unset
  619. *
  620. * @param Error $errors
  621. *
  622. * @return void
  623. */
  624. protected function debugErrors($errors)
  625. {
  626. if ($this->getConfigData('showmethod')) {
  627. /* @var $error Error */
  628. $this->_debug($errors);
  629. }
  630. }
  631. /**
  632. * Get error messages
  633. *
  634. * @return bool|Error
  635. */
  636. protected function getErrorMessage()
  637. {
  638. if ($this->getConfigData('showmethod')) {
  639. /* @var $error Error */
  640. $error = $this->_rateErrorFactory->create();
  641. $error->setCarrier($this->getCarrierCode());
  642. $error->setCarrierTitle($this->getConfigData('title'));
  643. $error->setErrorMessage($this->getConfigData('specificerrmsg'));
  644. return $error;
  645. } else {
  646. return false;
  647. }
  648. }
  649. }