/**
  * Call PAYMENT_CHANGE with the subtype credit
  * and add a credit item to the order
  */
 public static function creditAction()
 {
     $post = rpGlobals::getPost();
     $orderId = rpGlobals::getPostEntry('order_number');
     $creditAmount = floatval($post['voucherAmount'] . '.' . $post['voucherAmountKomma']);
     $deliveredBasketAmount = rpDb::getRpBasketAmount($orderId);
     if ($creditAmount <= $deliveredBasketAmount) {
         $order = new order($orderId);
         $rate = $order->info['payment_method'] == 'ratepay_rate' ? true : false;
         $payment = rpLoader::getRatepayPayment($order->info['payment_method']);
         $transactionId = rpDb::getRatepayOrderDataEntry($orderId, 'transaction_id');
         $transactionShortId = rpDb::getRatepayOrderDataEntry($orderId, 'transaction_short_id');
         if ($rate) {
             $subType = 'return';
             $postCredit = self::getRefundPostData($post);
         } else {
             $subType = 'credit';
         }
         $postCredit['order_number'] = $post['order_number'];
         $postCredit['voucherAmount'] = $post['voucherAmount'];
         $postCredit['voucherAmountKomma'] = $post['voucherAmountKomma'];
         $data = array('HeadInfo' => rpRequestMapper::getHeadInfoModel($order, $transactionId, $transactionShortId, $orderId, $subType), 'BasketInfo' => rpRequestMapper::getBasketInfoModel($order, $orderId, $postCredit, $subType), 'PaymentInfo' => rpRequestMapper::getPaymentInfoModel($order, $orderId, $postCredit, $subType));
         $requestService = new rpRequestService($payment->sandbox, $data);
         $result = $requestService->callPaymentChange();
         rpDb::xmlLog($order, $requestService->getRequest(), $orderId, $requestService->getResponse());
         if (!array_key_exists('error', $result)) {
             rpSession::setRpSessionEntry('message_css_class', 'messageStackSuccess');
             rpSession::setRpSessionEntry('message', RATEPAY_ORDER_MESSAGE_CREDIT_SUCCESS);
             rpDb::setRpCreditItem(rpGlobals::getPost(), $rate ? 1 : 0);
             rpDb::setRpHistoryEntry($orderId, rpData::getCreditItem($post), 'PAYMENT_CHANGE', $subType);
             rpDb::addCreditToShop($orderId, $post);
             rpDb::updateShopOrderTotals($orderId);
         } else {
             rpSession::setRpSessionEntry('message_css_class', 'messageStackError');
             rpSession::setRpSessionEntry('message', RATEPAY_ORDER_MESSAGE_CREDIT_ERROR);
         }
         if ($rate) {
             xtc_redirect(xtc_href_link("ratepay_order.php", 'oID=' . $orderId, 'SSL'));
         } else {
             self::deliverAction(self::getDeliverPostArray($orderId, $post['items']));
         }
     } else {
         rpSession::setRpSessionEntry('message_css_class', 'messageStackError');
         rpSession::setRpSessionEntry('message', RATEPAY_ORDER_MESSAGE_CREDIT_ERROR);
         xtc_redirect(xtc_href_link("ratepay_order.php", 'oID=' . $orderId, 'SSL'));
     }
 }
示例#2
0
 * GNU General Public License for more details.
 *
 * @category  PayIntelligent
 * @package   ratepay
 * @copyright (C) 2012 PayIntelligent GmbH  <http://www.payintelligent.de/>
 * @license   GPLv2
 */
/**
 * RatePAY logging template, displays the XML
 */
require_once 'includes/application_top.php';
require_once '../lang/' . $_SESSION['language'] . '/admin/modules/payment/ratepay.php';
require_once '../includes/classes/ratepay/helpers/Data.php';
require_once '../includes/classes/ratepay/helpers/Db.php';
require_once '../includes/classes/ratepay/helpers/Globals.php';
rpGlobals::hasParam('id') ? $log = rpDb::getLogEntry(rpGlobals::getParam('id')) : die('Page not allowed!');
?>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
<?php 
require DIR_WS_INCLUDES . 'header.php';
?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
    <tr>
        <td width="<?php 
