-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding stamps and refactoring some of the fedex
- Loading branch information
Showing
67 changed files
with
2,252 additions
and
1,151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,138 +1,135 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.Globalization; | ||
|
||
namespace EasyKeys.Shipping.Abstractions | ||
namespace EasyKeys.Shipping.Abstractions.Models; | ||
|
||
public class Address | ||
{ | ||
public class Address | ||
public Address() | ||
{ | ||
public Address() | ||
{ | ||
} | ||
} | ||
|
||
public Address( | ||
string city, | ||
string stateOrProvince, | ||
string postalCode, | ||
string countryCode) | ||
: this(string.Empty, string.Empty, city, stateOrProvince, postalCode, countryCode) | ||
{ | ||
} | ||
public Address( | ||
string city, | ||
string stateOrProvince, | ||
string postalCode, | ||
string countryCode) | ||
: this(string.Empty, string.Empty, city, stateOrProvince, postalCode, countryCode) | ||
{ | ||
} | ||
|
||
public Address( | ||
string streetLine, | ||
string city, | ||
string stateOrProvince, | ||
string postalCode, | ||
string countryCode) | ||
: this(streetLine, string.Empty, city, stateOrProvince, postalCode, countryCode) | ||
{ | ||
} | ||
public Address( | ||
string streetLine, | ||
string city, | ||
string stateOrProvince, | ||
string postalCode, | ||
string countryCode) | ||
: this(streetLine, string.Empty, city, stateOrProvince, postalCode, countryCode) | ||
{ | ||
} | ||
|
||
public Address( | ||
string streetLine, | ||
string city, | ||
string stateOrProvince, | ||
string postalCode, | ||
string countryCode, | ||
bool isResidential) | ||
: this(streetLine, string.Empty, city, stateOrProvince, postalCode, countryCode, isResidential) | ||
{ | ||
} | ||
public Address( | ||
string streetLine, | ||
string city, | ||
string stateOrProvince, | ||
string postalCode, | ||
string countryCode, | ||
bool isResidential) | ||
: this(streetLine, string.Empty, city, stateOrProvince, postalCode, countryCode, isResidential) | ||
{ | ||
} | ||
|
||
public Address( | ||
string streetLine, | ||
string streetLine1, | ||
string city, | ||
string stateOrProvince, | ||
string postalCode, | ||
string countryCode, | ||
bool isResidential = false) | ||
{ | ||
StreetLine = streetLine; | ||
StreetLine2 = streetLine1; | ||
City = city; | ||
StateOrProvince = stateOrProvince; | ||
PostalCode = postalCode; | ||
CountryCode = countryCode; | ||
IsResidential = isResidential; | ||
} | ||
public Address( | ||
string streetLine, | ||
string streetLine1, | ||
string city, | ||
string stateOrProvince, | ||
string postalCode, | ||
string countryCode, | ||
bool isResidential = false) | ||
{ | ||
StreetLine = streetLine; | ||
StreetLine2 = streetLine1; | ||
City = city; | ||
StateOrProvince = stateOrProvince; | ||
PostalCode = postalCode; | ||
CountryCode = countryCode; | ||
IsResidential = isResidential; | ||
} | ||
|
||
public string City { get; set; } = string.Empty; | ||
public string City { get; set; } = string.Empty; | ||
|
||
public string CountryCode { get; set; } = string.Empty; | ||
public string CountryCode { get; set; } = string.Empty; | ||
|
||
public string CountryName { get; set; } = string.Empty; | ||
public string CountryName { get; set; } = string.Empty; | ||
|
||
public string StreetLine { get; set; } = string.Empty; | ||
public string StreetLine { get; set; } = string.Empty; | ||
|
||
public string StreetLine2 { get; set; } = string.Empty; | ||
public string StreetLine2 { get; set; } = string.Empty; | ||
|
||
public string PostalCode { get; set; } = string.Empty; | ||
public string PostalCode { get; set; } = string.Empty; | ||
|
||
public string StateOrProvince { get; set; } = string.Empty; | ||
public string StateOrProvince { get; set; } = string.Empty; | ||
|
||
public bool IsResidential { get; set; } | ||
public bool IsResidential { get; set; } | ||
|
||
public string GetCountryName() | ||
public string GetCountryName() | ||
{ | ||
if (!string.IsNullOrEmpty(CountryName)) | ||
{ | ||
if (!string.IsNullOrEmpty(CountryName)) | ||
{ | ||
return CountryName; | ||
} | ||
|
||
if (string.IsNullOrEmpty(CountryCode)) | ||
{ | ||
return string.Empty; | ||
} | ||
|
||
var countryCode = CountryCode; | ||
|
||
// UK = GB United Kingdom | ||
// EI = IE Ireland | ||
// FX = FR France, Metropolitan | ||
if (string.Equals(countryCode, "UK", StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
countryCode = "GB"; | ||
} | ||
|
||
if (string.Equals(countryCode, "EI", StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
countryCode = "IE"; | ||
} | ||
|
||
if (string.Equals(countryCode, "FX", StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
countryCode = "FR"; | ||
} | ||
|
||
try | ||
{ | ||
var regionInfo = new RegionInfo(countryCode); | ||
return regionInfo.EnglishName; | ||
} | ||
catch | ||
{ | ||
// causes the whole application to crash. | ||
} | ||
return CountryName; | ||
} | ||
|
||
if (string.IsNullOrEmpty(CountryCode)) | ||
{ | ||
return string.Empty; | ||
} | ||
|
||
public bool IsCanadaAddress() | ||
var countryCode = CountryCode; | ||
|
||
// UK = GB United Kingdom | ||
// EI = IE Ireland | ||
// FX = FR France, Metropolitan | ||
if (string.Equals(countryCode, "UK", StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
countryCode = "GB"; | ||
} | ||
|
||
if (string.Equals(countryCode, "EI", StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
return !string.IsNullOrEmpty(CountryCode) && string.Equals(CountryCode, "CA", StringComparison.OrdinalIgnoreCase); | ||
countryCode = "IE"; | ||
} | ||
|
||
/// <summary> | ||
/// Returns true if the CountryCode matches US or one of the US territories. | ||
/// </summary> | ||
/// <returns></returns> | ||
public bool IsUnitedStatesAddress() | ||
if (string.Equals(countryCode, "FX", StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
var usAndTerritories = new List<string> { "AS", "GU", "MP", "PR", "UM", "VI", "US" }; | ||
countryCode = "FR"; | ||
} | ||
|
||
return usAndTerritories.Contains(CountryCode); | ||
try | ||
{ | ||
var regionInfo = new RegionInfo(countryCode); | ||
return regionInfo.EnglishName; | ||
} | ||
catch | ||
{ | ||
// causes the whole application to crash. | ||
} | ||
|
||
return string.Empty; | ||
} | ||
|
||
public bool IsCanadaAddress() | ||
{ | ||
return !string.IsNullOrEmpty(CountryCode) && string.Equals(CountryCode, "CA", StringComparison.OrdinalIgnoreCase); | ||
} | ||
|
||
/// <summary> | ||
/// Returns true if the CountryCode matches US or one of the US territories. | ||
/// </summary> | ||
/// <returns></returns> | ||
public bool IsUnitedStatesAddress() | ||
{ | ||
var usAndTerritories = new List<string> { "AS", "GU", "MP", "PR", "UM", "VI", "US" }; | ||
|
||
return usAndTerritories.Contains(CountryCode); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
src/EasyKeys.Shipping.Abstractions/Models/CollectOnDelivery.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.