src/Klarna.php
public function activateReservation(
        $pno, $rno, $gender, $ocr = "", $flags = KlarnaFlags::NO_FLAG,
        $pclass = KlarnaPClass::INVOICE, $encoding = null, $clear = true
    ) {
        $this->_checkLocale();

        //Get the PNO/SSN encoding constant.
        if ($encoding === null) {
            $encoding = $this->getPNOEncoding();
        }

        // Only check PNO if it is not explicitly null.
        if ($pno !== null) {
            $this->_checkPNO($pno, $encoding);
        }

        $this->_checkRNO($rno);

        if ($gender !== null && strlen($gender) > 0) {
            $this->_checkInt($gender, 'gender');
        }

        $this->_checkOCR($ocr);
        $this->_checkRef($this->reference, $this->reference_code);

        $this->_checkGoodslist();

        //No addresses used for phone transactions
        $billing = $shipping = '';
        if ( !($flags & KlarnaFlags::RSRV_PHONE_TRANSACTION) ) {
            $billing = $this->assembleAddr($this->billing);
            $shipping = $this->assembleAddr($this->shipping);

            if (strlen($shipping['country']) > 0
                && ($shipping['country'] !== $this->_country)
            ) {
                throw new Klarna_ShippingCountryException;
            }
        }

        //activate digest
        $string = $this->_eid . ":" . $pno . ":";
        foreach ($this->goodsList as $goods) {
            $string .= $goods["goods"]["artno"] . ":" . $goods["qty"] . ":";
        }
        $digestSecret = self::digest($string . $this->_secret);
        //end digest

        //Assume normal shipment unless otherwise specified.
        if (!isset($this->shipInfo['delay_adjust'])) {
            $this->setShipmentInfo('delay_adjust', KlarnaFlags::NORMAL_SHIPMENT);
        }

        $paramList = array(
            $rno,
            $ocr,
            $pno,
            $gender,
            $this->reference,
            $this->reference_code,
            $this->orderid[0],
            $this->orderid[1],
            $shipping,
            $billing,
            "0.0.0.0",
            $flags,
            $this->_currency,
            $this->_country,
            $this->_language,
            $this->_eid,
            $digestSecret,
            $encoding,
            $pclass,
            $this->goodsList,
            $this->comment,
            $this->shipInfo,
            $this->travelInfo,
            $this->incomeInfo,
            $this->bankInfo,
            $this->extraInfo
        );

        self::printDebug('activate_reservation', $paramList);

        $result = $this->xmlrpc_call('activate_reservation', $paramList);

        if ($clear === true) {
            $this->clear();
        }

        self::printDebug('activate_reservation result', $result);

        return $result;
    }
public function activateReservation(
        $pno, $rno, $gender, $ocr = "", $flags = KlarnaFlags::NO_FLAG,
        $pclass = KlarnaPClass::INVOICE, $encoding = null, $clear = true
    ) {
        $this->_checkLocale();

        //Get the PNO/SSN encoding constant.
        if ($encoding === null) {
            $encoding = $this->getPNOEncoding();
        }

        // Only check PNO if it is not explicitly null.
        if ($pno !== null) {
            $this->_checkPNO($pno, $encoding);
        }

        $this->_checkRNO($rno);

        if ($gender !== null && strlen($gender) > 0) {
            $this->_checkInt($gender, 'gender');
        }

        $this->_checkOCR($ocr);
        $this->_checkRef($this->reference, $this->reference_code);

        $this->_checkGoodslist();

        //No addresses used for phone transactions
        $billing = $shipping = '';
        if ( !($flags & KlarnaFlags::RSRV_PHONE_TRANSACTION) ) {
            $billing = $this->assembleAddr($this->billing);
            $shipping = $this->assembleAddr($this->shipping);

            if (strlen($shipping['country']) > 0
                && ($shipping['country'] !== $this->_country)
            ) {
                throw new Klarna_ShippingCountryException;
            }
        }

        //activate digest
        $string = $this->_eid . ":" . $pno . ":";
        foreach ($this->goodsList as $goods) {
            $string .= $goods["goods"]["artno"] . ":" . $goods["qty"] . ":";
        }
        $digestSecret = self::digest($string . $this->_secret);
        //end digest

        //Assume normal shipment unless otherwise specified.
        if (!isset($this->shipInfo['delay_adjust'])) {
            $this->setShipmentInfo('delay_adjust', KlarnaFlags::NORMAL_SHIPMENT);
        }

        $paramList = array(
            $rno,
            $ocr,
            $pno,
            $gender,
            $this->reference,
            $this->reference_code,
            $this->orderid[0],
            $this->orderid[1],
            $shipping,
            $billing,
            "0.0.0.0",
            $flags,
            $this->_currency,
            $this->_country,
            $this->_language,
            $this->_eid,
            $digestSecret,
            $encoding,
            $pclass,
            $this->goodsList,
            $this->comment,
            $this->shipInfo,
            $this->travelInfo,
            $this->incomeInfo,
            $this->bankInfo,
            $this->extraInfo
        );

        self::printDebug('activate_reservation', $paramList);

        $result = $this->xmlrpc_call('activate_reservation', $paramList);

        if ($clear === true) {
            $this->clear();
        }

        self::printDebug('activate_reservation result', $result);

        return $result;
    }
