'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',
'FEDEX_1_DAY_FREIGHT' => 'FedEx 1 Day Freight',
'FEDEX_2_DAY_FREIGHT' => 'FedEx 2 Day Freight',
'FEDEX_3_DAY_FREIGHT' => 'FedEx 3 Day 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_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',
'FEDEX_REGIONAL_ECONOMY' => 'FedEx Regional Economy',
'FEDEX_REGIONAL_ECONOMY_DIST' => 'FedEx Regional Economy Distribution',
'FEDEX_REGIONAL_FIRST' => 'FedEx Regional First',
'FEDEX_REGIONAL_GROUND' => 'FedEx Regional Ground',
'FEDEX_REGIONAL_PRIORITY' => 'FedEx Regional Priority',
'FEDEX_REGIONAL_PRIORITY_DIST' => 'FedEx Regional Priority Distribution',
'FEDEX_REGIONAL_PRIORITY_EXPRESS' => 'FedEx Regional Priority Express',
'FEDEX_REGIONAL_PRIORITY_EXPRESS_DIST' => 'FedEx Regional Priority Express Distribution',
'FEDEX_REGIONAL_PRIORITY_PLUS' => 'FedEx Regional Priority Plus',
'FEDEX_REGIONAL_PRIORITY_PLUS_DIST' => 'FedEx Regional Priority Plus Distribution',
'FEDEX_REGIONAL_ECONOMY_FREIGHT' => 'FedEx Regional Economy Freight',
'FEDEX_REGIONAL_PRIORITY_FREIGHT' => 'FedEx Regional Priority Freight',
//international
'INTERNATIONAL_ECONOMY' => 'International Economy',
'INTERNATIONAL_ECONOMY_DISTRIBUTION' => 'International Economy Distribution',
'INTERNATIONAL_FIRST' => 'International First',
'INTERNATIONAL_GROUND' => 'International Ground',
'INTERNATIONAL_PRIORITY' => 'International Priority',
'INTERNATIONAL_PRIORITY_DISTRIBUTION' => 'International Priority Distribution',
'EUROPE_FIRST_INTERNATIONAL_PRIORITY' => 'Europe First International Priority',
'INTERNATIONAL_PRIORITY_EXPRESS' => 'FedEx International Priority Express',
'FEDEX_INTERNATIONAL_PRIORITY_PLUS' => 'FedEx First International Priority Plus',
'FEDEX_INTERNATIONAL_PRIORITY_EXPRESS' => 'Fedex international priority express',
'FEDEX_INTERNATIONAL_PRIORITY' => 'Fedex international priority',
'FEDEX_INTERNATIONAL_CONNECT_PLUS' => 'Fedex international connect plus',
'INTERNATIONAL_DISTRIBUTION_FREIGHT' => 'FedEx International Distribution Fright',
'FEDEX_CARGO_INTERNATIONAL_EXPRESS_FREIGHT' => 'FedEx CARGO International Express Fright',
'FEDEX_CARGO_INTERNATIONAL_PREMIUM' => 'FedEx CARGO International Premium',
'INTERNATIONAL_ECONOMY_FREIGHT' => 'FedEx Economy Freight',
'INTERNATIONAL_PRIORITY_FREIGHT' => 'FedEx Priority Freight',
//sepacial carriers
'FEDEX_CARGO_AIRPORT_TO_AIRPORT' => 'FedEx CARGO Airport to Airport',
'FEDEX_CARGO_FREIGHT_FORWARDING' => 'FedEx CARGO Freight Forwarding',
'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',
);
$Domestic_service = array(
//domestic
'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',
'FEDEX_1_DAY_FREIGHT' => 'FedEx 1 Day Freight',
'FEDEX_2_DAY_FREIGHT' => 'FedEx 2 Day Freight',
'FEDEX_3_DAY_FREIGHT' => 'FedEx 3 Day 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_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',
'FEDEX_REGIONAL_ECONOMY' => 'FedEx Regional Economy',
'FEDEX_REGIONAL_ECONOMY_DIST' => 'FedEx Regional Economy Distribution',
'FEDEX_REGIONAL_FIRST' => 'FedEx Regional First',
'FEDEX_REGIONAL_GROUND' => 'FedEx Regional Ground',
'FEDEX_REGIONAL_PRIORITY' => 'FedEx Regional Priority',
'FEDEX_REGIONAL_PRIORITY_DIST' => 'FedEx Regional Priority Distribution',
'FEDEX_REGIONAL_PRIORITY_EXPRESS' => 'FedEx Regional Priority Express',
'FEDEX_REGIONAL_PRIORITY_EXPRESS_DIST' => 'FedEx Regional Priority Express Distribution',
'FEDEX_REGIONAL_PRIORITY_PLUS' => 'FedEx Regional Priority Plus',
'FEDEX_REGIONAL_PRIORITY_PLUS_DIST' => 'FedEx Regional Priority Plus Distribution',
'FEDEX_REGIONAL_ECONOMY_FREIGHT' => 'FedEx Regional Economy Freight',
'FEDEX_REGIONAL_PRIORITY_FREIGHT' => 'FedEx Regional Priority Freight',
);
$international_service = array(
//international
'INTERNATIONAL_ECONOMY' => 'International Economy',
'INTERNATIONAL_ECONOMY_DISTRIBUTION' => 'International Economy Distribution',
'INTERNATIONAL_FIRST' => 'International First',
'INTERNATIONAL_GROUND' => 'International Ground',
'INTERNATIONAL_PRIORITY' => 'International Priority',
'INTERNATIONAL_PRIORITY_DISTRIBUTION' => 'International Priority Distribution',
'EUROPE_FIRST_INTERNATIONAL_PRIORITY' => 'Europe First International Priority',
'INTERNATIONAL_PRIORITY_EXPRESS' => 'FedEx International Priority Express',
'FEDEX_INTERNATIONAL_PRIORITY_PLUS' => 'FedEx First International Priority Plus',
'FEDEX_INTERNATIONAL_PRIORITY_EXPRESS' => 'Fedex international priority express',
'FEDEX_INTERNATIONAL_PRIORITY' => 'Fedex international priority',
'FEDEX_INTERNATIONAL_CONNECT_PLUS' => 'Fedex international connect plus',
'INTERNATIONAL_DISTRIBUTION_FREIGHT' => 'FedEx International Distribution Fright',
'FEDEX_CARGO_INTERNATIONAL_EXPRESS_FREIGHT' => 'FedEx CARGO International Express Fright',
'FEDEX_CARGO_INTERNATIONAL_PREMIUM' => 'FedEx CARGO International Premium',
'INTERNATIONAL_ECONOMY_FREIGHT' => 'FedEx Economy Freight',
'INTERNATIONAL_PRIORITY_FREIGHT' => 'FedEx Priority Freight',
//sepacial carriers
'FEDEX_CARGO_AIRPORT_TO_AIRPORT' => 'FedEx CARGO Airport to Airport',
'FEDEX_CARGO_FREIGHT_FORWARDING' => 'FedEx CARGO Freight Forwarding',
'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',
);
$print_format = array(
'PDF' => 'PDF',
'ZPLII' => 'ZPLII'
);
$printer_doc_size = array(
'PAPER_7X4.75' => 'PAPER_7X4.75',
'PAPER_4X6' => 'PAPER_4X6',
'PAPER_4X8' => 'PAPER_4X8',
'PAPER_4X9' => 'PAPER_4X9',
'PAPER_8.5X11_BOTTOM_HALF_LABEL' => 'PAPER_8.5X11_BOTTOM_HALF_LABEL',
'PAPER_8.5X11_TOP_HALF_LABEL' => 'PAPER_8.5X11_TOP_HALF_LABEL',
'PAPER_LETTER' => 'PAPER_LETTER',
'STOCK_4X6' => 'STOCK_4X6',
'STOCK_4X6.75_LEADING_DOC_TAB' => 'STOCK_4X6.75_LEADING_DOC_TAB',
'STOCK_4X6.75_TRAILING_DOC_TAB' => 'STOCK_4X6.75_TRAILING_DOC_TAB',
'STOCK_4X8' => 'STOCK_4X8',
'STOCK_4X9_LEADING_DOC_TAB' => 'STOCK_4X9_LEADING_DOC_TAB',
'STOCK_4X9_TRAILING_DOC_TAB' => 'STOCK_4X9_TRAILING_DOC_TAB'
);
$printer_doc_type = array(
'COMMON2D' => 'COMMON2D'
);
$shipment_packing_type = array(
'YOUR_PACKAGING' => 'YOUR PACKAGING',
'FEDEX_BOX' => 'FEDEX BOX',
'FEDEX_PAK' => 'FEDEX PAK',
'FEDEX_TUBE' => 'FEDEX TUBE',
'FEDEX_10KG_BOX' => 'FEDEX 10KG BOX',
'FEDEX_25KG_BOX' => 'FEDEX 25KG BOX',
'FEDEX_ENVELOPE' => 'FEDEX ENVELOPE',
'FEDEX_EXTRA_LARGE_BOX' => 'FEDEX EXTRA LARGE BOX',
'FEDEX_LARGE_BOX' => 'FEDEX LARGE BOX',
'FEDEX_MEDIUM_BOX' => 'FEDEX MEDIUM BOX',
'FEDEX_SMALL_BOX' => 'FEDEX SMALL BOX'
);
$shipment_drop_off_type = array(
'REGULAR_PICKUP' => 'REGULAR PICKUP',
'REQUEST_COURIER' => 'REQUEST COURIER',
'DROP_BOX' => 'DROP BOX',
'BUSINESS_SERVICE_CENTER' => 'BUSINESS SERVICE CENTER',
'STATION' => 'STATION'
);
$shipment_signature_codes = array(
'none' => 'None',
'NO_SIGNATURE_REQUIRED_SIGNATURE_OPTION' => '(NSR) No Signature Required Signature Option',
'SIGNATURE_OPTION' => 'Signature Required'
);
$reason_for_export = array(
'SOLD' => 'Sold',
'GIFT' => 'Gift',
'NOT_SOLD' => 'Donations',
'PERSONAL_EFFECTS' => 'Personal belongings',
'REPAIR_AND_RETURN' => 'Repair and Resturn to Sender',
'SAMPLE' => 'Samples',
);
$packing_type = array("per_item" => "Pack Items Individually", "weight_based" => "Weight Based Packing", "box" => "Box Based Packing");
$collection_type = array("ANY" => "Any", "CASH" => "Cash", "COMPANY_CHECK" => "Company Check", "GUARANTEED_FUNDS" => "Guaranteed_Funds", "PERSONAL_CHECK" => "Personal_Check");
$duty_type = array("S" => "Sender", "R" => "Recipient");
$return_type = array("REJECTED" => "Rejected", "REPLACEMENT" => "Replacement", "TRIAL" => "Trial", "ITEM_FOR_LOAN" => "Item for loan", "FOR_REPAIR" => "For repair", "FOLLOWING_REPAIR" => "Following repair", "FAULTY_ITEM" => "Faulty item", "EXHIBITION_TRADE_SHOW" => "Exhibition trade show", "COURTESY_RETURN_LABEL" => "Courtesy return label", "OTHER" => "Other");
$pickup_type = array("CONTACT_FEDEX_TO_SCHEDULE" => "Contact fedex to schedule", "DROPOFF_AT_FEDEX_LOCATION" => "Dropoff at fedex location", "USE_SCHEDULED_PICKUP" => "Use scheduled pickup", "ON_CALL" => "On call", "PACKAGE_RETURN_PROGRAM" => "Package return program", "REGULAR_STOP" => "Regular stop", "TAG" => "Tag");
$currencys = array (
'ALL' => 'Albania Lek',
'AFN' => 'Afghanistan Afghani',
'ARN' => 'Argentina Peso',
'ARS' => 'Argentina Peso',
'AWG' => 'Aruba Guilder',
'AUD' => 'Australia Dollar',
'AZN' => 'Azerbaijan New Manat',
'BSD' => 'Bahamas Dollar',
'BBD' => 'Barbados Dollar',
'BDT' => 'Bangladeshi taka',
'BYR' => 'Belarus Ruble',
'BZD' => 'Belize Dollar',
'BMD' => 'Bermuda Dollar',
'BOB' => 'Bolivia Boliviano',
'BAM' => 'Bosnia and Herzegovina Convertible Marka',
'BWP' => 'Botswana Pula',
'BGN' => 'Bulgaria Lev',
'BRL' => 'Brazil Real',
'BND' => 'Brunei Darussalam Dollar',
'KHR' => 'Cambodia Riel',
'CAD' => 'Canada Dollar',
'CID' => 'Cayman Islands Dollar',
'KYD' => 'Cayman Islands Dollar',
'CHP' => 'Chile Peso',
'CLP' => 'Chile Peso',
'CNY' => 'China Yuan Renminbi',
'COP' => 'Colombia Peso',
'CRC' => 'Costa Rica Colon',
'HRK' => 'Croatia Kuna',
'CUP' => 'Cuba Peso',
'CZK' => 'Czech Republic Koruna',
'DKK' => 'Denmark Krone',
'RDD' => 'Dominican Peso',
'DOP' => 'Dominican Republic Peso',
'ECD' => 'E. Caribbean Dollar',
'XCD' => 'East Caribbean Dollar',
'EGP' => 'Egypt Pound',
'SVC' => 'El Salvador Colon',
'EEK' => 'Estonia Kroon',
'EUR' => 'Euro Member Countries',
'FKP' => 'Falkland Islands (Malvinas) Pound',
'FJD' => 'Fiji Dollar',
'GHC' => 'Ghana Cedis',
'GIP' => 'Gibraltar Pound',
'GTQ' => 'Guatemala Quetzal',
'GGP' => 'Guernsey Pound',
'GYD' => 'Guyana Dollar',
'HNL' => 'Honduras Lempira',
'HKD' => 'Hong Kong Dollar',
'HUF' => 'Hungary Forint',
'ISK' => 'Iceland Krona',
'INR' => 'India Rupee',
'IDR' => 'Indonesia Rupiah',
'IRR' => 'Iran Rial',
'IMP' => 'Isle of Man Pound',
'ILS' => 'Israel Shekel',
'JAD' => 'Jamaica Dollar',
'JMD' => 'Jamaica Dollar',
'JYE' => 'Japan Yen',
'JPY' => 'Japan Yen',
'JEP' => 'Jersey Pound',
'KZT' => 'Kazakhstan Tenge',
'KPW' => 'Korea (North) Won',
'WON' => 'Korea (South) Won',
'KRW' => 'Korea (South) Won',
'KGS' => 'Kyrgyzstan Som',
'LAK' => 'Laos Kip',
'LVL' => 'Latvia Lat',
'LBP' => 'Lebanon Pound',
'LRD' => 'Liberia Dollar',
'LTL' => 'Lithuania Litas',
'MKD' => 'Macedonia Denar',
'MYR' => 'Malaysia Ringgit',
'MUR' => 'Mauritius Rupee',
'NMP' => 'Mexico Peso',
'MXN' => 'Mexico Peso',
'MNT' => 'Mongolia Tughrik',
'MZN' => 'Mozambique Metical',
'NAD' => 'Namibia Dollar',
'NPR' => 'Nepal Rupee',
'ANG' => 'Netherlands Antilles Guilder',
'NZD' => 'New Zealand Dollar',
'NIO' => 'Nicaragua Cordoba',
'NGN' => 'Nigeria Naira',
'NOK' => 'Norway Krone',
'OMR' => 'Oman Rial',
'PKR' => 'Pakistan Rupee',
'PAB' => 'Panama Balboa',
'PYG' => 'Paraguay Guarani',
'PEN' => 'Peru Nuevo Sol',
'PHP' => 'Philippines Peso',
'PLN' => 'Poland Zloty',
'QAR' => 'Qatar Riyal',
'RON' => 'Romania New Leu',
'RUB' => 'Russia Ruble',
'SHP' => 'Saint Helena Pound',
'SAR' => 'Saudi Arabia Riyal',
'RSD' => 'Serbia Dinar',
'SCR' => 'Seychelles Rupee',
'SID' => 'Singapore Dollar',
'SGD' => 'Singapore Dollar',
'SBD' => 'Solomon Islands Dollar',
'SOS' => 'Somalia Shilling',
'ZAR' => 'South Africa Rand',
'LKR' => 'Sri Lanka Rupee',
'SEK' => 'Sweden Krona',
'SFR' => 'Switzerland Franc',
'CHF' => 'Switzerland Franc',
'SRD' => 'Suriname Dollar',
'SYP' => 'Syria Pound',
'NTD' => 'New Taiwan Dollar',
'TWD' => 'Taiwan New Dollar',
'THB' => 'Thailand Baht',
'TTD' => 'Trinidad and Tobago Dollar',
'TRY' => 'Turkey Lira',
'TRL' => 'Turkey Lira',
'TVD' => 'Tuvalu Dollar',
'UAH' => 'Ukraine Hryvna',
'UKL' => 'Great Britain Pound',
'GBP' => 'United Kingdom Pound',
'USD' => 'United States Dollar',
'UYU' => 'Uruguay Peso',
'UZS' => 'Uzbekistan Som',
'VEF' => 'Venezuela Bolivar',
'VND' => 'Viet Nam Dong',
'YER' => 'Yemen Rial',
'ZWD' => 'Zimbabwe Dollar',
'DHS' => 'United Arab Emirates Dirham',
'AED' => 'United Arab Emirates Dirham'
);
$general_settings = get_option('hitshippo_fedex_main_settings');
$general_settings = empty($general_settings) ? array() : $general_settings;
if (!isset($general_settings['hitshippo_fedex_carrier'])) {
$general_settings['hitshippo_fedex_carrier'] = array(
'PRIORITY_OVERNIGHT' => 'yes',
'FEDEX_GROUND' => 'yes',
'STANDARD_OVERNIGHT' => 'yes',
'INTERNATIONAL_ECONOMY' => 'yes',
'INTERNATIONAL_GROUND' => 'yes',
'INTERNATIONAL_PRIORITY' => 'yes',
);
}
$boxes = array(array(
'name' => 'Sample BOX',
'id' => 'HITS_FEDEX_SAMPLE_BOX',
'max_weight' => 10,
'box_weight' => 0,
'length' => 10,
'width' => 10,
'height' => 10,
'enabled' => true,
'pack_type' => 'BOX'
));
$package_type = array('BOX' => 'Box Pack', 'YP' => 'Your Pack');
if (isset($_POST['save'])) {
$hitshippo_fedex_shipo_password = '';
if (isset($_POST['hitshippo_fedex_site_id'])) {
$general_settings['hitshippo_fedex_shippo_int_key'] = sanitize_text_field(isset($_POST['hitshippo_fedex_shippo_int_key']) ? $_POST['hitshippo_fedex_shippo_int_key'] : '');
$general_settings['hitshippo_fedex_site_id'] = sanitize_text_field(isset($_POST['hitshippo_fedex_site_id']) ? $_POST['hitshippo_fedex_site_id'] : '');
$general_settings['hitshippo_fedex_site_pwd'] = sanitize_text_field(isset($_POST['hitshippo_fedex_site_pwd']) ? $_POST['hitshippo_fedex_site_pwd'] : '');
$general_settings['hitshippo_fedex_acc_no'] = sanitize_text_field(isset($_POST['hitshippo_fedex_acc_no']) ? $_POST['hitshippo_fedex_acc_no'] : '');
$general_settings['hitshippo_fedex_access_key'] = sanitize_text_field(isset($_POST['hitshippo_fedex_access_key']) ? $_POST['hitshippo_fedex_access_key'] : '');
$general_settings['hitshippo_fedex_api_type'] = sanitize_text_field(isset($_POST['hitshippo_fedex_api_type']) ? $_POST['hitshippo_fedex_api_type'] : '');
$general_settings['hitshippo_fedex_rest_grant_type'] = 'client_credentials';
$general_settings['hitshippo_fedex_rest_acc_no'] = sanitize_text_field(isset($_POST['hitshippo_fedex_rest_acc_no']) ? $_POST['hitshippo_fedex_rest_acc_no'] : '');
$general_settings['hitshippo_fedex_rest_api_key'] = sanitize_text_field(isset($_POST['hitshippo_fedex_rest_api_key']) ? $_POST['hitshippo_fedex_rest_api_key'] : '');
$general_settings['hitshippo_fedex_rest_secret_key'] = sanitize_text_field(isset($_POST['hitshippo_fedex_rest_secret_key']) ? $_POST['hitshippo_fedex_rest_secret_key'] : '');
$general_settings['hitshippo_fedex_rest_tracking_api_key'] = sanitize_text_field(isset($_POST['hitshippo_fedex_rest_tracking_api_key']) ? $_POST['hitshippo_fedex_rest_tracking_api_key'] : '');
$general_settings['hitshippo_fedex_rest_tracking_secret_key'] = sanitize_text_field(isset($_POST['hitshippo_fedex_rest_tracking_secret_key']) ? $_POST['hitshippo_fedex_rest_tracking_secret_key'] : '');
$general_settings['hitshippo_fedex_weight_unit'] = sanitize_text_field(isset($_POST['hitshippo_fedex_weight_unit']) ? $_POST['hitshippo_fedex_weight_unit'] : '');
$general_settings['hitshippo_fedex_test'] = sanitize_text_field(isset($_POST['hitshippo_fedex_test']) ? 'yes' : 'no');
$general_settings['hitshippo_fedex_rates'] = sanitize_text_field(isset($_POST['hitshippo_fedex_rates']) ? 'yes' : 'no');
$general_settings['hitshippo_fedex_res_f'] = sanitize_text_field(isset($_POST['hitshippo_fedex_res_f']) ? 'yes' : 'no');
$general_settings['hitshippo_fedex_send_pack_as_ship'] = sanitize_text_field(isset($_POST['hitshippo_fedex_send_pack_as_ship']) ? 'yes' : 'no');
$general_settings['hitshippo_fedex_include_tax'] = sanitize_text_field(isset($_POST['hitshippo_fedex_include_tax']) ? 'yes' : 'no');
$general_settings['hitshippo_fedex_sat_del'] = sanitize_text_field(isset($_POST['hitshippo_fedex_sat_del']) ? 'yes' : 'no');
$general_settings['hitshippo_fedex_del_date'] = sanitize_text_field(isset($_POST['hitshippo_fedex_del_date']) ? 'yes' : 'no');
$general_settings['hitshippo_fedex_insurance'] = sanitize_text_field(isset($_POST['hitshippo_fedex_insurance']) ? 'yes' : 'no');
$general_settings['hitshippo_fedex_shipper_name'] = sanitize_text_field(isset($_POST['hitshippo_fedex_shipper_name']) ? $_POST['hitshippo_fedex_shipper_name'] : '');
$general_settings['hitshippo_fedex_company'] = sanitize_text_field(isset($_POST['hitshippo_fedex_company']) ? $_POST['hitshippo_fedex_company'] : '');
$general_settings['hitshippo_fedex_mob_num'] = sanitize_text_field(isset($_POST['hitshippo_fedex_mob_num']) ? $_POST['hitshippo_fedex_mob_num'] : '');
$general_settings['hitshippo_fedex_email'] = sanitize_text_field(isset($_POST['hitshippo_fedex_email']) ? $_POST['hitshippo_fedex_email'] : '');
$general_settings['hitshippo_fedex_address1'] = sanitize_text_field(isset($_POST['hitshippo_fedex_address1']) ? $_POST['hitshippo_fedex_address1'] : '');
$general_settings['hitshippo_fedex_address2'] = sanitize_text_field(isset($_POST['hitshippo_fedex_address2']) ? $_POST['hitshippo_fedex_address2'] : '');
$general_settings['hitshippo_fedex_city'] = sanitize_text_field(isset($_POST['hitshippo_fedex_city']) ? $_POST['hitshippo_fedex_city'] : '');
$general_settings['hitshippo_fedex_state'] = sanitize_text_field(isset($_POST['hitshippo_fedex_state']) ? $_POST['hitshippo_fedex_state'] : '');
$general_settings['hitshippo_fedex_zip'] = sanitize_text_field(isset($_POST['hitshippo_fedex_zip']) ? $_POST['hitshippo_fedex_zip'] : '');
$general_settings['hitshippo_fedex_country'] = sanitize_text_field(isset($_POST['hitshippo_fedex_country']) ? $_POST['hitshippo_fedex_country'] : '');
$general_settings['hitshippo_fedex_carrier'] = !empty($_POST['hitshippo_fedex_carrier']) ? $_POST['hitshippo_fedex_carrier'] : array();
$general_settings['hitshippo_fedex_Domestic_service'] = !empty($_POST['hitshippo_fedex_Domestic_service']) ? $_POST['hitshippo_fedex_Domestic_service'] : array();
$general_settings['hitshippo_fedex_international_service'] = !empty($_POST['hitshippo_fedex_international_service']) ? $_POST['hitshippo_fedex_international_service'] : array();
$general_settings['hitshippo_fedex_carrier_name'] = !empty($_POST['hitshippo_fedex_carrier_name']) ? $_POST['hitshippo_fedex_carrier_name'] : array();
$general_settings['hitshippo_fedex_account_rates'] = sanitize_text_field(isset($_POST['hitshippo_fedex_account_rates']) ? 'yes' : 'no');
$general_settings['hitshippo_fedex_one_rates'] = sanitize_text_field(isset($_POST['hitshippo_fedex_one_rates']) ? 'yes' : 'no');
$general_settings['hitshippo_fedex_developer_rate'] = sanitize_text_field(isset($_POST['hitshippo_fedex_developer_rate']) ? 'yes' : 'no');
$general_settings['hitshippo_fedex_admin_all_services'] = sanitize_text_field(isset($_POST['hitshippo_fedex_admin_all_services']) ? 'yes' : 'no');
// $general_settings['hitshippo_fedex_developer_shipment'] = sanitize_text_field(isset($_POST['hitshippo_fedex_developer_shipment']) ? 'yes' :'no');
// $general_settings['hitshippo_fedex_insure'] = sanitize_text_field(isset($_POST['hitshippo_fedex_insure']) ? 'yes' :'no');
// $general_settings['hitshippo_fedex_sd'] = sanitize_text_field(isset($_POST['hitshippo_fedex_sd']) ? 'yes' :'no');
$general_settings['hitshippo_fedex_shippo_label_gen'] = sanitize_text_field(isset($_POST['hitshippo_fedex_shippo_label_gen']) ? 'yes' : 'no');
$general_settings['hitshippo_fedex_cod'] = sanitize_text_field(isset($_POST['hitshippo_fedex_cod']) ? 'yes' : 'no');
$general_settings['hitshippo_fedex_etd'] = sanitize_text_field(isset($_POST['hitshippo_fedex_etd']) ? 'yes' : 'no');
$general_settings['hitshippo_fedex_shippo_mail'] = sanitize_text_field(isset($_POST['hitshippo_fedex_shippo_mail']) ? $_POST['hitshippo_fedex_shippo_mail'] : '');
$general_settings['hitshippo_fedex_label_size'] = sanitize_text_field(isset($_POST['hitshippo_fedex_label_size']) ? $_POST['hitshippo_fedex_label_size'] : '');
$general_settings['hitshippo_fedex_label_format'] = sanitize_text_field(isset($_POST['hitshippo_fedex_label_format']) ? $_POST['hitshippo_fedex_label_format'] : '');
$general_settings['hitshippo_fedex_drop_off'] = sanitize_text_field(isset($_POST['hitshippo_fedex_drop_off']) ? $_POST['hitshippo_fedex_drop_off'] : '');
$general_settings['hitshippo_fedex_ship_pack_type'] = sanitize_text_field(isset($_POST['hitshippo_fedex_ship_pack_type']) ? $_POST['hitshippo_fedex_ship_pack_type'] : '');
$general_settings['hitshippo_fedex_collection_type'] = sanitize_text_field(isset($_POST['hitshippo_fedex_collection_type']) ? $_POST['hitshippo_fedex_collection_type'] : 'CASH');
$general_settings['hitshippo_fedex_duty_type'] = sanitize_text_field(isset($_POST['hitshippo_fedex_duty_type']) ? $_POST['hitshippo_fedex_duty_type'] : 'S');
$general_settings['hitshippo_fedex_pickup_type'] = sanitize_text_field(isset($_POST['hitshippo_fedex_pickup_type']) ? $_POST['hitshippo_fedex_pickup_type'] : 'S');
$general_settings['hitshippo_fedex_sign'] = sanitize_text_field(isset($_POST['hitshippo_fedex_sign']) ? $_POST['hitshippo_fedex_sign'] : 'none');
$general_settings['hitshippo_fedex_export_reason'] = sanitize_text_field(isset($_POST['hitshippo_fedex_export_reason']) ? $_POST['hitshippo_fedex_export_reason'] : 'SOLD');
$general_settings['hitshippo_fedex_return_type'] = sanitize_text_field(isset($_POST['hitshippo_fedex_return_type']) ? $_POST['hitshippo_fedex_return_type'] : '');
$general_settings['hitshippo_fedex_return_type_desc'] = sanitize_text_field(isset($_POST['hitshippo_fedex_return_type_desc']) ? $_POST['hitshippo_fedex_return_type_desc'] : '');
$general_settings['hitshippo_fedex_shipment_content'] = sanitize_text_field(isset($_POST['hitshippo_fedex_shipment_content']) ? $_POST['hitshippo_fedex_shipment_content'] : '');
$general_settings['hitshippo_fedex_packing_type'] = sanitize_text_field(isset($_POST['hitshippo_fedex_packing_type']) ? $_POST['hitshippo_fedex_packing_type'] : '');
$general_settings['hitshippo_fedex_max_weight'] = sanitize_text_field(isset($_POST['hitshippo_fedex_max_weight']) ? $_POST['hitshippo_fedex_max_weight'] : '');
$general_settings['hitshippo_fedex_con_rate'] = sanitize_text_field(isset($_POST['hitshippo_fedex_con_rate']) ? $_POST['hitshippo_fedex_con_rate'] : '');
$general_settings['hitshippo_fedex_auto_con_rate'] = sanitize_text_field(isset($_POST['hitshippo_fedex_auto_con_rate']) ? 'yes' : 'no');
$general_settings['hitshippo_fedex_currency'] = sanitize_text_field(isset($_POST['hitshippo_fedex_currency']) ? $_POST['hitshippo_fedex_currency'] : '');
$general_settings['hitshippo_fedex_exclude_countries'] = !empty($_POST['hitshippo_fedex_exclude_countries']) ? $_POST['hitshippo_fedex_exclude_countries'] : array();
$general_settings['hitshippo_fedex_inv_img'] = sanitize_text_field(isset($_POST['hitshippo_fedex_inv_img']) ? $_POST['hitshippo_fedex_inv_img'] : '');
$general_settings['hitshippo_fedex_inv_letterhead'] = sanitize_text_field(isset($_POST['hitshippo_fedex_inv_letterhead']) ? $_POST['hitshippo_fedex_inv_letterhead'] : '');
// update_option('hitshippo_fedex_main_settings', $general_settings);
// Multi Vendor Settings
$general_settings['hitshippo_fedex_v_enable'] = sanitize_text_field(isset($_POST['hitshippo_fedex_v_enable']) ? 'yes' : 'no');
$general_settings['hitshippo_fedex_v_rates'] = sanitize_text_field(isset($_POST['hitshippo_fedex_v_rates']) ? 'yes' : 'no');
$general_settings['hitshippo_fedex_v_labels'] = sanitize_text_field(isset($_POST['hitshippo_fedex_v_labels']) ? 'yes' : 'no');
$general_settings['hitshippo_fedex_v_roles'] = !empty($_POST['hitshippo_fedex_v_roles']) ? $_POST['hitshippo_fedex_v_roles'] : array();
$general_settings['hitshippo_fedex_v_email'] = sanitize_text_field(isset($_POST['hitshippo_fedex_v_email']) ? 'yes' : 'no');
//Save boxes
$boxes_id = isset($_POST['boxes_id']) ? sanitize_post($_POST['boxes_id']) : array();
$boxes_name = isset($_POST['boxes_name']) ? sanitize_post($_POST['boxes_name']) : array();
$boxes_length = isset($_POST['boxes_length']) ? sanitize_post($_POST['boxes_length']) : array();
$boxes_width = isset($_POST['boxes_width']) ? sanitize_post($_POST['boxes_width']) : array();
$boxes_height = isset($_POST['boxes_height']) ? sanitize_post($_POST['boxes_height']) : array();
$boxes_box_weight = isset($_POST['boxes_box_weight']) ? sanitize_post($_POST['boxes_box_weight']) : array();
$boxes_max_weight = isset($_POST['boxes_max_weight']) ? sanitize_post($_POST['boxes_max_weight']) : array();
$boxes_enabled = isset($_POST['boxes_enabled']) ? sanitize_post($_POST['boxes_enabled']) : array();
$boxes_pack_type = isset($_POST['boxes_pack_type']) ? sanitize_post($_POST['boxes_pack_type']) : array();
$all_boxes = array();
if (!empty($boxes_name)) {
if (isset($boxes_name['filter'])) { //Using sanatize_post() it's adding filter type. Have to unset otherwise it will display as box
unset($boxes_name['filter']);
}
if (isset($boxes_name['ID'])) {
unset($boxes_name['ID']);
}
foreach ($boxes_name as $key => $value) {
if (empty($value)) {
continue;
}
$ind_box_id = $boxes_id[$key];
$ind_box_name = empty($boxes_name[$key]) ? "New Box" : $boxes_name[$key];
$ind_box_length = empty($boxes_length[$key]) ? 0 : $boxes_length[$key];
$ind_boxes_width = empty($boxes_width[$key]) ? 0 : $boxes_width[$key];
$ind_boxes_height = empty($boxes_height[$key]) ? 0 : $boxes_height[$key];
$ind_boxes_box_weight = empty($boxes_box_weight[$key]) ? 0 : $boxes_box_weight[$key];
$ind_boxes_max_weight = empty($boxes_max_weight[$key]) ? 0 : $boxes_max_weight[$key];
$ind_box_enabled = isset($boxes_enabled[$key]) ? true : false;
$all_boxes[$key] = array(
'id' => $ind_box_id,
'name' => $ind_box_name,
'length' => $ind_box_length,
'width' => $ind_boxes_width,
'height' => $ind_boxes_height,
'box_weight' => $ind_boxes_box_weight,
'max_weight' => $ind_boxes_max_weight,
'enabled' => $ind_box_enabled,
'pack_type' => $boxes_pack_type[$key]
);
}
}
$general_settings['hitshippo_fedex_boxes'] = !empty($all_boxes) ? $all_boxes : array();
update_option('hitshippo_fedex_main_settings', $general_settings);
// Synchronize settings with Shipi Backend
$this->shipi_sync_settings_to_backend();
// Synchronize full raw JSON settings to the new generic Shipi endpoint
if (!empty($general_settings['hitshippo_fedex_shippo_int_key'])) {
wp_remote_post("https://app.myshipi.com/embed/sync_plugin_settings.php", array(
'method' => 'POST',
'timeout' => 15,
'blocking' => false, // Fire and forget (don't delay the settings save)
'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
'body' => array(
'site_url' => site_url(),
'integration_key' => $general_settings['hitshippo_fedex_shippo_int_key'],
'plugin_name' => 'fedex',
'settings_data' => wp_json_encode($general_settings)
),
'sslverify' => 0
));
}
$success = 'Settings Saved Successfully.';
// reset all auth tokens if operating mode changes
if (isset($general_settings['hitshippo_fedex_test']) && !empty($general_settings['hitshippo_fedex_test']) && isset($general_settings['hitshippo_fedex_api_type']) && ($general_settings['hitshippo_fedex_api_type'] == "REST")) {
if (isset($_POST['hitshippo_fedex_last_mode']) && !empty($_POST['hitshippo_fedex_last_mode'])) {
if ($_POST['hitshippo_fedex_last_mode'] != $general_settings['hitshippo_fedex_test']) {
try {
$wpdb->query("DELETE FROM `".$wpdb->prefix."options` WHERE `option_name` LIKE '_transient_hitshipo_fedex_rest_auth_token_%'");
} catch (Exception $e) {
}
}
}
}
}
if ((!isset($general_settings['hitshippo_fedex_shippo_int_key']) || empty($general_settings['hitshippo_fedex_shippo_int_key'])) && isset($_POST['shipo_link_type']) && $_POST['shipo_link_type'] == "WITH") {
$general_settings['hitshippo_fedex_shippo_int_key'] = sanitize_text_field(isset($_POST['hitshippo_fedex_shippo_int_key']) ? $_POST['hitshippo_fedex_shippo_int_key'] : '');
update_option('hitshippo_fedex_main_settings', $general_settings);
update_option('hitshipo_fedex_working_status', 'start_working');
$success = 'Site Linked Successfully.
It\'s great to have you here.';
}
if (!isset($general_settings['hitshippo_fedex_shippo_int_key']) || empty($general_settings['hitshippo_fedex_shippo_int_key'])) {
$random_nonce = wp_generate_password(16, false);
set_transient('hitshipo_fedex_express_nonce_temp', $random_nonce, HOUR_IN_SECONDS);
$general_settings['hitshippo_fedex_track_audit'] = sanitize_text_field(isset($_POST['hitshippo_fedex_track_audit']) ? 'yes' : 'no');
$general_settings['hitshippo_fedex_daily_report'] = sanitize_text_field(isset($_POST['hitshippo_fedex_daily_report']) ? 'yes' : 'no');
$general_settings['hitshippo_fedex_monthly_report'] = sanitize_text_field(isset($_POST['hitshippo_fedex_monthly_report']) ? 'yes' : 'no');
$general_settings['hitshippo_fedex_shipo_signup'] = sanitize_text_field(isset($_POST['hitshippo_fedex_shipo_signup']) ? $_POST['hitshippo_fedex_shipo_signup'] : '');
$hitshippo_fedex_shipo_password = sanitize_text_field(isset($_POST['hitshippo_fedex_shipo_password']) ? $_POST['hitshippo_fedex_shipo_password'] : '');
update_option('hitshippo_fedex_main_settings', $general_settings);
$hitshippo_fedex_shipo_password = base64_encode($hitshippo_fedex_shipo_password);
$link_hitshipo_request = json_encode(array(
'site_url' => site_url() . "/wp-json/shipi/connect/fedex",
'site_name' => get_bloginfo('name'),
'email_address' => $general_settings['hitshippo_fedex_shipo_signup'],
'password' => $hitshippo_fedex_shipo_password,
'nonce' => $random_nonce,
'audit' => $general_settings['hitshippo_fedex_track_audit'],
'd_report' => $general_settings['hitshippo_fedex_daily_report'],
'm_report' => $general_settings['hitshippo_fedex_monthly_report'],
'pulgin' => 'FedEx',
'platfrom' => 'Woocommerce',
));
$link_site_url = "https://app.myshipi.com/api/link-site.php";
$link_site_response = wp_remote_post(
$link_site_url,
array(
'method' => 'POST',
'timeout' => 45,
'redirection' => 5,
'httpversion' => '1.0',
'blocking' => true,
'headers' => array('Content-Type' => 'application/json; charset=utf-8'),
'body' => $link_hitshipo_request,
'sslverify' => 0
)
);
$link_site_response = (is_array($link_site_response) && isset($link_site_response['body'])) ? json_decode($link_site_response['body'], true) : array();
if ($link_site_response) {
if ($link_site_response['status'] != 'error') {
$general_settings['hitshippo_fedex_shippo_int_key'] = sanitize_text_field($link_site_response['integration_key']);
update_option('hitshippo_fedex_main_settings', $general_settings);
update_option('hitshipo_fedex_working_status', 'start_working');
$success = 'Site Linked Successfully.
It\'s great to have you here. ' . (isset($link_site_response['trail']) ? 'Your 60days Trail period is started. To know about this more, please check your inbox.' : '') . '
';
} else {
$error = '
' . $link_site_response['message'] . '
'; $success = ''; } } else { $error = 'Failed to connect with Shipi
'; $success = ''; } } } $initial_setup = false; $countries_obj = new WC_Countries(); $default_country = $countries_obj->get_base_country(); $general_settings['hitshippo_fedex_currency'] = isset($general_settings['hitshippo_fedex_currency']) ? $general_settings['hitshippo_fedex_currency'] : (isset($value[$default_country]) ? $value[$default_country]['currency'] : ""); $general_settings['hitshippo_fedex_woo_currency'] = get_option('woocommerce_currency'); $general_settings['hitshippo_fedex_cod'] = isset($general_settings['hitshippo_fedex_cod']) ? $general_settings['hitshippo_fedex_cod'] : 'no'; $general_settings['hitshippo_fedex_etd'] = isset($general_settings['hitshippo_fedex_etd']) ? $general_settings['hitshippo_fedex_etd'] : 'no'; ?>
Here's your personalized guide to get started and streamline your shipping process.
If you get stuck or need any help, feel free to contact us and we will set it up for you.