public function activate(
        $rno, $ocr = null, $flags = null, $clear = true
    ) {
        $this->_checkRNO($rno);

        // Overwrite any OCR set on activateInfo if supplied here since this
        // method call is more specific.
        if ($ocr !== null) {
            $this->setActivateInfo('ocr', $ocr);
        }

        // If flags is specified set the flag supplied here to activateInfo.
        if ($flags !== null) {
            $this->setActivateInfo('flags', $flags);
        }

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

        // Append shipment info to activateInfo
        $this->activateInfo['shipment_info'] = $this->shipInfo;

        // Unlike other calls, if NO_FLAG is specified it should not be sent in
        // at all.
        if (array_key_exists('flags', $this->activateInfo)
            && $this->activateInfo['flags'] === KlarnaFlags::NO_FLAG
        ) {
            unset($this->activateInfo['flags']);
        }

        // Build digest. Any field in activateInfo that is set is included in
        // the digest.
        $digestArray = array(
            str_replace('.', ':', $this->PROTO),
            $this->VERSION,
            $this->_eid,
            $rno
        );

        $optionalDigestKeys = array(
            'bclass',
            'cust_no',
            'flags',
            'ocr',
            'orderid1',
            'orderid2',
            'reference',
            'reference_code'
        );

        foreach ($optionalDigestKeys as $key) {
            if (array_key_exists($key, $this->activateInfo)) {
                $digestArray[] = $this->activateInfo[$key];
            }
        }

        if (array_key_exists('delay_adjust', $this->activateInfo['shipment_info'])) {
            $digestArray[] = $this->activateInfo['shipment_info']['delay_adjust'];
        }

        // If there are any artnos added with addArtNo, add them to the digest
        // and to the activateInfo
        if (is_array($this->artNos)) {
            foreach ($this->artNos as $artNo) {
                $digestArray[] = $artNo['artno'];
                $digestArray[] = $artNo['qty'];
            }
            $this->setActivateInfo('artnos', $this->artNos);
        }

        $digestArray[] = $this->_secret;
        $digestSecret = self::digest(
            call_user_func_array(
                array('self', 'colon'), $digestArray
            )
        );

        // Create the parameter list.
        $paramList = array(
            $this->_eid,
            $digestSecret,
            $rno,
            $this->activateInfo
        );

        self::printDebug('activate array', $paramList);

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

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

        // Clear the state if specified.
        if ($clear) {
            $this->clear();
        }

        return $result;
    }
public function activate(
        $rno, $ocr = null, $flags = null, $clear = true
    ) {
        $this->_checkRNO($rno);

        // Overwrite any OCR set on activateInfo if supplied here since this
        // method call is more specific.
        if ($ocr !== null) {
            $this->setActivateInfo('ocr', $ocr);
        }

        // If flags is specified set the flag supplied here to activateInfo.
        if ($flags !== null) {
            $this->setActivateInfo('flags', $flags);
        }

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

        // Append shipment info to activateInfo
        $this->activateInfo['shipment_info'] = $this->shipInfo;

        // Unlike other calls, if NO_FLAG is specified it should not be sent in
        // at all.
        if (array_key_exists('flags', $this->activateInfo)
            && $this->activateInfo['flags'] === KlarnaFlags::NO_FLAG
        ) {
            unset($this->activateInfo['flags']);
        }

        // Build digest. Any field in activateInfo that is set is included in
        // the digest.
        $digestArray = array(
            str_replace('.', ':', $this->PROTO),
            $this->VERSION,
            $this->_eid,
            $rno
        );

        $optionalDigestKeys = array(
            'bclass',
            'cust_no',
            'flags',
            'ocr',
            'orderid1',
            'orderid2',
            'reference',
            'reference_code'
        );

        foreach ($optionalDigestKeys as $key) {
            if (array_key_exists($key, $this->activateInfo)) {
                $digestArray[] = $this->activateInfo[$key];
            }
        }

        if (array_key_exists('delay_adjust', $this->activateInfo['shipment_info'])) {
            $digestArray[] = $this->activateInfo['shipment_info']['delay_adjust'];
        }

        // If there are any artnos added with addArtNo, add them to the digest
        // and to the activateInfo
        if (is_array($this->artNos)) {
            foreach ($this->artNos as $artNo) {
                $digestArray[] = $artNo['artno'];
                $digestArray[] = $artNo['qty'];
            }
            $this->setActivateInfo('artnos', $this->artNos);
        }

        $digestArray[] = $this->_secret;
        $digestSecret = self::digest(
            call_user_func_array(
                array('self', 'colon'), $digestArray
            )
        );

        // Create the parameter list.
        $paramList = array(
            $this->_eid,
            $digestSecret,
            $rno,
            $this->activateInfo
        );

        self::printDebug('activate array', $paramList);

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

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

        // Clear the state if specified.
        if ($clear) {
            $this->clear();
        }

        return $result;
    }
