* 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 */ require_once 'includes/classes/order.php'; require_once dirname(__FILE__) . '/../../../../lang/' . rpSession::getLang() . '/admin/modules/payment/ratepay.php'; require_once dirname(__FILE__) . '/../../../classes/ratepay/mappers/RequestMapper.php'; require_once dirname(__FILE__) . '/../../../classes/ratepay/helpers/Data.php'; require_once dirname(__FILE__) . '/../../../classes/ratepay/helpers/Db.php'; require_once dirname(__FILE__) . '/../../../classes/ratepay/helpers/Session.php'; require_once dirname(__FILE__) . '/../../../classes/ratepay/helpers/Globals.php'; require_once dirname(__FILE__) . '/../../../classes/ratepay/helpers/Loader.php'; /** * Order controller */ class rpOrderController { /** * Call CONFIRMATION_DELIVER and updates order and item data */ public static function deliverAction($deliverByCredit = false)
/** * This method save's all necessary request and response informations in the database * * @param order $order * @param rpSimpleXmlExtended $request * @param string $orderId * @param SimpleXMLElement $response */ public static function xmlLog($order, $request, $orderId = 'N/A', $response = null) { require_once dirname(__FILE__) . '/../../../../lang/' . rpSession::getLang() . '/modules/payment/' . $order->info['payment_method'] . '.php'; $payment = rpLoader::getRatepayPayment($order->info['payment_method']); if ($payment->logging) { $transactionId = 'N/A'; $subType = 'N/A'; if ($request->head->{'transaction-id'}) { $transactionId = (string) $request->head->{'transaction-id'}; } if ($request->head->operation->attributes()->subtype) { $subType = (string) $request->head->operation->attributes()->subtype; } $operation = (string) $request->head->operation; $responseXml = 'N/A'; if (!empty($response)) { $responseXml = $response->asXML(); $result = (string) $response->head->processing->result; $resultCode = (string) $response->head->processing->result->attributes()->code; $reasonText = (string) $response->head->processing->reason; if ($response->head->{'transaction-id'}) { $transactionId = (string) $response->head->{'transaction-id'}; } } else { $result = "Service unavaible."; $resultCode = "Service unavaible."; } $sql = "INSERT INTO ratepay_log " . "(" . "order_number, " . "transaction_id, " . "payment_method, " . "payment_type, " . "payment_subtype, " . "result, " . "request, " . "response, " . "result_code, " . "reason" . ") " . "VALUES ('" . xtc_db_input($orderId) . "', '" . xtc_db_input($transactionId) . "', '" . xtc_db_input($payment->title) . "', '" . xtc_db_input($operation) . "', '" . xtc_db_input($subType) . "', '" . xtc_db_input($result) . "','" . xtc_db_input(utf8_decode($request->asXML())) . "','" . xtc_db_input($responseXml) . "','" . xtc_db_input($resultCode) . "','" . xtc_db_input($reasonText) . "')"; xtc_db_query($sql); if ($operation == "PAYMENT_CONFIRM" && $transactionId != 'N/A') { $sql = "UPDATE ratepay_log SET order_number = '" . xtc_db_input($orderId) . "' WHERE transaction_id = '" . xtc_db_input($transactionId) . "';"; xtc_db_query($sql); } } }