Esempio n. 1
0
 public function validatePayment($gatewayID)
 {
     // Verify payment status
     if (strtolower(input::post('payment_status')) != 'completed' || strtolower(input::post('txn_type')) != 'web_accept') {
         $this->setError('Invalid payment status.');
         return false;
     }
     // Verify receiver's email
     if (strcasecmp($this->config['email'], input::post('business')) || strcasecmp($this->config['email'], input::post('receiver_email'))) {
         $this->setError('Invalid receiver email.');
         return false;
     }
     // Load http library
     loader::library('http');
     // Set parameters
     $params = $_POST;
     $params['cmd'] = '_notify-validate';
     // Run paypal request
     $response = $this->http->run($this->config['test'] ? 'https://www.sandbox.paypal.com/cgi-bin/webscr' : 'https://www.paypal.com/cgi-bin/webscr', 'POST', $params);
     // Verify reponse
     if (strcasecmp(trim($response), 'verified')) {
         $this->setError('Invalid response: ' . $response);
         return false;
     }
     // Get parameters
     $receiptID = input::post('txn_id');
     $invoiceID = input::post('item_number');
     $amount = input::post('mc_gross');
     $currency = input::post('mc_currency');
     // Verify duplicates
     if (!$this->transactions_model->isUniqueTransaction($gatewayID, $receiptID)) {
         $this->setError('Duplicate transaction: ' . $receiptID);
         return false;
     }
     // Get invoice
     if (!($invoice = $this->transactions_model->getInvoice($invoiceID))) {
         $this->setError('Invalid invoice ID: ' . $invoiceID);
         return false;
     }
     // Verify amount
     if (strcmp($invoice['amount'], $amount)) {
         $this->setError('Invalid payment amount: ' . money_helper::symbol(config::item('currency', 'billing')) . $amount);
         return false;
     }
     $invoice['receipt_id'] = $receiptID;
     return $invoice;
 }
