コード例 #1
0
 protected function setTimeVariableValues($timeOffset = 0) {
     parent::setTimeVariableValues($timeOffset);
     $firstClickTime = Gpf_Common_DateUtils::getTimestamp($this->transaction->get(Pap_Db_Table_Transactions::FIRST_CLICK_TIME));
     $lastClickTime = Gpf_Common_DateUtils::getTimestamp($this->transaction->get(Pap_Db_Table_Transactions::LAST_CLICK_TIME));
     $this->setVariable('firstclicktime', Gpf_Common_DateUtils::getDateTime($firstClickTime + $timeOffset));
     $this->setVariable('lastclicktime', Gpf_Common_DateUtils::getDateTime($lastClickTime + $timeOffset));
 }
コード例 #2
0
ファイル: Main.class.php プロジェクト: AmineCherrai/rostanvo
 /**
  *
  * @param $transaction
  * @return Gpf_Data_Record
  */
 protected function getChildAffiliateInfo(Pap_Common_Transaction $transaction){
     $userSelect = new Gpf_SqlBuilder_SelectBuilder();
     $userSelect->select->add('t.'.Pap_Db_Table_Transactions::USER_ID);
     $userSelect->select->add('u.'.Pap_Db_Table_Users::DATEINSERTED);
     $userSelect->from->add(Pap_Db_Table_Transactions::getName(),'t');
     $userSelect->from->addInnerJoin(Pap_Db_Table_Users::getName(),'u','t.userid=u.userid');
     $userSelect->where->add('t.'.Pap_Db_Table_Transactions::TRANSACTION_ID,'=',$transaction->getParentTransactionId());
     return $userSelect->getOneRow();
 }
コード例 #3
0
 protected function refundChargeback() {
     $transaction = new Pap_Common_Transaction();
     $items = explode("|", $this->doubleColonProducts);
     for ($i = 0; $i<count($items); $i++) {
         $transId = $this->getTransactionIdFromOrderId($this->getOrderID()."_".$i);
         if ($transId !== false)
         $transaction->processRefundChargeback($transId, Pap_Db_Transaction::TYPE_REFUND, '', $this->getOrderID()."_".$i, 0, true);
     }
 }
コード例 #4
0
ファイル: Main.class.php プロジェクト: AmineCherrai/rostanvo
 protected function computeCommission(Pap_Contexts_Action $context, Pap_Common_Transaction $transaction, Pap_Common_User $user, $tier){
     if (Gpf_Settings::get(TopLevelAffiliateFixedCommision_PluginConfig::USE_FIRST_TIER_COMMISSION)==Gpf::YES && $tier == 1) {
         return null;
     }
     $commissionPercentage = $this->getFixedCommissionPercentage($transaction->getCommissionTypeId());
     if ($commissionPercentage == TopLevelAffiliateFixedCommision_Config::UNDEFINED_PERCENTAGE) {
         return null;
     }
     return ($context->getRealTotalCost()-$context->getFixedCost()) / 100 * $commissionPercentage;
 }
コード例 #5
0
 private function approveRefund($transactionId) {
     $transaction = new Pap_Common_Transaction();
     $transaction->setId($transactionId);
     $refundTransaction = $transaction->getRefundOrChargebackTransaction();
     if (is_null($refundTransaction)) {
         Gpf_Log::debug('Transacton id: ' . $transactionId . ' does not have refund transaction.' );
         return;
     }
     if ($refundTransaction->getStatus() == Pap_Common_Constants::STATUS_PENDING) {
         $refundTransaction->setStatus(Pap_Common_Constants::STATUS_APPROVED);
         $refundTransaction->update(array(Pap_Db_Table_Transactions::R_STATUS));
         Gpf_Log::debug('Refund commission (' . $refundTransaction->getId() . ') for transacton id: ' . $transactionId . ' is approved.' );
     } 
 }
