/home/desid573/public_html/payment
NameSizeModeActions
assets/-0755rm
eway-rapid-php-master/-0755rm
pdd/-0755rm
xero/-0755rm
xero-2/-0755rm
xero-php-oauth2-master/-0755rm
10.php19410644editdlrm
11.php9920644editdlrm
approved.php15130644editdlrm
a_name_address.php9310644editdlrm
checktime.php14360644editdlrm
driverCheck.php7940644editdlrm
eCrypt.js684240644editdlrm
eway-rapid-php-master.zip572700644editdlrm
eWay.php426970644editdlrm
index.php560450644editdlrm
index1.php345060644editdlrm
index15May.php483660644editdlrm
indexOLD.php417930644editdlrm
indexTest.php425170644editdlrm
payment-shutdown.log5170644editdlrm
quote.php72180644editdlrm
test.php18710644editdlrm
thankyou.php241440644editdlrm
thankyouOLD.php301100644editdlrm
thankyouTest.php219500644editdlrm
tokenUpdate.php106730644editdlrm
updatetoken.php36960644editdlrm
xero-2-2.zip28341780644editdlrm
Edit: /home/desid573/public_html/payment/thankyouTest.php (21950B)
Payment - Processed
connect_error); $qcon=mysqli_connect($dbhost, $dbuser, $dbpass, $dbname); $query1 = "SELECT token FROM inquiries WHERE inquiry_mobile='".$phone."' ORDER BY token DESC LIMIT 0,1"; $result = mysqli_query($conn, $query1); $row = mysqli_fetch_assoc($result); $tokencheck = $row['token']; $success1 = $conn->query($query1); if (!$success1) { $updatetoken = 0; } if( $tokencheck != ""){ $apiEndpoint = \Eway\Rapid\Client::MODE_PRODUCTION; $client = \Eway\ Rapid::createClient($apiKey, $apiPassword, $apiEndpoint); $tokencustomerid = $tokencheck; $customer = [ 'Email' => trim($_POST['email']), 'TokenCustomerID' => $tokencustomerid, 'CardDetails' => [ 'Name' => $fullname, 'Number' => $_POST['EWAY_CARDNUMBER'], 'ExpiryMonth' => $_POST['EWAY_CARDEXPIRYMONTH'], 'ExpiryYear' => $_POST['EWAY_CARDEXPIRYYEAR'], 'CVN' => $_POST['EWAY_CARDCVN'] ] ]; /*echo '
';
	print_r($customer);
	echo '
'; exit;*/ $response = $client->updateCustomer(\Eway\Rapid\Enum\ApiMethod::DIRECT, $customer); $transaction = [ 'Customer' => [ 'TokenCustomerID' => $tokencustomerid, 'Reference' => $_POST['reference'], ], 'Payment' => [ 'TotalAmount' => $charge, 'InvoiceReference' => $_POST['reference'], ], 'TransactionType' => \Eway\Rapid\Enum\TransactionType::RECURRING, ]; $response = $client->createTransaction(\Eway\Rapid\Enum\ApiMethod::DIRECT, $transaction); }else{ $apiEndpoint = \Eway\Rapid\Client::MODE_PRODUCTION; $client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint); //create customer $fullname = trim($_POST['fullname']); $nameparts = explode(' ', $fullname); $customer = [ 'Title' => 'Mr.', 'FirstName' => trim($nameparts[0]), 'LastName' => trim($nameparts[1]), 'Country' => 'au', 'Email' => trim($_POST['email']), 'CardDetails' => [ 'Name' => $fullname, 'Number' => $_POST['EWAY_CARDNUMBER'], 'ExpiryMonth' => $_POST['EWAY_CARDEXPIRYMONTH'], 'ExpiryYear' => $_POST['EWAY_CARDEXPIRYYEAR'], 'CVN' => $_POST['EWAY_CARDCVN'] ] ]; $responce = $client->createCustomer(\Eway\Rapid\Enum\ApiMethod::DIRECT, $customer); $tokencustomerid = $response->Customer->TokenCustomerID; $transaction = [ 'Customer' => [ 'TokenCustomerID' => $tokencustomerid, 'Reference' => $_POST['reference'], ], 'Payment' => [ 'TotalAmount' => $charge, 'InvoiceReference' => $_POST['reference'], ], 'TransactionType' => \Eway\Rapid\Enum\TransactionType::RECURRING, ]; $response = $client->createTransaction(\Eway\Rapid\Enum\ApiMethod::DIRECT, $transaction); if (isset($response->TransactionStatus) && $response->TransactionStatus) { $query = "SELECT * FROM customer_tokens WHERE access_token_value='".$_POST['token']."'"; $result = $conn->query($query); if(!$result) { error_log("Token error: ".$conn->error); } else { if ($result->num_rows > 0) { $row = $result->fetch_assoc(); $tokencheck = $row['access_token_value']; $query = "UPDATE customer_tokens SET modified = NOW() WHERE access_token_value = ".$tokencheck; $result = $conn->query($query); if(!$result) { error_log("Token update error: ".$conn->error); } } else { if($type == "DD" OR $type == "FC" OR $type == "SF") { $query = "INSERT INTO customer_tokens (`id`, `cid`, `access_token_value`, `status`, `created`, `modified`) VALUES (NULL, '', ".$_POST['token'].", 1, NOW(), NOW())"; $result = $conn->query($query); if(!$result) { error_log("Token insert error: ".$conn->error); } } } } } } $nameq = mysqli_real_escape_string($qcon, $fullname); $dropoffq = mysqli_real_escape_string($qcon, $homeaddress); $table = "inquiries"; if($type == "FC") { $table = "customers"; } $query = "INSERT into ".$table." (inquiry_name, inquiry_mobile, inquiry_dropoff, inquiry_email, token, inquiry_created, welcomemess) VALUES ('" . $nameq . "','" . $phone . "','" . $dropoffq . "','" . $email . "','" . $tokencustomerid . "', NOW(), '') ON DUPLICATE KEY UPDATE inquiry_name='" . $nameq . "', inquiry_dropoff='" . $dropoffq . "', inquiry_email='" . $email . "', token='" . $tokencustomerid . "'"; $success = $conn->query($query); if (!$success) { die("Card could be processed but error with data/invoice: ".$conn->error); } } else { $chargeCard == true; } } else { $chargeCard == false; } if($chargeCard) { $apiEndpoint = \Eway\Rapid\Client::MODE_PRODUCTION; $client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint); //create customer $transaction = [ 'Customer' => [ 'Email' => trim($_POST['email']), 'Reference' => $_POST['reference'], 'CardDetails' => [ 'Name' => $fullname, 'Number' => $_POST['EWAY_CARDNUMBER'], 'ExpiryMonth' => $_POST['EWAY_CARDEXPIRYMONTH'], 'ExpiryYear' => $_POST['EWAY_CARDEXPIRYYEAR'], 'CVN' => $_POST['EWAY_CARDCVN'] ] ], 'Payment' => [ 'TotalAmount' => $charge, 'InvoiceReference' => $_POST['reference'], ], 'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE, ]; $response = $client->createTransaction(\Eway\Rapid\Enum\ApiMethod::DIRECT, $transaction); } } else if ($_POST['payment_type'] == 'token') { $apiEndpoint = \Eway\Rapid\Client::MODE_PRODUCTION; $client = \Eway\ Rapid::createClient($apiKey, $apiPassword, $apiEndpoint); $tokencustomerid = $_POST['token']; $transaction = [ 'Customer' => [ 'TokenCustomerID' => $_POST['token'], 'Reference' => $_POST['reference'], ], 'Payment' => [ 'TotalAmount' => $charge, 'InvoiceReference' => $_POST['reference'], ], 'TransactionType' => \Eway\Rapid\Enum\TransactionType::RECURRING, ]; $response = $client->createTransaction(\Eway\Rapid\Enum\ApiMethod::DIRECT, $transaction); if (isset($response->TransactionStatus) && $response->TransactionStatus) { $query = "SELECT * FROM customer_tokens WHERE access_token_value='".$_POST['token']."'"; $result = $conn->query($query); if(!$result) { error_log("Token error: ".$conn->error); } else { if ($result->num_rows > 0) { $row = $result->fetch_assoc(); $tokencheck = $row['access_token_value']; $query = "UPDATE customer_tokens SET modified = NOW() WHERE access_token_value = ".$tokencheck; $result = $conn->query($query); if(!$result) { error_log("Token update error: ".$conn->error); } } else { if($type == "DD" OR $type == "FC" OR $type == "SF") { $query = "INSERT INTO customer_tokens (`id`, `cid`, `access_token_value`, `status`, `created`, `modified`) VALUES (NULL, '', ".$_POST['token'].", 1, NOW(), NOW())"; $result = $conn->query($query); if(!$result) { error_log("Token insert error: ".$conn->error); } } } } } } if (isset($response->TransactionStatus) && $response->TransactionStatus) { $transactionid = $response->TransactionID; $AuthorisationCode = $response->AuthorisationCode; $paymentCode = "1cb7bb21-739d-480d-909d-fe564b0e2df8"; $sql = "UPDATE ".$table." SET payment_eway = '".$charge."' WHERE reference = '".$ref."'"; $response = $conn->query($sql); if(!$response) { error_log($conn->error); } } else { if($_POST['payment_type'] != 'account'){ $error = true; if ($response->getErrors()) { foreach ($response->getErrors() as $error) { $errormessage.= "Error: $error (".\Eway\Rapid::getMessage($error).")
\n"; } } else { $errormessage.= "Sorry, your payment was declined"; $query = "SELECT * FROM perthdes_eway_codes.responses WHERE code = '".$response->ResponseMessage."'"; $result = $conn->query($query); if ($result->num_rows > 0) { $row = $result->fetch_assoc(); $responseMessage = $row['message']; $errormessage = "
".$responseMessage; } } } } /* echo '
';
	print_r($response);
	echo '
