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
- interface \Drupal\Component\Plugin\ConfigurableInterface; interface \Drupal\Component\Plugin\DependentPluginInterface; interface \Drupal\Core\Plugin\PluginFormInterface
- interface \Drupal\commerce_recurring\Plugin\Commerce\Prorater\ProraterInterface
Expanded class hierarchy of ProraterInterface
All classes that implement ProraterInterface
1 file declares its use of ProraterInterface
File
- src/
Plugin/ Commerce/ Prorater/ ProraterInterface.php, line 19
Namespace
Drupal\commerce_recurring\Plugin\Commerce\ProraterView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigurableInterface:: |
public | function | Gets default configuration for this plugin. | 11 |
ConfigurableInterface:: |
public | function | Gets this plugin's configuration. | 12 |
ConfigurableInterface:: |
public | function | Sets the configuration for this plugin instance. | 12 |
DependentPluginInterface:: |
public | function | Calculates dependencies for the configured plugin. | 19 |
PluginFormInterface:: |
public | function | Form constructor. | 36 |
PluginFormInterface:: |
public | function | Form submission handler. | 32 |
PluginFormInterface:: |
public | function | Form validation handler. | 18 |
ProraterInterface:: |
public | function | Prorates the given order item. | 1 |