Example #1
0
 private function setRecognizedParams(Pap_Contexts_Action $context) {
     $context->setUserObject($this->affiliate);
     $context->setBannerObject($this->banner);
     $context->setCampaignObject($this->campaign);
     $context->setAccountId($this->campaign->getAccountId(), Pap_Contexts_Tracking::ACCOUNT_RECOGNIZED_FROM_CAMPAIGN);
     $context->setTrackingMethod(Pap_Common_Transaction::TRACKING_METHOD_COUPON);
     $context->getTransaction()->setCouponId($this->coupon->getId());
     $context->getTransaction()->set(Pap_Db_Table_Transactions::BANNER_ID, $this->banner->getId());
 }
 private function checkCampaign(Pap_Contexts_Tracking $context, Pap_Common_Campaign $campaign) {
     if ($this->isAccountRecognizedNotFromDefault($context) && $campaign->getAccountId() != $context->getAccountId()) {
         $context->debug("Campaign with Id: ".$campaign->getId()." and name '".$campaign->getName()."' cannot be used with accountId: '". $context->getAccountId() ."'!");
         throw new Gpf_Exception("Campaign is from differen account");
     }
     $status = $campaign->getCampaignStatus();
     if($status == Pap_Db_Campaign::CAMPAIGN_STATUS_STOPPED
         || $status == Pap_Db_Campaign::CAMPAIGN_STATUS_STOPPED_INVISIBLE) {
         $context->debug("Campaign with Id: ".$campaign->getId()." and name '".$campaign->getName()."' is stopped, cannot be used!");
         throw new Gpf_Exception("Campaign stopped");
     }
     if($status == Pap_Db_Campaign::CAMPAIGN_STATUS_DELETED) {
         $context->debug("Campaign with Id: ".$campaign->getId()." and name '".$campaign->getName()."' is deleted, cannot be used!");
         throw new Gpf_Exception("Campaign deleted");
     }
 }
 /**
  * @return Gpf_Settings_AccountSettings
  */
 protected function createAccountSettings() {
 	$campaign = new Pap_Common_Campaign();
 	$campaign->setId($this->transaction->getCampaignId());
 	try {
 		$campaign->load();
 		return Gpf_Settings::getAccountSettings($campaign->getAccountId());
 	} catch (Gpf_Exception $e) {
 	}
 	return Gpf_Settings::getAccountSettings(Gpf_Db_Account::DEFAULT_ACCOUNT_ID);
 }
Example #4
0
 private function getMerchantNotificationEmail(Pap_Common_Campaign $campaign) {
     $setting = new Gpf_Db_Setting();
     $setting->setAccountId($campaign->getAccountId());
     $setting->setName(Pap_Settings::MERCHANT_NOTIFICATION_EMAIL);
     try{
         $setting->loadFromData(array(Gpf_Db_Table_Settings::ACCOUNTID, Gpf_Db_Table_Settings::NAME));
         if($setting->getValue() != '') {
             return $setting->getValue();
         }
     } catch (Gpf_Exception $e) {
     }
     return Pap_Common_User::getMerchantEmail();
 }