You are here

abstract public function ProraterBase::prorateOrderItem in Commerce Recurring Framework 8

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:

if (in_array($order_item
  ->bundle(), commerce_recurring_order_item_types())) {

  // This is a recurring order item.
}
else {

  // This is an initial order item.
}

Parameters

\Drupal\commerce_order\Entity\OrderItemInterface $order_item: The order item.

\Drupal\commerce_recurring\BillingPeriod $billing_period: The partial billing period.

\Drupal\commerce_recurring\BillingPeriod $full_billing_period: The full billing period.

Return value

\Drupal\commerce_price\Price The prorated price.

Overrides ProraterInterface::prorateOrderItem

2 methods override ProraterBase::prorateOrderItem()
FullPrice::prorateOrderItem in src/Plugin/Commerce/Prorater/FullPrice.php
Prorates the given order item.
Proportional::prorateOrderItem in src/Plugin/Commerce/Prorater/Proportional.php
Prorates the given order item.

File

src/Plugin/Commerce/Prorater/ProraterBase.php, line 42

Class

ProraterBase
Defines the prorater class.

Namespace

Drupal\commerce_recurring\Plugin\Commerce\Prorater

Code

public abstract function prorateOrderItem(OrderItemInterface $order_item, BillingPeriod $partial_period, BillingPeriod $period);