Example #1
0
 protected function processAccountIdAndVisitorId(Pap_Tracking_ActionTracker $saleTracker, $cookie) {
     parent::processAccountIdAndVisitorId($saleTracker, $cookie);
     if (Gpf_Settings::get(PayPal_Config::APPROVE_AFFILIATE) == Gpf::YES) {
         $this->debug('Automatic approval of affiliates with sale is enabled');
         $userId = $this->computeAffiliateId($saleTracker->getVisitorId(), $saleTracker->getAccountId());
         try {
             $affiliate = new Pap_Common_User();
             $affiliate->setId($userId);
             $affiliate->load();
             if ($affiliate->getStatus() == Pap_Common_Constants::STATUS_PENDING) {
                 $affiliate->setStatus(Pap_Common_Constants::STATUS_APPROVED);
                 $affiliate->update();
             }
         } catch (Gpf_Exception $e) {
             $this->debug('Error occured during approving affiliate with id=' . $userId);
         }
     }
 }