Пример #1
0
$ret = ob_get_contents();
ob_end_clean();
$fp = fopen("log.txt", "a");
// ouverture du fichier en écriture
fputs($fp, "\n");
// on va a la ligne
fputs($fp, "{$ret}");
fclose($fp);
/*
Tester le header de la requette HTTP
*/
include dirname(__FILE__) . '/../../config/config.inc.php';
include dirname(__FILE__) . '/smtsps.php';
$errors = '';
$result = false;
$smt = new SmtSps();
$ref = $_GET['Reference'];
$act = $_GET['Action'];
$par = $_GET['Param'];
$temp = explode("TN-", $ref);
$id = str_replace("CMD", "", $temp[0]);
$id = intval($id) - 22002;
$cart = new Cart($id);
$Value = floatval($cart->getOrderTotal(true, 3));
$decimals = log10(abs($Value));
$decimals = -(intval(min($decimals, 0)) - 3);
$format = "%." . $decimals . "f";
$montant = sprintf($format, $Value);
switch ($act) {
    case "DETAIL":
        $tampon = "Reference=" . $ref . "&Action=" . $act . "&Reponse=" . $montant;
Пример #2
0
<?php

include dirname(__FILE__) . '/../../config/config.inc.php';
include dirname(__FILE__) . '/../../init.php';
include dirname(__FILE__) . '/smtsps.php';
$smt = new SmtSps();
$cart = new Cart(intval($cookie->id_cart));
$address = new Address(intval($cart->id_address_invoice));
$country = new Country(intval($address->id_country));
$state = NULL;
if ($address->id_state) {
    $state = new State(intval($address->id_state));
}
$customer = new Customer(intval($cart->id_customer));
$affilie = Configuration::get('SMT_AFFILIE');
$currency_order = new Currency(intval($cart->id_currency));
$currency_module = $currency_order;
$Value = floatval($cart->getOrderTotal(true, 3));
$decimals = log10(abs($Value));
$decimals = -(intval(min($decimals, 0)) - 3);
$format = "%." . $decimals . "f";
$amount = sprintf($format, $Value);
if (!Validate::isLoadedObject($address) or !Validate::isLoadedObject($customer)) {
    die($smt->l('Erreur de paiement : Addresse ou Client inconnu'));
}
$ref = $cart->id + 22002;
$randNumber = rand(999, 100000);
$ref = "CMD" . $ref . "TN-" . $randNumber;
$smarty->assign(array('reference' => $ref, 'redirect_text' => $smt->l('Veuillez patienter nous allons vous rediriger vers le serveur de paiement... Merci.'), 'cancel_text' => $smt->l('Annuler'), 'cart_text' => $smt->l('Mon panier'), 'return_text' => $smt->l('Retour &agrave; la boutique'), 'smt_url' => $smt->getSMTUrl(), 'address' => $address, 'country' => $country, 'state' => $state, 'amount' => $amount, 'customer' => $customer, 'sid' => $customer->secure_key, 'total' => floatval($cart->getOrderTotal(true, 3)), 'shipping' => Tools::ps_round(floatval($cart->getOrderShippingCost()) + floatval($cart->getOrderTotal(true, 6)), 2), 'discount' => $cart->getOrderTotal(true, 2), 'affilie' => $affilie, 'currency_module' => $currency_module, 'cart_id' => intval($cart->id), 'products' => $cart->getProducts(), 'smt_id' => intval($smt->id), 'url' => Tools::getHttpHost(false, true) . __PS_BASE_URI__));
/*