コード例 #6
0
	protected function addFillBonus(Pap_Common_User $user, $fillCount, $commission) {
		$transaction = new Pap_Common_Transaction();
		$transaction->setCommission($commission);
		$transaction->setType(Pap_Db_Transaction::TYPE_EXTRA_BONUS);
		$transaction->setDateInserted(Gpf_Common_DateUtils::now());
		$transaction->setStatus(Pap_Common_Constants::STATUS_APPROVED);
		$transaction->setPayoutStatus(Pap_Common_Constants::PSTATUS_UNPAID);
		$transaction->setUserId($user->getId());
		$transaction->setSystemNote($this->_('Matrix %sx fill bonus', $fillCount));
		$transaction->insert();
	}
コード例 #7
0
ファイル: Main.class.php プロジェクト: AmineCherrai/rostanvo
 public function checkRules(Pap_Common_Transaction $transaction) {
     Gpf_Log::debug('Performance reward started');
     foreach($this->getRules($transaction->getCampaignId()) as $ruleRecord) {
         $rule = new Pap_Features_PerformanceRewards_Rule_Transaction($transaction);
         $rule->fillFromRecord($ruleRecord);
         try {
             Gpf_Log::debug('Processing rule ' . $rule->getId() . ': ' . $rule->getAction());
             $rule->executeAction();
             Gpf_Log::debug('Rule completed');
         } catch (Exception $e) {
             Gpf_Log::error(sprintf('Rule %s failed. Reason: %s', $rule->getId(), $e->getMessage()));
         }
     }
     Gpf_Log::debug('Performance reward ended');
 }
