Пример #1
0
<?php
/**
 * 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 PayIntelligent GmbH  <http://www.payintelligent.de/>
 */
$pi_calculator = new PiRatepayRateCalc();

$pi_calculator->unsetData();
$pi_config = $pi_calculator->getRatepayRateConfig();
$pi_monthAllowed = $pi_config['month_allowed'];
$pi_monthAllowedArray = explode(',', $pi_monthAllowed);

$pi_amount = $pi_calculator->getRequestAmount();
$pi_language = $pi_calculator->getLanguage();
$pi_firstday = $pi_calculator->getRequestFirstday();

if ($pi_language == "DE") {
    require_once $calcPath.'/languages/german.php';
    $pi_currency = 'EUR';
    $pi_decimalSeperator = ',';
    $pi_thousandSeperator = '.';
} else {
    require_once $calcPath.'/languages/english.php';
    $pi_currency = 'EUR';
    $pi_decimalSeperator = '.';
    $pi_thousandSeperator = ',';
}
<?php

/**
 * 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 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);
<?php

/**
 * 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 {