paypal/merchant-sdk-dotnet — pull request #6 by ldsenow (2013-02-07 06:39:07+00:00)
Title: EnumUtils.GetValue should ignore casing

Hi,

I made a GetExpressCheckoutDetailsReq request to sandbox api webservice, the response came back successfully, but unfortunately the sdk did not handed it properly, due to the EnumUtils.GetValue function is looking for exact match but could not found a match enum value and the sdk tries to cast the null back to an enum type.

For my case,
PayPalPayPalAPIInterfaceServiceModel.cs line 3779
the this.AddressNormalizationStatus = (AddressNormalizationStatusCodeType)EnumUtils.GetValue(ChildNode.InnerText,typeof(AddressNormalizationStatusCodeType));
throws exception.

Because the response returns a string value "NONE" and the code tries to find an exact match in AddressNormalizationStatusCodeType but the match is not found due to the casing of the string. My guess is if the sdk team change the line 37 of EnumUtils file to

if (GetDescription((Enum)Enum.Parse(enumType, name)).Equals(value, StringComparison.InvariantCultureIgnoreCase))

from

if (GetDescription((Enum)Enum.Parse(enumType, name)).Equals(value))

then problem should be resolved.