예제 #1
0
 protected function addRefundChargeback(Pap_Db_Transaction $refundChargeback, $type, $note = '', $orderId = '', $fee = 0) {
     foreach ($this as $name => $value) {
         $refundChargeback->set($name, $value);
     }
     $refundChargeback->setId(Gpf_Common_String::generateId());
     $refundChargeback->setCommission(($this->getCommission() * -1) - $fee);
     $refundChargeback->setType($type);
     if ($orderId != '') {
         $refundChargeback->setOrderId($orderId);
     }
     $refundChargeback->setParentTransactionId($this->getId());
     $refundChargeback->setDateInserted(Gpf_Common_DateUtils::now());
     $refundChargeback->setPayoutStatus(Pap_Common_Constants::PSTATUS_UNPAID);
     $refundChargeback->setMerchantNote($note);
     if ($refundChargeback->getStatus() == Pap_Common_Constants::STATUS_APPROVED) {
         $refundChargeback->setDateApproved($refundChargeback->getDateInserted());
     } else {
         $refundChargeback->setDateApproved('');
     }
     $refundChargeback->insert();
 }
    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++;
    }
예제 #3
0
 /**
  *
  * @param $transaction
  * @return Pap_Db_Transaction
  */
 private function copyTransaction(Pap_Common_Transaction $transaction) {
     $dbTransaction = new Pap_Db_Transaction();
     foreach ($transaction->getAttributes() as $name => $value) {
         $dbTransaction->set($name, $value);
     }
     return $dbTransaction;
 }