public function activateReservation ( $ pno , $ rno , $ gender , $ ocr = "" , $ flags = KlarnaFlags :: NO_FLAG , $ pclass = KlarnaPClass :: INVOICE , $ encoding = null , $ clear = true ) { $ this -> _checkLocale ( ) ; //Get the PNO/SSN encoding constant. if ( $ encoding === null ) { $ encoding = $ this -> getPNOEncoding ( ) ; } // Only check PNO if it is not explicitly null. if ( $ pno !== null ) { $ this -> _checkPNO ( $ pno , $ encoding ) ; } $ this -> _checkRNO ( $ rno ) ; if ( $ gender !== null && strlen ( $ gender ) > 0 ) { $ this -> _checkInt ( $ gender , 'gender' ) ; } $ this -> _checkOCR ( $ ocr ) ; $ this -> _checkRef ( $ this -> reference , $ this -> reference_code ) ; $ this -> _checkGoodslist ( ) ; //No addresses used for phone transactions $ billing = $ shipping = '' ; if ( ! ( $ flags & KlarnaFlags :: RSRV_PHONE_TRANSACTION ) ) { $ billing = $ this -> assembleAddr ( $ this -> billing ) ; $ shipping = $ this -> assembleAddr ( $ this -> shipping ) ; if ( strlen ( $ shipping [ 'country' ] ) > 0 && ( $ shipping [ 'country' ] !== $ this -> _country ) ) { throw new Klarna_ShippingCountryException ; } } //activate digest $ string = $ this -> _eid . ":" . $ pno . ":" ; foreach ( $ this -> goodsList as $ goods ) { $ string .= $ goods [ "goods" ] [ "artno" ] . ":" . $ goods [ "qty" ] . ":" ; } $ digestSecret = self :: digest ( $ string . $ this -> _secret ) ; //end digest //Assume normal shipment unless otherwise specified. if ( ! isset ( $ this -> shipInfo [ 'delay_adjust' ] ) ) { $ this -> setShipmentInfo ( 'delay_adjust' , KlarnaFlags :: NORMAL_SHIPMENT ) ; } $ paramList = array ( $ rno , $ ocr , $ pno , $ gender , $ this -> reference , $ this -> reference_code , $ this -> orderid [ 0 ] , $ this -> orderid [ 1 ] , $ shipping , $ billing , "0.0.0.0" , $ flags , $ this -> _currency , $ this -> _country , $ this -> _language , $ this -> _eid , $ digestSecret , $ encoding , $ pclass , $ this -> goodsList , $ this -> comment , $ this -> shipInfo , $ this -> travelInfo , $ this -> incomeInfo , $ this -> bankInfo , $ this -> extraInfo ) ; self :: printDebug ( 'activate_reservation' , $ paramList ) ; $ result = $ this -> xmlrpc_call ( 'activate_reservation' , $ paramList ) ; if ( $ clear === true ) { $ this -> clear ( ) ; } self :: printDebug ( 'activate_reservation result' , $ result ) ; return $ result ; }
Activates a previously created reservation.

<b>This method returns an array with</b>:<br>
Risk status ("no_risk", "ok")<br>
Invoice number<br>

Gender is only required for Germany and Netherlands.<br>

Use of the OCR parameter is optional.
An OCR number can be retrieved by using: {@link Klarna::reserveOCR()}.

<b>Flags can be set to</b>:<br>
{@link KlarnaFlags::NO_FLAG}<br>
{@link KlarnaFlags::TEST_MODE}<br>
{@link KlarnaFlags::RSRV_SEND_BY_MAIL}<br>
{@link KlarnaFlags::RSRV_SEND_BY_EMAIL}<br>
{@link KlarnaFlags::RSRV_PRESERVE_RESERVATION}<br>
{@link KlarnaFlags::RSRV_SENSITIVE_ORDER}<br>

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

<b>Note</b>:<br>
Normal shipment type is assumed unless otherwise specified, you can
do this by calling:
{@link Klarna::setShipmentInfo() setShipmentInfo('delay_adjust', ...)}
with either: {@link KlarnaFlags::NORMAL_SHIPMENT NORMAL_SHIPMENT} or
{@link KlarnaFlags::EXPRESS_SHIPMENT EXPRESS_SHIPMENT}<br>

@param string $pno      Personal number, SSN, date of birth, etc.
@param string $rno      Reservation number.
@param int    $gender   {@link KlarnaFlags::FEMALE} or
{@link KlarnaFlags::MALE}, null for unspecified.
@param string $ocr      A OCR number.
@param int    $flags    Options which affect the behaviour.
@param int    $pclass   {@link KlarnaPClass::getId() PClass ID}.
@param int    $encoding {@link KlarnaEncoding PNO Encoding} constant.
@param bool   $clear    Whether customer info should be cleared after
this call.

@see Klarna::reserveAmount()

@throws KlarnaException
@return array An array with risk status and invoice number [string, string].
Activates a previously created reservation .