public function activate ( $ rno , $ ocr = null , $ flags = null , $ clear = true ) { $ this -> _checkRNO ( $ rno ) ; // Overwrite any OCR set on activateInfo if supplied here since this // method call is more specific. if ( $ ocr !== null ) { $ this -> setActivateInfo ( 'ocr' , $ ocr ) ; } // If flags is specified set the flag supplied here to activateInfo. if ( $ flags !== null ) { $ this -> setActivateInfo ( 'flags' , $ flags ) ; } //Assume normal shipment unless otherwise specified. if ( ! array_key_exists ( 'delay_adjust' , $ this -> shipInfo ) ) { $ this -> setShipmentInfo ( 'delay_adjust' , KlarnaFlags :: NORMAL_SHIPMENT ) ; } // Append shipment info to activateInfo $ this -> activateInfo [ 'shipment_info' ] = $ this -> shipInfo ; // Unlike other calls, if NO_FLAG is specified it should not be sent in // at all. if ( array_key_exists ( 'flags' , $ this -> activateInfo ) && $ this -> activateInfo [ 'flags' ] === KlarnaFlags :: NO_FLAG ) { unset ( $ this -> activateInfo [ 'flags' ] ) ; } // Build digest. Any field in activateInfo that is set is included in // the digest. $ digestArray = array ( str_replace ( '.' , ':' , $ this -> PROTO ) , $ this -> VERSION , $ this -> _eid , $ rno ) ; $ optionalDigestKeys = array ( 'bclass' , 'cust_no' , 'flags' , 'ocr' , 'orderid1' , 'orderid2' , 'reference' , 'reference_code' ) ; foreach ( $ optionalDigestKeys as $ key ) { if ( array_key_exists ( $ key , $ this -> activateInfo ) ) { $ digestArray [ ] = $ this -> activateInfo [ $ key ] ; } } if ( array_key_exists ( 'delay_adjust' , $ this -> activateInfo [ 'shipment_info' ] ) ) { $ digestArray [ ] = $ this -> activateInfo [ 'shipment_info' ] [ 'delay_adjust' ] ; } // If there are any artnos added with addArtNo, add them to the digest // and to the activateInfo if ( is_array ( $ this -> artNos ) ) { foreach ( $ this -> artNos as $ artNo ) { $ digestArray [ ] = $ artNo [ 'artno' ] ; $ digestArray [ ] = $ artNo [ 'qty' ] ; } $ this -> setActivateInfo ( 'artnos' , $ this -> artNos ) ; } $ digestArray [ ] = $ this -> _secret ; $ digestSecret = self :: digest ( call_user_func_array ( array ( 'self' , 'colon' ) , $ digestArray ) ) ; // Create the parameter list. $ paramList = array ( $ this -> _eid , $ digestSecret , $ rno , $ this -> activateInfo ) ; self :: printDebug ( 'activate array' , $ paramList ) ; $ result = $ this -> xmlrpc_call ( 'activate' , $ paramList ) ; self :: printDebug ( 'activate result' , $ result ) ; // Clear the state if specified. if ( $ clear ) { $ this -> clear ( ) ; } return $ result ; }
Activate the reservation matching the given reservation number.
Optional information should be set in ActivateInfo.

To perform a partial activation, use the addArtNo function to specify
which items in the reservation to include in the activation.

@param string  $rno   Reservation number
@param string  $ocr   optional OCR number to attach to the reservation when
activating. Overrides OCR specified in activateInfo.
@param string  $flags optional flags to affect behavior. If specified it
will overwrite any flag set in activateInfo.
@param boolean $clear clear set data after activating. Defaulted to true.

@throws KlarnaException when the RNO is not specified, or if an error
is recieved from Klarna Online.
@return A string array with risk status and reservation number.
Activate the reservation matching the given reservation number . Optional information should be set in ActivateInfo .