File: /var/www/grapossconnect/adminapi/testapi.php
<?php
function geplPaymentInvoice($from_domain, $if_vendor, $transaction_type, $payment_for, $payment_type, $order_id, $product_mrp, $gst_rate, $gepl_amount, $discount_amount, $net_amount, $customer_name, $customer_address, $customer_mobile, $customer_email, $customer_gst_name, $customer_gstin, $customer_state_id, $customer_state_code, $customer_state_name, $transaction_id1, $transaction_id2, $transaction_date, $ref_name1, $ref_id1, $ref_name2, $ref_id2, $ref_name3, $ref_id3)
{
$cipher = "aes-256-cbc";
$encryption_key = "gepl-enc2022";
$apiData = array("from_domain" => $from_domain, "if_vendor" => $if_vendor, "transaction_type" => $transaction_type, "payment_for" => $payment_for, "payment_type" => $payment_type, "order_id" => $order_id, "product_mrp" => $product_mrp, "gst_rate" => $gst_rate, "gepl_amount" => $gepl_amount, "discount_amount" => $discount_amount, "net_amount" => $net_amount, "customer_name" => $customer_name, "customer_address" => $customer_address, "customer_mobile" => $customer_mobile, "customer_email" => $customer_email, "customer_gst_name" => $customer_gst_name, "customer_gstin" => $customer_gstin, "customer_state_id" => $customer_state_id, "customer_state_code" => $customer_state_code, "customer_state_name" => $customer_state_name, "transaction_id1" => $transaction_id1, "transaction_id2" => $transaction_id2, "transaction_date" => $transaction_date, "ref_name1" => $ref_name1, "ref_id1" => $ref_id1, "ref_name2" => $ref_name2, "ref_id2" => $ref_id2, "ref_name3" => $ref_name3, "ref_id3" => $ref_id3);
$jsonEncodeData = json_encode($apiData);
$base64EncodeData = base64_encode($jsonEncodeData);
$finalEncryptedData = openssl_encrypt($base64EncodeData, $cipher, $encryption_key);
// API URL to send data
$url = 'https://grapossconnect.com/adminapi/invoice_all_platform.php';
// curl initiate
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $finalEncryptedData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute curl and assign returned data
$apiDataJsonResponse = curl_exec($ch);
// Close curl
curl_close($ch);
return $apiDataJsonResponse;
}
//sample parameters
// if (isset($_POST['submitForm'])) {
// $from_domain = $_POST['from_domain'];
// $if_vendor = $_POST['if_vendor'];
// $transaction_type = $_POST['transaction_type'];
// $payment_for = $_POST['payment_for'];
// $payment_type = $_POST['payment_type'];
// $order_id = $_POST['order_id'];
// $product_mrp = $_POST['product_mrp'];
// $gst_rate = $_POST['gst_rate'];
// $gepl_amount = $_POST['gepl_amount'];
// $discount_amount = $_POST['discount_amount'];
// $net_amount = $_POST['net_amount'];
// $customer_name = $_POST['customer_name'];
// $customer_address = $_POST['customer_address'];
// $customer_mobile = $_POST['customer_mobile'];
// $customer_email = $_POST['customer_email'];
// $customer_gst_name = $_POST['customer_gst_name'];
// $customer_gstin = $_POST['customer_gstin'];
// $customer_state_id = $_POST['customer_state_id'];
// $customer_state_code = $_POST['customer_state_code'];
// $customer_state_name = $_POST['customer_state_name'];
// $transaction_id1 = $_POST['transaction_id1'];
// $transaction_id2 = $_POST['transaction_id2'];
// $transaction_date = $_POST['transaction_date'];
// $ref_name1 = $_POST['ref_name1'];
// $ref_id1 = $_POST['ref_id1'];
// $ref_name2 = $_POST['ref_name2'];
// $ref_id2 = $_POST['ref_id2'];
// $ref_name3 = $_POST['ref_name3'];
// $ref_id3 = $_POST['ref_id3'];
// $paymentRef = geplPaymentInvoice($from_domain, $if_vendor, $transaction_type, $payment_for, $payment_type, $order_id, $product_mrp, $gst_rate, $gepl_amount, $discount_amount, $net_amount, $customer_name, $customer_address, $customer_mobile, $customer_email, $customer_gst_name, $customer_gstin, $customer_state_id, $customer_state_code, $customer_state_name, $transaction_id1, $transaction_id2, $transaction_date, $ref_name1, $ref_id1, $ref_name2, $ref_id2, $ref_name3, $ref_id3);
// $responseData = json_decode($paymentRef);
// echo "<pre>".print_r($responseData, true)."</pre>";
// }
?>
<?php /* ?>
<html>
<head>Form checking for invoice</head>
<body>
<form name="testform" method="post">
<table>
<tr>
<td>Domain Name</td>
<td><input type="text" name="from_domain" value="sarkaripariksha.com"></td>
<td><span class="spncls">transaction originating domain</span></td>
</tr>
<tr>
<td>Vendor Name</td>
<td><input type="text" name="if_vendor" value="SP"></td>
<td><span class="spncls">vendor name for vendors like csc, cms otherwise domain extn like SP, SA, CNN</span></td>
</tr>
<tr>
<td>Transaction Type</td>
<td><input type="text" name="transaction_type" value="SR"></td>
<td><span class="spncls">payment type short code like WDR for whitelabel domain renewal</span></td>
</tr>
<tr>
<td>Transaction Type Name</td>
<td><input type="text" name="transaction_type_name" value="SP-EXM-DIR-PG-student-registration"></td>
<td><span class="spncls">txn type name - SP-EXM-DIR-PG-student-registration, SP-BLS-EXM-DIR-PG-student-registration, SP-CSC-EXM-WLT-student-registration</span></td>
</tr>
<tr>
<td>Payment For</td>
<td><input type="text" name="payment_for" value="Student Registration"></td>
<td><span class="spncls">like student registration, whitelabel renewal, vendor student registration</span></td>
</tr>
<tr>
<td>Payment Type</td>
<td><input type="text" name="payment_type" value="Payment Gateway"></td>
<td><span class="spncls">like cash, payment gateway, wallet</span></td>
</tr>
<tr>
<td>Payment Gateway Name</td>
<td><input type="text" name="payment_type" value="Razorpay"></td>
<td><span class="spncls">like razorpay, paytm, payu</span></td>
</tr>
<tr>
<td>Order Id</td>
<td><input type="text" name="order_id" value="1"></td>
<td><span class="spncls">transaction originating table unique id</span></td>
</tr>
<tr>
<td>Product Mrp</td>
<td><input type="text" name="product_mrp" value="500"></td>
<td><span class="spncls">MRP of product, service</span></td>
</tr>
<tr>
<td>GST Rate</td>
<td><input type="text" name="gst_rate" value="18"></td>
<td><span class="spncls">applicable gst rate</span></td>
</tr>
<tr>
<td>gepl_amount</td>
<td><input type="text" name="gepl_amount" value="500"></td>
<td><span class="spncls">send from transaction page with % share in case of vendors, discount code</span></td>
</tr>
<tr>
<td>Discount Amount</td>
<td><input type="text" name="discount_amount" value="0"></td>
<td><span class="spncls">if any discount is given for this transaction</span></td>
</tr>
<tr>
<td>Net Amount</td>
<td><input type="text" name="net_amount" value="500"></td>
<td><span class="spncls">net amount payble by customer</span></td>
</tr>
<tr>
<td>Customer Name</td>
<td><input type="text" name="customer_name" value="Test Abc"></td>
<td><span class="spncls">-</span></td>
</tr>
<tr>
<td>Customer Address</td>
<td><input type="text" name="customer_address" value="Abc Address"></td>
<td><span class="spncls">-</span></td>
</tr>
<tr>
<td>Customer Mobile</td>
<td><input type="text" name="customer_mobile" value="7878787878"></td>
<td><span class="spncls">-</span></td>
</tr>
<tr>
<td>Customer Email</td>
<td><input type="text" name="customer_email" value="testabc@sp.com"></td>
<td><span class="spncls">-</span></td>
</tr>
<tr>
<td>Customer Gst Name</td>
<td><input type="text" name="customer_gst_name" value=""></td>
<td><span class="spncls">customer gst name if exist</span></td>
</tr>
<tr>
<td>Customer GSTIN</td>
<td><input type="text" name="customer_gstin" value=""></td>
<td><span class="spncls">customer gst number if exist</span></td>
</tr>
<tr>
<td>Customer State Id</td>
<td><input type="text" name="customer_state_id" value="36"></td>
<td><span class="spncls">transaction originating portal state table state id 36-Delhi, 23-UP</span></td>
</tr>
<tr>
<td>Customer State Code</td>
<td><input type="text" name="customer_state_code" value="DL"></td>
<td><span class="spncls">-</span></td>
</tr>
<tr>
<td>Customer State Name</td>
<td><input type="text" name="customer_state_name" value="Delhi"></td>
<td><span class="spncls">-</span></td>
</tr>
<tr>
<td>Transaction Id1</td>
<td><input type="text" name="transaction_id1" value="123456"></td>
<td><span class="spncls">-</span></td>
</tr>
<tr>
<td>Transaction Id2</td>
<td><input type="text" name="transaction_id2" value="123456"></td>
<td><span class="spncls">-</span></td>
</tr>
<tr>
<td>Transaction Date</td>
<td><input type="text" name="transaction_date" value="2023-01-28 16:13:23"></td>
<td><span class="spncls">-</span></td>
</tr>
<tr>
<td>Ref Name1</td>
<td><input type="text" name="ref_name1" value="Exam"></td>
<td><span class="spncls">any optional reference field name to keep records like exam name in case of Sarkari Pariksha exam</span></td>
</tr>
<tr>
<td>Ref Id1</td>
<td><input type="text" name="ref_id1" value="19208"></td>
<td><span class="spncls">optional reference field id from above name</span></td>
</tr>
<tr>
<td>Ref Name2</td>
<td><input type="text" name="ref_name2" value="Plan"></td>
<td><span class="spncls">-</span></td>
</tr>
<tr>
<td>Ref Id2</td>
<td><input type="text" name="ref_id2" value="56"></td>
<td><span class="spncls">-</span></td>
</tr>
<tr>
<td>Ref Name3</td>
<td><input type="text" name="ref_name3" value=""></td>
<td><span class="spncls">-</span></td>
</tr>
<tr>
<td>Ref Id3</td>
<td><input type="text" name="ref_id3" value=""></td>
<td><span class="spncls">-</span></td>
</tr>
<tr>
<td>-</td>
<td><input type="submit" name="submitForm"></td>
<td>-</td>
</tr>
</table>
</form>
</body>
<?php */ ?>
<style>
.spncls {
font-size: 12px;
color: #00bcd4;
}
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td,
th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
</style>
</html>