echo BOX_WIDTH;
?>
" valign="top">
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * @category  PayIntelligent
 * @package   ratepay
 * @copyright (C) 2012 PayIntelligent GmbH  <http://www.payintelligent.de/>
 * @license   GPLv2
 */
/**
 * RatePAY order script calls the right controller action for RatePAY order operations
 */
require_once 'includes/application_top.php';
require_once '../includes/classes/ratepay/helpers/Data.php';
require_once '../includes/classes/ratepay/helpers/Globals.php';
require_once '../includes/classes/ratepay/controllers/OrderController.php';
if (rpGlobals::hasPostEntry('order_number')) {
    if (rpGlobals::hasPostEntry('ship')) {
        rpOrderController::deliverAction();
    } elseif (rpGlobals::hasPostEntry('cancel')) {
        rpOrderController::cancelAction();
    } elseif (rpGlobals::hasPostEntry('refund')) {
        rpOrderController::refundAction();
    } elseif (rpGlobals::hasPostEntry('credit')) {
        rpOrderController::creditAction();
    } else {
        die('Operation not found!');
    }
} else {
    die('Missing post param "order_number"!');
}
                    <td>
                        <table border="0" width="100%" cellspacing="0" cellpadding="2" height="40">
                            <tr>
                                <td class="pageHeading"><?php 
echo RATEPAY_ADMIN_LOGGING;
?>
</td>
                            </tr>
                            <tr>
                                <td><img width="100%" height="1" border="0" alt="" src="images/pixel_black.gif"></td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <?php 
if (rpGlobals::hasParam('success')) {
    ?>
                <tr>
                    <td class="messageStackSuccess">
                        <img border="0" title="" alt="" src="images/icons/success.gif">
                        <?php 
    echo RATEPAY_ADMIN_LOGGING_DELETE_SUCCESS;
    ?>
                    </td>
                </tr>
                <?php 
}
?>
                <tr>
                    <td> 
                        <form method="post" action="<?php 
 public function pre_confirmation_check()
 {
     if (!rpGlobals::hasPostEntry('rp-account-number') || rpData::betterEmpty(rpGlobals::getPostEntry('rp-account-number'))) {
         $this->error['ACCOUNT_NUMBER'] = 'MISSING';
     }
     if (strtoupper(substr(rpGlobals::getPostEntry('rp-account-number'), 0, 2)) !== 'DE') {
         if (!rpGlobals::hasPostEntry('rp-sort-code') || rpData::betterEmpty(rpGlobals::getPostEntry('rp-sort-code'))) {
             $this->error['SORT_CODE'] = 'MISSING';
         }
     }
     if (strtoupper(substr(rpGlobals::getPostEntry('rp-account-number'), 0, 2)) === 'DE') {
         if (strlen(rpGlobals::getPostEntry('rp-account-number')) !== 22) {
             $this->error['ACCOUNT_NUMBER'] = 'DE_WRONG_LENGTH';
         }
         if (!is_numeric(substr(rpGlobals::getPostEntry('rp-account-number'), 2))) {
             $this->error['ACCOUNT_NUMBER'] = 'IBAN_INVALID';
         }
     }
     if (strtoupper(substr(rpGlobals::getPostEntry('rp-account-number'), 0, 2)) === 'AT') {
         if (strlen(rpGlobals::getPostEntry('rp-account-number')) !== 20) {
             $this->error['ACCOUNT_NUMBER'] = 'AT_WRONG_LENGTH';
         }
         if (!is_numeric(substr(rpGlobals::getPostEntry('rp-account-number'), 2))) {
             $this->error['ACCOUNT_NUMBER'] = 'IBAN_INVALID';
         }
     }
     if (is_numeric(substr(rpGlobals::getPostEntry('rp-account-number'), 0, 2))) {
         if (!is_numeric(rpGlobals::getPostEntry('rp-sort-code'))) {
             $this->error['SORT_CODE'] = 'NOT_NUMERIC';
         }
         if (strlen(rpGlobals::getPostEntry('rp-sort-code')) !== 8) {
             $this->error['SORT_CODE'] = 'WRONG_LENGTH';
         }
         if (!is_numeric(rpGlobals::getPostEntry('rp-account-number'))) {
             $this->error['ACCOUNT_NUMBER'] = 'KONTO_NR_NOT_NUMERIC';
         }
     }
     if (!is_numeric(substr(rpGlobals::getPostEntry('rp-account-number'), 0, 2))) {
         if (is_numeric(rpGlobals::getPostEntry('rp-sort-code')) && !rpData::betterEmpty(rpGlobals::getPostEntry('rp-sort-code'))) {
             $this->error['SORT_CODE'] = 'IBAN_AND_BLZ_PROVIDED';
         }
     }
     if (!rpGlobals::hasPostEntry('rp-account-holder') || rpData::betterEmpty(rpGlobals::getPostEntry('rp-account-holder'))) {
         $this->error['ACCOUNT_HOLDER'] = 'MISSING';
     }
     if (!rpGlobals::hasPostEntry('rp-bank-name') || rpData::betterEmpty(rpGlobals::getPostEntry('rp-bank-name'))) {
         $this->error['BANK_NAME'] = 'MISSING';
     }
     if (empty($this->error)) {
         $this->setBankData($_POST);
     }
     parent::pre_confirmation_check();
 }
 * @category  PayIntelligent
 * @package   ratepay
 * @copyright (C) 2012 PayIntelligent GmbH  <http://www.payintelligent.de/>
 * @license   GPLv2
 */
