<?php

require_once dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../init.php';
require_once dirname(__FILE__) . '/kwixo.php';
if (!class_exists('HashMD5')) {
    require_once dirname(__FILE__) . '/fianet_key_64bits.php';
}
$payment = new kwixo();
$rnp_md5 = new HashMD5();
$verification_hash = $rnp_md5->hash(Configuration::get('RNP_MERCHID') . Tools::getValue('RefID') . Tools::getValue('TransactionID'));
if (!Tools::getValue('Tag') and Tools::getValue('Tag') != 1) {
    $errors .= $payment->displayName . ' ' . $payment->l('payment canceled') . "\n";
}
if (!Tools::getValue('HashControl')) {
    $errors .= $payment->displayName . ' ' . $payment->l('hash control not specified') . "\n";
} else {
    $hashControl = Tools::getValue('HashControl');
}
if (!Tools::getValue('custom')) {
    $errors .= $payment->displayName . ' ' . $payment->l('key "custom" not specified, can\'t rely to cart') . "\n";
} else {
    $id_cart = intval(Tools::getValue('custom'));
}
if (!Tools::getValue('id_module')) {
    $errors .= $payment->displayName . ' ' . $payment->l('key "module" not specified, can\'t rely to payment module') . "\n";
} else {
    $id_module = intval(Tools::getValue('id_module'));
}
if (!isset($_POST['amount'])) {
    $errors .= $payment->displayName . ' ' . $payment->l('"amount" not specified, can\'t control the amount paid') . "\n";
Example #2
0
    $hashControl = Tools::getValue('HashControl');
}
if (!Tools::getValue('custom')) {
    exit;
}
$id_cart = intval(Tools::getValue('custom'));
$amount = floatval(Tools::getValue('amount'));
$cart = new Cart($id_cart);
if (!$cart->id) {
    exit;
}
$rnp_md5 = new HashMD5();
$controlHash = $rnp_md5->hash(Configuration::get('RNP_CRYPTKEY') . Tools::getValue('RefID') . Tools::getValue('TransactionID'));
if ($controlHash != $hashControl) {
    $orderState = _PS_OS_CANCELED_;
    $errors .= $payment->displayName . $payment->l('hash control invalid (data do not come from Receive&Pay)') . "\n";
}
global $cookie, $cart;
if (!Order::getOrderByCartId($cart->id)) {
    $feedback = 'Order Create';
    $payment->validateOrder(intval($cart->id), intval(Configuration::get('RNP_ID_ORDERSTATE')), $amount, 'kwixo', $feedback, NULL, $cart->id_currency);
    if ($cookie->id_cart == intval($cookie->last_id_cart)) {
        unset($cookie->id_cart);
    }
}
if ($id_order = Order::getOrderByCartId(intval($cart->id))) {
    $order = new Order(intval($id_order));
}
switch (Tools::getValue('Tag')) {
    case 0:
        $orderHistory = new OrderHistory();