public function build(array $data)
    {
        $this->validateArrayKeys(
            array('id', 'create_time', 'state', 'intent', 'payer', 'transactions', 'links'),
            $data
        );


        if (empty($data['id'])) {
            throw new BuilderException('id is mandatory and should not be empty');
        }

        $links = array();
        foreach ($data['links'] as $link) {
            $links[] = $this->linkBuilder->build($link);
        }

        $payment = new Payment(
            $data['id'],
            $data['create_time'],
            $data['state'],
            $data['intent'],
            $this->payerBuilder->build($data['payer']),
            $this->transactionsBuilder->build($data['transactions']),
            $links,
            isset($data['update_time']) ? $data['update_time'] : null
        );
        $payment->setPaypalData($data);

        return $payment;
    }
public function build(array $data)
    {
        $this->validateArrayKeys(
            array('id', 'create_time', 'state', 'intent', 'payer', 'transactions', 'links'),
            $data
        );


        if (empty($data['id'])) {
            throw new BuilderException('id is mandatory and should not be empty');
        }

        $links = array();
        foreach ($data['links'] as $link) {
            $links[] = $this->linkBuilder->build($link);
        }

        $payment = new Payment(
            $data['id'],
            $data['create_time'],
            $data['state'],
            $data['intent'],
            $this->payerBuilder->build($data['payer']),
            $this->transactionsBuilder->build($data['transactions']),
            $links,
            isset($data['update_time']) ? $data['update_time'] : null
        );
        $payment->setPaypalData($data);

        return $payment;
    }
public function build ( array $ data ) { $ this -> validateArrayKeys ( array ( 'id' , 'create_time' , 'state' , 'intent' , 'payer' , 'transactions' , 'links' ) , $ data ) ; if ( empty ( $ data [ 'id' ] ) ) { throw new BuilderException ( 'id is mandatory and should not be empty' ) ; } $ links = array ( ) ; foreach ( $ data [ 'links' ] as $ link ) { $ links [ ] = $ this -> linkBuilder -> build ( $ link ) ; } $ payment = new Payment ( $ data [ 'id' ] , $ data [ 'create_time' ] , $ data [ 'state' ] , $ data [ 'intent' ] , $ this -> payerBuilder -> build ( $ data [ 'payer' ] ) , $ this -> transactionsBuilder -> build ( $ data [ 'transactions' ] ) , $ links , isset ( $ data [ 'update_time' ] ) ? $ data [ 'update_time' ] : null ) ; $ payment -> setPaypalData ( $ data ) ; return $ payment ; }
Build an instance of PayPalRestApiClient\Model\Payment given an array

@param array $data The array should contains the following keys:
id, create_time, state, intent, payer, transactions, links
The "id" key value should not be empty.

@return PayPalRestApiClient\Model\Payment

@throws PayPalRestApiClient\Exception\BuilderException If not all keys are set

@see https://developer.paypal.com/docs/api/#payment-object
Build an instance of PayPalRestApiClient \ Model \ Payment given an array