$item_name = $_POST['item_name']; $item_number = $_POST['item_number']; $payment_status = $_POST['payment_status']; $payment_amount = $_POST['mc_gross']; $payment_currency = $_POST['mc_currency']; $txn_id = $_POST['txn_id']; $receiver_email = $_POST['receiver_email']; $payer_email = $_POST['payer_email']; try { if ($payment_status != 'Completed') { throw new Exception('Payment not completed'); } if ($receiver_email != erConfigClassLhConfig::getInstance()->getSetting('site', 'seller_paypal_mail')) { throw new Exception('Incorrect seller email'); } if (erLhcoreClassModelInstanceInvoice::getCount(array('filter' => array('txn_id' => $txn_id))) == 0) { $db = ezcDbInstance::get(); try { $db->beginTransaction(); $invoice = new erLhcoreClassModelInstanceInvoice(); $invoice->order_item = $_POST['option_selection1']; $invoice->txn_id = $txn_id; $invoice->instance_id = (int) $_POST['custom']; $invoice->amount = round($payment_amount * 100); $invoice->currency = $payment_currency; $dataLog = $_POST; $dataLog['raw_response'] = $res; $invoice->log = json_encode($dataLog, JSON_PRETTY_PRINT); $invoice->saveThis(); $optionPurchased = $_POST['option_selection1']; $paypalSellerOptions = erConfigClassLhConfig::getInstance()->getSetting('site', 'seller_paypal_options');
<?php try { $tpl = erLhcoreClassTemplate::getInstance('lhinstance/invoices.tpl.php'); $pages = new lhPaginator(); $pages->items_total = erLhcoreClassModelInstanceInvoice::getCount(); $pages->translationContext = 'abstract/list'; $pages->serverURL = erLhcoreClassDesign::baseurl('instance/invoices'); $pages->setItemsPerPage(20); $pages->paginate(); $tpl->set('pages', $pages); $items = array(); if ($pages->items_total > 0) { $items = erLhcoreClassModelInstanceInvoice::getList(array('offset' => $pages->low, 'limit' => $pages->items_per_page)); } $tpl->set('items', $items); $tpl->set('pages', $pages); $Result['content'] = $tpl->fetch(); $Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode', 'System configuration')), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Invoices'))); } catch (Exception $e) { print_r($e); }
$mail->AddReplyTo($instance->email, (string) $instance->address); $mail->Body = erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'User requested more feature') . "\n" . implode("\n", $requestedModules); $mail->AddAddress(erConfigClassLhConfig::getInstance()->getSetting('site', 'support_mail')); erLhcoreClassChatMail::setupSMTP($mail); try { $mail->Send(); } catch (Exception $e) { } $mail->ClearAddresses(); $tpl->set('request_send', true); } else { $tpl->set('errors', array(erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Please choose at least one valid module!'))); } } $pages = new lhPaginator(); $pages->items_total = erLhcoreClassModelInstanceInvoice::getCount(array('filter' => array('instance_id' => $instance->id))); $pages->translationContext = 'instance/billing'; $pages->serverURL = erLhcoreClassDesign::baseurl('instance/billing'); $pages->setItemsPerPage(20); $pages->paginate(); $tpl->set('pages', $pages); $items = array(); if ($pages->items_total > 0) { $items = erLhcoreClassModelInstanceInvoice::getList(array('filter' => array('instance_id' => $instance->id), 'offset' => $pages->low, 'limit' => $pages->items_per_page)); } $tpl->set('items', $items); if ($instance->is_reseller) { $pagesInstances = new lhPaginator(); $pagesInstances->items_total = erLhcoreClassModelInstance::getCount(array('switch_db' => true, 'filter' => array('reseller_id' => $instance->id))); $pagesInstances->translationContext = 'instance/billing'; $pagesInstances->serverURL = erLhcoreClassDesign::baseurl('instance/billinginstance');