public function Action()
 {
     $return = '';
     if (!empty($_POST['invoices'])) {
         $notfound = array();
         $updated = array();
         $db = JFactory::getDBO();
         $list = explode("\n", $_POST['invoices']);
         foreach ($list as $li) {
             $invoice = new Invoice();
             $invoice->loadInvoiceNumber(trim($li));
             if (empty($invoice->id)) {
                 $notfound[] = trim($li);
                 continue;
             }
             if (!is_numeric($invoice->usage)) {
                 $notfound[] = trim($li);
                 continue;
             }
             $metaUser = new metaUser($invoice->userid);
             $cfid = $metaUser->focusSubscription->id;
             if ($cfid != $invoice->subscr_id) {
                 if (!$metaUser->moveFocus($invoice->subscr_id)) {
                     $notfound[] = trim($li);
                     continue;
                 }
             }
             if ($metaUser->focusSubscription->status == 'Active') {
                 $metaUser->focusSubscription->expiration = date('Y-m-d H:i:s', (int) gmdate('U') - 60);
                 $metaUser->focusSubscription->plan = $invoice->usage;
                 $metaUser->focusSubscription->type = $invoice->method;
                 $metaUser->focusSubscription->recurring = 1;
                 $metaUser->focusSubscription->check();
                 $metaUser->focusSubscription->store();
                 $updated[] = $invoice->invoice_number;
             } else {
                 $metaUser->focusSubscription->status = 'Active';
                 $metaUser->focusSubscription->expiration = date('Y-m-d H:i:s', (int) gmdate('U') - 60);
                 $metaUser->focusSubscription->plan = $invoice->usage;
                 $metaUser->focusSubscription->type = $invoice->method;
                 $metaUser->focusSubscription->recurring = 1;
                 $metaUser->focusSubscription->check();
                 $metaUser->focusSubscription->store();
                 $updated[] = $invoice->invoice_number;
             }
         }
         $return = '<p>Provided ' . count($list) . ' Invoice Numbers.</p>';
         if (count($updated)) {
             $return .= '<p>Updated ' . count($updated) . ' Invoices:</p>';
             $return .= '<p>' . implode(', ', $updated) . '</p>';
         }
         if (count($notfound)) {
             $return .= '<p>Failed to process the following ' . count($notfound) . ' Invoices:</p>';
             $return .= '<p>' . implode(', ', $notfound) . '</p>';
         }
     } elseif (isset($_POST['invoices'])) {
         $return = '<p>Please enter invoice numbers.</p>';
     }
     return $return;
 }
