/**
  * Returns the charges and discounts for the shopping cart total for
  * this payment method.
  * 
  * @param SilvercartShoppingCart $silvercartShoppingCart The shopping cart object
  * @param string                 $priceType              'gross' or 'net'
  *
  * @return mixed boolean|DataObject
  * 
  * @author Sascha Koehler <*****@*****.**>,
  *         Sebastian Diel <*****@*****.**>
  * @since 16.11.2013
  */
 public function getChargesAndDiscountsForTotal(SilvercartShoppingCart $silvercartShoppingCart, $priceType = false)
 {
     $handlingCosts = new Money();
     $handlingCosts->setAmount(0);
     $handlingCosts->setCurrency(SilvercartConfig::DefaultCurrency());
     if ($priceType === false) {
         $priceType = SilvercartConfig::PriceType();
     }
     if ($this->useSumModification && $this->sumModificationImpact == 'totalValue') {
         $excludedPositions = array();
         switch ($this->sumModificationValueType) {
             case 'percent':
                 $amount = $silvercartShoppingCart->getAmountTotal(array(), false, true);
                 $modificationValue = $amount->getAmount() / 100 * $this->sumModificationValue;
                 $index = 1;
                 foreach ($silvercartShoppingCart->SilvercartShoppingCartPositions() as $position) {
                     if ($position->SilvercartProductID > 0 && $position->SilvercartProduct() instanceof SilvercartProduct && $position->SilvercartProduct()->ExcludeFromPaymentDiscounts) {
                         $modificationValue -= $position->getPrice()->getAmount() / 100 * $this->sumModificationValue;
                         $excludedPositions[] = $index;
                     }
                     $index++;
                 }
                 break;
             case 'absolute':
             default:
                 $modificationValue = $this->sumModificationValue;
         }
         if (count($excludedPositions) > 0) {
             if (count($excludedPositions) == 1) {
                 $this->sumModificationLabel .= ' (' . sprintf(_t('SilvercartPaymentMethod.ExcludedPosition'), implode(', ', $excludedPositions)) . ')';
             } else {
                 $this->sumModificationLabel .= ' (' . sprintf(_t('SilvercartPaymentMethod.ExcludedPositions'), implode(', ', $excludedPositions)) . ')';
             }
         }
         if ($this->sumModificationImpactType == 'charge') {
             $handlingCostAmount = $modificationValue;
         } else {
             $handlingCostAmount = "-" . $modificationValue;
         }
         if (SilvercartConfig::PriceType() == 'gross') {
             $shoppingCartTotal = $silvercartShoppingCart->getAmountTotal(array(), false, true);
         } else {
             $shoppingCartTotal = $silvercartShoppingCart->getAmountTotalNetWithoutVat(array(), false, true);
             $taxRate = $silvercartShoppingCart->getMostValuableTaxRate();
             $handlingCostAmount = round($handlingCostAmount / (100 + $taxRate->Rate) * 100, 4);
         }
         if ($handlingCostAmount < 0 && $shoppingCartTotal->getAmount() < $handlingCostAmount * -1) {
             $handlingCostAmount = $shoppingCartTotal->getAmount() * -1;
         }
         $handlingCosts->setAmount($handlingCostAmount);
     }
     $this->extend('updateChargesAndDiscountsForTotal', $handlingCosts);
     if ($handlingCosts->getAmount() == 0) {
         $handlingCosts = false;
     }
     return $handlingCosts;
 }