Commit 74449047 authored by mattwire's avatar mattwire
Browse files

Fix getSubscriptionDetails when contributionRecur not in CiviCRM

parent 0a7ee88b
......@@ -9,6 +9,7 @@
+--------------------------------------------------------------------+
*/
use Civi\Api4\ContributionRecur;
use Civi\Api4\PaymentprocessorWebhook;
/**
......@@ -657,22 +658,20 @@ class CRM_Core_Payment_StripeIPN {
}
// Get the recurring contribution record associated with the Stripe subscription.
try {
$contributionRecur = \Civi\Api4\ContributionRecur::get(FALSE)
->addWhere('trxn_id', '=', $this->subscription_id)
->addWhere('is_test', 'IN', [TRUE, FALSE])
->execute()
->first();
$this->contribution_recur_id = $contributionRecur['id'];
$this->contributionRecur = $contributionRecur;
}
catch (Exception $e) {
$contributionRecur = ContributionRecur::get(FALSE)
->addWhere('trxn_id', '=', $this->subscription_id)
->addWhere('is_test', 'IN', [TRUE, FALSE])
->execute()
->first();
if (empty($contributionRecur)) {
if ((bool)\Civi::settings()->get('stripe_ipndebug')) {
$message = $this->_paymentProcessor->getPaymentProcessorLabel() . ': ' . $this->getEventID() . ': Cannot find recurring contribution for subscription ID: ' . $this->subscription_id;
Civi::log()->debug($message);
}
return FALSE;
}
$this->contribution_recur_id = $contributionRecur['id'];
$this->contributionRecur = $contributionRecur;
return TRUE;
}
......
Supports Markdown
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