interface AdjustmentTransformerInterface in Commerce Core 8.2
Provides common logic for processing and transforming adjustments.
Hierarchy
- interface \Drupal\commerce_order\AdjustmentTransformerInterface
Expanded class hierarchy of AdjustmentTransformerInterface
All classes that implement AdjustmentTransformerInterface
File
- modules/
order/ src/ AdjustmentTransformerInterface.php, line 8
Namespace
Drupal\commerce_orderView source
interface AdjustmentTransformerInterface {
/**
* Combines, sorts, and rounds the given adjustments.
*
* @param \Drupal\commerce_order\Adjustment[] $adjustments
* The adjustments.
*
* @return \Drupal\commerce_order\Adjustment[]
* The processed adjustments.
*/
public function processAdjustments(array $adjustments);
/**
* Combines adjustments with the same type and source ID.
*
* For example, all tax adjustments generated by the same tax type
* will be combined into a single adjustment, which can then be shown
* in total summaries.
*
* @param \Drupal\commerce_order\Adjustment[] $adjustments
* The adjustments.
*
* @return \Drupal\commerce_order\Adjustment[]
* The combined adjustments.
*/
public function combineAdjustments(array $adjustments);
/**
* Sorts adjustments by their type's weight.
*
* For example, tax adjustments will be placed after promotion adjustments,
* because the tax adjustment type has a higher weight than the promotion
* one, as defined in commerce_order.commerce_adjustment_types.yml.
*
* @param \Drupal\commerce_order\Adjustment[] $adjustments
* The adjustments.
*
* @return \Drupal\commerce_order\Adjustment[]
* The sorted adjustments.
*/
public function sortAdjustments(array $adjustments);
/**
* Rounds adjustments to their currency precision.
*
* For example, USD adjustments will be rounded to 2 decimals.
*
* @param \Drupal\commerce_order\Adjustment[] $adjustments
* The adjustments.
* @param int $mode
* The rounding mode. One of the following constants: PHP_ROUND_HALF_UP,
* PHP_ROUND_HALF_DOWN, PHP_ROUND_HALF_EVEN, PHP_ROUND_HALF_ODD.
*
* @return \Drupal\commerce_order\Adjustment[]
* The rounded adjustments.
*/
public function roundAdjustments(array $adjustments, $mode = PHP_ROUND_HALF_UP);
/**
* Rounds an adjustment to its currency precision.
*
* For example, a USD adjustment will be rounded to 2 decimals.
*
* @param \Drupal\commerce_order\Adjustment $adjustment
* The adjustment.
* @param int $mode
* The rounding mode. One of the following constants: PHP_ROUND_HALF_UP,
* PHP_ROUND_HALF_DOWN, PHP_ROUND_HALF_EVEN, PHP_ROUND_HALF_ODD.
*
* @return \Drupal\commerce_order\Adjustment
* The rounded adjustment.
*/
public function roundAdjustment(Adjustment $adjustment, $mode = PHP_ROUND_HALF_UP);
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AdjustmentTransformerInterface:: |
public | function | Combines adjustments with the same type and source ID. | 1 |
AdjustmentTransformerInterface:: |
public | function | Combines, sorts, and rounds the given adjustments. | 1 |
AdjustmentTransformerInterface:: |
public | function | Rounds an adjustment to its currency precision. | 1 |
AdjustmentTransformerInterface:: |
public | function | Rounds adjustments to their currency precision. | 1 |
AdjustmentTransformerInterface:: |
public | function | Sorts adjustments by their type's weight. | 1 |