'; */ if (!$error) { echo "

Transaction Approved

"; echo "

Refresh

"; $amount = floatval($_POST['amount']); $reference = ($_POST['reference'] != '') ? $_POST['reference'] : $_POST['reference']; $invname = $_POST['invname']; $paidby = $_POST['payment_type']; $invdesc = $_POST['invdesc']; $invmessage = "Invoice Issued
Name $invname
Type $type
Email $email
Amount $amount
Paid By $paidby
Reference $reference
Description $invdesc"; send_mail('booking@perthdesignateddrivers.com.au', 'invoice@perthdesignateddrivers.com.au', 'New Invoice For '.$invname ,$invmessage); $amountArray = [$amount]; if($_POST['tollAmount'] != "0") { error_log("fired tolls"); array_push($amountArray, floatval($_POST['tollAmount'])); } $qcon=mysqli_connect($dbhost, $dbuser, $dbpass, $dbname); $query1 = "SELECT ".$spatulaID.", driver FROM ".$table." WHERE reference='".$reference."'"; $result = mysqli_query($conn, $query1); $row = mysqli_fetch_assoc($result); $spat_ref = $row[$spatulaID]; $driver_name = $row['driver']; $query1 = "SELECT id FROM perthdes_eway_codes.drivers WHERE driver='".$driver_name."'"; $result = mysqli_query($conn, $query1); $row = mysqli_fetch_assoc($result); $driver_id = $row['id']; $invnamed = mysqli_real_escape_string($qcon, $invname); $invdescd = mysqli_real_escape_string($qcon, $invdesc); $query1 = "INSERT INTO ".$dbname.".invoices (id, reference, tokenid, invname, amount, tollAmount, email, transactionid, date_created, type, paidby, invdesc, driver) VALUES (NULL,'" . $reference . "','" . $tokencustomerid . "','" . $invnamed . "','" . $amountArray[0] . "','" . $amountArray[1] . "','" . $email . "','" . $transactionid . "','" . date('Y-m-d H:i:s') . "','" . $type . "','" . $paidby . "','" . $invdescd . "','" . $driver_name . "')"; $success = mysqli_query($conn, $query1); if (!$success) { die("Couldn't enter data: ".$conn->error); } $query1 = "SELECT reference FROM ".$table." WHERE reference='".$reference."' ORDER BY reference DESC LIMIT 0,1"; $result = mysqli_query($conn, $query1); $row = mysqli_fetch_assoc($result); $refcheck = $row['reference']; $success = $conn->query($query1); if($type == "SI" OR $type=="HK" OR $type == "FA" OR $type == "SA") { $query1 = "SELECT cid FROM booking WHERE reference='".$reference."'"; $result = mysqli_query($conn, $query1); $row = mysqli_fetch_assoc($result); $cid = $row['cid']; if($_REQUEST["referral"] != "none") { $query1 = "UPDATE `credits` SET `reference` = '".$reference."', `is_used` = 1, `date_used` = NOW() WHERE `customer_id`='".$cid."' AND `is_used` = 0"; $result = mysqli_query($conn, $query1); $query1 = "UPDATE `referal_claim` SET `reference_claimed` = '".$reference."', `date_last_claimed` = NOW() WHERE `customer_id`='".$cid."'"; $result = mysqli_query($conn, $query1); } $query1 = "SELECT promo_code, promo_used FROM customers WHERE id='".$cid."' "; $result = mysqli_query($conn, $query1); $row = mysqli_fetch_assoc($result); $promo_code = $row['promo_code']; $is_used = $row['promo_used']; $is_used = $is_used + 1; if($promo_code != ""){ $query1 = "UPDATE `".$dbname."`.`customers` SET `promo_code` = '', promo_used = '".$is_used."' WHERE `id`='".$cid."'"; $result = mysqli_query($conn, $query1); if(substr($_REQUEST['promo_code'], 0, 2) === "RF"){ $sql = "UPDATE `".$dbname."`.`referrals` where `code` = '".$promo_code."' and `refered_id` = '".$cid."' SET `reference` = '".$reference."', `date_used` = NOW()"; $result = $conn->query($sql); if(!$result) { error_log($conn->error); } } } } if (!$success) { die("Couldnt enter invoice data: ".$conn->error); } else { $date = date("c", strtotime("today")); error_log(json_encode($amountArray, true)); $invoiceDetails = submitInvoice($invnamed, $date, $invdescd, $amountArray, $reference, $type); if($invoiceDetails != "") { $sql = "UPDATE ".$table." SET xero_inv = '".$invoiceDetails['invoiceNumber']."' WHERE reference = '".$reference."' "; $response = $conn->query($sql); if(!$response) { error_log($conn->error); } if($paymentCode != "") { $totalAmount = $amountArray[0] + $amountArray[1]; error_log("totalAmount = ".$totalAmount); submitPayment($invoiceDetails['invoiceID'], $paymentCode, $date, $totalAmount); } } } if($spat_ref != "") { $url = "https://api.fleeteng.com.au/v2/graph/role/jobs/$spat_ref/dispatches?access_token=9olkJkrIcttN8Zlh1lgAch70KFC_nJiIpUiCeaBMswbs"; $curlObj = curl_init(); curl_setopt($curlObj, CURLOPT_URL, "$url"); curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curlObj, CURLOPT_HEADER, 0); curl_setopt($curlObj, CURLOPT_HTTPHEADER, array('Content-type:application/json')); curl_setopt($curlObj, CURLOPT_POST, 1); curl_setopt($curlObj, CURLOPT_POSTFIELDS, '[{"vehicle":{"id":' . $driver_id . '},"type":"closed"}]'); $response = curl_exec($curlObj); error_log($response); curl_close($curlObj); } $message = "Type $type
Referecence $reference
"; header('Location: http://bookings.perthdesignateddrivers.com.au/payment/approved.php'); } else { echo "

Transaction has been declined


\n"; echo $errormessage. "
\n"; echo '



'; echo "

Refresh

"; } ?>