Skip to content

Commit

Permalink
Added support of new api key signature
Browse files Browse the repository at this point in the history
  • Loading branch information
chapdel committed Sep 2, 2023
1 parent 3e292f3 commit f7ebe42
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/NotchPay.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

class NotchPay
{
/** @var string The Paystack API key to be used for requests. */
/** @var string The Notch Pay API key to be used for requests. */
public static string $apiKey;

/** @var string The instance API key, settable once per new instance */
private $instanceApiKey;

/** @var string The base URL for the Paystack API. */
/** @var string The base URL for the Notch Pay API. */
public static $apiBase = 'https://api.notchpay.co';

/**
Expand All @@ -39,7 +39,7 @@ private static function validateApiKey($apiKey): bool
throw new InvalidArgumentException('Api key must be a string and cannot be empty');
}

if(substr( $apiKey, 0, 2 ) !== "b." && substr( $apiKey, 0, 3 ) !== "sb." ) {
if(substr( $apiKey, 0, 2 ) !== "b." && substr( $apiKey, 0, 3 ) !== "sb." && substr( $apiKey, 0, 2 ) !== "pk.") {
throw new InvalidArgumentException('Api key must have a valid signature.');
}
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/Util/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static function utf8(mixed $value): mixed
}

/**
* Converts a response from the Paystack API to the corresponding PHP object.
* Converts a response from the Notch Pay API to the corresponding PHP object.
*/
public static function convertArrayToObject(array $resp): array|object
{
Expand Down

0 comments on commit f7ebe42

Please sign in to comment.