/** * Function to check whether payment processor supports * cancellation of membership subscription * * @param int $mid membership id * * @return boolean * @access public * @static */ static function isCancelSubscriptionSupported($mid, $isNotCancelled = true) { $cacheKeyString = "{$mid}"; $cacheKeyString .= $isNotCancelled ? "_1" : "_0"; static $supportsCancel = array(); if (!array_key_exists($cacheKeyString, $supportsCancel)) { $supportsCancel[$cacheKeyString] = false; $isCancelled = false; if ($isNotCancelled) { $isCancelled = self::isSubscriptionCancelled($mid); } require_once 'CRM/Core/BAO/PaymentProcessor.php'; require_once 'CRM/Core/Payment.php'; $paymentObject = CRM_Core_BAO_PaymentProcessor::getProcessorForEntity($mid, 'membership', 'obj'); if (!empty($paymentObject)) { $supportsCancel[$cacheKeyString] = CRM_Core_Payment::isCancelSupported($paymentObject) && !$isCancelled; } } return $supportsCancel[$cacheKeyString]; }