alert('Invalid Verification Code'); history.back();");
// }
// }
$applicant_name = urlencode($_POST['applicant_name']);
$mobile_number = urlencode($_POST['mobile_number']);
$email_id = urlencode($_POST['email_id']);
$form_name = urlencode($_POST['form_name']);
//cancel reason togle
if(isset($_POST['cancel_reason_text'])){$cancelreason=$_POST['cancel_reason_text'];}else{$cancelreason=$_POST['cancel_reason'];}
$_SESSION['table_id'] = 'msme_form';
$payment_status = 'Unpaid';
// price of udaym canceletion
$product_price = 2700;
$sql="
INSERT INTO msme_form (
form_name,
applicant_name,
mobile_number,
email_id,
aadhaar_number,
udyam_number,
business_name,
total_amount,
payment_status,
terms_of_service,
cancel_reason,
office_state
)
VALUES (
'".$_POST["form_name"]."',
'".$_POST["applicant_name"]."',
'".$_POST["mobile_number"]."',
'".$_POST["email_id"]."',
'".$_POST["aadhaar_number"]."',
'".$_POST["udyam_number"]."',
'".$_POST["business_name"]."',
'".$product_price."',
'".$payment_status."',
'Checked',
'".$cancelreason."',
'".$_POST["office_state"]."'
)";
if(!$result = $conn->query($sql)){
die('There was an error running the query [' . $conn->error . ']');
}
else
{
$_SESSION["form_id"] = $conn->insert_id;
$ch = curl_init('https://crm2.techlounge.co.in/api/registration-form-submission.php?formId='.$_SESSION["form_id"].'&vendor=TTG&business=MSME&website='.$crm_website.'&amount='.$product_price.'&status=Unpaid&name='.$applicant_name.'&mobile='.$mobile_number.'&email='.$email_id.'&formName='.$form_name.'');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$_SESSION["panel_form_id_2"] = $response;
$ch = curl_init('https://crm11.techlounge.co.in/api/registration-form-submission.php?formId='.$_SESSION["form_id"].'&vendor=TTG&business=MSME&website='.$crm_website.'&amount='.$product_price.'&status=Unpaid&name='.$applicant_name.'&mobile='.$mobile_number.'&email='.$email_id.'&formName='.$form_name.'');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$_SESSION["panel_form_id_11"] = $response;
// Razorpay Payment
$api = new Api($keyId, $keySecret);
$orderData = [
'receipt' => 3457,
'amount' => $product_price * 100,
'currency' => 'INR',
'payment_capture' => 1
];
$razorpayOrder = $api->order->create($orderData);
$razorpayOrderId = $razorpayOrder['id'];
$_SESSION['razorpay_order_id'] = $razorpayOrderId;
$displayAmount = $amount = $orderData['amount'];
if ($displayCurrency !== 'INR')
{
$url = "https://api.fixer.io/latest?symbols=$displayCurrency&base=INR";
$exchange = json_decode(file_get_contents($url), true);
$displayAmount = $exchange['rates'][$displayCurrency] * $amount / 100;
}
$checkout = 'automatic';
if (isset($_GET['checkout']) and in_array($_GET['checkout'], ['automatic', 'manual'], true))
{
$checkout = $_GET['checkout'];
}
$data = [
"key" => $keyId,
"amount" => $amount,
"name" => strtoupper($url1),
"description" => $_POST['form_name'],
"image" => "./assets/img/digital-india.png",
"prefill" => [
"name" => $_POST['applicant_name'],
"email" => $_POST['email_id'],
"contact" => $_POST['mobile_number'],
],
"notes" => [
"address" => "India",
"merchant_order_id" => "EDSLlcJtsq4PGU",
],
"theme" => [
"color" => "#2767dc"
],
"order_id" => $razorpayOrderId,
];
if ($displayCurrency !== 'INR')
{
$data['display_currency'] = $displayCurrency;
$data['display_amount'] = $displayAmount;
}
$json = json_encode($data);
require("checkout/{$checkout}.php");
// Mailer
// Mailer
$host_name = $_SERVER['HTTP_HOST'];
$website_name = strtoupper($host_name);
$mail = new PHPMailer(true);
try {
$mail->isSMTP();
// $mail->SMTPDebug = 2;
$mail->Host = $host_name;
$mail->SMTPAuth = true;
$mail->Username = 'order@'.$host_name.'';
$mail->Password = 'freeDOM@611#';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom('order@'.$host_name.'', $website_name);
$mail->addAddress($_POST["email_id"]);
$mail->isHTML(true);
$mail->Subject = "New ".$_POST["form_name"]." Form Submitted";
$mail->Body = "
APPLICANT NAME: ".$_POST["applicant_name"]."
MOBILE NUMBER: ".$_POST['mobile_number']."
EMAIL ID: ".$_POST['email_id']."
BUSINESS NAME: ".$_POST["business_name"]."
AADHAAR NUMBER: ".$_POST["aadhaar_number"]."
UDYAM NUMBER: ".$_POST["udyam_number"]."
CANCELLATION REASON: ".$_POST['cancel_reason']."
TOTAL AMOUNT: ".$product_price."
";
$mail->send();
}
catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
}
include_once('./client-email.php');
//after submiting...
die();
}
?>