c# - DotNetShipping rates are always empty - FedEx -
using package, dotnetshipping, , rates fedex (i haven't used other providers) empty. did googling , didn't come w/ answers.
.net 4
- address 1 (first parameter address object) have valid address.
- no errors.
- fedex account has been created , (4) variables web.config have correct values.
testing code:
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"); // 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 empty { var p = rate; } return 0; }
i have documentation fedex's api, , looked on code package , looks similar.
if there's better free shipping rate package out there attempt use well.
after downloading source code , debugging it, it's important note when you're testing, set useproduction
false
=\
ratemanager.addprovider(new fedexprovider(fedexkey, fedexpassword, fedexaccountnumber, fedexmeternumber, false));
Comments
Post a Comment