Skip to content
Snippets Groups Projects
Commit 3d22e522 authored by mattwire's avatar mattwire
Browse files

Add a system check for invalid API key

parent cf9e7619
No related branches found
No related tags found
1 merge request!23Bugfixes - detect webform correctly, fix stripe customer creation in test mode
......@@ -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(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment