src/Klarna.php
public function addArticle(
        $qty, $artNo, $title, $price, $vat, $discount = 0,
        $flags = KlarnaFlags::INC_VAT
    ) {
        $this->_checkQty($qty);

        // Either artno or title has to be set
        if ((($artNo === null ) || ($artNo == ""))
            && (($title === null ) || ($title == ""))
        ) {
            throw new Klarna_ArgumentNotSetException('Title and ArtNo', 50026);
        }

        $this->_checkPrice($price);
        $this->_checkVAT($vat);
        $this->_checkDiscount($discount);
        $this->_checkInt($flags, 'flags');

        //Create goodsList array if not set.
        if (!$this->goodsList || !is_array($this->goodsList)) {
            $this->goodsList = array();
        }

        //Populate a temp array with the article details.
        $tmpArr = array(
            "artno" => $artNo,
            "title" => $title,
            "price" => $price,
            "vat" => $vat,
            "discount" => $discount,
            "flags" => $flags
        );

        //Add the temp array and quantity field to the internal goods list.
        $this->goodsList[] = array(
                "goods" => $tmpArr,
                "qty"   => $qty
        );

        if (count($this->goodsList) > 0) {
            self::printDebug(
                "article added",
                $this->goodsList[count($this->goodsList)-1]
            );
        }
    }
public function addArticle(
        $qty, $artNo, $title, $price, $vat, $discount = 0,
        $flags = KlarnaFlags::INC_VAT
    ) {
        $this->_checkQty($qty);

        // Either artno or title has to be set
        if ((($artNo === null ) || ($artNo == ""))
            && (($title === null ) || ($title == ""))
        ) {
            throw new Klarna_ArgumentNotSetException('Title and ArtNo', 50026);
        }

        $this->_checkPrice($price);
        $this->_checkVAT($vat);
        $this->_checkDiscount($discount);
        $this->_checkInt($flags, 'flags');

        //Create goodsList array if not set.
        if (!$this->goodsList || !is_array($this->goodsList)) {
            $this->goodsList = array();
        }

        //Populate a temp array with the article details.
        $tmpArr = array(
            "artno" => $artNo,
            "title" => $title,
            "price" => $price,
            "vat" => $vat,
            "discount" => $discount,
            "flags" => $flags
        );

        //Add the temp array and quantity field to the internal goods list.
        $this->goodsList[] = array(
                "goods" => $tmpArr,
                "qty"   => $qty
        );

        if (count($this->goodsList) > 0) {
            self::printDebug(
                "article added",
                $this->goodsList[count($this->goodsList)-1]
            );
        }
    }
public function addArticle ( $ qty , $ artNo , $ title , $ price , $ vat , $ discount = 0 , $ flags = KlarnaFlags :: INC_VAT ) { $ this -> _checkQty ( $ qty ) ; // Either artno or title has to be set if ( ( ( $ artNo === null ) || ( $ artNo == "" ) ) && ( ( $ title === null ) || ( $ title == "" ) ) ) { throw new Klarna_ArgumentNotSetException ( 'Title and ArtNo' , 50026 ) ; } $ this -> _checkPrice ( $ price ) ; $ this -> _checkVAT ( $ vat ) ; $ this -> _checkDiscount ( $ discount ) ; $ this -> _checkInt ( $ flags , 'flags' ) ; //Create goodsList array if not set. if ( ! $ this -> goodsList || ! is_array ( $ this -> goodsList ) ) { $ this -> goodsList = array ( ) ; } //Populate a temp array with the article details. $ tmpArr = array ( "artno" => $ artNo , "title" => $ title , "price" => $ price , "vat" => $ vat , "discount" => $ discount , "flags" => $ flags ) ; //Add the temp array and quantity field to the internal goods list. $ this -> goodsList [ ] = array ( "goods" => $ tmpArr , "qty" => $ qty ) ; if ( count ( $ this -> goodsList ) > 0 ) { self :: printDebug ( "article added" , $ this -> goodsList [ count ( $ this -> goodsList ) - 1 ] ) ; } }
Adds an article to the current goods list for the current order.

<b>Note</b>:<br>
It is recommended that you use {@link KlarnaFlags::INC_VAT}.<br>

<b>Flags can be</b>:<br>
{@link KlarnaFlags::INC_VAT}<br>
{@link KlarnaFlags::IS_SHIPMENT}<br>
{@link KlarnaFlags::IS_HANDLING}<br>
{@link KlarnaFlags::PRINT_1000}<br>
{@link KlarnaFlags::PRINT_100}<br>
{@link KlarnaFlags::PRINT_10}<br>
{@link KlarnaFlags::NO_FLAG}<br>

Some flags can be added to each other for multiple options.

@param int    $qty      Quantity.
@param string $artNo    Article number.
@param string $title    Article title.
@param int    $price    Article price.
@param float  $vat      VAT in percent, e.g. 25% is inputted as 25.
@param float  $discount Possible discount on article.
@param int    $flags    Options which specify the article
({@link KlarnaFlags::IS_HANDLING}) and it's price
({@link KlarnaFlags::INC_VAT})

@see Klarna::addTransaction()
@see Klarna::reserveAmount()
@see Klarna::activateReservation()

@throws KlarnaException
@return void
Adds an article to the current goods list for the current order .