RatesProcessor.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Refer to LICENSE.txt distributed with the Temando Shipping module for notice of license
  4. */
  5. namespace Temando\Shipping\Webservice\Processor\OrderOperation;
  6. use Magento\Quote\Model\Quote\Address\RateRequest;
  7. use Temando\Shipping\Api\Data\Order\ShippingExperienceInterface;
  8. use Temando\Shipping\Model\OrderInterface;
  9. use Temando\Shipping\Webservice\Response\Type\QualificationResponseType;
  10. /**
  11. * Temando Rates Processor.
  12. *
  13. * @package Temando\Shipping\Webservice
  14. * @author Christoph Aßmann <christoph.assmann@netresearch.de>
  15. * @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  16. * @link https://www.temando.com/
  17. */
  18. class RatesProcessor implements RatesProcessorInterface
  19. {
  20. /**
  21. * Extract shipping experiences from response.
  22. *
  23. * @param RateRequest $rateRequest
  24. * @param OrderInterface $requestType
  25. * @param QualificationResponseType $responseType
  26. * @return ShippingExperienceInterface[]
  27. */
  28. public function postProcess(
  29. RateRequest $rateRequest,
  30. OrderInterface $requestType,
  31. QualificationResponseType $responseType
  32. ) {
  33. if ($requestType->getCollectionPointSearchRequest() || $requestType->getPickupLocationSearchRequest()) {
  34. // ignore default recipient address experiences
  35. return [];
  36. }
  37. // experiences for default addresses
  38. return $responseType->getShippingExperiences();
  39. }
  40. }