You are here

public function FullPrice::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 ProraterBase::prorateOrderItem

File

src/Plugin/Commerce/Prorater/FullPrice.php, line 21

Class

FullPrice
Provides a full price prorater.

Namespace

Drupal\commerce_recurring\Plugin\Commerce\Prorater

Code

public function prorateOrderItem(OrderItemInterface $order_item, BillingPeriod $billing_period, BillingPeriod $full_billing_period) {
  return $order_item
    ->getUnitPrice();
}