使用此软件包,DotNetShipping和我的FedEx费率(我还没有使用任何其他提供商)总是空的。做了一些谷歌搜索,我没有得到任何答案。
.NET 4
测试代码:
public string fedexKey = ConfigurationManager.AppSettings["FedExKey"];
public string fedexPassword = ConfigurationManager.AppSettings["FedExPassword"];
public string fedexAccountNumber = ConfigurationManager.AppSettings["FedExAccountNumber"];
public string fedexMeterNumber = ConfigurationManager.AppSettings["FedExMeterNumber"];
public decimal Test()
{
var packages = new List<Package>();
packages.Add(new Package(12, 12, 12, 35, 150));
packages.Add(new Package(4, 4, 6, 15, 250));
var origin = new DotNetShipping.Address("address here", string.Empty, string.Empty, "Cary", "North Carolina", "27513", "US");
var destination = new DotNetShipping.Address("address here", string.Empty, string.Empty, "Smyrna", "Georgia", "30082", "US"); // US Address
var rateManager = new RateManager();
rateManager.AddProvider(new FedExProvider(fedexKey, fedexPassword, fedexAccountNumber, fedexMeterNumber));
DotNetShipping.Shipment shipment = rateManager.GetRates(origin, destination, packages);
foreach (Rate rate in shipment.Rates) // Rates are empty
{
var p = rate;
}
return 0;
}
我确实有FedEx API的文档,我查看了包中的code,它看起来很相似。
如果有更好的 免费 运费率套餐,我也会尝试使用它。
答案 0 :(得分:2)
下载源代码并对其进行调试后,请务必注意,在进行测试时,请将<?php widget('CJuiDateTimePicker',array('id'=>'recalldate','name'=>'Time','attribute'=>'eventDate',
'mode'=>'datetime',
'language'=> Yii::app()->request->cookies['language'] == 'en' ? 'en-GB' : Yii::app()->request->cookies['language'],
'options'=>array('changeMonth'=>'true',
'changeYear'=>'true',
'minDate'=>'0',
'yearRange' => '+0:+4',
'showAnim'=>'fold',
'dateFormat'=>'yy-mm-dd',
'value'=>date('yy-mm-dd'),
'theme'=>'redmond',
),
'htmlOptions'=> array('disabled'=>'disabled')
// jquery plugin options
));?>
设置为useProduction
= \
false