Oara\Network\Publisher\TradeDoubler::paymentTransactions PHP 메소드

paymentTransactions() 공개 메소드

public paymentTransactions ( $paymentId ) : array
$paymentId
리턴 array
    public function paymentTransactions($paymentId)
    {
        $transactionList = array();
        $urls = array();
        $valuesFormExport = array();
        $valuesFormExport[] = new \Oara\Curl\Parameter('popup', 'true');
        $valuesFormExport[] = new \Oara\Curl\Parameter('payment_id', $paymentId);
        $urls[] = new \Oara\Curl\Request('http://publisher.tradedoubler.com/pan/reports/Payment.html?', $valuesFormExport);
        $exportReport = $this->_client->get($urls);
        $doc = new \DOMDocument();
        @$doc->loadHTML(\Oara\Utilities::DOMinnerHTML($exportReport[0]));
        $xpath = new \DOMXPath($doc);
        $results = $xpath->query('//a');
        $urls = array();
        foreach ($results as $result) {
            $url = $result->getAttribute('href');
            $urls[] = new \Oara\Curl\Request("http://publisher.tradedoubler.com" . $url . "&format=CSV", array());
        }
        $exportReportList = $this->_client->get($urls);
        foreach ($exportReportList as $exportReport) {
            $exportReportData = \str_getcsv($exportReport, "\r\n");
            $num = \count($exportReportData);
            for ($i = 2; $i < $num - 1; $i++) {
                $transactionArray = \str_getcsv($exportReportData[$i], ";");
                if ($transactionArray[8] != '') {
                    $transactionList[] = $transactionArray[8];
                } else {
                    if ($transactionArray[7] != '') {
                        $transactionList[] = $transactionArray[7];
                    } else {
                        throw new \Exception("No Identifier");
                    }
                }
            }
        }
        return $transactionList;
    }