Beispiel #2
0
 public function save($userid, $subscriptionid, $assignto_plan)
 {
     $post = $_POST;
     if (!empty($assignto_plan)) {
         if ($assignto_plan[0] == 0) {
             unset($assignto_plan[0]);
         }
     }
     $metaUser = new metaUser($userid);
     if ($metaUser->hasSubscription && !empty($subscriptionid)) {
         $metaUser->moveFocus($subscriptionid);
     }
     $ck_primary = aecGetParam('ck_primary');
     if ($ck_primary && !$metaUser->focusSubscription->primary) {
         $metaUser->focusSubscription->makePrimary();
     }
     if (!empty($assignto_plan) && is_array($assignto_plan)) {
         foreach ($assignto_plan as $assign_planid) {
             $plan = new SubscriptionPlan();
             $plan->load($assign_planid);
             $metaUser->establishFocus($plan);
             $metaUser->focusSubscription->applyUsage($assign_planid, 'none', 1);
             // We have to reload the metaUser object because of the changes
             $metaUser = new metaUser($userid);
         }
     }
     $ck_lifetime = aecGetParam('ck_lifetime');
     $set_status = trim(aecGetParam('set_status', null));
     if (!$metaUser->hasSubscription) {
         if ($set_status == 'excluded') {
             $metaUser->focusSubscription = new Subscription();
             $metaUser->focusSubscription->createNew($metaUser->userid, 'none', 0);
             $metaUser->hasSubscription = true;
         } else {
             echo "<script> alert('" . JText::_('AEC_ERR_NO_SUBSCRIPTION') . "'); window.history.go(-1); </script>\n";
             exit;
         }
     }
     if (empty($assignto_plan)) {
         if ($ck_lifetime) {
             $metaUser->focusSubscription->expiration = '9999-12-31 00:00:00';
             $metaUser->focusSubscription->status = 'Active';
             $metaUser->focusSubscription->lifetime = 1;
         } elseif (!empty($post['expiration'])) {
             if ($post['expiration'] != $post['expiration_check']) {
                 if (strpos($post['expiration'], ':') === false) {
                     $metaUser->focusSubscription->expiration = $post['expiration'] . ' 00:00:00';
                 } else {
                     $metaUser->focusSubscription->expiration = $post['expiration'];
                 }
                 if ($metaUser->focusSubscription->status == 'Trial') {
                     $metaUser->focusSubscription->status = 'Trial';
                 } else {
                     $metaUser->focusSubscription->status = 'Active';
                 }
                 $metaUser->focusSubscription->lifetime = 0;
             }
         }
     }
     if (!empty($set_status)) {
         switch ($set_status) {
             case 'expired':
                 $metaUser->focusSubscription->expire();
                 break;
             case 'cancelled':
                 $metaUser->focusSubscription->cancel();
                 break;
             default:
                 $metaUser->focusSubscription->setStatus(ucfirst($set_status));
                 break;
         }
     }
     if (!empty($post['notes'])) {
         $metaUser->focusSubscription->customparams['notes'] = $post['notes'];
         unset($post['notes']);
     }
     if ($metaUser->hasSubscription) {
         $metaUser->focusSubscription->storeload();
     }
     $userMIs = $metaUser->getUserMIs();
     if (!empty($userMIs)) {
         foreach ($userMIs as $m) {
             $params = array();
             $pref = 'mi_' . $m->id . '_';
             $uf = $m->profile_form($metaUser);
             if (!empty($uf)) {
                 foreach ($uf as $k => $v) {
                     if (isset($post[$pref . $k])) {
                         $params[$k] = $post[$pref . $k];
                     }
                 }
                 $m->profile_form_save($metaUser, $params);
             }
             $admin_params = array();
             $af = $m->admin_form($metaUser);
             if (!empty($af)) {
                 foreach ($af as $k => $v) {
                     if (isset($post[$pref . $k])) {
                         $admin_params[$k] = $post[$pref . $k];
                     }
                 }
                 $m->admin_form_save($metaUser, $admin_params);
             }
             if (empty($params)) {
                 continue;
             }
             $metaUser->meta->setMIParams($m->id, null, $params, true);
         }
         $metaUser->meta->storeload();
     }
 }
