<?php session_start(); include $_SERVER['DOCUMENT_ROOT'] . '/includes/dbinfo-pdo.php'; include $_SERVER['DOCUMENT_ROOT'] . '/includes/TransFirst.php'; $tf = new TransFirst(); $response = $_SESSION['response']; $success = $tf->isSuccessful($response); $data = $_SESSION['data']; $citationInfo = $_SESSION['citationInfo']; $receiptNumber = $_SESSION['receiptNumber']; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Online Court Payment System Demo</title> <link rel="stylesheet" type="text/css" href="/css/style.css"/> </head> <body> <div id="main"> <div class="head"> <div style="width: 40%; float: left"> <a href="/index.php"><img src="" width="165" height="123" border="0" style="vertical-align: middle;" /></a> </div> <div align="right" style="width: 50%; float: left"> <u><a href="/index.php">Home</a></u> </div> </div> <div class="login"> </div>
$data['expirationMonth'] = $expirationMonth; // Displayed on confirmation page $data['expirationYear'] = $expirationYear; // Displayed on confirmation page $data['total'] = '0' . str_replace(',', '', $citationInfo['ProcessingTotal']) * 100; // "Request Amount" Leading zero is required. This is in *pennies* } $data['name'] = htmlentities($_POST['name']); $data['phoneNumber'] = htmlentities($_POST['phone']); $data['email'] = htmlentities($_POST['email']); $data['address1'] = htmlentities($_POST['address']); $data['city'] = htmlentities($_POST['city']); $data['state'] = htmlentities($_POST['state']); $data['zipcode'] = htmlentities($_POST['zip']); $data['receiptNumber'] = $receiptNumber; $tf = new TransFirst(); $request = $tf->generateTransactionRequest($data); $response = $client->SendTran($request); $success = $tf->isSuccessful($response); // If processing fee was successful, let's charge the fine amount if ($success || $debug) { // Record the convenience fee $sql = "insert into orders " . "(name, email, phone, address, city, state, zip, citation_number, case_number, violation_date, court_date, charges, processing_fee, chargetotal, ws_response, receipt_number)" . " values " . "(:name, :email, :phone, :address1, :city, :state, :zipcode, :citation_num, :case_num, :violation_date, :court_date, :charges, :processing_fee, :total, :ws_response, :receipt_number)"; $statement = $db->prepare($sql); try { if (!$debug) { $statement->execute(array(':name' => $data['name'], ':email' => $data['email'], ':phone' => $data['phoneNumber'], ':address1' => $data['address1'], ':city' => $data['city'], ':state' => $data['state'], ':zipcode' => $data['zipcode'], ':citation_num' => $citation['CitationNumber'], ':case_num' => $citation['CaseNumber'], ':violation_date' => $citation['ViolationDate'], ':court_date' => $citation['CourtDate'], ':charges' => $citation['Charges'], ':processing_fee' => $citationInfo['ProcessingTotal'], ':total' => number_format($data['total'] / 100, 2), ':ws_response' => serialize($response), ':receipt_number' => $receiptNumber)); } } catch (PDOException $e) { echo $e->getMessage(); exit;
$billingInfo['cvv'] = $_POST["cvv"]; $billingInfo['expiration'] = $expirationYear . $expirationMonth; $billingInfo['total'] = '0' . str_replace(',', '', $_SESSION['Total']) * 100; // "Total" Leading zero is required. This is in *pennies* $billingInfo['name'] = $_POST['name']; $billingInfo['phoneNumber'] = $_POST['phone']; $billingInfo['email'] = $_POST['email']; $billingInfo['address1'] = $_POST['address']; $billingInfo['city'] = $_POST['city']; $billingInfo['state'] = $_POST['state']; $billingInfo['zipcode'] = $_POST['zip']; // 5. If settle isn't successful, void the total amount (using tranNr returned by the settle) // 6. Send email and reference the reciept number (use the same one for all transactions) if (!$demo) { // Just authorize the total amount to see if they have it available $tf = new TransFirst(); $request = $tf->generateAuthOnlyRequest($billingInfo); $response = $client->SendTran($request); $success = $tf->isSuccessful($response); $partialAuth = $tf->isPartialAuth($response); $authTranNumber = $response->tranData->tranNr; $billingInfo['tranNumber'] = $authTranNumber; // If this was partially authorized or unsuccessful void the transaction and then throw an exception. if ($partialAuth || !$success) { $request = $tf->generateVoidRequest($billingInfo); $response = $client->sendTran($request); $success = $tf->isSuccessful($response); if ($success) { throw new Exception("Please verify that you have enough money on this card to pay the total amount. This transaction has been successfully voided."); } else { throw new Exception("Please verify that you have enough money on this card to pay the total amount. We were unable to successfully void this transcaction. Please call us at 1-877-689-5144 for assistance.");