private function _dealerAction($action, $param, $orderId)
 {
     $order = new Order($orderId);
     $webService = new BuysterWebService();
     $reference = BuysterOperation::getReferenceId($order->id_cart);
     $price = $order->total_paid;
     if ($action == "DUPLICATE") {
         $parametre = 'fromTransactionReference=' . $reference . ';';
         $result = $webService->operation($action, $param, $price, $parametre);
     } else {
         if ($action == "VALIDATE") {
             $parametre = 'operationCaptureNewDelay=' . $param . ';';
             $result = $webService->operation($action, $reference, $price, $parametre);
         } else {
             $parametre = NULL;
             $result = $webService->operation($action, $reference, $price, $parametre);
         }
     }
     if ($result['responseCode'] == "00") {
         $history = new OrderHistory();
         $history->id_order = (int) $orderId;
         if ($action == "DUPLICATE") {
             $operation = BuysterOperation::getOperationId($order->id_cart);
             if ($operation == 'paymentValidation') {
                 $history->changeIdOrderState((int) Configuration::get('BUYSTER_PAYMENT_STATE_VALIDATION'), (int) $orderId);
             } else {
                 $history->changeIdOrderState((int) Configuration::get('BUYSTER_PAYMENT_STATE'), (int) $orderId);
             }
             BuysterOperation::setReferenceReference($param, $reference);
             $reference = $param;
         }
         if ($action == "VALIDATE") {
             $history->changeIdOrderState((int) Configuration::get('PS_OS_PAYMENT'), (int) $orderId);
         }
         if ($action == "REFUND") {
             $history->changeIdOrderState((int) Configuration::get('PS_OS_REFUND'), (int) $orderId);
         }
         if ($action == "CANCEL") {
             $history->changeIdOrderState((int) Configuration::get('PS_OS_CANCELED'), (int) $orderId);
         }
         $history->addWithemail();
     }
     $return = '';
     if ($result['responseCode'] == "99") {
         $return = '<span style="color:red">Probl&egrave;me technique au niveau du serveur Buyster</span><br/>';
     }
     if ($result['responseCode'] == "00") {
         $return .= '<span style="color:green">L\'&eacute;tat de votre commande a &eacute;t&eacute; modifi&eacute;.</span><br/>';
     } else {
         if ($result['responseCode'] == "24") {
             $return = '<span style="color:red">Op&eacuteration impossible. L\'op&eacuteration que vous souhaitez r&eacute;aliser n\'est pas compatible avec l\'&eacute;tat de la transaction.</span><br/>';
         } else {
             $return .= $result['responseDescription'] . '<br/>';
         }
     }
     return $return;
 }
$cartId = substr(htmlentities($_POST['transactionReference']), 30);
//[BuysterRef][YYYYMMDDhhmmss][token][cartId]
$cart = new Cart($cartId);
$post_token = substr($_POST['transactionReference'], 24, 6);
$payment_token = BuysterOperation::getTokenId($cart->id);
if ($post_token != $payment_token || $payment_token == '') {
    die('Invalid Token');
}
$ref = BuysterOperation::getReferenceId($cart->id);
$webService = new BuysterWebService();
$result = $webService->operation("DIAGNOSTIC", $ref);
if ($cart->id_customer == 0 or $cart->id_address_delivery == 0 or $cart->id_address_invoice == 0 or !$buyster->active) {
    Tools::redirectLink(__PS_BASE_URI__ . 'order.php?step=1');
}
BuysterOperation::setStatusId($cart->id, htmlentities($_POST['status']));
$operation = BuysterOperation::getOperationId($cart->id);
if (isset($_POST['responseDescription'])) {
    $responseDescription = str_replace('+', ' ', Tools::safeOutput($_POST['responseDescription']));
}
if (htmlentities($_POST['responseCode']) != '00') {
    $buyster->validateOrder($cart->id, Configuration::get('PS_OS_ERROR'), 0, $buyster->name, $responseDescription, array(), NULL, false, $cart->secure_key);
} else {
    if ($operation == 'paymentValidation' && $result['status'] == 'TO_VALIDATE') {
        $buyster->validateOrder($cart->id, Configuration::get('BUYSTER_PAYMENT_STATE_VALIDATION'), (double) ($result['amount'] / 100), $buyster->name, $responseDescription, array(), NULL, false, $cart->secure_key);
    } else {
        if ($result['status'] == 'TO_CAPTURE') {
            $buyster->validateOrder($cart->id, Configuration::get('PS_OS_PAYMENT'), (double) ($result['amount'] / 100), $buyster->name, $responseDescription, array(), NULL, false, $cart->secure_key);
        } else {
            $buyster->validateOrder($cart->id, Configuration::get('PS_OS_ERROR'), 0, $buyster->name, $responseDescription, array(), NULL, false, $cart->secure_key);
        }
    }
<?php

$useSSL = true;
include dirname(__FILE__) . '/../../config/config.inc.php';
include dirname(__FILE__) . '/../../header.php';
require_once _PS_MODULE_DIR_ . "/buyster/classes/BuysterOperation.php";
require_once _PS_MODULE_DIR_ . "/buyster/classes/BuysterWebService.php";
if (Tools::getValue('payment')) {
    $typePayment = htmlentities(Tools::getValue('payment'));
}
$cartId = $cart->id;
$operation = new BuysterOperation($cartId);
if (isset($typePayment) && $typePayment == 'multiple') {
    $operation->setOperation('paymentN');
} else {
    $operation->setOperation(Configuration::get('BUYSTER_PAYMENT_TRANSACTION_TYPE'));
}
$buyster_token = substr(md5(rand()), 0, 6);
$ref = "BuysterRef" . date('Ymdhis') . $buyster_token . $cart->id;
// be carefull the reference must be under this request : [BuysterRef][YYYYMMDDhhmmss][token][cartId]
$operation->setReference($ref);
$operation->setToken($buyster_token);
//call webservice buyster
$webService = new BuysterWebService();
$url = $webService->getUrl($cart->getOrderTotal(), $_SERVER["REMOTE_ADDR"], $cart->id, $ref, $operation->getOperation(), $cart->id_customer);
//amount, address ip, orderid, transactionRef , type , customerId
if ($url['responseCode'] == '00' && isset($url['redirectionURL']) && $url['redirectionURL'] != '') {
    header("location:" . $url['redirectionURL']);
    echo '<p>Si vous n\'&ecirc;tes pas redirig&eacute;s dans un petit instant, Veuillez cliquer <a href="' . $url['redirectionURL'] . '">ici</a></p>';
} else {
    echo 'Problem : ' . (isset($url['responseDescription']) ? $url['responseDescription'] : '');