Ejemplo n.º 1
0
 public function afterSaveTransactionSendAffiliateNotification(Pap_Common_Transaction $transaction) {
     if ($transaction->getTier() != '1' || $transaction->getStatus() != Pap_Common_Constants::STATUS_APPROVED || ($transaction->getType() != Pap_Common_Constants::TYPE_SALE && $transaction->getType() != Pap_Common_Constants::TYPE_ACTION)) {
         return;
     }
     $user = Pap_Affiliates_User::loadFromId($transaction->getUserId());
     if ($user->getStatus() != Pap_Common_Constants::STATUS_APPROVED || !$this->isUserAutomaticallyRegistered($user)) {
         return;
     }
     if (!$this->isRegistrationEmailSent($user) || (!$this->wasUserLoggedIn($user) && Gpf::YES == Gpf_Settings::get(Pap_Features_AutoRegisteringAffiliates_Config::REGISTRATION_NOTIFICATION_EVERY_SALE))) {
         Gpf_Log::info('AutoRegisteringAffiliates - afterSaveFirstApprovedTransaction - sendApprovedAffiliateFirstSaleEmail to userid: ' . $user->getId() . ' (' . $user->getUserName() .')' );
         $this->sendApprovedAffiliateFirstSaleEmail($user);
     }
 }
    public function getTransactionFieldValue($code) {
        if($this->transaction == null) {
            throw new Gpf_Exception("You have to set Transaction before getting transaction fields value!");
        }

        if($code == self::TRANSACTIONID) {
            return $this->transaction->get(Pap_Db_Table_Transactions::TRANSACTION_ID);
        } else if($code == self::COMMISSION) {
            return $this->transaction->getCommissionAsText();
        } else if($code == self::TOTALCOST) {
            return $this->transaction->getTotalCostAsText();
        } else if($code == self::ORDERID) {
            return $this->transaction->getOrderId();
        } else if($code == self::PRODUCTID) {
            return $this->transaction->getProductId();
        } else if($code == self::TIER) {
            return $this->transaction->getTier();
        } else if($code == self::CAMPAIGNID) {
            return $this->transaction->getCampaignId();
        } else if($code == self::CAMPAIGNNAME) {
            return $this->getCampaignName($this->transaction->getCampaignId());
        } else if($code == self::STATUS) {
            return $this->getStatus($this->transaction->getStatus());
        } else if($code == self::STATUSCODE) {
            return $this->transaction->getStatus();
        } else if($code == self::TYPE) {
            return $this->getType($this->transaction->getType());
        } else if($code == self::RAWTYPE) {
            return $this->transaction->getType();
        } else if($code == self::ACTIONNAME) {
            return $this->getActionName($this->transaction->getType(), $this->transaction->getCommissionTypeId());
        } else if($code == self::SALEDATA1) {
            return $this->transaction->getData1();
        } else if($code == self::SALEDATA2) {
            return $this->transaction->getData2();
        } else if($code == self::SALEDATA3) {
            return $this->transaction->getData3();
        } else if($code == self::SALEDATA4) {
            return $this->transaction->getData4();
        } else if($code == self::SALEDATA5) {
            return $this->transaction->getData5();
        } else if($code == self::ORIGINALCURRENCY) {
            return $this->getOriginalCurrencyName($this->transaction->get(Pap_Db_Table_Transactions::ORIGINAL_CURRENCY_ID));
        }
        try {
            return $this->transaction->get($code);
        } catch (Gpf_Exception $e) {
        }
        return '';
    }
 public function getTier() {
     return $this->transaction->getTier();
 }
 private function hashTransaction(Pap_Common_Transaction $transaction) {
     return $transaction->getUserId(). $transaction->getCampaignId(). $transaction->getBannerId(). $transaction->getChannel() .
     $transaction->getStatus() . $transaction->getTier(). $transaction->getType(). $transaction->getPayoutStatus() . $this->dateTimeToDate($transaction->getDateInserted() . $transaction->getCountryCode());
 }