public function fetch()
    {
        parent::fetch();

        // Convert captures data to Capture[]

        $captures = [];
        foreach ($this['captures'] as $capture) {
            $captureId = $capture[Capture::ID_FIELD];

            $object = new Capture(
                $this->connector,
                $this->getLocation(),
                $captureId
            );
            $object->exchangeArray($capture);

            $captures[] = $object;
        }

        $this['captures'] = $captures;


        // Convert refunds data to Refund[]
        if (isset($this['refunds'])) {
            $refunds = [];
            foreach ($this['refunds'] as $refund) {
                $refundId = null;
                if (isset($refund[Refund::ID_FIELD])) {
                    $refundId = $refund[Refund::ID_FIELD];
                }

                $object = new Refund(
                    $this->connector,
                    $this->getLocation(),
                    $refundId
                );
                $object->exchangeArray($refund);

                $refunds[] = $object;
            }
            $this['refunds'] = $refunds;
        }

        return $this;
    }
public function fetch()
    {
        parent::fetch();

        // Convert captures data to Capture[]

        $captures = [];
        foreach ($this['captures'] as $capture) {
            $captureId = $capture[Capture::ID_FIELD];

            $object = new Capture(
                $this->connector,
                $this->getLocation(),
                $captureId
            );
            $object->exchangeArray($capture);

            $captures[] = $object;
        }

        $this['captures'] = $captures;


        // Convert refunds data to Refund[]
        if (isset($this['refunds'])) {
            $refunds = [];
            foreach ($this['refunds'] as $refund) {
                $refundId = null;
                if (isset($refund[Refund::ID_FIELD])) {
                    $refundId = $refund[Refund::ID_FIELD];
                }

                $object = new Refund(
                    $this->connector,
                    $this->getLocation(),
                    $refundId
                );
                $object->exchangeArray($refund);

                $refunds[] = $object;
            }
            $this['refunds'] = $refunds;
        }

        return $this;
    }
public function fetch ( ) { parent :: fetch ( ) ; // Convert captures data to Capture[] $ captures = [ ] ; foreach ( $ this [ 'captures' ] as $ capture ) { $ captureId = $ capture [ Capture :: ID_FIELD ] ; $ object = new Capture ( $ this -> connector , $ this -> getLocation ( ) , $ captureId ) ; $ object -> exchangeArray ( $ capture ) ; $ captures [ ] = $ object ; } $ this [ 'captures' ] = $ captures ; // Convert refunds data to Refund[] if ( isset ( $ this [ 'refunds' ] ) ) { $ refunds = [ ] ; foreach ( $ this [ 'refunds' ] as $ refund ) { $ refundId = null ; if ( isset ( $ refund [ Refund :: ID_FIELD ] ) ) { $ refundId = $ refund [ Refund :: ID_FIELD ] ; } $ object = new Refund ( $ this -> connector , $ this -> getLocation ( ) , $ refundId ) ; $ object -> exchangeArray ( $ refund ) ; $ refunds [ ] = $ object ; } $ this [ 'refunds' ] = $ refunds ; } return $ this ; }
Fetches the order.

@throws ConnectorException        When the API replies with an error response
@throws RequestException          When an error is encountered
@throws \RuntimeException         On an unexpected API response
@throws \RuntimeException         If the response content type is not JSON
@throws \InvalidArgumentException If the JSON cannot be parsed
@throws \LogicException           When Guzzle cannot populate the response

@return self
Fetches the order .