Reply
Highlighted
Member
Posts: 1
Registered: ‎04-27-2012

Serious bug on authorize.net C# api.

[ Edited ]

Using reflector I see the following code on authorize.net api: 

 public string AddCreditCard(string profileID, string cardNumber, int expirationMonth, int expirationYear, string cardCode, Address billToAddress)
        {
            DateTime time = DateTime.Parse(expirationMonth.ToString() + "-1-" + expirationYear.ToString());
            DateTime time3 = new DateTime(time.Year, time.Month, 1);
            DateTime time2 = time3.AddMonths(1).AddDays(-1.0);
            string str = time2.ToString("yyyy-MM");

 What hapens is that if the api is running on a machine with culture any other than en-us, the string parse game for the dates will fail. This is a very amatour way of processing card data and all developers should be aware of that.

Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Serious bug on authorize.net C# api.

Good catch. But FYI, you can download the C# SDKs source. There are two different zip. Left is the source. Right is the dll.

They should have just use the consturctor

DateTime Constructor (Int32 year, Int32 month, Int32 day)