Beispiel #3
0
 /**
  * @param InvoiceFactory $InvoiceFactory
  */
 public function processorResponse($InvoiceFactory, $response, $resp = '', $altvalidation = false)
 {
     global $aecConfig;
     if (!is_array($response)) {
         $response = array('original_response' => $response);
     }
     $this->computeAmount($InvoiceFactory);
     $objUsage = $this->getObjUsage();
     if (is_a($objUsage, 'SubscriptionPlan')) {
         $plan = $objUsage;
     } else {
         $plan = $objUsage->getTopPlan();
     }
     $response['planparams'] = $plan->getProcessorParameters($InvoiceFactory->pp);
     $post = aecPostParamClear($_POST);
     $response['userid'] = $this->userid;
     $InvoiceFactory->pp->exchangeSettingsByPlan($plan, $plan->params);
     if ($altvalidation) {
         $response = $InvoiceFactory->pp->instantvalidateNotification($response, $post, $this);
     } else {
         $response = $InvoiceFactory->pp->validateNotification($response, $post, $this);
     }
     if (!empty($aecConfig->cfg['invoice_cushion']) && $this->transaction_date !== '0000-00-00 00:00:00') {
         if (strtotime($this->transaction_date) + $aecConfig->cfg['invoice_cushion'] * 60 > (int) gmdate('U')) {
             if ($InvoiceFactory->pp->processor_name == 'desjardins') {
                 // Desjardins is the only exception so far... bad bad bad
             } elseif ($response['valid']) {
                 // The last notification has not been too long ago - skipping this one
                 // But only skip actual payment notifications - errors are OK
                 $short = JText::_('AEC_MSG_PROC_INVOICE_ACTION_SH');
                 $event = JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV_DUPLICATE') . "\n";
                 $tags = 'invoice,processor,duplicate';
                 $level = 2;
                 $params = array('invoice_number' => $this->invoice_number);
                 $eventlog = new eventLog();
                 $eventlog->issue($short, $tags, $event, $level, $params);
                 return $response;
             }
         }
     }
     if (isset($response['userid'])) {
         unset($response['userid']);
     }
     if (isset($response['planparams'])) {
         unset($response['planparams']);
     }
     if (isset($response['secondary_ident'])) {
         $this->secondary_ident = $response['secondary_ident'];
         $this->storeload();
         unset($response['secondary_ident']);
     }
     if (isset($response['invoiceparams'])) {
         $this->addParams($response['invoiceparams']);
         $this->storeload();
         unset($response['invoiceparams']);
     }
     if (isset($response['multiplicator'])) {
         $multiplicator = $response['multiplicator'];
         unset($response['multiplicator']);
     } else {
         $multiplicator = 1;
     }
     if (isset($response['fullresponse'])) {
         $resp = $response['fullresponse'];
         unset($response['fullresponse']);
     }
     if (empty($resp) && !empty($response['raw'])) {
         $resp = $response['raw'];
     }
     if (isset($response['break_processing'])) {
         unset($response['break_processing']);
         return $response;
     }
     $metaUser = new metaUser($this->userid);
     $mi_event = null;
     // Create history entry
     $history = new logHistory();
     $history->entryFromInvoice($this, $resp, $InvoiceFactory->pp);
     $short = JText::_('AEC_MSG_PROC_INVOICE_ACTION_SH');
     $event = JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV') . "\n";
     if (!empty($response)) {
         foreach ($response as $key => $value) {
             $event .= $key . "=" . $value . "\n";
         }
     }
     $event .= JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV_STATUS');
     $tags = 'invoice,processor';
     $level = 2;
     $params = array('invoice_number' => $this->invoice_number);
     $forcedisplay = false;
     $event .= ' ';
     $notificationerror = null;
     if ($response['valid']) {
         $break = 0;
         // If not in Testmode, check for amount and currency
         if (empty($InvoiceFactory->pp->settings['testmode'])) {
             if (isset($response['amount_paid'])) {
                 // In some cases, a straight up != can still come out as an error, so forcing INT
                 $ampaid = (int) ($response['amount_paid'] * 100);
                 $amasked = (int) ($this->amount * 100);
                 if ($ampaid != $amasked) {
                     // Amount Fraud, cancel payment and create error log addition
                     $event .= sprintf(JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV_FRAUD'), $response['amount_paid'], $this->amount);
                     $tags .= ',fraud_attempt,amount_fraud';
                     $break = 1;
                     $notificationerror = 'Wrong amount for invoice. Amount provided: "' . $response['amount_paid'] . '"';
                 }
             }
             if (isset($response['amount_currency'])) {
                 if ($response['amount_currency'] != $this->currency) {
                     // Amount Fraud, cancel payment and create error log addition
                     $event .= sprintf(JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV_CURR'), $response['amount_currency'], $this->currency);
                     $tags .= ',fraud_attempt,currency_fraud';
                     $break = 1;
                     $notificationerror = 'Wrong currency for invoice. Currency provided: "' . $response['amount_currency'] . '"';
                 }
             }
         }
         if (!$break) {
             if ($this->pay($multiplicator) === false) {
                 $notificationerror = 'Item Application failed. Please contact the System Administrator';
                 // Something went wrong
                 $event .= JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV_VALID_APPFAIL');
                 $tags .= ',payment,action_failed';
             } else {
                 $event .= JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV_VALID');
                 $tags .= ',payment,action';
             }
         } else {
             $level = 128;
         }
     } else {
         if (isset($response['pending'])) {
             if (strcmp($response['pending_reason'], 'signup') === 0) {
                 if ($plan->params['trial_free'] || $this->amount == '0.00') {
                     $this->pay($multiplicator);
                     $this->addParams(array('free_trial' => $response['pending_reason']), 'params', true);
                     $event .= JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV_TRIAL');
                     $tags .= ',payment,action,trial';
                 }
             } else {
                 $this->addParams(array('pending_reason' => $response['pending_reason']), 'params', true);
                 $event .= sprintf(JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV_PEND'), $response['pending_reason']);
                 $tags .= ',payment,pending' . $response['pending_reason'];
                 $mi_event = '_payment_pending';
             }
             $this->storeload();
         } elseif (isset($response['cancel'])) {
             $mi_event = '_payment_cancel';
             $event .= JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV_CANCEL');
             $tags .= ',cancel';
             if ($metaUser->hasSubscription) {
                 if (!empty($this->subscr_id)) {
                     $metaUser->moveFocus($this->subscr_id);
                 }
                 if (isset($response['cancel_expire'])) {
                     $mi_event = '_payment_cancel_expire';
                     $metaUser->focusSubscription->expire();
                     $tags .= ',expire';
                 } else {
                     $metaUser->focusSubscription->cancel($this);
                 }
                 $event .= JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV_USTATUS');
             }
         } elseif (isset($response['chargeback'])) {
             $mi_event = '_payment_chargeback';
             $event .= JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV_CHARGEBACK');
             $tags .= ',chargeback';
             $level = 128;
             if ($metaUser->hasSubscription) {
                 if (!empty($this->subscr_id)) {
                     $metaUser->moveFocus($this->subscr_id);
                 }
                 $metaUser->focusSubscription->hold($this);
                 $event .= JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV_USTATUS_HOLD');
             }
         } elseif (isset($response['chargeback_settle'])) {
             $mi_event = '_payment_chargeback_settle';
             $event .= JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV_CHARGEBACK_SETTLE');
             $tags .= ',chargeback_settle';
             $level = 8;
             $forcedisplay = true;
             if ($metaUser->hasSubscription) {
                 if (!empty($this->subscr_id)) {
                     $metaUser->moveFocus($this->subscr_id);
                 }
                 $metaUser->focusSubscription->hold_settle($this);
                 $event .= JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV_USTATUS_ACTIVE');
             }
         } elseif (isset($response['delete'])) {
             $mi_event = '_payment_refund';
             $event .= JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV_REFUND');
             $tags .= ',refund';
             if ($metaUser->hasSubscription) {
                 if (!empty($this->subscr_id)) {
                     $metaUser->moveFocus($this->subscr_id);
                 }
                 $usage = $this->getObjUsage();
                 if (is_a($usage, 'SubscriptionPlan')) {
                     // Check whether we're really expiring the right membership,
                     // Maybe the user was already switched to a different plan
                     if ($metaUser->focusSubscription->plan == $usage->id) {
                         $metaUser->focusSubscription->expire(false, 'refund');
                         $event .= JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV_EXPIRED');
                     }
                 } else {
                     $metaUser->focusSubscription->expire(false, 'refund');
                     $event .= JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV_EXPIRED');
                 }
             }
         } elseif (isset($response['eot'])) {
             $mi_event = '_payment_eot';
             $event .= JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV_EOT');
             $tags .= ',eot';
         } elseif (isset($response['duplicate'])) {
             $mi_event = '_payment_duplicate';
             $event .= JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV_DUPLICATE');
             $tags .= ',duplicate';
         } elseif (isset($response['null'])) {
             $mi_event = '_payment_null';
             $event .= JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV_NULL');
             $tags .= ',null';
         } elseif (isset($response['error']) && isset($response['errormsg'])) {
             $mi_event = '_payment_error';
             $event .= 'Error:' . $response['errormsg'];
             $tags .= ',error';
             $level = 128;
             $notificationerror = $response['errormsg'];
         } else {
             $event .= JText::_('AEC_MSG_PROC_INVOICE_ACTION_EV_U_ERROR');
             $tags .= ',general_error';
             $level = 128;
             $notificationerror = 'General Error. Please contact the System Administrator.';
         }
     }
     if (!empty($mi_event) && !empty($this->usage)) {
         $objUsage = new SubscriptionPlan();
         $objUsage->load($this->usage);
         $exchange = $silent = null;
         $objUsage->triggerMIs($mi_event, $metaUser, $exchange, $this, $response, $silent);
     }
     if (isset($response['explanation'])) {
         $event .= " (" . $response['explanation'] . ")";
     }
     $eventlog = new eventLog();
     $eventlog->issue($short, $tags, $event, $level, $params, $forcedisplay);
     if (!empty($notificationerror)) {
         $InvoiceFactory->pp->notificationError($response, $notificationerror);
     } else {
         $InvoiceFactory->pp->notificationSuccess($response);
     }
     return $response;
 }
 public function expire($overridefallback = false, $special = null, $now = true)
 {
     // Users who are excluded cannot expire
     if ($this->isExcluded()) {
         return null;
     }
     $plan = $this->getPlan();
     if (empty($plan)) {
         if ($now) {
             $this->expireNow();
         }
         return $this->setStatus('Expired');
     }
     $expired = true;
     // Recognize the fallback plan, if not overridden
     if (!empty($plan->params['fallback']) && !$overridefallback) {
         // Prevent fallback if an active parent is required, but not this or not present
         if (!$this->isPrimary() && !$plan->params['make_primary'] && !empty($plan->params['fallback_req_parent'])) {
             $metaUser = new metaUser($this->userid);
             $overridefallback = $metaUser->objSubscription->isExpired();
         }
         if (!$overridefallback) {
             $this->applyUsage($plan->params['fallback'], 'none', 1);
             $expired = null;
         }
     } else {
         // Set a Trial flag if this is an expired Trial for further reference
         if ($this->isTrial()) {
             $this->addParams(array('trialflag' => 1));
         } elseif (is_array($this->params)) {
             if (in_array('trialflag', $this->params)) {
                 $this->delParams(array('trialflag'));
             }
         }
         if (!$this->isStatus('Expired') && !$this->isClosed()) {
             if ($now) {
                 $this->expireNow();
             }
             $this->setStatus('Expired');
         }
         $metaUser = new metaUser($this->userid);
         if ($metaUser->moveFocus($this->id)) {
             // Call Expiration MIs
             $mih = new microIntegrationHandler();
             $mih->userPlanExpireActions($metaUser, $plan, $special);
         }
     }
     $this->reload();
     return $expired;
 }
Beispiel #5
0
 public function exportMembers()
 {
     $db = JFactory::getDBO();
     foreach ($this->filter as $k => $v) {
         if (empty($v)) {
             $this->filter[$k] = array();
         }
     }
     // Assemble Database call
     if (!in_array('notconfig', $this->filter['status'])) {
         $where = array();
         if (!empty($this->filter['planid'])) {
             $where[] = '`plan` IN (' . implode(',', $this->filter['planid']) . ')';
         }
         $query = 'SELECT a.id, a.userid' . ' FROM #__acctexp_subscr AS a' . ' INNER JOIN #__users AS b ON a.userid = b.id';
         if (!empty($where)) {
             $query .= ' WHERE ( ' . implode(' OR ', $where) . ' )';
         }
         if (!empty($this->filter['status'])) {
             $stati = array();
             foreach ($this->filter['status'] as $status) {
                 $stati[] = 'LOWER( `status` ) = \'' . strtolower($status) . '\'';
             }
             if (!empty($where)) {
                 $query .= ' AND (' . implode(' OR ', $stati) . ')';
             } else {
                 $query .= ' WHERE (' . implode(' OR ', $stati) . ')';
             }
         }
         if (!empty($this->filter['orderby'])) {
             $query .= ' ORDER BY ' . $this->filter['orderby'] . '';
         }
     } else {
         $query = 'SELECT DISTINCT b.id AS `userid`' . ' FROM #__users as b' . ' WHERE b.id NOT IN (' . ' SELECT a.userid' . ' FROM #__acctexp_subscr as a);';
     }
     $db->setQuery($query);
     $descriptions = AECToolbox::rewriteEngineExplain($this->options['rewrite_rule']);
     $descarray = explode(';', $descriptions);
     $this->exphandler->putDescription($descarray);
     // Fetch Userlist
     $userlist = $db->loadObjectList();
     // Plans Array
     $plans = array();
     // Iterate through userlist
     if (!empty($userlist)) {
         foreach ($userlist as $entry) {
             $metaUser = new metaUser($entry->userid);
             if (!empty($entry->id)) {
                 $metaUser->moveFocus($entry->id);
             }
             if ($metaUser->hasSubscription) {
                 $planid = $metaUser->focusSubscription->plan;
                 if (!isset($plans[$planid])) {
                     $plans[$planid] = new SubscriptionPlan();
                     $plans[$planid]->load($planid);
                 }
                 $invoiceid = aecInvoiceHelper::lastClearedInvoiceIDbyUserID($metaUser->userid, $planid);
                 if ($invoiceid) {
                     $invoice = new Invoice();
                     $invoice->load($invoiceid);
                     $line = AECToolbox::rewriteEngine($this->options['rewrite_rule'], $metaUser, $plans[$planid], $invoice);
                 } else {
                     $line = AECToolbox::rewriteEngine($this->options['rewrite_rule'], $metaUser, $plans[$planid]);
                 }
             } else {
                 $line = AECToolbox::rewriteEngine($this->options['rewrite_rule'], $metaUser);
             }
             $larray = explode(';', $line);
             // Remove whitespaces and newlines
             foreach ($larray as $larrid => $larrval) {
                 $larray[$descarray[$larrid]] = trim($larrval);
                 unset($larray[$larrid]);
             }
             $this->exphandler->putln($larray);
         }
     }
 }
 public function beat()
 {
     $this->processors = array();
     $this->proc_prepare = array();
     $this->result = array('fail_expired' => 0, 'fallback' => 0, 'skipped' => 0, 'expired' => 0, 'pre_expired' => 0, 'pre_exp_actions' => 0);
     // Some cleanup
     $this->deleteTempTokens();
     // Receive maximum pre expiration time
     $pre_expiration = microIntegrationHandler::getMaxPreExpirationTime();
     $subscription_list = $this->getSubscribers($pre_expiration);
     // Efficient way to check for expired users without checking on each one
     if (empty($subscription_list)) {
         return $this->endBeat();
     }
     foreach ($subscription_list as $sid => $sub_id) {
         $subscription = new Subscription();
         $subscription->load($sub_id);
         if (!aecUserHelper::UserExists($subscription->userid)) {
             unset($subscription_list[$sid]);
             continue;
         }
         // Check whether this user really is expired
         // If this check fails, the following subscriptions might still be pre-expiration events
         if ($subscription->isExpired()) {
             // If we don't have any validation response, expire
             $validate = $this->processorValidation($subscription, $subscription_list);
             if ($validate === false) {
                 // There was some kind of fatal error, return.
                 return false;
             } elseif ($validate !== true) {
                 $expire = $subscription->expire();
                 if ($expire) {
                     $this->result['expired']++;
                 } elseif ($expire === false) {
                     $this->result['fail_expired']++;
                 } elseif (is_null($expire)) {
                     $this->result['fallback']++;
                 } else {
                     $this->result['skipped']++;
                 }
             }
             unset($subscription_list[$sid]);
         } elseif (!$subscription->recurring) {
             break;
         }
     }
     // Only go for pre expiration action if we have at least one user for it
     if (empty($pre_expiration) || empty($subscription_list)) {
         return $this->endBeat();
     }
     // Get all the MIs which have a pre expiration check
     $mi_pexp = microIntegrationHandler::getPreExpIntegrations();
     // Find plans which have the MIs assigned
     $expmi_plans = microIntegrationHandler::getPlansbyMI($mi_pexp);
     // Filter out the users which dont have the correct plan
     $query = 'SELECT `id`, `userid`' . ' FROM #__acctexp_subscr' . ' WHERE `id` IN (' . implode(',', $subscription_list) . ')' . ' AND `plan` IN (' . implode(',', $expmi_plans) . ')';
     $this->_db->setQuery($query);
     $sub_list = $this->_db->loadObjectList();
     if (!empty($sub_list)) {
         foreach ($sub_list as $sl) {
             $metaUser = new metaUser($sl->userid);
             $metaUser->moveFocus($sl->id);
             $res = $metaUser->focusSubscription->triggerPreExpiration($metaUser, $mi_pexp);
             if ($res) {
                 $this->result['pre_exp_actions'] += $res;
                 $this->result['pre_expired']++;
             }
         }
     }
     return $this->endBeat();
 }