Thursday, May 19, 2011

ASPDNSF + QuickBooks Gateway + Zip 5-4 = Error

Version: AspDotNetStorefront 8.0.1.2

Problem:

Billing addresses with zip 5-4 e.g. 90019-5929 causes the QuickBooks gateway to error with the following message: The string X in the field CreditCardPostalCode is too long. The maximum length is 9.

Solution:

In file: \ASPDNSFGateways\QBMerchantServices.cs make the following modification:

//mod start Aydus 5/09/2011: Strip any non-numeric characters from zip. e.g. dash when address validation turned on.
System.Text.RegularExpressions.Regex nonNumericCharacters = new System.Text.RegularExpressions.Regex(@"[^0-9]");
creditCard.BillingPostalCode = nonNumericCharacters.Replace(UseBillingAddress.Zip, String.Empty);
//creditCard.BillingPostalCode = UseBillingAddress.Zip;
//mod end

No comments:

Post a Comment