Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Token hash added #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Payu/Parser/PaymentResponseParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ public function parse($rawData)
$statusCode = $this->parseStatusCode($status, $code);
$transactionId = $this->parseTransactionId($xml->REFNO, $statusCode);
$hash = isset($xml->HASH) ? (string) $xml->HASH : null;
$tokenHash = isset($xml->TOKEN_HASH) ? (string) $xml->TOKEN_HASH : null;
$url3DS = isset($xml->URL_3DS) ? (string) $xml->URL_3DS : null;

return new PaymentResponse($statusCode, $code, $message, $transactionId, $hash, $url3DS);
return new PaymentResponse($statusCode, $code, $message, $transactionId, $hash, $url3DS, $tokenHash);
}

private function parseStatusCode($status, $code)
Expand Down
25 changes: 24 additions & 1 deletion src/Payu/Response/PaymentResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,27 @@ class PaymentResponse extends ResponseAbstract
*/
protected $url3DS;

/**
* @var string
*/
protected $tokenHash;

/**
* @param integer $status
* @param string $code
* @param string $message
* @param string $transactionId
* @param string $hash
* @param string $url3DS
* @param string $tokenHash
*/
public function __construct($status, $code, $message, $transactionId, $hash, $url3DS)
public function __construct($status, $code, $message, $transactionId, $hash, $url3DS, $tokenHash)
{
parent::__construct($status, $code, $message);
$this->setTransactionId($transactionId);
$this->setHash($hash);
$this->setUrl3DS($url3DS);
$this->setTokenHash($tokenHash);
}

/**
Expand Down Expand Up @@ -82,4 +89,20 @@ public function setUrl3DS($url3DS)
{
$this->url3DS = $url3DS;
}

/**
* @return string
*/
public function getTokenHash()
{
return $this->tokenHash;
}

/**
* @param string $tokenHash
*/
public function setTokenHash($tokenHash)
{
$this->tokenHash = $tokenHash;
}
}