/** * recognizes commission type for campaign * * @param Pap_Plugins_Tracking_Action_Context $context */ public function getCommissionType(Pap_Contexts_Action $context) { $campaign = $context->getCampaignObject(); $context->debug('Recognizing commission type started'); $actionCode = $context->getActionCodeFromRequest(); if ($actionCode == null || $actionCode == '') { $type = Pap_Common_Constants::TYPE_SALE; } else { $type = Pap_Common_Constants::TYPE_ACTION; } try { $context->debug(' Checking commission type : '.$type.' is in campaign'); $commissionType = $campaign->getCommissionTypeObject($type, $context->getActionCodeFromRequest(), $context->getVisit()->getCountryCode()); } catch (Pap_Tracking_Exception $e) { $context->debug(" STOPPING, This commission type is not supported by current campaign or is NOT enabled! "); throw $e; } $context->setCommissionTypeObject($commissionType); $context->getTransaction(1)->setType($type); $context->debug(' Commission type set to: '.$type.', ID: '.$commissionType->getId()); $context->debug('Recognizing commission type ended'); $context->debug(""); }
/** * @param Pap_Contexts_Action $context * @return Pap_Db_CommissionType */ protected function getCommissionType(Pap_Contexts_Action $context) { $campaign = $context->getCampaignObject(); $actionCode = $context->getActionCodeFromRequest(); if ($actionCode != '') { return $campaign->getCommissionTypeObject(Pap_Common_Constants::TYPE_ACTION, $actionCode, $context->getVisit()->getCountryCode()); } else { return $campaign->getCommissionTypeObject(Pap_Common_Constants::TYPE_SALE, '', $context->getVisit()->getCountryCode()); } }
private function getTransactionType(Pap_Contexts_Action $context) { $actionCode = $context->getActionCodeFromRequest(); if ($actionCode == null || $actionCode == '') { return Pap_Common_Constants::TYPE_SALE; } else { return Pap_Common_Constants::TYPE_ACTION; } }