src/Klarna.php
public function update($rno, $clear = true)
    {
        $rno = strval($rno);

        // All info that is sent in is part of the digest secret, in this order:
        // [
        //      proto_vsn, client_vsn, eid, rno, careof, street, zip, city,
        //      country, fname, lname, careof, street, zip, city, country,
        //      fname, lname, artno, qty, orderid1, orderid2
        // ].
        // The address part appears twice, that is one per address that
        // changes. If no value is sent in for an optional field, there
        // is no entry for this field in the digest secret. Shared secret
        // is added at the end of the digest secret.
        $digestArray = array(
            str_replace('.', ':', $this->PROTO),
            $this->VERSION,
            $this->_eid,
            $rno
        );
        $digestArray = array_merge(
            $digestArray, $this->_addressDigestPart($this->shipping)
        );
        $digestArray = array_merge(
            $digestArray, $this->_addressDigestPart($this->billing)
        );
        if (is_array($this->goodsList) && $this->goodsList !== array()) {
            foreach ($this->goodsList as $goods) {
                if (strlen($goods["goods"]["artno"]) > 0) {
                    $digestArray[] = $goods["goods"]["artno"];
                } else {
                    $digestArray[] = $goods["goods"]["title"];
                }
                $digestArray[] = $goods["qty"];
            }
        }
        foreach ($this->orderid as $orderid) {
            $digestArray[] = $orderid;
        }
        $digestArray[] = $this->_secret;

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

        $shipping = array();
        $billing = array();
        if ($this->shipping !== null && $this->shipping instanceof KlarnaAddr) {
            $shipping = $this->shipping->toArray();
        }
        if ($this->billing !== null && $this->billing instanceof KlarnaAddr) {
            $billing = $this->billing->toArray();
        }
        $paramList = array(
            $this->_eid,
            $digestSecret,
            $rno,
            array(
                'goods_list' => $this->goodsList,
                'dlv_addr' => $shipping,
                'bill_addr' => $billing,
                'orderid1' => $this->orderid[0],
                'orderid2' => $this->orderid[1]
            )
        );

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

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

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

        return ($result === 'ok');
    }
public function update($rno, $clear = true)
    {
        $rno = strval($rno);

        // All info that is sent in is part of the digest secret, in this order:
        // [
        //      proto_vsn, client_vsn, eid, rno, careof, street, zip, city,
        //      country, fname, lname, careof, street, zip, city, country,
        //      fname, lname, artno, qty, orderid1, orderid2
        // ].
        // The address part appears twice, that is one per address that
        // changes. If no value is sent in for an optional field, there
        // is no entry for this field in the digest secret. Shared secret
        // is added at the end of the digest secret.
        $digestArray = array(
            str_replace('.', ':', $this->PROTO),
            $this->VERSION,
            $this->_eid,
            $rno
        );
        $digestArray = array_merge(
            $digestArray, $this->_addressDigestPart($this->shipping)
        );
        $digestArray = array_merge(
            $digestArray, $this->_addressDigestPart($this->billing)
        );
        if (is_array($this->goodsList) && $this->goodsList !== array()) {
            foreach ($this->goodsList as $goods) {
                if (strlen($goods["goods"]["artno"]) > 0) {
                    $digestArray[] = $goods["goods"]["artno"];
                } else {
                    $digestArray[] = $goods["goods"]["title"];
                }
                $digestArray[] = $goods["qty"];
            }
        }
        foreach ($this->orderid as $orderid) {
            $digestArray[] = $orderid;
        }
        $digestArray[] = $this->_secret;

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

        $shipping = array();
        $billing = array();
        if ($this->shipping !== null && $this->shipping instanceof KlarnaAddr) {
            $shipping = $this->shipping->toArray();
        }
        if ($this->billing !== null && $this->billing instanceof KlarnaAddr) {
            $billing = $this->billing->toArray();
        }
        $paramList = array(
            $this->_eid,
            $digestSecret,
            $rno,
            array(
                'goods_list' => $this->goodsList,
                'dlv_addr' => $shipping,
                'bill_addr' => $billing,
                'orderid1' => $this->orderid[0],
                'orderid2' => $this->orderid[1]
            )
        );

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

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

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

        return ($result === 'ok');
    }
public function update ( $ rno , $ clear = true ) { $ rno = strval ( $ rno ) ; // All info that is sent in is part of the digest secret, in this order: // [ //      proto_vsn, client_vsn, eid, rno, careof, street, zip, city, //      country, fname, lname, careof, street, zip, city, country, //      fname, lname, artno, qty, orderid1, orderid2 // ]. // The address part appears twice, that is one per address that // changes. If no value is sent in for an optional field, there // is no entry for this field in the digest secret. Shared secret // is added at the end of the digest secret. $ digestArray = array ( str_replace ( '.' , ':' , $ this -> PROTO ) , $ this -> VERSION , $ this -> _eid , $ rno ) ; $ digestArray = array_merge ( $ digestArray , $ this -> _addressDigestPart ( $ this -> shipping ) ) ; $ digestArray = array_merge ( $ digestArray , $ this -> _addressDigestPart ( $ this -> billing ) ) ; if ( is_array ( $ this -> goodsList ) && $ this -> goodsList !== array ( ) ) { foreach ( $ this -> goodsList as $ goods ) { if ( strlen ( $ goods [ "goods" ] [ "artno" ] ) > 0 ) { $ digestArray [ ] = $ goods [ "goods" ] [ "artno" ] ; } else { $ digestArray [ ] = $ goods [ "goods" ] [ "title" ] ; } $ digestArray [ ] = $ goods [ "qty" ] ; } } foreach ( $ this -> orderid as $ orderid ) { $ digestArray [ ] = $ orderid ; } $ digestArray [ ] = $ this -> _secret ; $ digestSecret = $ this -> digest ( call_user_func_array ( array ( 'self' , 'colon' ) , $ digestArray ) ) ; $ shipping = array ( ) ; $ billing = array ( ) ; if ( $ this -> shipping !== null && $ this -> shipping instanceof KlarnaAddr ) { $ shipping = $ this -> shipping -> toArray ( ) ; } if ( $ this -> billing !== null && $ this -> billing instanceof KlarnaAddr ) { $ billing = $ this -> billing -> toArray ( ) ; } $ paramList = array ( $ this -> _eid , $ digestSecret , $ rno , array ( 'goods_list' => $ this -> goodsList , 'dlv_addr' => $ shipping , 'bill_addr' => $ billing , 'orderid1' => $ this -> orderid [ 0 ] , 'orderid2' => $ this -> orderid [ 1 ] ) ) ; self :: printDebug ( 'update array' , $ paramList ) ; $ result = $ this -> xmlrpc_call ( 'update' , $ paramList ) ; self :: printDebug ( 'update result' , $ result ) ; return ( $ result === 'ok' ) ; }
Update the reservation matching the given reservation number.

@param string  $rno   Reservation number
@param boolean $clear clear set data aftre updating. Defaulted to true.

@throws KlarnaException if no RNO is given, or if an error is recieved
from Klarna Online.

@return true if the update was successful
Update the reservation matching the given reservation number .