I spent some time refactoring more code in Payment Processor (payment-processor). The result is a much more flexible library that developers can extend to meet their own requirements. The library contains a lot of XXInfo classes (where XX is a container category). Example: OrderInfo, ShippingInfo, etc. The old version of the AuthorizeRequest class had a massive constructor that took each XXInfo class. Internally there is a BuildPostString method that calls ToString on each one, which will result in the final POST string that is sent to Authorize.NET. This wasn't very friendly in many ways.
The first problem was usability. The old AuthorizeRequest constructor set was just too big and confusing. Passing in null 5 times looks extremely ugly and was hard to read.
The second issue was the ability to extend the XXInfo classes. There was absolutely no way to extend the POST string if needed and Authorize.NET does allow custom POST strings. So this issue was very critical. A developer can now implement their own XXInfo class by implementing the IInfo interface and passing it into the AuthorizeRequest CTor. It will generate a POST string for Authorize.NET request.
The final problem was the internal code to build the POST string was extremely redundant and very painful on the eyes. The old code for BuildPostString was 50+ lines of code, the new code is roughly 15.
Enjoy 1.10! Feel free to contact me with any questions or comments.
Friday, August 1, 2008
Wednesday, July 9, 2008
Python and C
I don't typically write in C, but lately in my free time at home I have been dabbling in C code. My two favorite dynamic languages are both extensible in C. There have been times my Python code was slow, and I either scrapped the code, or wrote it completely different to avoid the problem entirely. The ability to re-write that method in C would have been handy. This combination gives the quick development time of a dynamic language, and the speed of C. Next time I will be prepared.
Here is a great article for extending ruby in C:
http://www.onlamp.com/pub/a/onlamp/2004/11/18/extending_ruby.html
For Python:
http://docs.python.org/ext/ext.html
and
http://docs.python.org/api/api.html
Here is a great article for extending ruby in C:
http://www.onlamp.com/pub/a/onlamp/2004/11/18/extending_ruby.html
For Python:
http://docs.python.org/ext/ext.html
and
http://docs.python.org/api/api.html
Monday, June 9, 2008
Finally Moved In
This past month has been very busy. My wife and I just purchased our first home. We moved in on June 2nd, and are finally getting all of the boxes unpacked. I think I under-estimated how much work is involved. With an apartment, you can call your maintenance guy when something goes wrong. Boy am I going to miss those days! I am, however, enjoying the piece and quiet.
Friday, May 30, 2008
PaymentProcessor
I just finished version 1.0 of payment-processor. It is a C# library to communicate with Authorize.NET via their AIM integration. The library has support for ECHECK as well. ARB will be supported in later releases. I am pretty excited about this project. I am using the library in one of our internal applications here at Mission3. We have decided to release the library as open-source under the MIT license. Head over to Google code and check it out!
http://code.google.com/p/payment-processor/
http://code.google.com/p/payment-processor/
Subscribe to:
Posts (Atom)