You are here

interface TaxTypeInterface in Commerce Core 8.2

Same name in this branch
  1. 8.2 modules/tax/src/Entity/TaxTypeInterface.php \Drupal\commerce_tax\Entity\TaxTypeInterface
  2. 8.2 modules/tax/src/Plugin/Commerce/TaxType/TaxTypeInterface.php \Drupal\commerce_tax\Plugin\Commerce\TaxType\TaxTypeInterface

Defines the base interface for tax types.

Tax types can be local and remote, therefore each tax type plugin actually implements one of the child interfaces.

Hierarchy

Expanded class hierarchy of TaxTypeInterface

All classes that implement TaxTypeInterface

See also

\Drupal\commerce_tax\Plugin\Commerce\TaxType\LocalTaxTypeInterface

\Drupal\commerce_tax\Plugin\Commerce\TaxType\RemoteTaxTypeInterface

File

modules/tax/src/Plugin/Commerce/TaxType/TaxTypeInterface.php, line 21

Namespace

Drupal\commerce_tax\Plugin\Commerce\TaxType
View source
interface TaxTypeInterface extends ConfigurableInterface, DependentPluginInterface, PluginFormInterface, PluginInspectionInterface, DerivativeInspectionInterface {

  /**
   * Gets the tax type label.
   *
   * @return string
   *   The tax type label.
   */
  public function getLabel();

  /**
   * Gets the tax type weight.
   *
   * Used to determine the order in which tax type plugins should run.
   *
   * @return int
   *   The tax type weight.
   */
  public function getWeight();

  /**
   * Gets whether the tax type is display inclusive.
   *
   * E.g. US sales tax is not display inclusive, a $5 price is shown as $5
   * even if a $1 tax has been calculated. In France, a 5€ price is shown as
   * 6€ if a 1€ tax was calculated, because French VAT is display inclusive.
   *
   * @return bool
   *   TRUE if the tax type is display inclusive, FALSE otherwise.
   */
  public function isDisplayInclusive();

  /**
   * Checks whether the tax type applies to the given order.
   *
   * @param \Drupal\commerce_order\Entity\OrderInterface $order
   *   The order.
   *
   * @return bool
   *   TRUE if the tax type applies, FALSE otherwise.
   */
  public function applies(OrderInterface $order);

  /**
   * Applies the tax type to the given order.
   *
   * Taxes should be added on the order item level, to make returns
   * and refunds easier. This is true even for taxes that are only
   * shown at the order level, such as sales taxes.
   *
   * @param \Drupal\commerce_order\Entity\OrderInterface $order
   *   The order.
   */
  public function apply(OrderInterface $order);

}

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
DerivativeInspectionInterface::getBaseId public function Gets the base_plugin_id of the plugin instance. 1
DerivativeInspectionInterface::getDerivativeId public function Gets the derivative_id of the plugin instance. 1
PluginFormInterface::buildConfigurationForm public function Form constructor. 36
PluginFormInterface::submitConfigurationForm public function Form submission handler. 32
PluginFormInterface::validateConfigurationForm public function Form validation handler. 18
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2
TaxTypeInterface::applies public function Checks whether the tax type applies to the given order. 1
TaxTypeInterface::apply public function Applies the tax type to the given order. 1
TaxTypeInterface::getLabel public function Gets the tax type label. 1
TaxTypeInterface::getWeight public function Gets the tax type weight. 1
TaxTypeInterface::isDisplayInclusive public function Gets whether the tax type is display inclusive. 1