Example #1
0
 public function __construct()
 {
     parent::__construct();
     $iaTransaction = $this->_iaCore->factory('transaction');
     $this->setHelper($iaTransaction);
     $this->setTable(iaTransaction::getTable());
 }
Example #2
0
     $plan['cost'] = $transaction['amount'];
 } else {
     $plan = $iaPlan->getById($transaction['plan_id']);
 }
 $plan['title'] = $transaction['item'] . ' - ' . $plan['title'];
 $iaView->assign('plan', $plan);
 $iaView->assign('address', $iaCore->factory('invoice')->getAddress($transaction['id']));
 foreach ($gateways as $key => $gateway) {
     $htmlFormTemplate = IA_PLUGINS . $key . IA_DS . 'templates' . IA_DS . 'front' . IA_DS . 'form.tpl';
     $gateways[$key] = file_exists($htmlFormTemplate) ? $htmlFormTemplate : false;
 }
 // process payment button click
 if (isset($_POST['payment_type'])) {
     $gate = iaSanitize::sql($_POST['payment_type']);
     if (isset($gateways[$gate])) {
         $affected = $iaDb->update(array('id' => $transaction['id'], 'gateway' => $gate), null, array('date' => iaDb::FUNCTION_NOW), iaTransaction::getTable());
         $iaCore->factory('invoice')->updateAddress($transaction['id'], $_POST['invaddr']);
         // include pre form send files
         $paymentGatewayHandler = IA_PLUGINS . $gate . IA_DS . 'includes' . IA_DS . 'pre-processing' . iaSystem::EXECUTABLE_FILE_EXT;
         if (file_exists($paymentGatewayHandler)) {
             include $paymentGatewayHandler;
         }
         if (!empty($gateways[$gate])) {
             $data = array('caption' => 'Redirect to ' . $gate . '', 'msg' => 'You will be redirected to ' . $gate . '', 'form' => $gateways[$gate]);
             $iaView->assign('redir', $data);
             $tplFile = 'redirect-gateway';
             $iaView->disableLayout();
         }
     }
 }
 iaBreadcrumb::add(iaLanguage::get('page_title_member_funds'), $iaCore->factory('page', iaCore::FRONT)->getUrlByName('member_funds'));
Example #3
0
            $output['error'] = iaLanguage::get('amount_less_min');
        }
    } else {
        $output['error'] = iaLanguage::get('amount_incorrect');
    }
    $iaView->assign($output);
}
if (iaView::REQUEST_HTML == $iaView->getRequestType()) {
    iaUsers::reloadIdentity();
    if (isset($_POST['amount'])) {
        $amount = (double) $_POST['amount'];
        if ($amount > 0) {
            if ($amount >= (double) $iaCore->get('funds_min_amount')) {
                $iaTransaction->createInvoice(iaLanguage::get('funds'), $amount, iaTransaction::TRANSACTION_MEMBER_BALANCE, iaUsers::getIdentity(true), $profilePageUrl);
            } else {
                $iaView->setMessages(iaLanguage::get('amount_less_min'));
            }
        } else {
            $iaView->setMessages(iaLanguage::get('amount_incorrect'));
        }
    }
    $pagination = array('page' => 1, 'limit' => 10, 'total' => 0, 'template' => $profilePageUrl . 'funds/?page={page}');
    $pagination['page'] = isset($_GET['page']) && 1 < $_GET['page'] ? (int) $_GET['page'] : $pagination['page'];
    $pagination['page'] = ($pagination['page'] - 1) * $pagination['limit'];
    $transactions = $iaDb->all('SQL_CALC_FOUND_ROWS *', '`member_id` = ' . iaUsers::getIdentity()->id . ' ORDER BY `status`', $pagination['page'], $pagination['limit'], iaTransaction::getTable());
    $pagination['total'] = $iaDb->foundRows();
    $iaView->caption($iaView->title() . ': ' . number_format(iaUsers::getIdentity()->funds, 2, '.', '') . ' ' . $iaCore->get('currency'));
    $iaView->assign('pagination', $pagination);
    $iaView->assign('transactions', $transactions);
    $iaView->display('transactions');
}