} $taxSum = 0; foreach ($invoice->getItems() as $item) { if ($item->getTax()) { $taxSum += $item->getTax()->getAmount()->getValue(); } } $tID = 0; //This is the key value to hook up with the classis paypal API $tID = $paypal->request($invoice->getPayments()['0']->getTransactionId())['L_TRANSACTIONID0']; return array('date' => $invoice->getPayments()['0']->getDate(), 'memo' => $invoice->getMerchantMemo(), 'number' => $invoice->getNumber(), 'tax' => $taxSum, 'tID' => $tID); } $invoiceArray = array(); //Based on the classis API this calls the REST api to get the details (or the other way around?) foreach ($invoiceIDs as $id) { $invoiceArray[] = getInvoiceDetails($id, $apiContext, $paypal); } //This is a list of all the transactions including fee, but without taxes $transactionArray = $paypal->request(); foreach ($transactionArray as $id => $transaction) { foreach ($invoiceArray as $invoice) { //print "<br> invoice TID: " . $invoice['tID'] . " Transaction tID : " . $transaction['tID']; //print_r( array_values(array_keys($transaction))); if ($invoice['tID'] == $transaction['tID']) { $transactionArray[$id]['memo'] = $invoice['memo']; $transactionArray[$id]['tax'] = $invoice['tax']; $transactionArray[$id]['number'] = $invoice['number']; } } } //this is now the list of all transactions, but without fee and missing the direct payments
* Authors: Liran Tal <*****@*****.**> * ********************************************************************************************************* */ require_once dirname(__FILE__) . "/../../library/checklogin.php"; require_once dirname(__FILE__) . "/../../notifications/processNotificationUserInvoice.php"; require_once dirname(__FILE__) . "/../../library/config_read.php"; isset($_GET['invoice_id']) ? $invoice_id = $_GET['invoice_id'] : ($invoice_id = ""); isset($_GET['destination']) ? $destination = $_GET['destination'] : ($destination = "download"); $login = $_SESSION['login_user']; $username = $login; if (!$username) { return false; } if ($invoice_id != "") { $customerInfo = @getInvoiceDetails($invoice_id, $username); $pdfDocument = @createNotification($customerInfo); if ($destination == "download") { header("Content-type: application/pdf"); header("Content-Disposition: attachment; filename=notification_user_invoice_" . date("Ymd") . ".pdf; size=" . strlen($pdfDocument)); print $pdfDocument; } } function getInvoiceDetails($invoice_id = NULL, $username) { require dirname(__FILE__) . "/../../library/opendb.php"; require_once dirname(__FILE__) . "/../../lang/main.php"; global $configValues; $sql = "SELECT id, contactperson, city, state, username FROM " . $configValues['CONFIG_DB_TBL_DALOUSERBILLINFO'] . " WHERE username = '******'"; $res = $dbSocket->query($sql); $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
* You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ********************************************************************************************************* * * Authors: Liran Tal <*****@*****.**> * ********************************************************************************************************* */ require_once dirname(__FILE__) . "/../../notifications/processNotificationUserInvoice.php"; require_once dirname(__FILE__) . "/../../library/config_read.php"; isset($_GET['invoice_id']) ? $invoice_id = $_GET['invoice_id'] : ($invoice_id = ""); isset($_GET['destination']) ? $destination = $_GET['destination'] : ($destination = "download"); if ($invoice_id != "") { $customerInfo = @getInvoiceDetails($invoice_id); $smtpInfo['host'] = $configValues['CONFIG_MAIL_SMTPADDR']; $smtpInfo['port'] = $configValues['CONFIG_MAIL_SMTPPORT']; $smtpInfo['auth'] = $configValues['CONFIG_MAIL_SMTPAUTH']; $from = $configValues['CONFIG_MAIL_SMTPFROM']; $pdfDocument = @createNotification($customerInfo); if ($destination == "download") { header("Content-type: application/pdf"); header("Content-Disposition: attachment; filename=notification_user_invoice_" . date("Ymd") . ".pdf; size=" . strlen($pdfDocument)); print $pdfDocument; } else { if ($destination == "email") { @emailNotification($pdfDocument, $customerInfo, $smtpInfo, $from); header("Location: " . $_SERVER['HTTP_REFERER']); } }