Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set('display_errors', 1);
- ini_set('display_startup_errors', 1);
- error_reporting(E_ALL);
- mysqli_report(MYSQLI_REPORT_ALL & ~MYSQLI_REPORT_INDEX);
- require_once("dbcontroller.php");
- $db_handle = new DBController();
- $order_id='';
- $payment_type='';
- if(isset($_POST['order_id']) && $_POST['order_id']!='')
- {
- $order_id = $_POST['order_id'];
- $payment_type=$_POST['payment_type'];
- if($payment_type=="Cash on delivery")
- {
- $awbtype='COD';
- }
- else
- {
- $awbtype='PPD';
- }
- $sqlg="SELECT order_id , payment_type , customer_name , phone_number, price , order_date FROM do_order where payment_type='".$payment_type."'";
- $resultg = $db_handle->runSelectQuery($sqlg);
- $sqlc = "select awb_id , awb , orderid , status, awb_type FROM ecomexpress_awb WHERE status='unused' AND awb_type='".$awbtype."' limit 1";
- $resultc = $db_handle->runSelectQuery($sqlc);
- if(count($resultc)==1)
- {
- $sqle = "update ecomexpress_awb set orderid = '".$order_id."',status='used' WHERE awb ='".$resultc[0]['awb']."'";
- $resulte = $db_handle->runSelectQuery($sqle);
- }
- $sqlh="SELECT order_id , payment_type , customer_name , phone_number, price , order_date, address FROM do_order where order_id='".$order_id."'";
- $resulth = $db_handle->runSelectQuery($sqlh);
- $address=explode(",",$resulth['address']);
- $countadd=count($address);
- $pincode=$address[$countadd-1];
- $data =
- array (
- 'XBkey' => 'QG6MthH1',
- 'VersionNumber' => 'V5',
- 'ManifestDetails' =>
- array (
- 'ManifestID' => date("Ymd"),
- 'OrderType' => ($payment_type == "Cash on delivery" ? "COD" : "Prepaid"),
- 'OrderNo' => $order_id,
- 'PaymentStatus' => ($payment_type == "Cash on delivery" ? "COD" : "Prepaid"),
- 'PickupVendor' => 'Outthinking',
- 'PickVendorPinCode' => '560043',
- 'CustomerName' => $resulth[0]['customer_name'],
- 'ZipCode' => $pincode,
- 'CustomerAddressDetails' =>
- array (
- 0 =>
- array (
- 'Type' => 'Primary',
- 'Address' => $resulth[0]['customer_name'],
- ),
- ),
- 'CustomerMobileNumberDetails' =>
- array (
- 0 =>
- array (
- 'Type' => 'Primary',
- 'MobileNo' => $resulth[0]['phone_number'],
- ),
- ),
- 'RTOPinCode' => '560043',
- 'AirWayBillNO' => $resultc[0]['awb'],
- 'Quantity' => 1,
- 'PickupVendorCode' => '560043',
- 'CollectibleAmount' => ($payment_type == "Cash on delivery" ? $resulth[0]['price'] : 0),
- 'DeclaredValue' => $resulth[0]['price'],
- 'GSTMultiSellerInfo' =>
- array (
- 0 =>
- array (
- 'ProductDesc' => 'Custom product',
- 'SellerName' => ' PVT LTD',
- 'SellerAddress' => 'No 28 2nd Floor,5th Main road, ',
- 'SellerPincode' => 560043,
- 'InvoiceDate' => date("d-m-Y", strtotime($resulth[0]['order_date']))
- ),
- ),
- ),
- );
- $url = "http://114.143.206.69:803/StandardForwardStagingService.svc/AddManifestDetails";
- $data = json_encode($data);
- $headers = array("Content-Type: application/json");
- $curl = curl_init($url);
- curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl, CURLOPT_POST, true);
- curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($curl, CURLOPT_VERBOSE, true);
- $curl_response = curl_exec($curl);
- curl_close($curl);
- echo $curl_response ."\n";
- $res=json_decode($curl_response);
- if($res->AddManifestDetails[0]->ReturnMessage=='successful')
- {
- $sqli="update do_order set tracking_id='".$resultc[0]['awb']."',shipping_name='xpress' where order_id='".$order_id."'";
- $resulti=$db_handle->executeUpdate($sqli);
- $sqlj = "update ecomexpress_awb set orderid = '".$order_id."',status='assigned' WHERE awb ='".$resultc[0]['awb']."'";
- $resultj = $db_handle->runSelectQuery($sqlj);
- }
- else
- {
- echo $values->ReturnMessage;
- }
- print_r($data);
- }
- ?>
Add Comment
Please, Sign In to add comment