Skip to content

Commit

Permalink
Fixed an issue with the invalid data exception
Browse files Browse the repository at this point in the history
Appearently, StyleCI changed the class name and I did not notice...
Gotta add unit tests.
  • Loading branch information
RonMelkhior committed Jan 17, 2017
1 parent 7dffa7a commit 7d0bfc1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ try {
}
} catch (RonMelkhior\CoinpaymentsIPN\Exceptions\InvalidRequestException $e) {
// The IPN data was not valid to begin with (missing data, invalid IPN method).
} catch (RonMelkhior\CoinpaymentsIPN\Exceptions\InvalidDataException $e) {
} catch (RonMelkhior\CoinpaymentsIPN\Exceptions\InsufficientDataException $e) {
// Sufficient data provided, but either the merchant ID or the IPN secret didn't match.
} catch (RonMelkhior\CoinpaymentsIPN\Exceptions\FailedPaymentException $e) {
// IPN worked, but the payment has failed (PayPal refund/cancelled/timed out).
Expand Down
6 changes: 3 additions & 3 deletions src/RonMelkhior/CoinpaymentsIPN/IPN.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use RonMelkhior\CoinpaymentsIPN\Initialize;
use RonMelkhior\CoinpaymentsIPN\Exceptions\InvalidRequestException;
use RonMelkhior\CoinpaymentsIPN\Exceptions\InvalidDataException;
use RonMelkhior\CoinpaymentsIPN\Exceptions\InsufficientDataException;
use RonMelkhior\CoinpaymentsIPN\Exceptions\FailedPaymentException;

class IPN
Expand All @@ -29,11 +29,11 @@ public function validate(array $post_data, array $server_data)
}

if ($server_data['PHP_AUTH_USER'] !== $this->merchant_id) {
throw new InvalidDataException("Invalid merchant ID provided.");
throw new InsufficientDataException("Invalid merchant ID provided.");
}

if ($server_data['PHP_AUTH_PW'] !== $this->ipn_secret) {
throw new InvalidDataException("Invalid IPN secret provided.");
throw new InsufficientDataException("Invalid IPN secret provided.");
}

$order_status = $post_data['status'];
Expand Down

0 comments on commit 7d0bfc1

Please sign in to comment.