Commit 3d22e522 authored by mattwire's avatar mattwire

Add a system check for invalid API key

parent cf9e7619
......@@ -25,7 +25,23 @@ class CRM_Stripe_Utils_Check_Webhook {
$webhook_path = str_replace('NN', $pp['id'], $webhook_path);
\Stripe\Stripe::setApiKey($sk);
$webhooks = \Stripe\WebhookEndpoint::all(["limit" => 100]);
try {
$webhooks = \Stripe\WebhookEndpoint::all(["limit" => 100]);
}
catch (\Stripe\Error\Authentication $e) {
$messages[] = new CRM_Utils_Check_Message(
'stripe_webhook',
E::ts('The %1 (%2) Payment Processor has an invalid API key', [
1 => $pp['name'],
2 => $pp['id'],
]),
E::ts('Stripe - API Key'),
\Psr\Log\LogLevel::ERROR,
'fa-money'
);
continue;
}
if (empty($webhooks->data)) {
$messages[] = new CRM_Utils_Check_Message(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment