Skip to content
Snippets Groups Projects
Commit 21506a41 authored by mattwire's avatar mattwire
Browse files

Don't crash on webhook check if only one of live/test is configured

parent 16def2fb
No related branches found
No related tags found
No related merge requests found
...@@ -41,10 +41,11 @@ class CRM_Stripe_Webhook { ...@@ -41,10 +41,11 @@ class CRM_Stripe_Webhook {
foreach ($result['values'] as $paymentProcessor) { foreach ($result['values'] as $paymentProcessor) {
$webhook_path = self::getWebhookPath($paymentProcessor['id']); $webhook_path = self::getWebhookPath($paymentProcessor['id']);
// @todo consider replacing this: $processor = \Civi\Payment\System::singleton()->getById($paymentProcessor['id']);
$processor = new CRM_Core_Payment_Stripe('', civicrm_api3('PaymentProcessor', 'getsingle', ['id' => $paymentProcessor['id']])); if ($processor->stripeClient === NULL) {
// with // This means we only configured live OR test and not both.
// $processor = \Civi\Payment\System::singleton()->getById($paymentProcessor['id']); continue;
}
$processor->setAPIParams(); $processor->setAPIParams();
try { try {
...@@ -200,10 +201,7 @@ class CRM_Stripe_Webhook { ...@@ -200,10 +201,7 @@ class CRM_Stripe_Webhook {
* @param int $paymentProcessorId * @param int $paymentProcessorId
*/ */
public static function createWebhook($paymentProcessorId) { public static function createWebhook($paymentProcessorId) {
// @todo consider replacing this: $processor = \Civi\Payment\System::singleton()->getById($paymentProcessorId);
$processor = new CRM_Core_Payment_Stripe('', civicrm_api3('PaymentProcessor', 'getsingle', ['id' => $paymentProcessorId]));
// With:
// $processor = \Civi\Payment\System::singleton()->getById($paymentProcessor['id']);
$processor->setAPIParams(); $processor->setAPIParams();
$params = [ $params = [
......
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