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
Branches
Tags
No related merge requests found
......@@ -41,10 +41,11 @@ class CRM_Stripe_Webhook {
foreach ($result['values'] as $paymentProcessor) {
$webhook_path = self::getWebhookPath($paymentProcessor['id']);
// @todo consider replacing this:
$processor = new CRM_Core_Payment_Stripe('', civicrm_api3('PaymentProcessor', 'getsingle', ['id' => $paymentProcessor['id']]));
// with
// $processor = \Civi\Payment\System::singleton()->getById($paymentProcessor['id']);
$processor = \Civi\Payment\System::singleton()->getById($paymentProcessor['id']);
if ($processor->stripeClient === NULL) {
// This means we only configured live OR test and not both.
continue;
}
$processor->setAPIParams();
try {
......@@ -200,10 +201,7 @@ class CRM_Stripe_Webhook {
* @param int $paymentProcessorId
*/
public static function createWebhook($paymentProcessorId) {
// @todo consider replacing this:
$processor = new CRM_Core_Payment_Stripe('', civicrm_api3('PaymentProcessor', 'getsingle', ['id' => $paymentProcessorId]));
// With:
// $processor = \Civi\Payment\System::singleton()->getById($paymentProcessor['id']);
$processor = \Civi\Payment\System::singleton()->getById($paymentProcessorId);
$processor->setAPIParams();
$params = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment