You are here

interface ProraterInterface in Commerce Recurring Framework 8

Modifies unit prices to reflect partial billing periods.

For example, if the order's billing period is Jun 1st - Jul 1st, but the order item's billing period is Jun 1st - Jun 16th (because a plan change or a cancellation happened then), the order item's unit price should only be half of the usual price.

Hierarchy

Expanded class hierarchy of ProraterInterface

All classes that implement ProraterInterface

1 file declares its use of ProraterInterface
ProraterManager.php in src/ProraterManager.php

File

src/Plugin/Commerce/Prorater/ProraterInterface.php, line 19

Namespace

Drupal\commerce_recurring\Plugin\Commerce\Prorater
View source
interface ProraterInterface extends ConfigurableInterface, DependentPluginInterface, PluginFormInterface {

  /**
   * Prorates the given order item.
   *
   * When needed, the plugin can use separate logic for recurring and initial
   * order items by looking at the order item type:
   * @code
   * if (in_array($order_item->bundle(), commerce_recurring_order_item_types())) {
   *   // This is a recurring order item.
   * }
   * else {
   *   // This is an initial order item.
   * }
   * @endcode
   *
   * @param \Drupal\commerce_order\Entity\OrderItemInterface $order_item
   *   The order item.
   * @param \Drupal\commerce_recurring\BillingPeriod $billing_period
   *   The partial billing period.
   * @param \Drupal\commerce_recurring\BillingPeriod $full_billing_period
   *   The full billing period.
   *
   * @return \Drupal\commerce_price\Price
   *   The prorated price.
   */
  public function prorateOrderItem(OrderItemInterface $order_item, BillingPeriod $billing_period, BillingPeriod $full_billing_period);

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigurableInterface::defaultConfiguration public function Gets default configuration for this plugin. 11
ConfigurableInterface::getConfiguration public function Gets this plugin's configuration. 12
ConfigurableInterface::setConfiguration public function Sets the configuration for this plugin instance. 12
DependentPluginInterface::calculateDependencies public function Calculates dependencies for the configured plugin. 19
PluginFormInterface::buildConfigurationForm public function Form constructor. 36
PluginFormInterface::submitConfigurationForm public function Form submission handler. 32
PluginFormInterface::validateConfigurationForm public function Form validation handler. 18
ProraterInterface::prorateOrderItem public function Prorates the given order item. 1