开发人员在我们网站上提供的代码包含一堆快递(非运费)服务类型。我只需要在我的网站上实施联邦快递运费,开发商已经对我不利。任何帮助将不胜感激。
if($cominfo[0]['companyNAME'] == "FedEx" && $rescar12[0]['login']!="" && $rescar12[0]['carpassword']!="" && $rescar12[0]['accountNUMBER']!="" && $rescar12[0]['accesskey']!="" && $rescar12[0]['meterkey']!=""){
/*$fedx_accountnumber = $rescar12[0]['accountNUMBER'];
$fedex_meterkey = $rescar12[0]['meterkey'];
$fedex_freightAccount = $rescar12[0]['meterkey'];
$fedex_accessKey = $rescar12[0]['meterkey'];
$fedex_productionPassword = $rescar12[0]['meterkey'];*/
echo '<pre>';
print_r($_SESSION['order']);
$fedx_accountnumber = 'account number';
$fedex_meterkey = 'meter key';
$fedex_freightAccount = 'freight account';
$fedex_accessKey = 'secret access key';
$fedex_productionPassword = 'secret password';
//$services1['fedex']['STANDARDOVERNIGHT'] = 'Standard Overnight';
if($_SESSION['order'][$counter]['weight_unit'] != "lb"){
$weight= convert_weight($_SESSION['order'][$counter]['weight'],$_SESSION['order'][$counter]['weight_unit'],'lb');
$weight_units = 'LB';
} else{
$weight = $_SESSION['order'][$counter]['weight'] ;
$weight_units = $_SESSION['order'][$counter]['weight_unit'];
}
// Services
$services = $services1;
// Weight
$weight = $_SESSION['order'][$counter]['weight']; // Default = 1
$weight_units = $_SESSION['order'][$counter]['weight_unit']; // lb (default), oz, gram, kg
// Size
$size_length = $_SESSION['order'][$counter]['len_gth']; // Default = 8
$size_width = $_SESSION['order'][$counter]['width']; // Default = 4
$size_height = $_SESSION['order'][$counter]['height']; // Default = 2
$size_units = $_SESSION['order'][$counter]['dimesions']; // in (default), feet, cm
$role = $_SESSION['order'][$counter]['role'];
// From
$from_zip = $_SESSION['order'][$counter]['f_zipcode'];
$from_state = $_SESSION['order'][$counter]['f_stateID']; // Only Required for FedEx
$from_country = $_SESSION['order'][$counter]['f_countryID'];
$from_city = $_SESSION['order'][$counter]['f_cityID'];
// To
$to_zip = $_SESSION['order'][$counter]['t_zipcode'];
$to_state = $_SESSION['order'][$counter]['t_stateID']; // Only Required for FedEx
$to_country = $_SESSION['order'][$counter]['t_countryID'];
$to_city = $_SESSION['order'][$counter]['t_cityID'];
require_once "library/fedex-common.php";
//Please include and reference in $path_to_wsdl variable.
$path_to_wsdl = "wsdl/RateService_v14.wsdl";
ini_set("soap.wsdl_cache_enabled", "0");
$client = new SoapClient($path_to_wsdl, array('trace' => 1)); // Refer to http://us3.php.net/manual/en/ref.soap.php for more information
$request['WebAuthenticationDetail'] = array(
'UserCredential' =>array(
'Key' => getProperty('key'),
'Password' => getProperty('password')
)
);
$request['ClientDetail'] = array(
'AccountNumber' => getProperty('shipaccount'),
'MeterNumber' => getProperty('meter')
);
$request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request v14 using PHP ***');
$request['Version'] = array(
'ServiceId' => 'crs',
'Major' => '14',
'Intermediate' => '0',
'Minor' => '0'
);
$request['ReturnTransitAndCommit'] = true;
$request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP'; // valid values REGULAR_PICKUP, REQUEST_COURIER, ...
$request['RequestedShipment']['ShipTimestamp'] = date('c');
$request['RequestedShipment']['ServiceType'] = 'FEDEX_FREIGHT_ECONOMY'; // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
$request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING'; // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
$request['RequestedShipment']['Shipper'] = getProperty('freightbilling');
$request['RequestedShipment']['Recipient'] = addRecipient();
$request['RequestedShipment']['ShippingChargesPayment'] = addShippingChargesPayment();
$request['RequestedShipment']['FreightShipmentDetail'] = array(
'FedExFreightAccountNumber' => getProperty('freightaccount'),
'FedExFreightBillingContactAndAddress' => getProperty('freightbilling'),
'Role' =>$role,
'PaymentType' => 'PREPAID',
'LineItems' => array(
'FreightClass' => 'CLASS_0'.$_SESSION['order'][$counter]['class'],
'Weight' => array(
'Value' => $weight,
'Units' => $weight_units,
),
'Dimensions' => array(
'Length' => $size_length,
'Width' => $size_width,
'Height' => $size_height,
'Units' => $size_units
),
)
);
$request['RequestedShipment']['RateRequestTypes'] = 'ACCOUNT';
$request['RequestedShipment']['RateRequestTypes'] = 'LIST';
$request['RequestedShipment']['PackageCount'] = '1';
try{
if(setEndpoint('changeEndpoint')){
$newLocation = $client->__setLocation(setEndpoint('endpoint'));
}
$response = $client -> getRates($request);
echo '<pre>';
print_r($response);
exit;
if ($response -> HighestSeverity != 'FAILURE' && $response -> HighestSeverity != 'ERROR'){
echo $rateReply = $response -> RateReplyDetails->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount;
// printSuccess($client, $response);
}else{
echo $rateReply ='N/A';
//printError($client, $response);
}
//writeToLog($client); // Write to log file
} catch (SoapFault $exception) {
printFault($exception, $client);
}
$_SESSION['FedEx'][$counter]['price'] = $rateReply;
}