protected function insertTransaction($record) {
    	$obj = new Pap_Db_Transaction();
    	
    	$obj->setId($record->get('transid'));
    	$obj->setUserId($record->get('affiliateid'));
    	$obj->setCampaignId($record->get('campaignid'));
		$obj->setDateInserted($record->get('dateinserted'));
		if($record->get('dateapproved') != '') {
			$obj->setDateApproved($record->get('dateapproved'));
		}
		$obj->setSystemNote("Migrated from PAP3");
		$obj->set('countrycode', $record->get('countrycode'));
		$obj->set('ip', $record->get('ip'));
		$obj->set('refererurl', $record->get('refererurl'));
		$obj->set('browser', $record->get('browser'));
		$obj->setCommission($record->get('commission'));
		$obj->set('data1', $record->get('data1'));
		$obj->set('data2', $record->get('data2'));
		$obj->set('data3', $record->get('data3'));
		$obj->setFixedCost(0);
		$obj->setTotalCost($record->get('totalcost'));
		$obj->setOrderId($record->get('orderid'));
		$obj->setProductId($record->get('productid'));
		$obj->setAllowFirstClickData(GPF::YES);
		$obj->setAllowLastClickData(GPF::YES);
		if($record->get('payoutstatus') == 2) {
			$obj->setPayoutStatus('P');
		} else {
			$obj->setPayoutStatus('U');
		}
		$obj->setClickCount(1);
		$obj->setStatus(Pap3Compatibility_Migration_Pap3Constants::translateStatus($record->get('rstatus')));
		$obj->setType(Pap3Compatibility_Migration_Pap3Constants::translateTransType($record->get('transtype')));

		$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('bannerid', $record->get('bannerid'));
		$obj->set('commtypeid', $record->get('campcategoryid'));
		if($record->get('accountingid') != '') {
			$obj->set('payouthistoryid', $record->get('accountingid'));
		}
    	$obj->save();
    	
//bannerid               char(8)              utf8_general_ci  YES     MUL     (NULL)           select,insert,update,references
//parentbannerid         varchar(8)           utf8_general_ci  YES     MUL     (NULL)           select,insert,update,references
//parenttransid          char(8)              utf8_general_ci  YES     MUL     (NULL)           select,insert,update,references
//recurringcommid        char(8)              utf8_general_ci  YES             (NULL)           select,insert,update,references
//firstclicktime         datetime             (NULL)           YES             (NULL)           select,insert,update,references
//firstclickreferer      varchar(250)         utf8_general_ci  YES             (NULL)           select,insert,update,references
//firstclickip           varchar(15)          utf8_general_ci  YES             (NULL)           select,insert,update,references
//firstclickdata1        varchar(40)          utf8_general_ci  YES             (NULL)           select,insert,update,references
//firstclickdata2        varchar(40)          utf8_general_ci  YES             (NULL)           select,insert,update,references
//lastclicktime          datetime             (NULL)           YES             (NULL)           select,insert,update,references
//lastclickreferer       varchar(250)         utf8_general_ci  YES             (NULL)           select,insert,update,references
//lastclickip            varchar(15)          utf8_general_ci  YES             (NULL)           select,insert,update,references
//lastclickdata1         varchar(40)          utf8_general_ci  YES             (NULL)           select,insert,update,references
//lastclickdata2         varchar(40)          utf8_general_ci  YES             (NULL)           select,insert,update,references
//trackmethod            char(1)              utf8_general_ci  YES             U                select,insert,update,references
//commtypeid             char(8)              utf8_general_ci  YES     MUL     (NULL)           select,insert,update,references
//payouthistoryid        char(8)              utf8_general_ci  YES     MUL     (NULL)           select,insert,update,references
    	
    	$this->countSales++;
    }
예제 #2
0
 public function finishTransaction($newStatus) {      
     $transaction = new Pap_Db_Transaction();
     $transaction->setOrderId($_POST['LMI_PAYMENT_NO']);
     $transaction->setData5($_POST['LMI_SYS_TRANS_NO']);
     try {
         $transaction->loadFromData(array(Pap_Db_Table_Transactions::ORDER_ID, Pap_Db_Table_Transactions::DATA5));
     } catch (Gpf_DbEngine_NoRowException $e) {
         $this->debug('No such transaction with order id: ' . $transaction->getOrderId() . ' and data5: ' . $transaction->getData5() . '. Changing status ended.');
         return;
     }
     $transaction->setStatus($newStatus);
     $transaction->update();
 }
예제 #3
0
 /**
  * @param Pap_Db_Transaction $transaction
  */
 private function declineTransaction(Pap_Db_Transaction $transaction) {
     $this->log('Decline transaction: ' . $transaction->getId());
     $transaction->setStatus(Pap_Common_Constants::STATUS_DECLINED);
     $transaction->setParentTransactionId('');
     $transaction->update(array(Pap_Db_Table_Transactions::R_STATUS, Pap_Db_Table_Transactions::PARRENT_TRANSACTION_ID));
 }