Viewing file: unicredit.php (1.55 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include 'global.php';
$numeroOrdine = date("Ymd"); $numeroOrdine .= str_pad(intval(file_get_contents('unicredit.txt'))+1,10,"0",STR_PAD_LEFT);
$totaleOrdine = $_POST['Importo'];
require('./IGFS_CG_API/init/IgfsCgInit.php'); // ==================================================================== // = impostazione parametri per l’inizializzazione = // = richiesta di pagamento. = // = NB: I parametri riportati sono solo a titolo di esempio = // ==================================================================== $init = new IgfsCgInit(); $init->serverURL = "https://testuni.netsw.it/UNI_CG_SERVICES/services"; $init->timeout = 15000; $init->tid = "UNI_ECOM"; $init->kSig = "UNI_TESTKEY"; $init->shopID = $numeroOrdine; $init->shopUserRef = $_POST['Email']; $init->trType = "PURCHASE"; $init->currencyCode = "EUR"; $init->amount = (int) ($totaleOrdine * 100); $init->langID = "IT"; $init->notifyURL = $unicredit_notifyURL; $init->errorURL = $unicredit_errorURL; $init->disableCheckSSLCert();
if(!$init->execute()) {
if($init->rc == 'IGFS_20026') { $progress = intval(file_get_contents('./unicredit.txt')); $init->shopID = $numeroOrdine+1; $progress++; file_put_contents('./unicredit.txt',$progress); if($init->execute()) { goToPayment($init); return; } } header("location: error.php?rc=".urlencode($init->rc)."&errorDesc=".urlencode($init->errorDesc)."&n=".$numeroOrdine."&nn=".$progress); return; }
goToPayment($init);
function goToPayment($init) { $_SESSION['unicredit_pre'] = $init; header("location: ".$init->redirectURL); }
?>
|