In the function which receives a Silent Post from Authorize.Net, there is some code that specifically relates to the UC Recurring Fees module. It doesn't make any sense to have it here, especially if other modules take advantage of the Silent Post feature and you don't have UC Recurring Fees installed. In fact, if one does not have UC Recurring Fees installed, several PHP errors will be thrown if accessing the Silent Post URL.

I recommend moving all the UC Recurring Fees specific code out of the Authorize.Net module, and into the UC Recurring Fees module, via hooks.

I'm attaching a patch which cleans up the uc_authorizenet_silent_post() and removes the UC Recurring Fees specific code from it. I need this especially for an Authorize.Net Payment Plan module I'm developing (which will soon be available to the community).

Still to do in this ticket: remove the rest of the UC Recurring Fees code from the Authorize.Net module, and port it to the UC Recurring Fees module. Can anyone do this? I have no experience with the UC Recurring Fees module.

Comments

univate’s picture

Status: Active » Needs review
StatusFileSize
new4.68 KB

Payment gateway specific code doesn't actually belong in uc_recurring, since it is really just an API. But in the case of ubercarts core gateways the decision was made to have a set of include files to support these specific gateways where it was easier to maintain. The auth.net ARB gateway has been a bit of a pain to try and support in uc_recurring so far due to the existing handling of silent posts in ubercart.

The uc_recurring code currently in this module is specific to uc_recurring-1.x and since everyone will probably consider migrating to uc_recurring-2.x at some point it is going to become depreciated at some point anyway. Although since everyone is close to trying to get a stable UC2 released I don't think a change like this should be done without considering everyone already running that version of the module. So I would propose to avoid breaking anyones existing site, that this code remains but only executed if uc_recurring-1.x is installed and also commented that this code should be removed in the future as it is depreciated.

I would also like to propose changing the arb hook from

hook_uc_arb_payment();

to:

hook_uc_auth_arb_payment();

Once again that will not effect anyone running uc_recurring-1.x (as stated without uc_recurring-1.x this block of code doesn't work), but it means that namespace is clear that his hook is for Auth.net ARB (automatic recurring billing) and not another automatic recurring billing gateway, as I have seen the term 'ARB' used in other gateway documentation.

This overall small change would actually also help the development of Authnet ARB support in uc_recurring-2.x

deggertsen’s picture

Subscribe

duellj’s picture

Status: Needs review » Needs work

univate,

Thanks for getting this started; the patch you posted applied and tested fine. There's still a problem in the main uc_authorizenet.module with an implementation of hook_recurring_fee() which doesn't use the $op parameter and calls uc_authorizenet_arb_create() every time hook_recurring_fee is called. Not sure what the best way to account for the API changes in uc_recurring for this call, but it definitely needs to be altered for uc_recurring 2.x

univate’s picture

Status: Needs work » Needs review

@duellj - I have actually already removed that hook_recurring_fee() in the uc_recurring 2.x-dev branch, so that shouldn't cause any problems. What is a problem and makes working on ARB not worth the effort at the moment is this silent post code here and we need a way for ubercart to avoid executing it.

Anyone reviewing this, the guts of this change is just a big conditional if statement around everything that is uc_recurring-1.0 specific that is no longer part of ubercart core.

duellj’s picture

Status: Needs review » Reviewed & tested by the community

@univate: sorry, I wasn't using the most current 2.x-dev branch.

Everything looks good, and hook_uc_auth_arb_payment() was correctly triggered for a silent post request.

Thanks univate!

deggertsen’s picture

I second that. I've tested it and everything appears to be working great! Thanks univate!

univate’s picture

Now that ubercart 2.0 is out can this get a look at?

vitis’s picture

subscribing

BenK’s picture

Subscribing...

jday’s picture

what are the ingredients for a functional site with recurring orders using Authorize.net ARB?
ubercart 6.x-2.2
uc_recurring 6.x-2.x-dev
and this patch?

or not ready for production yet?

univate’s picture

Version: 6.x-2.0-rc7 » 6.x-2.x-dev

Giving this issue another plug... would be good to move this issue along so full support for ARB can exist in uc_recurring that doesn't conflict with the recurring code in the auth.net module.

Island Usurper’s picture

Status: Reviewed & tested by the community » Fixed
StatusFileSize
new4.58 KB

Sounds like a plan. I made a couple of stylistic changes, mostly trimming whitespace. I also used @order_id instead of !order_id just in case.

Committed as attached.

univate’s picture

Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Did anyone ever respond to jday in #10?

marty.true’s picture

Yes, can someone please answer #10 and list a working recipe for ARB recurring fees?
Will switching to Ubercart 6.x-2.x-dev and UC_Recurring 6.x-2.x-dev be enough or are there other patches that need to be applied?

abaddon’s picture

as far as i understand, you need ubercart 2.x-dev or 2.3 whenever thats released, and the current released version of uc_recurring, not necessarily the -dev
but i dont like running on dev's for live client sites, so ive just used the commited patch here and patched ubercart 2.2, if i wont come back with a post, it worked :-)

sansui’s picture

Subscribing to this post :) I hope your non-return means everything worked out great abaddon! I'm looking at using recurring billing for authorize ARB, so the work done in the patch here looks great, and I'm hoping I can patch my 2.2 install without having to go to the dev version (thanks Joel, Univate, Island :) )

jakew’s picture

Did it work to patch 2.2? I also am assuming that it did... I will try it too and post back here yea or nay... may need to remind me though.