Currently adjustment for applied tax have e.g. amount, sourceId and included information defined.

As many payment gateways expects detailed order information to be provided along with payment details, it would greatly help if tax adjustment had information about applied tax rate (% or 0.xx) in addition to amount and sourceId information.

Comments

mitrpaka created an issue. See original summary.

bojanz’s picture

Title: Add applied tax rate to tax adjustement » Add Adjustment::getPercentage()

We should add a $percentage and getPercentage() to the Adjustment class, have it populated by both taxes and promotions. Return NULL when unavailable.
Cause why not, and it will come useful in multiple places (such as suffixing VAT labels when there are different rates).

mitrpaka’s picture

Status: Active » Needs review
bojanz’s picture

Status: Needs review » Needs work

Thanks!

Here's a review:
1) We are missing a line in Order::collectAdjustments() that transfers the percentage, otherwise it's lost.
2) We're also missing test coverage to confirm that commerce_tax sets the percentage as expected.
3) We should also add validation to Adjustment::__construct() to ensure we got a valid percentage value, when available.
4) PercentageOffBase::getAmount() should be renamed to PercentageOffBase::getPercentage() to match the code here.

bojanz’s picture

Assigned: Unassigned » bojanz

I'll address the points above.

  • bojanz committed 289a07e on 8.x-2.x authored by mitrpaka
    Issue #2894792 by mitrpaka, bojanz: Add Adjustment::getPercentage()
    
bojanz’s picture

Status: Needs work » Fixed

Done.

Status: Fixed » Closed (fixed)

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