コード例 #8
0
    /**
     *
     * @return Pap_Common_Transaction
     */
    protected function getParentTransaction($futurePayId) {
        $select = new Gpf_SqlBuilder_SelectBuilder();
         
        $select->select->addAll(Pap_Db_Table_Transactions::getInstance());
        $select->from->add(Pap_Db_Table_Transactions::getName());
        $select->where->add(Pap_Db_Table_Transactions::DATA5, "=", $futurePayId);

        $select->where->add(Pap_Db_Table_Transactions::R_TYPE, "IN", array(Pap_Common_Constants::TYPE_SALE, Pap_Common_Constants::TYPE_ACTION, Pap_Common_Constants::TYPE_LEAD));
        $select->where->add(Pap_Db_Table_Transactions::TIER, "=", "1");
         
        $select->limit->set(0, 1);
        $t = new Pap_Common_Transaction();
        $t->fillFromRecord($select->getOneRow());

        return $t;
    }
 /**
  * @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);
 }
コード例 #10
0
 private function processPayoutStatus() {
     $transaction = new Pap_Common_Transaction();
     $transaction->setId($this->getTransactionID());
     try {
         $transaction->load();
     } catch (Gpf_DbEngine_NoRowException $e) {
     	$this->setPaymentStatus($this->getPaymentStatusFromMoneyBookersFormat());
     	return true;
     }
     
     if ($this->checkRefundChargeback()) {
     	return false;
     }
     
     $transaction->setPayoutStatus($this->getPaymentStatusFromMoneyBookersFormat());
     $transaction->save();
     $this->debug('ended - existing transaction updated, transactionID: ' . $this->getTransactionID());
     return false;
 }
コード例 #11
0
    protected function insertSummarizedTransaction($record) {
    	$obj = new Pap_Common_Transaction();
    	
    	$obj->setUserId($record->get('affiliateid'));
    	$obj->setCampaignId($record->get('campaignid'));
		$obj->setDateInserted($record->get('dateinserted'));
		$obj->setType(Pap3Compatibility_Migration_Pap3Constants::translateTransType($record->get('transtype')));
		$obj->setAllowFirstClickData(GPF::YES);
        $obj->setAllowLastClickData(GPF::YES);
		$obj->setStatus(Pap3Compatibility_Migration_Pap3Constants::translateStatus($record->get('rstatus')));
		
		if($record->get('rstatus') == Pap3Compatibility_Migration_Pap3Constants::STATUS_APPROVED) {
			$obj->setDateApproved($record->get('dateinserted'));
		}
		
		$obj->setCommission($record->get('commission'));
		$obj->setSystemNote("Migrated from PAP3");
		if($record->get('payoutstatus') == 2) {
			$obj->setPayoutStatus('P');
		} else {
			$obj->setPayoutStatus('U');
		}
		$obj->setClickCount($record->get('count'));

		$transKind = $record->get('transkind');
		if($transKind > Pap3Compatibility_Migration_Pap3Constants::TRANSKIND_SECONDTIER) {
			$tier = $transKind - Pap3Compatibility_Migration_Pap3Constants::TRANSKIND_SECONDTIER;
		} else {
			$tier = 1;
		}
		$obj->setTier($tier);
		$obj->set('commtypeid', $record->get('campcategoryid'));
		
    	$obj->save();
    }
コード例 #12
0
ファイル: Main.class.php プロジェクト: AmineCherrai/rostanvo
	private function saveCpmTransaction(Pap_Contexts_Impression $context) {
	    $campaign = new Pap_Common_Campaign();
	    $campaign->setId($context->getBannerObject()->getCampaignId());
	    $campaign->load();
	    $context->setCampaignObject($campaign);
	    $transaction = new Pap_Common_Transaction();
	    $transaction->setType(Pap_Common_Constants::TYPE_CPM);
	    $context->setTransactionObject($transaction);

	    $commissionType = new Pap_Tracking_Common_RecognizeCommType();
	    $commissionType->process($context);

	    $commissionGroup = new Pap_Tracking_Common_RecognizeCommGroup();
        $commissionGroup->recognize($context);

        $commissionSettings = new Pap_Tracking_Common_RecognizeCommSettings();
        $commissionSettings->recognize($context);

        $saveCommissions = new Pap_Tracking_Common_UpdateAllCommissions();
        $saveCommissions->process($context);
        $saveCommissions->saveChanges();
	}
コード例 #13
0
    private function makeRefund() {
        $this->debug('2checkout refund started');
        $transaction = new Pap_Db_Transaction();
        $transaction->setOrderId($this->getSubscriptionID());
        try{
            $collection = $transaction->loadCollection(array(Pap_Db_Table_Transactions::ORDER_ID));
        } catch (Gpf_Exception $e) {
            $this->debug('2checkout refund failed - Error in loading transactions: '.$e->getMessage());
            return;
        }

        if($collection->getSize() == 0) {
            $this->debug('2checkout refund failed: No transactions with order id: '.$this->getSubscriptionID());
            return;
        }

        foreach($collection as $transactionDb) {
            $transaction = new Pap_Common_Transaction();
            $transaction->processRefundChargeback($transactionDb->getId(), $transactionDb->getType());
            $this->debug('2checkout refunded transaction with id '.$transactionDb->getId());
        }
    }
コード例 #14
0
    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 '';
    }
コード例 #15
0
ファイル: Main.class.php プロジェクト: AmineCherrai/rostanvo
 public function updateCommission(Pap_Common_Transaction $transaction) {
 	if ($transaction->getType() != Pap_Db_Transaction::TYPE_SALE) {
 	    return;
 	}
     try {
         $minTotalCost = $this->createCampaignAttribute()->getSetting(SaleFilter_Definition::NAME_MINIMUM_TOTALCOST, $transaction->getCampaignId());
         if ($transaction->getTotalCost() < $minTotalCost) {
             $transaction->setCommission(0);
         }
     } catch (Gpf_DbEngine_NoRowException $e) {
     }
     try {
         $maxTotalCost = $this->createCampaignAttribute()->getSetting(SaleFilter_Definition::NAME_MAXIMUM_TOTALCOST, $transaction->getCampaignId());
         if ($maxTotalCost > 0 && $transaction->getTotalCost() > $maxTotalCost) {
             $transaction->setCommission(0);
         }
     } catch (Gpf_DbEngine_NoRowException $e) {
     }
 }
コード例 #16
0
ファイル: Main.class.php プロジェクト: AmineCherrai/rostanvo
 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);
     }
 }
コード例 #17
0
    /**
     * @param Pap_Common_Transaction $transaction
     * @param $transactionHeader
     * @param $transactionData
     * @param $matchTransactionField
     * @return Pap_Common_Transaction
     */
    private function loadTransaction(Pap_Common_Transaction $transaction, $transactionHeader, $transactionData, $matchTransactionField) {
        Gpf_Log::info('Matching transaction by: ' . $matchTransactionField);
        $data = array_flip($transactionHeader);
        $orderId = $transactionData[$data[$matchTransactionField]];

        if(trim($orderId)!=''){
            $transaction->set($matchTransactionField, $orderId);
            try{
                $transaction->loadFromData(array($matchTransactionField));
            } catch (Gpf_DbEngine_NoRowException $e) {
                Gpf_Log::info('No transaction with '.$matchTransactionField.': '.$orderId.' found.');
            } catch (Gpf_DbEngine_TooManyRowsException $e) {
                Gpf_Log::info('Too many transactions with '.$matchTransactionField.': '.$orderId);
                throw new Gpf_Exception($this->_('Too many transactions with '.$matchTransactionField.': '.$orderId));
            }
        }
        return $transaction;
    }
