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();
- /** code **/
- $sqlb="SELECT * FROM ecomexpress_awb";
- $resultb = $db_handle->runSelectQuery($sqlb);
- $order_id='';
- $payment_type='';
- if(isset($_POST['order_id']) && $_POST['order_id']!='')
- {
- $order_id = $_POST['order_id'];
- $payment_type=$_POST['payment_type'];
- $sqlg="SELECT * FROM do_order where payment_type='".$payment_type."'";
- $resultg = $db_handle->runSelectQuery($sqlg);
- if($payment_type=="Cash on delivery")
- {
- $sqlc = "select * from ecomexpress_awb WHERE status='unused' AND awb_type='COD' limit 1";
- }
- else
- {
- $sqlc = "select * from ecomexpress_awb WHERE status='unused' AND awb_type='PPD' 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);
- }
- //add only field name
- $sqlh="SELECT * FROM do_order where order_id='".$order_id."'";
- $resulth = $db_handle->runSelectQuery($sqlh);
- $data =
- array (
- 'XBkey' => 'QGfMthH1',
- 'VersionNumber' => 'V5',
- 'ManifestDetails' =>
- array (
- 'ManifestID' => '12320160729',
- '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' => '560043',
- 'CustomerAddressDetails' =>
- array (
- 0 =>
- array (
- 'Type' => 'Primary',
- 'Address' => $resulth[0]['customer_name'],
- ),
- ),
- 'CustomerMobileNumberDetails' =>
- array (
- 0 =>
- array (
- 'Type' => 'Primary',
- 'MobileNo' => $resulth[0]['phone_number'],
- ),
- ),
- 'RTOPinCode' => '400061',
- 'AirWayBillNO' => $resultc[0]['awb'],
- 'Quantity' => 1,
- 'PickupVendorCode' => 'M34',
- 'CollectibleAmount' => $resulth[0]['price'],
- 'DeclaredValue' => $resulth[0]['price'],
- 'GSTMultiSellerInfo' =>
- array (
- 0 =>
- array (
- 'ProductDesc' => 'Custom product',
- 'SellerName' => 'OUTTHINKING ELECTRONICS PVT LTD',
- 'SellerAddress' => 'No 28 2nd Floor,5th Main road, OMBR Layout Kasturinagar',
- 'SellerPincode' => 560043,
- 'InvoiceDate' => '13-10-2016', //orderdate
- ),
- ),
- ),
- );
- $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);
- foreach ($res->curl_response as $values)
- {
- if($values->ReturnMessage=='successful')
- {
- $usql="update do_order set tracking_id='".$resultc[0]['awb']."',shipping_name='xpress', where order_id='".$order_id."'";
- $result=$db_handle->executeUpdate($usql);
- echo "1";die;
- }
- else
- {
- echo $values->ReturnMessage;die;
- }
- }
- print_r($data);
- //print_r($res->curl_response);
- }
- //$sqla = "update ecomexpress_awb status='assigned' WHERE awb=".$selectawb." AND order_id=". $postorderid;
- //$sqld = $db_handle->runSelectQuery($sqla);
- ?>
Add Comment
Please, Sign In to add comment