Now that #2981432: Extract the tax-exempt price logic from LocalTaxTypeBase, into TaxOrderProcessor has landed, TaxOrderProcessor has a protected method for getting the default rates for an order item. This is useful logic that should live in its own service.

Proposed name: StoreTaxes.
Proposed method: getDefaultTaxRates($order_item, $store).

We could also have a getDefaultTaxTypes($store).

Open question on whether there should be a single "default tax type" (first tax type that matches the store's address) or multiple "default tax types" which means any tax type that matches the store's address.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bojanz created an issue. See original summary.

bojanz’s picture

Attacking this after #3113768: Fatal error when resolver are called by the chainRateResolver without a taxType set. Crediting flocondetoile for this test work in the other issue, which will be relevant here.

flocondetoile’s picture

Open question on whether there should be a single "default tax type" (first tax type that matches the store's address) or multiple "default tax types" which means any tax type that matches the store's address.

Most of all shops must have a single default tax type. But with tax there is always complex use cases belong the country you are. Why not a new settings on the Store, setting checked by default (to keep current behavior) ? Or by default a logic with only one default tax type, but easily swappeable / overrideable (a boolean parameter set on the service for example).

bojanz’s picture

Status: Active » Needs review
FileSize
21.46 KB

This is as fancy as I could make it for the 2.17 release. Anything more would need to wait for a future one.

  • bojanz committed 22dc4e8 on 8.x-2.x
    Issue #2981436 by bojanz, flocondetoile: Create a service for getting...
bojanz’s picture

Status: Needs review » Fixed

Expanded the tests a bit more and committed. See you in followups!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.