<?php

/**
 * @package		UserPoints for Joomla 4.x
 * @copyright	Copyright (C) 2015-2016. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
 * Joomla! is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */
// no direct access
defined('_JEXEC') or die('Restricted access');

use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;
use Joomla\CMS\HTML\HTMLHelper;

$amount = (float) $params->get('amount', 0.0);
// $currency = (string)$params->get('currency','');
$action = Route::_("index.php?option=com_userpoints&view=Purchase&task=payment&Itemid=" . Factory::getApplication()->input->get('Itemid', ''), false);
$token = HTMLHelper::_('form.token');

if ($amount) {
    echo <<<BUY_POINTS
    
    <div class="buy_points$moduleclass_sfx">
	<div class="buy_points_module_text">
            {$params->get('info','')}
        </div>
            <div class="buy_points_submit">
            <form action="$action" method="post" name="purchaseForm" id="purchaseForm" class="form-validate form-horizontal">
                <input type="submit" value="{$params->get('click','')}" class="btn btn-success" />
                <input type="hidden" name="option" value="com_userpoints" />
                <input type="hidden" name="view" value="Purchase" />
                <input type="hidden" name="task" value="payment" />
                <input type="hidden" name="howmany" value="$amount" />
                <input type="hidden" name="itemname" value="{$params->get('itemname','')}" />
                $token</input>
            </form>
        </div>
    </div>
    
BUY_POINTS;
}
