本文整理汇总了PHP中Oara_Utilities::cloneArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Oara_Utilities::cloneArray方法的具体用法?PHP Oara_Utilities::cloneArray怎么用?PHP Oara_Utilities::cloneArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oara_Utilities
的用法示例。
在下文中一共展示了Oara_Utilities::cloneArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTransactionList
/**
* (non-PHPdoc)
*
* @see library/Oara/Network/Oara_Network_Publisher_Base#getTransactionList($merchantId, $dStartDate, $dEndDate)
*/
public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
{
$totalTransactions = array();
$dEndDate->addDay(1);
$valuesFormExport = Oara_Utilities::cloneArray($this->_exportTransactionParameters);
$valuesFormExport[] = new Oara_Curl_Parameter('pDate1', $dStartDate->toString("MM/d/yyyy"));
$valuesFormExport[] = new Oara_Curl_Parameter('pDate2', $dEndDate->toString("MM/d/yyyy"));
$urls = array();
$urls[] = new Oara_Curl_Request('https://www.auto-europe.co.uk/afftools/iatareport_popup.cfm?', $valuesFormExport);
$exportReport = $this->_client->post($urls);
$xmlTransactionList = self::readTransactions($exportReport[0]);
foreach ($xmlTransactionList as $xmlTransaction) {
$transaction = array();
$transaction['merchantId'] = 1;
$date = new Zend_date($xmlTransaction['Booked'], "MM/dd/yyyy");
$transaction['date'] = $date->toString("yyyy-MM-dd 00:00:00");
$transaction['amount'] = (double) $xmlTransaction['commissionValue'];
$transaction['commission'] = (double) $xmlTransaction['commission'];
$transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
$transaction['unique_id'] = $xmlTransaction['Res #'];
if (isset($xmlTransaction['Affiliate1']) && isset($xmlTransaction['Affiliate2'])) {
$customId = (string) $xmlTransaction['Affiliate1'] . (string) $xmlTransaction['Affiliate2'];
$customId = "afal-" . current(unpack('H*', base64_decode(str_replace(array(".", "-"), array("/", "+"), $customId))));
$transaction['custom_id'] = $customId;
}
$totalTransactions[] = $transaction;
}
return $totalTransactions;
}
示例2: getTransactionList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Base#getTransactionList($merchantId, $dStartDate, $dEndDate)
*/
public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
$totalTransactions = array();
$valuesFormExport = Oara_Utilities::cloneArray($this->_exportTransactionParameters);
$valuesFormExport[] = new Oara_Curl_Parameter('start_year', $dStartDate->toString("yyyy"));
$valuesFormExport[] = new Oara_Curl_Parameter('start_month', $dStartDate->toString("M"));
$valuesFormExport[] = new Oara_Curl_Parameter('start_day', $dStartDate->toString("d"));
$valuesFormExport[] = new Oara_Curl_Parameter('end_year', $dEndDate->toString("yyyy"));
$valuesFormExport[] = new Oara_Curl_Parameter('end_month', $dEndDate->toString("M"));
$valuesFormExport[] = new Oara_Curl_Parameter('end_day', $dEndDate->toString("d"));
$urls = array();
$urls[] = new Oara_Curl_Request('https://www.cartrawler.com/affengine/AFFxreservelist2.asp?action=update', $valuesFormExport);
$exportReport = $this->_client->post($urls);
$exportTransactionList = self::readTransactionTable($exportReport[0], $dStartDate, $dEndDate);
foreach ($exportTransactionList as $exportTransaction) {
$transaction = array();
$transaction['merchantId'] = 1;
$transactionDate = new Zend_Date($exportTransaction[1], "d MMM yy", 'en_US');
$transaction['date'] = $transactionDate->toString("yyyy-MM-dd HH:mm:ss");
$transaction['amount'] = (double) $exportTransaction[5];
$transaction['commission'] = (double) $exportTransaction[11];
if ($exportTransaction[8] == 'CONFIRMED') {
$transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
} else {
if ($exportTransaction[8] == 'CANCELLED') {
$transaction['status'] = Oara_Utilities::STATUS_DECLINED;
} else {
if ($exportTransaction[8] == 'UNCONFIRMED' || $exportTransaction[8] == 'REBOOKED' || $exportTransaction[8] == 'PENDING INVOICE') {
$transaction['status'] = Oara_Utilities::STATUS_PENDING;
} else {
throw new Exception("New status found " . $transaction['status']);
}
}
}
$totalTransactions[] = $transaction;
}
return $totalTransactions;
}
示例3: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Base#getOverviewList($merchantId, $dStartDate, $dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
$overviewArray = array();
$transactionArray = Oara_Utilities::transactionMapPerDay($transactionList);
$valuesFromExport = Oara_Utilities::cloneArray($this->_exportTransactionParameters);
$valuesFromExport[] = new Oara_Curl_Parameter('ctl00%24m_mainPlaceholder%24m_periodFromField_hidden', "%3CDateChooser%20Value%3D%22" . $dStartDate->toString("yyyy") . "x" . $dStartDate->toString("M") . "x" . $dStartDate->toString("d") . "%22%3E%3C/DateChooser%3E");
$valuesFromExport[] = new Oara_Curl_Parameter('ctl00xmxmainPlaceholderxmxperiodFromField_input', $dStartDate->toString("dd/MM/yyyy"));
$valuesFromExport[] = new Oara_Curl_Parameter('ctl00_m_mainPlaceholder_m_periodFromField_DrpPnl_Calendar1', "%3Cx%20PostData%3D%22" . $dStartDate->toString("yyyy") . "x" . $dStartDate->toString("M") . "x" . $dStartDate->toString("yyyy") . "x" . $dStartDate->toString("M") . "x" . $dStartDate->toString("d") . "%22%3E%3C/x%3E");
$valuesFromExport[] = new Oara_Curl_Parameter('ctl00%24m_mainPlaceholder%24m_periodToField_hidden', "%3CDateChooser%20Value%3D%22" . $dEndDate->toString("yyyy") . "x" . $dEndDate->toString("M") . "x" . $dEndDate->toString("d") . "%22%3E%3C/DateChooser%3E");
$valuesFromExport[] = new Oara_Curl_Parameter('ctl00xmxmainPlaceholderxmxperiodToField_input', $dEndDate->toString("dd/MM/yyyy"));
$valuesFromExport[] = new Oara_Curl_Parameter('ctl00_m_mainPlaceholder_m_periodToField_DrpPnl_Calendar1', "%3Cx%20PostData%3D%22" . $dEndDate->toString("yyyy") . "x" . $dEndDate->toString("M") . "x" . $dEndDate->toString("yyyy") . "x" . $dEndDate->toString("M") . "x" . $dEndDate->toString("d") . "%22%3E%3C/x%3E");
$urls = array();
$urls[] = new Oara_Curl_Request('https://www.bet365affiliates.com/Members/Members/Statistics/Default.aspx', array());
$exportReport = $this->_client->get($urls);
$forbiddenList = array('ctl00$m_mainPlaceholder$m_periodFromField_hidden', 'ctl00_m_mainPlaceholder_m_periodFromField_DrpPnl_Calendar1', 'ctl00$m_mainPlaceholder$m_periodToField_hidden', 'ctl00_m_mainPlaceholder_m_periodToField_DrpPnl_Calendar1');
$dom = new Zend_Dom_Query($exportReport[0]);
$hiddenList = $dom->query('input[type="hidden"]');
foreach ($hiddenList as $hidden) {
if (!in_array($hidden->getAttribute("name"), $forbiddenList)) {
$valuesFromExport[] = new Oara_Curl_Parameter($hidden->getAttribute("name"), $hidden->getAttribute("value"));
}
}
$urls = array();
$urls[] = new Oara_Curl_Request('https://www.bet365affiliates.com/Members/Members/Statistics/Default.aspx', $valuesFromExport);
$exportReport = $this->_client->post($urls);
$dom = new Zend_Dom_Query($exportReport[0]);
$tableList = $dom->query('table');
$exportData = self::htmlToCsv(self::DOMinnerHTML($tableList->current()));
$num = count($exportData);
for ($i = 2; $i < $num - 1; $i++) {
$overviewExportArray = str_getcsv($exportData[$i], ";");
$overview = array();
$overview['merchantId'] = 1;
$overviewDate = new Zend_Date($overviewExportArray[1], 'dd-MM-yyyy', 'en');
$overview['date'] = $overviewDate->toString("yyyy-MM-dd HH:mm:ss");
$overview['click_number'] = (int) $overviewExportArray[2];
$overview['impression_number'] = 0;
$overview['transaction_number'] = 0;
$overview['transaction_confirmed_value'] = 0;
$overview['transaction_confirmed_commission'] = 0;
$overview['transaction_pending_value'] = 0;
$overview['transaction_pending_commission'] = 0;
$overview['transaction_declined_value'] = 0;
$overview['transaction_declined_commission'] = 0;
$transactionDateArray = Oara_Utilities::getDayFromArray($overview['merchantId'], $transactionArray, $overviewDate);
foreach ($transactionDateArray as $transaction) {
$overview['transaction_number']++;
if ($transaction['status'] == Oara_Utilities::STATUS_CONFIRMED) {
$overview['transaction_confirmed_value'] += $transaction['amount'];
$overview['transaction_confirmed_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_PENDING) {
$overview['transaction_pending_value'] += $transaction['amount'];
$overview['transaction_pending_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_DECLINED) {
$overview['transaction_declined_value'] += $transaction['amount'];
$overview['transaction_declined_commission'] += $transaction['commission'];
}
}
}
}
if (Oara_Utilities::checkRegister($overview)) {
$overviewArray[] = $overview;
}
}
return $overviewArray;
}
示例4: getPaymentHistory
/**
* (non-PHPdoc)
* @see Oara/Network/Oara_Network_Base#getPaymentHistory()
*/
public function getPaymentHistory()
{
$paymentHistory = array();
$valuesFromExport = $this->_exportPaymentParameters;
$urls = array();
$urls[] = new Oara_Curl_Request('https://admin.omgpm.com/v2/finance/affiliate/view_payments.aspx?', array());
$exportReport = $this->_client->get($urls);
/*** load the html into the object ***/
$doc = new DOMDocument();
libxml_use_internal_errors(true);
$doc->validateOnParse = true;
$doc->loadHTML($exportReport[0]);
$hiddenList = $doc->getElementsByTagName('input');
for ($i = 0; $i < $hiddenList->length; $i++) {
$attrs = $hiddenList->item($i)->attributes;
if ($attrs->getNamedItem("type")->nodeValue == 'hidden') {
//we are adding the hidden parameters
$valuesFromExport[] = new Oara_Curl_Parameter($attrs->getNamedItem("name")->nodeValue, $attrs->getNamedItem("value")->nodeValue);
}
}
$yearSelect = $doc->getElementById('ctl00_ContentPlaceHolder1_ddlYear')->childNodes;
$yearStart = (int) $yearSelect->item($yearSelect->length - 1)->attributes->getNamedItem("value")->nodeValue;
$nowDays = new Zend_Date();
$yearEnd = (int) $nowDays->get(Zend_Date::YEAR);
$urls = array();
for ($i = $yearStart; $i <= $yearEnd; $i++) {
$requestValuesFromExport = Oara_Utilities::cloneArray($valuesFromExport);
$requestValuesFromExport[] = new Oara_Curl_Parameter('ctl00$ContentPlaceHolder1$ddlYear', (string) $i);
$urls[] = new Oara_Curl_Request('https://admin.omgpm.com/v2/finance/affiliate/view_payments.aspx?', $requestValuesFromExport);
}
$exportReport = $this->_client->post($urls);
for ($i = 0; $i < count($exportReport); $i++) {
if (!preg_match("/No Results for this criteria/i", $exportReport[$i])) {
$doc = new DOMDocument();
libxml_use_internal_errors(true);
$doc->validateOnParse = true;
$doc->loadHTML($exportReport[$i]);
$table = $doc->getElementById('ctl00_ContentPlaceHolder1_gvSummary');
$paymentList = $table->childNodes;
for ($j = 1; $j < $paymentList->length; $j++) {
$paymentData = $paymentList->item($j)->childNodes;
$obj = array();
$obj['value'] = Oara_Utilities::parseDouble($paymentData->item(5)->nodeValue);
if ($obj['value'] != null) {
$date = new Zend_date($paymentData->item(8)->nodeValue, "dd/MM/yyyy HH:mm:ss");
$obj['date'] = $date->toString("yyyy-MM-dd HH:mm:ss");
$obj['pid'] = $paymentData->item(2)->nodeValue;
$ass = $paymentData->item(5)->nodeValue;
$obj['method'] = 'BACS';
$paymentHistory[] = $obj;
}
}
}
}
return $paymentHistory;
}
示例5: getTransactionList
/**
* (non-PHPdoc)
* @see Oara_Network::getTransactionList()
*/
public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
{
$totalTransactions = array();
$filter = new Zend_Filter_LocalizedToNormalized(array('precision' => 2));
self::login();
$valuesFormExport = Oara_Utilities::cloneArray($this->_exportTransactionParameters);
$valuesFormExport[] = new Oara_Curl_Parameter('startDate', self::formatDate($dStartDate));
$valuesFormExport[] = new Oara_Curl_Parameter('endDate', self::formatDate($dEndDate));
$urls = array();
$urls[] = new Oara_Curl_Request('https://affiliates.wehkamp.nl/pan/aReport3Internal.action?', $valuesFormExport);
$exportReport = $this->_client->get($urls);
$exportReport[0] = self::checkReportError($exportReport[0], $urls[0]);
$exportData = str_getcsv($exportReport[0], "\r\n");
$num = count($exportData);
for ($i = 2; $i < $num - 1; $i++) {
$transactionExportArray = str_getcsv($exportData[$i], ",");
if (!isset($transactionExportArray[2])) {
throw new Exception('Problem getting transaction\\n\\n');
}
if ($transactionExportArray[0] !== '' && in_array((int) $transactionExportArray[2], $merchantList)) {
$transaction = array();
$transaction['merchantId'] = $transactionExportArray[2];
$transactionDate = self::toDate($transactionExportArray[4]);
$transaction['date'] = $transactionDate->toString("yyyy-MM-dd HH:mm:ss");
if ($transactionExportArray[8] != '') {
$transaction['unique_id'] = $transactionExportArray[8];
} else {
if ($transactionExportArray[7] != '') {
$transaction['unique_id'] = $transactionExportArray[7];
} else {
throw new Exception("No Identifier");
}
}
if ($transactionExportArray[9] != '') {
$transaction['custom_id'] = $transactionExportArray[9];
}
if ($transactionExportArray[11] == 'A') {
$transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
} else {
if ($transactionExportArray[11] == 'P') {
$transaction['status'] = Oara_Utilities::STATUS_PENDING;
} else {
if ($transactionExportArray[11] == 'D') {
$transaction['status'] = Oara_Utilities::STATUS_DECLINED;
}
}
}
if ($transactionExportArray[19] != '') {
$transaction['amount'] = Oara_Utilities::parseDouble($transactionExportArray[19]);
} else {
$transaction['amount'] = Oara_Utilities::parseDouble($transactionExportArray[20]);
}
$transaction['commission'] = Oara_Utilities::parseDouble($transactionExportArray[20]);
$totalTransactions[] = $transaction;
}
}
return $totalTransactions;
}
示例6: getCreatives
/**
* (non-PHPdoc)
* @see Oara/Network/Oara_Network_Base#getCreatives()
*/
public function getCreatives()
{
$creativesMap = array();
$merchantList = self::getMerchantList();
foreach ($merchantList as $merchant) {
$websiteFirstId = null;
$websiteMap = array();
if (isset($this->_websitesList[$merchant['cid']])) {
$websiteMap = $this->_websitesList[$merchant['cid']];
}
foreach ($websiteMap as $websiteid => $websiteName) {
$websiteFirstId = $websiteid;
break;
}
if ($websiteFirstId != null) {
$urls = array();
$valuesFormExport = Oara_Utilities::cloneArray($this->_exportCreativeParameters);
$valuesFormExport[] = new Oara_Curl_Parameter('programGEListParameterTransport.siteId', $websiteFirstId);
$valuesFormExport[] = new Oara_Curl_Parameter('programGEListParameterTransport.programIdOrName', $merchant['cid']);
$urls[] = new Oara_Curl_Request('http://www.tradedoubler.com/pan/aGEList.action?', $valuesFormExport);
$exportReport = $this->_client->post($urls);
for ($i = 0; $i < count($exportReport); $i++) {
if (preg_match_all("/javascript: showCode\\((.+)?\\)/", $exportReport[$i], $matches)) {
foreach ($matches[1] as $parameters) {
$paramatersArray = explode(',', $parameters);
$programId = $paramatersArray[1];
$graphicalElementId = $paramatersArray[0];
$affiliateId = $paramatersArray[3];
if (is_numeric($programId) && is_numeric($graphicalElementId) && is_numeric($affiliateId)) {
/**
$creativesMap[(string)$programId][] = "<script type=\"text/javascript\">
var uri = 'http://impgb.tradedoubler.com/imp?type(img)g($graphicalElementId)a($affiliateId)' + new String (Math.random()).substring (2, 11);
document.write('<a href=\"http://clkuk.tradedoubler.com/click?p=$programId&a=$affiliateId&g=$graphicalElementId\" target=\"_BLANK\"><img src=\"'+uri+'\" border=0></a>');
</script>";
$creativesMap[(string)$programId][] = "<script type=\"text/javascript\">
var uri = 'http://impgb.tradedoubler.com/imp?type(iframe)g($graphicalElementId)a($affiliateId)' + new String (Math.random()).substring (2, 11);
document.write('<iframe src=\"'+uri +'\" width=\"234\" height=\"60\" frameborder=\"0\" border=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"></iframe>');
</script>";
**/
$creativesMap[(string) $programId][] = "<script type=\"text/javascript\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t var uri = 'http://impgb.tradedoubler.com/imp?type(js)g({$graphicalElementId})a({$affiliateId})' + new String (Math.random()).substring (2, 11);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t document.write('<sc'+'ript type=\"text/javascript\" src=\"'+uri+'\" charset=\"\"></sc'+'ript>');\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t </script>";
}
}
}
}
}
}
return $creativesMap;
}
示例7: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Base#getOverviewList($merchantId, $dStartDate, $dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
self::logIn();
$overviewArray = array();
$transactionArray = Oara_Utilities::transactionMapPerDay($transactionList);
$epcStartDate = clone $dStartDate;
$epcStartDate->addDay(1);
$epcEndDate = clone $dEndDate;
$epcEndDate->addDay(1);
$overviewExport = Oara_Utilities::cloneArray($this->_exportOverviewParameters);
$overviewExport[] = new Oara_Curl_Parameter('epc_start_date', $epcStartDate->toString("MM/dd/yy"));
$overviewExport[] = new Oara_Curl_Parameter('epc_start_date_month', $epcStartDate->toString("MM"));
$overviewExport[] = new Oara_Curl_Parameter('epc_start_date_day', $epcStartDate->toString("dd"));
$overviewExport[] = new Oara_Curl_Parameter('epc_start_date_year', $epcStartDate->toString("yyyy"));
$overviewExport[] = new Oara_Curl_Parameter('epc_end_date', $epcEndDate->toString("MM/dd/yy"));
$overviewExport[] = new Oara_Curl_Parameter('epc_end_date_month', $epcEndDate->toString("MM"));
$overviewExport[] = new Oara_Curl_Parameter('epc_end_date_day', $epcEndDate->toString("dd"));
$overviewExport[] = new Oara_Curl_Parameter('epc_end_date_year', $epcEndDate->toString("yyyy"));
$overviewByDateArray = array();
$try = 0;
$done = false;
while (!$done && $try < 5) {
try {
$urls = array();
$urls[] = new Oara_Curl_Request('https://publisher.ebaypartnernetwork.com/PublisherReportsTx?', $overviewExport);
$exportReport = $this->_client->get($urls);
$exportData = str_getcsv($exportReport[0], "\n");
$overviewByDateArray = array_merge($overviewByDateArray, self::getOverviewReportRecursive($exportData));
$done = true;
} catch (Exception $e) {
$try++;
}
}
if ($try == 5) {
echo $exportReport[0];
throw new Exception("Couldn't get overview ");
}
// Ad clicks and transactions for this day
foreach ($overviewByDateArray as $date => $obj) {
$overviewDate = new Zend_Date($date, "yyyy/MM/dd");
$returnObject = self::getDayFromArray($obj['merchantId'], $transactionArray, $overviewDate, true);
$transactionDateArray = $returnObject->resultArray;
$transactionArray = $returnObject->dateArray;
unset($overviewDate);
foreach ($transactionDateArray as $transaction) {
$obj['transaction_number']++;
if ($transaction['status'] == Oara_Utilities::STATUS_CONFIRMED) {
$obj['transaction_confirmed_value'] += $transaction['amount'];
$obj['transaction_confirmed_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_PENDING) {
$obj['transaction_pending_value'] += $transaction['amount'];
$obj['transaction_pending_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_DECLINED) {
$obj['transaction_declined_value'] += $transaction['amount'];
$obj['transaction_declined_commission'] += $transaction['commission'];
}
}
}
}
if (Oara_Utilities::checkRegister($obj)) {
$overviewArray[] = $obj;
}
}
//Add transactions
foreach ($transactionArray as $merchantId => $merchantTransaction) {
foreach ($merchantTransaction as $date => $transactionList) {
$overview = array();
$overview['merchantId'] = $merchantId;
$overviewDate = new Zend_Date($date, "yyyy-MM-dd");
$overview['date'] = $overviewDate->toString("yyyy-MM-dd HH:mm:ss");
unset($overviewDate);
$overview['click_number'] = 0;
$overview['impression_number'] = 0;
$overview['transaction_number'] = 0;
$overview['transaction_confirmed_value'] = 0;
$overview['transaction_confirmed_commission'] = 0;
$overview['transaction_pending_value'] = 0;
$overview['transaction_pending_commission'] = 0;
$overview['transaction_declined_value'] = 0;
$overview['transaction_declined_commission'] = 0;
foreach ($transactionList as $transaction) {
$overview['transaction_number']++;
if ($transaction['status'] == Oara_Utilities::STATUS_CONFIRMED) {
$overview['transaction_confirmed_value'] += $transaction['amount'];
$overview['transaction_confirmed_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_PENDING) {
$overview['transaction_pending_value'] += $transaction['amount'];
$overview['transaction_pending_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_DECLINED) {
$overview['transaction_declined_value'] += $transaction['amount'];
$overview['transaction_declined_commission'] += $transaction['commission'];
}
//.........这里部分代码省略.........
示例8: getTransactionList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Publisher_Interface#getTransactionList($aMerchantIds, $dStartDate, $dEndDate, $sTransactionStatus)
*/
public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
{
self::logIn();
$totalTransactions = array();
$valuesFromExport = Oara_Utilities::cloneArray($this->_exportTransactionParameters);
$valuesFromExport[] = new Oara_Curl_Parameter('start_date', $dStartDate->toString("M/d/yy"));
$valuesFromExport[] = new Oara_Curl_Parameter('start_date_month', $dStartDate->toString("MM"));
$valuesFromExport[] = new Oara_Curl_Parameter('start_date_day', $dStartDate->toString("d"));
$valuesFromExport[] = new Oara_Curl_Parameter('start_date_year', $dStartDate->toString("yyyy"));
$valuesFromExport[] = new Oara_Curl_Parameter('end_date', $dEndDate->toString("M/d/yy"));
$valuesFromExport[] = new Oara_Curl_Parameter('end_date_month', $dEndDate->toString("M"));
$valuesFromExport[] = new Oara_Curl_Parameter('end_date_day', $dEndDate->toString("d"));
$valuesFromExport[] = new Oara_Curl_Parameter('end_date_year', $dEndDate->toString("yyyy"));
$urls = array();
$urls[] = new Oara_Curl_Request('https://publisher.ebaypartnernetwork.com/PublisherReportsTx?', $valuesFromExport);
$exportReport = array();
$exportData = array();
try {
$exportReport = $this->_client->get($urls, 'content', 5);
$exportData = str_getcsv($exportReport[0], "\n");
} catch (Exception $e) {
}
$num = count($exportData);
for ($i = 1; $i < $num; $i++) {
$transactionExportArray = str_getcsv($exportData[$i], "\t");
if ($transactionExportArray[2] == "Winning Bid (Revenue)") {
$transaction = array();
$transaction['merchantId'] = 1;
$transactionDate = new Zend_Date($transactionExportArray[1], 'yyyy-MM-dd', 'en');
$transaction['date'] = $transactionDate->toString("yyyy-MM-dd HH:mm:ss");
unset($transactionDate);
if ($transactionExportArray[6] != null) {
$transaction['custom_id'] = $transactionExportArray[6];
}
$transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
$transaction['amount'] = Oara_Utilities::parseDouble($transactionExportArray[15]);
$transaction['commission'] = Oara_Utilities::parseDouble($transactionExportArray[3]);
$totalTransactions[] = $transaction;
}
}
return $totalTransactions;
}
示例9: getTransactionList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Publisher_Interface#getTransactionList($aMerchantIds, $dStartDate, $dEndDate, $sTransactionStatus)
*/
public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
{
$nowDate = new Zend_Date();
$dStartDate = clone $dStartDate;
$dStartDate->setLocale('en');
$dStartDate->setHour("00");
$dStartDate->setMinute("00");
$dStartDate->setSecond("00");
$dEndDate = clone $dEndDate;
$dEndDate->setLocale('en');
$dEndDate->setHour("23");
$dEndDate->setMinute("59");
$dEndDate->setSecond("59");
$valuesFromExport = Oara_Utilities::cloneArray($this->_exportTransactionParameters);
$valuesFromExport[] = new Oara_Curl_Parameter('startDate', $dStartDate->toString("dd-MMM-yyyy"));
$valuesFromExport[] = new Oara_Curl_Parameter('endDate', $dEndDate->toString("dd-MMM-yyyy"));
$transactions = array();
$urls = array();
$urls[] = new Oara_Curl_Request('http://ws-external.afnt.co.uk/apiv1/AFFILIATES/affiliatefuture.asmx/GetTransactionListbyDate?', $valuesFromExport);
$urls[] = new Oara_Curl_Request('http://ws-external.afnt.co.uk/apiv1/AFFILIATES/affiliatefuture.asmx/GetCancelledTransactionListbyDate?', $valuesFromExport);
$exportReport = $this->_client->get($urls);
for ($i = 0; $i < count($urls); $i++) {
$xml = self::loadXml($exportReport[$i]);
if (isset($xml->error)) {
throw new Exception('Error connecting with the server');
}
if (isset($xml->TransactionList)) {
foreach ($xml->TransactionList as $transaction) {
$date = new Zend_Date(self::findAttribute($transaction, 'TransactionDate'), "yyyy-MM-ddTHH:mm:ss");
if (in_array((int) self::findAttribute($transaction, 'ProgrammeID'), $merchantList) && $date->compare($dStartDate) >= 0 && $date->compare($dEndDate) <= 0) {
$obj = array();
$obj['merchantId'] = self::findAttribute($transaction, 'ProgrammeID');
$obj['date'] = $date->toString("yyyy-MM-dd HH:mm:ss");
if (self::findAttribute($transaction, 'TrackingReference') != null) {
$obj['custom_id'] = self::findAttribute($transaction, 'TrackingReference');
}
$obj['unique_id'] = self::findAttribute($transaction, 'TransactionID');
if ($i == 0) {
if (Oara_Utilities::numberOfDaysBetweenTwoDates($date, $nowDate) > 5) {
$obj['status'] = Oara_Utilities::STATUS_CONFIRMED;
} else {
$obj['status'] = Oara_Utilities::STATUS_PENDING;
}
} else {
if ($i == 1) {
$obj['status'] = Oara_Utilities::STATUS_DECLINED;
}
}
$obj['amount'] = self::findAttribute($transaction, 'SaleValue');
$obj['commission'] = self::findAttribute($transaction, 'SaleCommission');
$leadCommission = self::findAttribute($transaction, 'LeadCommission');
if ($leadCommission != 0) {
$obj['commission'] += $leadCommission;
}
$transactions[] = $obj;
}
}
}
}
return $transactions;
}
示例10: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Interface#getOverviewList($aMerchantIds, $dStartDate, $dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
$overviewArray = array();
$firstDayMonth = new Zend_Date();
$firstDayMonth->setDay(1);
$firstDayMonth->setHour("00");
$firstDayMonth->setMinute("00");
$firstDayMonth->setSecond("00");
$modeArray = array("AdSense for Content", "AdSense for Search", "AdSense for Feeds", "AdSense for Domains");
$valuesExport = array();
$valuesExport[] = new Oara_Curl_Parameter('d', $dStartDate->toString("yyyy/M/d") . "-" . $dEndDate->toString("yyyy/M/d"));
$valuesExportReport[] = new Oara_Curl_Parameter('ag', 'date');
$valuesExport[] = new Oara_Curl_Parameter('oc', 'earnings');
$valuesExport[] = new Oara_Curl_Parameter('oo', 'descending');
$valuesExport[] = new Oara_Curl_Parameter('hl', 'en_GB');
$urls = array();
$valuesExportReport = Oara_Utilities::cloneArray($valuesExport);
$valuesExportReport[] = new Oara_Curl_Parameter('dd', '1YproductY1YAFCYAdSense for Content');
$urls[] = new Oara_Curl_Request('https://www.google.com/adsense/v3/gwt/exportCsv?', $valuesExportReport);
$valuesExportReport = Oara_Utilities::cloneArray($valuesExport);
$valuesExportReport[] = new Oara_Curl_Parameter('dd', '1YproductY1YAFSYAdSense for Search');
$urls[] = new Oara_Curl_Request('https://www.google.com/adsense/v3/gwt/exportCsv?', $valuesExportReport);
$valuesExportReport = Oara_Utilities::cloneArray($valuesExport);
$valuesExportReport[] = new Oara_Curl_Parameter('dd', '1YproductY1YAFFYAdSense for Feeds');
$urls[] = new Oara_Curl_Request('https://www.google.com/adsense/v3/gwt/exportCsv?', $valuesExportReport);
$valuesExportReport = Oara_Utilities::cloneArray($valuesExport);
$valuesExportReport[] = new Oara_Curl_Parameter('dd', '1YproductY1YAFDYAdSense for Domains');
$urls[] = new Oara_Curl_Request('https://www.google.com/adsense/v3/gwt/exportCsv?', $valuesExportReport);
$content = $this->_client->post($urls);
for ($i = 0; $i < count($content); $i++) {
$exportData = str_getcsv(@iconv('UTF-16', 'UTF-8', $content[$i]), "\n");
for ($j = 1; $j < count($exportData); $j++) {
$overviewExportArray = str_getcsv($exportData[$j], "\t");
$obj = array();
$obj['merchantId'] = 1;
$overviewDate = new Zend_Date($overviewExportArray[0], "yyyy-MM-dd");
$overviewDate->setHour("00");
$overviewDate->setMinute("00");
$overviewDate->setSecond("00");
$obj['date'] = $overviewDate->toString("yyyy-MM-dd HH:mm:ss");
$obj['link'] = $modeArray[$i];
$obj['transaction_number'] = 0;
$obj['transaction_confirmed_commission'] = 0;
$obj['transaction_confirmed_value'] = 0;
$obj['transaction_pending_commission'] = 0;
$obj['transaction_pending_value'] = 0;
$obj['transaction_declined_commission'] = 0;
$obj['transaction_declined_value'] = 0;
$obj['impression_number'] = (int) Oara_Utilities::parseDouble($overviewExportArray[1]);
$obj['click_number'] = Oara_Utilities::parseDouble($overviewExportArray[2]);
if ($firstDayMonth->compare($overviewDate) <= 0) {
$obj['transaction_pending_commission'] = Oara_Utilities::parseDouble($overviewExportArray[6]);
$obj['transaction_pending_value'] = Oara_Utilities::parseDouble($overviewExportArray[6]);
} else {
$obj['transaction_confirmed_commission'] = Oara_Utilities::parseDouble($overviewExportArray[6]);
$obj['transaction_confirmed_value'] = Oara_Utilities::parseDouble($overviewExportArray[6]);
}
if (Oara_Utilities::checkRegister($obj)) {
$overviewArray[] = $obj;
}
}
}
unset($urls);
return $overviewArray;
}
示例11: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Base#getOverviewList($merchantId, $dStartDate, $dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
$overviewArray = array();
$transactionArray = Oara_Utilities::transactionMapPerDay($transactionList);
$valuesFromExport = Oara_Utilities::cloneArray($this->_exportTransactionParameters);
$valuesFromExport[] = new Oara_Curl_Parameter('fromPeriod', $dStartDate->toString("yyyy-MM-dd"));
$valuesFromExport[] = new Oara_Curl_Parameter('toPeriod', $dEndDate->toString("yyyy-MM-dd"));
$urls = array();
$urls[] = new Oara_Curl_Request('https://www.affutd.com/en/traffic-stats/advertiser', array());
$exportReport = $this->_client->get($urls);
$dom = new Zend_Dom_Query($exportReport[0]);
$campaignOption = $dom->query('option[label="DEFAULT"]');
$campaignOption = $campaignOption->current();
$valuesFromExport[] = new Oara_Curl_Parameter('campaign', $campaignOption->getAttribute('value'));
$hiddenParam = $dom->query('#jsonCampaigns');
$hiddenParam = $hiddenParam->current();
$valuesFromExport[] = new Oara_Curl_Parameter($hiddenParam->getAttribute('id'), $hiddenParam->getAttribute('value'));
$urls = array();
$urls[] = new Oara_Curl_Request('https://www.affutd.com/en/traffic-stats/advertiser', $valuesFromExport);
$exportReport = $this->_client->post($urls);
$exportData = str_getcsv($exportReport[0], "\n");
$num = count($exportData);
for ($i = 1; $i < $num - 1; $i++) {
$overviewExportArray = str_getcsv($exportData[$i], ",");
if (isset($this->_merchantMap[$overviewExportArray[0]]) && in_array($this->_merchantMap[$overviewExportArray[0]], $merchantList)) {
$overview = array();
$overview['merchantId'] = $this->_merchantMap[$overviewExportArray[0]];
$overviewDate = new Zend_Date($overviewExportArray[1], 'yyyy-MM-dd', 'en');
$overview['date'] = $overviewDate->toString("yyyy-MM-dd HH:mm:ss");
$overview['click_number'] = (int) $overviewExportArray[8];
$overview['impression_number'] = (int) $overviewExportArray[9];
$overview['transaction_number'] = 0;
$overview['transaction_confirmed_value'] = 0;
$overview['transaction_confirmed_commission'] = 0;
$overview['transaction_pending_value'] = 0;
$overview['transaction_pending_commission'] = 0;
$overview['transaction_declined_value'] = 0;
$overview['transaction_declined_commission'] = 0;
$transactionDateArray = Oara_Utilities::getDayFromArray($overview['merchantId'], $transactionArray, $overviewDate);
foreach ($transactionDateArray as $transaction) {
$overview['transaction_number']++;
if ($transaction['status'] == Oara_Utilities::STATUS_CONFIRMED) {
$overview['transaction_confirmed_value'] += $transaction['amount'];
$overview['transaction_confirmed_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_PENDING) {
$overview['transaction_pending_value'] += $transaction['amount'];
$overview['transaction_pending_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_DECLINED) {
$overview['transaction_declined_value'] += $transaction['amount'];
$overview['transaction_declined_commission'] += $transaction['commission'];
}
}
}
}
if (Oara_Utilities::checkRegister($overview)) {
$overviewArray[] = $overview;
}
}
}
return $overviewArray;
}
示例12: getPaymentHistory
/**
* (non-PHPdoc)
* @see Oara/Network/Oara_Network_Base#getPaymentHistory()
*/
public function getPaymentHistory()
{
$paymentHistory = array();
$valuesFromExport = Oara_Utilities::cloneArray($this->_exportPaymentParameters);
$valuesFromExport[] = new Oara_Curl_Parameter('fromDate', "01/01/2000");
$dEndDate = new Zend_Date();
$valuesFromExport[] = new Oara_Curl_Parameter('until', $dEndDate->toString("dd/MM/yyyy"));
$urls = array();
$urls[] = new Oara_Curl_Request('https://www.ladbrokes.com/aff_man', $valuesFromExport);
$exportReport = $this->_client->post($urls);
$dom = new Zend_Dom_Query($exportReport[0]);
$tableList = $dom->query('#results_table');
$exportData = self::htmlToCsv(self::DOMinnerHTML($tableList->current()));
$num = count($exportData);
for ($i = 2; $i < $num - 2; $i++) {
$paymentExportArray = str_getcsv($exportData[$i], ";");
$obj = array();
$date = new Zend_Date($paymentExportArray[1], "dd/MM/yy", 'en');
$obj['date'] = $date->toString("yyyy-MM-dd HH:mm:ss");
$obj['pid'] = $i - 1;
$obj['value'] = $paymentExportArray[10];
$obj['method'] = 'BACS';
$paymentHistory[] = $obj;
}
return $paymentHistory;
}
示例13: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Base#getOverviewList($merchantId, $dStartDate, $dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
$totalOverview = array();
$valuesFromExport = Oara_Utilities::cloneArray($this->_exportOverviewParameters);
$valuesFromExport[] = new Oara_Curl_Parameter('campaignID', self::getAdvertisersCampaigns($merchantList));
$valuesFromExport[] = new Oara_Curl_Parameter('fromDate', $dStartDate->toString("dd/MM/yyyy"));
$valuesFromExport[] = new Oara_Curl_Parameter('toDate', $dEndDate->toString("dd/MM/yyyy"));
$urls = array();
$urls[] = new Oara_Curl_Request('http://www.dgmpro.com/affiliates/cfc/dgmreports.cfc?method=getSummaryCSV', $valuesFromExport);
$exportReport = $this->_curlClient->post($urls);
$reportUrl = null;
if (preg_match("/<filelocation>(.*)<\\/filelocation>/", $exportReport[0], $matches)) {
$reportUrl = trim($matches[1]);
} else {
throw new Exception('No transaction report found');
}
$urls = array();
$urls[] = new Oara_Curl_Request($reportUrl, array());
$exportReport = $this->_curlClient->get($urls);
$exportData = str_getcsv($exportReport[0], "\n");
if (self::checkOverview($exportData)) {
$transactionArray = Oara_Utilities::transactionMapPerDay($transactionList);
$iteration = self::calculeIterationNumber(count($merchantList), $this->_pageSize);
for ($it = 0; $it < $iteration; $it++) {
$merchantStartIndex = $this->_pageSize * $it;
if (count($merchantList) > $this->_pageSize * ($it + 1)) {
$merchantEndIndex = $this->_pageSize * ($it + 1);
} else {
$merchantEndIndex = count($merchantList);
}
$urls = array();
for ($merchantIndex = $merchantStartIndex; $merchantIndex < $merchantEndIndex; $merchantIndex++) {
$valuesFromExport = Oara_Utilities::cloneArray($this->_exportOverviewParameters);
$valuesFromExport[] = new Oara_Curl_Parameter('campaignID', self::getAdvertisersCampaigns(array($merchantList[$merchantIndex])));
$valuesFromExport[] = new Oara_Curl_Parameter('fromDate', $dStartDate->toString("dd/MM/yyyy"));
$valuesFromExport[] = new Oara_Curl_Parameter('toDate', $dEndDate->toString("dd/MM/yyyy"));
$urls[] = new Oara_Curl_Request('http://www.dgmpro.com/affiliates/cfc/dgmreports.cfc?method=getSummaryCSV', $valuesFromExport);
}
$exportReportUrl = $this->_curlClient->post($urls);
$urls = array();
for ($i = 0; $i < count($exportReportUrl); $i++) {
$reportUrl = null;
if (preg_match("/<filelocation>(.*)<\\/filelocation>/", $exportReportUrl[$i], $matches)) {
$reportUrl = trim($matches[1]);
$urls[] = new Oara_Curl_Request($reportUrl, array());
} else {
throw new Exception('No transaction report found');
}
}
$overviewRegisters = $this->_curlClient->get($urls);
for ($i = 0; $i < count($overviewRegisters); $i++) {
$exportData = str_getcsv($overviewRegisters[$i], "\n");
for ($j = 7; $j < count($exportData) - 2; $j++) {
$overviewExportArray = str_getcsv($exportData[$j], ",");
$overview = array();
$overview['merchantId'] = $merchantList[$i];
$transactionDate = new Zend_Date($overviewExportArray[0], 'dd-MMM-yyyy HH:mm:ss', 'en_GB');
$overview['date'] = $transactionDate->toString("yyyy-MM-dd HH:mm:ss");
$overview['click_number'] = (int) $overviewExportArray[2];
$overview['impression_number'] = (int) $overviewExportArray[1];
$overview['transaction_number'] = 0;
$overview['transaction_confirmed_value'] = 0;
$overview['transaction_confirmed_commission'] = 0;
$overview['transaction_pending_value'] = 0;
$overview['transaction_pending_commission'] = 0;
$overview['transaction_declined_value'] = 0;
$overview['transaction_declined_commission'] = 0;
$transactionDateArray = Oara_Utilities::getDayFromArray($overview['merchantId'], $transactionArray, $transactionDate);
foreach ($transactionDateArray as $transaction) {
$overview['transaction_number']++;
if ($transaction['status'] == Oara_Utilities::STATUS_CONFIRMED) {
$overview['transaction_confirmed_value'] += $transaction['amount'];
$overview['transaction_confirmed_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_PENDING) {
$overview['transaction_pending_value'] += $transaction['amount'];
$overview['transaction_pending_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_DECLINED) {
$overview['transaction_declined_value'] += $transaction['amount'];
$overview['transaction_declined_commission'] += $transaction['commission'];
}
}
}
}
if (Oara_Utilities::checkRegister($overview)) {
$totalOverview[] = $overview;
}
}
}
}
}
return $totalOverview;
}
示例14: getTransactionList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Publisher_Interface#getTransactionList($aMerchantIds, $dStartDate, $dEndDate, $sTransactionStatus)
*/
public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
{
$totalTransactions = array();
$filter = new Zend_Filter_LocalizedToNormalized(array('precision' => 2));
$valuesFromExport = array();
$urls = array();
$urls[] = new Oara_Curl_Request('https://secure.paymode.com/paymode/reports-baiv2.jsp?', array());
$exportReport = $this->_client->get($urls);
$dom = new Zend_Dom_Query($exportReport[0]);
$results = $dom->query('input[type="hidden"]');
foreach ($results as $hidden) {
$name = $hidden->getAttribute("name");
$value = $hidden->getAttribute("value");
$valuesFromExport[] = new Oara_Curl_Parameter($name, $value);
}
$valuesFromExport[] = new Oara_Curl_Parameter('dataSource', '1');
$valuesFromExport[] = new Oara_Curl_Parameter('RA:reports-baiv2.jspCHOOSE', '620541800');
$valuesFromExport[] = new Oara_Curl_Parameter('reportFormat', 'csv');
$valuesFromExport[] = new Oara_Curl_Parameter('includeCurrencyCodeColumn', 'on');
$valuesFromExport[] = new Oara_Curl_Parameter('remitTypeCode', '');
$valuesFromExport[] = new Oara_Curl_Parameter('PAYMENT_CURRENCY_TYPE', 'CREDIT');
$valuesFromExport[] = new Oara_Curl_Parameter('PAYMENT_CURRENCY_TYPE', 'INSTRUCTION');
$valuesFromExport[] = new Oara_Curl_Parameter('subSiteExtID', '');
$valuesFromExport[] = new Oara_Curl_Parameter('ediProvider835Version', '5010');
$valuesFromExport[] = new Oara_Curl_Parameter('tooManyRowsCheck', 'true');
$urls = array();
$dateList = Oara_Utilities::daysOfDifference($dStartDate, $dEndDate);
foreach ($dateList as $date) {
$valuesFromExportTemp = Oara_Utilities::cloneArray($valuesFromExport);
$valuesFromExportTemp[] = new Oara_Curl_Parameter('date', $date->toString("MM/dd/yyyy"));
$urls[] = new Oara_Curl_Request('https://secure.paymode.com/paymode/reports-do_csv.jsp?closeJQS=true?', $valuesFromExportTemp);
}
$exportReport = $this->_client->get($urls);
$transactionCounter = 0;
$valueCounter = 0;
$commissionCounter = 0;
$j = 0;
foreach ($exportReport as $report) {
$reportParameters = $urls[$j]->getParameters();
$reportDate = $reportParameters[count($reportParameters) - 1]->getValue();
$transactionDate = new Zend_Date($reportDate, 'MM/dd/yyyy', 'en');
if (!preg_match("/logout.jsp/", $report)) {
$exportReportData = str_getcsv($report, "\n");
$num = count($exportReportData);
for ($i = 1; $i < $num; $i++) {
$transactionArray = str_getcsv($exportReportData[$i], ",");
if (count($transactionArray) == 30 && $transactionArray[0] == 'D' && $transactionArray[1] == null) {
$transactionCounter++;
$valueCounter += $filter->filter($transactionArray[24]);
$commissionCounter += $filter->filter($transactionArray[28]);
}
}
}
$j++;
}
if ($transactionCounter > 0) {
for ($i = 0; $i < count($dateList); $i++) {
$transaction = array();
$transaction['merchantId'] = 1;
$transaction['status'] = Oara_Utilities::STATUS_PAID;
$transaction['date'] = $dateList[$i]->toString("yyyy-MM-dd HH:mm:ss");
$transaction['amount'] = $valueCounter / count($dateList);
$transaction['commission'] = $commissionCounter / count($dateList);
$totalTransactions[] = $transaction;
}
}
return $totalTransactions;
}
示例15: getOverviewList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Interface#getOverviewList($aMerchantIds, $dStartDate, $dEndDate)
*/
public function getOverviewList($transactionList = null, $merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null)
{
$overviewArray = array();
$transactionArray = array();
$mothOverviewUrls = array();
$valuesFromExport = Oara_Utilities::cloneArray($this->_exportOverviewParameters);
$valuesFromExport[] = new Oara_Curl_Parameter('from_year', $dStartDate->get(Zend_Date::YEAR));
$valuesFromExport[] = new Oara_Curl_Parameter('from_month', $dStartDate->get(Zend_Date::MONTH));
$valuesFromExport[] = new Oara_Curl_Parameter('from_day', $dStartDate->get(Zend_Date::DAY));
$valuesFromExport[] = new Oara_Curl_Parameter('to_year', $dEndDate->get(Zend_Date::YEAR));
$valuesFromExport[] = new Oara_Curl_Parameter('to_month', $dEndDate->get(Zend_Date::MONTH));
$valuesFromExport[] = new Oara_Curl_Parameter('to_day', $dEndDate->get(Zend_Date::DAY));
$valuesFromExport[] = new Oara_Curl_Parameter('prog_id', '0');
$urls = array();
$urls[] = new Oara_Curl_Request('http://users.buy.at/ma/index.php/affiliateReport/dailySummary?', $valuesFromExport);
$exportReport = $this->_client->get($urls);
$exportData = str_getcsv($exportReport[0], "\r\n");
if (self::checkOverview($exportData)) {
$transactionArray = Oara_Utilities::transactionMapPerDay($transactionList);
foreach ($merchantList as $idMerchant) {
$valuesFromExport = Oara_Utilities::cloneArray($this->_exportOverviewParameters);
$valuesFromExport[] = new Oara_Curl_Parameter('from_year', $dStartDate->get(Zend_Date::YEAR));
$valuesFromExport[] = new Oara_Curl_Parameter('from_month', $dStartDate->get(Zend_Date::MONTH));
$valuesFromExport[] = new Oara_Curl_Parameter('from_day', $dStartDate->get(Zend_Date::DAY));
$valuesFromExport[] = new Oara_Curl_Parameter('to_year', $dEndDate->get(Zend_Date::YEAR));
$valuesFromExport[] = new Oara_Curl_Parameter('to_month', $dEndDate->get(Zend_Date::MONTH));
$valuesFromExport[] = new Oara_Curl_Parameter('to_day', $dEndDate->get(Zend_Date::DAY));
$valuesFromExport[] = new Oara_Curl_Parameter('prog_id', $idMerchant);
$mothOverviewUrls[] = new Oara_Curl_Request('http://users.buy.at/ma/index.php/affiliateReport/dailySummary?', $valuesFromExport);
}
}
if (count($mothOverviewUrls) > 0) {
$exportReport = $this->_client->get($mothOverviewUrls);
$exportReportNumber = count($exportReport);
for ($i = 0; $i < $exportReportNumber; $i++) {
$exportData = str_getcsv($exportReport[$i], "\r\n");
$num = count($exportData);
if (self::checkOverview($exportData)) {
for ($j = 1; $j < $num; $j++) {
$overviewExportArray = str_getcsv($exportData[$j], ",");
$parameter = $mothOverviewUrls[$i]->getParameter(21);
$parameterMerchantId = $parameter->getValue();
$obj = array();
$obj['merchantId'] = $parameterMerchantId;
$overviewDate = new Zend_Date($overviewExportArray[0], "yyyy-MM-dd");
$obj['date'] = $overviewDate->toString("yyyy-MM-dd HH:mm:ss");
$obj['impression_number'] = 0;
$obj['click_number'] = $overviewExportArray[1];
$obj['transaction_number'] = 0;
$obj['transaction_confirmed_commission'] = 0;
$obj['transaction_confirmed_value'] = 0;
$obj['transaction_pending_commission'] = 0;
$obj['transaction_pending_value'] = 0;
$obj['transaction_declined_commission'] = 0;
$obj['transaction_declined_value'] = 0;
$transactionDateArray = Oara_Utilities::getDayFromArray($obj['merchantId'], $transactionArray, $overviewDate);
foreach ($transactionDateArray as $transaction) {
$obj['transaction_number']++;
if ($transaction['status'] == Oara_Utilities::STATUS_CONFIRMED) {
$obj['transaction_confirmed_value'] += $transaction['amount'];
$obj['transaction_confirmed_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_PENDING) {
$obj['transaction_pending_value'] += $transaction['amount'];
$obj['transaction_pending_commission'] += $transaction['commission'];
} else {
if ($transaction['status'] == Oara_Utilities::STATUS_DECLINED) {
$obj['transaction_declined_value'] += $transaction['amount'];
$obj['transaction_declined_commission'] += $transaction['commission'];
}
}
}
}
if (Oara_Utilities::checkRegister($obj)) {
$overviewArray[] = $obj;
}
}
}
}
}
return $overviewArray;
}