本文整理汇总了PHP中Oara_Utilities::parseDouble方法的典型用法代码示例。如果您正苦于以下问题:PHP Oara_Utilities::parseDouble方法的具体用法?PHP Oara_Utilities::parseDouble怎么用?PHP Oara_Utilities::parseDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oara_Utilities
的用法示例。
在下文中一共展示了Oara_Utilities::parseDouble方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
$xmlLocation = "https://api.m4n.nl/restful/csv/affiliate/leads/clickTime/from/" . $dStartDate->toString("yyyyMMdd") . "/to/" . $dEndDate->toString("yyyyMMdd") . "";
$transactionData = self::returnApiData($xmlLocation);
$exportData = str_getcsv($transactionData, "\n");
$num = count($exportData);
for ($i = 1; $i < $num; $i++) {
$transactionExportArray = str_getcsv($exportData[$i], ";");
if (in_array((int) $transactionExportArray[3], $merchantList)) {
$transaction = array();
$merchantId = (int) $transactionExportArray[3];
$transaction['merchantId'] = $merchantId;
$transaction['unique_id'] = $transactionExportArray[0];
$date = $transactionExportArray[10];
if ($transactionExportArray[10] == "null") {
$date = $transactionExportArray[9];
}
$transactionDate = new Zend_Date($date, 'yyyy-MM-dd HH:mm:ss');
$transaction['date'] = $transactionDate->toString("yyyy-MM-dd HH:mm:ss");
if ($transactionExportArray[2] == 'ACCEPTED') {
$transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
} else {
if ($transactionExportArray[2] == 'ON_HOLD' || $transactionExportArray[2] == 'TO_BE_APPROVED' || $transactionExportArray[2] == 'BLOCKED') {
$transaction['status'] = Oara_Utilities::STATUS_PENDING;
} else {
if ($transactionExportArray[2] == 'REJECTED') {
$transaction['status'] = Oara_Utilities::STATUS_DECLINED;
} else {
throw new Exception("New status {$transactionExportArray['2']}");
}
}
}
$transaction['amount'] = Oara_Utilities::parseDouble($transactionExportArray[12]);
$transaction['commission'] = Oara_Utilities::parseDouble($transactionExportArray[4]);
$totalTransactions[] = $transaction;
}
}
return $totalTransactions;
}
示例2: getTransactionList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Publisher_Interface#getTransactionList($idMerchant, $dStartDate, $dEndDate)
*/
public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
{
$totalTransactions = array();
$returnResult = self::makeCall("transactiondetail", "&dateStart=" . $dStartDate->toString("MM/dd/yyyy") . "&dateEnd=" . $dEndDate->toString("MM/dd/yyyy"));
$exportData = str_getcsv($returnResult, "\r\n");
$num = count($exportData);
for ($i = 1; $i < $num; $i++) {
$transactionExportArray = str_getcsv($exportData[$i], "|");
if (in_array((int) $transactionExportArray[1], $merchantList)) {
$transaction = array();
$merchantId = (int) $transactionExportArray[1];
$transaction['merchantId'] = $merchantId;
$transactionDate = new Zend_Date($transactionExportArray[2], 'MM-dd-yyyy HH:mm:ss');
$transaction['date'] = $transactionDate->toString("yyyy-MM-dd HH:mm:ss");
$transaction['unique_id'] = (int) $transactionExportArray[0];
if ($transactionExportArray[27] != null) {
$transaction['custom_id'] = $transactionExportArray[27];
}
if ($transactionExportArray[8] != null) {
$transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
} else {
if ($transactionExportArray[9] != null) {
$transaction['status'] = Oara_Utilities::STATUS_PENDING;
} else {
if ($transactionExportArray[7] != null) {
$transaction['status'] = Oara_Utilities::STATUS_DECLINED;
} else {
$transaction['status'] = Oara_Utilities::STATUS_PENDING;
}
}
}
$transaction['amount'] = Oara_Utilities::parseDouble($transactionExportArray[3]);
$transaction['commission'] = Oara_Utilities::parseDouble($transactionExportArray[4]);
$totalTransactions[] = $transaction;
}
}
return $totalTransactions;
}
示例3: getPaymentHistory
/**
* (non-PHPdoc)
* @see Oara/Network/Oara_Network_Publisher_Base#getPaymentHistory()
*/
public function getPaymentHistory($currentPage = 1)
{
$paymentHistory = array();
$pdfToTextPath = '';
if (PHP_OS == "WIN32" || PHP_OS == "WINNT") {
return $paymentHistory;
} else {
// some other platform
$pdfToTextPath = 'pdftotext ';
}
$params = array();
if ($currentPage != 1) {
$urls = array();
$urls[] = new Oara_Curl_Request($this->_serverUrl . '/Invoices/Default.aspx?', $params);
$exportReport = $this->_client->post($urls);
$doc = new DOMDocument();
libxml_use_internal_errors(true);
$doc->validateOnParse = true;
$doc->loadHTML($exportReport[0]);
$viewState = $doc->getElementById('__VIEWSTATE')->attributes->getNamedItem("value")->nodeValue;
$params = array(new Oara_Curl_Parameter('__EVENTTARGET', 'ctl00$ContentPlaceHolder1$gvInvoices'), new Oara_Curl_Parameter('__EVENTARGUMENT', 'Page$' . $currentPage), new Oara_Curl_Parameter('__VIEWSTATE', $viewState));
}
$urls = array();
$urls[] = new Oara_Curl_Request($this->_serverUrl . '/Invoices/Default.aspx?', $params);
$exportReport = $this->_client->post($urls);
$doc = new DOMDocument();
libxml_use_internal_errors(true);
$doc->validateOnParse = true;
$doc->loadHTML($exportReport[0]);
$registerTable = $doc->getElementById('ctl00_ContentPlaceHolder1_gvInvoices');
if ($registerTable !== null) {
$registerLines = $registerTable->childNodes;
$descriptorspec = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
$pagesNumber = 1;
for ($i = 2; $i < $registerLines->length; $i++) {
$registerLineClass = $registerLines->item($i)->attributes->getNamedItem("class")->nodeValue;
if ($registerLineClass == 'pager') {
$lenght = $registerLines->item($i)->childNodes->item(0)->childNodes->item(0)->childNodes->item(0)->childNodes->length;
$pagesNumber = $registerLines->item($i)->childNodes->item(0)->childNodes->item(0)->childNodes->item(0)->childNodes->item($lenght - 2)->nodeValue;
} else {
$registerLine = $registerLines->item($i)->childNodes;
$obj = array();
//get the pdf
$parameters = array();
$parameters[] = new Oara_Curl_Parameter('id', $registerLine->item(0)->nodeValue);
$urls = array();
$urls[] = new Oara_Curl_Request($this->_serverUrl . 'Invoices/ViewInvoice.aspx?', $parameters);
$exportReport = $this->_client->get($urls);
$exportReportUrl = $this->_client->get($urls, 'url');
$exportReportUrl = explode('/', $exportReportUrl[0]);
$exportReportUrl = $exportReportUrl[count($exportReportUrl) - 1];
$dir = realpath(dirname(__FILE__)) . '/../../data/pdf/';
//writing temp pdf
$fh = fopen($dir . $exportReportUrl, 'w') or die("can't open file");
fwrite($fh, $exportReport[0]);
fclose($fh);
//parsing the pdf
$pipes = null;
$pdfReader = proc_open($pdfToTextPath . $dir . $exportReportUrl . ' -', $descriptorspec, $pipes, null, null);
if (is_resource($pdfReader)) {
$pdfContent = '';
$error = '';
$stdin = $pipes[0];
$stdout = $pipes[1];
$stderr = $pipes[2];
while (!feof($stdout)) {
$pdfContent .= fgets($stdout);
}
while (!feof($stderr)) {
$error .= fgets($stderr);
}
fclose($stdin);
fclose($stdout);
fclose($stderr);
$exit_code = proc_close($pdfReader);
}
if (preg_match_all("/[0-9]*,?[0-9]*\\.[0-9]+/", $pdfContent, $matches)) {
$obj['value'] = Oara_Utilities::parseDouble($matches[0][count($matches[0]) - 1]);
} else {
throw new Exception('Problem getting value in payments');
}
unlink($dir . $exportReportUrl);
$date = new Zend_Date($registerLine->item(3)->nodeValue, "dd/MMM/yyyy", 'en_US');
$obj['date'] = $date->toString("yyyy-MM-dd HH:mm:ss");
$obj['pid'] = $registerLine->item(0)->nodeValue;
$obj['method'] = 'BACS';
$paymentHistory[] = $obj;
}
}
if ($currentPage == 1) {
for ($i = 2; $i <= $pagesNumber; $i++) {
$paymentHistory = array_merge($paymentHistory, self::getPaymentHistory($i));
}
}
}
return $paymentHistory;
//.........这里部分代码省略.........
示例4: getPaymentHistory
/**
* (non-PHPdoc)
* @see Oara/Network/Oara_Network_Publisher_Base#getPaymentHistory()
*/
public function getPaymentHistory()
{
$filter = new Zend_Filter_LocalizedToNormalized(array('precision' => 2));
$paymentHistory = array();
$urls = array();
$urls[] = new Oara_Curl_Request('https://affiliates.wehkamp.nl/pan/reportSelection/Payment?', 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]);
$selectList = $doc->getElementsByTagName('select');
$paymentSelect = null;
if ($selectList->length > 0) {
// looking for the payments select
$it = 0;
while ($it < $selectList->length) {
$selectName = $selectList->item($it)->attributes->getNamedItem('name')->nodeValue;
if ($selectName == 'payment_id') {
$paymentSelect = $selectList->item($it);
break;
}
$it++;
}
if ($paymentSelect != null) {
$paymentLines = $paymentSelect->childNodes;
for ($i = 0; $i < $paymentLines->length; $i++) {
$pid = $paymentLines->item($i)->attributes->getNamedItem("value")->nodeValue;
if (is_numeric($pid)) {
$obj = array();
$paymentLine = $paymentLines->item($i)->nodeValue;
$value = preg_replace("/[^0-9\\.,]/", "", substr($paymentLine, 10));
$date = self::toDate(substr($paymentLine, 0, 10));
$obj['date'] = $date->toString("yyyy-MM-dd HH:mm:ss");
$obj['pid'] = $pid;
$obj['method'] = 'BACS';
$obj['value'] = Oara_Utilities::parseDouble($value);
$paymentHistory[] = $obj;
}
}
}
}
return $paymentHistory;
}
示例5: 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;
}
示例6: getPaymentHistory
/**
* (non-PHPdoc)
* @see Oara/Network/Oara_Network_Base#getPaymentHistory()
*/
public function getPaymentHistory()
{
$paymentHistory = array();
$urls = array();
$urls[] = new Oara_Curl_Request('http://www.tradedoubler.com/pan/reportSelection/Payment?', 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]);
$selectList = $doc->getElementsByTagName('select');
$paymentSelect = null;
if ($selectList->length > 0) {
// looking for the payments select
$it = 0;
while ($it < $selectList->length) {
$selectName = $selectList->item($it)->attributes->getNamedItem('name')->nodeValue;
if ($selectName == 'payment_id') {
$paymentSelect = $selectList->item($it);
break;
}
$it++;
}
if ($paymentSelect != null) {
$paymentLines = $paymentSelect->childNodes;
for ($i = 0; $i < $paymentLines->length; $i++) {
$pid = $paymentLines->item($i)->attributes->getNamedItem("value")->nodeValue;
if (is_numeric($pid)) {
$obj = array();
$paymentLine = $paymentLines->item($i)->nodeValue;
$paymentLine = htmlentities($paymentLine);
$paymentLine = str_replace("Â ", "", $paymentLine);
$paymentLine = html_entity_decode($paymentLine);
if ($this->_dateFormat == 'dd/MM/yy') {
$date = new Zend_Date(substr($paymentLine, 0, 10), "dd/MM/yy");
} else {
if ($this->_dateFormat == 'M/d/yy') {
$date = new Zend_Date(substr($paymentLine, 0, 10), "M/d/yy");
} else {
if ($this->_dateFormat == 'd/MM/yy') {
$date = new Zend_Date(substr($paymentLine, 0, 10), "d/MM/yy");
} else {
if ($this->_dateFormat == 'tt.MM.uu') {
$date = new Zend_Date(substr($paymentLine, 0, 10), "dd.MM.yy");
} else {
throw new Exception("\n Date Format not supported " . $this->_dateFormat . "\n");
}
}
}
}
$obj['date'] = $date->toString("yyyy-MM-dd HH:mm:ss");
$obj['pid'] = $pid;
$obj['method'] = 'BACS';
if (preg_match("/[-+]?[0-9]*,?[0-9]*\\.?[0-9]+/", substr($paymentLine, 10), $matches)) {
$obj['value'] = Oara_Utilities::parseDouble($matches[0]);
} else {
throw new Exception("Problem reading payments");
}
$paymentHistory[] = $obj;
}
}
}
}
return $paymentHistory;
}
示例7: getTransactionList
/**
* @param null $merchantList
* @param Zend_Date|null $dStartDate
* @param Zend_Date|null $dEndDate
* @param null $merchantMap
* @return array
*/
public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
{
$totalTransactions = array();
$valuesFromExport = array(new Oara_Curl_Parameter('payment[from]', $dStartDate->toString("MM/dd/yyyy")), new Oara_Curl_Parameter('payment[to]', $dEndDate->toString("MM/dd/yyyy")));
$rch = curl_init();
$options = $this->_options;
$arg = array();
foreach ($valuesFromExport as $parameter) {
$arg[] = $parameter->getKey() . '=' . urlencode($parameter->getValue());
}
$url = 'http://affiliates.shuttlefare.com/partners/payments/report.csv?' . implode('&', $arg);
curl_setopt($rch, CURLOPT_URL, $url);
curl_setopt_array($rch, $options);
$html = curl_exec($rch);
curl_close($rch);
if (!preg_match("/No transaction in given date range/", $html) && $html) {
$exportData = explode("\n", $html);
$num = count($exportData);
for ($i = 0; $i < $num - 1; $i++) {
$transactionExportArray = explode(",", $exportData[$i]);
$transaction = array();
$transaction['merchantId'] = 1;
$transaction['unique_id'] = $transactionExportArray[0];
$transactionDate = new Zend_Date($transactionExportArray[7], 'MM/dd/yyyy');
$transaction['date'] = $transactionDate->toString("yyyy-MM-dd HH:mm:ss");
$transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
$transaction['amount'] = Oara_Utilities::parseDouble(preg_replace('/[^0-9\\.,]/', "", $transactionExportArray[2]));
$transaction['commission'] = Oara_Utilities::parseDouble(preg_replace('/[^0-9\\.,]/', "", $transactionExportArray[3]));
$totalTransactions[] = $transaction;
}
}
return $totalTransactions;
}
示例8: 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();
$stringToFind = $dStartDate->toString("MMMM yyyy");
$urls = array();
$urls[] = new Oara_Curl_Request('http://book.terravision.eu/partner/my/payments', array());
$exportReport = $this->_client->get($urls);
/*** load the html into the object ***/
$dom = new Zend_Dom_Query($exportReport[0]);
$results = $dom->query('#navigation > table');
$exportData = self::htmlToCsv(self::DOMinnerHTML($results->current()));
$num = count($exportData);
for ($i = 1; $i < $num - 1; $i++) {
$transactionArray = str_getcsv($exportData[$i], ";");
if ($transactionArray[0] == $stringToFind) {
$transaction = array();
$transaction['merchantId'] = 1;
$transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
$transaction['date'] = $dEndDate->toString("yyyy-MM-dd HH:mm:ss");
$transaction['amount'] = Oara_Utilities::parseDouble(preg_replace("/[^0-9\\.,]/", "", $transactionArray[2]));
$transaction['commission'] = Oara_Utilities::parseDouble(preg_replace("/[^0-9\\.,]/", "", $transactionArray[2]));
$totalTransactions[] = $transaction;
}
}
return $totalTransactions;
}
示例9: getPaymentHistory
/**
* (non-PHPdoc)
* @see Oara/Network/Oara_Network_Base#getPaymentHistory()
*/
public function getPaymentHistory()
{
$paymentHistory = array();
$urls = array();
$urls[] = new Oara_Curl_Request('https://www.webgains.com/affiliates/payment.html', array());
$exportReport = $this->_webClient->get($urls);
/*** load the html into the object ***/
$doc = new DOMDocument();
libxml_use_internal_errors(true);
$doc->validateOnParse = true;
$doc->loadHTML($exportReport[0]);
$tableList = $doc->getElementsByTagName('table');
$i = 0;
$enc = false;
while ($i < $tableList->length && !$enc) {
$registerTable = $tableList->item($i);
if ($registerTable->getAttribute('class') == 'withgrid') {
$enc = true;
}
$i++;
}
if (!$enc) {
throw new Exception('Fail getting the payment History');
}
$registerLines = $registerTable->childNodes;
for ($i = 2; $i < $registerLines->length; $i++) {
$obj = array();
$linkList = $registerLines->item($i)->getElementsByTagName('a');
$url = $linkList->item(1)->attributes->getNamedItem("href")->nodeValue;
$parseUrl = parse_url(trim($url));
$parameters = explode('&', $parseUrl['query']);
foreach ($parameters as $parameter) {
$parameterValue = explode('=', $parameter);
if ($parameterValue[0] == 'payment') {
$obj['pid'] = $parameterValue[1];
}
}
$registerLine = $registerLines->item($i)->childNodes;
$date = new Zend_Date($registerLine->item(0)->nodeValue, "dd/MM/yy");
$obj['date'] = $date->toString("yyyy-MM-dd HH:mm:ss");
$value = $registerLine->item(2)->nodeValue;
preg_match('/[0-9]+(,[0-9]{3})*(\\.[0-9]{2})?$/', $value, $matches);
$obj['value'] = Oara_Utilities::parseDouble($matches[0]);
$obj['method'] = $registerLine->item(6)->nodeValue;
$paymentHistory[] = $obj;
}
return $paymentHistory;
}
示例10: 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();
$startDate = $dStartDate->toString('dd/MM/yyyy');
$endDate = $dEndDate->toString('dd/MM/yyyy');
$valueIndex = 9;
$commissionIndex = 16;
$statusIndex = 17;
if ($this->_serverUrl == "https://mats.brandconversions.com/") {
$valueIndex = 11;
$commissionIndex = 17;
$statusIndex = 18;
}
$valuesFormExport = Oara_Utilities::cloneArray($this->_exportTransactionParameters);
//$valuesFormExport[] = new Oara_Curl_Parameter('merchant', '0');
$valuesFormExport[] = new Oara_Curl_Parameter('datefrom', $startDate);
$valuesFormExport[] = new Oara_Curl_Parameter('dateto', $endDate);
$urls = array();
$urls[] = new Oara_Curl_Request($this->_serverUrl . 'reports/remote.aspx?', $valuesFormExport);
$exportReport = $this->_client->get($urls);
$exportData = str_getcsv($exportReport[0], "\r\n");
$num = count($exportData);
for ($i = 1; $i < $num; $i++) {
$transactionExportArray = str_getcsv($exportData[$i], ",");
if (in_array((int) $transactionExportArray[4], $merchantList)) {
$transaction = array();
$transaction['unique_id'] = $transactionExportArray[0];
$transaction['merchantId'] = $transactionExportArray[4];
$transactionDate = new Zend_Date($transactionExportArray[2], "dd/MM/YY HH:mm:ss");
$transaction['date'] = $transactionDate->toString("yyyy-MM-dd HH:mm:ss");
if ($transactionExportArray[7] != null) {
$transaction['custom_id'] = $transactionExportArray[7];
}
if (preg_match('/Unpaid Confirmed/', $transactionExportArray[$statusIndex]) || preg_match('/Paid Confirmed/', $transactionExportArray[$statusIndex])) {
$transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
} else {
if (preg_match('/Unpaid Unconfirmed/', $transactionExportArray[$statusIndex])) {
$transaction['status'] = Oara_Utilities::STATUS_PENDING;
} else {
if (preg_match('/Unpaid Rejected/', $transactionExportArray[$statusIndex])) {
$transaction['status'] = Oara_Utilities::STATUS_DECLINED;
} else {
throw new Exception("No Status supported " . $transactionExportArray[$statusIndex]);
}
}
}
$transaction['amount'] = Oara_Utilities::parseDouble($transactionExportArray[$valueIndex]);
$transaction['commission'] = Oara_Utilities::parseDouble($transactionExportArray[$commissionIndex]);
$totalTransactions[] = $transaction;
}
}
return $totalTransactions;
}
示例11: 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();
$today = new Zend_Date();
$today->setHour(0);
$today->setMinute(0);
$urls = array();
$exportParams = array(new Oara_Curl_Parameter('data[query][agent]', $this->_agent), new Oara_Curl_Parameter('data[query][date1]', $dStartDate->toString("yyyy-MM-dd")), new Oara_Curl_Parameter('data[query][date2]', $dEndDate->toString("yyyy-MM-dd")), new Oara_Curl_Parameter('data[query][api_key]', $this->_apiKey));
$urls[] = new Oara_Curl_Request('http://www.skyparksecure.com/api/v4/jsonp/getSales?', $exportParams);
$exportReport = $this->_client->get($urls);
$report = substr($exportReport[0], 1, strlen($exportReport[0]) - 3);
$exportData = json_decode($report);
foreach ($exportData->result as $booking) {
$transaction = array();
$transaction['merchantId'] = 1;
$transaction['unique_id'] = $booking->booking_ref;
$transaction['metadata'] = $booking->product_name;
$transaction['custom_id'] = $booking->custom_id;
$transactionDate = new Zend_Date($booking->booking_date, 'yyyy.MMM.dd HH:mm:00', 'en');
$pickupDate = new Zend_Date($booking->dateA, 'yyyy.MMM.dd HH:mm:00', 'en');
$transaction['date'] = $transactionDate->toString("yyyy-MM-dd HH:mm:ss");
$transaction['metadata'] = $booking->product_id;
if ($booking->booking_mode == "Booked" || $booking->booking_mode == "Amended") {
$transaction['status'] = Oara_Utilities::STATUS_PENDING;
if ($today > $pickupDate) {
$transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
}
} else {
if ($booking->booking_mode == "Cancelled") {
$transaction['status'] = Oara_Utilities::STATUS_DECLINED;
} else {
throw new Exception("New status found");
}
}
$transaction['amount'] = Oara_Utilities::parseDouble(preg_replace('/[^0-9\\.,]/', "", $booking->sale_price)) / 1.2;
$transaction['commission'] = Oara_Utilities::parseDouble(preg_replace('/[^0-9\\.,]/', "", $booking->commission_affiliate)) / 1.2;
$totalTransactions[] = $transaction;
}
return $totalTransactions;
}
示例12: getTransactionList
/**
* (non-PHPdoc)
* @see library/Oara/Network/Oara_Network_Publisher_Interface#getTransactionList($aMerchantIds, $dStartDate, $dEndDate)
*/
public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
{
$totalTransactions = array();
$url = 'http://api.effiliation.com/apiv2/transaction.csv?key=' . $this->_credentials["apiPassword"] . '&start=' . $dStartDate->toString("dd/MM/yyyy") . '&end=' . $dEndDate->toString("dd/MM/yyyy") . '&type=date';
$content = utf8_encode(file_get_contents($url));
$exportData = str_getcsv($content, "\n");
$num = count($exportData);
for ($i = 1; $i < $num; $i++) {
$transactionExportArray = str_getcsv($exportData[$i], "|");
if (in_array((int) $transactionExportArray[2], $merchantList)) {
/*
$numFields = 0;
foreach ($transactionExportArray as $fieldValue){
if ($fieldValue == "Valide" || $fieldValue == "Attente" || $fieldValue == "Refusé"){
break;
}
$numFields ++;
}
*/
$transaction = array();
$merchantId = (int) $transactionExportArray[2];
$transaction['merchantId'] = $merchantId;
$transaction['date'] = $transactionExportArray[10];
$transaction['unique_id'] = $transactionExportArray[0];
if ($transactionExportArray[15] != null) {
$transaction['custom_id'] = $transactionExportArray[15];
}
if ($transactionExportArray[9] == 'Valide') {
$transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
} else {
if ($transactionExportArray[9] == 'Attente') {
$transaction['status'] = Oara_Utilities::STATUS_PENDING;
} else {
if ($transactionExportArray[9] == 'Refusé') {
$transaction['status'] = Oara_Utilities::STATUS_DECLINED;
}
}
}
$transaction['amount'] = Oara_Utilities::parseDouble($transactionExportArray[7]);
$transaction['commission'] = Oara_Utilities::parseDouble($transactionExportArray[8]);
$totalTransactions[] = $transaction;
}
}
return $totalTransactions;
}
示例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)
{
$overviewArray = array();
$transactionArray = Oara_Utilities::transactionMapPerDay($transactionList);
$mothOverviewUrls = array();
$dateArray = Oara_Utilities::daysOfDifference($dStartDate, $dEndDate);
$dateArraySize = sizeof($dateArray);
for ($i = 0; $i < $dateArraySize; $i++) {
$valuesFormExport = Oara_Utilities::cloneArray($this->_exportTransactionParameters);
$valuesFormExport[] = new Oara_Curl_Parameter('datefrom', $dateArray[$i]->toString("yyyy-MM-dd"));
$valuesFormExport[] = new Oara_Curl_Parameter('dateto', $dateArray[$i]->toString("yyyy-MM-dd"));
$mothUrls[] = new Oara_Curl_Request('https://accounts.skimlinks.com/reports_export.php?', $valuesFormExport);
}
$exportReport = $this->_client->get($mothUrls);
$exportReportNumber = count($exportReport);
for ($i = 0; $i < $exportReportNumber; $i++) {
$exportData = str_getcsv($exportReport[$i], "\n");
$num = count($exportData);
for ($j = 1; $j < $num - 5; $j++) {
$overviewExportArray = str_getcsv($exportData[$j], ",");
if (Oara_Utilities::parseDouble($overviewExportArray[2]) != 0 && isset($this->_merchantMap[$overviewExportArray[0]]) && in_array($this->_merchantMap[$overviewExportArray[0]], $merchantList)) {
$overview = array();
$overview['merchantId'] = $this->_merchantMap[$overviewExportArray[0]];
$overviewDate = new Zend_Date($mothUrls[$i]->getParameter(5)->getValue(), 'yyyy-MM-dd', 'en');
$overview['date'] = $overviewDate->toString("yyyy-MM-dd HH:mm:ss");
$overview['click_number'] = (int) $overviewExportArray[1];
$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;
}
示例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();
$urls = array();
$urls[] = new Oara_Curl_Request("https://publisher.ebaypartnernetwork.com/PublisherReportsTx?pt=2&start_date={$dStartDate->toSTring("M/d/yyyy")}&end_date={$dEndDate->toSTring("M/d/yyyy")}&user_name={$this->_credentials['user']}&user_password={$this->_credentials['password']}&advIdProgIdCombo=&tx_fmt=3&submit_tx=Download", 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)" && (empty($this->_sitesAllowed) || in_array($transactionExportArray[5], $this->_sitesAllowed))) {
$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[12] != null) {
$transaction['custom_id'] = $transactionExportArray[12];
}
$transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
$transaction['amount'] = Oara_Utilities::parseDouble($transactionExportArray[3]);
$transaction['commission'] = Oara_Utilities::parseDouble($transactionExportArray[20]);
$totalTransactions[] = $transaction;
}
}
return $totalTransactions;
}
示例15: 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();
$rch = curl_init();
$options = $this->_options;
curl_setopt($rch, CURLOPT_URL, 'https://www.sportscoverdirect.com/promoters/earn');
curl_setopt_array($rch, $options);
$html = curl_exec($rch);
curl_close($rch);
$dom = new Zend_Dom_Query($html);
$results = $dom->query('.performance');
if (count($results) > 0) {
$exportData = self::htmlToCsv(self::DOMinnerHTML($results->current()));
$num = count($exportData) - 1;
//the last row is show-more show-less
for ($i = 1; $i < $num; $i++) {
$overviewExportArray = str_getcsv($exportData[$i], ";");
$transaction = array();
$transaction['merchantId'] = 1;
$date = new Zend_Date($overviewExportArray[0], "dd/MM/yyyy");
$transaction['date'] = $date->toString("yyyy-MM-dd HH:mm:ss");
$transaction['amount'] = Oara_Utilities::parseDouble(preg_replace('/[^0-9\\.,]/', "", $overviewExportArray[1]));
$transaction['commission'] = Oara_Utilities::parseDouble(preg_replace('/[^0-9\\.,]/', "", $overviewExportArray[1]));
$transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
$totalTransactions[] = $transaction;
}
}
return $totalTransactions;
}