Commit bce5b99a authored by Cameron Prince's avatar Cameron Prince
Browse files

Issue #3285433: Undefined property:...

Issue #3285433: Undefined property: Drupal\commerce_printful\Service\OrderIntegrator::$priceExchangerCalculator
parent a0a1bd80
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ services:
  # Order integrator service.
  commerce_printful.order_integrator:
    class: Drupal\commerce_printful\Service\OrderIntegrator
    arguments: ['@commerce_printful.printful', '@logger.factory']
    arguments: ['@commerce_printful.printful', '@logger.factory', '@commerce_currency_resolver.calculator']

  commerce_printful.order_subscriber:
    class: Drupal\commerce_printful\EventSubscriber\OrderEventSubscriber
+1 −1
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ trait OrderItemsTrait {
            $totalPrice = $orderItem->getTotalPrice();

            // Convert currency to Printful default if required.
            if ($totalPrice->getCurrencyCode() !== $pf_currency) {
            if (isset($pf_currency) && $totalPrice->getCurrencyCode() !== $pf_currency) {
              $totalPrice = $this->priceExchangerCalculator->priceConversion($totalPrice, $pf_currency);
            }
            $item['name'] = $orderItem->label();
+15 −3
Original line number Diff line number Diff line
@@ -2,12 +2,13 @@

namespace Drupal\commerce_printful\Service;

use Drupal\commerce_printful\OrderItemsTrait;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Drupal\commerce_printful\Entity\PrintfulStoreInterface;
use Drupal\commerce_currency_resolver\PriceExchangerCalculator;
use Drupal\commerce_order\Entity\OrderInterface;
use Drupal\commerce_printful\Entity\PrintfulStoreInterface;
use Drupal\commerce_printful\Exception\PrintfulException;
use Drupal\commerce_printful\OrderItemsTrait;

/**
 * Printful order integration service implementation.
@@ -38,6 +39,13 @@ class OrderIntegrator implements OrderIntegratorInterface {
   */
  protected $logger;

  /**
   * The Price Exchanger Calculator.
   *
   * @var \Drupal\commerce_currency_resolver\PriceExchangerCalculator
   */
  protected $priceExchangerCalculator;

  /**
   * Constructor.
   *
@@ -45,13 +53,17 @@ class OrderIntegrator implements OrderIntegratorInterface {
   *   The printful API service.
   * @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $logger_factory
   *   The logger factory.
   * @param \Drupal\commerce_currency_resolver\PriceExchangerCalculator $price_exchanger_calculator
   *   The Price exchange calculator service.
   */
  public function __construct(
    Printful $pf,
    LoggerChannelFactoryInterface $logger_factory
    LoggerChannelFactoryInterface $logger_factory,
    PriceExchangerCalculator $price_exchanger_calculator
  ) {
    $this->pf = $pf;
    $this->logger = $logger_factory->get('commerce_printful');
    $this->priceExchangerCalculator = $price_exchanger_calculator;
  }

  /**