Example #1
0
 public static function calculate($base, TaxRateInterface $rate)
 {
     if ($rate->isIncludedInPrice()) {
         return $base - $base / (1 + $rate->getAmount());
     }
     return $base * $rate->getAmount();
 }
Example #2
0
 public function transform(TaxRateInterface $taxRate)
 {
     return array('id' => $taxRate->id, 'category' => $taxRate->category, 'amount' => $taxRate->getAmount(), 'percentage' => $taxRate->getAmountAsPercentage(), 'included_in_price' => (bool) $taxRate->isIncludedInPrice());
 }