Oara\Network\Publisher\Dianomi::getTransactionList PHP Method

getTransactionList() public method

public getTransactionList ( null $merchantList = null, DateTime $dStartDate = null, DateTime $dEndDate = null ) : array
$merchantList null
$dStartDate DateTime
$dEndDate DateTime
return array
    public function getTransactionList($merchantList = null, \DateTime $dStartDate = null, \DateTime $dEndDate = null)
    {
        $totalTransactions = array();
        $valuesFormExport = array();
        $valuesFormExport[] = new \Oara\Curl\Parameter('periodtype', "fromtolong");
        $valuesFormExport[] = new \Oara\Curl\Parameter('fromday', $dStartDate->format("d"));
        $valuesFormExport[] = new \Oara\Curl\Parameter('frommonth', $dStartDate->format("m"));
        $valuesFormExport[] = new \Oara\Curl\Parameter('fromyear', $dStartDate->format("Y"));
        $valuesFormExport[] = new \Oara\Curl\Parameter('today', $dEndDate->format("d"));
        $valuesFormExport[] = new \Oara\Curl\Parameter('tomonth', $dEndDate->format("m"));
        $valuesFormExport[] = new \Oara\Curl\Parameter('toyear', $dEndDate->format("Y"));
        $valuesFormExport[] = new \Oara\Curl\Parameter('Go', 'Go');
        $valuesFormExport[] = new \Oara\Curl\Parameter('partnerId', '326');
        $valuesFormExport[] = new \Oara\Curl\Parameter('action', 'partnerLeads');
        $valuesFormExport[] = new \Oara\Curl\Parameter('subaction', 'RevenueOverTime');
        $urls = array();
        $urls[] = new \Oara\Curl\Request('https://my.dianomi.com/Campaign-Analysis-378_1.html?', $valuesFormExport);
        $exportReport = $this->_client->get($urls);
        $doc = new \DOMDocument();
        @$doc->loadHTML($exportReport[0]);
        $xpath = new \DOMXPath($doc);
        $results = $xpath->query('//*[contains(concat(" ", normalize-space(@class), " "), " tabular ")]');
        if ($results->length > 0) {
            $exportData = \Oara\Utilities::htmlToCsv(\Oara\Utilities::DOMinnerHTML($results->item(0)));
            $num = count($exportData);
            for ($i = 1; $i < $num; $i++) {
                $overviewExportArray = \str_getcsv($exportData[$i], ";");
                $transaction = array();
                $transaction['merchantId'] = 1;
                $date = \DateTime::createFromFormat("Y-m-d 00:00:00", $overviewExportArray[0]);
                $transaction['date'] = $date->format("Y-m-d H:i:s");
                $transaction['amount'] = $overviewExportArray[1];
                $transaction['commission'] = $overviewExportArray[1];
                $transaction['status'] = \Oara\Utilities::STATUS_CONFIRMED;
                $totalTransactions[] = $transaction;
            }
        }
        return $totalTransactions;
    }