Esempio n. 2
0
 public function browse()
 {
     // Did we submit the form?
     if (input::post('action') == 'reorder' && input::post('ids')) {
         $this->_reorderPlans();
     }
     // Get plans
     if (!($plans = $this->plans_model->getPlans(false))) {
         view::setInfo(__('no_plans', 'billing_plans'));
     }
     // Set cycles
     $cycles = array_map('strtolower', array(1 => __('day', 'date'), 2 => __('week', 'date'), 3 => __('month', 'date'), 4 => __('year', 'date')));
     $cyclesMulti = array_map('strtolower', array(1 => __('days', 'date'), 2 => __('weeks', 'date'), 3 => __('months', 'date'), 4 => __('years', 'date')));
     // Create table grid
     $grid = array('uri' => 'cp/billing/plans/browse', 'keyword' => 'billing_plans', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'group' => array('html' => __('plan_group', 'billing_plans'), 'class' => 'group'), 'cycle' => array('html' => __('plan_cycle', 'billing_plans'), 'class' => 'cycle'), 'price' => array('html' => __('price', 'billing'), 'class' => 'price'), 'signup' => array('html' => __('plan_signup', 'billing_plans'), 'class' => 'signup'), 'status' => array('html' => __('active', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
     // Create grid content
     foreach ($plans as $plan) {
         $grid['content'][] = array('name' => array('html' => html_helper::anchor('cp/billing/plans/edit/' . $plan['plan_id'], $plan['name'])), 'group' => array('html' => config::item('usergroups', 'core', $plan['group_id'])), 'cycle' => array('html' => $plan['duration'] . ' ' . ($plan['duration'] == 1 ? $cycles[$plan['cycle']] : $cyclesMulti[$plan['cycle']])), 'price' => array('html' => money_helper::symbol(config::item('currency', 'billing')) . $plan['price']), 'signup' => array('html' => $plan['signup'] ? '<span class="label success small">' . __('yes', 'system') . '</span>' : '<span class="label important small">' . __('no', 'system') . '</span>'), 'status' => array('html' => $plan['active'] ? '<span class="label success small">' . __('yes', 'system') . '</span>' : '<span class="label important small">' . __('no', 'system') . '</span>'), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/billing/plans/edit/' . $plan['plan_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/billing/plans/delete/' . $plan['plan_id'], __('delete', 'system'), array('data-html' => __('plan_delete?', 'billing_plans'), 'data-role' => 'confirm', 'class' => 'delete')))));
     }
     // Filter hooks
     hook::filter('cp/billing/plans/browse/grid', $grid);
     // Assign vars
     view::assign(array('grid' => $grid, 'plans' => $plans));
     // Set title
     view::setTitle(__('billing_plans_manage', 'system_navigation'));
     // Assign actions
     view::setAction('cp/billing/plans/edit', __('plan_new', 'billing_plans'), array('class' => 'icon-text icon-billing-plans-new'));
     view::setAction('#', __('done', 'system'), array('class' => 'icon-text icon-system-done', 'onclick' => 'saveSortable();return false;', 'id' => 'actions_link_save'));
     view::setAction('#', __('cancel', 'system'), array('class' => 'icon-text icon-system-cancel', 'onclick' => 'cancelSortable();return false;', 'id' => 'actions_link_cancel'));
     view::setAction('#', __('reorder', 'system'), array('class' => 'icon-text icon-system-sort', 'onclick' => 'switchSortable();return false;', 'id' => 'actions_link_reorder'));
     // Include sortable vendor files
     view::includeJavascript('externals/html5sortable/html5sortable.js');
     view::includeStylesheet('externals/html5sortable/style.css');
     // Load view
     if (input::isAjaxRequest()) {
         view::load('cp/billing/plans/browse_' . (input::post('view') == 'list' ? 'list' : 'grid'));
     } else {
         view::load('cp/billing/plans/browse');
     }
 }
Esempio n. 3
0
 public function browse()
 {
     // Get packages
     if (!($packages = $this->credits_model->getPackages(false))) {
         view::setInfo(__('no_packages', 'billing_credits'));
     }
     // Create table grid
     $grid = array('uri' => 'cp/billing/credits/browse', 'keyword' => 'billing_credits', 'header' => array('credits' => array('html' => __('credits', 'billing_credits'), 'class' => 'credits'), 'price' => array('html' => __('price', 'billing'), 'class' => 'price'), 'active' => array('html' => __('active', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
     // Create grid content
     foreach ($packages as $package) {
         $grid['content'][] = array('credits' => array('html' => html_helper::anchor('cp/billing/credits/edit/' . $package['package_id'], $package['credits'])), 'price' => array('html' => money_helper::symbol(config::item('currency', 'billing')) . $package['price']), 'active' => array('html' => $package['active'] ? '<span class="label success small">' . __('yes', 'system') . '</span>' : '<span class="label important small">' . __('no', 'system') . '</span>'), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/billing/credits/edit/' . $package['package_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/billing/credits/delete/' . $package['package_id'], __('delete', 'system'), array('data-html' => __('package_delete?', 'billing_credits'), 'data-role' => 'confirm', 'class' => 'delete')))));
     }
     // Filter hooks
     hook::filter('cp/billing/credits/browse/grid', $grid);
     // Assign vars
     view::assign(array('grid' => $grid));
     // Set title
     view::setTitle(__('billing_credits_manage', 'system_navigation'));
     // Assign actions
     view::setAction('cp/billing/credits/edit', __('package_new', 'billing_credits'), array('class' => 'icon-text icon-billing-packages-new'));
     // Load view
     view::load('cp/billing/credits/browse');
 }
Esempio n. 4
0
<?php

view::load('header');
?>

<section class="plugin-billing billing-payment">

	<div class="content-view">

		<article class="item">

			<header class="item-header">
				<h2>
					<?php 
echo html_helper::anchor($location, $product['name'] . ' - ' . money_helper::symbol(config::item('currency', 'billing')) . $product['price']);
?>
				</h2>
			</header>

			<?php 
if (isset($product['description']) && $product['description']) {
    ?>
				<div class="item-article">
					<?php 
    echo $product['description'];
    ?>
				</div>
			<?php 
}
?>
Esempio n. 5
0
        echo $invoice['transaction_id'];
        ?>
">
					<span class="name">
						<?php 
        echo $invoice['name'];
        ?>
					</span>
					<span class="date">
						<?php 
        echo date_helper::formatDate($invoice['post_date']);
        ?>
					</span>
					<span class="amount">
						<?php 
        echo money_helper::symbol(config::item('currency', 'billing')) . $invoice['amount'];
        ?>
					</span>
				</li>

			<?php 
    }
    ?>

		</ul>

		<div class="content-footer">
			<?php 
    view::load('system/elements/pagination', array('pagination' => $pagination));
    ?>
		</div>
Esempio n. 6
0
        echo html_helper::anchor('classifieds/view/' . $ad['ad_id'] . '/' . text_helper::slug($ad['data_title'], 100), $ad['data_title']);
        ?>
							</h2>
						</header>

						<dl class="content-grid">
							<?php 
        if (isset($ad['data_price'])) {
            ?>
								<dt><?php 
            echo config::item('fields_classifieds', 'core', 'price');
            ?>
:</dt>
								<dd>
									<?php 
            echo money_helper::symbol(config::item('ad_currency', 'classifieds')) . $ad['data_price'];
            ?>
								</dd>
							<?php 
        }
        ?>
							<?php 
        if (isset($ad['data_location'])) {
            ?>
								<dt><?php 
            echo config::item('fields_classifieds', 'core', 'location');
            ?>
:</dt>
								<dd>
									<?php 
            if (!is_array($ad['data_location'])) {
Esempio n. 7
0
 public function browse()
 {
     // Get gateways
     $gateways = array();
     foreach ($this->gateways_model->getGateways(false, false) as $gateway) {
         $gateways[$gateway['gateway_id']] = $gateway['name'];
     }
     // Parameters
     $params = array('join_columns' => array());
     // Process filters
     $params = $this->parseCounters($params, $gateways);
     // Process query string
     $qstring = $this->parseQuerystring($params['total']);
     // Create actions
     $actions = array(0 => __('select', 'system'), 'delete' => __('delete', 'system'));
     // Check form action
     if (input::post('do_action')) {
         // Delete selected transactions
         if (input::post('action') == 'delete') {
             if (input::post('transaction_id') && is_array(input::post('transaction_id'))) {
                 foreach (input::post('transaction_id') as $transactionID) {
                     $transactionID = (int) $transactionID;
                     if ($transactionID && $transactionID > 0) {
                         $this->delete($transactionID);
                     }
                 }
             }
         }
         // Success
         view::setInfo(__('action_applied', 'system'));
         router::redirect('cp/billing/transactions?' . $qstring['url'] . 'page=' . $qstring['page']);
     }
     // Get transaction
     $transactions = array();
     if ($params['total']) {
         $transactions = $this->transactions_model->getTransactions($params['join_columns'], $qstring['order'], $qstring['limit']);
     }
     // Create table grid
     $grid = array('uri' => 'cp/billing/transactions', 'keyword' => 'billing_transactions', 'header' => array('check' => array('html' => 'transaction_id', 'class' => 'check'), 'product' => array('html' => __('product', 'billing'), 'class' => 'product'), 'user' => array('html' => __('user', 'system'), 'class' => 'user'), 'gateway' => array('html' => __('payment_gateway', 'billing'), 'class' => 'gateway'), 'amount' => array('html' => __('price', 'billing'), 'class' => 'price', 'sortable' => true), 'post_date' => array('html' => __('payment_date', 'billing'), 'class' => 'date', 'sortable' => true), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
     // Create grid content
     foreach ($transactions as $transaction) {
         $grid['content'][] = array('check' => array('html' => $transaction['transaction_id']), 'product' => array('html' => html_helper::anchor('cp/billing/transactions/view/' . $transaction['transaction_id'], $transaction['name'])), 'user' => array('html' => users_helper::anchor($transaction['user'])), 'gateway' => array('html' => $gateways[$transaction['gateway_id']]), 'amount' => array('html' => money_helper::symbol(config::item('currency', 'billing')) . $transaction['amount']), 'post_date' => array('html' => date_helper::formatDate($transaction['post_date'])), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/billing/transactions/view/' . $transaction['transaction_id'], __('details', 'system'), array('class' => 'details')), 'delete' => html_helper::anchor('cp/billing/transactions/delete/' . $transaction['transaction_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('delete', 'system'), array('data-html' => __('transaction_delete?', 'billing_transactions'), 'data-role' => 'confirm', 'class' => 'delete')))));
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('cp/billing/transactions?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->transactionPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Filter hooks
     hook::filter('cp/billing/transactions/browse/grid', $grid);
     hook::filter('cp/billing/transactions/browse/actions', $actions);
     // Assign vars
     view::assign(array('grid' => $grid, 'actions' => $actions, 'pagination' => $pagination));
     // Set title
     view::setTitle(__('billing_transactions_manage', 'system_navigation'));
     // Set trail
     if ($qstring['search_id']) {
         view::setTrail('cp/billing/transactions?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system'));
     }
     // Assign actions
     view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#transactions-search\').toggle();return false;'));
     // Load view
     view::load('cp/billing/transactions/browse');
 }
Esempio n. 8
0
						<li class="<?php 
        echo text_helper::alternate('odd', 'even');
        ?>
 clearfix" id="row-plan-<?php 
        echo $plan['plan_id'];
        ?>
">
							<span class="name">
								<?php 
        echo html_helper::anchor('billing/plans/payment/' . $plan['plan_id'], $plan['name']);
        ?>
							</span>
							<span class="amount">
								<?php 
        echo money_helper::symbol(config::item('currency', 'billing')) . $plan['price'];
        ?>
							</span>
						</li>

					<?php 
    }
    ?>

				</ul>

			</article>

		</div>

	<?php 
Esempio n. 9
0
 protected function _get_currencies($setting)
 {
     loader::helper('money');
     $setting['items'] = money_helper::currencies();
     return $setting;
 }
Esempio n. 10
0
?>
			</td>
		</tr>

		<tr class="<?php 
echo text_helper::alternate('odd', 'even');
?>
" id="input_row_transaction_amount">
			<td class="name">
				<?php 
echo __('amount', 'billing');
?>
			</td>
			<td class="value">
				<?php 
echo money_helper::symbol(config::item('currency', 'billing')) . $transaction['amount'];
?>
			</td>
		</tr>

		<tr class="<?php 
echo text_helper::alternate('odd', 'even');
?>
" id="input_row_transaction_user">
			<td class="name">
				<?php 
echo __('user', 'system');
?>
			</td>
			<td class="value">
				<?php