I'm thinking of taking a page from the uc_authnet project, and rewriting parts of the uc_cim module to work with the SDK that is available from the developer.authorize.net site: http://developer.authorize.net/downloads/
Pro: It makes life much easier when attempting to communicate with the Authorize API, in that we don't have to write our own http requests.
Con: It means site admins need to download the library to a specific location; it also requires SimpleXML be installed on a server.
Thoughts? Should I abandon this work (I've already started working on it for the "Manage credit cards" area) or keep going? I think SimpleXML is a relatively minor requirement to make, and downloading libraries for modules to work (due to licensing) is fairly common nowadays.
Feedback appreciated!
Comments
Comment #1
Jztinfinity commentedI'd say yes.
1. It allows easy integration into system's where you're already using the PHP SDK and you want to use this module for a new form, but not necessarily rewrite your old code (or not necessarily rewrite it yet), especially when that code might be outside Drupal
2. Whenever authorize.net's api changes, chances are the official PHP SDK will minimize the changes to code using current features while enabling the new features
3. Outside code which uses the SDK can be adapted into your module, nice thing about open source is you can always pull apart someone else's work and feast on the innards
4. Most servers have SimpleXML, I believe you actually need to disable it from the standard PHP build, and I think downloading the extra library isn't a huge burden, also I think admins running ecommerce sites which use authorize.net probably are at least a notch above beginners and so probably have downloaded extra libraries for other projects anyways (although, one way to avoid downloading to a specific location is to use $location = variable_get('authorizenet_library_path','sites/all/modules/authorizenet/phpsdk'); or something of the like. For my projects I've started using abstracted paths like that and I think it's useful just in case there's some complication to using the presumed location. Alternatively, I wonder if you can use the Libraries API for this purpose http://drupal.org/project/libraries
Comment #2
torgospizzaThanks for the feedback! I'm looking at the Libraries module now. Seems it'd make integration and reusability much easier.
Comment #3
m.stentaWhat's the status on this?
@torgosPizza: do you have the code you started working on for this?
Comment #4
m.stentaI've begun working on this. I think it makes a lot of sense, and the dependencies are not an issue, in my opinion. This is the RIGHT way to do it.
Ultimately, it would be even better if the Authorize.net API existed as a separate module altogether, independent of Ubercart, Commerce, and any other modules that need to use it (ie: Payment API). There is a module called simply "authorizenet" already, which is specific to the Payment API project. I posted a question to the maintainer to see what they would think about combining efforts in some way: #1650760: Why not use SDK?
For now I'm just going to write it as part of the uc_cim module, but do so in a way that makes it easy to break out into it's own module in the future.
Comment #5
m.stentaUpdate: this is coming along nicely. I think there's potential to clean up a lot of the existing code in uc_cim. The plan is basically to write all the necessary wrapper functions for Authorize.net SDK calls, which will exist alongside the original code (in a separate file for organization). Then, when those are ready, I'll go back through the existing code, and replace the old code with the new wrapper functions.
Nothing is committed yet. I've just been working on it in my local repository. Stay tuned for updates...
Comment #6
m.stentaWe've written a new generic Authorize.net API module that utilizes the official SDK. It is available here: http://drupal.org/project/authnet
Next step is to make it a dependency of uc_cim to replace the API functions that it provides.