src/Omnipay/Ecopayz/Message/FetchTransactionRequest.php
public function sendData($data)
    {
        if (strpos($data, 'QueryBySVSTransactionID') !== false) {

            $headers = array(
                'Content-Type' => 'text/xml; charset=utf-8',
                'SOAPAction' => 'http://www.ecocard.com/merchantAPI/QueryBySVSTransactionID'
            );

            $httpRequest = $this->httpClient->createRequest('POST', $this->getEndpoint(), $headers, $data);
            $httpResponse = $httpRequest->send();
            $xmlResponse = $httpResponse->xml()
                ->children('http://schemas.xmlsoap.org/soap/envelope/')
                ->children('http://www.ecocard.com/merchantAPI/');

            if (!isset($xmlResponse->QueryBySVSTransactionIDResponse)) {
                throw new InvalidResponseException('Missing element in XML response');
            }

            if (!isset($xmlResponse->QueryBySVSTransactionIDResponse->TransactionResponse)) {
                throw new InvalidResponseException('Missing element in XML response');
            }

            return new FetchTransactionResponse(
                $this,
                $xmlResponse
                    ->QueryBySVSTransactionIDResponse
                    ->TransactionResponse
            );

        } elseif (strpos($data, 'QueryByCustomerTransactionID') !== false) {

            $headers = array(
                'Content-Type' => 'text/xml; charset=utf-8',
                'SOAPAction' => 'http://www.ecocard.com/merchantAPI/QueryByCustomerTransactionID'
            );

            $httpRequest = $this->httpClient->createRequest('POST', $this->getEndpoint(), $headers, $data);
            $httpResponse = $httpRequest->send();
            $xmlResponse = $httpResponse->xml()
                ->children('http://schemas.xmlsoap.org/soap/envelope/')
                ->children('http://www.ecocard.com/merchantAPI/');

            if (!isset($xmlResponse->QueryByCustomerTransactionIDResponse)) {
                throw new InvalidResponseException('Missing element in XML response');
            }

            if (!isset($xmlResponse->QueryByCustomerTransactionIDResponse->TransactionResponse)) {
                throw new InvalidResponseException('Missing element in XML response');
            }

            return new FetchTransactionResponse(
                $this,
                $xmlResponse
                    ->QueryByCustomerTransactionIDResponse
                    ->TransactionResponse
            );

        } else {

            throw new InvalidRequestException('The transactionId or transactionReference parameter is required');

        }
    }
public function sendData($data)
    {
        if (strpos($data, 'QueryBySVSTransactionID') !== false) {

            $headers = array(
                'Content-Type' => 'text/xml; charset=utf-8',
                'SOAPAction' => 'http://www.ecocard.com/merchantAPI/QueryBySVSTransactionID'
            );

            $httpRequest = $this->httpClient->createRequest('POST', $this->getEndpoint(), $headers, $data);
            $httpResponse = $httpRequest->send();
            $xmlResponse = $httpResponse->xml()
                ->children('http://schemas.xmlsoap.org/soap/envelope/')
                ->children('http://www.ecocard.com/merchantAPI/');

            if (!isset($xmlResponse->QueryBySVSTransactionIDResponse)) {
                throw new InvalidResponseException('Missing element in XML response');
            }

            if (!isset($xmlResponse->QueryBySVSTransactionIDResponse->TransactionResponse)) {
                throw new InvalidResponseException('Missing element in XML response');
            }

            return new FetchTransactionResponse(
                $this,
                $xmlResponse
                    ->QueryBySVSTransactionIDResponse
                    ->TransactionResponse
            );

        } elseif (strpos($data, 'QueryByCustomerTransactionID') !== false) {

            $headers = array(
                'Content-Type' => 'text/xml; charset=utf-8',
                'SOAPAction' => 'http://www.ecocard.com/merchantAPI/QueryByCustomerTransactionID'
            );

            $httpRequest = $this->httpClient->createRequest('POST', $this->getEndpoint(), $headers, $data);
            $httpResponse = $httpRequest->send();
            $xmlResponse = $httpResponse->xml()
                ->children('http://schemas.xmlsoap.org/soap/envelope/')
                ->children('http://www.ecocard.com/merchantAPI/');

            if (!isset($xmlResponse->QueryByCustomerTransactionIDResponse)) {
                throw new InvalidResponseException('Missing element in XML response');
            }

            if (!isset($xmlResponse->QueryByCustomerTransactionIDResponse->TransactionResponse)) {
                throw new InvalidResponseException('Missing element in XML response');
            }

            return new FetchTransactionResponse(
                $this,
                $xmlResponse
                    ->QueryByCustomerTransactionIDResponse
                    ->TransactionResponse
            );

        } else {

            throw new InvalidRequestException('The transactionId or transactionReference parameter is required');

        }
    }
public function sendData ( $ data ) { if ( strpos ( $ data , 'QueryBySVSTransactionID' ) !== false ) { $ headers = array ( 'Content-Type' => 'text/xml; charset=utf-8' , 'SOAPAction' => 'http://www.ecocard.com/merchantAPI/QueryBySVSTransactionID' ) ; $ httpRequest = $ this -> httpClient -> createRequest ( 'POST' , $ this -> getEndpoint ( ) , $ headers , $ data ) ; $ httpResponse = $ httpRequest -> send ( ) ; $ xmlResponse = $ httpResponse -> xml ( ) -> children ( 'http://schemas.xmlsoap.org/soap/envelope/' ) -> children ( 'http://www.ecocard.com/merchantAPI/' ) ; if ( ! isset ( $ xmlResponse -> QueryBySVSTransactionIDResponse ) ) { throw new InvalidResponseException ( 'Missing element in XML response' ) ; } if ( ! isset ( $ xmlResponse -> QueryBySVSTransactionIDResponse -> TransactionResponse ) ) { throw new InvalidResponseException ( 'Missing element in XML response' ) ; } return new FetchTransactionResponse ( $ this , $ xmlResponse -> QueryBySVSTransactionIDResponse -> TransactionResponse ) ; } elseif ( strpos ( $ data , 'QueryByCustomerTransactionID' ) !== false ) { $ headers = array ( 'Content-Type' => 'text/xml; charset=utf-8' , 'SOAPAction' => 'http://www.ecocard.com/merchantAPI/QueryByCustomerTransactionID' ) ; $ httpRequest = $ this -> httpClient -> createRequest ( 'POST' , $ this -> getEndpoint ( ) , $ headers , $ data ) ; $ httpResponse = $ httpRequest -> send ( ) ; $ xmlResponse = $ httpResponse -> xml ( ) -> children ( 'http://schemas.xmlsoap.org/soap/envelope/' ) -> children ( 'http://www.ecocard.com/merchantAPI/' ) ; if ( ! isset ( $ xmlResponse -> QueryByCustomerTransactionIDResponse ) ) { throw new InvalidResponseException ( 'Missing element in XML response' ) ; } if ( ! isset ( $ xmlResponse -> QueryByCustomerTransactionIDResponse -> TransactionResponse ) ) { throw new InvalidResponseException ( 'Missing element in XML response' ) ; } return new FetchTransactionResponse ( $ this , $ xmlResponse -> QueryByCustomerTransactionIDResponse -> TransactionResponse ) ; } else { throw new InvalidRequestException ( 'The transactionId or transactionReference parameter is required' ) ; } }
Send the request with specified data

@param  mixed                    $data The data to send
@throws InvalidResponseException
@throws InvalidRequestException
@return FetchTransactionResponse
Send the request with specified data