This is a final cart function
It is called roundTotalAmount() because of backward compatibility
but is the place to do last checks in cart
/**
* This is a final cart function
* It is called roundTotalAmount() because of backward compatibility
* but is the place to do last checks in cart
*
*/
public function roundTotalAmount()
{
$calc = new PhocacartCartCalculation();
$calc->setType($this->type);
$this->shipping['costs'] = isset($this->shipping['costs']) ? $this->shipping['costs'] : 0;
$this->payment['costs'] = isset($this->payment['costs']) ? $this->payment['costs'] : 0;
// 1) CORRECT TOTAL ITEMS (Rounding), CORRECT CURRENCY TOTAL ITEMS (Rounding for each item)
$calc->correctTotalItems($this->total, $this->shipping['costs'], $this->payment['costs']);
// 2) MAKE TAX RECAPITULATION and correct total by tax recapitulation if asked
$calc->taxRecapitulation($this->total[0], $this->shipping['costs'], $this->payment['costs']);
// 3) CORRECT TOTAL ITEMS (Rounding), CORRECT CURRENCY TOTAL ITEMS (Rounding for each item) - AGAIN WHEN TOTAL CHANGED BY TAX RECAPITULATION
$options = array();
$options['brutto_currency_set'] = 1;
// Brutto currency exists yet, so don't create it again from "brutto * currencyRating"
$calc->correctTotalItems($this->total, $this->shipping['costs'], $this->payment['costs'], $options);
// 4) ROUND TOTAL AMOUNT IF ASKED (e.g. 95.67 => 96)
$calc->roundTotalAmount($this->total[0]);
// ROUNDING VS: TRCROUNDING
// NETTO (Payment,Shipping incl. Tax) Rounding Brutto
// Rounding TC: 1370.79 + 25.94 + 0.14 = 1396,87
// Rounding: 1370.83 + 25.94 + 0.10 = 1396,87
// 0.14 - 0.10 = 0.04
// 1370.79 + 0.10 + 0.04 + 25.94 = 1396,87
}