コード例 #18
0
ファイル: Main.class.php プロジェクト: AmineCherrai/rostanvo
 public function initCountryCodeTransaction(Pap_Common_Transaction $transaction) {
     if (is_null($transaction->getCountryCode()) || $transaction->getCountryCode() === '') {
         $context = new Gpf_Data_Record(array(Pap_Db_Table_RawImpressions::IP, Pap_Db_Table_Impressions::COUNTRYCODE), array($transaction->getIp(), ''));
         $this->getCountryCode($context);
         $transaction->setCountryCode($context->get(Pap_Db_Table_Impressions::COUNTRYCODE));
     }
 }
コード例 #19
0
 protected function refundChargeback() {
     $transaction = new Pap_Common_Transaction();
     $transaction->processRefundChargeback($this->getTransactionIdFromOrderId($this->getParentTransId()), Pap_Db_Transaction::TYPE_REFUND, '',
     $this->getOrderID(), 0, true);
 }
コード例 #20
0
    private function setFirstAndLastClick(Pap_Common_Transaction $transaction, $contextUserId) {
        $firstAffiliate = $this->visitorAffiliateCollection->getValid(0);
        $lastAffiliate = $this->visitorAffiliateCollection->getValid($this->visitorAffiliateCollection->getValidSize()-1);

        try{
            $visitorAffiliate = $this->visitorAffiliateCollection->getVisitorAffiliateByUserId($contextUserId);
            $transaction->setRefererUrl($visitorAffiliate->getReferrerUrl());
        } catch(Gpf_Exception $e){
            $context->debug($e->getMessage());
            $transaction->setRefererUrl($this->_('Unknown'));
        }

        $this->setFirstClickData($transaction,$firstAffiliate);

        if ($firstAffiliate->getUserId() == $contextUserId){
            $transaction->setAllowFirstClickData(Gpf::YES);
        } else{
            $transaction->setAllowFirstClickData(Gpf::NO);
        }

        $this->setLastClickData($transaction,$lastAffiliate);
        if ($lastAffiliate->getUserId() == $contextUserId){
            $transaction->setAllowLastClickData(Gpf::YES);
        } else{
            $transaction->setAllowLastClickData(Gpf::NO);
        }
    }
コード例 #21
0
ファイル: Main.class.php プロジェクト: AmineCherrai/rostanvo
 private function setOriginalCurrencyValues(Pap_Common_Transaction $transaction, Gpf_Db_Currency $currency, $totalCost) {
     $transaction->setOriginalCurrencyId($currency->getId());
     $transaction->setOriginalCurrencyValue($totalCost);
     $transaction->setOriginalCurrencyRate($currency->getExchangeRate());
 }
コード例 #22
0
 /** 
  * @return Pap_Common_Transaction
  */
 protected function getTransaction($id) {
     $transaction = new Pap_Common_Transaction();
     $transaction->setId($id);
     $transaction->load();
     return $transaction;
 }
コード例 #23
0
    protected function setFirstAndLastClick(Pap_Common_Transaction $transaction, Pap_Tracking_Common_VisitorAffiliateCollection $collection) {
        if ($collection->getSize() == 0) {
            throw new Gpf_Exception('VisitorAffiliates for this visitor are empty');
        }
        
        $firstVisitorAffiliate = $collection->get(0);
        $transaction->setFirstClickTime($firstVisitorAffiliate->getDateVisit());
        $transaction->setFirstClickReferer($firstVisitorAffiliate->getReferrerUrl());
        $transaction->setFirstClickIp($firstVisitorAffiliate->getIp());
        $transaction->setFirstClickData1($firstVisitorAffiliate->getData1());
        $transaction->setFirstClickData2($firstVisitorAffiliate->getData2());

        $lastVisitorAffiliate = $collection->get($collection->getSize()-1);
        $transaction->setLastClickTime($lastVisitorAffiliate->getDateVisit());
        $transaction->setLastClickReferer($lastVisitorAffiliate->getReferrerUrl());
        $transaction->setLastClickIp($lastVisitorAffiliate->getIp());
        $transaction->setLastClickData1($lastVisitorAffiliate->getData1());
        $transaction->setLastClickData2($lastVisitorAffiliate->getData2());
    }
