$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; break; case "ERREUR": // $smt->validateOrder($id, _PS_OS_ERROR_, 0, $smt->displayName, $smt->l('erreur ').$act); $tampon = "Reference=" . $ref . "&Action=" . $act . "&Reponse=OK"; break; case "ACCORD": $tampon = "Reference=" . $ref . "&Action=" . $act . "&Reponse=OK"; $extra['transaction_id'] = $par; $smt->validateOrder(intval($id), 55, floatval($montant), $smt->displayName, $smt->l('transaction ') . $par . ' ' . $tampon, $extra, null, false, true, null); break; case "REFUS": // $smt->validateOrder($id, _PS_OS_ERROR_, 0, $smt->displayName, $smt->l('erreur ').$act); $tampon = "Reference=" . $ref . "&Action=" . $act . "&Reponse=OK"; break; case "ANNULATION": $id_order = Order::getOrderByCartId($id); if ($id_order > 0) { $history = new OrderHistory(); $history->id_order = intval($id_order); $history->changeIdOrderState(6, intval($id_order)); $history->addWithemail(); } $tampon = "Reference=" . $ref . "&Action=" . $act . "&Reponse=OK"; //$smt->validateOrder($id, 6, 0, $smt->displayName, $smt->l('Annulation ').$tampon );
$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 à 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__)); /* <input type="hidden" name="return" value="http://{$url}order-confirmation.php?key={$customer->secure_key}&id_cart={$cart_id}&id_module={$paypal_id}&slowvalidation" /> */ if (is_file(_PS_THEME_DIR_ . 'modules/smtsps/redirect.tpl')) { $smarty->display(_PS_THEME_DIR_ . 'modules/' . $smt->name . '/redirect.tpl'); } else { $smarty->display(_PS_MODULE_DIR_ . $smt->name . '/redirect.tpl'); }