<?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";
Esempio n. 2
0
<?php

require_once dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../init.php';
include dirname(__FILE__) . '/kwixo.php';
require_once dirname(__FILE__) . '/fianet_key_64bits.php';
$payment = new kwixo();
$orderState = _PS_OS_PAYMENT_;
if (!Tools::getValue('Tag')) {
    $orderState = _PS_OS_ERROR_;
}
if (!Tools::getValue('HashControl')) {
    $orderState = _PS_OS_ERROR_;
} else {
    $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";
}