2 replies [Last post]
setfree's picture
Offline
Uber Donor
Joined: 12/16/2007
Juice: 436
Was this information Helpful?

I have a customer who has a fair enough request. The "Customer ID" value sent from uc_authorizenet.module to Authorize.net is the Drupal user account number. My customer is using his own business database and every UC customer has been created with his business' customer account number.

I simply need to alter $order before being sent to auth.net in _uc_authorizenet_charge()

I tried using hook_order / submit, but the values are lost before hitting _uc_authorizenet_charge.

I can't use hook_order / save or otherwise save the value to the database because the stored order needs to use the uid for proper tracking and functionality.

So I'm left with a core hack inserting a hook in _uc_authorizenet_charge before the request is formed and sent to auth.net.

Is there any way to achieve this without a hack? If not, any chance (or how do I go about) getting a very useful hook put into uc_authorizenet.module to allow changing some $order values.

Note: this is also very useful for populating customer information from the Drupal profile. I am using this in the hook for first and last names and company name, etc...

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Any way besides core hack to alter order/user values sent to

Hmm, unfortunately there is no way to do this at the moment, and you might say that's a limitation of the credit card system itself which should provide a feature to facilitate this. There's no chance we'll get that into 2.0, so at this point I'd either recommend:

  1. A core hack that you keep around as a patch and re-apply whenever you update the Ubercart install.
  2. A duplicate Auth.Net module that you rename, change all the hooks to, and tweak for your needs.

While option 2 this would be upgrade "safe", it would also lose any benefit of upgrades and bugfixes to the core Auth.Net module that came along. I'd go with option 1 and establish some sort of maintenance contract with your client that includes software updates and patch maintenance.

setfree's picture
Offline
Uber Donor
Joined: 12/16/2007
Juice: 436
Re: Re: Any way besides core hack to alter order/user values sen

Okay, thanks for the info. It's only one small line of code in the hack. I'll do like I've done before and keep a 'hack log' in the site's log and simply reapply the code on next upgrade. Thanks to the flexibility of Drupal and Ubercart this is only the second core hack I've had to do in three years. Not bad. Thanks again Ryan.