コード例 #24
0
    public function readRequestVariables() {
        $input = $this->readXmlData();

        if (Gpf_Settings::get(Recurly_Config::RESEND_URL) != "") {
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, Gpf_Settings::get(Recurly_Config::RESEND_URL));
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_TIMEOUT, 60);
            //curl_setopt($ch, CURLOPT_USERAGENT, $defined_vars['HTTP_USER_AGENT']);
            curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml"));
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $input);
            curl_exec($ch);

            /*
             $ch = curl_init();
             curl_setopt($ch, CURLOPT_URL, Gpf_Settings::get(Recurly_Config::RESEND_URL));
             curl_setopt($ch, CURLOPT_POST, 1);
             curl_setopt($ch, CURLOPT_TIMEOUT, 60);
             curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml"));
             curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
             curl_exec($ch);
             */
        }

        $this->debug("Input get: " . $input);
        try {
            $xml = new SimpleXMLElement($input);
        } catch (Exception $e) {
            $this->setPaymentStatus("Failed");
            $this->debug('Wrong XML format!');
            return false;
        }

        // read last tag to find out what kind of request this is, e.g. </new_subscription_notification>
        $status = strrpos($input,"</");
        $status = substr($input,$status+2,strlen($input)-1);
        $status = substr($status,0,strrpos($status,">"));

        $this->setType($status);

        if ($this->getType() == self::NEWPAYMENT) {
            $totalcost_name = "amount_in_cents";
            $this->setData1((string)$xml->{"transaction"}->{"invoice_number"});
        }
        else {
            $totalcost_name = "total_amount_in_cents";
            $this->setProductID((string)$xml->{"transaction"}->{"plan_code"});
        }
        $this->setTransactionID((string)$xml->{"account"}->{"account_code"});
        $this->setTotalCost((string)$xml->{"transaction"}->{$totalcost_name}/100)*(((string)$xml->{"transaction"}->{"quantity"})?(string)$xml->{"transaction"}->{"quantity"}:1);

        // get original Affiliate
        $status = array(Pap_Common_Constants::STATUS_APPROVED, Pap_Common_Constants::STATUS_PENDING);
        $types = array(Pap_Common_Constants::TYPE_SALE, Pap_Common_Constants::TYPE_ACTION, Pap_Common_Constants::TYPE_LEAD);

        $select = new Gpf_SqlBuilder_SelectBuilder();
        $select->select->addAll(Pap_Db_Table_Transactions::getInstance());
        $select->from->add(Pap_Db_Table_Transactions::getName());
        $select->where->add(Pap_Db_Table_Transactions::ORDER_ID, "=", $this->getOrderID());
        $select->where->add(Pap_Db_Table_Transactions::R_TYPE, "IN", $types);
        $select->where->add(Pap_Db_Table_Transactions::R_STATUS, "IN", $status);
        $transaction = new Pap_Common_Transaction();
        $transaction->fillFromSelect($select);

        if (($transaction->getUserId() == null) OR ($transaction->getUserId() == "")) {
            $this->debug('No affiliate found for order ID: '.$this->getOrderID());
        }
        else {
            $this->setAccountId($transaction->getAccountId());
            $this->setAffiliateID($transaction->getUserId());
            $this->setProductID($transaction->getProductId());
            $this->setCampaignId($transaction->getCampaignId());
        }
    }
