/** * returns commission group for user (if not set already) * Commission group can be set previously in the checkCampaignType() function * */ protected function getCommissionGroup(Pap_Contexts_Tracking $context) { $context->debug('Recognizing commission group started'); if (($user = $context->getUserObject()) == null) { $context->debug('STOPPING, user is not set - cannot find commission group'); return; } $commGroupId = $this->getUserCommissionGroupFromCache($context->getCampaignObject(), $user->getId()); if($commGroupId == false) { $context->debug("STOPPING, Cannot find commission group for this affiliate and campaign! ".$context->getCampaignObject()->getId().' - '.$user->getId()); $context->setDoCommissionsSave(false); $context->setDoTrackerSave(false); return; } Gpf_Plugins_Engine::extensionPoint('PostAffiliate.RecognizeCommGroup.getCommissionGroup', $context); $commissionGroup = $this->getCommissionGroupFromCache($commGroupId); if ($commissionGroup == null) { $context->debug(' Commission group with ID '.$commGroupId . ' does not exist'); return; } $context->setCommissionGroup($commissionGroup); $context->debug('Received commission group ID = '.$commGroupId); }
public function getCommissionGroup(Pap_Contexts_Tracking $context) { if ($context->getCampaignObject()->getCampaignType() != Pap_Db_Campaign::CAMPAIGN_TYPE_PUBLIC) { try { $status = Pap_Db_Table_UserInCommissionGroup::getStatus($context->getCampaignObject()->getId(), $context->getUserObject()->getId()); if ($status != Pap_Features_PerformanceRewards_Condition::STATUS_APPROVED && $status != Pap_Features_PerformanceRewards_Condition::STATUS_FIXED) { throw new Gpf_Exception(''); } } catch (Gpf_Exception $e) { $context->debug(' STOPPING, User is not approved in this campaign!'); $context->setDoCommissionsSave(false); $context->setDoTrackerSave(false); } } }