protected function respond($response, $request, $options, $statusCode)
    {
        if (array_key_exists('webhooks', $response)) {
            $results = [];
            foreach ($response['webhooks'] as $result) {
                $results[] = $this->mapResponse($result, $statusCode);
            }

            return $results;
        }

        // IPN response
        if (in_array(Arr::get($response, 'body'), ['VERIFIED', 'INVALID'])) {
            $response = array_merge($request, $response);
        }
        // charge request
        elseif (array_key_exists('continue_url', $options)) {
            $response['continue_url'] = $options['continue_url'];
            $response['is_redirect'] = true;
        }

        return $this->mapResponse($response, $statusCode);
    }
protected function respond($response, $request, $options, $statusCode)
    {
        if (array_key_exists('webhooks', $response)) {
            $results = [];
            foreach ($response['webhooks'] as $result) {
                $results[] = $this->mapResponse($result, $statusCode);
            }

            return $results;
        }

        // IPN response
        if (in_array(Arr::get($response, 'body'), ['VERIFIED', 'INVALID'])) {
            $response = array_merge($request, $response);
        }
        // charge request
        elseif (array_key_exists('continue_url', $options)) {
            $response['continue_url'] = $options['continue_url'];
            $response['is_redirect'] = true;
        }

        return $this->mapResponse($response, $statusCode);
    }
protected function respond ( $ response , $ request , $ options , $ statusCode ) { if ( array_key_exists ( 'webhooks' , $ response ) ) { $ results = [ ] ; foreach ( $ response [ 'webhooks' ] as $ result ) { $ results [ ] = $ this -> mapResponse ( $ result , $ statusCode ) ; } return $ results ; } // IPN response if ( in_array ( Arr :: get ( $ response , 'body' ) , [ 'VERIFIED' , 'INVALID' ] ) ) { $ response = array_merge ( $ request , $ response ) ; } // charge request elseif ( array_key_exists ( 'continue_url' , $ options ) ) { $ response [ 'continue_url' ] = $ options [ 'continue_url' ] ; $ response [ 'is_redirect' ] = true ; } return $ this -> mapResponse ( $ response , $ statusCode ) ; }
Configure the raw response before the mapping.

@param array $response
@param array $request
@param array $options
@param int   $statusCode

@return array
Configure the raw response before the mapping .