src/Klarna.php
public function summarizeGoodsList()
    {
        $amount = 0;
        if (!is_array($this->goodsList)) {
            return $amount;
        }
        foreach ($this->goodsList as $goods) {
            $price = $goods['goods']['price'];

            // Add VAT if price is Excluding VAT
            if (($goods['goods']['flags'] & KlarnaFlags::INC_VAT) === 0) {
                $vat = $goods['goods']['vat'] / 100.0;
                $price *= (1.0 + $vat);
            }

            // Reduce discounts
            if ($goods['goods']['discount'] > 0) {
                $discount = $goods['goods']['discount'] / 100.0;
                $price *= (1.0 - $discount);
            }

            $amount += $price * (int)$goods['qty'];
        }
        return $amount;
    }
public function summarizeGoodsList()
    {
        $amount = 0;
        if (!is_array($this->goodsList)) {
            return $amount;
        }
        foreach ($this->goodsList as $goods) {
            $price = $goods['goods']['price'];

            // Add VAT if price is Excluding VAT
            if (($goods['goods']['flags'] & KlarnaFlags::INC_VAT) === 0) {
                $vat = $goods['goods']['vat'] / 100.0;
                $price *= (1.0 + $vat);
            }

            // Reduce discounts
            if ($goods['goods']['discount'] > 0) {
                $discount = $goods['goods']['discount'] / 100.0;
                $price *= (1.0 - $discount);
            }

            $amount += $price * (int)$goods['qty'];
        }
        return $amount;
    }
public function summarizeGoodsList ( ) { $ amount = 0 ; if ( ! is_array ( $ this -> goodsList ) ) { return $ amount ; } foreach ( $ this -> goodsList as $ goods ) { $ price = $ goods [ 'goods' ] [ 'price' ] ; // Add VAT if price is Excluding VAT if ( ( $ goods [ 'goods' ] [ 'flags' ] & KlarnaFlags :: INC_VAT ) === 0 ) { $ vat = $ goods [ 'goods' ] [ 'vat' ] / 100.0 ; $ price *= ( 1.0 + $ vat ) ; } // Reduce discounts if ( $ goods [ 'goods' ] [ 'discount' ] > 0 ) { $ discount = $ goods [ 'goods' ] [ 'discount' ] / 100.0 ; $ price *= ( 1.0 - $ discount ) ; } $ amount += $ price * ( int ) $ goods [ 'qty' ] ; } return $ amount ; }
Summarizes the prices of the held goods list

@return int total amount
Summarizes the prices of the held goods list