コード例 #1
0
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @package pi_ratepay_rate_calculator
 * Code by PayIntelligent GmbH  <http://www.payintelligent.de/>
 */
include_once 'includes/application_top.php';
require_once 'ext/modules/payment/ratepay/ratepay_rate/ratenrechner/php/path.php';
require_once $pi_ratepay_rate_calc_path . 'php/PiRatepayRateCalc.php';
$pi_calculator = new PiRatepayRateCalc();
if (isset($_POST['calcValue']) && isset($_POST['calcMethod'])) {
    if ($_POST['calcMethod'] == "calculation-by-time" || $_POST['calcMethod'] == "calculation-by-rate") {
        if ($_POST['calcMethod'] == "calculation-by-time" && is_numeric($_POST['calcValue'])) {
            if (preg_match('/^[0-9]{1,3}$/', $_POST['calcValue'])) {
                $pi_calculator->setRequestCalculationValue($_POST['calcValue']);
                $pi_calculator->setRequestDueDay($_POST['dueDate']);
                $pi_resultArray = $pi_calculator->getRatepayRateDetails($_POST['calcMethod']);
            } else {
                $pi_calculator->setErrorMsg('wrongvalue');
            }
        } else {
            if ($_POST['calcMethod'] == "calculation-by-rate") {
                if (preg_match('/^[0-9]+(\\.[0-9][0-9][0-9])?(,[0-9]{1,2})?$/', $_POST['calcValue'])) {
                    $pi_value = $_POST['calcValue'];
                    $pi_value = str_replace(".", "", $pi_value);
                    $pi_value = str_replace(",", ".", $pi_value);
                    $pi_calculator->setRequestCalculationValue($pi_value);
                    $pi_calculator->setRequestDueDay($_POST['dueDate']);
                    $pi_resultArray = $pi_calculator->getRatepayRateDetails($_POST['calcMethod']);
                } else {
                    if (preg_match('/^[0-9]+(\\,[0-9][0-9][0-9])?(.[0-9]{1,2})?$/', $_POST['calcValue'])) {
                        $pi_value = $_POST['calcValue'];
コード例 #2
0
/**
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @package pi_ratepay_rate_calculator
 * Code by Ratepay GmbH  <http://www.ratepay.com/>
 */
$pi_calculator = new PiRatepayRateCalc();
if ($pi_calculator->getGetParameter('calcValue') != '' && $pi_calculator->getGetParameter('calcMethod') != '') {
    if ($pi_calculator->getGetParameter('calcMethod') == "calculation-by-time" || $pi_calculator->getGetParameter('calcMethod') == "calculation-by-rate") {
        if ($pi_calculator->getGetParameter('calcMethod') == "calculation-by-time" && is_numeric($pi_calculator->getGetParameter('calcValue'))) {
            if (preg_match('/^[0-9]{1,3}$/', $pi_calculator->getGetParameter('calcValue'))) {
                $pi_calculator->setRequestCalculationValue($pi_calculator->getGetParameter('calcValue'));
                $pi_calculator->setRequestDueDay($pi_calculator->getGetParameter('dueDate'));
                $pi_resultArray = $pi_calculator->getRatepayRateDetails($pi_calculator->getGetParameter('calcMethod'));
            } else {
                $pi_calculator->setErrorMsg('wrongvalue');
            }
        } else {
            if ($pi_calculator->getGetParameter('calcMethod') == "calculation-by-rate") {
                if (preg_match('/^[0-9]+(\\.[0-9][0-9][0-9])?(,[0-9]{1,2})?$/', $pi_calculator->getGetParameter('calcValue'))) {
                    $pi_value = $pi_calculator->getGetParameter('calcValue');
                    $pi_value = str_replace(".", "", $pi_value);
                    $pi_value = str_replace(",", ".", $pi_value);
                    $pi_calculator->setRequestCalculationValue($pi_value);
                    $pi_calculator->setRequestDueDay($pi_calculator->getGetParameter('dueDate'));
                    $pi_resultArray = $pi_calculator->getRatepayRateDetails($pi_calculator->getGetParameter('calcMethod'));
                } else {
                    if (preg_match('/^[0-9]+(\\,[0-9][0-9][0-9])?(.[0-9]{1,2})?$/', $pi_calculator->getGetParameter('calcValue'))) {
                        $pi_value = $pi_calculator->getGetParameter('calcValue');