/**
 * RatePAY order template, displays the deliver/cancel, refund, credit and histroy panel
 */
require_once 'includes/application_top.php';
require_once '../lang/' . $_SESSION['language'] . '/admin/modules/payment/ratepay.php';
require_once '../includes/classes/ratepay/helpers/Data.php';
require_once '../includes/classes/ratepay/helpers/Db.php';
require_once '../includes/classes/ratepay/helpers/Session.php';
require_once '../includes/classes/ratepay/helpers/Globals.php';
require_once 'includes/classes/order.php';
$orderId = rpGlobals::hasParam('oID') ? rpGlobals::getParam('oID') : die('Missing param: "oID"');
$order = new order($orderId);
$lang = $_SESSION['language'];
$basketAmount = rpData::getBasketAmount($order, $orderId);
$allItems = rpDb::getRpItems($orderId);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html <?php 
echo HTML_PARAMS;
?>
>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo CHARSET;
?>
">
 /**
  * Is called after checkout_payment.php is confirmed,
  * checks if all needed customer data available or 
  * redirect the customer to the checkout_payment.php
  * with a error message otherwise the user get to the
  * ratepay terms page
  * 
  * @global order $order
  */
 public function pre_confirmation_check()
 {
     global $order;
     if (strtoupper($this->code) == 'RATEPAY_SEPA' && !rpGlobals::hasPostEntry($this->code . '_conditions')) {
         $this->error['CONDITIONS'] = 'MISSING';
     }
     if ($this->_isPhoneNeeded()) {
         if (rpGlobals::hasPostEntry($this->code . '_phone') && !rpData::betterEmpty(rpGlobals::getPostEntry($this->code . '_phone'))) {
             rpDb::setXtCustomerEntry(rpSession::getSessionEntry('customer_id'), 'customers_telephone', rpGlobals::getPostEntry($this->code . '_phone'));
             $order->customer['telephone'] = rpGlobals::getPostEntry($this->code . '_phone');
         } else {
             $this->error['PHONE'] = 'MISSING';
         }
     }
     if ($this->_isDobNeeded()) {
         if (rpGlobals::hasPostEntry($this->code . '_birthdate') && !rpData::betterEmpty(rpGlobals::getPostEntry($this->code . '_birthdate'))) {
             if (!$this->_isDobValid(rpGlobals::getPostEntry($this->code . '_birthdate'))) {
                 $this->error['DOB'] = 'INVALID';
             } else {
                 $dob = rpGlobals::getPostEntry($this->code . '_birthdate');
                 $dateStr = substr(xtc_date_raw($dob), 6, 2) . "." . substr(xtc_date_raw($dob), 4, 2) . "." . substr(xtc_date_raw($dob), 0, 4) . " 00:00:00";
                 $dateStr = substr(xtc_date_raw($dob), 0, 4) . '-' . substr(xtc_date_raw($dob), 4, 2) . '-' . substr(xtc_date_raw($dob), 6, 2) . ' 00:00:00';
                 rpDb::setXtCustomerEntry(rpSession::getSessionEntry('customer_id'), 'customers_dob', $dateStr);
             }
         } else {
             $this->error['DOB'] = 'MISSING';
         }
     }
     if ($this->_isCompanyNeeded()) {
         if (rpGlobals::hasPostEntry($this->code . '_company') && !rpData::betterEmpty(rpGlobals::getPostEntry($this->code . '_company'))) {
             $company = rpGlobals::getPostEntry($this->code . '_company');
             $order->customer['company'] = $company;
             $order->billing['company'] = $company;
             $dbInput = xtc_db_input(rpDb::getXtCustomerEntry(rpSession::getSessionEntry('customer_id'), 'customers_default_address_id'));
             xtc_db_query("UPDATE " . TABLE_ADDRESS_BOOK . " " . "SET entry_company = '" . xtc_db_prepare_input($company) . "' " . "WHERE address_book_id = '" . $dbInput . "'");
         } else {
             $this->error['VATID'] = 'MISSING';
         }
     }
     if ($this->_isVatIdNeeded()) {
         if (rpGlobals::hasPostEntry($this->code . '_vatid') && !rpData::betterEmpty(rpGlobals::getPostEntry($this->code . '_vatid'))) {
             rpDb::setXtCustomerEntry(rpSession::getSessionEntry('customer_id'), 'customers_vat_id', rpGlobals::getPostEntry($this->code . '_vatid'));
         } else {
             $this->error['VATID'] = 'MISSING';
         }
     }
     if (!$this->_isAdult(rpDb::getCustomersDob(null, rpSession::getSessionEntry('customer_id')))) {
         $this->error['DOB'] = 'YOUNGER';
     }
     if (!empty($this->error)) {
         $error = urlencode($this->_getErrorString($this->error));
         $url = xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . $error, 'SSL');
         xtc_redirect($url);
     }
 }
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License, version 2, as
 * published by the Free Software Foundation.
 *
 * 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.  See the
 * GNU General Public License for more details.
 *
 * @category  PayIntelligent
 * @package   ratepay
 * @copyright (C) 2012 PayIntelligent GmbH  <http://www.payintelligent.de/>
 * @license   GPLv2
 */
/**
 * Delete logging script
 */
require_once 'includes/application_top.php';
require_once '../includes/classes/ratepay/helpers/Data.php';
require_once '../includes/classes/ratepay/helpers/Globals.php';
if (rpGlobals::hasPostEntry('submit')) {
    $days = rpGlobals::getPostEntry('days');
    if (preg_match("/^[0-9]{1,2}\$/", $days)) {
        if ($days == 0) {
            xtc_db_query("delete from ratepay_log");
        } else {
            xtc_db_query("DELETE FROM ratepay_log WHERE TO_DAYS(now()) - TO_DAYS(date) > " . (int) $days);
        }
    }
}
xtc_redirect(xtc_href_link('ratepay_logging.php', 'success=1', 'SSL'));
示例#9
0
 /**
  * Retrieve the logging logical
  *
  * @return string
  */
 public static function getLoggingLogical()
 {
     $logicals = array('desc' => 'asc', 'asc' => 'desc');
     $logical = 'desc';
     if (rpGlobals::hasParam('logical')) {
         $logical = $logicals[rpGlobals::getParam('logical')];
     }
     return $logical;
 }