public static function completeRingResponse(
        Transaction $trans,
        array $response,
        MessageFactoryInterface $messageFactory
    ) {
        $trans->state = 'complete';
        $trans->transferInfo = isset($response['transfer_stats'])
            ? $response['transfer_stats'] : [];

        if (!empty($response['status'])) {
            $options = [];
            if (isset($response['version'])) {
                $options['protocol_version'] = $response['version'];
            }
            if (isset($response['reason'])) {
                $options['reason_phrase'] = $response['reason'];
            }
            $trans->response = $messageFactory->createResponse(
                $response['status'],
                isset($response['headers']) ? $response['headers'] : [],
                isset($response['body']) ? $response['body'] : null,
                $options
            );
            if (isset($response['effective_url'])) {
                $trans->response->setEffectiveUrl($response['effective_url']);
            }
        } elseif (empty($response['error'])) {
            // When nothing was returned, then we need to add an error.
            $response['error'] = self::getNoRingResponseException($trans->request);
        }

        if (isset($response['error'])) {
            $trans->state = 'error';
            $trans->exception = $response['error'];
        }
    }
public static function completeRingResponse(
        Transaction $trans,
        array $response,
        MessageFactoryInterface $messageFactory
    ) {
        $trans->state = 'complete';
        $trans->transferInfo = isset($response['transfer_stats'])
            ? $response['transfer_stats'] : [];

        if (!empty($response['status'])) {
            $options = [];
            if (isset($response['version'])) {
                $options['protocol_version'] = $response['version'];
            }
            if (isset($response['reason'])) {
                $options['reason_phrase'] = $response['reason'];
            }
            $trans->response = $messageFactory->createResponse(
                $response['status'],
                isset($response['headers']) ? $response['headers'] : [],
                isset($response['body']) ? $response['body'] : null,
                $options
            );
            if (isset($response['effective_url'])) {
                $trans->response->setEffectiveUrl($response['effective_url']);
            }
        } elseif (empty($response['error'])) {
            // When nothing was returned, then we need to add an error.
            $response['error'] = self::getNoRingResponseException($trans->request);
        }

        if (isset($response['error'])) {
            $trans->state = 'error';
            $trans->exception = $response['error'];
        }
    }
public static function completeRingResponse ( Transaction $ trans , array $ response , MessageFactoryInterface $ messageFactory ) { $ trans -> state = 'complete' ; $ trans -> transferInfo = isset ( $ response [ 'transfer_stats' ] ) ? $ response [ 'transfer_stats' ] : [ ] ; if ( ! empty ( $ response [ 'status' ] ) ) { $ options = [ ] ; if ( isset ( $ response [ 'version' ] ) ) { $ options [ 'protocol_version' ] = $ response [ 'version' ] ; } if ( isset ( $ response [ 'reason' ] ) ) { $ options [ 'reason_phrase' ] = $ response [ 'reason' ] ; } $ trans -> response = $ messageFactory -> createResponse ( $ response [ 'status' ] , isset ( $ response [ 'headers' ] ) ? $ response [ 'headers' ] : [ ] , isset ( $ response [ 'body' ] ) ? $ response [ 'body' ] : null , $ options ) ; if ( isset ( $ response [ 'effective_url' ] ) ) { $ trans -> response -> setEffectiveUrl ( $ response [ 'effective_url' ] ) ; } } elseif ( empty ( $ response [ 'error' ] ) ) { // When nothing was returned, then we need to add an error. $ response [ 'error' ] = self :: getNoRingResponseException ( $ trans -> request ) ; } if ( isset ( $ response [ 'error' ] ) ) { $ trans -> state = 'error' ; $ trans -> exception = $ response [ 'error' ] ; } }
Handles the process of processing a response received from a ring
handler. The created response is added to the transaction, and the
transaction stat is set appropriately.

@param Transaction             $trans          Owns request and response.
@param array                   $response       Ring response array
@param MessageFactoryInterface $messageFactory Creates response objects.
Handles the process of processing a response received from a ring handler . The created response is added to the transaction and the transaction stat is set appropriately .