コード例 #25
0
    /**
     * @return Gpf_DbEngine_Row_Collection
     */
    protected function getTransactionsCollection() {
        $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
        $selectBuilder->select->addAll(Pap_Db_Table_Transactions::getInstance());
        $selectBuilder->from->add(Pap_Db_Table_Transactions::getName());
        $selectBuilder->where->add(Pap_Db_Table_Transactions::SALE_ID,'=',$this->saleId);
        $recordSet = $selectBuilder->getAllRows();

        $transaction = new Pap_Common_Transaction();
        return $transaction->loadCollectionFromRecordset($recordSet);
    }
コード例 #26
0
 protected function insertTransaction($affiliateId, $type, $commissionValue, $status, Gpf_Data_Record $commission = null) {
     if ($affiliateId == null) {
         return;
     }
     $transaction = new Pap_Common_Transaction();
     $transaction->setUserId($affiliateId);
     $transaction->setType($type);
     if ($commission != null) {
         $transaction->setTier($commission->get(Pap_Db_Table_Commissions::TIER));
     } else {
         $transaction->setTier('1');
     }
     $transaction->setStatus($status);
     $transaction->setPayoutStatus('U');
     $transaction->setDateInserted(Gpf_Common_DateUtils::now());
     $transaction->setCommission($commissionValue);
     $transaction->setData5($this->user->getId());
     $transaction->setIp(Gpf_Http::getRemoteIp());
     $transaction->insert();
 }
コード例 #27
0
 /**
  * @return Pap_Common_Transaction
  */
 protected function findTransaction($subscriptionId, $type = Pap_Common_Constants::TYPE_SALE) {
     $transaction = new Pap_Common_Transaction();
     $transaction->setOrderId($subscriptionId);
     $transaction->setType($type);
     $transaction->setTier(1);
     $transaction->loadFromData(array(Pap_Db_Table_Transactions::ORDER_ID, Pap_Db_Table_Transactions::TIER, Pap_Db_Table_Transactions::R_TYPE));
     return $transaction;
 }
コード例 #28
0
    private function initTransactionObject(Pap_Contexts_Click $context) {
        $transaction = new Pap_Common_Transaction();

        $transaction->setTotalCost('');

        $transaction->generateNewTransactionId();
        $transaction->setData1($context->getExtraDataFromRequest(1));
        $transaction->setData2($context->getExtraDataFromRequest(2));
        $transaction->set(Pap_Db_Table_Transactions::REFERER_URL, $context->getReferrerUrl());
        $transaction->set(Pap_Db_Table_Transactions::IP, $context->getIp());
        $transaction->set(Pap_Db_Table_Transactions::BROWSER, $context->getUserAgent());
        $transaction->setType(Pap_Common_Constants::TYPE_CLICK);
        $transaction->setDateInserted($context->getVisitDateTime());
        if ($context->getVisit()!= null && $context->getVisit()->getCountryCode() != '') {
            $transaction->setCountryCode($context->getVisit()->getCountryCode());
        }
        $context->setTransactionObject($transaction);
        $context->debug("Transaction object set");
    }
コード例 #29
0
 public function getTier() {
     return $this->transaction->getTier();
 }
コード例 #30
0
    /**
     *
     * @param $orderId
     * @param $includeRefund
     * @return Gpf_DbEngine_Row_Collection<Pap_Common_Transaction>
     */
    private function getAllTransactionIdsWithOrderId($orderId, $includeRefund){
        $status = array (Pap_Common_Constants::STATUS_APPROVED, Pap_Common_Constants::STATUS_PENDING);
        $types = array(Pap_Common_Constants::TYPE_SALE, Pap_Common_Constants::TYPE_ACTION, Pap_Common_Constants::TYPE_LEAD);
        if ($includeRefund == true) {
            $types[] = Pap_Common_Constants::TYPE_REFUND;
        }

        $select = new Gpf_SqlBuilder_SelectBuilder();

        $select->select->addAll(Pap_Db_Table_Transactions::getInstance());
        $select->from->add(Pap_Db_Table_Transactions::getName());
        $select->where->add(Pap_Db_Table_Transactions::ORDER_ID, "=", $orderId);

        $select->where->add(Pap_Db_Table_Transactions::R_TYPE, "IN", $types);
        $select->where->add(Pap_Db_Table_Transactions::R_STATUS, "IN", $status);

        $transaction = new Pap_Common_Transaction();
        return $transaction->loadCollectionFromRecordset($select->getAllRows());
    }