Skip to content

Commit

Permalink
Fixed TransactionStatusRequest and TransactionStatusResponse for retr…
Browse files Browse the repository at this point in the history
…eiving the statusCode of the transaction.
  • Loading branch information
kiettran committed Feb 25, 2020
1 parent 1cde4ff commit 6e840be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 8 additions & 1 deletion src/Message/TransactionStatusRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,16 @@ public function sendData($data): ResponseInterface
$data
);

$response = array_merge(
$this->getResponseBody(),
[
'statusCode' => $this->getResponse()->getStatusCode(),
]
);

return new TransactionStatusResponse(
$this,
$this->getResponseBody()
$response
);
}
}
6 changes: 1 addition & 5 deletions src/Message/TransactionStatusResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ class TransactionStatusResponse extends AbstractResponse
*/
public function isSuccessful(): bool
{
return parent::isSuccessful()
&& in_array($this->data['statusCode'], [
self::RESPONSE_STATUS_COMPLETED,
self::RESPONSE_STATUS_SETTLED,
]);
return isset($this->data['statusCode']) && $this->data['statusCode'] === 200;
}

/**
Expand Down

0 comments on commit 6e840be

Please sign in to comment.