You are here

interface OrderRefreshInterface in Commerce Core 8.2

Runs order refresh on draft orders.

Hierarchy

Expanded class hierarchy of OrderRefreshInterface

All classes that implement OrderRefreshInterface

File

modules/order/src/OrderRefreshInterface.php, line 10

Namespace

Drupal\commerce_order
View source
interface OrderRefreshInterface {

  /**
   * Adds an order preprocessor.
   *
   * @param \Drupal\commerce_order\OrderPreprocessorInterface $processor
   *   The order preprocessor.
   */
  public function addPreprocessor(OrderPreprocessorInterface $processor);

  /**
   * Adds an order processor.
   *
   * @param \Drupal\commerce_order\OrderProcessorInterface $processor
   *   The order processor.
   */
  public function addProcessor(OrderProcessorInterface $processor);

  /**
   * Checks whether the order should be refreshed.
   *
   * Wraps the needsRefresh() check with an additional refresh mode check,
   * skipping the refresh for non-customers when specified.
   *
   * @param \Drupal\commerce_order\Entity\OrderInterface $order
   *   The order.
   *
   * @return bool
   *   TRUE if the order should be refreshed, FALSE otherwise.
   */
  public function shouldRefresh(OrderInterface $order);

  /**
   * Checks whether the given order needs to be refreshed.
   *
   * An order needs to be refreshed:
   * - If a refresh was explicitly requested via $order->setNeedsRefresh() due
   *   to the order being modified.
   * - If it was not refreshed today (date changes can affect tax rate amounts,
   *   promotion availability)
   * - If it was not refreshed for longer than the refresh frequency.
   *
   * @param \Drupal\commerce_order\Entity\OrderInterface $order
   *   The order.
   *
   * @return bool
   *   TRUE if the order needs to be refreshed, FALSE otherwise.
   */
  public function needsRefresh(OrderInterface $order);

  /**
   * Refreshes the given order.
   *
   * Any modified order items will be automatically saved.
   * The order itself will not be saved.
   *
   * @param \Drupal\commerce_order\Entity\OrderInterface $order
   *   The order.
   */
  public function refresh(OrderInterface $order);

}

Members

Namesort descending Modifiers Type Description Overrides
OrderRefreshInterface::addPreprocessor public function Adds an order preprocessor. 1
OrderRefreshInterface::addProcessor public function Adds an order processor. 1
OrderRefreshInterface::needsRefresh public function Checks whether the given order needs to be refreshed. 1
OrderRefreshInterface::refresh public function Refreshes the given order. 1
OrderRefreshInterface::shouldRefresh public function Checks whether the order should be refreshed. 1