version, '2.1', '>=') ? "wc-settings" : "woocommerce_settings"; $plugin_links = array( '' . __( 'Configure', 'hitshippo_fedex' ) . '', '' . __('Support', 'hitshippo_fedex') . '' ); return array_merge( $plugin_links, $links ); } public function create_fedex_shipping_meta_box() { add_meta_box( 'hitshippo_create_fedex_shipping', __('Automated Fedex Shipping Label','hitshippo_fedex'), array($this, 'create_fedex_shipping_label_genetation'), 'shop_order', 'side', 'core' ); } public function hitshippo_fedex_order_status_update(){ global $woocommerce; if (isset($_GET['carrier']) && $_GET['carrier'] == "fedex") { if(isset($_GET['h1t_updat3_0rd3r']) && isset($_GET['key']) && isset($_GET['action'])){ $order_id = $_GET['h1t_updat3_0rd3r']; $key = $_GET['key']; $action = $_GET['action']; $order_ids = explode(",",$order_id); $general_settings = get_option('hitshippo_fedex_main_settings',array()); if(isset($general_settings['hitshippo_fedex_shippo_int_key']) && $general_settings['hitshippo_fedex_shippo_int_key'] == $key){ if($action == 'processing'){ foreach ($order_ids as $order_id) { $order = wc_get_order( $order_id ); $order->update_status( 'processing' ); } }else if($action == 'completed'){ foreach ($order_ids as $order_id) { $order = wc_get_order( $order_id ); $order->update_status( 'completed' ); } } } die(); } if(isset($_GET['h1t_updat3_sh1pp1ng']) && isset($_GET['key']) && isset($_GET['user_id']) && isset($_GET['carrier']) && isset($_GET['track'])){ $order_id = $_GET['h1t_updat3_sh1pp1ng']; $key = $_GET['key']; $general_settings = get_option('hitshippo_fedex_main_settings',array()); $user_id = $_GET['user_id']; $carrier = $_GET['carrier']; $track = $_GET['track']; $output['status'] = 'success'; $output['tracking_num'] = $track; // $output['label'] = "localhost/hitshippo/api/shipping_labels/".$user_id."/".$carrier."/order_".$order_id."_track_".$track."_label.pdf"; // $output['invoice'] = "localhost/hitshippo/api/shipping_labels/".$user_id."/".$carrier."/order_".$order_id."_track_".$track."_invoice.pdf"; $output['label'] = "https://shipo.hitstacks.com/api/shipping_labels/".$user_id."/".$carrier."/order_".$order_id."_track_".$track."_label.pdf"; $output['invoice'] = "https://shipo.hitstacks.com/api/shipping_labels/".$user_id."/".$carrier."/order_".$order_id."_track_".$track."_invoice.pdf"; if(isset($general_settings['hitshippo_fedex_shippo_int_key']) && $general_settings['hitshippo_fedex_shippo_int_key'] == $key){ update_option('hitshippo_fedex_values_'.$order_id, json_encode($output)); } die(); } } } public function create_fedex_shipping_label_genetation($post){ // print_r('expression'); // die(); if($post->post_type !='shop_order' ){ return; } $order = wc_get_order( $post->ID ); $ship_met = $order->get_shipping_methods(); $order_id = $order->get_id(); $_fedex_carriers = array( 'FIRST_OVERNIGHT' => 'FedEx First Overnight', 'PRIORITY_OVERNIGHT' => 'FedEx Priority Overnight', 'STANDARD_OVERNIGHT' => 'FedEx Standard Overnight', 'FEDEX_2_DAY_AM' => 'FedEx 2Day A.M', 'FEDEX_2_DAY' => 'FedEx 2Day', 'SAME_DAY' => 'FedEx Same Day', 'SAME_DAY_CITY' => 'FedEx Same Day City', 'SAME_DAY_METRO_AFTERNOON' => 'FedEx Same Day Metro Afternoon', 'SAME_DAY_METRO_MORNING' => 'FedEx Same Day Metro Morning', 'SAME_DAY_METRO_RUSH' => 'FedEx Same Day Metro Rush', 'FEDEX_EXPRESS_SAVER' => 'FedEx Express Saver', 'GROUND_HOME_DELIVERY' => 'FedEx Ground Home Delivery', 'FEDEX_GROUND' => 'FedEx Ground', 'INTERNATIONAL_ECONOMY' => 'FedEx International Economy', 'INTERNATIONAL_ECONOMY_DISTRIBUTION' => 'FedEx International Economy Distribution', 'INTERNATIONAL_FIRST' => 'FedEx International First', 'INTERNATIONAL_GROUND' => 'FedEx International Ground', 'INTERNATIONAL_PRIORITY' => 'FedEx International Priority', 'INTERNATIONAL_PRIORITY_DISTRIBUTION' => 'FedEx International Priority Distribution', 'EUROPE_FIRST_INTERNATIONAL_PRIORITY' => 'FedEx Europe First International Priority', 'INTERNATIONAL_PRIORITY_EXPRESS' => 'FedEx International Priority Express', 'FEDEX_INTERNATIONAL_PRIORITY_PLUS' => 'FedEx First International Priority Plus', 'INTERNATIONAL_DISTRIBUTION_FREIGHT' => 'FedEx International Distribution Fright', 'FEDEX_1_DAY_FREIGHT' => 'FedEx 1 Day Freight', 'FEDEX_2_DAY_FREIGHT' => 'FedEx 2 Day Freight', 'FEDEX_3_DAY_FREIGHT' => 'FedEx 3 Day Freight', 'INTERNATIONAL_ECONOMY_FREIGHT' => 'FedEx Economy Freight', 'INTERNATIONAL_PRIORITY_FREIGHT' => 'FedEx Priority Freight', 'SMART_POST' => 'FedEx Smart Post', 'FEDEX_FIRST_FREIGHT' => 'FedEx First Freight', 'FEDEX_FREIGHT_ECONOMY' => 'FedEx Freight Economy', 'FEDEX_FREIGHT_PRIORITY' => 'FedEx Freight Priority', 'FEDEX_CARGO_AIRPORT_TO_AIRPORT' => 'FedEx CARGO Airport to Airport', 'FEDEX_CARGO_FREIGHT_FORWARDING' => 'FedEx CARGO Freight FOrwarding', 'FEDEX_CARGO_INTERNATIONAL_EXPRESS_FREIGHT' => 'FedEx CARGO International Express Fright', 'FEDEX_CARGO_INTERNATIONAL_PREMIUM' => 'FedEx CARGO International Premium', 'FEDEX_CARGO_MAIL' => 'FedEx CARGO Mail', 'FEDEX_CARGO_REGISTERED_MAIL' => 'FedEx CARGO Registered Mail', 'FEDEX_CARGO_SURFACE_MAIL' => 'FedEx CARGO Surface Mail', 'FEDEX_CUSTOM_CRITICAL_AIR_EXPEDITE_EXCLUSIVE_USE' => 'FedEx Custom Critical Air Expedite Exclusive Use', 'FEDEX_CUSTOM_CRITICAL_AIR_EXPEDITE_NETWORK' => 'FedEx Custom Critical Air Expedite Network', 'FEDEX_CUSTOM_CRITICAL_CHARTER_AIR' => 'FedEx Custom Critical Charter Air', 'FEDEX_CUSTOM_CRITICAL_POINT_TO_POINT' => 'FedEx Custom Critical Point to Point', 'FEDEX_CUSTOM_CRITICAL_SURFACE_EXPEDITE' => 'FedEx Custom Critical Surface Expedite', 'FEDEX_CUSTOM_CRITICAL_SURFACE_EXPEDITE_EXCLUSIVE_USE' => 'FedEx Custom Critical Surface Expedite Exclusive Use', 'FEDEX_CUSTOM_CRITICAL_TEMP_ASSURE_AIR' => 'FedEx Custom Critical Temp Assure Air', 'FEDEX_CUSTOM_CRITICAL_TEMP_ASSURE_VALIDATED_AIR' => 'FedEx Custom Critical Temp Assure Validated Air', 'FEDEX_CUSTOM_CRITICAL_WHITE_GLOVE_SERVICES' => 'FedEx Custom Critical White Glove Services', 'TRANSBORDER_DISTRIBUTION_CONSOLIDATION' => 'Fedex Transborder Distribution Consolidation', 'FEDEX_DISTANCE_DEFERRED' => 'FedEx Distance Deferred', 'FEDEX_NEXT_DAY_EARLY_MORNING' => 'FedEx Next Day Early Morning', 'FEDEX_NEXT_DAY_MID_MORNING' => 'FedEx Next Day Mid Morning', 'FEDEX_NEXT_DAY_AFTERNOON' => 'FedEx Next Day Afternoon', 'FEDEX_NEXT_DAY_END_OF_DAY' => 'FedEx Next Day End of Day', 'FEDEX_NEXT_DAY_FREIGHT' => 'FedEx Next Day Freight', ); $general_settings = get_option('hitshippo_fedex_main_settings',array()); $shipment_data = json_decode(get_option('hitshippo_fedex_values_'.$order_id), true); // using "true" to convert stdobject to array $notice = get_option('hitshippo_fedex_status_'.$order_id, null); // echo '
';
		       	// print_r($shipment_data);
		       	// echo '

Notice

'; // print_r($notice); // die(); if(empty($shipment_data)){ echo 'Choose Service to Ship'; echo '
'; echo '
Shipment Content'; echo '
'; if($notice && $notice != 'success'){ echo "

".$notice."

"; delete_option('hitshippo_fedex_status_'.$order_id); } echo ''; } else{ echo 'Shipment ID: '.$shipment_data['tracking_num'].''; echo ' Shipping Label '.$key.' '; echo ' Invoice '; echo ' '; if ($notice && $notice == 'success') { echo "

Shipment created successfully

"; delete_option('hitshippo_fedex_status_'.$order_id); }elseif($notice && $notice != 'success'){ echo "

".$notice."

"; delete_option('hitshippo_fedex_status_'.$order_id); } } } public function hitshippo_fedex_wc_checkout_order_processed($order_id){ $post = get_post($order_id); if($post->post_type !='shop_order' ){ return; } $order = wc_get_order( $order_id ); $service_code =''; $shipping_charge = 0; foreach( $order->get_shipping_methods() as $item_id => $item ){ $service_code = $item->get_meta('hitshippo_fedex_service'); $shipping_charge = $item->get_meta('hitshippo_fedex_shipping_charge'); // $service_code = $item->get_meta('a2z_dhl_service'); } if(empty($service_code)){ return; } $order_data = $order->get_data(); $order_id = $order_data['id']; $order_currency = $order_data['currency']; $order_shipping_first_name = $order_data['shipping']['first_name']; $order_shipping_last_name = $order_data['shipping']['last_name']; $order_shipping_company = empty($order_data['shipping']['company']) ? $order_data['shipping']['first_name'] : $order_data['shipping']['company']; $order_shipping_address_1 = $order_data['shipping']['address_1']; $order_shipping_address_2 = $order_data['shipping']['address_2']; $order_shipping_city = $order_data['shipping']['city']; $order_shipping_state = $order_data['shipping']['state']; $order_shipping_postcode = $order_data['shipping']['postcode']; $order_shipping_country = $order_data['shipping']['country']; $order_shipping_phone = $order_data['billing']['phone']; $order_shipping_email = $order_data['billing']['email']; $general_settings = get_option('hitshippo_fedex_main_settings',array()); $items = $order->get_items(); $pack_products = array(); $total_weg = 0; //weight conversion wc_get_weight( $weight, $to_unit, $from_unit ) // $general_settings = get_option('hit_ups_auto_main_settings',array()); $woo_weg_unit = get_option('woocommerce_weight_unit'); $woo_dim_unit = get_option('woocommerce_dimension_unit'); $config_weg_unit = $general_settings['hitshippo_fedex_weight_unit']; $mod_weg_unit = (!empty($config_weg_unit) && $config_weg_unit == 'LB_IN') ? 'lbs' : 'kg'; $mod_dim_unit = (!empty($config_weg_unit) && $config_weg_unit == 'LB_IN') ? 'in' : 'cm'; foreach ( $items as $item ) { $product_data = $item->get_data(); $product = array(); $product['product_name'] = $product_data['name']; $product['product_quantity'] = $product_data['quantity']; $product_variation_id = $item->get_variation_id(); if(empty($product_variation_id)){ $getproduct = wc_get_product( $product_data['product_id'] ); }else{ $getproduct = wc_get_product( $product_variation_id ); } $product['price'] = $getproduct->get_price(); $product['width'] = round(wc_get_dimension($getproduct->get_width(),$mod_dim_unit,$woo_dim_unit)); $product['height'] = round(wc_get_dimension($getproduct->get_height(),$mod_dim_unit,$woo_dim_unit)); $product['depth'] = round(wc_get_dimension($getproduct->get_length(),$mod_dim_unit,$woo_dim_unit)); $product['weight'] = (float)round(wc_get_weight($getproduct->get_weight(),$mod_weg_unit,$woo_weg_unit),2); $total_weg += $product['weight']; $pack_products[] = $product; } $ship_content = !empty($general_settings['hitshippo_fedex_shipment_content']) ? $general_settings['hitshippo_fedex_shipment_content'] : 'Shipment Content'; if(!empty($general_settings) && isset($general_settings['hitshippo_fedex_shippo_int_key'])){ $mode = 'live'; if(isset($general_settings['hitshippo_fedex_test']) && $general_settings['hitshippo_fedex_test']== 'yes'){ $mode = 'test'; } $execution = 'manual'; if(isset($general_settings['hitshippo_fedex_shippo_label_gen']) && $general_settings['hitshippo_fedex_shippo_label_gen']== 'yes'){ $execution = 'auto'; } $acc_rates = ($general_settings['hitshippo_fedex_account_rates'] == 'yes') ? 'LIST' : 'NONE'; $residental_del = ($general_settings['hitshippo_fedex_res_f'] == 'yes') ? 'true' : 'false'; $data = array(); $data['integrated_key'] = $general_settings['hitshippo_fedex_shippo_int_key']; $data['order_id'] = $order_id; $data['exec_type'] = $execution; $data['mode'] = $mode; $data['ship_price'] = $order_data['shipping_total']; $data['meta'] = array( "site_id" => $general_settings['hitshippo_fedex_site_id'], "password" => $general_settings['hitshippo_fedex_site_pwd'], "accountnum" => $general_settings['hitshippo_fedex_acc_no'], "meternum" => $general_settings['hitshippo_fedex_access_key'], "t_company" => $order_shipping_company, "t_address1" => $order_shipping_address_1, "t_address2" => $order_shipping_address_2, "t_city" => $order_shipping_city, "t_state" => $order_shipping_state, "t_postal" => $order_shipping_postcode, "t_country" => $order_shipping_country, "t_name" => $order_shipping_first_name . ' '. $order_shipping_last_name, "t_phone" => $order_shipping_phone, "t_email" => $order_shipping_email, "residential" => $residental_del, "drop_off_type" => $general_settings['hitshippo_fedex_drop_off'], "packing_type" => $general_settings['hitshippo_fedex_ship_pack_type'], "shipping_charge" => $shipping_charge, "products" => $pack_products, "pack_algorithm" => $general_settings['hitshippo_fedex_packing_type'], "max_weight" => $general_settings['hitshippo_fedex_max_weight'], "wight_dim_unit" => $general_settings['hitshippo_fedex_weight_unit'], "total_product_weg" => $total_weg, "service_code" => $service_code, //'PRIORITY_OVERNIGHT' "shipment_content" => $ship_content, "s_company" => $general_settings['hitshippo_fedex_company'], "s_address1" => $general_settings['hitshippo_fedex_address1'], "s_address2" => $general_settings['hitshippo_fedex_address2'], "s_city" => $general_settings['hitshippo_fedex_city'], "s_state" => $general_settings['hitshippo_fedex_state'], "s_postal" => $general_settings['hitshippo_fedex_zip'], "s_country" => $general_settings['hitshippo_fedex_country'], // "gstin" => $general_settings['a2z_dhlexpress_gstin'], "s_name" => $general_settings['hitshippo_fedex_shipper_name'], "s_phone" => $general_settings['hitshippo_fedex_mob_num'], "s_email" => $general_settings['hitshippo_fedex_email'], "label_format" => "PDF", "label_format_type" => $general_settings['hitshippo_fedex_label_format_type'], "label_size" => $general_settings['hitshippo_fedex_label_size'], "account_rates" => $acc_rates, "sent_email_to" => $general_settings['hitshippo_fedex_shippo_mail'], ); // echo '
';
					  // print_r($data);
					  // die();
					
					$curl = curl_init();
							curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode( $data));
							curl_setopt_array($curl, array(
								CURLOPT_URL            => "https://shipo.hitstacks.com/api/fedex_order.php",
								// CURLOPT_URL            => "localhost/hitshippo/api/fedex_order.php",
								CURLOPT_RETURNTRANSFER => false,
								CURLOPT_POST 		   => true,
								CURLOPT_USERAGENT 	   => 'api',
								CURLOPT_FORBID_REUSE 	   => true,
								CURLOPT_MAXREDIRS      => 10,
								CURLOPT_HEADER         => false,
								CURLOPT_TIMEOUT        => 30,
								CURLOPT_CONNECTTIMEOUT        => 1,
								CURLOPT_DNS_CACHE_TIMEOUT        => 10,
								CURLOPT_FRESH_CONNECT        => true,
								CURLOPT_CUSTOMREQUEST  => 'POST',
							));

							
					    curl_exec($curl);   

					    curl_close($curl);

					// if($output && isset($output['sttaus'])){
						
					// }
				}
		}

		public function hitshippo_create_fedex_shipping($order_id){
			$post = get_post($order_id);
		    	if($post->post_type !='shop_order' ){
		    		return;
		    	}
		    	
		    	if (  isset( $_POST[ 'hitshippo_fedex_reset' ] ) ) {
		    		delete_option('hitshippo_fedex_values_'.$order_id);
		    	}
		        $general_settings = get_option('a2z_fedex_main_settings',array());
		    	if (isset($_POST['hitshippo_fedex_create_label'])) {
		    		$service_code = $_POST['hitshippo_fedex_service_code'];
		        	$ship_content = !empty($_POST['hit_dhl_shipment_content']) ? $_POST['hit_dhl_shipment_content'] : 'Shipment Content';
					$order = wc_get_order( $order_id );
			       if($order){
		        	$order_data = $order->get_data();

		       		$order_id = $order_data['id'];
		       		$order_currency = $order_data['currency'];

		       		$order_shipping_first_name = $order_data['shipping']['first_name'];
					$order_shipping_last_name = $order_data['shipping']['last_name'];
					$order_shipping_company = empty($order_data['shipping']['company']) ? $order_data['shipping']['first_name'] :  $order_data['shipping']['company'];
					$order_shipping_address_1 = $order_data['shipping']['address_1'];
					$order_shipping_address_2 = $order_data['shipping']['address_2'];
					$order_shipping_city = $order_data['shipping']['city'];
					$order_shipping_state = $order_data['shipping']['state'];
					$order_shipping_postcode = $order_data['shipping']['postcode'];
					$order_shipping_country = $order_data['shipping']['country'];
					$order_shipping_phone = $order_data['billing']['phone'];
					$order_shipping_email = $order_data['billing']['email'];
					$shipping_charge = $order_data['shipping_total'];

					$items = $order->get_items();
					$pack_products = array();
					$total_weg = 0;
					$general_settings = get_option('hitshippo_fedex_main_settings',array());

				//weight conversion wc_get_weight( $weight, $to_unit, $from_unit )
				// $general_settings = get_option('hit_ups_auto_main_settings',array());
				$woo_weg_unit = get_option('woocommerce_weight_unit');
				$woo_dim_unit = get_option('woocommerce_dimension_unit');
				$config_weg_unit = $general_settings['hitshippo_fedex_weight_unit'];
				$mod_weg_unit = (!empty($config_weg_unit) && $config_weg_unit == 'LB_IN') ? 'lbs' : 'kg';
				$mod_dim_unit = (!empty($config_weg_unit) && $config_weg_unit == 'LB_IN') ? 'in' : 'cm';
					
					foreach ( $items as $item ) {
						$product_data = $item->get_data();
					    $product = array();
					    $product['product_name'] = $product_data['name'];
					    $product['product_quantity'] = $product_data['quantity'];

					    $product_variation_id = $item->get_variation_id();
					    if(empty($product_variation_id)){
					    	$getproduct = wc_get_product( $product_data['product_id'] );
					    }else{
					    	$getproduct = wc_get_product( $product_variation_id );
					    }
					    
						$product['price'] = $getproduct->get_price();
						$product['width'] = round(wc_get_dimension($getproduct->get_width(),$mod_dim_unit,$woo_dim_unit));
				    	$product['height'] = round(wc_get_dimension($getproduct->get_height(),$mod_dim_unit,$woo_dim_unit));
				   		$product['depth'] = round(wc_get_dimension($getproduct->get_length(),$mod_dim_unit,$woo_dim_unit));
						$product['weight'] = (float)round(wc_get_weight($getproduct->get_weight(),$mod_weg_unit,$woo_weg_unit),2);
						$total_weg += $product['weight'];
					   
					    $pack_products[] = $product;
					    
					}
					
			    	
					if(!empty($general_settings) && isset($general_settings['hitshippo_fedex_shippo_int_key'])){
						$mode = 'live';
						if(isset($general_settings['hitshippo_fedex_test']) && $general_settings['hitshippo_fedex_test']== 'yes'){
							$mode = 'test';
						}
						$execution = 'manual';
						if(isset($general_settings['hitshippo_fedex_shippo_label_gen']) && $general_settings['hitshippo_fedex_shippo_label_gen']== 'yes'){
							$execution = 'auto';
						}

						$acc_rates = ($general_settings['hitshippo_fedex_account_rates'] == 'yes') ? 'LIST' : 'NONE';
						$residental_del = ($general_settings['hitshippo_fedex_res_f'] == 'yes') ? 'true' : 'false';

						$data = array();
						$data['integrated_key'] = $general_settings['hitshippo_fedex_shippo_int_key'];
						$data['order_id'] = $order_id;
						$data['exec_type'] = $execution;
						$data['mode'] = $mode;
						$data['ship_price'] = $shipping_charge;
						$data['meta'] = array(
							"site_id" => $general_settings['hitshippo_fedex_site_id'],
							"password"  => $general_settings['hitshippo_fedex_site_pwd'],
							"accountnum" => $general_settings['hitshippo_fedex_acc_no'],
							"meternum" => $general_settings['hitshippo_fedex_access_key'],
							"t_company" => $order_shipping_company,
							"t_address1" => $order_shipping_address_1,
							"t_address2" => $order_shipping_address_2,
							"t_city" => $order_shipping_city,
							"t_state" => $order_shipping_state,
							"t_postal" => $order_shipping_postcode,
							"t_country" => $order_shipping_country,
							"t_name" => $order_shipping_first_name . ' '. $order_shipping_last_name,
							"t_phone" => $order_shipping_phone,
							"t_email" => $order_shipping_email,
							"residential" => $residental_del,
							"drop_off_type" => $general_settings['hitshippo_fedex_drop_off'],
							"packing_type" => $general_settings['hitshippo_fedex_ship_pack_type'],
							"shipping_charge" => $shipping_charge,
							"products" => $pack_products,
							"pack_algorithm" => $general_settings['hitshippo_fedex_packing_type'],
							"max_weight" => $general_settings['hitshippo_fedex_max_weight'],
							"wight_dim_unit" => $general_settings['hitshippo_fedex_weight_unit'],
							"total_product_weg" => $total_weg,
							"service_code" => $service_code,	//'PRIORITY_OVERNIGHT'
							"shipment_content" => $ship_content,
							"s_company" => $general_settings['hitshippo_fedex_company'],
							"s_address1" => $general_settings['hitshippo_fedex_address1'],
							"s_address2" => $general_settings['hitshippo_fedex_address2'],
							"s_city" => $general_settings['hitshippo_fedex_city'],
							"s_state" => $general_settings['hitshippo_fedex_state'],
							"s_postal" => $general_settings['hitshippo_fedex_zip'],
							"s_country" => $general_settings['hitshippo_fedex_country'],
							// "gstin" => $general_settings['a2z_dhlexpress_gstin'],
							"s_name" => $general_settings['hitshippo_fedex_shipper_name'],
							"s_phone" => $general_settings['hitshippo_fedex_mob_num'],
							"s_email" => $general_settings['hitshippo_fedex_email'],
							"label_format" => "PDF",
							"label_format_type" => $general_settings['hitshippo_fedex_label_format_type'],
							"label_size" => $general_settings['hitshippo_fedex_label_size'],
							"account_rates" => $acc_rates,
							"sent_email_to" => $general_settings['hitshippo_fedex_shippo_mail'],
						);

						 // echo '
';
						 // print_r($data);
						 // die();
						
						$curl = curl_init();
								curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode( $data));
								curl_setopt_array($curl, array(
									CURLOPT_URL            => "https://shipo.hitstacks.com/api/fedex_manual.php",
									// CURLOPT_URL            => "localhost/hitshippo/api/fedex_manual.php",
									CURLOPT_RETURNTRANSFER => true,
									CURLOPT_ENCODING       => "",
									CURLOPT_MAXREDIRS      => 10,
									CURLOPT_HEADER         => false,
									CURLOPT_TIMEOUT        => 60,
									CURLOPT_HTTP_VERSION   => CURL_HTTP_VERSION_1_1,
									CURLOPT_CUSTOMREQUEST  => 'POST',
								));

						$output = json_decode(curl_exec($curl),true);
// echo '
';
// print_r($output);
// die();
								if($output){
									if(isset($output['status'])){

										if(isset($output['status']) && $output['status'] != 'success'){
											   update_option('hitshippo_fedex_status_'.$order_id, $output['status']);

										}else if(isset($output['status']) && $output['status'] == 'success'){

											update_option('hitshippo_fedex_values_'.$order_id, json_encode($output));
											update_option('hitshippo_fedex_status_'.$order_id, $output['status']);
										}
									}else{
										update_option('hitshippo_fedex_status_'.$order_id, 'Site not Connected with HITStacks. Contact HITStacks Team.');
									}
								}else{
									update_option('hitshippo_fedex_status_'.$order_id, 'Site not Connected with HITStacks. Contact HITStacks Team.');
								}

			    	}
			}

		}
		}
		
	}
	new hitshippo_fedex_parent();
}
}