lib/Braintree/DisputeGateway.php
public function addTextEvidence($id, $contentOrRequest)
    {
        $request = is_array($contentOrRequest) ? $contentOrRequest : ['content' => $contentOrRequest];
        if (trim($request['content']) == "") {
            throw new InvalidArgumentException('content cannot be blank');
        }

        try {
            $evidence = [
                'comments' => $request['content'],
            ];

            if (trim($id) == "") {
                throw new Exception\NotFound();
            }

            if (array_key_exists('tag', $request)) {
                $evidence['category'] = $request['tag'];
            }

            if (array_key_exists('category', $request)) {
                if (trim($request['category']) == "") {
                    throw new InvalidArgumentException('category cannot be blank');
                }
                $evidence['category'] = $request['category'];
            }

            if (array_key_exists('sequenceNumber', $request)) {
                if (trim($request['sequenceNumber']) == "") {
                    throw new InvalidArgumentException('sequenceNumber cannot be blank');
                } else if ((string)(int)($request['sequenceNumber']) != $request['sequenceNumber']) {
                    throw new InvalidArgumentException('sequenceNumber must be an integer');
                }
                $evidence['sequenceNumber'] = (int)$request['sequenceNumber'];
            }

            $path = $this->_config->merchantPath() . '/disputes/' . $id . '/evidence';
            $response = $this->_http->post($path, [
                'evidence' =>  $evidence
            ]);

            if (isset($response['apiErrorResponse'])) {
                return new Result\Error($response['apiErrorResponse']);
            }

            if (isset($response['evidence'])) {
                $evidence = new Dispute\EvidenceDetails($response['evidence']);
                return new Result\Successful($evidence);
            }
        } catch (Exception\NotFound $e) {
            throw new Exception\NotFound('dispute with id "' . $id . '" not found');
        }
    }
public function addTextEvidence($id, $contentOrRequest)
    {
        $request = is_array($contentOrRequest) ? $contentOrRequest : ['content' => $contentOrRequest];
        if (trim($request['content']) == "") {
            throw new InvalidArgumentException('content cannot be blank');
        }

        try {
            $evidence = [
                'comments' => $request['content'],
            ];

            if (trim($id) == "") {
                throw new Exception\NotFound();
            }

            if (array_key_exists('tag', $request)) {
                $evidence['category'] = $request['tag'];
            }

            if (array_key_exists('category', $request)) {
                if (trim($request['category']) == "") {
                    throw new InvalidArgumentException('category cannot be blank');
                }
                $evidence['category'] = $request['category'];
            }

            if (array_key_exists('sequenceNumber', $request)) {
                if (trim($request['sequenceNumber']) == "") {
                    throw new InvalidArgumentException('sequenceNumber cannot be blank');
                } else if ((string)(int)($request['sequenceNumber']) != $request['sequenceNumber']) {
                    throw new InvalidArgumentException('sequenceNumber must be an integer');
                }
                $evidence['sequenceNumber'] = (int)$request['sequenceNumber'];
            }

            $path = $this->_config->merchantPath() . '/disputes/' . $id . '/evidence';
            $response = $this->_http->post($path, [
                'evidence' =>  $evidence
            ]);

            if (isset($response['apiErrorResponse'])) {
                return new Result\Error($response['apiErrorResponse']);
            }

            if (isset($response['evidence'])) {
                $evidence = new Dispute\EvidenceDetails($response['evidence']);
                return new Result\Successful($evidence);
            }
        } catch (Exception\NotFound $e) {
            throw new Exception\NotFound('dispute with id "' . $id . '" not found');
        }
    }
public function addTextEvidence ( $ id , $ contentOrRequest ) { $ request = is_array ( $ contentOrRequest ) ? $ contentOrRequest : [ 'content' => $ contentOrRequest ] ; if ( trim ( $ request [ 'content' ] ) == "" ) { throw new InvalidArgumentException ( 'content cannot be blank' ) ; } try { $ evidence = [ 'comments' => $ request [ 'content' ] , ] ; if ( trim ( $ id ) == "" ) { throw new Exception \ NotFound ( ) ; } if ( array_key_exists ( 'tag' , $ request ) ) { $ evidence [ 'category' ] = $ request [ 'tag' ] ; } if ( array_key_exists ( 'category' , $ request ) ) { if ( trim ( $ request [ 'category' ] ) == "" ) { throw new InvalidArgumentException ( 'category cannot be blank' ) ; } $ evidence [ 'category' ] = $ request [ 'category' ] ; } if ( array_key_exists ( 'sequenceNumber' , $ request ) ) { if ( trim ( $ request [ 'sequenceNumber' ] ) == "" ) { throw new InvalidArgumentException ( 'sequenceNumber cannot be blank' ) ; } else if ( ( string ) ( int ) ( $ request [ 'sequenceNumber' ] ) != $ request [ 'sequenceNumber' ] ) { throw new InvalidArgumentException ( 'sequenceNumber must be an integer' ) ; } $ evidence [ 'sequenceNumber' ] = ( int ) $ request [ 'sequenceNumber' ] ; } $ path = $ this -> _config -> merchantPath ( ) . '/disputes/' . $ id . '/evidence' ; $ response = $ this -> _http -> post ( $ path , [ 'evidence' => $ evidence ] ) ; if ( isset ( $ response [ 'apiErrorResponse' ] ) ) { return new Result \ Error ( $ response [ 'apiErrorResponse' ] ) ; } if ( isset ( $ response [ 'evidence' ] ) ) { $ evidence = new Dispute \ EvidenceDetails ( $ response [ 'evidence' ] ) ; return new Result \ Successful ( $ evidence ) ; } } catch ( Exception \ NotFound $ e ) { throw new Exception \ NotFound ( 'dispute with id "' . $ id . '" not found' ) ; } }
Adds text evidence to a dispute, given a dispute ID and content

@param string $id
@param string $content
Adds text evidence to a dispute given a dispute ID and content