Skip to content

Commit

Permalink
add origin country code to UPSProvider [closes #52]
Browse files Browse the repository at this point in the history
  • Loading branch information
kylewest committed Sep 29, 2016
1 parent e3d249b commit d59d3fc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions DotNetShipping.Tests/Features/UPSRates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,29 @@ public void UPS_Returns_Multiple_Rates_When_Using_Valid_Addresses_For_All_Servic
}
}

[Fact]
public void UPS_Returns_Rates_When_Using_International_Origin_And_Destination_Addresses_For_All_Services()
{
var rateManager = new RateManager();
rateManager.AddProvider(new UPSProvider(UPSLicenseNumber, UPSUserId, UPSPassword));

var response = rateManager.GetRates(InternationalAddress2, InternationalAddress1, Package1);

Debug.WriteLine(string.Format("Rates returned: {0}", response.Rates.Any() ? response.Rates.Count.ToString() : "0"));

Assert.NotNull(response);
Assert.NotEmpty(response.Rates);
Assert.Empty(response.ServerErrors);

foreach (var rate in response.Rates)
{
Assert.NotNull(rate);
Assert.True(rate.TotalCharges > 0);

Debug.WriteLine(rate.Name + ": " + rate.TotalCharges);
}
}

[Fact]
public void UPS_Returns_Rates_When_Using_International_Destination_Addresses_For_All_Services()
{
Expand Down
1 change: 1 addition & 0 deletions DotNetShipping/ShippingProviders/UPSProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ private byte[] BuildRatesRequestMessage()
}
writer.WriteStartElement("Address");
writer.WriteElementString("PostalCode", Shipment.OriginAddress.PostalCode);
writer.WriteElementString("CountryCode", Shipment.OriginAddress.CountryCode);
writer.WriteEndElement(); // </Address>
writer.WriteEndElement(); // </Shipper>
writer.WriteStartElement("ShipTo");
Expand Down

0 comments on commit d59d3fc

Please sign in to comment.