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

Fixed exception messages strings to properly identify source #12

Merged
merged 2 commits into from
Nov 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/VictoriaBank/Completion/CompletionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,34 +67,34 @@ public function validateRequestParams()
if (!isset($this->_requestFields[self::AMOUNT]) || strlen($this->_requestFields[self::AMOUNT]) < 1 || strlen(
$this->_requestFields[self::AMOUNT]
) > 12) {
throw new Exception('Authorization request failed: invalid '.self::AMOUNT);
throw new Exception('Completion request failed: invalid '.self::AMOUNT);
}
if (!isset($this->_requestFields[self::CURRENCY]) || strlen($this->_requestFields[self::CURRENCY]) != 3) {
throw new Exception('Authorization request failed: invalid '.self::CURRENCY);
throw new Exception('Completion request failed: invalid '.self::CURRENCY);
}
if (!isset($this->_requestFields[self::ORDER]) || strlen($this->_requestFields[self::ORDER]) < 6 || strlen(
$this->_requestFields[self::ORDER]
) > 32) {
throw new Exception('Authorization request failed: invalid '.self::ORDER);
throw new Exception('Completion request failed: invalid '.self::ORDER);
}
if (!isset($this->_requestFields[self::TERMINAL]) || strlen($this->_requestFields[self::TERMINAL]) != 8) {
throw new Exception('Authorization request failed: invalid '.self::TERMINAL);
throw new Exception('Completion request failed: invalid '.self::TERMINAL);
}
if (!isset($this->_requestFields[self::TIMESTAMP]) || strlen($this->_requestFields[self::TIMESTAMP]) != 14) {
throw new Exception('Authorization request failed: invalid '.self::TIMESTAMP);
throw new Exception('Completion request failed: invalid '.self::TIMESTAMP);
}
if (!isset($this->_requestFields[self::NONCE]) || strlen($this->_requestFields[self::NONCE]) < 20 || strlen(
$this->_requestFields[self::NONCE]
) > 32) {
throw new Exception('Authorization request failed: invalid '.self::NONCE);
throw new Exception('Completion request failed: invalid '.self::NONCE);
}
if (!isset($this->_requestFields[self::RRN]) || strlen($this->_requestFields[self::RRN]) != 12) {
throw new Exception('Authorization request failed: invalid '.self::RRN);
throw new Exception('Completion request failed: invalid '.self::RRN);
}
if (!isset($this->_requestFields[self::INT_REF]) || strlen($this->_requestFields[self::INT_REF]) < 1 || strlen(
$this->_requestFields[self::INT_REF]
) > 32) {
throw new Exception('Authorization request failed: invalid '.self::INT_REF);
throw new Exception('Completion request failed: invalid '.self::INT_REF);
}

return $this;
Expand Down
6 changes: 3 additions & 3 deletions src/VictoriaBank/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ abstract class Response implements ResponseInterface
*/
public function __construct(array $responseData)
{
#Make sure to set these static params prior to calling the request
#Make sure to set these static params prior to calling the response
if (is_null(self::$bankPublicKeyPath)) {
throw new Exception('Could not instantiate the bank request - missing parameter bankPublicKeyPath');
throw new Exception('Could not instantiate the bank response - missing parameter bankPublicKeyPath');
}
if (is_null(self::$signaturePrefix)) {
throw new Exception('Could not instantiate the bank request - missing parameter signaturePrefix');
throw new Exception('Could not instantiate the bank response - missing parameter signaturePrefix');
}
if (empty($responseData)) {
throw new Exception('Bank response error: Empty data received');
Expand Down
16 changes: 8 additions & 8 deletions src/VictoriaBank/Reversal/ReversalRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,34 +67,34 @@ public function validateRequestParams()
if (!isset($this->_requestFields[self::AMOUNT]) || strlen($this->_requestFields[self::AMOUNT]) < 1 || strlen(
$this->_requestFields[self::AMOUNT]
) > 12) {
throw new Exception('Authorization request failed: invalid '.self::AMOUNT);
throw new Exception('Reversal request failed: invalid '.self::AMOUNT);
}
if (!isset($this->_requestFields[self::CURRENCY]) || strlen($this->_requestFields[self::CURRENCY]) != 3) {
throw new Exception('Authorization request failed: invalid '.self::CURRENCY);
throw new Exception('Reversal request failed: invalid '.self::CURRENCY);
}
if (!isset($this->_requestFields[self::ORDER]) || strlen($this->_requestFields[self::ORDER]) < 6 || strlen(
$this->_requestFields[self::ORDER]
) > 32) {
throw new Exception('Authorization request failed: invalid '.self::ORDER);
throw new Exception('Reversal request failed: invalid '.self::ORDER);
}
if (!isset($this->_requestFields[self::TERMINAL]) || strlen($this->_requestFields[self::TERMINAL]) != 8) {
throw new Exception('Authorization request failed: invalid '.self::TERMINAL);
throw new Exception('Reversal request failed: invalid '.self::TERMINAL);
}
if (!isset($this->_requestFields[self::TIMESTAMP]) || strlen($this->_requestFields[self::TIMESTAMP]) != 14) {
throw new Exception('Authorization request failed: invalid '.self::TIMESTAMP);
throw new Exception('Reversal request failed: invalid '.self::TIMESTAMP);
}
if (!isset($this->_requestFields[self::NONCE]) || strlen($this->_requestFields[self::NONCE]) < 20 || strlen(
$this->_requestFields[self::NONCE]
) > 32) {
throw new Exception('Authorization request failed: invalid '.self::NONCE);
throw new Exception('Reversal request failed: invalid '.self::NONCE);
}
if (!isset($this->_requestFields[self::RRN]) || strlen($this->_requestFields[self::RRN]) != 12) {
throw new Exception('Authorization request failed: invalid '.self::RRN);
throw new Exception('Reversal request failed: invalid '.self::RRN);
}
if (!isset($this->_requestFields[self::INT_REF]) || strlen($this->_requestFields[self::INT_REF]) < 1 || strlen(
$this->_requestFields[self::INT_REF]
) > 32) {
throw new Exception('Authorization request failed: invalid '.self::INT_REF);
throw new Exception('Reversal request failed: invalid '.self::INT_REF);
}

return $this;
Expand Down