Payu\Parser\PaymentResponseParser::parse PHP Method

parse() public method

public parse ( Guzzle\Http\EntityBody | string | array $rawData ) : PaymentResponse | ResponseAbstract
$rawData Guzzle\Http\EntityBody | string | array
return Payu\Response\PaymentResponse | Payu\Response\ResponseAbstract
    public function parse($rawData)
    {
        try {
            $xml = $rawData instanceof EntityBody || is_string($rawData) ? new SimpleXMLElement($rawData) : (object) $rawData;
        } catch (Exception $e) {
            throw new BadResponseError('Unexpected response received from provider. Response: ' . $rawData);
        }
        $status = (string) $xml->STATUS;
        $code = (string) $xml->RETURN_CODE;
        $message = (string) $xml->RETURN_MESSAGE;
        $statusCode = $this->parseStatusCode($status, $code);
        $transactionId = $this->parseTransactionId($xml->REFNO, $statusCode);
        $hash = isset($xml->HASH) ? (string) $xml->HASH : null;
        $url3DS = isset($xml->URL_3DS) ? (string) $xml->URL_3DS : null;
        return new PaymentResponse($statusCode, $code, $message, $transactionId, $hash, $url3DS);
    }